StrUtil Class Reference

StrUtil Class: String Manipulation Utilities. More...

#include <StrUtil.H>

List of all members.

Public Member Functions

string xml_beautifier (const string &input_txt)
 XML Beautifier.

Static Public Member Functions

static string parse (const string &text, const map< string, string, less< string > > &to_parse, string tag_begin, string tag_end)
 Used for parsing XML Templates.
static int gsub (string &buffer, const char *pat, const char *drp)
 Used for substitution of pat for drp within buffer.
template<class kind >
static string to_string (const char *format, const kind &number)
 Convert number to string where the format string looks like printf format.
static int iso88591_to_utf8 (const string &iso88591, string &utf8)
static int utf8_to_iso88591 (const string &utf8, string &iso88591)
static string esc_xml_markup (const string &input_txt)
 Escape &'><" characters.


Detailed Description

StrUtil Class: String Manipulation Utilities.

Member Function Documentation

static string StrUtil::esc_xml_markup ( const string &  input_txt  )  [static]

Escape &'><" characters.

Parameters:
input_txt The text that will possibly have some characters escaped
Returns:
strings with &'><" characters escaped

Referenced by DSInfo::get_xml_format(), and Action::set_xml_template_common().

static int StrUtil::gsub ( string &  buffer,
const char *  pat,
const char *  drp 
) [static]

Used for substitution of pat for drp within buffer.

Parameters:
buffer Text to be scanned
pat Pattern to be substituted
drp Substitute for the pattern indicated by pat
Returns:
Number of matches

Referenced by SheppStrUtil::doc2id().

static int StrUtil::iso88591_to_utf8 ( const string &  iso88591,
string &  utf8 
) [static]

Encodes an ISO-8859-1 string to UTF-8. ISO-8859-1 non-printable characters are substituted by spaces (ASCII 0x20).

Parameters:
iso88591 ISO-8859-1 string to be encoded to UTF-8
utf8 UTF-8 encodeded string
Returns:
number of characters substituted by spaces

Referenced by cmd_xmlcmd().

static string StrUtil::parse ( const string &  text,
const map< string, string, less< string > > &  to_parse,
string  tag_begin,
string  tag_end 
) [static]

Used for parsing XML Templates.

Parameters:
text XML template to be parsed
to_parse Mapping tags into values
tag_begin Symbol for begin tag
tag_end Symbol for end tag
Returns:
Parsed string

Referenced by Action::set_xml_template_common().

template<class kind >
static string StrUtil::to_string ( const char *  format,
const kind &  number 
) [inline, static]

Convert number to string where the format string looks like printf format.

Parameters:
format the format string in the printf format
number the number to be converted
Returns:
the string containing the number

Referenced by DSInfo::get_xml_format(), and Action::set_xml_template_common().

static int StrUtil::utf8_to_iso88591 ( const string &  utf8,
string &  iso88591 
) [static]

Decodes a UTF-8 string to ISO-8859-1. ISO-8859-1 non-printable characters and not ISO-8859-1 characters are substituted by spaces (ASCII 0x20).

Parameters:
utf8 UTF-8 encoded string to be decoded
iso88591 decoded ISO-8859-1 string
Returns:
number of characters substituted by spaces

string StrUtil::xml_beautifier ( const string &  input_txt  ) 

XML Beautifier.

Parameters:
input_txt The text to be formatted (in UTF-8)
Returns:
The indented XML document

Referenced by cmd_xmlcmd(), and cmd_xmlrsp().


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

Generated on Thu Jan 21 14:44:04 2010 for libepp_nicbr by  doxygen 1.5.9