class NamedList

A named string container class. More...

Full nameTelEngine::NamedList
Definition#include <yateclass.h>
InheritsTelEngine::String [public ]
Inherited byCallInfo, ISDNQ931IE, Message, SDPMedia, SignallingCircuitEvent
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Methods

Public Static Methods


Detailed Description

This class holds a named list of named strings

 NamedList (const char* name)

NamedList

Creates a new named list.

Parameters:
nameName of the list - must not be NULL or empty

 NamedList (const NamedList& original)

NamedList

Copy constructor

Parameters:
originalNamed list we are copying

 NamedList (const char* name, const NamedList& original, const String& prefix)

NamedList

Creates a named list with subparameters of another list.

Parameters:
nameName of the list - must not be NULL or empty
originalNamed list to copy parameters from
prefixPrefix to match and remove from parameter names

void*  getObject (const String& name)

getObject

[const virtual]

Get a pointer to a derived class given that class name

Parameters:
nameName of the class we are asking for

Returns: Pointer to the requested class or NULL if this object doesn't implement it

Reimplemented from String.

inline unsigned int  length ()

length

[const]

Get the number of parameters

Returns: Count of named strings

Reimplemented from String.

inline unsigned int  count ()

count

[const]

Get the number of non-null parameters

Returns: Count of existing named strings

inline void  clearParams ()

clearParams

Clear all parameters

NamedList&  addParam (NamedString* param)

addParam

Add a named string to the parameter list.

Parameters:
paramParameter to add

NamedList&  addParam (const char* name, const char* value)

addParam

Add a named string to the parameter list.

Parameters:
nameName of the new string
valueValue of the new string

NamedList&  setParam (NamedString* param)

setParam

Set a named string in the parameter list.

Parameters:
paramParameter to set or add

NamedList&  setParam (const char* name, const char* value)

setParam

Set a named string in the parameter list.

Parameters:
nameName of the string
valueValue of the string

NamedList&  clearParam (const String& name, char childSep = 0)

clearParam

Clears all instances of a named string in the parameter list.

Parameters:
nameName of the string to remove
childSepIf set clears all child parameters in format name+childSep+anything

NamedList&  clearParam (NamedString* param)

clearParam

Remove a specific parameter

Parameters:
paramPointer to parameter to remove

NamedList&  copyParam (const NamedList& original, const String& name, char childSep = 0)

copyParam

Copy a parameter from another NamedList, clears it if not present there

Parameters:
originalNamedList to copy the parameter from
nameName of the string to copy or clear
childSepIf set copies all child parameters in format name+childSep+anything

NamedList&  copyParams (const NamedList& original)

copyParams

Copy all parameters from another NamedList, does not clear list first

Parameters:
originalNamedList to copy the parameters from

NamedList&  copyParams (const NamedList& original, ObjList* list, char childSep = 0)

copyParams

Copy multiple parameters from another NamedList, clears them if not present there

Parameters:
originalNamedList to copy the parameters from
listList of objects (usually String) whose name (blanks stripped) is used as parameters names
childSepIf set copies all child parameters in format name+childSep+anything

NamedList&  copyParams (const NamedList& original, const String& list, char childSep = 0)

copyParams

Copy multiple parameters from another NamedList, clears it if not present there

Parameters:
originalNamedList to copy the parameter from
listComma separated list of parameters to copy or clear
childSepIf set copies all child parameters in format name+childSep+anything

NamedList&  copySubParams (const NamedList& original, const String& prefix)

copySubParams

Copy subparameters from another list

Parameters:
originalNamed list to copy parameters from
prefixPrefix to match and remove from parameter names, must not be NULL

int  getIndex (const NamedString* param)

getIndex

[const]

Get the index of a named string in the parameter list.

Parameters:
paramPointer to the parameter to locate

Returns: Index of the named string or -1 if not found

int  getIndex (const String& name)

getIndex

[const]

Get the index of first matching named string in the parameter list.

Parameters:
nameName of parameter to locate

Returns: Index of the first matching named string or -1 if not found

NamedString*  getParam (const String& name)

getParam

[const]

Locate a named string in the parameter list.

Parameters:
nameName of parameter to locate

Returns: A pointer to the named string or NULL.

NamedString*  getParam (unsigned int index)

getParam

[const]

Locate a named string in the parameter list.

Parameters:
indexIndex of the parameter to locate

Returns: A pointer to the named string or NULL.

const String&  operator[] (const String& name)

operator[]

[const]

Parameter access operator

Parameters:
nameName of the parameter to return

Returns: String value of the parameter, String::empty() if missing

Reimplemented from String.

const char*  getValue (const String& name, const char* defvalue = 0)

getValue

[const]

Retrive the value of a named parameter.

Parameters:
nameName of parameter to locate
defvalueDefault value to return if not found

Returns: The string contained in the named parameter or the default

int  getIntValue (const String& name, int defvalue = 0)

getIntValue

[const]

Retrive the numeric value of a parameter.

Parameters:
nameName of parameter to locate
defvalueDefault value to return if not found

Returns: The number contained in the named parameter or the default

int  getIntValue (const String& name, const TokenDict* tokens, int defvalue = 0)

getIntValue

[const]

Retrive the numeric value of a parameter trying first a table lookup.

Parameters:
nameName of parameter to locate
tokensA pointer to an array of tokens to try to lookup
defvalueDefault value to return if not found

Returns: The number contained in the named parameter or the default

double  getDoubleValue (const String& name, double defvalue = 0.0)

getDoubleValue

[const]

Retrive the floating point value of a parameter.

Parameters:
nameName of parameter to locate
defvalueDefault value to return if not found

Returns: The number contained in the named parameter or the default

bool  getBoolValue (const String& name, bool defvalue = false)

getBoolValue

[const]

Retrive the boolean value of a parameter.

Parameters:
nameName of parameter to locate
defvalueDefault value to return if not found

Returns: The boolean value contained in the named parameter or the default

int  replaceParams (String& str, bool sqlEsc = false, char extraEsc = 0)

replaceParams

[const]

Replaces all ${paramname} in a String with the corresponding parameters

Parameters:
strString in which the replacements will be made
sqlEscTrue to apply SQL escaping to parameter values
extraEscCharacter to escape other than the SQL default ones

Returns: Number of replacements made, -1 if an error occured

void  dump (String& str, const char* separator, char quote = 0, bool force = false)

dump

[const]

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

Parameters:
strString to which the name and parameters are appended
separatorSeparator string to use before each parameter
quoteString quoting character, usually single or double quote
forceTrue to insert the separator even in an empty string

const NamedList&  empty ()

empty

[static]

A static empty named list

Returns: Reference to a static empty named list

Reimplemented from String.


Generated by: paulc on bussard on Mon Mar 8 12:18:15 2010, using kdoc 2.0a54.