bes  Updated for version 3.20.6
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 namespace ncml_module {
43 
53 private:
54  AttributeElement& operator=(const AttributeElement& rhs); // disallow
55 
56 public:
57  // methods
59  AttributeElement(const AttributeElement& proto);
60  virtual ~AttributeElement();
61  virtual const string& getTypeName() const;
62  virtual AttributeElement* clone() const; // override clone with more specific subclass
63  virtual void setAttributes(const XMLAttributeMap& attrs);
64  virtual void handleBegin();
65  virtual void handleContent(const string& content);
66  virtual void handleEnd();
67  virtual string toString() const;
68 
69 public:
70  // data rep
71  static const string _sTypeName;
72  static const vector<string> _sValidAttributes;
73  static const string _default_global_container;
74 
75 private:
76  // method
77 
119  void processAttribute(NCMLParser& p);
120 
126  void processAttributeContainerAtCurrentScope(NCMLParser& p);
127 
132  void processAtomicAttributeAtCurrentScope(NCMLParser& p);
133 
135  string getInternalType() const;
136 
140  void addNewAttribute(NCMLParser& p);
141 
152  void mutateAttributeAtCurrentScope(NCMLParser& p, const string& name, const string& type, const string& value);
153 
166  void renameAtomicAttribute(NCMLParser& p);
167 
175  libdap::AttrTable* renameAttributeContainer(NCMLParser& p);
176 
180  void processEndAttribute(NCMLParser& p);
181 
186  void startOtherXMLParse(NCMLParser& p);
187 
190  static vector<string> getValidAttributes();
191 
192 private:
193  string _name;
194  string _type;
195  string _value;
196  string _separator;
197  string _orgName;
198 
199  // Temp for tokenizing
200  vector<string> _tokens;
201 
202  // If we're parsing an attr of type OtherXML,
203  // We will create and pass this into the NCMLParser to collect
204  // the OtherXML string. We own the memory.
205  OtherXMLParser* _pOtherXMLParser;
206 };
207 
208 }
209 
210 #endif /* __NCML_MODULE__ATTRIBUTE_ELEMENT_H__ */
ncml_module::AttributeElement::handleBegin
virtual void handleBegin()
Definition: AttributeElement.cc:105
ncml_module::AttributeElement::getTypeName
virtual const string & getTypeName() const
Definition: AttributeElement.cc:81
ncml_module::AttributeElement::handleEnd
virtual void handleEnd()
Definition: AttributeElement.cc:130
ncml_module::AttributeElement::toString
virtual string toString() const
Definition: AttributeElement.cc:136
ncml_module::AttributeElement
Concrete class for NcML <attribute> element.
Definition: AttributeElement.h:52
ncml_module::NCMLParser
Definition: NCMLParser.h:158
ncml_module::XMLAttributeMap
Definition: XMLHelpers.h:93
ncml_module::OtherXMLParser
Definition: OtherXMLParser.h:47
ncml_module::AttributeElement::clone
virtual AttributeElement * clone() const
Definition: AttributeElement.cc:87
libdap
Definition: BESDapFunctionResponseCache.h:35
ncml_module::AttributeElement::setAttributes
virtual void setAttributes(const XMLAttributeMap &attrs)
Definition: AttributeElement.cc:93
ncml_module::NCMLElement
Base class for NcML element concrete classes.
Definition: NCMLElement.h:61
ncml_module
NcML Parser for adding/modifying/removing metadata (attributes) to existing local datasets using NcML...
Definition: AggregationElement.cc:72