Changeset 322 in dev for trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
- Timestamp:
- Sep 24, 2007, 2:58:10 PM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp
r299 r322 190 190 } 191 191 192 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinary ( const string &filePath, bool isShowExceptionMessage )193 { 194 // 入力アーカイブの作成 195 std::ifstream ifs( filePath.c_str() );192 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinaryFile( const string &filePath, bool isShowExceptionMessage ) 193 { 194 // 入力アーカイブの作成 195 std::ifstream ifs( filePath.c_str(), ios::in | ios::binary ); 196 196 197 197 bool isSuccessful = false; … … 228 228 return true; 229 229 } 230 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteBinary ( const string &filePath, bool isShowExceptionMessage ) const231 { 232 // 出力アーカイブの作成 233 std::ofstream ofs( filePath.c_str() );230 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteBinaryFile( const string &filePath, bool isShowExceptionMessage ) const 231 { 232 // 出力アーカイブの作成 233 std::ofstream ofs( filePath.c_str(), ios::out | ios::binary ); 234 234 235 235 bool isSuccessful = false; … … 267 267 } 268 268 269 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadBinaryString( const std::string &binaryString ) 270 { 271 bool isSuccessful = false; 272 273 // 入力アーカイブの作成 274 std::istringstream iss( binaryString, ios::in | ios::binary ); 275 276 try{ 277 boost::archive::binary_iarchive ia(iss); 278 279 // 文字列ストリームから読込 280 ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 281 282 isSuccessful = true; 283 } 284 catch( boost::archive::archive_exception e ) 285 { 286 echo( e.what() ); 287 } 288 catch(...){ 289 echo( "archive_exception以外の不明な例外" ); 290 } 291 292 return isSuccessful; 293 } 294 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::WriteBinaryString( std::string &binaryString ) const 295 { 296 // 出力アーカイブの作成 297 std::ostringstream oss( "", ios::out | ios::binary ); 298 299 bool isSuccessful = false; 300 try{ 301 boost::archive::binary_oarchive oa(oss); 302 303 // 文字列ストリームに書き出し 304 oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this ); 305 306 isSuccessful = true; 307 } 308 catch( boost::archive::archive_exception e ) 309 { 310 echo( e.what() ); 311 } 312 catch(...){ 313 echo( "archive_exception以外の不明な例外" ); 314 } 315 316 binaryString = oss.str(); 317 318 return isSuccessful; 319 } 320 269 321 template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadText( const string &filePath, bool isShowExceptionMessage ) 270 322 {
Note:
See TracChangeset
for help on using the changeset viewer.