OPeNDAP Hyrax Back End Server (BES)  Updated for version 3.8.3
AttributeElement.h
Go to the documentation of this file.
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 {
36  class AttrTable;
37 }
38 namespace ncml_module
39 {
40  class OtherXMLParser;
41 }
42 
43 using namespace std;
44 namespace ncml_module
45 {
46 
56  {
57  private:
58  AttributeElement& operator=(const AttributeElement& rhs); // disallow
59 
60  public: // methods
62  AttributeElement(const AttributeElement& proto);
63  virtual ~AttributeElement();
64  virtual const string& getTypeName() const;
65  virtual AttributeElement* clone() const; // override clone with more specific subclass
66  virtual void setAttributes(const XMLAttributeMap& attrs);
67  virtual void handleBegin();
68  virtual void handleContent(const string& content);
69  virtual void handleEnd();
70  virtual string toString() const;
71 
72 public: // data rep
73  static const string _sTypeName;
74  static const vector<string> _sValidAttributes;
75  static const string _default_global_container;
76 
77  private: // 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__ */
An abstract superclass for NCMLArray that handles the non-parameterized functionality and allows u...
STL namespace.
static class NCMLUtil overview
static const string _sTypeName
Class used to handle parsing in an attribute of type=="OtherXML" which basically just has to keep app...
static const vector< string > _sValidAttributes
Base class for NcML element concrete classes.
Definition: NCMLElement.h:64
static const string _default_global_container
Concrete class for NcML element.