Changeset 322 in dev for trunk/abdev/BasicCompiler_Common/src
- Timestamp:
- Sep 24, 2007, 2:58:10 PM (17 years ago)
- Location:
- trunk/abdev/BasicCompiler_Common/src
- Files:
-
- 2 added
- 5 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 { -
trunk/abdev/BasicCompiler_Common/src/Class.cpp
r310 r322 957 957 958 958 bool isEnum = false; 959 bool isDelegate = false; 959 960 if( source[i] == 1 && source[i+1] == ESC_ENUM ){ 960 961 // 列挙型の場合 961 962 isEnum = true; 962 963 963 i+=2; 964 i += 2; 965 } 966 else if( source[i] == 1 && source[i+1] == ESC_DELEGATE ) 967 { 968 // デリゲートの場合 969 isDelegate = true; 970 971 i += 2; 964 972 } 965 973 … … 976 984 if( pClass ){ 977 985 if( source[nowLine+1] == ESC_CLASS ){ 978 if( isEnum ){ 986 if( isEnum ) 987 { 979 988 pClass->SetClassType( CClass::Enum ); 989 } 990 else if( isDelegate ) 991 { 992 pClass->SetClassType( CClass::Delegate ); 980 993 } 981 994 else{ … … 1310 1323 } 1311 1324 1312 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ){ 1325 if( basbuf[i] == 1 && basbuf[i+1] == ESC_ENUM ) 1326 { 1313 1327 // 列挙型の場合 1314 i+=2; 1328 i += 2; 1329 } 1330 else if( basbuf[i] == 1 && basbuf[i+1] == ESC_DELEGATE ) 1331 { 1332 // デリゲートの場合 1333 i += 2; 1315 1334 } 1316 1335 -
trunk/abdev/BasicCompiler_Common/src/ObjectModule.cpp
r308 r322 9 9 ObjectModuleDataTypeBinaly, 10 10 }; 11 const ObjectModuleDataType objectModuleDataType = ObjectModuleDataType Text;11 const ObjectModuleDataType objectModuleDataType = ObjectModuleDataTypeBinaly; 12 12 13 13 … … 48 48 return ReadText( filePath ); 49 49 case ObjectModuleDataTypeBinaly: 50 return ReadBinary ( filePath );50 return ReadBinaryFile( filePath ); 51 51 default: 52 52 Jenga::Throw( "" ); … … 64 64 return WriteText( filePath ); 65 65 case ObjectModuleDataTypeBinaly: 66 return WriteBinary ( filePath );66 return WriteBinaryFile( filePath ); 67 67 default: 68 68 Jenga::Throw( "" ); … … 80 80 return ReadTextString( str ); 81 81 case ObjectModuleDataTypeBinaly: 82 Jenga::Throw( "" ); 83 break; 82 return ReadBinaryString( str ); 84 83 default: 85 84 Jenga::Throw( "" ); … … 97 96 return WriteTextString( str ); 98 97 case ObjectModuleDataTypeBinaly: 99 Jenga::Throw( "" ); 100 break; 98 return WriteBinaryString( str ); 101 99 default: 102 100 Jenga::Throw( "" ); -
trunk/abdev/BasicCompiler_Common/src/Procedure.cpp
r311 r322 55 55 //ソースコードの位置 56 56 this->codePos = nowLine; 57 if( nowLine == 0x10b ) 58 { 59 int test=0; 60 } 57 61 58 62 //パラメータ -
trunk/abdev/BasicCompiler_Common/src/Source.cpp
r305 r322 422 422 int i,i2; 423 423 424 bool isMustChange = false; 425 for( i=0; ; i++ ){ 426 if( buffer[i] == '\0' ){ 427 break; 428 } 429 if( buffer[i]=='\n' ) 430 { 431 if( i>0 ) 432 { 433 if( buffer[i-1] == '\r' ) 434 { 435 isMustChange = true; 436 } 437 } 438 } 439 } 440 441 if( !isMustChange ) 442 { 443 // 改行コードの変換は必要ない 444 return; 445 } 446 424 447 #ifdef _DEBUG 425 448 //改行コードの整合性チェック … … 806 829 } 807 830 831 void BasicSource::Initialize( const std::string &source ) 832 { 833 Clear(); 834 Add( source ); 835 836 // 改行コードをCRLFからLFに変換 837 ChangeReturnLineChar(); 838 839 // コメントを削除 840 RemoveComments(); 841 842 //最終行には文字を含ませないようにする 843 if( lstrlen(buffer)>0 && buffer[lstrlen(buffer)-1] != '\n' ) 844 { 845 Realloc( length + 1 ); 846 lstrcat( buffer, "\n" ); 847 } 848 849 // アンダーバーによる改行を正規表現に戻す 850 RemoveReturnLineUnderbar(); 851 } 852 808 853 void BasicSource::SetBuffer( const char *buffer ){ 809 854 this->buffer = (char *)calloc( lstrlen(buffer) + 1, 1 ); … … 987 1032 return 1; 988 1033 } 1034 1035 1036 SourceTemplate::SourceTemplate( const std::string &filePath ) 1037 { 1038 Jenga::Common::File file = Jenga::Common::File( GetApplicationBaseFullPath( filePath ) ); 1039 source = file.Read(); 1040 } 1041 std::string SourceTemplate::GetResult( const std::map<std::string,std::string> &values ) 1042 { 1043 std::string result = source; 1044 1045 std::map<std::string,std::string>::const_iterator it = values.begin(); 1046 while( it != values.end() ) 1047 { 1048 while( true ) 1049 { 1050 std::string::size_type index = result.find( "#" + it->first + "#" ); 1051 if( index == std::string::npos ) 1052 { 1053 break; 1054 } 1055 1056 result = result.substr( 0, index ) + it->second + result.substr( index + it->first.length() + 2 ); 1057 } 1058 it++; 1059 } 1060 1061 return result; 1062 }
Note:
See TracChangeset
for help on using the changeset viewer.