Changeset 264 in dev for trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
- Timestamp:
- Aug 6, 2007, 9:31:22 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
r256 r264 270 270 } 271 271 272 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadXmlFromString( const string &xmlBuffer ) 273 { 274 bool isSuccessful = false; 275 276 // 入力アーカイブの作成 277 std::istringstream iss( xmlBuffer ); 272 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadTextString( const std::string &textString ) 273 { 274 bool isSuccessful = false; 275 276 // 入力アーカイブの作成 277 std::istringstream iss( textString ); 278 279 try{ 280 boost::archive::text_iarchive ia(iss); 281 282 // 文字列ストリームから読込 283 ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 284 285 isSuccessful = true; 286 } 287 catch(...){ 288 // 失敗 289 } 290 291 if( !isSuccessful ) 292 { 293 return false; 294 } 295 296 return true; 297 } 298 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteTextString( std::string &textString ) const 299 { 300 // 出力アーカイブの作成 301 std::ostringstream oss; 302 303 bool isSuccessful = false; 304 try{ 305 boost::archive::text_oarchive oa(oss); 306 307 // 文字列ストリームに書き出し 308 oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 309 310 isSuccessful = true; 311 } 312 catch( boost::archive::archive_exception e ) 313 { 314 echo( e.what() ); 315 } 316 catch(...){ 317 echo( "archive_exception以外の不明な例外" ); 318 } 319 320 if( !isSuccessful ) 321 { 322 return false; 323 } 324 325 textString = oss.str(); 326 327 return true; 328 } 329 330 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadXmlFromString( const std::string &textString ) 331 { 332 bool isSuccessful = false; 333 334 // 入力アーカイブの作成 335 std::istringstream iss( textString ); 278 336 279 337 try{
Note:
See TracChangeset
for help on using the changeset viewer.