[215] | 1 | #pragma once
|
---|
| 2 |
|
---|
| 3 | #include <vector>
|
---|
| 4 | #include <string>
|
---|
| 5 | #include <fstream>
|
---|
| 6 | #include <sstream>
|
---|
| 7 |
|
---|
| 8 | #include <boost/serialization/serialization.hpp>
|
---|
| 9 | #include <boost/serialization/nvp.hpp>
|
---|
| 10 | #include <boost/serialization/export.hpp>
|
---|
| 11 |
|
---|
| 12 | namespace Jenga{
|
---|
| 13 | namespace Common{
|
---|
| 14 |
|
---|
| 15 | using namespace std;
|
---|
| 16 |
|
---|
| 17 | template<class T_xml_schema> class BoostSerializationSupport{
|
---|
| 18 | virtual const char *RootTagName() const = 0;
|
---|
| 19 |
|
---|
| 20 | void echo( const char *msg ) const;
|
---|
| 21 |
|
---|
| 22 | public:
|
---|
| 23 | bool ReadXml( istream& ifs, bool isShowExceptionMessage = true );
|
---|
| 24 | bool WriteXml( ostream& ofs, bool isShowExceptionMessage = true ) const;
|
---|
[264] | 25 | bool ReadXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true );
|
---|
| 26 | bool WriteXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true ) const;
|
---|
[279] | 27 | bool ReadXmlString( const std::string &xmlString );
|
---|
| 28 | bool WriteXmlString( std::string &xmlString ) const;
|
---|
[215] | 29 |
|
---|
[322] | 30 | bool ReadBinaryFile( const std::string &filePath, bool isShowExceptionMessage = true );
|
---|
| 31 | bool WriteBinaryFile( const std::string &filePath, bool isShowExceptionMessage = true ) const;
|
---|
| 32 | bool ReadBinaryString( const std::string &binaryString );
|
---|
| 33 | bool WriteBinaryString( std::string &binaryString ) const;
|
---|
[215] | 34 |
|
---|
[264] | 35 | bool ReadText( const std::string &filePath, bool isShowExceptionMessage = true );
|
---|
| 36 | bool WriteText( const std::string &filePath, bool isShowExceptionMessage = true ) const;
|
---|
| 37 | bool ReadTextString( const std::string &textString );
|
---|
| 38 | bool WriteTextString( std::string &textString ) const;
|
---|
[215] | 39 |
|
---|
[264] | 40 | bool ReadXmlFromString( const std::string &xmlBuffer );
|
---|
[215] | 41 | };
|
---|
| 42 |
|
---|
| 43 |
|
---|
| 44 | }}
|
---|