ffead.server.doc
Element.h
1 /*
2  Copyright 2009-2012, Sumeet Chhetri
3 
4  Licensed under the Apache License, Version 2.0 (the "License");
5  you may not use this file except in compliance with the License.
6  You may obtain a copy of the License at
7 
8  http://www.apache.org/licenses/LICENSE-2.0
9 
10  Unless required by applicable law or agreed to in writing, software
11  distributed under the License is distributed on an "AS IS" BASIS,
12  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  See the License for the specific language governing permissions and
14  limitations under the License.
15 */
16 
17 #ifndef ELEMENT_H_
18 #define ELEMENT_H_
19 
20 
21 #include "map"
22 #include "vector"
23 #include "StringUtil.h"
24 #include "string"
25 #include "Renderer.h"
26 using namespace std;
27 
28 
29 class Element : public Renderer
30 {
31  public:
32  typedef map<string,string> AttributeList;
33  typedef map<string,Element> ElementMap;
34  typedef vector<Element> ElementList;
35  void addElement(Element element);
36  void removeElement(Element element);
37  void updateElement(Element);
38  void addAttribute(string key,string value);
39  void removeAttribute(string key);
40  //void updateAttribute(string,string) = &addAttribute;
41  AttributeList getAttributes();
42  string getAttribute(string);
43  ElementList getChildElements();
44  bool isNull();
45  string getTagName();
46  string getTagNameSpc();
47  string getNewTagNameSpc(string);
48  string getNameSpc();
49  void setTagName(string tagName);
50  bool operator == (Element);
51  bool operator == (Element *);
52  bool getCdata() const;
53  void setCdata(bool);
54  string getText() const;
55  void setText(string);
56  Element getElementByName(string);
57  ElementList getElementsByName(string name);
58  string render();
59  string renderChildren();
60 private:
61  AttributeList attributes;
62  ElementList elements;
63  string tagName;
64  string nameSpace;
65  string text;
66  bool cdata;
67  ElementMap mapOfEle;
68 };
69 #endif
70 
71