UniSet
1.4.0
|
00001 /* This file is part of the UniSet project 00002 * Copyright (c) 2002 Free Software Foundation, Inc. 00003 * Copyright (c) 2002 Pavel Vainerman 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 Free Software 00017 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. 00018 */ 00019 // -------------------------------------------------------------------------- 00024 // -------------------------------------------------------------------------- 00025 #ifndef ISRestorer_H_ 00026 #define ISRestorer_H_ 00027 // ------------------------------------------------------------------------------------------ 00028 #include <string> 00029 #include "UniXML.h" 00030 #include "InfoServer.h" 00031 #include "Restorer.h" 00032 // ------------------------------------------------------------------------------------------ 00036 class ISRestorer 00037 { 00038 public: 00039 00040 ISRestorer(); 00041 virtual ~ISRestorer(); 00042 00043 virtual void read(InfoServer* is, const std::string fname="")=0; 00044 virtual void dump(InfoServer* is, const UniSetTypes::MessageCode code, 00045 const InfoServer::ConsumerList& lst)=0; 00046 00047 protected: 00048 00049 // добавление списка заказчиков 00050 void addlist( InfoServer* is, const UniSetTypes::MessageCode code, 00051 InfoServer::ConsumerList& lst ); 00052 }; 00053 // ------------------------------------------------------------------------------------------ 00054 #if 0 00055 00063 class ISRestorer_XML: 00064 public ISRestorer, 00065 public Restorer_XML 00066 { 00067 public: 00068 00069 ISRestorer_XML(const std::string fname, bool createIfNotFound=false ); 00070 // ISRestorer_XML( UniXML& xml ); 00071 00072 virtual ~ISRestorer_XML(); 00073 00074 virtual void dump(InfoServer* is, const UniSetTypes::MessageCode code, 00075 const InfoServer::ConsumerList& lst); 00076 00077 virtual void read(InfoServer* is, const std::string fname=""); 00078 virtual void read(InfoServer* is, UniXML& xml ); 00079 00080 00081 void setFileName(const std::string& file); 00082 inline std::string getFileName(){ return fname; } 00083 00084 ISRestorer_XML(); 00085 00086 protected: 00087 virtual void read_list(UniXML& xml, xmlNode* node, InfoServer* is); 00088 00089 }; 00090 // ------------------------------------------------------------------------------------------ 00091 #endif 00092 00099 class ISRestorer_XML: 00100 public ISRestorer, 00101 public Restorer_XML 00102 { 00103 public: 00104 ISRestorer_XML( const std::string fname ); 00105 // ISRestorer_XML( UniXML& xml ); 00106 virtual ~ISRestorer_XML(); 00107 00108 virtual void dump(InfoServer* is, const UniSetTypes::MessageCode code, 00109 const InfoServer::ConsumerList& lst); 00110 00111 virtual void read(InfoServer* is, const std::string fname=""); 00112 virtual void read(InfoServer* is, UniXML& xml ); 00113 00114 00115 void setFileName(const std::string& file); 00116 inline std::string getFileName(){ return fname; } 00117 00118 protected: 00119 void read_list(UniXML& xml, xmlNode* node, InfoServer* is); 00120 void create_new_file(const std::string& fname); 00121 xmlNode* bind_node(UniXML& xml, xmlNode* root, const std::string& nodename, const std::string nm=""); 00122 xmlNode* rebind_node(UniXML& xml, xmlNode* root, const std::string& nodename, const std::string nm=""); 00123 void init( std::string fname ); 00124 00125 std::string fname; 00126 UniXML uxml; 00127 }; 00128 00129 // ------------------------------------------------------------------------------------------ 00130 #endif