Yate
|
A named string container class. More...
#include <yateclass.h>
Public Member Functions | |
NamedList (const char *name) | |
NamedList (const NamedList &original) | |
NamedList (const char *name, const NamedList &original, const String &prefix) | |
NamedList & | operator= (const NamedList &value) |
virtual void * | getObject (const String &name) const |
unsigned int | length () const |
unsigned int | count () const |
void | clearParams () |
NamedList & | addParam (NamedString *param) |
NamedList & | addParam (const char *name, const char *value, bool emptyOK=true) |
NamedList & | setParam (NamedString *param) |
NamedList & | setParam (const char *name, const char *value) |
NamedList & | clearParam (const String &name, char childSep=0) |
NamedList & | clearParam (NamedString *param) |
NamedList & | copyParam (const NamedList &original, const String &name, char childSep=0) |
NamedList & | copyParams (const NamedList &original) |
NamedList & | copyParams (const NamedList &original, ObjList *list, char childSep=0) |
NamedList & | copyParams (const NamedList &original, const String &list, char childSep=0) |
NamedList & | copySubParams (const NamedList &original, const String &prefix, bool skipPrefix=true) |
int | getIndex (const NamedString *param) const |
int | getIndex (const String &name) const |
NamedString * | getParam (const String &name) const |
NamedString * | getParam (unsigned int index) const |
const String & | operator[] (const String &name) const |
const char * | getValue (const String &name, const char *defvalue=0) const |
int | getIntValue (const String &name, int defvalue=0, int minvalue=INT_MIN, int maxvalue=INT_MAX, bool clamp=true) const |
int | getIntValue (const String &name, const TokenDict *tokens, int defvalue=0) const |
double | getDoubleValue (const String &name, double defvalue=0.0) const |
bool | getBoolValue (const String &name, bool defvalue=false) const |
int | replaceParams (String &str, bool sqlEsc=false, char extraEsc=0) const |
void | dump (String &str, const char *separator, char quote=0, bool force=false) const |
Static Public Member Functions | |
static const NamedList & | empty () |
Friends | |
class | NamedIterator |
A named string container class.
This class holds a named list of named strings
NamedList | ( | const char * | name | ) | [explicit] |
Creates a new named list.
name | Name of the list - must not be NULL or empty |
Copy constructor
original | Named list we are copying |
Creates a named list with subparameters of another list.
name | Name of the list - must not be NULL or empty |
original | Named list to copy parameters from |
prefix | Prefix to match and remove from parameter names |
NamedList& addParam | ( | NamedString * | param | ) |
Add a named string to the parameter list.
param | Parameter to add |
Referenced by ISDNQ931Message::appendIEValue(), and MucRoom::buildMucRoom().
Add a named string to the parameter list.
name | Name of the new string |
value | Value of the new string |
emptyOK | True to always add parameter, false to skip empty values |
NamedList& clearParam | ( | const String & | name, |
char | childSep = 0 |
||
) |
Clears all instances of a named string in the parameter list.
name | Name of the string to remove |
childSep | If set clears all child parameters in format name+childSep+anything |
NamedList& clearParam | ( | NamedString * | param | ) |
Remove a specific parameter
param | Pointer to parameter to remove |
void clearParams | ( | ) | [inline] |
Clear all parameters
Referenced by JGRtpMedia::set().
NamedList& copyParams | ( | const NamedList & | original | ) |
NamedList& copyParams | ( | const NamedList & | original, |
ObjList * | list, | ||
char | childSep = 0 |
||
) |
Copy multiple parameters from another NamedList, clears them if not present there
original | NamedList to copy the parameters from |
list | List of objects (usually String) whose name (blanks stripped) is used as parameters names |
childSep | If set copies all child parameters in format name+childSep+anything |
NamedList& copyParams | ( | const NamedList & | original, |
const String & | list, | ||
char | childSep = 0 |
||
) |
Copy multiple parameters from another NamedList, clears it if not present there
original | NamedList to copy the parameter from |
list | Comma separated list of parameters to copy or clear |
childSep | If set copies all child parameters in format name+childSep+anything |
NamedList& copySubParams | ( | const NamedList & | original, |
const String & | prefix, | ||
bool | skipPrefix = true |
||
) |
Copy subparameters from another list
original | Named list to copy parameters from |
prefix | Prefix to match in parameter names, must not be NULL |
skipPrefix | Skip over the prefix when building new parameter name |
unsigned int count | ( | ) | const [inline] |
Get the number of non-null parameters
Dumps the name and all parameters to a string in a human readable format. No escaping takes place so this method should be used for debugging only
bool getBoolValue | ( | const String & | name, |
bool | defvalue = false |
||
) | const |
Retrieve the boolean value of a parameter.
name | Name of parameter to locate |
defvalue | Default value to return if not found |
double getDoubleValue | ( | const String & | name, |
double | defvalue = 0.0 |
||
) | const |
Retrieve the floating point value of a parameter.
name | Name of parameter to locate |
defvalue | Default value to return if not found |
int getIndex | ( | const NamedString * | param | ) | const |
Get the index of a named string in the parameter list.
param | Pointer to the parameter to locate |
Get the index of first matching named string in the parameter list.
name | Name of parameter to locate |
int getIntValue | ( | const String & | name, |
int | defvalue = 0 , |
||
int | minvalue = INT_MIN , |
||
int | maxvalue = INT_MAX , |
||
bool | clamp = true |
||
) | const |
Retrieve the numeric value of a parameter.
name | Name of parameter to locate |
defvalue | Default value to return if not found |
minvalue | Minimum value allowed for the parameter |
maxvalue | Maximum value allowed for the parameter |
clamp | Control the out of bound values: true to adjust to the nearest bound, false to return the default value |
int getIntValue | ( | const String & | name, |
const TokenDict * | tokens, | ||
int | defvalue = 0 |
||
) | const |
Retrieve the numeric value of a parameter trying first a table lookup.
name | Name of parameter to locate |
tokens | A pointer to an array of tokens to try to lookup |
defvalue | Default value to return if not found |
NamedString* getParam | ( | const String & | name | ) | const |
Locate a named string in the parameter list.
name | Name of parameter to locate |
Referenced by SS7MsgSCCP::canBeUDT().
NamedString* getParam | ( | unsigned int | index | ) | const |
Locate a named string in the parameter list.
index | Index of the parameter to locate |
Retrieve the value of a named parameter.
name | Name of parameter to locate |
defvalue | Default value to return if not found |
Referenced by ISDNQ931Message::getIEValue().
unsigned int length | ( | ) | const [inline] |
Assignment operator
value | New name and parameters to assign |
Referenced by DataFormat::operator=().
Parameter access operator
name | Name of the parameter to return |
int replaceParams | ( | String & | str, |
bool | sqlEsc = false , |
||
char | extraEsc = 0 |
||
) | const |
Replaces all ${paramname} in a String with the corresponding parameters
str | String in which the replacements will be made |
sqlEsc | True to apply SQL escaping to parameter values |
extraEsc | Character to escape other than the SQL default ones |
NamedList& setParam | ( | NamedString * | param | ) |
Set a named string in the parameter list.
param | Parameter to set or add |
Set a named string in the parameter list.
name | Name of the string |
value | Value of the string |