20#include <boost/preprocessor/cat.hpp>
22#include "mongo/bson/bsonobj.h"
23#include "mongo/base/disallow_copying.h"
43 if (MONGO_unlikely(sz == 0)) {
48 _theend = jso.
objdata() + sz - 1;
58 return _pos < _theend;
64 return _pos <= _theend;
70 verify(_pos <= _theend);
74 maxLen = _theend + 1 - _pos;
79 int esize = e.
size(maxLen);
80 massert(16446,
"BSONElement has bad size", esize > 0);
86 verify(_pos <= _theend);
94 void operator++(
int) {
98 BSONElement operator*() {
99 verify(_pos <= _theend);
100 return BSONElement(_pos);
120 return _cur < _nfields;
131 class ElementFieldCmp;
135 const char** _fields;
174#define BSONForEach(e, obj) \
175 ::mongo::BSONObjIterator BOOST_PP_CAT(it_, __LINE__)(obj); \
176 for (::mongo::BSONElement e; \
177 (BOOST_PP_CAT(it_, __LINE__).more() ? (e = BOOST_PP_CAT(it_, __LINE__).next(), true) \
Provides iteration of a BSONArray's BSONElements in numeric field order.
Definition bsonobjiterator.h:151
BSONElement represents an "element" in a BSONObj.
Definition bsonelement.h:55
int size(int maxLen) const
Size of the element.
Base class implementing ordered iteration through BSONElements.
Definition bsonobjiterator.h:109
Provides iteration of a BSONObj's BSONElements in lexical field order.
Definition bsonobjiterator.h:141
iterator for a BSONObj
Definition bsonobjiterator.h:37
bool moreWithEOO()
Definition bsonobjiterator.h:63
BSONObjIterator(const BSONObj &jso)
Create an iterator for a BSON object.
Definition bsonobjiterator.h:41
BSONElement next(bool checkEnd)
Definition bsonobjiterator.h:69
bool more()
Definition bsonobjiterator.h:57
C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary representa...
Definition bsonobj.h:78
int objsize() const
Definition bsonobj.h:308
const char * objdata() const
Definition bsonobj.h:303
the main MongoDB namespace
Definition bulk_operation_builder.h:24