SheppStrUtil Class Reference

Useful string manipulation routines used by shepp. More...

#include <SheppStrUtil.H>

List of all members.

Static Public Member Functions

static char * trim (char *line)
 Removes leading and ending white spaces from line (shepp).
static vector< string > parse_line (char *line)
 Given a line, split its words by white space into a string vector (shepp).
static int split (string input, string &first, string &second, string splitter, bool relaxed=false)
static int quote_gathering (vector< string > &words, string &gather)
 Gathers command-line arguments bounded by quotes in a string.
static string doc2id (const string &doc)
 Removes chars [./-] from document strings.


Detailed Description

Useful string manipulation routines used by shepp.

Member Function Documentation

static string SheppStrUtil::doc2id ( const string &  doc  )  [inline, static]

Removes chars [./-] from document strings.

Parameters:
doc a CPF or CNPJ document
Returns:
input doc with no [./-] characters

References StrUtil::gsub().

Referenced by cmd_brorg_check(), cmd_brorg_create(), cmd_brorg_info(), and cmd_brorg_update().

static vector<string> SheppStrUtil::parse_line ( char *  line  )  [inline, static]

Given a line, split its words by white space into a string vector (shepp).

Parameters:
line line to be parsed
loop boolean, default true, set to false to get only first word
Returns:
string vector with all words found in line

Referenced by execute(), and executeInputFile().

static int SheppStrUtil::quote_gathering ( vector< string > &  words,
string &  gather 
) [inline, static]

Gathers command-line arguments bounded by quotes in a string.

Parameters:
words reference to vector with arguments
gather reference to return string
Returns:
0 if OK, -1 if ERROR

Referenced by cmd_brorg_create(), cmd_brorg_update(), SheppObjSet::postalInfo(), and SheppObjSet::status().

static int SheppStrUtil::split ( string  input,
string &  first,
string &  second,
string  splitter,
bool  relaxed = false 
) [inline, static]

Splits input into first and second at first occurrence of splitter. If relaxed is true, it is acceptable for second to be empty.

Parameters:
input string to be divided
first left side goes here
second right side goes here
splitter division point
relaxed true means that second can be empty

Referenced by SheppObjSet::authInfo(), cmd_asn_create(), cmd_asn_renew(), cmd_asn_update(), cmd_brorg_update(), cmd_contact_update(), cmd_domain_create(), cmd_domain_renew(), cmd_domain_update(), cmd_ipnetwork_create(), cmd_ipnetwork_renew(), cmd_ipnetwork_update(), cmd_server(), SheppObjSet::contacts(), SheppObjSet::disclose(), SheppObjSet::nameServer(), parse_iprange(), SheppObjSet::phone(), and SheppObjSet::status().

static char* SheppStrUtil::trim ( char *  line  )  [inline, static]

Removes leading and ending white spaces from line (shepp).

Parameters:
line line to be trimmed
Returns:
trimmed line

Referenced by executeInputFile(), and main().


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