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


C++ DocumentStorageIterator::nameSD方法代码示例

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


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

示例1: hash_combine

 void Document::hash_combine(size_t &seed) const {
     for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
         StringData name = it->nameSD();
         boost::hash_range(seed, name.rawData(), name.rawData() + name.size());
         it->val.hash_combine(seed);
     }
 }
开发者ID:3rf,项目名称:mongo,代码行数:7,代码来源:document.cpp

示例2: findField

    Position DocumentStorage::findField(StringData requested) const {
        if (_numFields >= HASH_TAB_MIN) { // hash lookup
            const unsigned bucket = bucketForKey(requested);

            Position pos = _hashTab[bucket];
            while (pos.found()) {
                const ValueElement& elem = getField(pos);
                if (requested == elem.nameSD())
                    return pos;

                // possible collision
                pos = elem.nextCollision;
            }
        }
        else if (_numFields) { // linear scan
            for (DocumentStorageIterator it = iteratorAll(); !it.atEnd(); it.advance()) {
                if (size_t(it->nameLen) == requested.size()
                    && requested == it->nameSD()) {
                    return it.position();
                }
            }
        }

        // if we got here, there's no such field
        return Position();
    }
开发者ID:imageoptimiser,项目名称:mongo,代码行数:26,代码来源:document.cpp

示例3: serializeForSorter

    void Document::serializeForSorter(BufBuilder& buf) const {
        const int numElems = size();
        buf.appendNum(numElems);

        for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
            buf.appendStr(it->nameSD(), /*NUL byte*/ true);
            it->val.serializeForSorter(buf);
        }
    }
开发者ID:acruikshank,项目名称:mongo,代码行数:9,代码来源:document.cpp

示例4: toBson

void Document::toBson(BSONObjBuilder* builder, size_t recursionLevel) const {
    uassert(ErrorCodes::Overflow,
            str::stream() << "cannot convert document to BSON because it exceeds the limit of "
                          << BSONDepth::getMaxAllowableDepth()
                          << " levels of nesting",
            recursionLevel <= BSONDepth::getMaxAllowableDepth());

    for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
        it->val.addToBsonObj(builder, it->nameSD(), recursionLevel);
    }
}
开发者ID:i80and,项目名称:mongo,代码行数:11,代码来源:document.cpp

示例5: toString

    string Document::toString() const {
        if (empty())
            return "{}";

        StringBuilder out;
        const char* prefix = "{";

        for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
            out << prefix << it->nameSD() << ": " << it->val.toString();
            prefix = ", ";
        }
        out << '}';

        return out.str();
    }
开发者ID:3rf,项目名称:mongo,代码行数:15,代码来源:document.cpp

示例6: serializeForSorter

void Document::serializeForSorter(BufBuilder& buf) const {
    const int numElems = size();
    buf.appendNum(numElems);

    for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
        buf.appendStr(it->nameSD(), /*NUL byte*/ true);
        it->val.serializeForSorter(buf);
    }

    if (hasTextScore()) {
        buf.appendNum(char(DocumentStorage::MetaType::TEXT_SCORE + 1));
        buf.appendNum(getTextScore());
    }
    if (hasRandMetaField()) {
        buf.appendNum(char(DocumentStorage::MetaType::RAND_VAL + 1));
        buf.appendNum(getRandMetaField());
    }
    buf.appendNum(char(0));
}
开发者ID:CeperaCPP,项目名称:mongo,代码行数:19,代码来源:document.cpp

示例7: toBson

 void Document::toBson(BSONObjBuilder* pBuilder) const {
     for (DocumentStorageIterator it = storage().iterator(); !it.atEnd(); it.advance()) {
         *pBuilder << it->nameSD() << it->val;
     }
 }
开发者ID:3rf,项目名称:mongo,代码行数:5,代码来源:document.cpp


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