本文整理汇总了C++中qpid::types::variant::Map::begin方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::begin方法的具体用法?C++ Map::begin怎么用?C++ Map::begin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类qpid::types::variant::Map
的用法示例。
在下文中一共展示了Map::begin方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: variantMapToJSONString
std::string agocontrol::variantMapToJSONString(qpid::types::Variant::Map map) {
string result;
result += "{";
for (Variant::Map::const_iterator it = map.begin(); it != map.end(); ++it) {
result += "\""+ it->first + "\":";
std::string tmpstring;
switch (it->second.getType()) {
case VAR_MAP:
result += variantMapToJSONString(it->second.asMap());
break;
case VAR_LIST:
result += variantListToJSONString(it->second.asList());
break;
case VAR_STRING:
tmpstring = it->second.asString();
replaceString(tmpstring, "\"", "\\\"");
result += "\"" + tmpstring + "\"";
break;
default:
if (it->second.asString().size() != 0) {
result += it->second.asString();
} else {
result += "null";
}
}
if ((it != map.end()) && (next(it) != map.end())) result += ",";
}
result += "}";
return result;
}
示例2: getEncodedSizeForElements
size_t MessageEncoder::getEncodedSizeForElements(const qpid::types::Variant::Map& map)
{
size_t total = 0;
for (qpid::types::Variant::Map::const_iterator i = map.begin(); i != map.end(); ++i) {
total += 1/*code*/ + encodedSize(i->first) + getEncodedSizeForValue(i->second);
}
return total;
}
示例3: getEncodedSizeForElements
size_t MessageEncoder::getEncodedSizeForElements(const qpid::types::Variant::Map& map)
{
size_t total = 0;
for (qpid::types::Variant::Map::const_iterator i = map.begin(); i != map.end(); ++i) {
total += 1/*code*/ + encodedSize(i->first);
switch (i->second.getType()) {
case qpid::types::VAR_MAP:
case qpid::types::VAR_LIST:
case qpid::types::VAR_VOID:
case qpid::types::VAR_BOOL:
total += 1;
break;
case qpid::types::VAR_UINT8:
case qpid::types::VAR_INT8:
total += 2;
break;
case qpid::types::VAR_UINT16:
case qpid::types::VAR_INT16:
total += 3;
break;
case qpid::types::VAR_UINT32:
case qpid::types::VAR_INT32:
case qpid::types::VAR_FLOAT:
total += 5;
break;
case qpid::types::VAR_UINT64:
case qpid::types::VAR_INT64:
case qpid::types::VAR_DOUBLE:
total += 9;
break;
case qpid::types::VAR_UUID:
total += 17;
break;
case qpid::types::VAR_STRING:
total += 1/*code*/ + encodedSize(i->second);
break;
}
}
return total;
}
示例4: writeMap
void MessageEncoder::writeMap(const qpid::types::Variant::Map& properties, const Descriptor* d, bool large)
{
void* token = large ? startMap32(d) : startMap8(d);
for (qpid::types::Variant::Map::const_iterator i = properties.begin(); i != properties.end(); ++i) {
writeString(i->first);
switch (i->second.getType()) {
case qpid::types::VAR_MAP:
case qpid::types::VAR_LIST:
//not allowed (TODO: revise, only strictly true for application-properties) whereas this is now a more general method)
QPID_LOG(warning, "Ignoring nested map/list; not allowed in application-properties for AMQP 1.0");
case qpid::types::VAR_VOID:
writeNull();
break;
case qpid::types::VAR_BOOL:
writeBoolean(i->second);
break;
case qpid::types::VAR_UINT8:
writeUByte(i->second);
break;
case qpid::types::VAR_UINT16:
writeUShort(i->second);
break;
case qpid::types::VAR_UINT32:
writeUInt(i->second);
break;
case qpid::types::VAR_UINT64:
writeULong(i->second);
break;
case qpid::types::VAR_INT8:
writeByte(i->second);
break;
case qpid::types::VAR_INT16:
writeShort(i->second);
break;
case qpid::types::VAR_INT32:
writeInt(i->second);
break;
case qpid::types::VAR_INT64:
writeULong(i->second);
break;
case qpid::types::VAR_FLOAT:
writeFloat(i->second);
break;
case qpid::types::VAR_DOUBLE:
writeDouble(i->second);
break;
case qpid::types::VAR_STRING:
if (i->second.getEncoding() == BINARY) {
writeBinary(i->second);
} else {
writeString(i->second);
}
break;
case qpid::types::VAR_UUID:
writeUuid(i->second);
break;
}
}
if (large) endMap32(properties.size()*2, token);
else endMap8(properties.size()*2, token);
}