Kodi Documentation 22.0
Kodi is an open source media player and entertainment hub.
Loading...
Searching...
No Matches
XMLUtils Class Reference

#include <XMLUtils.h>

Static Public Member Functions

static bool HasChild (const TiXmlNode *pRootNode, const char *strTag)
 
static bool HasChild (const tinyxml2::XMLNode *rootNode, const char *tag)
 
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 GetHex (const tinyxml2::XMLNode *rootNode, const char *tag, uint32_t &value)
 
static bool GetUInt (const tinyxml2::XMLNode *rootNode, const char *tag, uint32_t &value)
 
static bool GetLong (const tinyxml2::XMLNode *rootNode, const char *tag, long &value)
 
static bool GetFloat (const tinyxml2::XMLNode *rootNode, const char *tag, float &value)
 
static bool GetDouble (const tinyxml2::XMLNode *rootNode, const char *tag, double &value)
 
static bool GetInt (const tinyxml2::XMLNode *rootNode, const char *tag, int &value)
 
static bool GetBoolean (const tinyxml2::XMLNode *rootNode, const char *tag, bool &value)
 
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.
 
static bool GetString (const tinyxml2::XMLNode *rootNode, const char *tag, std::string &value)
 
static std::string GetString (const TiXmlNode *pRootNode, const char *strTag)
 Get a string value from the xml tag.
 
static std::string GetString (const tinyxml2::XMLNode *rootNode, const char *tag)
 
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.
 
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 bool GetAdditiveString (const tinyxml2::XMLNode *rootNode, const char *tag, const std::string &separator, std::string &value, bool clear=false)
 
static bool GetStringArray (const tinyxml2::XMLNode *rootNode, const char *tag, std::vector< std::string > &value, bool clear=false, const std::string &separator="")
 
static bool GetPath (const tinyxml2::XMLNode *rootNode, const char *tag, std::string &value)
 
static bool GetFloat (const tinyxml2::XMLNode *rootNode, const char *tag, float &value, const float min, const float max)
 
static bool GetUInt (const tinyxml2::XMLNode *rootNode, const char *tag, uint32_t &value, const uint32_t min, const uint32_t max)
 
static bool GetInt (const tinyxml2::XMLNode *rootNode, const char *tag, int &value, const int min, const int max)
 
static bool GetDate (const tinyxml2::XMLNode *rootNode, const char *tag, CDateTime &date)
 
static bool GetDateTime (const tinyxml2::XMLNode *rootNode, const char *tag, 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.
 
static std::string GetAttribute (const tinyxml2::XMLElement *element, const char *tag)
 
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 TiXmlNode * SetDouble (TiXmlNode *pRootNode, const char *strTag, double 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 tinyxml2::XMLNode * SetString (tinyxml2::XMLNode *rootNode, const char *tag, const std::string &value)
 
static void SetAdditiveString (tinyxml2::XMLNode *rootNode, const char *tag, const std::string &separator, const std::string &value)
 
static void SetStringArray (tinyxml2::XMLNode *rootNode, const char *tag, const std::vector< std::string > &value)
 
static tinyxml2::XMLNode * SetInt (tinyxml2::XMLNode *rootNode, const char *tag, int value)
 
static tinyxml2::XMLNode * SetFloat (tinyxml2::XMLNode *rootNode, const char *tag, float value)
 
static tinyxml2::XMLNode * SetDouble (tinyxml2::XMLNode *rootNode, const char *tag, double value)
 
static void SetBoolean (tinyxml2::XMLNode *rootNode, const char *tag, bool value)
 
static void SetHex (tinyxml2::XMLNode *rootNode, const char *tag, uint32_t value)
 
static void SetPath (tinyxml2::XMLNode *rootNode, const char *tag, const std::string &value)
 
static void SetLong (tinyxml2::XMLNode *rootNode, const char *tag, long value)
 
static void SetDate (tinyxml2::XMLNode *rootNode, const char *tag, const CDateTime &date)
 
static void SetDateTime (tinyxml2::XMLNode *rootNode, const char *tag, const CDateTime &dateTime)
 

Static Public Attributes

static const int path_version = 1
 

Member Function Documentation

◆ GetAdditiveString() [1/2]

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

◆ GetAdditiveString() [2/2]

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() [1/2]

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

◆ GetAttribute() [2/2]

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() [1/2]

bool XMLUtils::GetBoolean ( const tinyxml2::XMLNode * rootNode,
const char * tag,
bool & value )
static

◆ GetBoolean() [2/2]

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

◆ GetDate() [1/2]

bool XMLUtils::GetDate ( const tinyxml2::XMLNode * rootNode,
const char * tag,
CDateTime & date )
static

◆ GetDate() [2/2]

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

◆ GetDateTime() [1/2]

bool XMLUtils::GetDateTime ( const tinyxml2::XMLNode * rootNode,
const char * tag,
CDateTime & dateTime )
static

◆ GetDateTime() [2/2]

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

◆ GetDouble() [1/2]

bool XMLUtils::GetDouble ( const tinyxml2::XMLNode * rootNode,
const char * tag,
double & value )
static

◆ GetDouble() [2/2]

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

◆ GetFloat() [1/4]

bool XMLUtils::GetFloat ( const tinyxml2::XMLNode * rootNode,
const char * tag,
float & value )
static

◆ GetFloat() [2/4]

bool XMLUtils::GetFloat ( const tinyxml2::XMLNode * rootNode,
const char * tag,
float & value,
const float min,
const float max )
static

◆ GetFloat() [3/4]

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

◆ GetFloat() [4/4]

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

◆ GetHex() [1/2]

bool XMLUtils::GetHex ( const tinyxml2::XMLNode * rootNode,
const char * tag,
uint32_t & value )
static

◆ GetHex() [2/2]

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

◆ GetInt() [1/4]

bool XMLUtils::GetInt ( const tinyxml2::XMLNode * rootNode,
const char * tag,
int & value )
static

◆ GetInt() [2/4]

bool XMLUtils::GetInt ( const tinyxml2::XMLNode * rootNode,
const char * tag,
int & value,
const int min,
const int max )
static

◆ GetInt() [3/4]

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

◆ GetInt() [4/4]

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

◆ GetLong() [1/2]

bool XMLUtils::GetLong ( const tinyxml2::XMLNode * rootNode,
const char * tag,
long & value )
static

◆ GetLong() [2/2]

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

◆ GetPath() [1/2]

bool XMLUtils::GetPath ( const tinyxml2::XMLNode * rootNode,
const char * tag,
std::string & value )
static

◆ GetPath() [2/2]

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

◆ GetString() [1/4]

std::string XMLUtils::GetString ( const tinyxml2::XMLNode * rootNode,
const char * tag )
static

◆ GetString() [2/4]

bool XMLUtils::GetString ( const tinyxml2::XMLNode * rootNode,
const char * tag,
std::string & value )
static

◆ GetString() [3/4]

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() [4/4]

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() [1/2]

bool XMLUtils::GetStringArray ( const tinyxml2::XMLNode * rootNode,
const char * tag,
std::vector< std::string > & value,
bool clear = false,
const std::string & separator = "" )
static

◆ GetStringArray() [2/2]

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/4]

bool XMLUtils::GetUInt ( const tinyxml2::XMLNode * rootNode,
const char * tag,
uint32_t & value )
static

◆ GetUInt() [2/4]

bool XMLUtils::GetUInt ( const tinyxml2::XMLNode * rootNode,
const char * tag,
uint32_t & value,
const uint32_t min,
const uint32_t max )
static

◆ GetUInt() [3/4]

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

◆ GetUInt() [4/4]

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

◆ HasChild() [1/2]

bool XMLUtils::HasChild ( const tinyxml2::XMLNode * rootNode,
const char * tag )
static

◆ HasChild() [2/2]

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

◆ SetAdditiveString() [1/2]

void XMLUtils::SetAdditiveString ( tinyxml2::XMLNode * rootNode,
const char * tag,
const std::string & separator,
const std::string & value )
static

◆ SetAdditiveString() [2/2]

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

◆ SetBoolean() [1/2]

void XMLUtils::SetBoolean ( tinyxml2::XMLNode * rootNode,
const char * tag,
bool value )
static

◆ SetBoolean() [2/2]

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

◆ SetDate() [1/2]

void XMLUtils::SetDate ( tinyxml2::XMLNode * rootNode,
const char * tag,
const CDateTime & date )
static

◆ SetDate() [2/2]

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

◆ SetDateTime() [1/2]

void XMLUtils::SetDateTime ( tinyxml2::XMLNode * rootNode,
const char * tag,
const CDateTime & dateTime )
static

◆ SetDateTime() [2/2]

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

◆ SetDouble() [1/2]

tinyxml2::XMLNode * XMLUtils::SetDouble ( tinyxml2::XMLNode * rootNode,
const char * tag,
double value )
static

◆ SetDouble() [2/2]

TiXmlNode * XMLUtils::SetDouble ( TiXmlNode * pRootNode,
const char * strTag,
double value )
static

◆ SetFloat() [1/2]

tinyxml2::XMLNode * XMLUtils::SetFloat ( tinyxml2::XMLNode * rootNode,
const char * tag,
float value )
static

◆ SetFloat() [2/2]

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

◆ SetHex() [1/2]

void XMLUtils::SetHex ( tinyxml2::XMLNode * rootNode,
const char * tag,
uint32_t value )
static

◆ SetHex() [2/2]

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

◆ SetInt() [1/2]

tinyxml2::XMLNode * XMLUtils::SetInt ( tinyxml2::XMLNode * rootNode,
const char * tag,
int value )
static

◆ SetInt() [2/2]

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

◆ SetLong() [1/2]

void XMLUtils::SetLong ( tinyxml2::XMLNode * rootNode,
const char * tag,
long value )
static

◆ SetLong() [2/2]

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

◆ SetPath() [1/2]

void XMLUtils::SetPath ( tinyxml2::XMLNode * rootNode,
const char * tag,
const std::string & value )
static

◆ SetPath() [2/2]

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

◆ SetString() [1/2]

tinyxml2::XMLNode * XMLUtils::SetString ( tinyxml2::XMLNode * rootNode,
const char * tag,
const std::string & value )
static

◆ SetString() [2/2]

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

◆ SetStringArray() [1/2]

void XMLUtils::SetStringArray ( tinyxml2::XMLNode * rootNode,
const char * tag,
const std::vector< std::string > & value )
static

◆ SetStringArray() [2/2]

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: