diff options
Diffstat (limited to 'src/mongo/db/pipeline')
-rw-r--r-- | src/mongo/db/pipeline/accumulator.h | 2 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document.h | 18 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_internal.h | 2 | ||||
-rw-r--r-- | src/mongo/db/pipeline/document_source.h | 46 | ||||
-rw-r--r-- | src/mongo/db/pipeline/expression.h | 54 | ||||
-rw-r--r-- | src/mongo/db/pipeline/field_path.h | 20 | ||||
-rw-r--r-- | src/mongo/db/pipeline/pipeline.h | 10 | ||||
-rw-r--r-- | src/mongo/db/pipeline/value.h | 30 | ||||
-rw-r--r-- | src/mongo/db/pipeline/value_internal.h | 14 |
9 files changed, 98 insertions, 98 deletions
diff --git a/src/mongo/db/pipeline/accumulator.h b/src/mongo/db/pipeline/accumulator.h index 61b2dade4e7..d0b48b498b6 100644 --- a/src/mongo/db/pipeline/accumulator.h +++ b/src/mongo/db/pipeline/accumulator.h @@ -168,7 +168,7 @@ namespace mongo { private: AccumulatorPush(); - vector<Value> vpValue; + std::vector<Value> vpValue; }; diff --git a/src/mongo/db/pipeline/document.h b/src/mongo/db/pipeline/document.h index 7f2fde8a26f..1ee358b434c 100644 --- a/src/mongo/db/pipeline/document.h +++ b/src/mongo/db/pipeline/document.h @@ -55,7 +55,7 @@ namespace mongo { /** A Document is similar to a BSONObj but with a different in-memory representation. * - * A Document can be treated as a const map<string, const Value> that is + * A Document can be treated as a const std::map<std::string, const Value> that is * very cheap to copy and is Assignable. Therefore, it is acceptable to * pass and return by Value. Note that the data in a Document is * immutable, but you can replace a Document instance with assignment. @@ -88,7 +88,7 @@ namespace mongo { * TODO a version that doesn't use FieldPath */ const Value getNestedField(const FieldPath& fieldNames, - vector<Position>* positions=NULL) const; + std::vector<Position>* positions=NULL) const; /// Number of fields in this document. O(n) size_t size() const { return storage().size(); } @@ -100,7 +100,7 @@ namespace mongo { FieldIterator fieldIterator() const; /// Convenience type for dealing with fields. Used by FieldIterator. - typedef pair<StringData, Value> FieldPair; + typedef std::pair<StringData, Value> FieldPair; /** Get the approximate storage size of the document and sub-values in bytes. * Note: Some memory may be shared with other Documents or between fields within @@ -123,10 +123,10 @@ namespace mongo { */ static int compare(const Document& lhs, const Document& rhs); - string toString() const; + std::string toString() const; friend - ostream& operator << (ostream& out, const Document& doc) { return out << doc.toString(); } + std::ostream& operator << (std::ostream& out, const Document& doc) { return out << doc.toString(); } /** Calculate a hash value. * @@ -356,8 +356,8 @@ namespace mongo { } /// Takes positions vector from Document::getNestedField. All fields in path must exist. - MutableValue getNestedField(const vector<Position>& positions); - void setNestedField(const vector<Position>& positions, const Value& val) { + MutableValue getNestedField(const std::vector<Position>& positions); + void setNestedField(const std::vector<Position>& positions, const Value& val) { getNestedField(positions) = val; } @@ -437,7 +437,7 @@ namespace mongo { // recursive helpers for same-named public methods MutableValue getNestedFieldHelper(const FieldPath& dottedField, size_t level); - MutableValue getNestedFieldHelper(const vector<Position>& positions, size_t level); + MutableValue getNestedFieldHelper(const std::vector<Position>& positions, size_t level); // this should only be called by storage methods and peek/freeze const DocumentStorage* storagePtr() const { @@ -541,7 +541,7 @@ namespace mongo { Value done() { return Value::consume(_array); } private: - vector<Value> _array; + std::vector<Value> _array; }; } diff --git a/src/mongo/db/pipeline/document_internal.h b/src/mongo/db/pipeline/document_internal.h index 4ef2a0f0710..2716c2a4a94 100644 --- a/src/mongo/db/pipeline/document_internal.h +++ b/src/mongo/db/pipeline/document_internal.h @@ -40,7 +40,7 @@ namespace mongo { */ class Position { public: - // This represents "not found" similar to string::npos + // This represents "not found" similar to std::string::npos Position() :index(static_cast<unsigned>(-1)) {} bool found() const { return index != Position().index; } diff --git a/src/mongo/db/pipeline/document_source.h b/src/mongo/db/pipeline/document_source.h index 1b2b3cc4bea..641a3b9643b 100644 --- a/src/mongo/db/pipeline/document_source.h +++ b/src/mongo/db/pipeline/document_source.h @@ -78,7 +78,7 @@ namespace mongo { /** Get the source's name. - @returns the string name of the source as a constant string; + @returns the std::string name of the source as a constant string; this is static, and there's no need to worry about adopting it */ virtual const char *getSourceName() const; @@ -144,13 +144,13 @@ namespace mongo { } /** - * In the default case, serializes the DocumentSource and adds it to the vector<Value>. + * In the default case, serializes the DocumentSource and adds it to the std::vector<Value>. * * A subclass may choose to overwrite this, rather than serialize, * if it should output multiple stages (eg, $sort sometimes also outputs a $limit). */ - virtual void serializeToArray(vector<Value>& array, bool explain = false) const; + virtual void serializeToArray(std::vector<Value>& array, bool explain = false) const; /// Returns true if doesn't require an input source (most DocumentSources do). virtual bool isValidInitialSource() const { return false; } @@ -287,13 +287,13 @@ namespace mongo { virtual bool isValidInitialSource() const { return true; } /* convenient shorthand for a commonly used type */ - typedef vector<Strategy::CommandResult> ShardOutput; + typedef std::vector<Strategy::CommandResult> ShardOutput; /** Returns the result arrays from shards using the 2.4 protocol. * Call this instead of getNext() if you want access to the raw streams. * This method should only be called at most once. */ - vector<BSONArray> getArrays(); + std::vector<BSONArray> getArrays(); /** Create a DocumentSource that wraps the output of many shards @@ -353,7 +353,7 @@ namespace mongo { * in order to fetch data from the database. */ static intrusive_ptr<DocumentSourceCursor> create( - const string& ns, + const std::string& ns, const boost::shared_ptr<Runner>& runner, const intrusive_ptr<ExpressionContext> &pExpCtx); @@ -397,7 +397,7 @@ namespace mongo { private: DocumentSourceCursor( - const string& ns, + const std::string& ns, const boost::shared_ptr<Runner>& runner, const intrusive_ptr<ExpressionContext> &pExpCtx); @@ -413,7 +413,7 @@ namespace mongo { intrusive_ptr<DocumentSourceLimit> _limit; long long _docsAddedToBatches; // for _limit enforcement - const string _ns; + const std::string _ns; boost::shared_ptr<Runner> _runner; // PipelineRunner holds a weak_ptr to this. }; @@ -513,7 +513,7 @@ namespace mongo { Value expandId(const Value& val); - typedef vector<intrusive_ptr<Accumulator> > Accumulators; + typedef std::vector<intrusive_ptr<Accumulator> > Accumulators; typedef boost::unordered_map<Value, Accumulators, Value::Hash> GroupsMap; GroupsMap groups; @@ -529,9 +529,9 @@ namespace mongo { These three vectors parallel each other. */ - vector<string> vFieldName; - vector<intrusive_ptr<Accumulator> (*)()> vpAccumulatorFactory; - vector<intrusive_ptr<Expression> > vpExpression; + std::vector<std::string> vFieldName; + std::vector<intrusive_ptr<Accumulator> (*)()> vpAccumulatorFactory; + std::vector<intrusive_ptr<Expression> > vpExpression; Document makeDocument(const Value& id, const Accumulators& accums, bool mergeableOutput); @@ -549,7 +549,7 @@ namespace mongo { // only used when _spilled scoped_ptr<Sorter<Value, Value>::Iterator> _sorterIterator; - pair<Value, Value> _firstPartOfNextGroup; + std::pair<Value, Value> _firstPartOfNextGroup; Value _currentId; Accumulators _currentAccumulators; }; @@ -605,7 +605,7 @@ namespace mongo { class DocumentSourceMergeCursors : public DocumentSource { public: - typedef vector<pair<ConnectionString, CursorId> > CursorIds; + typedef std::vector<std::pair<ConnectionString, CursorId> > CursorIds; // virtuals from DocumentSource boost::optional<Document> getNext(); @@ -629,7 +629,7 @@ namespace mongo { * Call this instead of getNext() if you want access to the raw streams. * This method should only be called at most once. */ - vector<DBClientCursor*> getCursors(); + std::vector<DBClientCursor*> getCursors(); /** * Returns the next object from the cursor, throwing an appropriate exception if the cursor @@ -646,7 +646,7 @@ namespace mongo { }; // using list to enable removing arbitrary elements - typedef list<boost::shared_ptr<CursorAndConnection> > Cursors; + typedef std::list<boost::shared_ptr<CursorAndConnection> > Cursors; DocumentSourceMergeCursors( const CursorIds& cursorIds, @@ -705,7 +705,7 @@ namespace mongo { // Sets _tempsNs and prepares it to receive data. void prepTempCollection(); - void spill(DBClientBase* conn, const vector<BSONObj>& toInsert); + void spill(DBClientBase* conn, const std::vector<BSONObj>& toInsert); bool _done; @@ -787,7 +787,7 @@ namespace mongo { // virtuals from DocumentSource virtual boost::optional<Document> getNext(); virtual const char *getSourceName() const; - virtual void serializeToArray(vector<Value>& array, bool explain = false) const; + virtual void serializeToArray(std::vector<Value>& array, bool explain = false) const; virtual bool coalesce(const intrusive_ptr<DocumentSource> &pNextSource); virtual void dispose(); @@ -806,7 +806,7 @@ namespace mongo { @param ascending if true, use the key for an ascending sort, otherwise, use it for descending */ - void addKey(const string &fieldPath, bool ascending); + void addKey(const std::string &fieldPath, bool ascending); /// Write out a Document whose contents are the sort key. Document serializeSortKey(bool explain) const; @@ -862,13 +862,13 @@ namespace mongo { // not. class IteratorFromCursor; class IteratorFromBsonArray; - void populateFromCursors(const vector<DBClientCursor*>& cursors); - void populateFromBsonArrays(const vector<BSONArray>& arrays); + void populateFromCursors(const std::vector<DBClientCursor*>& cursors); + void populateFromBsonArrays(const std::vector<BSONArray>& arrays); /* these two parallel each other */ - typedef vector<intrusive_ptr<Expression> > SortKey; + typedef std::vector<intrusive_ptr<Expression> > SortKey; SortKey vSortKey; - vector<char> vAscending; // used like vector<bool> but without specialization + std::vector<char> vAscending; // used like std::vector<bool> but without specialization /// Extracts the fields in vSortKey from the Document; Value extractKey(const Document& d) const; diff --git a/src/mongo/db/pipeline/expression.h b/src/mongo/db/pipeline/expression.h index 31a0171ecc2..cc94babf443 100644 --- a/src/mongo/db/pipeline/expression.h +++ b/src/mongo/db/pipeline/expression.h @@ -170,14 +170,14 @@ namespace mongo { * Expressions are trees, so this is often recursive. * * @param deps Fully qualified paths to depended-on fields are added to this set. - * Empty string means need full document. + * Empty std::string means need full document. * @param path path to self if all ancestors are ExpressionObjects. * Top-level ExpressionObject gets pointer to empty vector. * If any other Expression is an ancestor, or in other cases * where {a:1} inclusion objects aren't allowed, they get * NULL. */ - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const = 0; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const = 0; /** simple expressions are just inclusion exclusion as supported by ExpressionObject */ virtual bool isSimple() { return false; } @@ -265,14 +265,14 @@ namespace mongo { const VariablesParseState& vps); /* - Produce a field path string with the field prefix removed. + Produce a field path std::string with the field prefix removed. Throws an error if the field prefix is not present. @param prefixedField the prefixed field @returns the field path with the prefix removed */ - static string removeFieldPrefix(const string &prefixedField); + static std::string removeFieldPrefix(const std::string &prefixedField); /** Evaluate the subclass Expression using the given Variables as context and return result. * @@ -282,7 +282,7 @@ namespace mongo { virtual Value evaluateInternal(Variables* vars) const = 0; protected: - typedef vector<intrusive_ptr<Expression> > ExpressionVector; + typedef std::vector<intrusive_ptr<Expression> > ExpressionVector; }; @@ -293,7 +293,7 @@ namespace mongo { // virtuals from Expression virtual intrusive_ptr<Expression> optimize(); virtual Value serialize(bool explain) const; - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; /* Add an operand to the n-ary expression. @@ -308,7 +308,7 @@ namespace mongo { /* Get the name of the operator. - @returns the name of the operator; this string belongs to the class + @returns the name of the operator; this std::string belongs to the class implementation, and should not be deleted and should not */ @@ -399,7 +399,7 @@ namespace mongo { public: // virtuals from ExpressionNary virtual intrusive_ptr<Expression> optimize(); - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; virtual Value evaluateInternal(Variables* vars) const; virtual Value serialize(bool explain) const; @@ -471,7 +471,7 @@ namespace mongo { public: // virtuals from Expression virtual intrusive_ptr<Expression> optimize(); - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; virtual Value evaluateInternal(Variables* vars) const; virtual const char *getOpName() const; virtual Value serialize(bool explain) const; @@ -531,7 +531,7 @@ namespace mongo { public: // virtuals from Expression virtual intrusive_ptr<Expression> optimize(); - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; virtual Value evaluateInternal(Variables* vars) const; virtual Value serialize(bool explain) const; @@ -548,17 +548,17 @@ namespace mongo { indicator @returns the newly created field path expression */ - static intrusive_ptr<ExpressionFieldPath> create(const string& fieldPath); + static intrusive_ptr<ExpressionFieldPath> create(const std::string& fieldPath); - /// Like create(), but works with the raw string from the user with the "$" prefixes. + /// Like create(), but works with the raw std::string from the user with the "$" prefixes. static intrusive_ptr<ExpressionFieldPath> parse( - const string& raw, + const std::string& raw, const VariablesParseState& vps); const FieldPath& getFieldPath() const { return _fieldPath; } private: - ExpressionFieldPath(const string& fieldPath, Variables::Id variable); + ExpressionFieldPath(const std::string& fieldPath, Variables::Id variable); /* Internal implementation of evaluateInternal(), used recursively. @@ -605,7 +605,7 @@ namespace mongo { virtual intrusive_ptr<Expression> optimize(); virtual Value serialize(bool explain) const; virtual Value evaluateInternal(Variables* vars) const; - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; static intrusive_ptr<Expression> parse( BSONElement expr, @@ -613,16 +613,16 @@ namespace mongo { struct NameAndExpression { NameAndExpression() {} - NameAndExpression(string name, intrusive_ptr<Expression> expression) + NameAndExpression(std::string name, intrusive_ptr<Expression> expression) : name(name) , expression(expression) {} - string name; + std::string name; intrusive_ptr<Expression> expression; }; - typedef map<Variables::Id, NameAndExpression> VariableMap; + typedef std::map<Variables::Id, NameAndExpression> VariableMap; private: ExpressionLet(const VariableMap& vars, @@ -638,19 +638,19 @@ namespace mongo { virtual intrusive_ptr<Expression> optimize(); virtual Value serialize(bool explain) const; virtual Value evaluateInternal(Variables* vars) const; - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; static intrusive_ptr<Expression> parse( BSONElement expr, const VariablesParseState& vps); private: - ExpressionMap(const string& varName, // name of variable to set + ExpressionMap(const std::string& varName, // name of variable to set Variables::Id varId, // id of variable to set intrusive_ptr<Expression> input, // yields array to iterate intrusive_ptr<Expression> each); // yields results to be added to output array - string _varName; + std::string _varName; Variables::Id _varId; intrusive_ptr<Expression> _input; intrusive_ptr<Expression> _each; @@ -661,7 +661,7 @@ namespace mongo { // virtuals from Expression virtual Value serialize(bool explain) const; virtual Value evaluateInternal(Variables* vars) const; - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; static intrusive_ptr<Expression> parse( BSONElement expr, @@ -722,7 +722,7 @@ namespace mongo { // virtuals from Expression virtual intrusive_ptr<Expression> optimize(); virtual bool isSimple(); - virtual void addDependencies(DepsTracker* deps, vector<string>* path=NULL) const; + virtual void addDependencies(DepsTracker* deps, std::vector<std::string>* path=NULL) const; /** Only evaluates non inclusion expressions. For inclusions, use addToDocument(). */ virtual Value evaluateInternal(Variables* vars) const; virtual Value serialize(bool explain) const; @@ -771,7 +771,7 @@ namespace mongo { @param fieldPath the name of the field to be included */ - void includePath(const string &fieldPath); + void includePath(const std::string &fieldPath); /* Get a count of the added fields. @@ -806,7 +806,7 @@ namespace mongo { @param include if true, the path is included; if false, the path is excluded */ - virtual void path(const string &path, bool include) = 0; + virtual void path(const std::string &path, bool include) = 0; }; void excludeId(bool b) { _excludeId = b; } @@ -816,11 +816,11 @@ namespace mongo { // Mapping from fieldname to the Expression that generates its value. // NULL expression means inclusion from source document. - typedef map<string, intrusive_ptr<Expression> > FieldMap; + typedef std::map<std::string, intrusive_ptr<Expression> > FieldMap; FieldMap _expressions; // this is used to maintain order for generated fields not in the source document - vector<string> _order; + std::vector<std::string> _order; bool _excludeId; bool _atRoot; diff --git a/src/mongo/db/pipeline/field_path.h b/src/mongo/db/pipeline/field_path.h index d8a8984b9f0..93ee10f6afa 100644 --- a/src/mongo/db/pipeline/field_path.h +++ b/src/mongo/db/pipeline/field_path.h @@ -38,12 +38,12 @@ namespace mongo { /** * Constructor. * - * @param fieldPath the dotted field path string or non empty pre-split vector. + * @param fieldPath the dotted field path std::string or non empty pre-split vector. * The constructed object will have getPathLength() > 0. * Uassert if any component field names do not pass validation. */ - FieldPath(const string& fieldPath); - FieldPath(const vector<string>& fieldPath); + FieldPath(const std::string& fieldPath); + FieldPath(const std::vector<std::string>& fieldPath); /** Get the number of path elements in the field path. @@ -58,7 +58,7 @@ namespace mongo { @param i the zero based index of the path element. @returns the path element */ - const string& getFieldName(size_t i) const; + const std::string& getFieldName(size_t i) const; /** Get the full path. @@ -66,7 +66,7 @@ namespace mongo { @param fieldPrefix whether or not to include the field prefix @returns the complete field path */ - string getPath(bool fieldPrefix) const; + std::string getPath(bool fieldPrefix) const; /** Write the full path. @@ -74,7 +74,7 @@ namespace mongo { @param outStream where to write the path to @param fieldPrefix whether or not to include the field prefix */ - void writePath(ostream &outStream, bool fieldPrefix) const; + void writePath(std::ostream &outStream, bool fieldPrefix) const; /** Get the prefix string. @@ -93,15 +93,15 @@ namespace mongo { private: /** Uassert if a field name does not pass validation. */ - static void uassertValidFieldName(const string& fieldName); + static void uassertValidFieldName(const std::string& fieldName); /** * Push a new field name to the back of the vector of names comprising the field path. * Uassert if 'fieldName' does not pass validation. */ - void pushFieldName(const string& fieldName); + void pushFieldName(const std::string& fieldName); - vector<string> vFieldName; + std::vector<std::string> vFieldName; }; } @@ -114,7 +114,7 @@ namespace mongo { return vFieldName.size(); } - inline const string& FieldPath::getFieldName(size_t i) const { + inline const std::string& FieldPath::getFieldName(size_t i) const { dassert(i < getPathLength()); return vFieldName[i]; } diff --git a/src/mongo/db/pipeline/pipeline.h b/src/mongo/db/pipeline/pipeline.h index 4d11f8eed29..297d73874f9 100644 --- a/src/mongo/db/pipeline/pipeline.h +++ b/src/mongo/db/pipeline/pipeline.h @@ -57,15 +57,15 @@ namespace mongo { * @returns the pipeline, if created, otherwise a NULL reference */ static intrusive_ptr<Pipeline> parseCommand( - string& errmsg, + std::string& errmsg, const BSONObj& cmdObj, const intrusive_ptr<ExpressionContext>& pCtx); /// Helper to implement Command::addRequiredPrivileges static void addRequiredPrivileges(Command* commandTemplate, - const string& dbname, + const std::string& dbname, BSONObj cmdObj, - vector<Privilege>* out); + std::vector<Privilege>* out); intrusive_ptr<ExpressionContext> getContext() const { return pCtx; } @@ -122,10 +122,10 @@ namespace mongo { bool canRunInMongos() const; /** - * Write the pipeline's operators to a vector<Value>, with the + * Write the pipeline's operators to a std::vector<Value>, with the * explain flag true (for DocumentSource::serializeToArray()). */ - vector<Value> writeExplainOps() const; + std::vector<Value> writeExplainOps() const; /** * Returns the dependencies needed by this pipeline. diff --git a/src/mongo/db/pipeline/value.h b/src/mongo/db/pipeline/value.h index 2a70a94733d..d4dd9b5899e 100644 --- a/src/mongo/db/pipeline/value.h +++ b/src/mongo/db/pipeline/value.h @@ -45,7 +45,7 @@ namespace mongo { * change. However if you have a non-const Value you replace it with * operator=. These rules are the same as BSONObj, and similar to * shared_ptr<const Object> with stronger guarantees of constness. This is - * also the same as Java's String type. + * also the same as Java's std::string type. * * Thread-safety: A single Value instance can be safely shared between * threads as long as there are no writers while other threads are @@ -73,12 +73,12 @@ namespace mongo { explicit Value(const OpTime& value) : _storage(Timestamp, value.asDate()) {} explicit Value(const OID& value) : _storage(jstOID, value) {} explicit Value(const StringData& value) : _storage(String, value) {} - explicit Value(const string& value) : _storage(String, StringData(value)) {} + explicit Value(const std::string& value) : _storage(String, StringData(value)) {} explicit Value(const char* value) : _storage(String, StringData(value)) {} explicit Value(const Document& doc) : _storage(Object, doc) {} explicit Value(const BSONObj& obj); explicit Value(const BSONArray& arr); - explicit Value(const vector<Value>& vec) : _storage(Array, new RCVector(vec)) {} + explicit Value(const std::vector<Value>& vec) : _storage(Array, new RCVector(vec)) {} explicit Value(const BSONBinData& bd) : _storage(BinData, bd) {} explicit Value(const BSONRegEx& re) : _storage(RegEx, re) {} explicit Value(const BSONCodeWScope& cws) : _storage(CodeWScope, cws) {} @@ -109,7 +109,7 @@ namespace mongo { * consumed is replaced with an empty vector. * In C++11 this would be spelled Value(std::move(consumed)). */ - static Value consume(vector<Value>& consumed) { + static Value consume(std::vector<Value>& consumed) { RCVector* vec = new RCVector(); std::swap(vec->vec, consumed); return Value(ValueStorage(Array, vec)); @@ -143,7 +143,7 @@ namespace mongo { * See coerceTo methods below for a more type-flexible alternative. */ double getDouble() const; - string getString() const; + std::string getString() const; Document getDocument() const; OID getOid() const; bool getBool() const; @@ -151,11 +151,11 @@ namespace mongo { OpTime getTimestamp() const; const char* getRegex() const; const char* getRegexFlags() const; - string getSymbol() const; - string getCode() const; + std::string getSymbol() const; + std::string getCode() const; int getInt() const; long long getLong() const; - const vector<Value>& getArray() const { return _storage.getArray(); } + const std::vector<Value>& getArray() const { return _storage.getArray(); } size_t getArrayLength() const; /// Access an element of a subarray. Returns Value() if missing or getType() != Array @@ -183,7 +183,7 @@ namespace mongo { * These currently assert if called on an unconvertible type. * TODO: decided how to handle unsupported types. */ - string coerceToString() const; + std::string coerceToString() const; int coerceToInt() const; long long coerceToLong() const; double coerceToDouble() const; @@ -218,8 +218,8 @@ namespace mongo { } /// This is for debugging, logging, etc. See getString() for how to extract a string. - string toString() const; - friend ostream& operator << (ostream& out, const Value& v); + std::string toString() const; + friend std::ostream& operator << (std::ostream& out, const Value& v); void swap(Value& rhs) { _storage.swap(rhs._storage); @@ -243,7 +243,7 @@ namespace mongo { void hash_combine(size_t& seed) const; /// struct Hash is defined to enable the use of Values as keys in unordered_map. - struct Hash : unary_function<const Value&, size_t> { + struct Hash : std::unary_function<const Value&, size_t> { size_t operator()(const Value& rV) const; }; @@ -304,7 +304,7 @@ namespace mongo { return _storage.getString(); } - inline string Value::getString() const { + inline std::string Value::getString() const { verify(getType() == String); return _storage.getString().toString(); } @@ -341,11 +341,11 @@ namespace mongo { return flags; } - inline string Value::getSymbol() const { + inline std::string Value::getSymbol() const { verify(getType() == Symbol); return _storage.getString().toString(); } - inline string Value::getCode() const { + inline std::string Value::getCode() const { verify(getType() == Code); return _storage.getString().toString(); } diff --git a/src/mongo/db/pipeline/value_internal.h b/src/mongo/db/pipeline/value_internal.h index 7565e318bd5..d124892282a 100644 --- a/src/mongo/db/pipeline/value_internal.h +++ b/src/mongo/db/pipeline/value_internal.h @@ -47,21 +47,21 @@ namespace mongo { class RCVector : public RefCountable { public: RCVector() {} - RCVector(const vector<Value>& v) :vec(v) {} - vector<Value> vec; + RCVector(const std::vector<Value>& v) :vec(v) {} + std::vector<Value> vec; }; class RCCodeWScope : public RefCountable { public: - RCCodeWScope(const string& str, BSONObj obj) :code(str), scope(obj.getOwned()) {} - const string code; + RCCodeWScope(const std::string& str, BSONObj obj) :code(str), scope(obj.getOwned()) {} + const std::string code; const BSONObj scope; // Not worth converting to Document for now }; class RCDBRef : public RefCountable { public: - RCDBRef(const string& str, const OID& o) :ns(str), oid(o) {} - const string ns; + RCDBRef(const std::string& str, const OID& o) :ns(str), oid(o) {} + const std::string ns; const OID oid; }; @@ -168,7 +168,7 @@ namespace mongo { } } - const vector<Value>& getArray() const { + const std::vector<Value>& getArray() const { dassert(typeid(*genericRCPtr) == typeid(const RCVector)); const RCVector* arrayPtr = static_cast<const RCVector*>(genericRCPtr); return arrayPtr->vec; |