UniSet  2.6.0
Restorer.h
00001 /*
00002  * Copyright (c) 2015 Pavel Vainerman.
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU Lesser General Public License as
00006  * published by the Free Software Foundation, version 2.1.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00011  * Lesser General Lesser Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00015  */
00016 // --------------------------------------------------------------------------
00021 // --------------------------------------------------------------------------
00022 #ifndef Restorer_H_
00023 #define Restorer_H_
00024 // --------------------------------------------------------------------------
00025 #include <memory>
00026 #include <sigc++/sigc++.h>
00027 #include <string>
00028 #include "UniXML.h"
00029 #include "UniSetTypes.h"
00030 // --------------------------------------------------------------------------
00031 namespace uniset
00032 {
00038 class Restorer_XML
00039 {
00040     public:
00041 
00042         Restorer_XML();
00043         virtual ~Restorer_XML();
00044 
00051         typedef sigc::slot<bool, const std::shared_ptr<UniXML>&, UniXML::iterator&, xmlNode*> ReaderSlot;
00052 
00064         void setReadItem( ReaderSlot sl );
00065 
00066 
00078         void setReadConsumerItem( ReaderSlot sl );
00079 
00080 
00084         void setItemFilter( const std::string& filterField, const std::string& filterValue = "" );
00085 
00089         void setConsumerFilter( const std::string& filterField, const std::string& filterValue = "" );
00090 
00091 
00096         bool getConsumerInfo( UniXML::iterator& it,
00097                               uniset::ObjectId& cid, uniset::ObjectId& cnode );
00098 
00100         static xmlNode* find_node( const std::shared_ptr<UniXML>& xml, xmlNode* root, const std::string& nodename, const std::string& nm = "" );
00101 
00102     protected:
00103 
00104         virtual bool check_list_item( UniXML::iterator& it );
00105         virtual bool check_consumer_item( UniXML::iterator& it );
00106 
00107         ReaderSlot rslot;
00108         ReaderSlot cslot;
00109 
00110         std::string i_filterField = { "" };
00111         std::string i_filterValue = { "" };
00112         std::string c_filterField = { "" };
00113         std::string c_filterValue = { "" };
00114 };
00115 // -------------------------------------------------------------------------
00116 } // end of uniset namespace
00117 // --------------------------------------------------------------------------
00118 #endif
00119 // --------------------------------------------------------------------------