XMLEntity.h

Go to the documentation of this file.
00001 /*
00002  *  Copyright (C) 2000-2002  The Exult Team
00003  *
00004  *  This program is free software; you can redistribute it and/or modify
00005  *  it under the terms of the GNU General Public License as published by
00006  *  the Free Software Foundation; either version 2 of the License, or
00007  *  (at your option) any later version.
00008  *
00009  *  This program is distributed in the hope that it will be useful,
00010  *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012  *  GNU General Public License for more details.
00013  *
00014  *  You should have received a copy of the GNU General Public License
00015  *  along with this program; if not, write to the Free Software
00016  *  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
00017  */
00018 
00019 #ifndef XMLENTITY_H
00020 #define XMLENTITY_H
00021 
00022 #include <string>
00023 #include <vector>
00024 
00025 
00026 class XMLnode
00027 {
00028 protected:
00029   std::string       id;
00030   std::string       content;
00031   std::vector<XMLnode*> nodelist;
00032   bool          no_close;
00033   
00034 public:
00035   XMLnode() : no_close(false)
00036     {  }
00037   XMLnode(const std::string &i) : id(i), no_close(false)
00038     {  }
00039   XMLnode(const XMLnode &n) : id(n.id),content(n.content),nodelist(n.nodelist), no_close(false)
00040     {  }
00041   ~XMLnode();
00042   
00043   XMLnode &operator=(const XMLnode &n) { id=n.id; content=n.content; nodelist=n.nodelist; no_close = n.no_close; return *this; }
00044   const std::string &reference(const std::string &,bool &);
00045   const XMLnode *subtree(const std::string &) const;
00046   
00047   const std::string &value(void) const
00048     { return content; }
00049   
00050   typedef std::pair<std::string, std::string> KeyType;
00051   typedef std::vector<KeyType> KeyTypeList;
00052   
00053   bool searchpairs(KeyTypeList &ktl, const std::string &basekey, const std::string currkey, const unsigned int pos);
00054   void selectpairs(KeyTypeList &ktl, const std::string currkey);
00055   
00056   std::string dump(int depth = 0);
00057   void dump(std::ostream &o, const std::string &indentstr, const unsigned int depth=0) const;
00058   
00059   void  xmlassign(const std::string &key, const std::string &value);
00060   void  xmlparse(const std::string &s,std::size_t &pos);
00061 
00062   void  listkeys(const std::string &,std::vector<std::string> &, bool longformat=true) const;
00063 };
00064 
00065 #endif

Generated on Mon Jul 9 14:42:44 2007 for ExultEngine by  doxygen 1.5.1