MongoDB  2.7.0
Public Member Functions | Friends | List of all members
mongo::mutablebson::ConstElement Class Reference

For an overview of mutable BSON, please see the file document.h in this directory. More...

#include <const_element.h>

Public Member Functions

 ConstElement (const Element &basis)
ConstElement leftChild () const
ConstElement rightChild () const
bool hasChildren () const
ConstElement leftSibling (size_t distance=1) const
ConstElement rightSibling (size_t distance=1) const
ConstElement parent () const
ConstElement findNthChild (size_t n) const
ConstElement operator[] (size_t n) const
ConstElement findFirstChildNamed (const StringData &name) const
ConstElement operator[] (const StringData &n) const
ConstElement findElementNamed (const StringData &name) const
size_t countSiblingsLeft () const
size_t countSiblingsRight () const
size_t countChildren () const
bool hasValue () const
const BSONElement getValue () const
double getValueDouble () const
StringData getValueString () const
BSONObj getValueObject () const
BSONArray getValueArray () const
bool isValueUndefined () const
OID getValueOID () const
bool getValueBool () const
Date_t getValueDate () const
bool isValueNull () const
StringData getValueSymbol () const
int32_t getValueInt () const
OpTime getValueTimestamp () const
int64_t getValueLong () const
bool isValueMinKey () const
bool isValueMaxKey () const
SafeNum getValueSafeNum () const
int compareWithElement (const ConstElement &other, bool considerFieldName=true) const
int compareWithBSONElement (const BSONElement &other, bool considerFieldName=true) const
int compareWithBSONObj (const BSONObj &other, bool considerFieldName=true) const
void writeTo (BSONObjBuilder *builder) const
void writeArrayTo (BSONArrayBuilder *builder) const
bool ok () const
const DocumentgetDocument () const
BSONType getType () const
bool isType (BSONType type) const
StringData getFieldName () const
Element::RepIdx getIdx () const
std::string toString () const


class Document
bool operator== (const ConstElement &, const ConstElement &)
 See notes for operator==(const Element&, const Element&). More...

Detailed Description

For an overview of mutable BSON, please see the file document.h in this directory.

ConstElement recapitulates all of the const methods of Element, but cannot be converted to an Element. This makes it safe to return as a value from a constant Document, since none of Element's non-const methods may be called on ConstElement or any values it yields. If you think of Element like an STL 'iterator', then ConstElement is a 'const_iterator'.

For details on the API methods of ConstElement, please see the method comments for the analagous Element methods in the file element.h (in this same directory).

All calls on ConstElement are simply forwarded to the underlying Element.

Friends And Related Function Documentation

bool operator== ( const ConstElement ,
const ConstElement  

See notes for operator==(const Element&, const Element&).

The multiple variants listed here enable cross type comparisons between Elements and ConstElements.

The documentation for this class was generated from the following files: