Page MenuHomePhabricator (Chris)

ITreeSerializer.h
No OneTemporary

Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None

ITreeSerializer.h

/****************************************************************************
** Copyright (C) 2011 Luka Horvat <redreaper132 at gmail.com>
** Copyright (C) 2011 Edward Lii <edward_iii at myway.com>
** Copyright (C) 2011 O. Bahri Gordebak <gordebak at gmail.com>
**
**
** This file may be used under the terms of the GNU General Public
** License version 3.0 as published by the Free Software Foundation
** and appearing in the file LICENSE.GPL included in the packaging of
** this file.
**
** This file is provided AS IS with NO WARRANTY OF ANY KIND, INCLUDING THE
** WARRANTY OF DESIGN, MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.
**
** You should have received a copy of the GNU General Public License
** along with this program. If not, see <http://www.gnu.org/licenses/>.
**
****************************************************************************/
#ifndef ITREESERIALIZER_H
#define ITREESERIALIZER_H
#include <string>
#include <vector>
#include <iostream>
#include <fstream>
#include "ITreeStorage.h"
class ITreeSerializer{
public:
virtual bool readNode(std::istream& fin,ITreeStorageBuilder* objOut,bool loadSubNodeOnly=false)=0;
virtual void writeNode(ITreeStorageReader* obj,std::ostream& fout,bool bWriteHeader=true,bool saveSubNodeOnly=false)=0;
public:
bool LoadNodeFromFile(const char* FileName,ITreeStorageBuilder* objOut,bool loadSubNodeOnly=false){
std::ifstream f(FileName);
if(!f) return false;
//std::cerr<<"LoadNodeFromFile "<<FileName<<"\n";
return readNode(f,objOut,loadSubNodeOnly);
}
bool SaveNodeToFile(const char* FileName,ITreeStorageReader* obj,bool bWriteHeader=true,bool saveSubNodeOnly=false){
std::ofstream f(FileName);
if(!f) return false;
//std::cerr<<"SaveNodeToFile "<<FileName<<"\n";
writeNode(obj,f,bWriteHeader,saveSubNodeOnly);
return true;
}
};
#endif

File Metadata

Mime Type
text/x-c++
Expires
Sun, Nov 15, 1:31 AM (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
140342
Default Alt Text
ITreeSerializer.h (1 KB)

Event Timeline