A helper for working with text inside PCDATA nodes. More...
#include <nodetext.h>
Public Member Functions | |
NodeText () | |
Default constructor. Constructs an empty object. | |
bool | AsBool (bool def=false) const |
Get text as bool. More... | |
double | AsDouble (double def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
float | AsFloat (float def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
int | AsInt (int def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
Integer | AsInteger (Integer def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
Real | AsReal (Real def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
const Char8 * | AsString (const Char8 *def="") const |
Get text, or the default Value if object is empty. More... | |
unsigned int | AsUint (unsigned int def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
Whole | AsWhole (Whole def=0) const |
Get text as a number, or the default Value if conversion did not succeed or object is empty. More... | |
Node | data () const |
Get the data node (NodePcdata or NodeCdata) for this object. More... | |
bool | Empty () const |
Is this storing anything at all? More... | |
const Char8 * | GetString () const |
Get text, or "" if object is empty. More... | |
operator unspecified_bool_type () const | |
Used to convert this to a boolean value in a safe way. More... | |
bool | operator! () const |
Used to convert this attribute the opposite of it's normal boolean value. More... | |
NodeText & | operator= (const Char8 *rhs) |
Set text (equivalent to set without error checking) More... | |
NodeText & | operator= (int rhs) |
Set text (equivalent to set without error checking) by lexigraphically converting rhs. More... | |
NodeText & | operator= (unsigned int rhs) |
Set text (equivalent to set without error checking) by lexigraphically converting rhs. More... | |
NodeText & | operator= (double rhs) |
Set text (equivalent to set without error checking) by lexigraphically converting rhs. More... | |
NodeText & | operator= (bool rhs) |
Set text (equivalent to set without error checking)by converting value to "true"/"false". More... | |
bool | Set (const Char8 *rhs) |
Set text. More... | |
bool | Set (int rhs) |
Set text by lexigraphically converting rhs. More... | |
bool | Set (unsigned int rhs) |
Set text by lexigraphically converting rhs. More... | |
bool | Set (double rhs) |
Set text by lexigraphically converting rhs. More... | |
bool | Set (bool rhs) |
Set text by converting value to "true"/"false". More... | |
Friends | |
class | Node |
A helper for working with text inside PCDATA nodes.
Definition at line 73 of file nodetext.h.
bool Mezzanine::XML::NodeText::AsBool | ( | bool | def = false ) | const |
Get text as bool.
def | The default value to return if conversion is not possible. |
double Mezzanine::XML::NodeText::AsDouble | ( | double | def = 0 ) | const |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
float Mezzanine::XML::NodeText::AsFloat | ( | float | def = 0 ) | const |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
int Mezzanine::XML::NodeText::AsInt | ( | int | def = 0 ) | const |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
Get text, or the default Value if object is empty.
def | The value to be returned if there is no valid return |
unsigned int Mezzanine::XML::NodeText::AsUint | ( | unsigned int | def = 0 ) | const |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
Get text as a number, or the default Value if conversion did not succeed or object is empty.
def | The value To be returned if an error occurs in conversion, like a an out of memory condition. |
Node Mezzanine::XML::NodeText::data | ( | ) | const |
bool Mezzanine::XML::NodeText::Empty | ( | ) | const |
Is this storing anything at all?
const Char8* Mezzanine::XML::NodeText::GetString | ( | ) | const |
Get text, or "" if object is empty.
Mezzanine::XML::NodeText::operator unspecified_bool_type | ( | ) | const |
Used to convert this to a boolean value in a safe way.
bool Mezzanine::XML::NodeText::operator! | ( | ) | const |
Used to convert this attribute the opposite of it's normal boolean value.
This is described in the PugiXML source a a workaround for a borland c++ issue.
Set text (equivalent to set without error checking)
rhs | The value to store in this text. |
NodeText& Mezzanine::XML::NodeText::operator= | ( | int | rhs) |
Set text (equivalent to set without error checking) by lexigraphically converting rhs.
rhs | The value to store in this text. |
NodeText& Mezzanine::XML::NodeText::operator= | ( | unsigned int | rhs) |
Set text (equivalent to set without error checking) by lexigraphically converting rhs.
rhs | The value to store in this text. |
NodeText& Mezzanine::XML::NodeText::operator= | ( | double | rhs) |
Set text (equivalent to set without error checking) by lexigraphically converting rhs.
rhs | The value to store in this text. |
NodeText& Mezzanine::XML::NodeText::operator= | ( | bool | rhs) |
Set text (equivalent to set without error checking)by converting value to "true"/"false".
rhs | The value to store in this text. |
bool Mezzanine::XML::NodeText::Set | ( | const Char8 * | rhs) |
Set text.
rhs | The value to store in this text. |
bool Mezzanine::XML::NodeText::Set | ( | int | rhs) |
Set text by lexigraphically converting rhs.
rhs | The value to store in this text. |
bool Mezzanine::XML::NodeText::Set | ( | unsigned int | rhs) |
Set text by lexigraphically converting rhs.
rhs | The value to store in this text. |
bool Mezzanine::XML::NodeText::Set | ( | double | rhs) |
Set text by lexigraphically converting rhs.
rhs | The value to store in this text. |
bool Mezzanine::XML::NodeText::Set | ( | bool | rhs) |
Set text by converting value to "true"/"false".
rhs | The value to store in this text. |