Exemple #1
0
void JsonConf::getKeys(const SectionType& section, std::vector<KeyType>& keys)
{
    keys.clear();
    Thread::RWLock::RDScoped l(locker);
    SectionMap sMap = jsonConfMap[section];
    for( SectionMap::const_iterator it = sMap.begin(); it != sMap.end(); ++it){
        keys.push_back( it->first );
    }
}
Exemple #2
0
void INI::merge_map(const SectionMap & data2, bool overwrite)
{
    SectionMap::const_iterator it1;
    OptionMap::const_iterator it2;
    for (it1 = data2.begin(); it1 != data2.end(); ++it1) {
        for (it2 = (*it1).second.begin(); it2 != (*it1).second.end();
             ++it2) {
            if (!overwrite && has_item((*it1).first, (*it2).first))
                continue;
            (*data)[(*it1).first][(*it2).first] = (*it2).second;
        }
    }
    save_auto();
}
Exemple #3
0
void
CAConfig::dumpTree(CASection *casection, int level)
{
	std::string tab = "";
	for (int i = 0; i <= level; i++) tab += "  ";

	if (level == 0)
		LOGIT_INFO (tab);

	std::string sectionComment = casection->section->getComment();
	if (sectionComment.length() > 0)
		LOGIT_INFO (tab <<
		            "SectionComment " << casection->section->getComment());

	EntryMap eMap= casection->section->getEntries();
	for (EntryMap::iterator i = eMap.begin(); i != eMap.end(); i++)
	{
		Entry entry = i->second;
		std::string comment = entry.getComment();
		if (comment.length() > 0)
			LOGIT_INFO (tab <<
			            "Comment " << i->first << " : " << entry.getComment());
		LOGIT_INFO (tab <<
		            "Entry   " << i->first << " : " << entry.getValue());
	}

	SectionMap sMap = casection->section->getSections();
	for (SectionMap::iterator i = sMap.begin(); i != sMap.end(); i++)
	{
		Section sec = i->second;
		LOGIT_INFO (tab <<
		            "Section " << i->first);
		CASection cas;
		cas.section = &sec;
		dumpTree (&cas, level+1);
	}
}