00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00022 #ifndef LIBCWD_BUF2STR_H
00023 #define LIBCWD_BUF2STR_H
00024
00025 #ifndef LIBCWD_CHAR2STR_H
00026 #include <libcwd/char2str.h>
00027 #endif
00028 #ifndef LIBCW_CSTDDEF
00029 #define LIBCW_CSTDDEF
00030 #include <cstddef>
00031 #endif
00032 #ifndef LIBCW_IOSFWD
00033 #define LIBCW_IOSFWD
00034 #include <iosfwd>
00035 #endif
00036
00037 namespace libcwd {
00038
00062 class buf2str {
00063 private:
00064 char const* M_buf;
00065 size_t M_size;
00066
00067 public:
00069 buf2str(char const* buf, size_t size) : M_buf(buf), M_size(size) { }
00070
00075 friend
00076 __inline__
00077 std::ostream&
00078 operator<<(std::ostream& os, buf2str const& __buf2str)
00079 {
00080 size_t size = __buf2str.M_size;
00081 for (char const* p1 = __buf2str.M_buf; size > 0; --size, p1++)
00082 os << char2str(*p1);
00083 return os;
00084 }
00085 };
00086
00087 }
00088
00089 #endif // LIBCWD_BUF2STR_H