Пример #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 );
    }
}
Пример #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();
}
Пример #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);
	}
}
Пример #4
0
std::string
Configuration::getConfigStr (const char *sectionKey, const char * name)
{
  if ((sectionKey == 0) || (name == 0))
    return "";

  map<string, SectionMap*>::iterator it = this->m_configMap.find (sectionKey);
  if (it != this->m_configMap.end ()) {
    SectionMap* sectionMap = it->second;
    if (sectionMap == 0) {
      LogMsg << "err find the section " << sectionKey << endl;
      return "";
    }

    map<string, string>::iterator it2 = sectionMap->find (name);
    if (it2 != sectionMap->end ()) {
      return it2->second;
    } else {
      return "";
    }
  } else {
    return "";
  }
}