MCPcopy Create free account
hub / github.com/AcademySoftwareFoundation/OpenColorIO / set_parameter

Method set_parameter

src/apputils/argparse.cpp:213–254  ·  view source on GitHub ↗

Given a string from argv, set the associated option parameter at index i using the format conversion code in the code string.

Source from the content-addressed store, hash-verified

211// Given a string from argv, set the associated option parameter
212// at index i using the format conversion code in the code string.
213void
214ArgOption::set_parameter (int i, const char *argv)
215{
216 assert(i < m_count);
217
218 static const std::string nullStr;
219
220 switch (m_code[i]) {
221 case 'd':
222 *(int *)m_param[i] = argv ? atoi(argv) : 0;
223 break;
224
225 case 'f':
226 case 'g':
227 *(float *)m_param[i] = argv ? (float)atof(argv) : 0.0f;
228 break;
229
230 case 'F':
231 *(double *)m_param[i] = argv ? atof(argv) : 0.;
232 break;
233
234 case 's':
235 *(std::string *)m_param[i] = argv ? argv : nullStr;
236 break;
237
238 case 'S':
239 *(std::string *)m_param[i] = argv ? argv : nullStr;
240 break;
241
242 case 'L':
243 ((std::vector<std::string> *)m_param[i])->push_back (argv);
244 break;
245
246 case 'b':
247 *(bool *)m_param[i] = true;
248 break;
249
250 case '*':
251 default:
252 abort();
253 }
254}
255
256
257

Callers 1

parseMethod · 0.80

Calls 1

push_backMethod · 0.45

Tested by

no test coverage detected