本文整理汇总了C++中PropertyMap::end方法的典型用法代码示例。如果您正苦于以下问题:C++ PropertyMap::end方法的具体用法?C++ PropertyMap::end怎么用?C++ PropertyMap::end使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类PropertyMap
的用法示例。
在下文中一共展示了PropertyMap::end方法的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: 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));
}
}
示例3:
PropertyMap *
Event::find(const PropertyName &name, PropertyMap::iterator &i)
{
PropertyMap *map = m_data->m_properties;
if (!map || ((i = map->find(name)) == map->end())) {
map = m_nonPersistentProperties;
if (!map) return 0;
i = map->find(name);
if (i == map->end()) return 0;
}
return map;
}
示例4: 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);
}
示例5: 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;
}
示例6: 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;
}
示例7: 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);
}
}
示例8: 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();
}
示例9: get
const std::shared_ptr<ValueImpl>& get(const std::string& propertyName) const override
{
auto val = properties.find(propertyName);
if (val == properties.end())
{
D6_THROW(JsonException, std::string("Property ") + propertyName + " not found");
}
return val->second;
}
示例10: 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);
}
示例11: minimum_spanning_tree_prim
edge_list minimum_spanning_tree_prim(const Graph & g, const PropertyMap & p, vertex start)
{
using Value = typename PropertyMap::mapped_type;
return detail::minimum_spanning_tree_prim<Value>(g, start, [&p](edge e) -> Value {
auto const i = p.find(e);
if (i != p.end())
return i->second;
return {};
});
}
示例12: testInsertAndExtract
void testInsertAndExtract()
{
ScopedFileCopy copy("matroska", ".mka");
string filename = copy.fileName();
{
EBML::Matroska::File f1(filename.c_str());
CPPUNIT_ASSERT(f1.isValid());
Tag* t = f1.tag();
CPPUNIT_ASSERT(t != 0);
t->setTitle("Seconds of Silence");
t->setArtist("Nobody");
t->setAlbum("TagLib Test Suite");
t->setComment("Well, there's nothing to say - a few special signs: ©’…ä–€ſ");
t->setGenre("Air");
t->setYear(2013);
t->setTrack(15);
CPPUNIT_ASSERT(f1.save());
}
{
EBML::Matroska::File f2(filename.c_str());
CPPUNIT_ASSERT(f2.isValid());
Tag* t = f2.tag();
CPPUNIT_ASSERT(t != 0);
CPPUNIT_ASSERT_EQUAL(String("Seconds of Silence"), t->title());
CPPUNIT_ASSERT_EQUAL(String("Nobody"), t->artist());
CPPUNIT_ASSERT_EQUAL(String("TagLib Test Suite"), t->album());
CPPUNIT_ASSERT_EQUAL(String("Well, there's nothing to say - a few special signs: ©’…ä–€ſ"), t->comment());
CPPUNIT_ASSERT_EQUAL(String("Air"), t->genre());
CPPUNIT_ASSERT_EQUAL(2013u, t->year());
CPPUNIT_ASSERT_EQUAL(15u, t->track());
PropertyMap pm = f2.properties();
pm.erase("COMMENT");
f2.setProperties(pm);
CPPUNIT_ASSERT(f2.save());
}
{
EBML::Matroska::File f3(filename.c_str());
CPPUNIT_ASSERT(f3.isValid());
PropertyMap pm = f3.properties();
PropertyMap::Iterator i = pm.find("GENRE");
CPPUNIT_ASSERT(i != pm.end());
CPPUNIT_ASSERT_EQUAL(String("Air"), i->second.front());
}
}
示例13: 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;
}
示例14: constructBuddy
BuddyPtr XMPPAccountHandler::constructBuddy(const PropertyMap& vProps)
{
PropertyMap::const_iterator pos = vProps.find("name");
if (pos != vProps.end())
{
UT_return_val_if_fail(pos->second.size() > 0, XMPPBuddyPtr());
UT_DEBUGMSG(("Constructing buddy (%s)\n", pos->second.c_str()));
return XMPPBuddyPtr(new XMPPBuddy(this, pos->second.c_str()));
}
UT_ASSERT_HARMLESS(UT_NOT_REACHED);
return XMPPBuddyPtr();
}
示例15: testPredefined
void testPredefined()
{
ScopedFileCopy copy("matroska", ".mka");
string filename = copy.fileName();
EBML::Matroska::File f(filename.c_str());
CPPUNIT_ASSERT(f.isValid());
PropertyMap pm = f.properties();
PropertyMap::Iterator i = pm.find("ENCODER");
CPPUNIT_ASSERT(i != pm.end());
CPPUNIT_ASSERT_EQUAL(String("Lavf54.63.104"), i->second.front());
}