System documentation of the GNU Image-Finding Tool

CXMLElement.h
00001 /* -*- mode: c++ -*- 
00002 */
00003 /* 
00004 
00005     GIFT, a flexible content based image retrieval system.
00006     Copyright (C) 1998, 1999, 2000, 2001, 2002, CUI University of Geneva
00007 
00008      Copyright (C) 2003, 2004 Bayreuth University
00009       2005 Bamberg University
00010     This program is free software; you can redistribute it and/or modify
00011     it under the terms of the GNU General Public License as published by
00012     the Free Software Foundation; either version 2 of the License, or
00013     (at your option) any later version.
00014 
00015     This program is distributed in the hope that it will be useful,
00016     but WITHOUT ANY WARRANTY; without even the implied warranty of
00017     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00018     GNU General Public License for more details.
00019 
00020     You should have received a copy of the GNU General Public License
00021     along with this program; if not, write to the Free Software
00022     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00023 
00024 */
00025 /* -*- Mode: c++ -*- */
00026 /* the tag above is for making xemacs find the right mode for this file
00027    (avoids typing M-x c++-mode M-x font-lock-mode M-x font-lock-mode)
00028  */
00029 #ifndef _CXMLElement
00030 #define _CXMLElement
00031 #include "libMRML/include/uses-declarations.h"
00032 #include <map>
00033 #include <list>
00034 #include <string>
00035 #include "libMRML/include/CMagic.h"
00036 #include "libMRML/include/CAttributeList.h"
00037 class CXMLElementVisitor;
00038 #include "libMRML/include/CMutex.h"
00039 #include "libMRML/include/CNoDelete.h" //debugging
00051 class CXMLElement:public CMagic,public CNoDelete{
00052 public:
00054   typedef list<CXMLElement*> lCChildren;
00055 protected:
00057   CXMLElement* mFather;
00059   CXMLElement* mCurrentChild;
00060 protected:
00062   lCChildren mChildren;
00064   CAttributeList mAttributes;
00066   string mName;
00068   void setFather(CXMLElement*);
00069 
00074   string mText;
00081   const int mTypeOfNode;
00082 public:
00086   static int const cTextNode; 
00090   static int const cElementNode; 
00091   
00092 public:
00094   CXMLElement* getFather()const;
00095 
00097   void addAttribute(const string& inAttribute,long inValue);
00099   void addAttribute(const string& inAttribute,double inValue);
00101   void addAttribute(const string& inAttribute,const string& inValue);
00102 
00109   pair<bool,bool> boolReadAttribute(const string& inAttribute)const;
00111   pair<bool,long> longReadAttribute(const string& inAttribute)const;
00113   pair<bool,double> doubleReadAttribute(const string& inAttribute)const;
00123   virtual pair<bool,string> stringReadAttribute(const string& inAttribute)const;
00124 
00132   CXMLElement* clone(bool inDeep=true)const;
00133 
00137   void toXML(string& outString,const int=0)const;
00141   void traverse(CXMLElementVisitor& inoutVisitor)const;
00145   void traverse(CXMLElementVisitor& inoutVisitor);
00146     
00148   list<CXMLElement*>::const_iterator child_list_begin()const;
00151   list<CXMLElement*>::const_iterator child_list_end()const;
00153   list<CXMLElement*>::iterator child_list_begin();
00156   list<CXMLElement*>::iterator child_list_end();
00157 
00158 
00163   virtual void addChild(CXMLElement* inChild);
00169   virtual void addChild(const string&,
00170                         const char* const* const inAttributeList=0);
00171 
00175   void moveUp();
00180   bool isSubtreeFinished()const;
00181 
00186   CXMLElement(const string&,
00187               const char* const* const inAttributeList=0);
00189   virtual ~CXMLElement();
00193   CXMLElement(const int inType,
00194               const string&);
00196   CXMLElement(const string& inString,
00197               const list< pair<string,string> >& inList);
00199   CXMLElement(const string& inString,
00200               const CAttributeList& inList);
00204   CXMLElement(const CXMLElement& in);
00210   list<pair<string,string> >* createNamedValueList()const;
00212   string getText()const;
00214   string getName()const;
00216   int getTypeOfNode()const;
00218   int getNumberOfAttributes()const;
00220   void check()const;
00221   
00222 };
00223 
00224 #endif

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