libepp_nicbr
Public Member Functions | Static Public Member Functions | List of all members
StrUtil Class Reference

StrUtil Class: String Manipulation Utilities. More...

#include <StrUtil.H>

Public Member Functions

string xml_beautifier (const string &input_txt)
 XML Beautifier. More...
 

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. More...
 
static int gsub (string &buffer, const char *pat, const char *drp)
 Used for substitution of pat for drp within buffer. More...
 
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. More...
 
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. More...
 
static string & ltrim (string &s)
 Trim from start. More...
 
static string & rtrim (string &s)
 Trim from end. More...
 
static string & trim (string &s)
 Trim from both ends. More...
 

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_txtThe text that will possibly have some characters escaped
Returns
strings with &'><" characters escaped

Referenced by ReverseDSInfo::get_xml_format(), 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
bufferText to be scanned
patPattern to be substituted
drpSubstitute 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
iso88591ISO-8859-1 string to be encoded to UTF-8
utf8UTF-8 encodeded string
Returns
number of characters substituted by spaces

Referenced by cmd_xmlcmd().

static string& StrUtil::ltrim ( string &  s)
static

Trim from start.

Parameters
sstring to analyze
Returns
left trimmed string
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
textXML template to be parsed
to_parseMapping tags into values
tag_beginSymbol for begin tag
tag_endSymbol for end tag
Returns
Parsed string

Referenced by Action::set_xml_template_common().

static string& StrUtil::rtrim ( string &  s)
static

Trim from end.

Parameters
sstring to analyze
Returns
right trimmed string
template<class kind >
static string StrUtil::to_string ( const char *  format,
const kind &  number 
)
inlinestatic

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

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

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

static string& StrUtil::trim ( string &  s)
static

Trim from both ends.

Parameters
sstring to analyze
Returns
trimmed string

Referenced by cmd_domain_create().

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
utf8UTF-8 encoded string to be decoded
iso88591decoded ISO-8859-1 string
Returns
number of characters substituted by spaces
string StrUtil::xml_beautifier ( const string &  input_txt)

XML Beautifier.

Parameters
input_txtThe 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: