nidas  v1.2-1520
XMLConfigWriter.h
Go to the documentation of this file.
1 // -*- mode: C++; indent-tabs-mode: nil; c-basic-offset: 4; tab-width: 4; -*-
2 // vim: set shiftwidth=4 softtabstop=4 expandtab:
3 /*
4  ********************************************************************
5  ** NIDAS: NCAR In-situ Data Acquistion Software
6  **
7  ** 2005, Copyright University Corporation for Atmospheric Research
8  **
9  ** This program is free software; you can redistribute it and/or modify
10  ** it under the terms of the GNU General Public License as published by
11  ** the Free Software Foundation; either version 2 of the License, or
12  ** (at your option) any later version.
13  **
14  ** This program is distributed in the hope that it will be useful,
15  ** but WITHOUT ANY WARRANTY; without even the implied warranty of
16  ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17  ** GNU General Public License for more details.
18  **
19  ** The LICENSE.txt file accompanying this software contains
20  ** a copy of the GNU General Public License. If it is not found,
21  ** write to the Free Software Foundation, Inc.,
22  ** 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
23  **
24  ********************************************************************
25 */
26 
27 #ifndef NIDAS_CORE_XMLCONFIGWRITER_H
28 #define NIDAS_CORE_XMLCONFIGWRITER_H
29 
30 #include "DSMConfig.h"
31 
32 #include "XMLParser.h"
33 #include "XMLWriter.h"
34 
35 #include <nidas/util/IOException.h>
36 
37 #include <xercesc/framework/XMLFormatter.hpp>
38 
39 namespace nidas { namespace core {
40 
41 class XMLConfigWriterFilter: public
42 #if XERCES_VERSION_MAJOR < 3
43  xercesc::DOMWriterFilter
44 #else
45  xercesc::DOMLSSerializerFilter
46 #endif
47 
48 {
49 public:
50 
54  XMLConfigWriterFilter(const DSMConfig* dsm);
55 
56 #if XERCES_VERSION_MAJOR < 3
57  short
58 #else
59  xercesc::DOMNodeFilter::FilterAction
60 #endif
61  acceptNode(const xercesc::DOMNode* node) const;
62 
63  unsigned long getWhatToShow() const;
64 
65  void setWhatToShow(unsigned long val);
66 
67 private:
68 
69  const DSMConfig* _dsm;
70 
71  unsigned long _whatToShow;
72 
73 #if XERCES_VERSION_MAJOR < 3
74  short
75 #else
76  xercesc::DOMNodeFilter::FilterAction
77 #endif
78  acceptDSMNode(const xercesc::DOMNode* node) const;
79 
82 
85 };
86 
90 class XMLConfigWriter: public XMLWriter {
91 public:
92 
94 
96 
98 
99 private:
100 
102 
105 
108 };
109 
110 }} // namespace nidas namespace core
111 
112 #endif
113 
short acceptNode(const xercesc::DOMNode *node) const
Definition: XMLConfigWriter.cc:75
XMLConfigWriter()
Definition: XMLConfigWriter.cc:42
Exception which can be built from an xerces::XMLException, xercesc::SAXException, or xercesc::DOMExce...
Definition: XMLException.h:43
unsigned long _whatToShow
Definition: XMLConfigWriter.h:71
An XMLWriter which writes the NIDAS XML configuration.
Definition: XMLConfigWriter.h:90
XMLConfigWriterFilter * _filter
Definition: XMLConfigWriter.h:101
~XMLConfigWriter()
Definition: XMLConfigWriter.cc:58
Class that should include all that is configurable about a DSM.
Definition: DSMConfig.h:55
Wrapper class around xerces-c DOMWriter to write XML.
Definition: XMLWriter.h:39
XMLConfigWriterFilter & operator=(const XMLConfigWriterFilter &)
No assignment.
XMLConfigWriter & operator=(const XMLConfigWriter &)
No assignment.
unsigned long getWhatToShow() const
Definition: XMLConfigWriter.cc:139
const DSMConfig * _dsm
Definition: XMLConfigWriter.h:69
short acceptDSMNode(const xercesc::DOMNode *node) const
Definition: XMLConfigWriter.cc:117
void setWhatToShow(unsigned long val)
Definition: XMLConfigWriter.cc:134
Definition: XMLConfigWriter.h:41
XMLConfigWriterFilter(const DSMConfig *dsm)
Only accept nodes for a certain dsm.
Definition: XMLConfigWriter.cc:64