Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

StringTreeDump Class Reference

Expandable, indent-capable, (alloc-ahead) string buffer for tree node dump. More...

#include <strtreedump.h>

Collaboration diagram for StringTreeDump:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 StringTreeDump ()
 Create empty string tree dump.

 ~StringTreeDump ()
 Destroy thereby freeing data.

void AddIndent (int n=1)
 Change indent: Increase it by passed amount.

void SubIndent (int n=1)
 Change indent: Decrease it by passed amount.

bool IndentJustAdded () const
 Was the indent just increased?

void append (const TLString &str)
 Append string to the dump:.

StringTreeDumpoperator+= (const TLString &str)
 Append string to the dump:.

void RemoveEnd (char c)
 Remove the passed character if that char is at the end of the dump:.

size_t write (FILE *fp, int indent_size=4, char indent_char=' ')
 Write the complete string representation to a FILE *.


Private Member Functions

 StringTreeDump (const StringTreeDump &)
 Do not use:.

void operator= (const StringTreeDump &)
 Do not use:.


Private Attributes

LinkedList< Entryents
int curr_indent
bool indent_just_added

Detailed Description

Expandable, indent-capable, (alloc-ahead) string buffer for tree node dump.

Author:
Wolfgang Wieser ] wwieser (a) gmx <*> de [
This class can be used to get a string representation of a whole tree by simply adding string text for each node. Upon recursion, the indention counter can be increased and decreased when coming up again resulting in nice indented output.

This class is NOT C++-safe. NOTE: This class is not thread-safe. Only one thread may append strings at a time.

Definition at line 51 of file strtreedump.h.


Constructor & Destructor Documentation

StringTreeDump::StringTreeDump const StringTreeDump  )  [private]
 

Do not use:.

StringTreeDump::StringTreeDump  ) 
 

Create empty string tree dump.

Definition at line 128 of file strtreedump.cc.

References curr_indent, and indent_just_added.

StringTreeDump::~StringTreeDump  ) 
 

Destroy thereby freeing data.

Definition at line 135 of file strtreedump.cc.

References ents, LinkedList< Entry >::IsEmpty(), and LinkedList< Entry >::PopLast().


Member Function Documentation

void StringTreeDump::AddIndent int  n = 1  )  [inline]
 

Change indent: Increase it by passed amount.

Definition at line 106 of file strtreedump.h.

References curr_indent, and indent_just_added.

Referenced by VM::AssemblerFile_Plaintext::_WriteSymbols_Global(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), VM::AssemblerFile_Plaintext::_WriteSymbolSectionContent(), VM::NamespaceInfo::DumpTree(), and VM::ClassInfo::DumpTree().

void StringTreeDump::append const TLString str  ) 
 

Append string to the dump:.

Definition at line 36 of file strtreedump.cc.

References StringTreeDump::Entry::append(), LinkedList< Entry >::append(), curr_indent, ents, StringTreeDump::Entry::indent, indent_just_added, LinkedList< Entry >::last(), StringTreeDump::Entry::str, and TLString::TightenSize().

Referenced by VM::VMLinker::LinkAll(), and operator+=().

bool StringTreeDump::IndentJustAdded  )  const [inline]
 

Was the indent just increased?

Definition at line 112 of file strtreedump.h.

References indent_just_added.

StringTreeDump& StringTreeDump::operator+= const TLString str  )  [inline]
 

Append string to the dump:.

Definition at line 117 of file strtreedump.h.

References append().

void StringTreeDump::operator= const StringTreeDump  )  [private]
 

Do not use:.

void StringTreeDump::RemoveEnd char  c  ) 
 

Remove the passed character if that char is at the end of the dump:.

Definition at line 52 of file strtreedump.cc.

References Assert, ents, LinkedList< Entry >::last(), and StringTreeDump::Entry::RemoveEnd().

void StringTreeDump::SubIndent int  n = 1  )  [inline]
 

Change indent: Decrease it by passed amount.

Definition at line 109 of file strtreedump.h.

References curr_indent.

Referenced by VM::AssemblerFile_Plaintext::_WriteSymbols_Global(), VM::AssemblerFile_Plaintext::_WriteSymbols_Recursive(), VM::AssemblerFile_Plaintext::_WriteSymbolSectionContent(), VM::NamespaceInfo::DumpTree(), and VM::ClassInfo::DumpTree().

size_t StringTreeDump::write FILE *  fp,
int  indent_size = 4,
char  indent_char = ' '
 

Write the complete string representation to a FILE *.

The indent_size is the number of indent_char's to be used for one level of indention.

Returns number of bytes written.

Definition at line 60 of file strtreedump.cc.

References TLString::append(), Assert, ents, LinkedList< Entry >::first(), StringTreeDump::Entry::indent, TLString::length(), LinkedListBase< Entry >::next, TLString::str(), StringTreeDump::Entry::str, and TLString::trunc().

Referenced by VM::AssemblerFile_Plaintext::_WriteSymbolSectionContent(), and VM::VMLinker::LinkAll().


Member Data Documentation

int StringTreeDump::curr_indent [private]
 

Definition at line 92 of file strtreedump.h.

Referenced by AddIndent(), append(), StringTreeDump(), and SubIndent().

LinkedList<Entry> StringTreeDump::ents [private]
 

Definition at line 91 of file strtreedump.h.

Referenced by append(), RemoveEnd(), write(), and ~StringTreeDump().

bool StringTreeDump::indent_just_added [private]
 

Definition at line 93 of file strtreedump.h.

Referenced by AddIndent(), append(), IndentJustAdded(), and StringTreeDump().


The documentation for this class was generated from the following files:
Generated on Sat Feb 19 22:35:40 2005 for Ray by doxygen 1.3.5