#include #include using namespace Jenga::Common; CmdLines::CmdLines( const std::string &strCmdLine ) { for( int i=0; i<(int)strCmdLine.size() ; i++ ) { if( strCmdLine[i] == '/' ) { i++; char temporary[255]; // コマンド文字列(オプション名)を抽出 for( int j = 0; ; j++, i++ ) { if( isalpha( strCmdLine[i] ) || isdigit( strCmdLine[i] ) || strCmdLine[i] == '_' ) { temporary[j] = strCmdLine[i]; } else { temporary[j] = 0; break; } } while( strCmdLine[i] == ' ' ) i++; std::string command = temporary; std::string parameter = ""; if( (int)strCmdLine.size() > i && strCmdLine[i] != '/' ) { // パラメータを抽出 if( strCmdLine[i] == '\"' ) { i++; //ダブルクォートの中身を取り出す for( int j=0; ; j++, i++ ) { if( strCmdLine[i] == '\"' || strCmdLine[i] == '\0' ) { temporary[j] = 0; if( strCmdLine[i] == '\"' ) i++; break; } temporary[j] = strCmdLine[i]; } } else { //空白またはヌル文字以前を取り出す for( int j=0; ; j++, i++ ) { if( strCmdLine[i] == ' ' || strCmdLine[i] == '\0' ) { temporary[j] = 0; break; } temporary[j] = strCmdLine[i]; } } parameter = temporary; } this->push_back( CmdLine( command, parameter ) ); } } } bool CmdLines::IsExist( const std::string &commandString ) const { const CmdLines &cmdLines = *this; BOOST_FOREACH( const CmdLine &cmdLine, cmdLines ) { if( cmdLine.GetCommand() == commandString ) { return true; } } return false; }