コード例 #1
0
bool ARMGNULDBackend::initTargetSectionMap(SectionMap& pSectionMap)
{
  if (!pSectionMap.push_back(".ARM.exidx", ".ARM.exidx") ||
      !pSectionMap.push_back(".ARM.extab", ".ARM.extab") ||
      !pSectionMap.push_back(".ARM.attributes", ".ARM.attributes"))
    return false;
  return true;
}
コード例 #2
0
ファイル: jsonconf.cpp プロジェクト: umiringo/musculus
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 );
    }
}
コード例 #3
0
ファイル: ini.cpp プロジェクト: carriercomm/anaconda
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();
}
コード例 #4
0
ファイル: ConfigService.cpp プロジェクト: LawrenceWeng/ember
	ConfigService::SectionMap ConfigService::getSection ( const std::string& sectionName )
	{
		SectionMap combinedSection;

		if (mInstanceConfig->findSection(sectionName)) {
			const SectionMap& section = mInstanceConfig->getSection(sectionName);
			combinedSection.insert(section.begin(), section.end());
		}
		if (mCommandLineConfig->findSection(sectionName)) {
			const SectionMap& section = mCommandLineConfig->getSection(sectionName);
			combinedSection.insert(section.begin(), section.end());
		}
		if (mUserConfig->findSection(sectionName)) {
			const SectionMap& section = mUserConfig->getSection(sectionName);
			combinedSection.insert(section.begin(), section.end());
		}
		if (mGlobalConfig->findSection(sectionName)) {
			const SectionMap& section = mGlobalConfig->getSection(sectionName);
			combinedSection.insert(section.begin(), section.end());
		}
		return combinedSection;
	}
コード例 #5
0
ファイル: jsonconf.cpp プロジェクト: umiringo/musculus
void JsonConf::reLoad()
{
    struct stat st;
    Thread::RWLock::WRScoped l(locker);

    for( stat(fileName.c_str(), &st); mTime != st.st_mtime; stat( fileName.c_str(), &st) ){
        mTime = st.st_mtime;
        std::ifstream ifs( fileName.c_str() );
        SectionType section;
        SectionMap sMap;
        if( !jsonConfMap.empty() ){
            jsonConfMap.clear();
        }
        
        if( !ifs.is_open() ){
            Logger::file()->error("json file open failed! {}", fileName);
            return;
        }
        Json::Reader reader;
        Json::Value root;
        if( !reader.parse(ifs, root, false) ){
            Logger::file()->error("json file parse failed! {}", fileName);
            return;
        }

        for( Json::Value::const_iterator fit = root.begin(); fit != root.end(); ++fit){
            std::string sectionKey = fit.key().asString();
            SectionMap mapTmp;
            for( Json::Value::const_iterator sit = fit->begin(); sit != fit->end(); ++sit ){
                std::string key = sit.key().asString();
                mapTmp[key] = sit->asString();
            }
            if( !mapTmp.empty() ){
                jsonConfMap[sectionKey] = mapTmp;
            }
        }
    }
}
コード例 #6
0
ファイル: CAConfig.cpp プロジェクト: openSUSE/libcamgm
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);
	}
}
コード例 #7
0
ファイル: Configuration.cpp プロジェクト: wuhua988/icm
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 "";
  }
}
コード例 #8
0
ファイル: iniparser.cpp プロジェクト: adenzhang/iniparser
 void clear() {
     sections.clear();
 }
コード例 #9
0
ファイル: Configuration.cpp プロジェクト: wuhua988/icm
int
Configuration::open (const char *fileName)
{
  if (0 == fileName)  {
      errno = EINVAL;
      return -1;
  }
  FILE* in = OS::fopen (fileName, ACE_TEXT ("r"));
  if (!in)
    return -1;

  char buffer[4096];
  SectionMap *section = 0;
  while (OS::fgets (buffer, sizeof buffer, in))
    {
      char *line = this->squish (buffer);
      // Check for a comment and blank line
      if (line[0] ==  ';'  ||
          line[0] ==  '#'  ||
          line[0] == '\0')
        continue;

      if (line[0] == '[')  {
          // We have a new section here, strip out the section name
          char* end = OS::strrchr (line, ']');
          if (!end) {
              OS::fclose (in);
              return -3;
          }

          // edited by robert, change to memmove to handle overlapping memory
//          OS::memcpy (line, line + 1, OS::strlen (line) - 2);
          OS::memmove (line, line + 1, OS::strlen (line) - 2);
          line[OS::strlen (line) -2] = 0;
          //*end = 0;

          section = new SectionMap;
          this->m_configMap.insert (pair<string, SectionMap*> (line,section));

          continue;
      }

      // We have a line; name ends at equal sign.
      char *end = OS::strchr (line, '=');
      if (end == 0)   {
          OS::fclose (in);
          return -3;
      }
      *end++ = '\0';
      char *name = this->squish (line);

      // Now find the start of the value
      char *value = this->squish (end);
      //size_t value_len = OS::strlen (value);

      section->insert (pair<string, string> (name, value));

  } // end while fgets

  if (ferror (in))  {
      OS::fclose (in);
      return -1;
  }

  OS::fclose (in);
  return 0;
}
コード例 #10
0
SectionMerger::SectionMerger(SectionMap& pSectionMap, LDContext& pContext)
: m_SectionNameMap(pSectionMap),
  m_Output(pContext),
  m_LDSectionMap(pSectionMap.size())
{
}