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; }
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; }
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)); } }
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; }
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); }
void PropertyHolder::setProperties(const PropertyMap& propmap) { for (PropertyMap::const_iterator it = propmap.begin(); it != propmap.end(); it++) { setProperty((*it).first.c_str(), (*it).second); } }
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(); }
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); }
// ======================= 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; }
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; }
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); } }
PropertyMap ID3v2::Tag::setProperties(const PropertyMap &origProps) { FrameList framesToDelete; // we split up the PropertyMap into the "normal" keys and the "complicated" ones, // which are those according to TIPL or TMCL frames. PropertyMap properties; PropertyMap tiplProperties; PropertyMap tmclProperties; Frame::splitProperties(origProps, properties, tiplProperties, tmclProperties); for(FrameListMap::ConstIterator it = frameListMap().begin(); it != frameListMap().end(); ++it){ for(FrameList::ConstIterator lit = it->second.begin(); lit != it->second.end(); ++lit){ PropertyMap frameProperties = (*lit)->asProperties(); if(it->first == "TIPL") { if (tiplProperties != frameProperties) framesToDelete.append(*lit); else tiplProperties.erase(frameProperties); } else if(it->first == "TMCL") { if (tmclProperties != frameProperties) framesToDelete.append(*lit); else tmclProperties.erase(frameProperties); } else if(!properties.contains(frameProperties)) framesToDelete.append(*lit); else properties.erase(frameProperties); } } for(FrameList::ConstIterator it = framesToDelete.begin(); it != framesToDelete.end(); ++it) removeFrame(*it); // now create remaining frames: // start with the involved people list (TIPL) if(!tiplProperties.isEmpty()) addFrame(TextIdentificationFrame::createTIPLFrame(tiplProperties)); // proceed with the musician credit list (TMCL) if(!tmclProperties.isEmpty()) addFrame(TextIdentificationFrame::createTMCLFrame(tmclProperties)); // now create the "one key per frame" frames for(PropertyMap::ConstIterator it = properties.begin(); it != properties.end(); ++it) addFrame(Frame::createTextualFrame(it->first, it->second)); return PropertyMap(); // ID3 implements the complete PropertyMap interface, so an empty map is returned }
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())); } }
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); } }
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); } } } }
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) { StringSet::const_iterator endIt = k->second.end(); for (StringSet::const_iterator h=k->second.begin(); h!=endIt; ++h) { PropertyDesc pd; pd.name = k->first; pd.type_name = *h; // simple property { const FunctionList &fl_get = get_candidates[0][*h][k->first]; FunctionList fl_set; fl_set.insert(fl_set.end(), set_candidates[0][*h][k->first].begin(), set_candidates[0][*h][k->first].end()); fl_set.insert(fl_set.end(), set_candidates[0]["const " + *h + " &"][k->first].begin(), set_candidates[0]["const " + *h + " &"][k->first].end()); if (!fl_get.empty()) pd.get_method = fl_get.front().name_signature; if (!fl_set.empty()) pd.set_method = fl_set.front().name_signature; if (!pd.get_method.empty() || !pd.set_method.empty()) { pd.type = PropertyDesc::SIMPLE; newprops[pd.name].push_back(pd); continue; } } // array property { FunctionList fl_count; fl_count.insert(fl_count.end(), count_candidates[k->first].begin(), count_candidates[k->first].end()); fl_count.insert(fl_count.end(), count_candidates[k->first + "s"].begin(), count_candidates[k->first + "s"].end()); fl_count.insert(fl_count.end(), count_candidates[k->first + "es"].begin(), count_candidates[k->first + "es"].end()); fl_count.insert(fl_count.end(), count_candidates[k->first + "ren"].begin(), count_candidates[k->first + "ren"].end()); if (fl_count.size()) { std::string& return_type_specifier = fl_count.front().return_type_specifier; const FunctionList &fl_get = get_candidates[1][*h][k->first]; FunctionList fl_set; fl_set.insert(fl_set.end(), set_candidates[1][*h][k->first].begin(), set_candidates[1][*h][k->first].end()); fl_set.insert(fl_set.end(), set_candidates[1]["const " + *h + " &"][k->first].begin(), set_candidates[1]["const " + *h + " &"][k->first].end()); const FunctionList &fl_add = add_candidates[*h][k->first]; FunctionList fl_remove; fl_remove.insert(fl_remove.end(), remove_candidates[1][return_type_specifier][k->first].begin(), remove_candidates[1][return_type_specifier][k->first].end()); fl_remove.insert(fl_remove.end(), remove_candidates[1][return_type_specifier][k->first + "s"].begin(), remove_candidates[1][return_type_specifier][k->first + "s"].end()); fl_remove.insert(fl_remove.end(), remove_candidates[1][return_type_specifier][k->first + "es"].begin(), remove_candidates[1][return_type_specifier][k->first + "es"].end()); fl_remove.insert(fl_remove.end(), remove_candidates[1][return_type_specifier][k->first + "ren"].begin(), remove_candidates[1][return_type_specifier][k->first + "ren"].end()); fl_remove.insert(fl_remove.end(), remove_candidates[2][return_type_specifier][k->first].begin(), remove_candidates[2][return_type_specifier][k->first].end()); fl_remove.insert(fl_remove.end(), remove_candidates[2][return_type_specifier][k->first + "s"].begin(), remove_candidates[2][return_type_specifier][k->first + "s"].end()); fl_remove.insert(fl_remove.end(), remove_candidates[2][return_type_specifier][k->first + "es"].begin(), remove_candidates[2][return_type_specifier][k->first + "es"].end()); fl_remove.insert(fl_remove.end(), remove_candidates[2][return_type_specifier][k->first + "ren"].begin(), remove_candidates[2][return_type_specifier][k->first + "ren"].end()); FunctionList fl_insert = insert_candidates[return_type_specifier][k->first]; fl_insert.erase(std::remove_if(fl_insert.begin(), fl_insert.end(), PropertyFunctionFirstParameterNameFilter<2>(fl_count.front().return_type_specifier)), fl_insert.end()); fl_remove.erase(std::remove_if(fl_remove.begin(), fl_remove.end(), PropertyFunctionFirstParameterNameFilter<1>(fl_count.front().return_type_specifier)), fl_remove.end()); if (!fl_get.empty()) pd.get_method = fl_get.front().name_signature; if (!fl_set.empty()) pd.set_method = fl_set.front().name_signature; if (!fl_add.empty()) pd.add_method = fl_add.front().name_signature; if (!fl_insert.empty()) pd.insert_method = fl_insert.front().name_signature; if (!fl_remove.empty()) pd.remove_method = fl_remove.front().name_signature; if (!fl_count.empty()) pd.count_method = fl_count.front().name_signature; if (!pd.get_method.empty() || !pd.set_method.empty()) { pd.type = PropertyDesc::ARRAY; newprops[pd.name].push_back(pd); continue; } } } // indexed property for (std::size_t u=1; u<=max_indices; ++u) { const FunctionList &fl_get = get_candidates[u][*h][k->first]; FunctionList fl_set; fl_set.insert(fl_set.end(), set_candidates[u][*h][k->first].begin(), set_candidates[u][*h][k->first].end()); fl_set.insert(fl_set.end(), set_candidates[u]["const " + *h + " &"][k->first].begin(), set_candidates[u]["const " + *h + " &"][k->first].end()); if (!fl_get.empty()) pd.get_method = fl_get.front().name_signature; if (!fl_set.empty()) pd.set_method = fl_set.front().name_signature; for (FunctionList::const_iterator x=fl_get.begin(); x!=fl_get.end(); ++x) { ParameterList get_indices(x->params.begin(), x->params.end()); for (FunctionList::const_iterator y=fl_set.begin(); y!=fl_set.end(); ++y) { ParameterList set_indices(y->params.begin(), y->params.end()); set_indices.pop_back(); if (same_parameters(get_indices, set_indices)) { pd.type = PropertyDesc::INDEXED; pd.get_method = x->name_signature; pd.set_method = y->name_signature; newprops[pd.name].push_back(pd); break; } } } } } } for (PropertyMap::iterator k=newprops.begin(); k!=newprops.end(); ++k) { if (!k->second.empty()) { std::sort(k->second.begin(), k->second.end(), PropertySorter()); PropertyDesc & pd = k->second.front(); const PropertyOptions *opt = cfg_.getPropertyOptions(i->type_name, pd.name); if (opt) { if (!opt->get_method.empty()) pd.get_method = opt->get_method; if (!opt->set_method.empty()) pd.set_method = opt->set_method; if (!opt->remove_method.empty()) pd.remove_method = opt->remove_method; if (!opt->add_method.empty()) pd.add_method = opt->add_method; if (!opt->insert_method.empty()) pd.insert_method = opt->insert_method; if (!opt->count_method.empty()) { Notify::info("define count method of property `" + pd.name + "' in type `" + i->type_name + "' on user request"); pd.type = PropertyDesc::ARRAY; pd.count_method = opt->count_method; } } i->properties.push_back(k->second.front()); } } } } }
PropertyMap ASF::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()) { if(it->first == "TITLE") { d->title = String::null; } else if(it->first == "ARTIST") { d->artist = String::null; } else if(it->first == "COMMENT") { d->comment = String::null; } else if(it->first == "COPYRIGHT") { d->copyright = String::null; } else { d->attributeListMap.erase(reverseKeyMap[it->first]); } } } PropertyMap ignoredProps; it = props.begin(); for(; it != props.end(); ++it) { if(reverseKeyMap.contains(it->first)) { String name = reverseKeyMap[it->first]; removeItem(name); StringList::ConstIterator it2 = it->second.begin(); for(; it2 != it->second.end(); ++it2) { addAttribute(name, *it2); } } else if(it->first == "TITLE") { d->title = it->second.toString(); } else if(it->first == "ARTIST") { d->artist = it->second.toString(); } else if(it->first == "COMMENT") { d->comment = it->second.toString(); } else if(it->first == "COPYRIGHT") { d->copyright = it->second.toString(); } else { ignoredProps.insert(it->first, it->second); } } return ignoredProps; }