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

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

#include <SheppStrUtil.H>

Static Public Member Functions

static char * trim (char *line)
 Removes leading and ending white spaces from line (shepp) More...
 
static vector< string > parse_line (char *line)
 Given a line, split its words by white space into a string vector (shepp) More...
 
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. More...
 
static string doc2id (const string &doc)
 Removes chars [./-] from document strings. More...
 

Detailed Description

Useful string manipulation routines used by shepp.

Member Function Documentation

static string SheppStrUtil::doc2id ( const string &  doc)
inlinestatic

Removes chars [./-] from document strings.

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

References StrUtil::gsub().

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

static vector<string> SheppStrUtil::parse_line ( char *  line)
inlinestatic

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

Parameters
lineline to be parsed
loopboolean, 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 
)
inlinestatic

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

Parameters
wordsreference to vector with arguments
gatherreference to return string
Returns
0 if OK, -1 if ERROR

Referenced by cmd_asn_create(), cmd_asn_reserve_create(), cmd_asn_update(), cmd_brorg_create(), cmd_brorg_update(), cmd_contact_create(), cmd_contact_update(), cmd_ipnetwork_create(), SheppObjSet::postalInfo(), SheppObjSet::rgpRestore(), and SheppObjSet::status().

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

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

Parameters
inputstring to be divided
firstleft side goes here
secondright side goes here
splitterdivision point
relaxedtrue 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_def_reg_check(), cmd_def_reg_create(), cmd_def_reg_renew(), cmd_def_reg_transfer(), cmd_domain_check(), cmd_domain_create(), cmd_domain_delete(), cmd_domain_info(), cmd_domain_renew(), cmd_domain_update(), cmd_ipnetwork_create(), cmd_ipnetwork_renew(), cmd_ipnetwork_update(), cmd_server(), SheppObjSet::contacts(), SheppObjSet::disclose(), SheppObjSet::nameServer(), SheppObjSet::parse_iprange(), SheppObjSet::phone(), and SheppObjSet::status().

static char* SheppStrUtil::trim ( char *  line)
inlinestatic

Removes leading and ending white spaces from line (shepp)

Parameters
lineline to be trimmed
Returns
trimmed line

Referenced by executeInputFile(), and main().


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