|
Helper function to create a list of string pairs from an array of const char*, terminated by a 0 (zero, NULL). The element in the given array are, alternating, the first and the second element of each pair. I.e. you can write {"1st pair->first", "1st pair->second", "2nd pair->first", "2nd pair->second", 0} and so on.
However, since C++ does not allow anonymus char* arrays, you have to store the char array in a variable. I.e. you need to write
simth::PropertyList pl;
const char * a[] = { "option1", "explanation of option", "option2", "explanation", 0 };
pl.addProperty("my_mode", "enum", "option1", "description of property", simth::to_stringpairs( a ));
- Note:
- Watch out -- if you forget the trailing 0 (zero, NULL) then this function will crash.
|