本文整理汇总了C++中PropertyMap类的典型用法代码示例。如果您正苦于以下问题:C++ PropertyMap类的具体用法?C++ PropertyMap怎么用?C++ PropertyMap使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了PropertyMap类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: testDictInterface1
void testDictInterface1()
{
ScopedFileCopy copy("empty", ".ogg");
string newname = copy.fileName();
Vorbis::File f(newname.c_str());
CPPUNIT_ASSERT_EQUAL((unsigned int)0, f.tag()->properties().size());
PropertyMap newTags;
StringList values("value 1");
values.append("value 2");
newTags["ARTIST"] = values;
f.tag()->setProperties(newTags);
PropertyMap map = f.tag()->properties();
CPPUNIT_ASSERT_EQUAL((unsigned int)1, map.size());
CPPUNIT_ASSERT_EQUAL((unsigned int)2, map["ARTIST"].size());
CPPUNIT_ASSERT_EQUAL(String("value 1"), map["ARTIST"][0]);
}
示例2: QFETCH
void tst_QDBusXmlParser::properties()
{
QString xmlHeader = "<node>"
"<interface name=\"iface.iface1\">",
xmlFooter = "</interface>"
"</node>";
QFETCH(QString, xmlDataFragment);
QDBusIntrospection::Interface iface =
QDBusIntrospection::parseInterface(xmlHeader + xmlDataFragment + xmlFooter);
QCOMPARE(iface.name, QString("iface.iface1"));
QFETCH(PropertyMap, propertyMap);
PropertyMap parsedMap = iface.properties;
QCOMPARE(propertyMap.count(), parsedMap.count());
QCOMPARE(propertyMap, parsedMap);
}
示例3: _getPort
UT_sint32 TCPAccountHandler::_getPort(const PropertyMap& props)
{
PropertyMap::const_iterator pi = props.find("port");
UT_sint32 port = -1;
if (pi == props.end()) // no port specified, use the default port
{
port = DEFAULT_TCP_PORT;
}
else
{
long portl = strtol(pi->second.c_str(), (char **)NULL, 10);
if (portl == LONG_MIN || portl == LONG_MAX) // TODO: we should check errno here for ERANGE
port = DEFAULT_TCP_PORT;
else
port = (UT_sint32)portl;
}
return port;
}
示例4: initialise
void FileDialog::initialise(const Root* r, const PropertyMap& p) {
Window::initialise(r, p);
if(m_client->getWidgetCount()==0) return; // Nothing
// Cache sub widgets
m_list = getWidget<Listbox>("filelist");
m_file = getWidget<Textbox>("filename");
m_dir = getWidget<Textbox>("path");
m_confirm = getWidget<Button>("confirm");
// Set up callbacks
m_list->eventSelected.bind(this, &FileDialog::selectFile);
m_list->eventMouseDown.bind(this, &FileDialog::clickFile);
m_confirm->eventPressed.bind(this, &FileDialog::pressConfirm);
m_file->eventChanged.bind(this, &FileDialog::changedFileName);
m_file->eventSubmit.bind(this, &FileDialog::submitFileName);
m_dir->eventSubmit.bind(this, &FileDialog::changedDirectory);
Button* btn = getWidget<Button>("up");
if(btn) btn->eventPressed.bind(this, &FileDialog::pressUp);
btn = getWidget<Button>("back");
if(btn) btn->eventPressed.bind(this, &FileDialog::pressBack);
btn = getWidget<Button>("fwd");
if(btn) btn->eventPressed.bind(this, &FileDialog::pressForward);
// Cache icons
m_folderIcon = m_list->getIconList()->getIconIndex("folder");
m_fileIcon = m_list->getIconList()->getIconIndex("file");
// Load properties
const char* initialPath = ".";
if(p.contains("filter")) setFilter( p["filter"] );
if(p.contains("dir")) initialPath = p["dir"];
// Initial directory
char buffer[FILENAME_MAX];
Directory::getFullPath(initialPath, buffer);
setDirectory(buffer);
}
示例5: sizeof
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();
for(PropertyMap::ConstIterator it = origProps.begin(); it != origProps.end(); ++it) {
if(!props.contains(it->first) || props[it->first].isEmpty()) {
d->items.erase(reverseKeyMap[it->first]);
}
}
PropertyMap ignoredProps;
for(PropertyMap::ConstIterator it = props.begin(); it != props.end(); ++it) {
if(reverseKeyMap.contains(it->first)) {
String name = reverseKeyMap[it->first];
if((it->first == "TRACKNUMBER" || it->first == "DISCNUMBER") && !it->second.isEmpty()) {
StringList parts = StringList::split(it->second.front(), "/");
if(!parts.isEmpty()) {
int first = parts[0].toInt();
int second = 0;
if(parts.size() > 1) {
second = parts[1].toInt();
}
d->items[name] = MP4::Item(first, second);
}
}
else if((it->first == "BPM" || it->first == "MOVEMENTNUMBER" || it->first == "MOVEMENTCOUNT") && !it->second.isEmpty()) {
int value = it->second.front().toInt();
d->items[name] = MP4::Item(value);
}
else if((it->first == "COMPILATION" || it->first == "SHOWWORKMOVEMENT") && !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;
}
示例6: makeTMCLProperties
PropertyMap TextIdentificationFrame::makeTMCLProperties() const
{
PropertyMap map;
if(fieldList().size() % 2 != 0){
// according to the ID3 spec, TMCL must contain an even number of entries
map.unsupportedData().append(frameID());
return map;
}
StringList l = fieldList();
for(StringList::ConstIterator it = l.begin(); it != l.end(); ++it) {
String instrument = it->upper();
if(instrument.isEmpty()) {
// instrument is not a valid key -> frame unsupported
map.clear();
map.unsupportedData().append(frameID());
return map;
}
map.insert(L"PERFORMER:" + instrument, (++it)->split(","));
}
return map;
}
示例7: testDictInterface2
void testDictInterface2()
{
ScopedFileCopy copy("test", ".ogg");
string newname = copy.fileName();
Vorbis::File *f = new Vorbis::File(newname.c_str());
PropertyMap tags = f->tag()->properties();
CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), tags["UNUSUALTAG"].size());
CPPUNIT_ASSERT_EQUAL(String("usual value"), tags["UNUSUALTAG"][0]);
CPPUNIT_ASSERT_EQUAL(String("another value"), tags["UNUSUALTAG"][1]);
CPPUNIT_ASSERT_EQUAL(String("öäüoΣø", String::UTF8), tags["UNICODETAG"][0]);
tags["UNICODETAG"][0] = String("νεω ναλυε", String::UTF8);
tags.erase("UNUSUALTAG");
f->tag()->setProperties(tags);
CPPUNIT_ASSERT_EQUAL(String("νεω ναλυε", String::UTF8), f->tag()->properties()["UNICODETAG"][0]);
CPPUNIT_ASSERT_EQUAL(false, f->tag()->properties().contains("UNUSUALTAG"));
delete f;
}
示例8:
void SO3CSpace::Properties(PropertyMap& pmap)
{
pmap.set("cartesian",0);
pmap.set("geodesic",1);
pmap.set("metric","so3");
pmap.set("volume",Pow(Pi,3.0));
pmap.setArray("minimum",vector<double>(3,-Pi));
pmap.setArray("maximum",vector<double>(3,Pi));
pmap.set("diameter",TwoPi);
}
示例9: translateKey
PropertyMap ASF::Tag::properties() const
{
PropertyMap props;
if(!d->title.isEmpty()) {
props["TITLE"] = d->title;
}
if(!d->artist.isEmpty()) {
props["ARTIST"] = d->artist;
}
if(!d->copyright.isEmpty()) {
props["COPYRIGHT"] = d->copyright;
}
if(!d->comment.isEmpty()) {
props["COMMENT"] = d->comment;
}
ASF::AttributeListMap::ConstIterator it = d->attributeListMap.begin();
for(; it != d->attributeListMap.end(); ++it) {
const String key = translateKey(it->first);
if(!key.isEmpty()) {
AttributeList::ConstIterator it2 = it->second.begin();
for(; it2 != it->second.end(); ++it2) {
if(key == "TRACKNUMBER") {
if(it2->type() == ASF::Attribute::DWordType)
props.insert(key, String::number(it2->toUInt()));
else
props.insert(key, it2->toString());
}
else {
props.insert(key, it2->toString());
}
}
}
else {
props.unsupportedData().append(it->first);
}
}
return props;
}
示例10: sizeof
PropertyMap MP4::Tag::properties() const
{
static Map<String, String> keyMap;
if(keyMap.isEmpty()) {
int numKeys = sizeof(keyTranslation) / sizeof(keyTranslation[0]);
for(int i = 0; i < numKeys; i++) {
keyMap[keyTranslation[i][0]] = keyTranslation[i][1];
}
}
PropertyMap props;
MP4::ItemMap::ConstIterator it = d->items.begin();
for(; it != d->items.end(); ++it) {
if(keyMap.contains(it->first)) {
String key = keyMap[it->first];
if(key == "TRACKNUMBER" || key == "DISCNUMBER") {
MP4::Item::IntPair ip = it->second.toIntPair();
String value = String::number(ip.first);
if(ip.second) {
value += "/" + String::number(ip.second);
}
props[key] = value;
}
else if(key == "BPM") {
props[key] = String::number(it->second.toInt());
}
else if(key == "COMPILATION") {
props[key] = String::number(it->second.toBool());
}
else {
props[key] = it->second.toStringList();
}
}
else {
props.unsupportedData().append(it->first);
}
}
return props;
}
示例11: testDictInterface1
void testDictInterface1()
{
ScopedFileCopy copy("empty", ".ogg");
string newname = copy.fileName();
Vorbis::File *f = new Vorbis::File(newname.c_str());
CPPUNIT_ASSERT_EQUAL(TagLib::uint(0), f->tag()->properties().size());
PropertyMap newTags;
StringList values("value 1");
values.append("value 2");
newTags["ARTIST"] = values;
f->tag()->setProperties(newTags);
PropertyMap map = f->tag()->properties();
CPPUNIT_ASSERT_EQUAL(TagLib::uint(1), map.size());
CPPUNIT_ASSERT_EQUAL(TagLib::uint(2), map["ARTIST"].size());
CPPUNIT_ASSERT_EQUAL(String("value 1"), map["ARTIST"][0]);
delete f;
}
示例12: main
int main ()
{
printf ("Results of transaction_test:\n");
try
{
Transaction transaction;
printf ("default transaction\n");
dump (transaction);
transaction.SetState (TransactionState_Purchased);
transaction.SetStatus ("Success");
transaction.SetProductId ("ProductId");
transaction.SetQuantity (4);
transaction.SetReceipt (xtl::xstrlen (RECEIPT), RECEIPT);
transaction.SetHandle ((const void*)1);
PropertyMap properties;
properties.SetProperty ("String", "StringValue");
properties.SetProperty ("IntValue", 10);
transaction.SetProperties (properties);
printf ("filled transaction\n");
dump (transaction);
transaction.Finish ();
}
catch (std::exception& exception)
{
printf ("exception: %s\n", exception.what ());
}
return 0;
}
示例13: GetStats
virtual void GetStats(PropertyMap& stats) const {
MotionPlannerInterface::GetStats(stats);
stats.set("configCheckTime",planner.tCheck);
stats.set("knnTime",planner.tKnn);
stats.set("connectTime",planner.tConnect);
if(planner.lazy)
stats.set("lazyPathCheckTime",planner.tLazy);
stats.set("shortestPathsTime",planner.tShortestPaths);
stats.set("numEdgeChecks",planner.numEdgeChecks);
if(planner.lazy)
stats.set("numEdgesPrechecked",planner.numEdgePrechecks);
}
示例14: 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);
}
}
示例15: testMisc
void testMisc() {
PropertyMap *map;
// test remove() doesn't crash with empty list
map = new PropertyMap();
map->remove("nonexistant");
delete map;
printf("PASS: remove() doesn't crash with empty list\n");
// test get() doesn't crash with empty list
map = new PropertyMap();
map->get("nonexistant");
delete map;
printf("PASS: get() doesn't crash with empty list\n");
// test get() returns 0 on an empty list
map = new PropertyMap();
if (map->get("nonexistant") == 0)
printf("PASS: get() returns 0 on an empty list\n");
else
printf("FAIL: get() returns 0 on an empty list\n");
delete map;
}