21 #ifndef POORMAN_OSTREAM_HPP_INCLUDED 22 #define POORMAN_OSTREAM_HPP_INCLUDED 24 #include <type_traits> 31 static char nibble(
unsigned val) {
33 return val < 10 ?
'0' + val :
'a' + val - 10;
47 template<
typename valT>
48 typename std::enable_if<std::is_integral<valT>::value,
ostream &>::type
51 for(
int i =
sizeof(valT) * 8 - 4; i >= 0; i -= 4) {
52 st.
put(nibble(val >> i));
81 #endif // POORMAN_OSTREAM_HPP_INCLUDED virtual ostream & write(const char_type *s, unsigned int count)=0
virtual ostream & puts(const char_type *s)=0
Definition: poorman_ostream.hpp:29
virtual ostream & flush()=0
virtual ostream & put(char_type c)=0
std::enable_if< std::is_integral< valT >::value, ostream & >::type friend operator<<(ostream &st, valT val)
hexadecimal output of any integral type
Definition: poorman_ostream.hpp:49
friend ostream & operator<<(ostream &st, const char *s)
Definition: poorman_ostream.hpp:57
Definition: poorman_cstring.hpp:26
fifoT::char_type char_type
Definition: poorman_ostream.hpp:37
ostream & operator<<(ostream &(*func)(ostream &))
Definition: poorman_ostream.hpp:62
virtual ostream & endl()=0