![]() |
TSDuck v3.43-4509
MPEG Transport Stream Toolkit
|
Attribute of an XML element. More...
#include <tsxmlAttribute.h>
Public Member Functions | |
| Attribute () | |
| Default constructor. | |
| Attribute (const UString &name, const UString &value=UString(), size_t line=0) | |
| Full constructor. | |
| void | expandEnvironment () |
| Expand all environment variables in the attribute value. | |
| const UString | formattedValue (const Tweaks &tweaks) const |
| Get the formatted attribute value with quotes and escaped characters. | |
| bool | ignoreNamespace () const |
| Check if namespace is ignored by default when comparing attribute names. | |
| bool | isValid () const |
| Check if the attribute is valid. | |
| size_t | lineNumber () const |
| Get the line number in input document. | |
| const UString & | name () const |
| Get the attribute name. | |
| bool | nameMatch (const UChar *str) const |
| Check if the name of the attribute matches a given value, case-insensitive. | |
| bool | nameMatch (const UChar *str, bool ignore_namespace) const |
| Check if the name of the attribute matches a given value, case-insensitive. | |
| bool | nameMatch (const UString &str) const |
| Check if the name of the attribute matches a given value, case-insensitive. | |
| bool | nameMatch (const UString &str, bool ignore_namespace) const |
| Check if the name of the attribute matches a given value, case-insensitive. | |
| size_t | sequence () const |
| Get the update sequence number. | |
| void | setBool (bool value) |
| Set a bool attribute to a node. | |
| void | setDate (const Time &value) |
| Set a date (without hours) attribute of an XML element. | |
| void | setDateTime (const Time &value) |
| Set a date/time attribute of an XML element. | |
| template<typename INT > requires ts::int_enum<INT> | |
| void | setEnum (const Names &definition, INT value) |
| Set an enumeration attribute of a node. | |
| template<typename FLT > requires std::floating_point<FLT> | |
| void | setFloat (FLT value, size_t width=0, size_t precision=6, bool force_sign=false) |
| Set an attribute with a floating point value to a node. | |
| void | setIignoreNamespace (bool ignore) |
| Specify if namespace is ignored by default when comparing attribute names. | |
| template<typename INT > requires std::integral<INT> | |
| void | setInteger (INT value, bool hexa=false) |
| Set an attribute with an integer value to a node. | |
| void | setString (const UString &value) |
| Set a string attribute. | |
| template<class Rep , class Period > | |
| void | setTime (const cn::duration< Rep, Period > &value) |
| Set a time attribute of an XML element in "hh:mm:ss" format. | |
| const UString & | value () const |
| Get the attribute value. | |
Static Public Member Functions | |
| static bool | DateFromString (Time &value, const UString &str) |
| Convert a string into a date (without hours), as required in attributes. | |
| static bool | DateTimeFromString (Time &value, const UString &str) |
| Convert a string into a date/time, as required in attributes. | |
| static UString | DateTimeToString (const Time &value) |
| Convert a date/time into a string, as required in attributes. | |
| static UString | DateToString (const Time &value) |
| Convert a date (without time) into a string, as required in attributes. | |
| static const Attribute & | INVALID () |
| A constant static invalid instance. | |
| template<class Rep , class Period > | |
| static bool | TimeFromString (cn::duration< Rep, Period > &value, const UString &str) |
| Convert a string into a time, as required in attributes. | |
| template<class Rep , class Period > | |
| static UString | TimeToString (const cn::duration< Rep, Period > &value) |
| Convert a time (without date) into a string, as required in attributes. | |
Attribute of an XML element.
| ts::xml::Attribute::Attribute | ( | ) |
Default constructor.
The argument is initially invalid, everything will fail.
|
inline |
Check if the attribute is valid.
|
inline |
Get the line number in input document.
|
inline |
Get the attribute name.
|
inline |
Check if the name of the attribute matches a given value, case-insensitive.
| [in] | str | The string value to compare. |
|
inline |
Check if the name of the attribute matches a given value, case-insensitive.
| [in] | str | The string value to compare. |
| bool ts::xml::Attribute::nameMatch | ( | const UChar * | str, |
| bool | ignore_namespace | ||
| ) | const |
Check if the name of the attribute matches a given value, case-insensitive.
| [in] | str | The string value to compare. |
| [in] | ignore_namespace | If true, ignore namespaces in the comparison. |
|
inline |
Check if the name of the attribute matches a given value, case-insensitive.
| [in] | str | The string value to compare. |
| [in] | ignore_namespace | If true, ignore namespaces in the comparison. |
|
inline |
Check if namespace is ignored by default when comparing attribute names.
|
inline |
Specify if namespace is ignored by default when comparing attribute names.
| [in] | ignore | It true, namespace is ignored by default. |
|
inline |
Get the attribute value.
Get the formatted attribute value with quotes and escaped characters.
| [in] | tweaks | Formatting tweaks. |
|
inline |
Get the update sequence number.
Each time an attribute is updated, a global (non-thread-safe) index is incremented. The method returns the value of the global index the last time the attribute was modified. This is a way to rebuild the list of attributes in their order of modification.
| void ts::xml::Attribute::setString | ( | const UString & | value | ) |
Set a string attribute.
| [in] | value | Attribute value. |
| void ts::xml::Attribute::setBool | ( | bool | value | ) |
Set a bool attribute to a node.
| [in] | value | Attribute value. |
|
inline |
|
inline |
Set an attribute with a floating point value to a node.
| FLT | a floating point type. |
| [in] | value | Attribute value. |
| [in] | width | Width of the formatted number, not including the optional prefix and separator. |
| [in] | precision | Precision to use after the decimal point. Default is 6 digits. |
| [in] | force_sign | If true, force a '+' sign for positive values. |
| void ts::xml::Attribute::setDateTime | ( | const Time & | value | ) |
Set a date/time attribute of an XML element.
| [in] | value | Attribute value. |
| void ts::xml::Attribute::setDate | ( | const Time & | value | ) |
Set a date (without hours) attribute of an XML element.
| [in] | value | Attribute value. |
|
inline |
Set a time attribute of an XML element in "hh:mm:ss" format.
| [in] | value | Attribute value. |
Convert a date/time into a string, as required in attributes.
| [in] | value | Time value. |
Convert a date (without time) into a string, as required in attributes.
| [in] | value | Time value. |
|
static |
Convert a time (without date) into a string, as required in attributes.
| [in] | value | Time value. |
Convert a string into a date (without hours), as required in attributes.
| [in,out] | value | Date value. Unmodified in case of error. |
| [in] | str | Date value as a string. |
|
static |
| void ts::xml::Attribute::expandEnvironment | ( | ) |
Expand all environment variables in the attribute value.
Environment variables are referenced using '${varname}' in text, attributes, names.
|
static |
A constant static invalid instance.
Used as universal invalid attribute.