Esempio n. 1
0
 std::vector<std::string> get_keys(const std::string &section)
 {
     try {
         return _get_keys(_pt.get_child(section));
     } catch (const boost::property_tree::ptree_bad_path &) {
         return std::vector<std::string>{};
     }
 }
Esempio n. 2
0
 std::vector<std::string> get_sections()
 {
     try {
         return _get_keys(_pt);
     } catch (const boost::property_tree::ptree_bad_path &) {
         return std::vector<std::string>{};
     }
 }
Esempio n. 3
0
/*--------------------------------------------------------------------------*/
int _get_sections()
{
	int i;
	if ((section_list->count = iniparser_getnsec(ini)) == -1){
		write_to_log(WARNING, "%s - %d - %s", __LINE__, __func__, "Unable to count config sections");
		return -1;
	}
	for(i = 0; i < section_list->count; i++) {
		TSection* node = malloc(sizeof(struct section));
		node->section_name = iniparser_getsecname(ini, i);
		_get_keys(node);
		if (section_list->first == NULL) {
			section_list->first = node;
		} else {
			TSection *tmp = section_list->first;
			section_list->first = node;
			section_list->first->next = tmp;
		}
	}
	return 0; 
}