casa  5.7.0-16
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
QtXmlRecord.h
Go to the documentation of this file.
1 //# QtXmlRecord.h: translations between aips++ options Records and xml.
2 //# Copyright (C) 2005
3 //# Associated Universities, Inc. Washington DC, USA.
4 //#
5 //# This library is free software; you can redistribute it and/or modify it
6 //# under the terms of the GNU Library General Public License as published by
7 //# the Free Software Foundation; either version 2 of the License, or (at your
8 //# option) any later version.
9 //#
10 //# This library is distributed in the hope that it will be useful, but WITHOUT
11 //# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
12 //# FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public
13 //# License for more details.
14 //#
15 //# You should have received a copy of the GNU Library General Public License
16 //# along with this library; if not, write to the Free Software Foundation,
17 //# Inc., 675 Massachusetts Ave, Cambridge, MA 02139, USA.
18 //#
19 //# Correspondence concerning AIPS++ should be addressed as follows:
20 //# Internet email: aips2-request@nrao.edu.
21 //# Postal address: AIPS++ Project Office
22 //# National Radio Astronomy Observatory
23 //# 520 Edgemont Road
24 //# Charlottesville, VA 22903-2475 USA
25 //#
26 //# $Id$
27 
28 #ifndef QTXMLRECORD_H
29 #define QTXMLRECORD_H
30 
31 #include <casa/aips.h>
32 
33 #include <graphics/X11/X_enter.h>
34 # include <QtXml>
35 # include <QDomDocument>
36 #include <graphics/X11/X_exit.h>
37 
38 
39 #include <casa/Arrays/Vector.h>
40 #include <casa/Arrays/ArrayUtil.h>
42 #include <casa/Containers/Record.h>
45 
46 namespace casa { //# NAMESPACE CASA - BEGIN
47 
48  class QtXmlRecord : public casacore::Record, public QObject {
49 
50  public:
51  QtXmlRecord();
52  ~QtXmlRecord();
53  bool recordToElement(const casacore::Record *rec, QDomElement *parent,
54  QDomDocument &doc);
55  casacore::Bool elementToRecord(QDomElement *ele, casacore::Record &rec, casacore::Bool useOptName=true);
56  casacore::Bool domToRecord(QDomDocument *doc, casacore::Record &rec);
57  casacore::Bool optsElemToRecord(QDomElement optsElem, casacore::Record &rec);
58  bool readDomFrom(QDomDocument &doc, QIODevice *device);
59  bool writeDomTo(QDomDocument *doc, QIODevice *device);
60  bool recordToDom(casacore::Record *rec, QDomDocument &doc);
61  const QString rootName;
62  static QString domToString(const QDomElement &elt);
63  static QDomDocument stringToDom(const QString &xml);
64 
65  private:
66  void formatXml(QDomDocument &doc);
67  };
68 
69 } //# NAMESPACE CASA - END
70 
71 
72 #endif
bool recordToDom(casacore::Record *rec, QDomDocument &doc)
bool recordToElement(const casacore::Record *rec, QDomElement *parent, QDomDocument &doc)
static QString domToString(const QDomElement &elt)
casacore::Bool domToRecord(QDomDocument *doc, casacore::Record &rec)
bool readDomFrom(QDomDocument &doc, QIODevice *device)
casacore::Bool optsElemToRecord(QDomElement optsElem, casacore::Record &rec)
A hierarchical collection of named fields of various types.
Definition: Record.h:180
bool Bool
Define the standard types used by Casacore.
Definition: aipstype.h:42
casacore::Bool elementToRecord(QDomElement *ele, casacore::Record &rec, casacore::Bool useOptName=true)
static QDomDocument stringToDom(const QString &xml)
bool writeDomTo(QDomDocument *doc, QIODevice *device)
void formatXml(QDomDocument &doc)
const QString rootName
Definition: QtXmlRecord.h:61