CPPSERV


Home Projects Jobs Clientele Contact
CPPSERV Documentation Download TODO Mailing lists Bug tracker News RSS Feed Browse source

xmlserverconfig.h

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2004 by Ilya A. Volynets-Evenbakh                       *
00003  *   ilya@total-knowledge.com                                              *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 #ifndef CSERVIMPLXMLSERVERCONFIG_H
00021 #define CSERVIMPLXMLSERVERCONFIG_H
00022 
00023 #include <signal.h>
00024 
00025 #include "serverconfig.h"
00026 
00027 #include <sptk4/cxml>
00028 
00029 namespace container {
00030 namespace serverconfig {
00037 class XMLServerConfig : public ServerConfig
00038 {
00039     class XMLConfigNode:
00040         public ConfigNode
00041     {
00042     public:
00043         XMLConfigNode(const std::string& type, XMLConfigNode* parent)
00044         {
00045             this->m_type=type;
00046             this->m_parent=parent;
00047         }
00048         XMLConfigNode(const std::string& type, const std::string& name, XMLConfigNode* parent)
00049         {
00050             this->m_name=name;
00051             this->m_type=type;
00052             this->m_parent=parent;
00053         }
00054         virtual ~XMLConfigNode()
00055         {
00056             for(childlist_t::iterator i=m_children.begin();i!=m_children.end();i++){
00057                 delete *i;
00058             }
00059         }
00060         void addAttr(const std::string& name, const std::string& val);
00061         void addNode(XMLConfigNode* node);
00062         ConfigNode::childlist_t& getChildren(){return m_children;}
00063     };
00064 
00065     std::string m_path;
00066 public:
00067     XMLServerConfig();
00068     ~XMLServerConfig();
00069 
00070     virtual ConfigNode::childlist_t getNodes(const ConfigNode* parent);
00071     virtual ConfigNode::childlist_t getNodes(const ConfigNode* parent, const std::string& type);
00072     void load();
00073 
00078     void setPath(const char* path)
00079     {this->m_path=path;}
00080 
00081 private:
00082     void addKids(sptk::CXmlNode* n, XMLServerConfig::XMLConfigNode* parent);
00083 };
00084 
00085 }
00086 }
00087 #endif

SourceForge.net Logo