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;
57 bool more() {
return _pos < _theend; }
64 verify( _pos <= _theend );
68 maxLen = _theend + 1 - _pos;
73 int esize = e.
size( maxLen );
74 massert( 16446,
"BSONElement has bad size", esize > 0 );
80 verify( _pos <= _theend );
85 void operator++() { next(); }
86 void operator++(
int) {
next(); }
88 BSONElement operator*() {
89 verify( _pos <= _theend );
90 return BSONElement(_pos);
109 return _cur < _nfields;
114 if ( _cur < _nfields )
120 class ElementFieldCmp;
124 const char ** _fields;
163 #define BSONForEach(e, obj) \
164 ::mongo::BSONObjIterator BOOST_PP_CAT(it_,__LINE__)(obj); \
165 for ( ::mongo::BSONElement e; \
166 (BOOST_PP_CAT(it_,__LINE__).more() ? \
167 (e = BOOST_PP_CAT(it_,__LINE__).next(), true) : \
int objsize() const
Definition: bsonobj.h:304
the main MongoDB namespace
Definition: bulk_operation_builder.h:24
int size(int maxLen) const
Size of the element.
BSONElement next(bool checkEnd)
Definition: bsonobjiterator.h:63
const char * objdata() const
Definition: bsonobj.h:299
BSONObjIterator(const BSONObj &jso)
Create an iterator for a BSON object.
Definition: bsonobjiterator.h:41
bool moreWithEOO()
Definition: bsonobjiterator.h:60
bool more()
Definition: bsonobjiterator.h:57
iterator for a BSONObj
Definition: bsonobjiterator.h:37
BSONElement represents an "element" in a BSONObj.
Definition: bsonelement.h:55
Definition: bsonobj.h:559
Provides iteration of a BSONObj's BSONElements in lexical field order.
Definition: bsonobjiterator.h:130
C++ representation of a "BSON" object – that is, an extended JSON-style object in a binary represent...
Definition: bsonobj.h:78
Base class implementing ordered iteration through BSONElements.
Definition: bsonobjiterator.h:99
Provides iteration of a BSONArray's BSONElements in numeric field order.
Definition: bsonobjiterator.h:140