Main Page   Reference Manual   Namespace List   Compound List   Namespace Members   Compound Members   File Members  

/usr/src/libcwd/libcwd/include/libcwd/buf2str.h

Go to the documentation of this file.
00001 // $Header: /cvsroot/libcwd/libcwd/include/libcwd/buf2str.h,v 1.6 2004/07/14 00:29:35 libcw Exp $
00002 //
00003 // Copyright (C) 2000 - 2004, by
00004 // 
00005 // Carlo Wood, Run on IRC <carlo@alinoe.com>
00006 // RSA-1024 0x624ACAD5 1997-01-26                    Sign & Encrypt
00007 // Fingerprint16 = 32 EC A7 B6 AC DB 65 A6  F6 F6 55 DD 1C DC FF 61
00008 //
00009 // This file may be distributed under the terms of the Q Public License
00010 // version 1.0 as appearing in the file LICENSE.QPL included in the
00011 // packaging of this file.
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>              // Needed for size_t
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 } // namespace libcwd
00088 
00089 #endif // LIBCWD_BUF2STR_H
Copyright © 2001 - 2004 Carlo Wood.  All rights reserved.