Kodi Documentation 18.0
Kodi is an open source media player and entertainment hub.
XMLUtils Class Reference

#include <XMLUtils.h>

Static Public Member Functions

static bool HasChild (const TiXmlNode *pRootNode, const char *strTag)
 
static bool GetHex (const TiXmlNode *pRootNode, const char *strTag, uint32_t &dwHexValue)
 
static bool GetUInt (const TiXmlNode *pRootNode, const char *strTag, uint32_t &dwUIntValue)
 
static bool GetLong (const TiXmlNode *pRootNode, const char *strTag, long &lLongValue)
 
static bool GetFloat (const TiXmlNode *pRootNode, const char *strTag, float &value)
 
static bool GetDouble (const TiXmlNode *pRootNode, const char *strTag, double &value)
 
static bool GetInt (const TiXmlNode *pRootNode, const char *strTag, int &iIntValue)
 
static bool GetBoolean (const TiXmlNode *pRootNode, const char *strTag, bool &bBoolValue)
 
static bool GetString (const TiXmlNode *pRootNode, const char *strTag, std::string &strStringValue)
 Get a string value from the xml tag If the specified tag isn't found strStringvalue is not modified and will contain whatever value it had before the method call. More...
 
static std::string GetString (const TiXmlNode *pRootNode, const char *strTag)
 Get a string value from the xml tag. More...
 
static bool GetAdditiveString (const TiXmlNode *rootNode, const char *tag, const std::string &separator, std::string &value, bool clear=false)
 Get multiple tags, concatenating the values together. Transforms <tag>value1</tag> <tag clear="true">value2</tag> ... <tag>valuen</tag> into value2<sep>...<sep>valuen, appending it to the value string. Note that <value1> is overwritten by the clear="true" tag. More...
 
static bool GetStringArray (const TiXmlNode *rootNode, const char *tag, std::vector< std::string > &arrayValue, bool clear=false, const std::string &separator="")
 
static bool GetPath (const TiXmlNode *pRootNode, const char *strTag, std::string &strStringValue)
 
static bool GetFloat (const TiXmlNode *pRootNode, const char *strTag, float &value, const float min, const float max)
 
static bool GetUInt (const TiXmlNode *pRootNode, const char *strTag, uint32_t &dwUIntValue, const uint32_t min, const uint32_t max)
 
static bool GetInt (const TiXmlNode *pRootNode, const char *strTag, int &iIntValue, const int min, const int max)
 
static bool GetDate (const TiXmlNode *pRootNode, const char *strTag, CDateTime &date)
 
static bool GetDateTime (const TiXmlNode *pRootNode, const char *strTag, CDateTime &dateTime)
 
static std::string GetAttribute (const TiXmlElement *element, const char *tag)
 Fetch a std::string copy of an attribute, if it exists. Cannot distinguish between empty and non-existent attributes. More...
 
static TiXmlNode * SetString (TiXmlNode *pRootNode, const char *strTag, const std::string &strValue)
 
static void SetAdditiveString (TiXmlNode *pRootNode, const char *strTag, const std::string &strSeparator, const std::string &strValue)
 
static void SetStringArray (TiXmlNode *pRootNode, const char *strTag, const std::vector< std::string > &arrayValue)
 
static TiXmlNode * SetInt (TiXmlNode *pRootNode, const char *strTag, int value)
 
static TiXmlNode * SetFloat (TiXmlNode *pRootNode, const char *strTag, float value)
 
static void SetBoolean (TiXmlNode *pRootNode, const char *strTag, bool value)
 
static void SetHex (TiXmlNode *pRootNode, const char *strTag, uint32_t value)
 
static void SetPath (TiXmlNode *pRootNode, const char *strTag, const std::string &strValue)
 
static void SetLong (TiXmlNode *pRootNode, const char *strTag, long iValue)
 
static void SetDate (TiXmlNode *pRootNode, const char *strTag, const CDateTime &date)
 
static void SetDateTime (TiXmlNode *pRootNode, const char *strTag, const CDateTime &dateTime)
 

Static Public Attributes

static const int path_version = 1
 

Member Function Documentation

◆ GetAdditiveString()

bool XMLUtils::GetAdditiveString ( const TiXmlNode *  rootNode,
const char *  tag,
const std::string &  separator,
std::string &  value,
bool  clear = false 
)
static

Get multiple tags, concatenating the values together. Transforms <tag>value1</tag> <tag clear="true">value2</tag> ... <tag>valuen</tag> into value2<sep>...<sep>valuen, appending it to the value string. Note that <value1> is overwritten by the clear="true" tag.

Parameters
rootNodethe parent containing the <tag>'s.
tagthe <tag> in question.
separatorthe separator to use when concatenating values.
value[out] the resulting string. Remains untouched if no <tag> is available, else is appended (or cleared based on the clear parameter).
clearif true, clears the string prior to adding tags, if tags are available. Defaults to false.

◆ GetAttribute()

std::string XMLUtils::GetAttribute ( const TiXmlElement *  element,
const char *  tag 
)
static

Fetch a std::string copy of an attribute, if it exists. Cannot distinguish between empty and non-existent attributes.

Parameters
elementthe element to query.
tagthe name of the attribute.
Returns
the attribute, if it exists, else an empty string

◆ GetBoolean()

bool XMLUtils::GetBoolean ( const TiXmlNode *  pRootNode,
const char *  strTag,
bool &  bBoolValue 
)
static

◆ GetDate()

bool XMLUtils::GetDate ( const TiXmlNode *  pRootNode,
const char *  strTag,
CDateTime date 
)
static

◆ GetDateTime()

bool XMLUtils::GetDateTime ( const TiXmlNode *  pRootNode,
const char *  strTag,
CDateTime dateTime 
)
static

◆ GetDouble()

bool XMLUtils::GetDouble ( const TiXmlNode *  pRootNode,
const char *  strTag,
double &  value 
)
static

◆ GetFloat() [1/2]

bool XMLUtils::GetFloat ( const TiXmlNode *  pRootNode,
const char *  strTag,
float &  value 
)
static

◆ GetFloat() [2/2]

bool XMLUtils::GetFloat ( const TiXmlNode *  pRootNode,
const char *  strTag,
float &  value,
const float  min,
const float  max 
)
static

◆ GetHex()

bool XMLUtils::GetHex ( const TiXmlNode *  pRootNode,
const char *  strTag,
uint32_t &  dwHexValue 
)
static

◆ GetInt() [1/2]

bool XMLUtils::GetInt ( const TiXmlNode *  pRootNode,
const char *  strTag,
int &  iIntValue 
)
static

◆ GetInt() [2/2]

bool XMLUtils::GetInt ( const TiXmlNode *  pRootNode,
const char *  strTag,
int &  iIntValue,
const int  min,
const int  max 
)
static

◆ GetLong()

bool XMLUtils::GetLong ( const TiXmlNode *  pRootNode,
const char *  strTag,
long &  lLongValue 
)
static

◆ GetPath()

bool XMLUtils::GetPath ( const TiXmlNode *  pRootNode,
const char *  strTag,
std::string &  strStringValue 
)
static

◆ GetString() [1/2]

std::string XMLUtils::GetString ( const TiXmlNode *  pRootNode,
const char *  strTag 
)
static

Get a string value from the xml tag.

Parameters
[in]pRootNodethe xml node that contains the tag
[in]strTagthe tag to read from
Returns
the value in the specified tag or an empty string if the tag isn't found

◆ GetString() [2/2]

bool XMLUtils::GetString ( const TiXmlNode *  pRootNode,
const char *  strTag,
std::string &  strStringValue 
)
static

Get a string value from the xml tag If the specified tag isn't found strStringvalue is not modified and will contain whatever value it had before the method call.

Parameters
[in]pRootNodethe xml node that contains the tag
[in]strTagthe xml tag to read from
[in,out]strStringValuewhere to store the read string
Returns
true on success, false if the tag isn't found

◆ GetStringArray()

bool XMLUtils::GetStringArray ( const TiXmlNode *  pRootNode,
const char *  strTag,
std::vector< std::string > &  arrayValue,
bool  clear = false,
const std::string &  separator = "" 
)
static

Parses the XML for multiple tags of the given name. Does not clear the array to support chaining.

◆ GetUInt() [1/2]

bool XMLUtils::GetUInt ( const TiXmlNode *  pRootNode,
const char *  strTag,
uint32_t &  dwUIntValue 
)
static

◆ GetUInt() [2/2]

bool XMLUtils::GetUInt ( const TiXmlNode *  pRootNode,
const char *  strTag,
uint32_t &  dwUIntValue,
const uint32_t  min,
const uint32_t  max 
)
static

◆ HasChild()

bool XMLUtils::HasChild ( const TiXmlNode *  pRootNode,
const char *  strTag 
)
static

◆ SetAdditiveString()

void XMLUtils::SetAdditiveString ( TiXmlNode *  pRootNode,
const char *  strTag,
const std::string &  strSeparator,
const std::string &  strValue 
)
static

◆ SetBoolean()

void XMLUtils::SetBoolean ( TiXmlNode *  pRootNode,
const char *  strTag,
bool  value 
)
static

◆ SetDate()

void XMLUtils::SetDate ( TiXmlNode *  pRootNode,
const char *  strTag,
const CDateTime date 
)
static

◆ SetDateTime()

void XMLUtils::SetDateTime ( TiXmlNode *  pRootNode,
const char *  strTag,
const CDateTime dateTime 
)
static

◆ SetFloat()

TiXmlNode * XMLUtils::SetFloat ( TiXmlNode *  pRootNode,
const char *  strTag,
float  value 
)
static

◆ SetHex()

void XMLUtils::SetHex ( TiXmlNode *  pRootNode,
const char *  strTag,
uint32_t  value 
)
static

◆ SetInt()

TiXmlNode * XMLUtils::SetInt ( TiXmlNode *  pRootNode,
const char *  strTag,
int  value 
)
static

◆ SetLong()

void XMLUtils::SetLong ( TiXmlNode *  pRootNode,
const char *  strTag,
long  iValue 
)
static

◆ SetPath()

void XMLUtils::SetPath ( TiXmlNode *  pRootNode,
const char *  strTag,
const std::string &  strValue 
)
static

◆ SetString()

TiXmlNode * XMLUtils::SetString ( TiXmlNode *  pRootNode,
const char *  strTag,
const std::string &  strValue 
)
static

◆ SetStringArray()

void XMLUtils::SetStringArray ( TiXmlNode *  pRootNode,
const char *  strTag,
const std::vector< std::string > &  arrayValue 
)
static

Member Data Documentation

◆ path_version

const int XMLUtils::path_version = 1
static

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