NCBI C++ ToolKit
|
Search Toolkit Book for CStringPairs
Template for parsing string into pairs of name and value or merging them back into a single string. More...
#include <corelib/ncbistr.hpp>
Public Types | |
typedef TContainer | TStrPairs |
typedef TContainer::value_type | TStrPair |
The container's value type must be pair<string, string> or a compatible type. More... | |
Public Member Functions | |
CStringPairs (IStringDecoder *decoder=NULL, EOwnership own_decoder=eTakeOwnership, IStringEncoder *encoder=NULL, EOwnership own_encoder=eTakeOwnership) | |
Create parser with the specified decoder/encoder and default separators. More... | |
CStringPairs (const CTempString arg_sep, const CTempString val_sep, IStringDecoder *decoder=NULL, EOwnership own_decoder=eTakeOwnership, IStringEncoder *encoder=NULL, EOwnership own_encoder=eTakeOwnership) | |
Create parser with the specified parameters. More... | |
CStringPairs (NStr::EUrlDecode decode_flag, NStr::EUrlEncode encode_flag) | |
Create parser with the selected URL-encoding/decoding options and default separators. More... | |
virtual | ~CStringPairs (void) |
void | SetDecoder (IStringDecoder *decoder, EOwnership own=eTakeOwnership) |
Set string decoder. More... | |
IStringDecoder * | GetDecoder (void) |
Get decoder or NULL. Does not affect decoder ownership. More... | |
void | SetEncoder (IStringEncoder *encoder, EOwnership own=eTakeOwnership) |
Set string encoder. More... | |
IStringEncoder * | GetEncoder (void) |
Get encoder or NULL. Does not affect encoder ownership. More... | |
void | Parse (const CTempString str, NStr::EMergeDelims merge_argsep=NStr::eMergeDelims) |
Parse the string. More... | |
string | Merge (void) const |
Merge name-value pairs into a single string using the currently set separators and the provided encoder if any. More... | |
const TStrPairs & | GetPairs (void) const |
Read data. More... | |
TStrPairs & | GetPairs (void) |
Get non-const data. More... | |
Static Public Member Functions | |
static void | Parse (TStrPairs &pairs, const CTempString str, const CTempString arg_sep, const CTempString val_sep, IStringDecoder *decoder=NULL, EOwnership own=eTakeOwnership, NStr::EMergeDelims merge_argsep=NStr::eMergeDelims) |
Parse the string using the provided decoder, put data into the container. More... | |
static string | Merge (const TStrPairs &pairs, const string &arg_sep, const string &val_sep, IStringEncoder *encoder=NULL, EOwnership own=eTakeOwnership) |
Merge name-value pairs from the provided container, separators and encoder. More... | |
Private Attributes | |
string | m_ArgSep |
string | m_ValSep |
AutoPtr< IStringDecoder > | m_Decoder |
AutoPtr< IStringEncoder > | m_Encoder |
TStrPairs | m_Data |
Template for parsing string into pairs of name and value or merging them back into a single string.
The container class must hold pairs of strings (pair<string, string>).
Definition at line 4592 of file ncbistr.hpp.