ders::text_buf Class Reference

Helper class for text concatenation and built-in types conversion. More...

#include <text_buf.hpp>

List of all members.

Public Member Functions

 text_buf (mem_pool &mp, int rsv=1024)
 text_buf (sh_text sht, int rsv=1024)
text_bufoperator+ (const ch_rng &r)
text_bufoperator+ (char byte)
text_bufoperator+ (bool val)
text_bufoperator+ (int val)
text_bufoperator+ (unsigned val)
text_bufoperator+ (long val)
text_bufoperator+ (unsigned long val)
text_bufoperator+ (const char *str)
text_bufoperator+ (void *ptr)
 operator const sh_text & () const
 operator ch_rng () const
int size () const


Detailed Description

Helper class for text concatenation and built-in types conversion.

Definition at line 26 of file text_buf.hpp.


Constructor & Destructor Documentation

ders::text_buf::text_buf ( mem_pool mp,
int  rsv = 1024 
) [inline, explicit]

Definition at line 54 of file text_buf.hpp.

00054                                                : txt(nt(mp))
00055 { txt->reserve(rsv); }

ders::text_buf::text_buf ( sh_text  sht,
int  rsv = 1024 
) [inline, explicit]

Definition at line 57 of file text_buf.hpp.

00057                                               : txt(nt(sht.pool(), sht))
00058 { txt->reserve(rsv); }


Member Function Documentation

text_buf & ders::text_buf::operator+ ( const ch_rng r  )  [inline]

Definition at line 60 of file text_buf.hpp.

00061 {
00062  txt->append(r);
00063  return *this;
00064 }

text_buf & ders::text_buf::operator+ ( char  byte  )  [inline]

Definition at line 66 of file text_buf.hpp.

00067 {
00068  txt->append(byte);
00069  return *this;
00070 }

text_buf & ders::text_buf::operator+ ( bool  val  )  [inline]

Definition at line 72 of file text_buf.hpp.

00073 { return *this+(val? "true" : "false"); }

text_buf & ders::text_buf::operator+ ( int  val  ) 

Definition at line 20 of file text_buf.cpp.

00021 {
00022  char buf[25];
00023  return *this+ch_rng(buf, buf+sprintf(buf, "%d", val));
00024 }

text_buf & ders::text_buf::operator+ ( unsigned  val  ) 

Definition at line 26 of file text_buf.cpp.

00027 {
00028  char buf[25];
00029  return *this+ch_rng(buf, buf+sprintf(buf, "%u", val));
00030 }

text_buf & ders::text_buf::operator+ ( long  val  ) 

Definition at line 32 of file text_buf.cpp.

00033 {
00034  char buf[50];
00035  return *this+ch_rng(buf, buf+sprintf(buf, "%ld", val));
00036 }

text_buf & ders::text_buf::operator+ ( unsigned long  val  ) 

Definition at line 38 of file text_buf.cpp.

00039 {
00040  char buf[50];
00041  return *this+ch_rng(buf, buf+sprintf(buf, "%lu", val));
00042 }

text_buf & ders::text_buf::operator+ ( const char *  str  )  [inline]

Definition at line 75 of file text_buf.hpp.

00076 { return *this+ch_rng(str); }

text_buf & ders::text_buf::operator+ ( void *  ptr  ) 

Definition at line 44 of file text_buf.cpp.

00045 {
00046  char buf[25];
00047  return *this+ch_rng(buf, buf+sprintf(buf, "%p", ptr));
00048 }

ders::text_buf::operator const sh_text & (  )  const [inline]

Definition at line 48 of file text_buf.hpp.

00048 { return txt; }

ders::text_buf::operator ch_rng (  )  const [inline]

Definition at line 49 of file text_buf.hpp.

00049 { return ch_rng(txt); }

int ders::text_buf::size (  )  const [inline]

Definition at line 51 of file text_buf.hpp.

00051 { return txt->size(); }


The documentation for this class was generated from the following files:

Generated on Tue Dec 8 11:35:33 2009 for derslib by  doxygen 1.5.5