45 std::string &sEventType,
46 std::string &sModuleId,
50 int iArgumentCount = 0;
51 std::string sArgument;
57 inputArguments.clear();
60 pos = sInput.find_first_not_of(
" \t");
62 while(!(sArgument = getNextArgument(sInput, pos)).empty())
64 if(iArgumentCount == 0)
70 else if(iArgumentCount == 1)
73 sModuleId = sArgument;
75 else if(iArgumentCount == 2)
78 sEventType = sArgument;
82 inputArguments.push_back(sArgument);
88 return iArgumentCount >= 3;
91 std::string EMANE::Generators::EEL::InputParser::getNextArgument(
const std::string & sInput,
94 std::string sArgument;
96 if(posStart != std::string::npos)
98 size_t posEnd = sInput.find_first_of(
" \t\n#\"",posStart);
100 if(posEnd != std::string::npos)
104 if(sInput.at(posEnd) ==
'\"')
106 if(sInput.at(posStart) ==
'\"')
108 posEnd = sInput.find_first_of(
"\"",posEnd + 1);
110 if(posEnd != std::string::npos)
113 len = posEnd - posStart;
118 std::stringstream ssDescription;
119 ssDescription<<
"Unterminated string: "<<sInput<<std::ends;
126 std::stringstream ssDescription;
127 ssDescription<<
"Invalid start of string: "<<sInput<<std::ends;
133 len = posEnd - posStart;
136 sArgument = sInput.substr(posStart, len);
138 posStart = sInput.find_first_not_of(
" \t\n",posEnd);
142 sArgument = sInput.substr(posStart);
143 posStart = std::string::npos;
std::vector< std::string > InputArguments
float toFloat(float fMin=std::numeric_limits< float >::lowest(), float fMax=std::numeric_limits< float >::max()) const
Parameter conversion class with range checks.