- while (options[i].type != numTypes) {
- if (strcasecmp(name.c_str(), options[i].name) == 0) {
- ConfigItem *item = new ConfigItem(options[i].type, value);
- items.push_back(item);
- break;
+ while (bool_options[i].type != NUM_BOOL_TYPES) {
+ if (strcasecmp(name.c_str(), bool_options[i].name) == 0) {
+ BoolItem *item = new BoolItem;
+ const char *tmp = value.c_str();
+
+ item->type = bool_options[i].type;
+
+ if (strcasecmp(tmp, "true") == 0 || strcasecmp(tmp, "1") == 0 ||
+ strcasecmp(tmp, "on") == 0)
+ item->value = true;
+ else
+ item->value = false;
+
+ bool_items.push_back(item);
+ return;
+ }
+ i++;
+ }
+
+ // if it's a string, add it to the string_items list
+ i = 0;
+ while (string_options[i].type != NUM_STRING_TYPES) {
+ if (strcasecmp(name.c_str(), string_options[i].name) == 0) {
+ StringItem *item = new StringItem;
+ item->type = string_options[i].type;
+ item->value = value;
+
+ string_items.push_back(item);
+ return;
+ }
+ i++;
+ }
+
+ // if it's a number, add it to the number_items list
+ i = 0;
+ while (number_options[i].type != NUM_NUMBER_TYPES) {
+ if (strcasecmp(name.c_str(), number_options[i].name) == 0) {
+ NumberItem *item = new NumberItem;
+ item->type = number_options[i].type;
+ item->value = atoi( value.c_str() );
+
+ number_items.push_back(item);
+ return;