System documentation of the GNU Image-Finding Tool

Main Page | Class Hierarchy | Alphabetical List | Compound List | File List | Compound Members

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     This program is free software; you can redistribute it and/or modify
00009     it under the terms of the GNU General Public License as published by
00010     the Free Software Foundation; either version 2 of the License, or
00011     (at your option) any later version.
00012 
00013     This program is distributed in the hope that it will be useful,
00014     but WITHOUT ANY WARRANTY; without even the implied warranty of
00015     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00016     GNU General Public License for more details.
00017 
00018     You should have received a copy of the GNU General Public License
00019     along with this program; if not, write to the Free Software
00020     Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00021 
00022 */
00023 /* -*- Mode: c++ -*- */
00024 /* the tag above is for making xemacs find the right mode for this file
00025    (avoids typing M-x c++-mode M-x font-lock-mode M-x font-lock-mode)
00026  */
00027 #ifndef _CXMLElement
00028 #define _CXMLElement
00029 #include "libMRML/include/uses-declarations.h"
00030 #include <map>
00031 #include <list>
00032 #include <string>
00033 #include "libMRML/include/CMagic.h"
00034 #include "libMRML/include/CAttributeList.h"
00035 class CXMLElementVisitor;
00036 #include "libMRML/include/CMutex.h"
00037 #include "libMRML/include/CNoDelete.h" //debugging
00049 class CXMLElement:public CMagic,public CNoDelete{
00050 public:
00052   typedef list<CXMLElement*> lCChildren;
00053 protected:
00055   CXMLElement* mFather;
00057   CXMLElement* mCurrentChild;
00058 protected:
00060   lCChildren mChildren;
00062   CAttributeList mAttributes;
00064   string mName;
00066   void setFather(CXMLElement*);
00067 
00072   string mText;
00079   const int mTypeOfNode;
00080 public:
00084   static int const cTextNode; 
00088   static int const cElementNode; 
00089   
00090 public:
00092   CXMLElement* getFather()const;
00093 
00095   void addAttribute(const string& inAttribute,long inValue);
00097   void addAttribute(const string& inAttribute,double inValue);
00099   void addAttribute(const string& inAttribute,const string& inValue);
00100 
00107   pair<bool,bool> boolReadAttribute(const string& inAttribute)const;
00109   pair<bool,long> longReadAttribute(const string& inAttribute)const;
00111   pair<bool,double> doubleReadAttribute(const string& inAttribute)const;
00121   virtual pair<bool,string> stringReadAttribute(const string& inAttribute)const;
00122 
00130   CXMLElement* clone(bool inDeep=true)const;
00131 
00135   void toXML(string& outString,const int=0)const;
00139   void traverse(CXMLElementVisitor& inoutVisitor)const;
00143   void traverse(CXMLElementVisitor& inoutVisitor);
00144     
00146   list<CXMLElement*>::const_iterator child_list_begin()const;
00149   list<CXMLElement*>::const_iterator child_list_end()const;
00151   list<CXMLElement*>::iterator child_list_begin();
00154   list<CXMLElement*>::iterator child_list_end();
00155 
00156 
00161   virtual void addChild(CXMLElement* inChild);
00167   virtual void addChild(const string&,
00168                         const char* const* const inAttributeList=0);
00169 
00173   void moveUp();
00178   bool isSubtreeFinished()const;
00179 
00184   CXMLElement(const string&,
00185               const char* const* const inAttributeList=0);
00187   virtual ~CXMLElement();
00191   CXMLElement(const int inType,
00192               const string&);
00194   CXMLElement(const string& inString,
00195               const list< pair<string,string> >& inList);
00197   CXMLElement(const string& inString,
00198               const CAttributeList& inList);
00202   CXMLElement(const CXMLElement& in);
00208   list<pair<string,string> >* createNamedValueList()const;
00210   string getText()const;
00212   string getName()const;
00214   int getTypeOfNode()const;
00216   int getNumberOfAttributes()const;
00218   void check()const;
00219   
00220 };
00221 
00222 #endif

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