soui 5.0.0.1
Soui5 Doc
 
Loading...
Searching...
No Matches
SXmlAttr Class Reference

Class representing an XML attribute. More...

#include <SXml.h>

Inheritance diagram for SXmlAttr:
IXmlAttr

Public Member Functions

 SXmlAttr (pugi::xml_attribute attr)
 Constructor for SXmlAttr.
 
 SXmlAttr (const IXmlAttr *src)
 Constructor for SXmlAttr from an IXmlAttr pointer.
 
 SXmlAttr (const SXmlAttr &src)
 Copy constructor for SXmlAttr.
 
 SXmlAttr (LPVOID pData=NULL)
 Constructor for SXmlAttr with an optional private data pointer.
 
LPVOID GetPrivPtr () SCONST OVERRIDE
 Gets the private data pointer.
 
BOOL Empty () SCONST OVERRIDE
 Checks if the attribute is empty.
 
const wchar_t * Name () SCONST OVERRIDE
 Gets the attribute name.
 
const wchar_t * Value () SCONST OVERRIDE
 Gets the attribute value.
 
BOOL set_userdata (int data) OVERRIDE
 Sets user data for the attribute.
 
int get_userdata () SCONST OVERRIDE
 Gets user data for the attribute.
 
IXmlAttrNext () OVERRIDE
 Gets the next attribute in the attribute list of the parent node.
 
IXmlAttrPrev () OVERRIDE
 Gets the previous attribute in the attribute list of the parent node.
 
int AsInt (int def=0) OVERRIDE
 Converts the attribute value to an integer.
 
unsigned int AsUint (int def=0) OVERRIDE
 Converts the attribute value to an unsigned integer.
 
float AsFloat (float def=0.0f) OVERRIDE
 Converts the attribute value to a float.
 
double AsDouble (double def=0.0) OVERRIDE
 Converts the attribute value to a double.
 
BOOL AsBool (BOOL def=FALSE) OVERRIDE
 Converts the attribute value to a boolean.
 
 operator bool () const
 Checks if the attribute is empty.
 
bool empty () const
 Checks if the attribute is empty.
 
const wchar_t * name () const
 Gets the attribute name.
 
const wchar_t * value () const
 Gets the attribute value.
 
const wchar_t * as_string (const wchar_t *def=L"") const
 Gets the attribute value as a string.
 
int as_int (int def=0) const
 Converts the attribute value to an integer.
 
unsigned int as_uint (unsigned int def=0) const
 Converts the attribute value to an unsigned integer.
 
double as_double (double def=0) const
 Converts the attribute value to a double.
 
float as_float (float def=0) const
 Converts the attribute value to a float.
 
bool as_bool (bool def=false) const
 Converts the attribute value to a boolean.
 
bool set_name (const wchar_t *rhs)
 Sets the attribute name.
 
bool set_value (const wchar_t *rhs)
 Sets the attribute value.
 
bool set_value (int rhs)
 Sets the attribute value with type conversion (integer).
 
bool set_value (unsigned int rhs)
 Sets the attribute value with type conversion (unsigned integer).
 
bool set_value (long rhs)
 Sets the attribute value with type conversion (long).
 
bool set_value (unsigned long rhs)
 Sets the attribute value with type conversion (unsigned long).
 
bool set_value (double rhs)
 Sets the attribute value with type conversion (double).
 
bool set_value (double rhs, int precision)
 Sets the attribute value with type conversion (double with precision).
 
bool set_value (float rhs)
 Sets the attribute value with type conversion (float).
 
bool set_value (float rhs, int precision)
 Sets the attribute value with type conversion (float with precision).
 
bool set_value (bool rhs)
 Sets the attribute value with type conversion (boolean).
 
SXmlAttr next_attribute () const
 Gets the next attribute in the attribute list of the parent node.
 
SXmlAttr previous_attribute () const
 Gets the previous attribute in the attribute list of the parent node.
 

Friends

class SXmlNode
 

Detailed Description

Class representing an XML attribute.

This class provides methods to manipulate and access XML attributes.

Definition at line 19 of file SXml.h.

Constructor & Destructor Documentation

◆ SXmlAttr() [1/4]

SXmlAttr::SXmlAttr ( pugi::xml_attribute attr)

Constructor for SXmlAttr.

Parameters
attrThe pugi::xml_attribute to initialize with.

Definition at line 16 of file SXml.cpp.

◆ SXmlAttr() [2/4]

SXmlAttr::SXmlAttr ( const IXmlAttr * src)

Constructor for SXmlAttr from an IXmlAttr pointer.

Parameters
srcThe IXmlAttr pointer to initialize with.

Definition at line 12 of file SXml.cpp.

◆ SXmlAttr() [3/4]

SXmlAttr::SXmlAttr ( const SXmlAttr & src)

Copy constructor for SXmlAttr.

Parameters
srcThe SXmlAttr to copy.

Definition at line 21 of file SXml.cpp.

◆ SXmlAttr() [4/4]

SNSBEGIN SXmlAttr::SXmlAttr ( LPVOID pData = NULL)
explicit

Constructor for SXmlAttr with an optional private data pointer.

Parameters
pDataPointer to private data.

Definition at line 8 of file SXml.cpp.

Member Function Documentation

◆ as_bool()

bool SXmlAttr::as_bool ( bool def = false) const

Converts the attribute value to a boolean.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Boolean value of the attribute.

Definition at line 120 of file SXml.cpp.

◆ as_double()

double SXmlAttr::as_double ( double def = 0) const

Converts the attribute value to a double.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Double value of the attribute.

Definition at line 110 of file SXml.cpp.

◆ as_float()

float SXmlAttr::as_float ( float def = 0) const

Converts the attribute value to a float.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Float value of the attribute.

Definition at line 115 of file SXml.cpp.

◆ as_int()

int SXmlAttr::as_int ( int def = 0) const

Converts the attribute value to an integer.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Integer value of the attribute.

Definition at line 100 of file SXml.cpp.

◆ as_string()

const wchar_t * SXmlAttr::as_string ( const wchar_t * def = L"") const

Gets the attribute value as a string.

Parameters
defDefault value if the attribute is empty.
Returns
Attribute value as a string.

Definition at line 95 of file SXml.cpp.

◆ as_uint()

unsigned int SXmlAttr::as_uint ( unsigned int def = 0) const

Converts the attribute value to an unsigned integer.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Unsigned integer value of the attribute.

Definition at line 105 of file SXml.cpp.

◆ AsBool()

BOOL SXmlAttr::AsBool ( BOOL def = FALSE)

Converts the attribute value to a boolean.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Boolean value of the attribute.

Implements IXmlAttr.

Definition at line 210 of file SXml.cpp.

◆ AsDouble()

double SXmlAttr::AsDouble ( double def = 0.0)

Converts the attribute value to a double.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Double value of the attribute.

Implements IXmlAttr.

Definition at line 205 of file SXml.cpp.

◆ AsFloat()

float SXmlAttr::AsFloat ( float def = 0.0f)

Converts the attribute value to a float.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Float value of the attribute.

Implements IXmlAttr.

Definition at line 200 of file SXml.cpp.

◆ AsInt()

int SXmlAttr::AsInt ( int def = 0)

Converts the attribute value to an integer.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Integer value of the attribute.

Implements IXmlAttr.

Definition at line 190 of file SXml.cpp.

◆ AsUint()

unsigned int SXmlAttr::AsUint ( int def = 0)

Converts the attribute value to an unsigned integer.

Parameters
defDefault value if conversion fails or attribute is empty.
Returns
Unsigned integer value of the attribute.

Implements IXmlAttr.

Definition at line 195 of file SXml.cpp.

◆ Empty()

BOOL SXmlAttr::Empty ( )

Checks if the attribute is empty.

Returns
TRUE if the attribute is empty, FALSE otherwise.

Implements IXmlAttr.

Definition at line 38 of file SXml.cpp.

◆ empty()

bool SXmlAttr::empty ( ) const

Checks if the attribute is empty.

Returns
TRUE if the attribute is empty, FALSE otherwise.

Definition at line 80 of file SXml.cpp.

◆ get_userdata()

int SXmlAttr::get_userdata ( )

Gets user data for the attribute.

Returns
User data.

Implements IXmlAttr.

Definition at line 58 of file SXml.cpp.

◆ GetPrivPtr()

LPVOID SXmlAttr::GetPrivPtr ( )

Gets the private data pointer.

Returns
Pointer to the private data.

Implements IXmlAttr.

Definition at line 33 of file SXml.cpp.

◆ Name()

const wchar_t * SXmlAttr::Name ( )

Gets the attribute name.

Returns
Attribute name, or "" if the attribute is empty.

Implements IXmlAttr.

Definition at line 43 of file SXml.cpp.

◆ name()

const wchar_t * SXmlAttr::name ( ) const

Gets the attribute name.

Returns
Attribute name, or "" if the attribute is empty.

Definition at line 85 of file SXml.cpp.

◆ Next()

IXmlAttr * SXmlAttr::Next ( )

Gets the next attribute in the attribute list of the parent node.

Returns
Pointer to the next attribute.

Implements IXmlAttr.

Definition at line 63 of file SXml.cpp.

◆ next_attribute()

SXmlAttr SXmlAttr::next_attribute ( ) const

Gets the next attribute in the attribute list of the parent node.

Returns
Next attribute.

Definition at line 180 of file SXml.cpp.

◆ operator bool()

SXmlAttr::operator bool ( ) const

Checks if the attribute is empty.

Returns
TRUE if the attribute is empty, FALSE otherwise.

Definition at line 75 of file SXml.cpp.

◆ Prev()

IXmlAttr * SXmlAttr::Prev ( )

Gets the previous attribute in the attribute list of the parent node.

Returns
Pointer to the previous attribute.

Implements IXmlAttr.

Definition at line 69 of file SXml.cpp.

◆ previous_attribute()

SXmlAttr SXmlAttr::previous_attribute ( ) const

Gets the previous attribute in the attribute list of the parent node.

Returns
Previous attribute.

Definition at line 185 of file SXml.cpp.

◆ set_name()

bool SXmlAttr::set_name ( const wchar_t * rhs)

Sets the attribute name.

Parameters
rhsNew attribute name.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 125 of file SXml.cpp.

◆ set_userdata()

BOOL SXmlAttr::set_userdata ( int data)

Sets user data for the attribute.

Parameters
dataUser data to set.
Returns
TRUE if successful, FALSE otherwise.

Implements IXmlAttr.

Definition at line 53 of file SXml.cpp.

◆ set_value() [1/10]

bool SXmlAttr::set_value ( bool rhs)

Sets the attribute value with type conversion (boolean).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 175 of file SXml.cpp.

◆ set_value() [2/10]

bool SXmlAttr::set_value ( const wchar_t * rhs)

Sets the attribute value.

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 130 of file SXml.cpp.

◆ set_value() [3/10]

bool SXmlAttr::set_value ( double rhs)

Sets the attribute value with type conversion (double).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 155 of file SXml.cpp.

◆ set_value() [4/10]

bool SXmlAttr::set_value ( double rhs,
int precision )

Sets the attribute value with type conversion (double with precision).

Parameters
rhsNew attribute value.
precisionPrecision for the conversion.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 160 of file SXml.cpp.

◆ set_value() [5/10]

bool SXmlAttr::set_value ( float rhs)

Sets the attribute value with type conversion (float).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 165 of file SXml.cpp.

◆ set_value() [6/10]

bool SXmlAttr::set_value ( float rhs,
int precision )

Sets the attribute value with type conversion (float with precision).

Parameters
rhsNew attribute value.
precisionPrecision for the conversion.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 170 of file SXml.cpp.

◆ set_value() [7/10]

bool SXmlAttr::set_value ( int rhs)

Sets the attribute value with type conversion (integer).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 135 of file SXml.cpp.

◆ set_value() [8/10]

bool SXmlAttr::set_value ( long rhs)

Sets the attribute value with type conversion (long).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 145 of file SXml.cpp.

◆ set_value() [9/10]

bool SXmlAttr::set_value ( unsigned int rhs)

Sets the attribute value with type conversion (unsigned integer).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 140 of file SXml.cpp.

◆ set_value() [10/10]

bool SXmlAttr::set_value ( unsigned long rhs)

Sets the attribute value with type conversion (unsigned long).

Parameters
rhsNew attribute value.
Returns
TRUE if successful, FALSE otherwise.

Definition at line 150 of file SXml.cpp.

◆ Value()

const wchar_t * SXmlAttr::Value ( )

Gets the attribute value.

Returns
Attribute value, or "" if the attribute is empty.

Implements IXmlAttr.

Definition at line 48 of file SXml.cpp.

◆ value()

const wchar_t * SXmlAttr::value ( ) const

Gets the attribute value.

Returns
Attribute value, or "" if the attribute is empty.

Definition at line 90 of file SXml.cpp.

Friends And Related Symbol Documentation

◆ SXmlNode

friend class SXmlNode
friend

Definition at line 21 of file SXml.h.


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