RDK2::TextUtils Namespace Reference


Data Structures

class  KaGetOpt
class  LineStream

Typedefs

typedef std::vector< std::string > StringVector
typedef const std::string & cstr

Functions

template<typename T>
string toString (const T &v)
template<>
string toString (const bool &v)
StringVector tokenize (const std::string &s)
vector< string > tokenize (const std::string &s, const std::string &delimiters)
void consume_line (std::istream &is)
void consumeWhitespace (std::istream &is)
std::string readCommentLines (std::istream &is, char commentChar)
bool startsWith (const std::string &s, const char *cs)
bool endsWith (const std::string &s, const char *cs)
std::string normalizeLibraryName (const std::string &l)
string trim (const string &s, const char *charsToTrim)
string readEntireFile (cstr file)
template<typename T>
std::string toString (T v)
template<class X>
bool parse (const std::string &s, X &x)
template<class X>
std::string quote (X &x)
std::string normalizeLibraryName (cstr libraryName)


Typedef Documentation

typedef const std::string& RDK2::TextUtils::cstr

Definition at line 34 of file textutils.h.

typedef std::vector<std::string> RDK2::TextUtils::StringVector

Types definition

Definition at line 33 of file textutils.h.


Function Documentation

void RDK2::TextUtils::consume_line ( std::istream &  is  ) 

Definition at line 57 of file textutils.cpp.

Referenced by consumeWhitespace().

void RDK2::TextUtils::consumeWhitespace ( std::istream &  is  ) 

Add your own utils here. Consumes whitespaces from the stream. Whitespaces are empty lines, isspace() and lines beginning with '#'

Definition at line 64 of file textutils.cpp.

References consume_line().

Referenced by RDK2::Geometry::PGMFile::load(), and RDK2::Geometry::loadPGM().

Here is the call graph for this function:

bool RDK2::TextUtils::endsWith ( const std::string &  s,
const char *  cs 
)

Test whether s ands with cs.

Definition at line 108 of file textutils.cpp.

Referenced by normalizeLibraryName().

std::string RDK2::TextUtils::normalizeLibraryName ( cstr  libraryName  ) 

std::string RDK2::TextUtils::normalizeLibraryName ( const std::string &  l  ) 

Definition at line 113 of file textutils.cpp.

References endsWith(), startsWith(), and tokenize().

Referenced by RDK2::RAgent::Module::createFromLibrary().

Here is the call graph for this function:

template<class X>
bool RDK2::TextUtils::parse ( const std::string &  s,
X &  x 
) [inline]

The converse of .

Definition at line 77 of file textutils.h.

Referenced by RDK2::SensorData::LaserParser::parse(), and RDK2::Geometry::parsePoint().

template<class X>
std::string RDK2::TextUtils::quote ( X &  x  )  [inline]

The converse of .

Definition at line 84 of file textutils.h.

References toString().

Referenced by RDK2::Filesystem::fsOpenOrException(), RDK2::Filesystem::fsRealpath(), RDK2::Geometry::PGMFile::load(), and RDK2::Filesystem::modificationTime().

Here is the call graph for this function:

std::string RDK2::TextUtils::readCommentLines ( std::istream &  is,
char  commentChar = '#' 
)

Reads a comment of the form "# ... \n # ..." and strips the #

Definition at line 82 of file textutils.cpp.

Referenced by RDK2::Geometry::PGMFile::load().

std::string RDK2::TextUtils::readEntireFile ( cstr  file  ) 

Reads the entire file into a string.

Definition at line 153 of file textutils.cpp.

bool RDK2::TextUtils::startsWith ( const std::string &  s,
const char *  cs 
)

std::vector< std::string > RDK2::TextUtils::tokenize ( const std::string &  s,
const std::string &  delimiters 
)

StringVector RDK2::TextUtils::tokenize ( const std::string &   ) 

Tokenizes a string

Definition at line 33 of file textutils.cpp.

Referenced by normalizeLibraryName(), and RDK2::TextUtils::LineStream::tokenize().

template<typename T>
std::string RDK2::TextUtils::toString ( v  )  [inline]

template<>
string RDK2::TextUtils::toString ( const bool v  )  [inline]

Definition at line 16 of file kagetopt.h.

template<typename T>
string RDK2::TextUtils::toString ( const T &  v  )  [inline]

std::string RDK2::TextUtils::trim ( const string &  s,
const char *  charsToTrim 
)


Generated on Tue Mar 3 15:06:58 2009 for OpenRDK by  doxygen 1.5.6