Changeset 815 in dev
- Timestamp:
- Mar 19, 2011, 2:01:10 AM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/egtra/ab5.0/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
r806 r815 17 17 #include <limits.h> 18 18 #include <shlobj.h> 19 #include <process.h>20 #include <fcntl.h>21 #include <io.h>22 19 #include <shlwapi.h> 23 20 #include <tchar.h> 24 #include <stdarg.h>25 21 26 22 //boost libraries 27 23 #include <boost/foreach.hpp> 28 24 #include <boost/cast.hpp> 25 26 #pragma warning(push) 27 #pragma warning(disable: 4244 6326) 29 28 #include <boost/archive/xml_oarchive.hpp> 30 29 #include <boost/archive/xml_iarchive.hpp> … … 39 38 #include <boost/serialization/map.hpp> 40 39 #include <boost/serialization/version.hpp> 40 #pragma warning(pop) 41 41 42 42 #include <jenga/include/jenga.h> … … 46 46 using namespace Jenga::Common; 47 47 48 using boost::polymorphic_downcast; 49 48 50 template<class T_xml_schema> void BoostSerializationSupport<T_xml_schema>::echo( const char *msg ) const 49 51 { 50 MessageBox( NULL, msg, " XMLシリアライズの例外", MB_OK );52 MessageBox( NULL, msg, "シリアライズの例外", MB_OK ); 51 53 } 52 54 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadXml( std::istream& ifs, bool isShowExceptionMessage ) … … 58 60 59 61 // ファイルから読込 60 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);61 62 isSuccessful = true; 63 } 64 catch( boost::archive::archive_exception e )62 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 63 64 isSuccessful = true; 65 } 66 catch( boost::archive::archive_exception const& e ) 65 67 { 66 68 if( isShowExceptionMessage ) … … 91 93 92 94 // ファイルに書き出し 93 oa << boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);94 95 isSuccessful = true; 96 } 97 catch( boost::archive::archive_exception e )95 oa << boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema const*>(this) ); 96 97 isSuccessful = true; 98 } 99 catch( boost::archive::archive_exception const& e ) 98 100 { 99 101 if( isShowExceptionMessage ) … … 151 153 152 154 // 文字列ストリームから読込 153 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);155 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 154 156 155 157 isSuccessful = true; … … 176 178 177 179 // 文字列ストリームに書き出し 178 oa << boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);179 180 isSuccessful = true; 181 } 182 catch( boost::archive::archive_exception e )180 oa << boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema const*>(this) ); 181 182 isSuccessful = true; 183 } 184 catch( boost::archive::archive_exception const& e ) 183 185 { 184 186 echo( e.what() ); … … 208 210 209 211 // ファイルから読込 210 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);211 212 isSuccessful = true; 213 } 214 catch( boost::archive::archive_exception e )212 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 213 214 isSuccessful = true; 215 } 216 catch( boost::archive::archive_exception const& e ) 215 217 { 216 218 if( isShowExceptionMessage ) … … 246 248 247 249 // ファイルに書き出し 248 oa << boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);249 250 isSuccessful = true; 251 } 252 catch( boost::archive::archive_exception e )250 oa << boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema const*>(this) ); 251 252 isSuccessful = true; 253 } 254 catch( boost::archive::archive_exception const& e ) 253 255 { 254 256 if( isShowExceptionMessage ) … … 286 288 287 289 // 文字列ストリームから読込 288 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);289 290 isSuccessful = true; 291 } 292 catch( boost::archive::archive_exception e )290 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 291 292 isSuccessful = true; 293 } 294 catch( boost::archive::archive_exception const& e ) 293 295 { 294 296 echo( e.what() ); … … 310 312 311 313 // 文字列ストリームに書き出し 312 oa << boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);313 314 isSuccessful = true; 315 } 316 catch( boost::archive::archive_exception e )314 oa << boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema const*>(this) ); 315 316 isSuccessful = true; 317 } 318 catch( boost::archive::archive_exception const& e ) 317 319 { 318 320 echo( e.what() ); … … 339 341 340 342 // ファイルから読込 341 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);342 343 isSuccessful = true; 344 } 345 catch( boost::archive::archive_exception e )343 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 344 345 isSuccessful = true; 346 } 347 catch( boost::archive::archive_exception const& e ) 346 348 { 347 349 if( isShowExceptionMessage ) … … 377 379 378 380 // ファイルに書き出し 379 oa << boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);380 381 isSuccessful = true; 382 } 383 catch( boost::archive::archive_exception e )381 oa << boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema const*>(this) ); 382 383 isSuccessful = true; 384 } 385 catch( boost::archive::archive_exception const& e ) 384 386 { 385 387 if( isShowExceptionMessage ) … … 417 419 418 420 // 文字列ストリームから読込 419 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);421 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 420 422 421 423 isSuccessful = true; … … 442 444 443 445 // 文字列ストリームに書き出し 444 oa << boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);445 446 isSuccessful = true; 447 } 448 catch( boost::archive::archive_exception e )446 oa << boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema const*>(this) ); 447 448 isSuccessful = true; 449 } 450 catch( boost::archive::archive_exception const& e ) 449 451 { 450 452 echo( e.what() ); … … 475 477 476 478 // 文字列ストリームから読込 477 ia >> boost::serialization::make_nvp( RootTagName(), * (T_xml_schema *)this);479 ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) ); 478 480 479 481 isSuccessful = true;
Note:
See TracChangeset
for help on using the changeset viewer.