ARTS  2.2.66
xml_io_private.h
Go to the documentation of this file.
1 /* Copyright (C) 2002-2012 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 xml_open_output_file(ostream& file, const String& name);
55 
56 void xml_open_input_file(ifstream& file, const String& name, const Verbosity& verbosity);
57 
58 
60 // XML parser classes
62 
64 
68 class XMLAttribute {
69 public:
72 };
73 
74 
76 
79 class ArtsXMLTag {
80 public:
81  ArtsXMLTag(const Verbosity& rverbosity) : verbosity(rverbosity) {};
82 
83  String& get_name() { return name; }
84 
85  void check_name(const String& expected_name);
86 
87  void set_name(const String& new_name) { name = new_name; }
88 
89  void add_attribute(const String& aname, const String& value);
90 
91  void add_attribute(const String& aname, const Index& value);
92 
93  void check_attribute(const String& aname, const String& value);
94 
95  void get_attribute_value(const String& aname, String& value);
96 
97  void get_attribute_value(const String& aname, Index& value);
98 
99  void read_from_stream(istream& is);
100 
101  void write_to_stream(ostream& os);
102 
103 private:
107 };
108 
109 
111 // General XML handling routines
113 
114 void xml_parse_error(const String& str_error);
115 
116 void xml_data_parse_error(ArtsXMLTag& tag, String str_error);
117 
118 void xml_read_header_from_stream(istream& is, FileType& ftype,
119  NumericType& ntype, EndianType& etype,
120  const Verbosity& verbosity);
121 
122 void xml_read_footer_from_stream(istream& is, const Verbosity& verbosity);
123 
124 void xml_write_header_to_stream(ostream& os, FileType ftype, const Verbosity& verbosity);
125 
126 void xml_write_footer_to_stream(ostream& os, const Verbosity& verbosity);
127 
128 void xml_set_stream_precision(ostream& os);
129 
130 
131 #endif /* xml_io_private_h */
INDEX Index
The type to use for all integer numbers and indices.
Definition: matpack.h:35
void xml_open_input_file(ifstream &file, const String &name, const Verbosity &verbosity)
Open file for XML input.
Definition: xml_io.cc:507
Declarations having to do with the four output streams.
XML attribute class.
String & get_name()
void xml_parse_error(const String &str_error)
Throws XML parser runtime error.
Definition: xml_io.cc:605
This file contains basic functions to handle XML data files.
This file contains the definition of Array.
The implementation for String, the ARTS string class.
Definition: mystring.h:63
const Verbosity & verbosity
The ARTS XML tag class.
ArtsXMLTag(const Verbosity &rverbosity)
void xml_set_stream_precision(ostream &os)
Definition: xml_io.cc:799
void set_name(const String &new_name)
Declarations for agendas.
This file contains the class declaration of bifstream.
This file contains the class declaration of bofstream.
void xml_write_footer_to_stream(ostream &os, const Verbosity &verbosity)
Write closing root tag.
Definition: xml_io.cc:788
Declarations for the gas absorption lookup table.
Declarations required for the calculation of absorption coefficients.
Propagation path structure and functions.
void xml_write_header_to_stream(ostream &os, FileType ftype, const Verbosity &verbosity)
Writes XML header and root tag.
Definition: xml_io.cc:756
Array< XMLAttribute > attribs
EndianType
Definition: xml_io.h:45
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:644
void xml_data_parse_error(ArtsXMLTag &tag, String str_error)
Throws XML parser runtime error.
Definition: xml_io.cc:622
FileType
Definition: xml_io.h:38
NumericType
Definition: xml_io.h:44
void xml_read_footer_from_stream(istream &is, const Verbosity &verbosity)
Reads closing root tag.
Definition: xml_io.cc:742
Scattering database structure and functions.
void xml_open_output_file(ostream &file, const String &name)