soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SNamedValue< T, ValueParser > Class Template Reference

Template class for managing named values. More...

#include <SNamedValue.h>

Public Types

typedef TNAMEDVALUE< T > NAMEDVALUE
 

Public Member Functions

virtual BOOL Init (SXmlNode xmlNode)
 Initializes the named values from an XML node.
 
String2Value (const SStringW &strName) const
 Converts a string name to its corresponding value.
 
BOOL FindValue (const SStringW &strName, T &value) const
 Finds the value associated with a given name.
 
GetAt (const int idx) const
 Retrieves the value at a specific index.
 
size_t Merge (const SNamedValue &src)
 Merges the named values from another SNamedValue object.
 
UINT GetCount () const
 Retrieves the number of named values.
 

Static Protected Member Functions

static int Compare (const void *p1, const void *p2)
 Comparison function for sorting and searching.
 

Protected Attributes

SArray< NAMEDVALUEm_lstNamedValue
 

Detailed Description

template<class T, class ValueParser>
class SNamedValue< T, ValueParser >

Template class for managing named values.

This class manages a list of named values, allowing for initialization from XML, retrieval by name, and merging of values.

Template Parameters
TType of the value.
ValueParserClass responsible for parsing the value from a string.

Definition at line 35 of file SNamedValue.h.

Member Typedef Documentation

◆ NAMEDVALUE

template<class T, class ValueParser>
typedef TNAMEDVALUE<T> SNamedValue< T, ValueParser >::NAMEDVALUE

Definition at line 37 of file SNamedValue.h.

Member Function Documentation

◆ Compare()

template<class T, class ValueParser>
static int SNamedValue< T, ValueParser >::Compare ( const void * p1,
const void * p2 )
inlinestaticprotected

Comparison function for sorting and searching.

Parameters
p1Pointer to the first NAMEDVALUE.
p2Pointer to the second NAMEDVALUE.
Returns
Comparison result.

Definition at line 157 of file SNamedValue.h.

◆ FindValue()

template<class T, class ValueParser>
BOOL SNamedValue< T, ValueParser >::FindValue ( const SStringW & strName,
T & value ) const
inline

Finds the value associated with a given name.

Parameters
strNameName of the value.
valueVariable to store the found value.
Returns
TRUE if the value is found, FALSE otherwise.

Definition at line 90 of file SNamedValue.h.

◆ GetAt()

template<class T, class ValueParser>
T SNamedValue< T, ValueParser >::GetAt ( const int idx) const
inline

Retrieves the value at a specific index.

Parameters
idxIndex of the value.
Returns
Value at the specified index.

Definition at line 106 of file SNamedValue.h.

◆ GetCount()

template<class T, class ValueParser>
UINT SNamedValue< T, ValueParser >::GetCount ( ) const
inline

Retrieves the number of named values.

Returns
Number of named values.

Definition at line 145 of file SNamedValue.h.

◆ Init()

template<class T, class ValueParser>
virtual BOOL SNamedValue< T, ValueParser >::Init ( SXmlNode xmlNode)
inlinevirtual

Initializes the named values from an XML node.

Parameters
xmlNodeXML node containing the named values.
Returns
TRUE if initialization is successful, FALSE otherwise.

Definition at line 44 of file SNamedValue.h.

◆ Merge()

template<class T, class ValueParser>
size_t SNamedValue< T, ValueParser >::Merge ( const SNamedValue< T, ValueParser > & src)
inline

Merges the named values from another SNamedValue object.

Parameters
srcSource SNamedValue object.
Returns
Number of new values added.

Definition at line 117 of file SNamedValue.h.

◆ String2Value()

template<class T, class ValueParser>
T SNamedValue< T, ValueParser >::String2Value ( const SStringW & strName) const
inline

Converts a string name to its corresponding value.

Parameters
strNameName of the value.
Returns
Value associated with the name, or a null value if not found.

Definition at line 75 of file SNamedValue.h.

Member Data Documentation

◆ m_lstNamedValue

template<class T, class ValueParser>
SArray<NAMEDVALUE> SNamedValue< T, ValueParser >::m_lstNamedValue
protected

Definition at line 164 of file SNamedValue.h.


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