Ignore:
Timestamp:
Mar 19, 2012, 1:59:48 AM (12 years ago)
Author:
イグトランス (egtra)
Message:

egtraブランチの内容をマージ。

Location:
trunk
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk

  • trunk/ab5.0/abdev

    • Property svn:ignore set to
      *.opensdf
      *.sdf
      *.suo
      *.user
      int
      ipch
      out
  • trunk/ab5.0/abdev/BasicCompiler_Common/src/BoostSerializationSupport.cpp

    r751 r828  
    1 #pragma warning(disable : 4996)
    2 
    31#include <map>
    42#include <string>
     
    1917#include <limits.h>
    2018#include <shlobj.h>
    21 #include <process.h>
    22 #include <fcntl.h>
    23 #include <io.h>
    2419#include <shlwapi.h>
    2520#include <tchar.h>
    26 #include <stdarg.h>
    2721
    2822//boost libraries
    2923#include <boost/foreach.hpp>
    30 
     24#include <boost/cast.hpp>
     25
     26#pragma warning(push)
     27#pragma warning(disable: 4244 6326)
    3128#include <boost/archive/xml_oarchive.hpp>
    3229#include <boost/archive/xml_iarchive.hpp>
     
    4138#include <boost/serialization/map.hpp>
    4239#include <boost/serialization/version.hpp>
    43 #include <boost/serialization/is_abstract.hpp>
     40#pragma warning(pop)
    4441
    4542#include <jenga/include/jenga.h>
     
    4946using namespace Jenga::Common;
    5047
     48using boost::polymorphic_downcast;
     49
    5150template<class T_xml_schema> void BoostSerializationSupport<T_xml_schema>::echo( const char *msg ) const
    5251{
    53     MessageBox( NULL, msg, "XMLシリアライズの例外", MB_OK );
     52    MessageBox( NULL, msg, "シリアライズの例外", MB_OK );
    5453}
    5554template<class T_xml_schema> bool BoostSerializationSupport<T_xml_schema>::ReadXml( std::istream& ifs, bool isShowExceptionMessage )
     
    6160
    6261        // ファイルから読込
    63         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    64 
    65         isSuccessful = true;
    66     }
    67     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 )
    6867    {
    6968        if( isShowExceptionMessage )
     
    9493
    9594        // ファイルに書き出し
    96         oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    97 
    98         isSuccessful = true;
    99     }
    100     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 )
    101100    {
    102101        if( isShowExceptionMessage )
     
    154153
    155154        // 文字列ストリームから読込
    156         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
     155        ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) );
    157156
    158157        isSuccessful = true;
     
    179178
    180179        // 文字列ストリームに書き出し
    181         oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    182 
    183         isSuccessful = true;
    184     }
    185     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 )
    186185    {
    187186        echo( e.what() );
     
    211210
    212211        // ファイルから読込
    213         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    214 
    215         isSuccessful = true;
    216     }
    217     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 )
    218217    {
    219218        if( isShowExceptionMessage )
     
    249248
    250249        // ファイルに書き出し
    251         oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    252 
    253         isSuccessful = true;
    254     }
    255     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 )
    256255    {
    257256        if( isShowExceptionMessage )
     
    289288
    290289        // 文字列ストリームから読込
    291         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    292 
    293         isSuccessful = true;
    294     }
    295     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 )
    296295    {
    297296        echo( e.what() );
     
    313312
    314313        // 文字列ストリームに書き出し
    315         oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    316 
    317         isSuccessful = true;
    318     }
    319     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 )
    320319    {
    321320        echo( e.what() );
     
    342341
    343342        // ファイルから読込
    344         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    345 
    346         isSuccessful = true;
    347     }
    348     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 )
    349348    {
    350349        if( isShowExceptionMessage )
     
    380379
    381380        // ファイルに書き出し
    382         oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    383 
    384         isSuccessful = true;
    385     }
    386     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 )
    387386    {
    388387        if( isShowExceptionMessage )
     
    420419
    421420        // 文字列ストリームから読込
    422         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
     421        ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) );
    423422
    424423        isSuccessful = true;
     
    445444
    446445        // 文字列ストリームに書き出し
    447         oa << boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
    448 
    449         isSuccessful = true;
    450     }
    451     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 )
    452451    {
    453452        echo( e.what() );
     
    478477
    479478        // 文字列ストリームから読込
    480         ia >> boost::serialization::make_nvp( RootTagName(), *(T_xml_schema *)this );
     479        ia >> boost::serialization::make_nvp( RootTagName(), *polymorphic_downcast<T_xml_schema*>(this) );
    481480
    482481        isSuccessful = true;
Note: See TracChangeset for help on using the changeset viewer.