#include <tsxmlAttribute.h>
|
| | Attribute () |
| | Attribute (const UString &name, const UString &value=UString(), size_t line=0) |
| void | expandEnvironment () |
| const UString | formattedValue (const Tweaks &tweaks) const |
| bool | ignoreNamespace () const |
| bool | isValid () const |
| size_t | lineNumber () const |
| const UString & | name () const |
| bool | nameMatch (const UChar *str) const |
| bool | nameMatch (const UChar *str, bool ignore_namespace) const |
| bool | nameMatch (const UString &str) const |
| bool | nameMatch (const UString &str, bool ignore_namespace) const |
| size_t | sequence () const |
| void | setBool (bool value) |
| void | setDate (const Time &value) |
| void | setDateTime (const Time &value) |
template<typename INT>
requires ts::int_enum<INT> |
| void | setEnum (const Names &definition, INT value) |
template<typename FLT>
requires std::floating_point<FLT> |
| void | setFloat (FLT value, size_t width=0, size_t precision=6, bool force_sign=false) |
| void | setIignoreNamespace (bool ignore) |
template<typename INT>
requires std::integral<INT> |
| void | setInteger (INT value, bool hexa=false) |
| void | setString (const UString &value) |
| template<class Rep, class Period> |
| void | setTime (const cn::duration< Rep, Period > &value) |
| const UString & | value () const |
Attribute of an XML element.
◆ Attribute() [1/2]
| ts::xml::Attribute::Attribute |
( |
| ) |
|
Default constructor. The argument is initially invalid, everything will fail.
◆ Attribute() [2/2]
| ts::xml::Attribute::Attribute |
( |
const UString & | name, |
|
|
const UString & | value = UString(), |
|
|
size_t | line = 0 ) |
|
explicit |
Full constructor.
- Parameters
-
◆ isValid()
| bool ts::xml::Attribute::isValid |
( |
| ) |
const |
|
inline |
Check if the attribute is valid.
- Returns
- True if the attribute is valid.
◆ lineNumber()
| size_t ts::xml::Attribute::lineNumber |
( |
| ) |
const |
|
inline |
Get the line number in input document.
- Returns
- The line number in input document, zero if the attribute was built programmatically.
◆ name()
| const UString & ts::xml::Attribute::name |
( |
| ) |
const |
|
inline |
Get the attribute name.
- Returns
- A constant reference to the attribute name.
◆ nameMatch() [1/4]
| bool ts::xml::Attribute::nameMatch |
( |
const UChar * | str | ) |
const |
|
inline |
Check if the name of the attribute matches a given value, case-insensitive.
- Parameters
-
| [in] | str | The string value to compare. |
- Returns
- True is the name of this object matches str.
◆ nameMatch() [2/4]
| bool ts::xml::Attribute::nameMatch |
( |
const UString & | str | ) |
const |
|
inline |
Check if the name of the attribute matches a given value, case-insensitive.
- Parameters
-
| [in] | str | The string value to compare. |
- Returns
- True is the name of this object matches str.
◆ nameMatch() [3/4]
| 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.
- Parameters
-
| [in] | str | The string value to compare. |
| [in] | ignore_namespace | If true, ignore namespaces in the comparison. |
- Returns
- True is the name of this object matches str.
◆ nameMatch() [4/4]
| bool ts::xml::Attribute::nameMatch |
( |
const UString & | str, |
|
|
bool | ignore_namespace ) const |
|
inline |
Check if the name of the attribute matches a given value, case-insensitive.
- Parameters
-
| [in] | str | The string value to compare. |
| [in] | ignore_namespace | If true, ignore namespaces in the comparison. |
- Returns
- True is the name of this object matches str.
◆ ignoreNamespace()
| bool ts::xml::Attribute::ignoreNamespace |
( |
| ) |
const |
|
inline |
Check if namespace is ignored by default when comparing attribute names.
- Returns
- True if namespace is ignored by default.
◆ setIignoreNamespace()
| void ts::xml::Attribute::setIignoreNamespace |
( |
bool | ignore | ) |
|
|
inline |
Specify if namespace is ignored by default when comparing attribute names.
- Parameters
-
| [in] | ignore | It true, namespace is ignored by default. |
◆ value()
| const UString & ts::xml::Attribute::value |
( |
| ) |
const |
|
inline |
Get the attribute value.
- Returns
- A constant reference to the attribute value.
◆ formattedValue()
| const UString ts::xml::Attribute::formattedValue |
( |
const Tweaks & | tweaks | ) |
const |
Get the formatted attribute value with quotes and escaped characters.
- Parameters
-
| [in] | tweaks | Formatting tweaks. |
- Returns
- The formatted value of the attribute.
◆ sequence()
| size_t ts::xml::Attribute::sequence |
( |
| ) |
const |
|
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.
- Returns
- The update sequence number.
◆ setString()
| void ts::xml::Attribute::setString |
( |
const UString & | value | ) |
|
Set a string attribute.
- Parameters
-
◆ setBool()
| void ts::xml::Attribute::setBool |
( |
bool | value | ) |
|
Set a bool attribute to a node.
- Parameters
-
◆ setInteger()
template<typename
INT>
requires std::integral<
INT>
| void ts::xml::Attribute::setInteger |
( |
INT | value, |
|
|
bool | hexa = false ) |
|
inline |
Set an attribute with an integer value to a node.
- Template Parameters
-
- Parameters
-
| [in] | value | Attribute value. |
| [in] | hexa | If true, use an hexadecimal representation. When decimal is used, a comma is used as thousands separator. When hexadecimal is used, a 0x prefix is added. |
◆ setEnum()
| void ts::xml::Attribute::setEnum |
( |
const Names & | definition, |
|
|
INT | value ) |
|
inline |
Set an enumeration attribute of a node.
- Template Parameters
-
| INT | An integer or enum type. |
- Parameters
-
| [in] | definition | The definition of enumeration values. |
| [in] | value | Attribute value. |
◆ setFloat()
template<typename FLT>
requires std::floating_point<FLT>
| void ts::xml::Attribute::setFloat |
( |
FLT | value, |
|
|
size_t | width = 0, |
|
|
size_t | precision = 6, |
|
|
bool | force_sign = false ) |
|
inline |
Set an attribute with a floating point value to a node.
- Template Parameters
-
| FLT | a floating point type. |
- Parameters
-
| [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. |
◆ setDateTime()
| void ts::xml::Attribute::setDateTime |
( |
const Time & | value | ) |
|
Set a date/time attribute of an XML element.
- Parameters
-
◆ setDate()
| void ts::xml::Attribute::setDate |
( |
const Time & | value | ) |
|
Set a date (without hours) attribute of an XML element.
- Parameters
-
◆ setTime()
template<class Rep, class Period>
| void ts::xml::Attribute::setTime |
( |
const cn::duration< Rep, Period > & | value | ) |
|
|
inline |
Set a time attribute of an XML element in "hh:mm:ss" format.
- Parameters
-
◆ DateTimeToString()
| UString ts::xml::Attribute::DateTimeToString |
( |
const Time & | value | ) |
|
|
static |
Convert a date/time into a string, as required in attributes.
- Parameters
-
- Returns
- The corresponding string.
◆ DateToString()
| UString ts::xml::Attribute::DateToString |
( |
const Time & | value | ) |
|
|
static |
Convert a date (without time) into a string, as required in attributes.
- Parameters
-
- Returns
- The corresponding string.
◆ TimeToString()
template<class Rep, class Period>
| UString ts::xml::Attribute::TimeToString |
( |
const cn::duration< Rep, Period > & | value | ) |
|
|
static |
Convert a time (without date) into a string, as required in attributes.
- Parameters
-
- Returns
- The corresponding string.
◆ DateTimeFromString()
| bool ts::xml::Attribute::DateTimeFromString |
( |
Time & | value, |
|
|
const UString & | str ) |
|
static |
Convert a string into a date/time, as required in attributes.
- Parameters
-
| [in,out] | value | Time value. Unmodified in case of error. |
| [in] | str | Time value as a string. |
- Returns
- True on success, false on error.
◆ DateFromString()
| bool ts::xml::Attribute::DateFromString |
( |
Time & | value, |
|
|
const UString & | str ) |
|
static |
Convert a string into a date (without hours), as required in attributes.
- Parameters
-
| [in,out] | value | Date value. Unmodified in case of error. |
| [in] | str | Date value as a string. |
- Returns
- True on success, false on error.
◆ TimeFromString()
template<class Rep, class Period>
| bool ts::xml::Attribute::TimeFromString |
( |
cn::duration< Rep, Period > & | value, |
|
|
const UString & | str ) |
|
static |
Convert a string into a time, as required in attributes.
- Parameters
-
| [in,out] | value | Time value. Unmodified in case of error. |
| [in] | str | Time value as a string. |
- Returns
- True on success, false on error.
◆ expandEnvironment()
| void ts::xml::Attribute::expandEnvironment |
( |
| ) |
|
Expand all environment variables in the attribute value. Environment variables are referenced using '${varname}' in text, attributes, names.
◆ INVALID()
| const Attribute & ts::xml::Attribute::INVALID |
( |
| ) |
|
|
static |
A constant static invalid instance. Used as universal invalid attribute.
- Returns
- A constant reference to the universal invalid attribute.
The documentation for this class was generated from the following file: