本文整理汇总了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;
}
示例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;
}
示例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));
}
}
示例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;
}
示例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);
}
示例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);
}
}
示例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();
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
示例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()));
}
}
示例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);
}
}
示例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);
}
}
}
}
示例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)
//.........这里部分代码省略.........