System documentation of the GNU Image-Finding Tool

CXMLElement.h
1 /* -*- mode: c++ -*-
2 */
3 /*
4 
5  GIFT, a flexible content based image retrieval system.
6  Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
7 
8  Copyright (C) 2003, 2004 Bayreuth University
9  2005 Bamberg University
10  This program is free software; you can redistribute it and/or modify
11  it under the terms of the GNU General Public License as published by
12  the Free Software Foundation; either version 2 of the License, or
13  (at your option) any later version.
14 
15  This program is distributed in the hope that it will be useful,
16  but WITHOUT ANY WARRANTY; without even the implied warranty of
17  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18  GNU General Public License for more details.
19 
20  You should have received a copy of the GNU General Public License
21  along with this program; if not, write to the Free Software
22  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
23 
24 */
25 /* -*- Mode: c++ -*- */
26 /* the tag above is for making xemacs find the right mode for this file
27  (avoids typing M-x c++-mode M-x font-lock-mode M-x font-lock-mode)
28  */
29 #ifndef _CXMLElement
30 #define _CXMLElement
31 #include "libMRML/include/uses-declarations.h"
32 #include <map>
33 #include <list>
34 #include <string>
35 #include "libMRML/include/CMagic.h"
36 #include "libMRML/include/CAttributeList.h"
37 class CXMLElementVisitor;
38 #include "libMRML/include/CMutex.h"
39 #include "libMRML/include/CNoDelete.h" //debugging
51 class CXMLElement:public CMagic,public CNoDelete{
52 public:
54  typedef list<CXMLElement*> lCChildren;
55 protected:
60 protected:
66  string mName;
68  void setFather(CXMLElement*);
69 
74  string mText;
81  const int mTypeOfNode;
82 public:
86  static int const cTextNode;
90  static int const cElementNode;
91 
92 public:
94  CXMLElement* getFather()const;
95 
97  void addAttribute(const string& inAttribute,long inValue);
99  void addAttribute(const string& inAttribute,double inValue);
101  void addAttribute(const string& inAttribute,const string& inValue);
102 
109  pair<bool,bool> boolReadAttribute(const string& inAttribute)const;
111  pair<bool,long> longReadAttribute(const string& inAttribute)const;
113  pair<bool,double> doubleReadAttribute(const string& inAttribute)const;
123  virtual pair<bool,string> stringReadAttribute(const string& inAttribute)const;
124 
132  CXMLElement* clone(bool inDeep=true)const;
133 
137  void toXML(string& outString,const int=0)const;
141  void traverse(CXMLElementVisitor& inoutVisitor)const;
145  void traverse(CXMLElementVisitor& inoutVisitor);
146 
148  list<CXMLElement*>::const_iterator child_list_begin()const;
151  list<CXMLElement*>::const_iterator child_list_end()const;
153  list<CXMLElement*>::iterator child_list_begin();
156  list<CXMLElement*>::iterator child_list_end();
157 
158 
163  virtual void addChild(CXMLElement* inChild);
169  virtual void addChild(const string&,
170  const char* const* const inAttributeList=0);
171 
175  void moveUp();
180  bool isSubtreeFinished()const;
181 
186  CXMLElement(const string&,
187  const char* const* const inAttributeList=0);
189  virtual ~CXMLElement();
193  CXMLElement(const int inType,
194  const string&);
196  CXMLElement(const string& inString,
197  const list< pair<string,string> >& inList);
199  CXMLElement(const string& inString,
200  const CAttributeList& inList);
204  CXMLElement(const CXMLElement& in);
210  list<pair<string,string> >* createNamedValueList()const;
212  string getText()const;
214  string getName()const;
216  int getTypeOfNode()const;
218  int getNumberOfAttributes()const;
220  void check()const;
221 
222 };
223 
224 #endif

Need for discussion? Want to contribute? Contact
help-gift@gnu.org Generated using Doxygen