Archon::Utilities::Text Namespace Reference


Classes

class  StringTokenizer
class  Table

Functions

string toString (void *v)
string toString (bool v)
string toString (short v)
string toString (unsigned short v)
string toString (int v)
string toString (unsigned v)
string toString (long v)
string toString (unsigned long v)
string toString (float v)
string toString (double v)
string toString (long double v)
bool isPrefixOf (string prefix, string s, bool ignoreCase)
bool isSuffixOf (string suffix, string s, bool ignoreCase)
string toLowerCase (string s)
string toUpperCase (string s)
string initCap (string s)
string trim (string)
 Strip leading and trailing whitespace.
string lineTrim (string)
 Strip leading and trailing blank lines.
int compareIgnoreCase (const string &a, const string &b)
 Returns 0 if a and b are equal, -1 if a is lexicographically before b, and 1 otherwise.
string escapeNonprintable (const string &s)
ustring escapeNonprintable (const ustring &s)
string format (string, int width=0)
 Formats text to a certain width, or flatterns text to one line if "width" < 0.
int width (string s)
int height (string s)
string extractLine (string s, int i)
string format (Table< string > &table, int maxTotalWidth, int columnSpacing, bool header)
string toString (string v)
string toString (ustring v)
string toString (const Time &t)


Function Documentation

ustring Archon::Utilities::Text::escapeNonprintable const ustring &  s  ) 
 

Todo:
Should detect any nonprintable unicode character, but only deals with the 8-bit ISO8859-1 subset.

Definition at line 233 of file text.C.

References Archon::Utilities::Unicode::decodeUtf8().

string Archon::Utilities::Text::format string  ,
int  width = 0
 

Formats text to a certain width, or flatterns text to one line if "width" < 0.

Below a text is viewed as consisting of words delimited by sequences of white-space characters.

In this context white-space characters are considered to be:

  • " ", SP, space
  • "\t", HT, horizontal tab
  • "\r", CR, carrage return
  • "\n", LF/NL, line-feed/new-line

All sequences of white-space characters are reduced to one of:

  • a single space
  • one or more newline characters
  • nothing depending on where it occurs in the text and the value of "width" (especially whether it is negative or not.)

Existing line brakings: If "width" >= 0 then newline characters occuring in the source text are preserved, except when they occur at the end of the text, that is, when no words follow. if "width" < 0 then newline characters are discarded.

Line splitting: If "width" > 0 then lines are split into pieces, so that each resulting line has a maximum length of "width". Whenever possible the splitting is done right after the last word that fits on the line. This only fails if we encounter a word that is wider than "width". In this case the word is split into as many lines as needed in such a way that all except the last line have length exactly equal to "width".

Definition at line 266 of file text.C.

References Archon::Utilities::Text::StringTokenizer::hasMoreElements(), and Archon::Utilities::Text::StringTokenizer::nextToken().

Referenced by format(), Archon::Utilities::Options::list(), Archon::Utilities::NFA::print(), Archon::Utilities::DFA::print(), Archon::Utilities::CFG::print(), Archon::Utilities::CFG::FollowSets::print(), and Archon::Utilities::CFG::FirstSets::print().

string Archon::Utilities::Text::lineTrim string   ) 
 

Strip leading and trailing blank lines.

While trim will eliminate any indent on the first line of the input this function retains that indent. Otherwise they are identical.

Definition at line 167 of file text.C.

Referenced by Archon::Utilities::FormatLibjpeg::load().


Generated on Sun Jul 30 22:58:19 2006 for Archon by  doxygen 1.4.4