Changeset 457 in dev for trunk/ab5.0/jenga/src/common/CmdLine.cpp
- Timestamp:
- Mar 23, 2008, 1:24:09 AM (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/ab5.0/jenga/src/common/CmdLine.cpp
r291 r457 7 7 CmdLines::CmdLines( const std::string &strCmdLine ) 8 8 { 9 for( int i=0; i<(int)strCmdLine.size() ; i++ ) 9 char temporary[8192]; 10 int i = 0; 11 while( i<(int)strCmdLine.size() ) 10 12 { 13 while( strCmdLine[i] == ' ' ) 14 { 15 i ++; 16 } 17 18 if( strCmdLine[i] == '\0' ) 19 { 20 break; 21 } 22 11 23 if( strCmdLine[i] == '/' ) 12 24 { 13 25 i++; 14 15 char temporary[255];16 26 17 27 // コマンド文字列(オプション名)を抽出 … … 35 45 if( (int)strCmdLine.size() > i && strCmdLine[i] != '/' ) 36 46 { 47 if( strCmdLine[i] == ':' ) 48 { 49 // ':'はコマンドとパラメータの区切り文字として認識する 50 i++; 51 } 52 37 53 // パラメータを抽出 38 54 if( strCmdLine[i] == '\"' ) … … 70 86 this->push_back( CmdLine( command, parameter ) ); 71 87 } 88 else if( strCmdLine[i] == '\"' ) 89 { 90 i++; 91 //ダブルクォートの中身を取り出す 92 for( int j=0; ; j++, i++ ) 93 { 94 if( strCmdLine[i] == '\"' || strCmdLine[i] == '\0' ) 95 { 96 temporary[j] = 0; 97 98 if( strCmdLine[i] == '\"' ) i++; 99 break; 100 } 101 temporary[j] = strCmdLine[i]; 102 } 103 104 this->push_back( CmdLine( "", temporary ) ); 105 } 106 else 107 { 108 //空白またはヌル文字以前を取り出す 109 for( int j=0; ; j++, i++ ) 110 { 111 if( strCmdLine[i] == ' ' || strCmdLine[i] == '\0' ) 112 { 113 temporary[j] = 0; 114 break; 115 } 116 temporary[j] = strCmdLine[i]; 117 } 118 119 this->push_back( CmdLine( "", temporary ) ); 120 } 72 121 } 73 122 }
Note:
See TracChangeset
for help on using the changeset viewer.