libcsdbg  1.28
C++ exception (and generic) stack trace debug library
csdbg::streambuf Class Referenceabstract

This abstract class is the base for all buffered output stream types (for files, sockets, serial interfaces e.t.c) More...

#include <streambuf.hpp>

+ Inheritance diagram for csdbg::streambuf:
+ Collaboration diagram for csdbg::streambuf:

Public Member Functions

 streambuf ()
 Object default constructor. More...
 
 streambuf (const streambuf &)
 Object copy constructor. More...
 
virtual ~streambuf ()=0
 To be implemented. More...
 
virtual streambufclone () const =0
 To be implemented. More...
 
virtual i32 handle () const
 Get the handle. More...
 
virtual bool is_opened () const
 Check if the stream is opened for output. More...
 
virtual streambufoperator= (const streambuf &)
 Assignment operator. More...
 
virtual streambufopen ()=0
 To be implemented. More...
 
virtual streambufclose ()
 Close the stream. More...
 
virtual streambufflush ()=0
 To be implemented. More...
 
virtual streambufsync () const =0
 To be implemented. More...
 
virtual streambuflock () const
 Lock the stream (exclusively) More...
 
virtual streambufunlock () const
 Unlock the stream. More...
 
virtual streambufheader ()
 Append LDP headers to the buffer. More...
 
- Public Member Functions inherited from csdbg::string
 string (u32=0)
 Object constructor. More...
 
 string (const i8 *,...)
 Object constructor. More...
 
 string (const string &)
 Object copy constructor. More...
 
virtual ~string ()
 Object destructor. More...
 
virtual const i8cstr () const
 Get the C-string equivalent. More...
 
virtual u32 length () const
 Get the character count. More...
 
virtual u32 bufsize () const
 Get the buffer size. More...
 
virtual i8at (u32)
 Get/set the character at an offset. More...
 
virtual stringset (const i8 *,...)
 Fill with a printf-style format C-string expanded with the values of a variable argument list. More...
 
virtual stringset (const string &)
 Copy a string. More...
 
virtual stringoperator= (const string &)
 Assignment operator. More...
 
virtual stringoperator+= (const string &)
 Compound addition-assignment operator (append) More...
 
virtual i8operator[] (u32)
 Subscript operator. More...
 
virtual u32 available () const
 Get the available buffer size, the number of characters that can be appended without reallocation. More...
 
virtual stringshred (u8=0)
 Fill the whole buffer with a constant byte. More...
 
virtual stringclear ()
 Clear contents. More...
 
virtual stringappend (const string &)
 Append a string. More...
 
virtual stringappend (const i8 *,...)
 Append a printf-style format C-string expanded with the values of a variable argument list. More...
 
virtual stringappend (i8)
 Append a character. More...
 
virtual i32 cmp (const string &, bool=false) const
 Compare to another string. More...
 
virtual bool match (const string &, bool=false) const
 Match against a POSIX extended regular expression. More...
 
virtual stringtrim (i32=0)
 Remove leading and/or trailing whitespace characters. More...
 
virtual stringinsert (u32, const string &)
 Insert a string at a specified position. More...
 
virtual stringinsert (u32, const i8 *,...)
 Insert a printf-style format C-string expanded with the values of a variable argument list, at a specified position. More...
 
virtual chain< string > * split (const string &, bool=true, bool=false) const
 Tokenize using a POSIX extended regular expression. More...
 
- Public Member Functions inherited from csdbg::object
virtual ~object ()=0
 To be implemented. More...
 
virtual const i8class_name () const
 Query the class name of an object descending from csdbg::object. More...
 

Protected Attributes

i32 m_handle
 Stream handle (descriptor) More...
 
- Protected Attributes inherited from csdbg::string
i8m_data
 String data. More...
 
u32 m_length
 Character count. More...
 
u32 m_size
 Buffer size. More...
 

Additional Inherited Members

- Protected Member Functions inherited from csdbg::string
virtual stringmemalign (u32, bool=false)
 Allocate aligned memory, mandate a minimum buffer size. More...
 
virtual stringformat (const i8 *, va_list)
 Fill with a printf-style format C-string expanded with the values of a variable argument list. More...
 

Detailed Description

This abstract class is the base for all buffered output stream types (for files, sockets, serial interfaces e.t.c)

Subclassing class streambuf is the standard way to create objects that output trace and other data to various media. A streambuf-derived object is both a string buffer and an output stream for any type of media that can be accessed using an integer descriptor/handle. Currently, libcsdbg is shipped with three streambuf implementations, csdbg::filebuf for files, csdbg::tcpsockbuf for TCP/IP sockets and csdbg::sttybuf for serial interfaces. Class streambuf is not thread safe, but it implements basic stream locking. The buffer part of the object can be manipulated using the methods inherited from csdbg::string. For example if you need to copy only the buffer from one object to another (even of different types) use the string::set(const string&) method instead of the overloaded assignment operator

See Also
5.4 LDP (Libcsdbg Debug Protocol)
5.5 Buffered output streams
Todo:

[ ? ] Implement the udpsockbuf subclass

[ ? ] Add method try_lock

Definition at line 37 of file streambuf.hpp.


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