bes  Updated for version 3.20.5
AttributeElement.h
1 // This file is part of the "NcML Module" project, a BES module designed
3 // to allow NcML files to be used to be used as a wrapper to add
4 // AIS to existing datasets of any format.
5 //
6 // Copyright (c) 2009 OPeNDAP, Inc.
7 // Author: Michael Johnson <m.johnson@opendap.org>
8 //
9 // For more information, please also see the main website: http://opendap.org/
10 //
11 // This library is free software; you can redistribute it and/or
12 // modify it under the terms of the GNU Lesser General Public
13 // License as published by the Free Software Foundation; either
14 // version 2.1 of the License, or (at your option) any later version.
15 //
16 // This library is distributed in the hope that it will be useful,
17 // but WITHOUT ANY WARRANTY; without even the implied warranty of
18 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 // Lesser General Public License for more details.
20 //
21 // You should have received a copy of the GNU Lesser General Public
22 // License along with this library; if not, write to the Free Software
23 // Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
24 //
25 // Please see the files COPYING and COPYRIGHT for more information on the GLPL.
26 //
27 // You can contact OPeNDAP, Inc. at PO Box 112, Saunderstown, RI. 02874-0112.
29 #ifndef __NCML_MODULE__ATTRIBUTE_ELEMENT_H__
30 #define __NCML_MODULE__ATTRIBUTE_ELEMENT_H__
31 
32 #include "NCMLElement.h"
33 
34 namespace libdap {
35 class AttrTable;
36 }
37 
38 namespace ncml_module {
39 class OtherXMLParser;
40 }
41 
42 using namespace std;
43 namespace ncml_module {
44 
54 private:
55  AttributeElement& operator=(const AttributeElement& rhs); // disallow
56 
57 public:
58  // methods
60  AttributeElement(const AttributeElement& proto);
61  virtual ~AttributeElement();
62  virtual const string& getTypeName() const;
63  virtual AttributeElement* clone() const; // override clone with more specific subclass
64  virtual void setAttributes(const XMLAttributeMap& attrs);
65  virtual void handleBegin();
66  virtual void handleContent(const string& content);
67  virtual void handleEnd();
68  virtual string toString() const;
69 
70 public:
71  // data rep
72  static const string _sTypeName;
73  static const vector<string> _sValidAttributes;
74  static const string _default_global_container;
75 
76 private:
77  // method
78 
120  void processAttribute(NCMLParser& p);
121 
127  void processAttributeContainerAtCurrentScope(NCMLParser& p);
128 
133  void processAtomicAttributeAtCurrentScope(NCMLParser& p);
134 
136  string getInternalType() const;
137 
141  void addNewAttribute(NCMLParser& p);
142 
153  void mutateAttributeAtCurrentScope(NCMLParser& p, const string& name, const string& type, const string& value);
154 
167  void renameAtomicAttribute(NCMLParser& p);
168 
176  libdap::AttrTable* renameAttributeContainer(NCMLParser& p);
177 
181  void processEndAttribute(NCMLParser& p);
182 
187  void startOtherXMLParse(NCMLParser& p);
188 
191  static vector<string> getValidAttributes();
192 
193 private:
194  string _name;
195  string _type;
196  string _value;
197  string _separator;
198  string _orgName;
199 
200  // Temp for tokenizing
201  vector<string> _tokens;
202 
203  // If we're parsing an attr of type OtherXML,
204  // We will create and pass this into the NCMLParser to collect
205  // the OtherXML string. We own the memory.
206  OtherXMLParser* _pOtherXMLParser;
207 };
208 
209 }
210 
211 #endif /* __NCML_MODULE__ATTRIBUTE_ELEMENT_H__ */
ncml_module::AttributeElement
Concrete class for NcML <attribute> element.
Definition: AttributeElement.h:53
ncml_module::NCMLParser
Definition: NCMLParser.h:159
ncml_module::XMLAttributeMap
Definition: XMLHelpers.h:96
ncml_module::OtherXMLParser
Definition: OtherXMLParser.h:47
libdap
Definition: BESDapFunctionResponseCache.h:35
ncml_module::NCMLElement
Base class for NcML element concrete classes.
Definition: NCMLElement.h:63
ncml_module
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...
Definition: AggregationElement.cc:72