0
0
mirror of https://github.com/mongodb/mongo.git synced 2024-12-01 01:21:03 +01:00

StringBuilder support for BSONObj/BSONElement

This commit is contained in:
Eliot Horowitz 2010-11-28 03:40:02 -05:00
parent 108401044c
commit a8115022f0
2 changed files with 15 additions and 0 deletions

View File

@ -614,6 +614,16 @@ namespace mongo {
return s << e.toString();
}
inline StringBuilder& operator<<( StringBuilder &s, const BSONObj &o ) {
o.toString( s );
return s;
}
inline StringBuilder& operator<<( StringBuilder &s, const BSONElement &e ) {
e.toString( s );
return s;
}
inline void BSONElement::Val(BSONObj& v) const { v = Obj(); }
template<typename T>

View File

@ -373,9 +373,14 @@ private:
_assertInvalid();
}
};
ostream& operator<<( ostream &s, const BSONObj &o );
ostream& operator<<( ostream &s, const BSONElement &e );
StringBuilder& operator<<( StringBuilder &s, const BSONObj &o );
StringBuilder& operator<<( StringBuilder &s, const BSONElement &e );
struct BSONArray : BSONObj {
// Don't add anything other than forwarding constructors!!!
BSONArray(): BSONObj() {}