当前位置: 首页>>代码示例>>C++>>正文


C++ Map::size方法代码示例

本文整理汇总了C++中qpid::types::variant::Map::size方法的典型用法代码示例。如果您正苦于以下问题:C++ Map::size方法的具体用法?C++ Map::size怎么用?C++ Map::size使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在qpid::types::variant::Map的用法示例。


在下文中一共展示了Map::size方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: getEncodedSize

size_t MessageEncoder::getEncodedSize(const qpid::types::Variant::Map& map, bool alwaysUseLargeMap)
{
    size_t total = getEncodedSizeForElements(map);

    //its not just the count that determines whether we can use a small map, but the aggregate size:
    if (alwaysUseLargeMap || map.size()*2 > 255 || total > 255) total +=  4/*size*/ + 4/*count*/;
    else total += 1/*size*/ + 1/*count*/;

    total += 1 /*code for map itself*/;

    return total;
}
开发者ID:bbcarchdev,项目名称:qpid-cpp,代码行数:12,代码来源:MessageEncoder.cpp

示例2: writeApplicationProperties

void MessageEncoder::writeApplicationProperties(const qpid::types::Variant::Map& properties)
{
    writeApplicationProperties(properties, !optimise || properties.size()*2 > 255 || getEncodedSizeForElements(properties) > 255);
}
开发者ID:bbcarchdev,项目名称:qpid-cpp,代码行数:4,代码来源:MessageEncoder.cpp

示例3: 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);
}
开发者ID:ncdc,项目名称:qpid,代码行数:61,代码来源:MessageEncoder.cpp


注:本文中的qpid::types::variant::Map::size方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。