ARTS  2.0.49
xml_io_private.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2008 Oliver Lemke <olemke@core-dump.info>
2 
3  This program is free software; you can redistribute it and/or modify it
4  under the terms of the GNU General Public License as published by the
5  Free Software Foundation; either version 2, or (at your option) any
6  later version.
7 
8  This program is distributed in the hope that it will be useful,
9  but WITHOUT ANY WARRANTY; without even the implied warranty of
10  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11  GNU General Public License for more details.
12 
13  You should have received a copy of the GNU General Public License
14  along with this program; if not, write to the Free Software
15  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
16  USA. */
17 
18 
20 // File description
22 
32 #ifndef xml_io_private_h
33 #define xml_io_private_h
34 
35 #include "xml_io.h"
36 #include <stdexcept>
37 #include <cfloat>
38 #include "matpackVII.h"
39 #include "array.h"
40 #include "messages.h"
41 #include "ppath.h"
42 #include "agenda_class.h"
43 #include "absorption.h"
44 #include "gas_abs_lookup.h"
45 #include "optproperties.h"
46 #include "bifstream.h"
47 #include "bofstream.h"
48 
49 
51 // Functions to open and read XML files
53 
54 void
55 xml_open_output_file (ostream& file, const String& name);
56 
57 void
58 xml_open_input_file (ifstream& file, const String& name, const Verbosity& verbosity);
59 
60 
62 // XML parser classes
64 
66 
71 {
72 public:
75 };
76 
77 
79 
83 {
84 public:
85  ArtsXMLTag(const Verbosity& rverbosity) : verbosity(rverbosity) {};
86 
87  String&
88  get_name () { return (name); }
89 
90  void
91  check_name (const String& expected_name);
92 
93  void
94  set_name (const String& new_name) { name = new_name; }
95 
96  void
97  add_attribute (const String& aname, const String& value);
98 
99  void
100  add_attribute (const String& aname, const Index& value);
101 
102  void
103  check_attribute (const String& aname, const String& value);
104 
105  void
106  get_attribute_value (const String& aname, String& value);
107 
108  void
109  get_attribute_value (const String& aname, Index& value);
110 
111  void
112  read_from_stream (istream& is);
113 
114  void
115  write_to_stream (ostream& os);
116 
117 private:
121 };
122 
123 
125 // General XML handling routines
127 
128 void
129 xml_parse_error (const String& str_error);
130 
131 void
132 xml_data_parse_error (ArtsXMLTag& tag, String str_error);
133 
134 void
135 xml_read_header_from_stream (istream& is, FileType& ftype,
136  NumericType& ntype, EndianType& etype,
137  const Verbosity& verbosity);
138 
139 void
140 xml_read_footer_from_stream (istream& is, const Verbosity& verbosity);
141 
142 void
143 xml_write_header_to_stream (ostream& os, FileType ftype, const Verbosity& verbosity);
144 
145 void
146 xml_write_footer_to_stream (ostream& os, const Verbosity& verbosity);
147 
148 void
149 xml_set_stream_precision (ostream& os);
150 
151 
152 #endif /* xml_io_private_h */
ArtsXMLTag::ArtsXMLTag
ArtsXMLTag(const Verbosity &rverbosity)
Definition: xml_io_private.h:85
NumericType
NumericType
Definition: xml_io.h:44
ArtsXMLTag::verbosity
const Verbosity & verbosity
Definition: xml_io_private.h:120
ArtsXMLTag::check_name
void check_name(const String &expected_name)
Check tag name.
Definition: xml_io.cc:56
absorption.h
Declarations required for the calculation of absorption coefficients.
xml_set_stream_precision
void xml_set_stream_precision(ostream &os)
Definition: xml_io.cc:818
XMLAttribute
XML attribute class.
Definition: xml_io_private.h:71
xml_open_input_file
void xml_open_input_file(ifstream &file, const String &name, const Verbosity &verbosity)
Open file for XML input.
Definition: xml_io.cc:520
xml_read_header_from_stream
void xml_read_header_from_stream(istream &is, FileType &ftype, NumericType &ntype, EndianType &etype, const Verbosity &verbosity)
Reads XML header and root tag.
Definition: xml_io.cc:661
ArtsXMLTag::get_attribute_value
void get_attribute_value(const String &aname, String &value)
Returns value of attribute as String.
Definition: xml_io.cc:140
ArtsXMLTag::check_attribute
void check_attribute(const String &aname, const String &value)
Checks whether attribute has the expected value.
Definition: xml_io.cc:110
ArtsXMLTag::name
String name
Definition: xml_io_private.h:118
array.h
This file contains the definition of Array.
ArtsXMLTag::write_to_stream
void write_to_stream(ostream &os)
Write XML tag.
Definition: xml_io.cc:333
xml_data_parse_error
void xml_data_parse_error(ArtsXMLTag &tag, String str_error)
Throws XML parser runtime error.
Definition: xml_io.cc:638
Array< XMLAttribute >
ArtsXMLTag::attribs
Array< XMLAttribute > attribs
Definition: xml_io_private.h:119
agenda_class.h
Declarations for agendas.
messages.h
Declarations having to do with the four output streams.
xml_write_header_to_stream
void xml_write_header_to_stream(ostream &os, FileType ftype, const Verbosity &verbosity)
Writes XML header and root tag.
Definition: xml_io.cc:774
ArtsXMLTag::read_from_stream
void read_from_stream(istream &is)
Reads next XML tag.
Definition: xml_io.cc:194
my_basic_string
The implementation for String, the ARTS string class.
Definition: mystring.h:62
optproperties.h
Scattering database structure and functions.
xml_read_footer_from_stream
void xml_read_footer_from_stream(istream &is, const Verbosity &verbosity)
Reads closing root tag.
Definition: xml_io.cc:759
Verbosity
Definition: messages.h:50
ArtsXMLTag::add_attribute
void add_attribute(const String &aname, const String &value)
Adds a String attribute to tag.
Definition: xml_io.cc:74
ArtsXMLTag::get_name
String & get_name()
Definition: xml_io_private.h:88
bifstream.h
This file contains the class declaration of bifstream.
bofstream.h
This file contains the class declaration of bofstream.
xml_parse_error
void xml_parse_error(const String &str_error)
Throws XML parser runtime error.
Definition: xml_io.cc:620
FileType
FileType
Definition: xml_io.h:38
ppath.h
Propagation path structure and functions.
EndianType
EndianType
Definition: xml_io.h:45
xml_write_footer_to_stream
void xml_write_footer_to_stream(ostream &os, const Verbosity &verbosity)
Write closing root tag.
Definition: xml_io.cc:807
xml_open_output_file
void xml_open_output_file(ostream &file, const String &name)
ArtsXMLTag
The ARTS XML tag class.
Definition: xml_io_private.h:83
Index
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:39
XMLAttribute::name
String name
Definition: xml_io_private.h:73
ArtsXMLTag::set_name
void set_name(const String &new_name)
Definition: xml_io_private.h:94
XMLAttribute::value
String value
Definition: xml_io_private.h:74
gas_abs_lookup.h
Declarations for the gas absorption lookup table.
matpackVII.h
xml_io.h
This file contains basic functions to handle XML data files.