ArtsXMLTag Class Reference

The ARTS XML tag class. More...

#include <xml_io_private.h>

Collaboration diagram for ArtsXMLTag:

Collaboration graph
[legend]

List of all members.

Public Member Functions

Stringget_name ()
void check_name (const String &expected_name)
 Check tag name.
void set_name (const String &new_name)
void add_attribute (const String &aname, const String &value)
 Adds a String attribute to tag.
void add_attribute (const String &aname, const Index &value)
 Adds an Index attribute to tag.
void check_attribute (const String &aname, const String &value)
 Checks whether attribute has the expected value.
void get_attribute_value (const String &aname, String &value)
 Returns value of attribute as String.
void get_attribute_value (const String &aname, Index &value)
 Returns value of attribute as type Index.
void read_from_stream (istream &is)
 Reads next XML tag.
void write_to_stream (ostream &os)
 Write XML tag.

Private Attributes

String name
Array< XMLAttributeattribs


Detailed Description

The ARTS XML tag class.

Handles reading, writing and constructing of XML tags.

Definition at line 82 of file xml_io_private.h.


Member Function Documentation

String& ArtsXMLTag::get_name (  )  [inline]

Definition at line 87 of file xml_io_private.h.

References name.

Referenced by 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.

Parameters:
expected_name Expected tag name

Definition at line 57 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::set_name ( const String new_name  )  [inline]

Definition at line 93 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::add_attribute ( const String aname,
const String value 
)

Adds a String attribute to tag.

Parameters:
aname Attribute name
value Attribute value

Definition at line 75 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().

void ArtsXMLTag::add_attribute ( const String aname,
const Index value 
)

Adds an Index attribute to tag.

Parameters:
aname Attribute name
value Attribute value

Definition at line 92 of file xml_io.cc.

References add_attribute().

void ArtsXMLTag::check_attribute ( const String aname,
const String value 
)

Checks whether attribute has the expected value.

If the attribute has another value or is unknown an exception is thrown.

Parameters:
aname Attribute name
value Expected value

Definition at line 111 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::get_attribute_value ( const String aname,
String value 
)

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*.

Parameters:
aname Attribute name
value Return value

Definition at line 141 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().

void ArtsXMLTag::get_attribute_value ( const String aname,
Index value 
)

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*.

Parameters:
aname Attribute name
value Return value

Definition at line 171 of file xml_io.cc.

References get_attribute_value(), name, and xml_parse_error().

void ArtsXMLTag::read_from_stream ( istream &  is  ) 

Reads next XML tag.

Reads the name and attributes of the next XML tag from stream.

Parameters:
is Input stream

Definition at line 195 of file xml_io.cc.

References attribs, check_name(), XMLAttribute::name, name, my_basic_string< charT >::npos, out3, XMLAttribute::value, and xml_parse_error().

Referenced by xml_read_footer_from_stream(), xml_read_from_stream(), and xml_read_header_from_stream().

void ArtsXMLTag::write_to_stream ( ostream &  os  ) 

Write XML tag.

Puts the tag together and writes it to stream.

Parameters:
os Output stream

Definition at line 331 of file xml_io.cc.

References attribs, and name.

Referenced by xml_data_parse_error(), xml_write_footer_to_stream(), xml_write_header_to_stream(), and xml_write_to_stream().


Member Data Documentation

List of attributes

Definition at line 118 of file xml_io_private.h.

Referenced by add_attribute(), get_attribute_value(), read_from_stream(), and write_to_stream().


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

Generated on Mon Mar 23 14:06:57 2009 for ARTS by  doxygen 1.5.6