ARTS
2.4.0(git:4fb77825)
|
The ARTS XML tag class. More...
#include <xml_io_private.h>
Public Member Functions | |
ArtsXMLTag (const Verbosity &rverbosity) | |
String & | get_name () |
void | check_name (const String &expected_name) |
Check tag name. More... | |
void | set_name (const String &new_name) |
void | add_attribute (const String &aname, const String &value) |
Adds a String attribute to tag. More... | |
void | add_attribute (const String &aname, const Index &value) |
Adds an Index attribute to tag. More... | |
void | add_attribute (const String &aname, const Numeric &value) |
Adds value of attribute as type Numeric to tag. More... | |
void | add_attribute (const String &aname, const std::vector< QuantumNumberType > &value) |
Adds value of attribute as type std::vector<QuantumNumberType> to tag. More... | |
void | add_attribute (const String &aname, const ArrayOfSpeciesTag &value, const bool self, const bool bath) |
Adds value of attribute. More... | |
void | check_attribute (const String &aname, const String &value) |
Checks whether attribute has the expected value. More... | |
void | get_attribute_value (const String &aname, String &value) |
Returns value of attribute as String. More... | |
void | get_attribute_value (const String &aname, Index &value) |
Returns value of attribute as type Index. More... | |
void | get_attribute_value (const String &aname, Numeric &value) |
Returns value of attribute as type Numeric. More... | |
void | get_attribute_value (const String &aname, SpeciesTag &value) |
Returns value of attribute as type SpeciesTag. More... | |
void | get_attribute_value (const String &aname, ArrayOfSpeciesTag &value, bool &self, bool &bath) |
Returns value of attribute as type ArrayOfSpeciesTag. More... | |
void | get_attribute_value (const String &aname, std::vector< QuantumNumberType > &value) |
Returns value of attribute as type ArrayOfSpeciesTag. More... | |
void | get_attribute_value (const String &aname, QuantumNumbers &value) |
Returns value of attribute as type ArrayOfSpeciesTag. More... | |
void | read_from_stream (istream &is) |
Reads next XML tag. More... | |
void | write_to_stream (ostream &os) |
Write XML tag. More... | |
Private Attributes | |
String | name |
Array< XMLAttribute > | attribs |
const Verbosity & | verbosity |
The ARTS XML tag class.
Handles reading, writing and constructing of XML tags.
Definition at line 90 of file xml_io_private.h.
|
inline |
Definition at line 92 of file xml_io_private.h.
void ArtsXMLTag::add_attribute | ( | const String & | aname, |
const ArrayOfSpeciesTag & | value, | ||
const bool | self, | ||
const bool | bath | ||
) |
Adds value of attribute.
[in] | aname | Attribute name |
[in] | value | SpeciesTag(s) for all lines. Basic initialization at self and bath |
[in] | self | True if LineShape::self_broadening in list |
[in] | bath | True if LineShape::bath_broadening in list |
Definition at line 108 of file xml_io.cc.
References add_attribute(), and Array< base >::nelem().
Adds an Index attribute to tag.
aname | Attribute name |
value | Attribute value |
Definition at line 80 of file xml_io.cc.
References add_attribute().
Adds value of attribute as type Numeric to tag.
[in] | aname | Attribute name |
[in] | value | Set value |
Definition at line 87 of file xml_io.cc.
References add_attribute().
void ArtsXMLTag::add_attribute | ( | const String & | aname, |
const std::vector< QuantumNumberType > & | value | ||
) |
Adds value of attribute as type std::vector<QuantumNumberType> to tag.
[in] | aname | Attribute name |
[in] | value | Set value |
Definition at line 94 of file xml_io.cc.
References add_attribute(), and quantumnumbertype2string().
Adds a String attribute to tag.
aname | Attribute name |
value | Attribute value |
Definition at line 66 of file xml_io.cc.
References attribs, XMLAttribute::name, and XMLAttribute::value.
Referenced by add_attribute(), xml_write_header_to_stream(), and xml_write_to_stream().
Checks whether attribute has the expected value.
If the attribute has another value or is unknown an exception is thrown.
aname | Attribute name |
value | Expected value |
Definition at line 131 of file xml_io.cc.
References get_attribute_value(), and xml_parse_error().
Referenced by xml_parse_from_stream(), and xml_read_from_stream().
void ArtsXMLTag::check_name | ( | const String & | expected_name | ) |
Check tag name.
Checks whether the name of the tag is correct. Throws runtime error otherwise.
expected_name | Expected tag name |
Definition at line 54 of file xml_io.cc.
References name, and xml_parse_error().
Referenced by read_from_stream(), xml_read_footer_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().
void ArtsXMLTag::get_attribute_value | ( | const String & | aname, |
ArrayOfSpeciesTag & | value, | ||
bool & | self, | ||
bool & | bath | ||
) |
Returns value of attribute as type ArrayOfSpeciesTag.
Searches for the matching attribute and returns it value. If no attribute with the given name exists, it fails exceptionally.
[in] | aname | Attribute name |
[out] | value | SpeciesTag(s) for all lines. Basic initialization at self and bath |
[out] | self | True if LineShape::self_broadening in list |
[out] | bath | True if LineShape::bath_broadening in list |
Definition at line 209 of file xml_io.cc.
References get_attribute_value(), name, my_basic_string< charT >::nelem(), and xml_parse_error().
Returns value of attribute as type Index.
Searches for the matching attribute and returns it value. If no attribute with the given name exists, return value is set to not found*.
aname | Attribute name |
value | Return value |
Definition at line 176 of file xml_io.cc.
References get_attribute_value(), name, and xml_parse_error().
Returns value of attribute as type Numeric.
Searches for the matching attribute and returns it value. If no attribute with the given name exists, return value is set to -1e99.
[in] | aname | Attribute name |
[out] | value | Return value |
Definition at line 189 of file xml_io.cc.
References get_attribute_value(), name, and xml_parse_error().
void ArtsXMLTag::get_attribute_value | ( | const String & | aname, |
QuantumNumbers & | value | ||
) |
Returns value of attribute as type ArrayOfSpeciesTag.
Searches for the matching attribute and returns it value
[in] | aname | Attribute name |
[in,out] | value | Return value |
Definition at line 265 of file xml_io.cc.
References get_attribute_value(), and QuantumNumbers::Set().
void ArtsXMLTag::get_attribute_value | ( | const String & | aname, |
SpeciesTag & | value | ||
) |
Returns value of attribute as type SpeciesTag.
Searches for the matching attribute and returns it value. If no attribute with the given name exists, it fails exceptionally.
[in] | aname | Attribute name |
[out] | value | Return value |
Definition at line 202 of file xml_io.cc.
References get_attribute_value().
void ArtsXMLTag::get_attribute_value | ( | const String & | aname, |
std::vector< QuantumNumberType > & | value | ||
) |
Returns value of attribute as type ArrayOfSpeciesTag.
Searches for the matching attribute and returns it value
[in] | aname | Attribute name |
[out] | value | Return value |
Definition at line 243 of file xml_io.cc.
References get_attribute_value(), name, my_basic_string< charT >::nelem(), string2quantumnumbertype(), and xml_parse_error().
Returns value of attribute as String.
Searches for the matching attribute and returns it value. If no attribute with the given name exists, return value is set to not found*.
aname | Attribute name |
value | Return value |
Definition at line 153 of file xml_io.cc.
References attribs.
Referenced by check_attribute(), get_attribute_value(), xml_parse_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().
|
inline |
Definition at line 94 of file xml_io_private.h.
References name.
Referenced by xml_read_from_stream().
void ArtsXMLTag::read_from_stream | ( | istream & | is | ) |
Reads next XML tag.
Reads the name and attributes of the next XML tag from stream.
is | Input stream |
Definition at line 289 of file xml_io.cc.
References attribs, check_name(), CREATE_OUT3, XMLAttribute::name, name, my_basic_string< char >::npos, XMLAttribute::value, and xml_parse_error().
Referenced by xml_read_footer_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().
|
inline |
Definition at line 98 of file xml_io_private.h.
References name.
Referenced by xml_write_footer_to_stream(), xml_write_header_to_stream(), and xml_write_to_stream().
void ArtsXMLTag::write_to_stream | ( | ostream & | os | ) |
Write XML tag.
Puts the tag together and writes it to stream.
os | Output stream |
Definition at line 410 of file xml_io.cc.
Referenced by xml_data_parse_error(), xml_write_footer_to_stream(), xml_write_header_to_stream(), and xml_write_to_stream().
|
private |
List of attributes
Definition at line 190 of file xml_io_private.h.
Referenced by add_attribute(), get_attribute_value(), read_from_stream(), and write_to_stream().
|
private |
Tag name
Definition at line 189 of file xml_io_private.h.
Referenced by check_name(), get_attribute_value(), get_name(), read_from_stream(), set_name(), and write_to_stream().
|
private |
Definition at line 191 of file xml_io_private.h.