carb::dictionary::setDictionaryFromCmdLine

Defined in carb/dictionary/DictionaryUtils.h

inline void carb::dictionary::setDictionaryFromCmdLine(IDictionary *id, Item *dict, char **argv, int argc, const char *prefix = "--/")

Parses a set of command line arguments for dictionary items arguments and sets them.

Remark

This parses command line arguments to find ones that should be added to a settings dictionary. Only arguments beginning with the given prefix will be added. The type of each individual item added to the dictionary will be automatically detected based on the same criteria used for setDictionaryElementAutoType().

Thread Safety

This operation itself is thread safe, but a race condition may still exist if multiple threads are trying to set the values for the same set of items simultaneously. The operation will succeed, but the value that gets set in each item in the end is undefined.

Parameters
  • id[in] The IDictionary interface to use to access the items in the dictionary. This must not be nullptr. This must be the same interface that was originally used to create the dictionary dict.

  • dict[in] The base item to act as the root of where to set the values relative to. This may not be nullptr.

  • argv[in] The Unix style argument array for the command line to the process. This must not be nullptr. The first entry in this array is expected to be the process’s name. Only the arguments starting with prefix will be parsed here.

  • argc[in] The Unix style argument count for the total number of items in argv to parse.

  • prefix[in] A string indicating the prefix of arguments that should be parsed by this operation. This may not be nullptr. Arguments that do not start with this prefix will simply be ignored.

Returns

No return value.