- Timestamp:
- Aug 6, 2007, 9:31:22 AM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/DebugMiddleFile.cpp
r263 r264 76 76 *(long *)(buffer+i2)=PLATFORM; 77 77 i2+=sizeof(long); 78 79 80 // オブジェクトモジュール 81 { 82 // テキストデータにシリアライズ 83 std::string textString; 84 compiler.objectModule.WriteTextString( textString ); 85 86 // サイズ 87 *(long *)(buffer+i2) = textString.size(); 88 i2+=sizeof(long); 89 90 //バッファが足りない場合は再確保 91 if(BufferSize<i2+(int)textString.size()+32768){ 92 while( BufferSize<i2+(int)textString.size()+32768 ) 93 { 94 BufferSize+=32768; 95 } 96 97 buffer=(char *)HeapReAlloc(hHeap,0,buffer,BufferSize); 98 } 99 100 // バッファ 101 memcpy( buffer+i2, textString.c_str(), textString.size() ); 102 i2 += textString.size(); 103 } 104 78 105 79 106 //インクルード情報 … … 475 502 i2+=sizeof(long); 476 503 504 MessageBox(0,"test","test",0); 505 506 // オブジェクトモジュール 507 { 508 // サイズ 509 int size = *(long *)(buffer+i2); 510 i2 += sizeof(long); 511 512 // バッファ 513 const std::string textString( (const char *)(buffer + i2), size ); 514 i2 += textString.size(); 515 516 // テキストデータからシリアライズ 517 this->objectModule.ReadTextString( textString ); 518 } 519 477 520 //インクルード情報 478 521 IncludeFileInfo.FilesNum=*(long *)(buffer+i2); -
trunk/abdev/BasicCompiler_Common/include/BoostSerializationSupport.h
r256 r264 23 23 bool ReadXml( istream& ifs, bool isShowExceptionMessage = true ); 24 24 bool WriteXml( ostream& ofs, bool isShowExceptionMessage = true ) const; 25 bool ReadXml( const st ring &xmlFilePath, bool isShowExceptionMessage = true );26 bool WriteXml( const st ring &xmlFilePath, bool isShowExceptionMessage = true ) const;25 bool ReadXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true ); 26 bool WriteXml( const std::string &xmlFilePath, bool isShowExceptionMessage = true ) const; 27 27 28 bool ReadBinary( const st ring &filePath, bool isShowExceptionMessage = true );29 bool WriteBinary( const st ring &filePath, bool isShowExceptionMessage = true ) const;28 bool ReadBinary( const std::string &filePath, bool isShowExceptionMessage = true ); 29 bool WriteBinary( const std::string &filePath, bool isShowExceptionMessage = true ) const; 30 30 31 bool ReadText( const string &filePath, bool isShowExceptionMessage = true ); 32 bool WriteText( const string &filePath, bool isShowExceptionMessage = true ) const; 31 bool ReadText( const std::string &filePath, bool isShowExceptionMessage = true ); 32 bool WriteText( const std::string &filePath, bool isShowExceptionMessage = true ) const; 33 bool ReadTextString( const std::string &textString ); 34 bool WriteTextString( std::string &textString ) const; 33 35 34 bool ReadXmlFromString( const st ring &xmlBuffer );36 bool ReadXmlFromString( const std::string &xmlBuffer ); 35 37 }; 36 38 -
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.