Changeset 279 in dev for trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
- Timestamp:
- Aug 14, 2007, 3:22:02 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
r264 r279 115 115 return result; 116 116 } 117 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadXmlString( const std::string &xmlString ) 118 { 119 bool isSuccessful = false; 120 121 // 入力アーカイブの作成 122 std::istringstream iss( xmlString ); 123 124 try{ 125 boost::archive::xml_iarchive ia(iss); 126 127 // 文字列ストリームから読込 128 ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 129 130 isSuccessful = true; 131 } 132 catch(...){ 133 // 失敗 134 } 135 136 if( !isSuccessful ) 137 { 138 return false; 139 } 140 141 return true; 142 } 143 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteXmlString( std::string &xmlString ) const 144 { 145 // 出力アーカイブの作成 146 std::ostringstream oss; 147 148 bool isSuccessful = false; 149 try{ 150 boost::archive::xml_oarchive oa(oss); 151 152 // 文字列ストリームに書き出し 153 oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 154 155 isSuccessful = true; 156 } 157 catch( boost::archive::archive_exception e ) 158 { 159 echo( e.what() ); 160 } 161 catch(...){ 162 echo( "archive_exception以外の不明な例外" ); 163 } 164 165 if( !isSuccessful ) 166 { 167 return false; 168 } 169 170 xmlString = oss.str(); 171 172 return true; 173 } 117 174 118 175 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinary( const string &filePath, bool isShowExceptionMessage )
Note:
See TracChangeset
for help on using the changeset viewer.