bool fillVectorInt(const Array& array, std::vector<int>* pVector) { for (Array::const_iterator it = array.begin(); it != array.end(); ++it) { if (!isType<int>(*it)) return false; pVector->push_back(it->get_int()); } return true; }
void JSONConfiguration::GetArray(IN const string &name, OUT list<any> &out_list) { const Array &val_array = find_array(_rootValue.get_obj(),name); out_list.clear(); for (Array::const_iterator iter = val_array.begin(); iter != val_array.end(); iter++) { Value_type vt = iter->type(); switch (vt) { case str_type: { out_list.push_back(iter->get_str()); break; } case bool_type: { out_list.push_back(iter->get_bool()); break; } case int_type: { out_list.push_back(iter->get_int()); break; } case real_type: { out_list.push_back(iter->get_real()); break; } case obj_type: case null_type: case array_type: default: { throw new configuration_exception("not supported JSON type. (TBD)"); } } // switch } }