当前位置: 首页>>代码示例>>C++>>正文


C++ PropertyMap::begin方法代码示例

本文整理汇总了C++中PropertyMap::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyMap::begin方法的具体用法?C++ PropertyMap::begin怎么用?C++ PropertyMap::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PropertyMap的用法示例。


在下文中一共展示了PropertyMap::begin方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: if

PropertyMap MP4::Tag::setProperties(const PropertyMap &props)
{
  static Map<String, String> reverseKeyMap;
  if(reverseKeyMap.isEmpty()) {
    int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]);
    for(int i = 0; i < numKeys; i++) {
      reverseKeyMap[keyTranslation[i][1]] = keyTranslation[i][0];
    }
  }

  PropertyMap origProps = properties();
  PropertyMap::ConstIterator it = origProps.begin();
  for(; it != origProps.end(); ++it) {
    if(!props.contains(it->first) || props[it->first].isEmpty()) {
      d->items.erase(reverseKeyMap[it->first]);
    }
  }

  PropertyMap ignoredProps;
  it = props.begin();
  for(; it != props.end(); ++it) {
    if(reverseKeyMap.contains(it->first)) {
      String name = reverseKeyMap[it->first];
      if((it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") && !it->second.isEmpty()) {
        int first = 0, second = 0;
        StringList parts = StringList::split(it->second.front(), "/");
        if(parts.size() > 0) {
          first = parts[0].toInt();
          if(parts.size() > 1) {
            second = parts[1].toInt();
          }
          d->items[name] = MP4::Item(first, second);
        }
      }
      else if(it->first == "BPM" && !it->second.isEmpty()) {
        int value = it->second.front().toInt();
        d->items[name] = MP4::Item(value);
      }
      else if(it->first == "COMPILATION" && !it->second.isEmpty()) {
        bool value = (it->second.front().toInt() != 0);
        d->items[name] = MP4::Item(value);
      }
      else {
        d->items[name] = it->second;
      }
    }
    else {
      ignoredProps.insert(it->first, it->second);
    }
  }

  return ignoredProps;
}
开发者ID:ConfusedGiant,项目名称:Clementine,代码行数:53,代码来源:mp4tag.cpp

示例2: if

PropertyMap Ogg::XiphComment::setProperties(const PropertyMap &properties)
{
  // check which keys are to be deleted
  StringList toRemove;
  for(FieldListMap::ConstIterator it = d->fieldListMap.begin(); it != d->fieldListMap.end(); ++it)
    if (!properties.contains(it->first))
      toRemove.append(it->first);

  for(StringList::ConstIterator it = toRemove.begin(); it != toRemove.end(); ++it)
      removeField(*it);

  // now go through keys in \a properties and check that the values match those in the xiph comment
  PropertyMap invalid;
  PropertyMap::ConstIterator it = properties.begin();
  for(; it != properties.end(); ++it)
  {
    if(!checkKey(it->first))
      invalid.insert(it->first, it->second);
    else if(!d->fieldListMap.contains(it->first) || !(it->second == d->fieldListMap[it->first])) {
      const StringList &sl = it->second;
      if(sl.size() == 0)
        // zero size string list -> remove the tag with all values
        removeField(it->first);
      else {
        // replace all strings in the list for the tag
        StringList::ConstIterator valueIterator = sl.begin();
        addField(it->first, *valueIterator, true);
        ++valueIterator;
        for(; valueIterator != sl.end(); ++valueIterator)
          addField(it->first, *valueIterator, false);
      }
    }
  }
  return invalid;
}
开发者ID:audioprog,项目名称:AudioDatabaseForUsbAutoCopyMaster,代码行数:35,代码来源:xiphcomment.cpp

示例3: createProcess

void RTComponent::createProcess(string& command, PropertyMap& prop)
{
    QStringList argv;
    argv.push_back(QString("-o"));
    argv.push_back(QString("naming.formats: %n.rtc"));
    argv.push_back(QString("-o"));
    argv.push_back(QString("logger.enable: NO"));
    for(PropertyMap::iterator it = prop.begin(); it != prop.end(); it++){
        argv.push_back(QString("-o"));
        argv.push_back(QString(string(it->first+":"+it->second).c_str()));
    }
    if(rtcProcess.state() != QProcess::NotRunning){
        rtcProcess.kill();
        rtcProcess.waitForFinished(100);
    }
#ifdef _WIN32
    rtcProcess.start(QString("\"") + command.c_str() + "\"", argv );
#else
    rtcProcess.start(command.c_str(), argv);
#endif
    if(!rtcProcess.waitForStarted()){
        mv->putln(fmt(_("RT Component process \"%1%\" cannot be executed.")) % command);
    } else {
        mv->putln(fmt(_("RT Component process \"%1%\" has been executed.")) % command );
        rtcProcess.sigReadyReadStandardOutput().connect(
            boost::bind(&RTComponent::onReadyReadServerProcessOutput, this));
    }
}
开发者ID:Alexixu,项目名称:choreonoid,代码行数:28,代码来源:RTCItem.cpp

示例4: ParseTag

bool CTagLoaderTagLib::ParseTag(Tag *generic, EmbeddedArt *art, CMusicInfoTag& tag)
{
  if (!generic)
    return false;

  PropertyMap properties = generic->properties();
  for (PropertyMap::ConstIterator it = properties.begin(); it != properties.end(); ++it)
  {
    if (it->first == "ARTIST")
      SetArtist(tag, StringListToVectorString(it->second));
    else if (it->first == "ALBUM")
      tag.SetAlbum(it->second.front().to8Bit(true));
    else if (it->first == "TITLE")
      tag.SetTitle(it->second.front().to8Bit(true));
    else if (it->first == "TRACKNUMBER")
      tag.SetTrackNumber(it->second.front().toInt());
    else if (it->first == "YEAR")
      tag.SetYear(it->second.front().toInt());
    else if (it->first == "GENRE")
      SetGenre(tag, StringListToVectorString(it->second));
    else if (it->first == "COMMENT")
      tag.SetComment(it->second.front().to8Bit(true));
  }

  return true;
}
开发者ID:rmrector,项目名称:xbmc,代码行数:26,代码来源:TagLoaderTagLib.cpp

示例5: setLogDir

void CLoggingUtils::setLogDir(const std::string& logDir) {
	CAF_CM_STATIC_FUNC_LOG_VALIDATE("CLoggingUtils", "setLogDir");
	CAF_CM_VALIDATE_STRING(logDir);

	if (!FileSystemUtils::doesDirectoryExist(logDir)) {
		CAF_CM_LOG_INFO_VA1("Creating log dir - %s", logDir.c_str());
		FileSystemUtils::createDirectory(logDir);
	}

	// Create a temporary file for storing the new config
	std::string tmpFileName = FileSystemUtils::buildPath(logDir, "log4cpp_config_tmp");
	static const std::string SRCH_STR = ".fileName";
	static const size_t SRCH_STR_SIZE = SRCH_STR.length();

	std::ofstream tmpCfg(tmpFileName.c_str(), std::ios_base::out | std::ios_base::trunc);
	PropertyMap src = getInstance()->_properties;
	for (PropertyMap::const_iterator iter = src.begin(); iter != src.end(); iter++) {
		tmpCfg << (*iter).first << "=";
		if (iter->first.rfind(SRCH_STR) == iter->first.length() - SRCH_STR_SIZE) {
			const std::string basename = FileSystemUtils::getBasename(iter->second);
			tmpCfg << FileSystemUtils::buildPath(logDir, basename);
		} else {
			tmpCfg << (*iter).second;
		}
		tmpCfg << std::endl;
	}
	tmpCfg.close();

	loadConfig(tmpFileName);
	FileSystemUtils::removeFile(tmpFileName);
}
开发者ID:bzed,项目名称:pkg-open-vm-tools,代码行数:31,代码来源:CLoggingUtils.cpp

示例6: setProperties

 void PropertyHolder::setProperties(const PropertyMap& propmap)
 {
     for (PropertyMap::const_iterator it = propmap.begin();
         it != propmap.end(); it++)
     {
         setProperty((*it).first.c_str(), (*it).second);
     }
 }
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:8,代码来源:Properties.cpp

示例7: asJson

std::string FileProperties::asJson() const
{
    json::JsonObjectStreamWriter writer;
    PropertyMap properties = asMap();
    for(PropertyMap::iterator it = properties.begin(); it != properties.end(); ++it)
        writer << std::make_pair(it->first.c_str(), it->second.c_str());
    return writer.build();
}
开发者ID:boudewijnrempt,项目名称:avTranscoder,代码行数:8,代码来源:FileProperties.cpp

示例8: updateDisplayedProperties

void PropertiesWidget::updateDisplayedProperties()
{
  tableWidget->clear();
  _propNames.clear();

  tableWidget->setColumnCount(2);

  QStringList horizontalHeaders;
  horizontalHeaders.append("Name");
  horizontalHeaders.append("Value");
  tableWidget->setHorizontalHeaderLabels(horizontalHeaders);

  tableWidget->verticalHeader()->hide();

  PropertyMap* properties = _properties;
  if (! properties)
    return;
  tableWidget->setRowCount(properties->size());

  int r = 0;
  for (PropertyMap::PropertyMapIterator it = properties->begin(); it != properties->end(); ++it, ++r) {

    QTableWidgetItem* textItem = new QTableWidgetItem;
    textItem->setText(QString::fromLocal8Bit(humanReadablePropName(it->first).c_str()));
    textItem->setFlags(textItem->flags() & ~Qt::ItemIsEditable);
    tableWidget->setItem(r, 0, textItem);
    _propNames.push_back(it->first);

    if (dynamic_cast<Property<bool>*>(it->second)) {
      Property<bool>* prop = static_cast<Property<bool>*>(it->second);
      QTableWidgetItem* checkItem = new QTableWidgetItem;
      checkItem->setText("enabled");
      checkItem->setFlags(checkItem->flags() | Qt::ItemIsUserCheckable);
      if (prop->value())
        checkItem->setCheckState(Qt::Checked);
      else
        checkItem->setCheckState(Qt::Unchecked);
      tableWidget->setItem(r, 1, checkItem);
    } else {
      QLineEdit* editor = new QLineEdit(tableWidget);
      editor->setText(QString::fromLocal8Bit(it->second->toString().c_str()));
      if (dynamic_cast<Property<int>*>(it->second)) {
        editor->setValidator(new QIntValidator(editor));
      }
      else if (dynamic_cast<Property<float>*>(it->second)) {
        editor->setValidator(new QDoubleValidator(editor));
      }
      else if (dynamic_cast<Property<double>*>(it->second)) {
        editor->setValidator(new QDoubleValidator(editor));
      }
      tableWidget->setCellWidget(r, 1, editor);
    }

  }
  tableWidget->resizeColumnToContents(0);
}
开发者ID:maxint,项目名称:g2o,代码行数:56,代码来源:properties_widget.cpp

示例9: saveOptions

// =======================
bool saveOptions(const PropertyMap &options, FarSettings &settings)
{
	bool ok = true;
	for (PropertyMap::const_iterator it = options.begin(); it != options.end(); ++it) {
		if (!settings.set(it->first, (String)it->second)) {
			ok = false;
		};
	}

	return ok;
}
开发者ID:starcat13,项目名称:FileCopyEx,代码行数:12,代码来源:FarSettings.cpp

示例10: getStats

PyObject* PlannerInterface::getStats()
{
  if(index < 0 || index >= (int)plans.size() || plans[index]==NULL) 
    throw PyException("Invalid plan index");  
  PropertyMap stats;
  plans[index]->GetStats(stats);
  PyObject* res = PyDict_New();
  for(PropertyMap::const_iterator i=stats.begin();i!=stats.end();i++) {
    PyObject* value = PyString_FromString(i->second.c_str());
    PyDict_SetItemString(res,i->first.c_str(),value);
    Py_XDECREF(value);
  }
  return res;
}
开发者ID:arocchi,项目名称:Klampt,代码行数:14,代码来源:motionplanning.cpp

示例11: splitProperties

void Frame::splitProperties(const PropertyMap &original, PropertyMap &singleFrameProperties,
                            PropertyMap &tiplProperties, PropertyMap &tmclProperties)
{

    singleFrameProperties.clear();
    tiplProperties.clear();
    tmclProperties.clear();
    for(PropertyMap::ConstIterator it = original.begin(); it != original.end(); ++it) {
        if(TextIdentificationFrame::involvedPeopleMap().contains(it->first))
            tiplProperties.insert(it->first, it->second);
        else if(it->first.startsWith(TextIdentificationFrame::instrumentPrefix))
            tmclProperties.insert(it->first, it->second);
        else
            singleFrameProperties.insert(it->first, it->second);
    }
}
开发者ID:kzmi,项目名称:mythtv_isdb,代码行数:16,代码来源:id3v2frame.cpp

示例12: PropertyNameHash

PropertyMap::PropertyMap(const PropertyMap &pm) :

#ifdef PROPERTY_MAP_IS_HASH_MAP

    __HASH_NS::hash_map<PropertyName,
			PropertyStoreBase *,
			PropertyNameHash,
			PropertyNamesEqual>(50, PropertyNameHash())
#else

    std::map<PropertyName, PropertyStoreBase *>()

#endif

{
    for (const_iterator i = pm.begin(); i != pm.end(); ++i) {
	insert(PropertyPair(i->first, i->second->clone()));
    }
}
开发者ID:UIKit0,项目名称:rosegarden,代码行数:19,代码来源:PropertyMap.cpp

示例13: setupModules

void RTComponent::setupModules(string& fileName, string& initFuncName, string& componentName, PropertyMap& prop)
{
    RTC::Manager& rtcManager = RTC::Manager::instance();

    rtcManager.load(fileName.c_str(), initFuncName.c_str());

    string option("?");
    for(PropertyMap::iterator it = prop.begin(); it != prop.end(); ){
        option += it->first + "=" + it->second;
        if(++it != prop.end()){
            option += "&";
        }
    }
    rtc_ = createManagedRTC((componentName + option).c_str());

    if(!rtc_){
        mv->putln(fmt(_("RTC \"%1%\" cannot be created by the RTC manager.\n"
                        " RTC module file: \"%2%\"\n"
                        " Init function: %3%\n"
                        " option: %4%"))
                  % componentName % fileName % initFuncName % option);
    }
}
开发者ID:Alexixu,项目名称:choreonoid,代码行数:23,代码来源:RTCItem.cpp

示例14: setProperty

	void Inventory::setProperty(const CeGuiString& key, const Property& value)
	{
        if (key == Inventory::PROPERTY_SLOTS)
        {
            PropertyArray slotVec = value.toArray();

            for (PropertyArray::const_iterator it = slotVec.begin(); it != slotVec.end(); ++it)
            {
                PropertyMap slotProps = it->toMap();

                CeGuiString name = slotProps["name"].toString();
                int holdItems = Item::ITEMTYPE_ALL_ITEMS;
                if (slotProps.find("holds") != slotProps.end())
                {
                    holdItems = slotProps["holds"].toInt();
                }
                int readyItems = Item::ITEMTYPE_ALL_ITEMS;
                if (slotProps.find("readies") != slotProps.end())
                {
                    readyItems = slotProps["readies"].toInt();
                }

                CeGuiString type = slotProps.find("type")->second.toString();
                if (type == "bone")
                {
                    CeGuiString bone = slotProps["bone"].toString();
                    LOG_MESSAGE("Inventory", "Add bone slot "+ bone);
                    addSlot(name, bone.c_str(), readyItems, holdItems, SLOT_BONE);
                }
                else if (type == "submesh")
                {
                    CeGuiString submesh = slotProps["submesh"].toString();
                    LOG_MESSAGE("Inventory", "Add submesh slot "+ submesh);
                    addSlot(name, submesh.c_str(), readyItems, holdItems, SLOT_SUBMESH);
                }
                else if (type == "material")
                {
                    CeGuiString submesh = slotProps["submesh"].toString();
                    LOG_MESSAGE("Inventory", "Add material slot "+ submesh);
                    addSlot(name, submesh.c_str(), readyItems, holdItems, SLOT_MATERIAL);
                }
                else if (type == "default")
                {
                    LOG_MESSAGE("Inventory", "Add default slot "+ name);
                    addSlot(name, "", readyItems, holdItems, SLOT_DEFAULT);
                }
                else
                {
                    LOG_ERROR(Logger::RULES, 
                        "Unknown slot type '"+type+"' in inventory properties.");
                }
            }
        }
		else if (key == Inventory::PROPERTY_CONTENT)
		{
			PropertyMap bonesContent = value.toMap();
			for (PropertyMap::const_iterator it = bonesContent.begin();
				it != bonesContent.end(); ++it)
			{
				Item* item = dynamic_cast<Item*>(
					GameObjectManager::getSingleton().createGameObjectFromProperty(
						(*it).second));
				if (item)
				{
					LOG_MESSAGE("Inventory", "Add item " + it->second.toString() + " to slot "+ (*it).first);
					hold(item, (*it).first);
				}
			}
		}
	}
开发者ID:BackupTheBerlios,项目名称:dsa-hl-svn,代码行数:70,代码来源:Inventory.cpp

示例15: define_properties

void TypeRegistry::define_properties()
{
    for (TypeMap::iterator j=tfmap_.begin(); j!=tfmap_.end(); ++j)
    {
        for (TypeList::iterator i=j->second.begin(); i!=j->second.end(); ++i)
        {
            typedef std::map<std::string, FunctionList> NameFunctionMap;
            typedef std::map<std::string, NameFunctionMap> FunctionMap;
            typedef std::map<std::size_t, FunctionMap> IndexFunctionMap;

            typedef std::map<std::string, PropertyList> PropertyMap;
            PropertyMap newprops;

            NameFunctionMap count_candidates;
            FunctionMap add_candidates;
            FunctionMap insert_candidates;
            IndexFunctionMap remove_candidates;
            IndexFunctionMap get_candidates;
            IndexFunctionMap set_candidates;

            typedef std::map<std::string, StringSet>    NameTypeMap;
            NameTypeMap nameTypeMap;
            std::size_t max_indices = 0;

            for (FunctionList::const_iterator k=i->methods.begin(); k!=i->methods.end(); ++k)
            {
                if (!k->is_constructor(*i) && !k->is_destructor() && !k->is_static)
                {
                    if (begins_with(k->name, "getOr") && k->name.size() > 5 && std::isupper(k->name[5], std::locale()))
                        continue;

                    if (begins_with(k->name, "getNum") && k->name.size() > 6 && std::isupper(k->name[6], std::locale()))
                    {
                        if (k->params.empty())
                        {
                            std::string name(k->name.substr(6));
                            count_candidates[name].push_back(*k);
                            continue;
                        }
                    }

                    if (begins_with(k->name, "get") && ((k->name.size() > 3 && std::isupper(k->name[3], std::locale())) || (k->name.size() == 3)))
                    {
                        std::string name(k->name.substr(3));
                        std::size_t indices = k->params.size();
                        get_candidates[indices][k->return_type_specifier][name].push_back(*k);
                        if (indices > max_indices) max_indices = indices;
                        nameTypeMap[name].insert(k->return_type_specifier);
                        continue;
                    }

                    if (begins_with(k->name, "set") && k->name.size() > 3 && std::isupper(k->name[3], std::locale()))
                    {
                        if (!k->params.empty())
                        {
                            std::string name(k->name.substr(3));
                            std::size_t indices = k->params.size() - 1;
                            set_candidates[indices][k->params.back().type_specifier][name].push_back(*k);
                            if (indices > max_indices) max_indices = indices;
                            nameTypeMap[name].insert(k->params.back().type_specifier);
                        }
                        continue;
                    }

                    if (begins_with(k->name, "add") && k->name.size() > 3 && std::isupper(k->name[3], std::locale()))
                    {
                        if (k->params.size() == 1)
                        {
                            std::string name(k->name.substr(3));
                            add_candidates[k->params.front().type_specifier][name].push_back(*k);
                            nameTypeMap[name].insert(k->params.front().type_specifier);
                        }
                        continue;
                    }

                    if (begins_with(k->name, "remove") && k->name.size() > 6 && std::isupper(k->name[6], std::locale()))
                    {
                        if (!k->params.empty())
                        {
                            std::string name(k->name.substr(6));
                            std::size_t indices = k->params.size();
                            remove_candidates[indices][k->params.front().type_specifier][name].push_back(*k);
                        }
                        continue;
                    }
                    if (begins_with(k->name, "insert") && k->name.size() > 6 && std::isupper(k->name[6], std::locale()))
                    {
                        if (k->params.size() >= 2)
                        {
                            std::string name(k->name.substr(6));
                            
                            insert_candidates[k->params.front().type_specifier][name].push_back(*k);
                        }
                        continue;
                    }
                }
            }


            for (NameTypeMap::const_iterator k=nameTypeMap.begin(); k!=nameTypeMap.end(); ++k)
//.........这里部分代码省略.........
开发者ID:comicfans44,项目名称:cppintrospection,代码行数:101,代码来源:TypeRegistry.cpp


注:本文中的PropertyMap::begin方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。