MCPcopy Create free account
hub / github.com/MITK/MITK / addParameter

Method addParameter

Modules/CommandLine/src/mitkCommandLineParser.cpp:156–220  ·  view source on GitHub ↗

--------------------------------------------------------------------------

Source from the content-addressed store, hash-verified

154
155// --------------------------------------------------------------------------
156bool CommandLineParserArgumentDescription::addParameter(const string &value)
157{
158 switch (ValueType)
159 {
160 case mitkCommandLineParser::String:
161 {
162 Value = value;
163 }
164 break;
165 case mitkCommandLineParser::Bool:
166 {
167 if (value.compare("true") == 0)
168 Value = true;
169 else
170 Value = false;
171 }
172 break;
173 case mitkCommandLineParser::StringList:
174 {
175 try
176 {
177 mitkCommandLineParser::StringContainerType list =
178 us::any_cast<mitkCommandLineParser::StringContainerType>(Value);
179 list.push_back(value);
180 Value = list;
181 }
182 catch (...)
183 {
184 mitkCommandLineParser::StringContainerType list;
185 list.push_back(value);
186 Value = list;
187 }
188 }
189 break;
190 case mitkCommandLineParser::Int:
191 {
192 stringstream ss(value);
193 int i;
194 ss >> i;
195 Value = i;
196 }
197 break;
198 case mitkCommandLineParser::Float:
199 {
200 stringstream ss(value);
201 float f;
202 ss >> f;
203 Value = f;
204 }
205 break;
206
207 case mitkCommandLineParser::Directory:
208 case mitkCommandLineParser::Image:
209 case mitkCommandLineParser::File:
210 {
211 Value = value;
212 }
213 break;

Callers 1

parseArgumentsMethod · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected