diff options
author | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2014-05-19 12:46:52 -0400 |
---|---|---|
committer | Mark Benvenuto <mark.benvenuto@mongodb.com> | 2014-05-19 14:43:05 -0400 |
commit | f2bfd36a6f3eb7e7e2587268be3cc12636703d42 (patch) | |
tree | 6436772fbceb28f07bbfaee528d700159beb0cec /src/mongo/db | |
parent | c10e8282a7af38f8512e911a14889e14df8a2c6a (diff) | |
download | mongo-f2bfd36a6f3eb7e7e2587268be3cc12636703d42.tar.gz |
SERVER-13256: Remove pch - qualify std in headers
Diffstat (limited to 'src/mongo/db')
152 files changed, 844 insertions, 841 deletions
diff --git a/src/mongo/db/auth/action_set.h b/src/mongo/db/auth/action_set.h index a43ec9fa458..4a5c6ef45d0 100644 --- a/src/mongo/db/auth/action_set.h +++ b/src/mongo/db/auth/action_set.h @@ -66,17 +66,17 @@ namespace mongo { // ActionSet. bool isSupersetOf(const ActionSet& other) const; - // Returns the string representation of this ActionSet + // Returns the std::string representation of this ActionSet std::string toString() const; // Returns a vector of strings representing the actions in the ActionSet. std::vector<std::string> getActionsAsStrings() const; - // Takes a comma-separated string of action type string representations and returns + // Takes a comma-separated std::string of action type std::string representations and returns // an int bitmask of the actions. static Status parseActionSetFromString(const std::string& actionsString, ActionSet* result); - // Takes a vector of action type string representations and returns an ActionSet of the + // Takes a vector of action type std::string representations and returns an ActionSet of the // actions. static Status parseActionSetFromStringVector(const std::vector<std::string>& actionsVector, ActionSet* result); diff --git a/src/mongo/db/auth/authorization_manager.h b/src/mongo/db/auth/authorization_manager.h index bd32cba4224..b3a17c491c5 100644 --- a/src/mongo/db/auth/authorization_manager.h +++ b/src/mongo/db/auth/authorization_manager.h @@ -276,7 +276,7 @@ namespace mongo { * membership and delegation information, a full list of the user's privileges, and a full * list of the user's roles, including those roles held implicitly through other roles * (indirect roles). In the event that some of this information is inconsistent, the - * document will contain a "warnings" array, with string messages describing + * document will contain a "warnings" array, with std::string messages describing * inconsistencies. * * If the user does not exist, returns ErrorCodes::UserNotFound. @@ -290,7 +290,7 @@ namespace mongo { * implicitly through other roles (indirect roles). If "showPrivileges" is true, then the * description documents will also include a full list of the role's privileges. * In the event that some of this information is inconsistent, the document will contain a - * "warnings" array, with string messages describing inconsistencies. + * "warnings" array, with std::string messages describing inconsistencies. * * If the role does not exist, returns ErrorCodes::RoleNotFound. */ @@ -306,13 +306,13 @@ namespace mongo { * contain description documents for all the builtin roles for the given database, if it * is false the result will just include user defined roles. * In the event that some of the information in a given role description is inconsistent, - * the document will contain a "warnings" array, with string messages describing + * the document will contain a "warnings" array, with std::string messages describing * inconsistencies. */ Status getRoleDescriptionsForDB(const std::string dbname, bool showPrivileges, bool showBuiltinRoles, - vector<BSONObj>* result); + std::vector<BSONObj>* result); /** * Returns the User object for the given userName in the out parameter "acquiredUser". diff --git a/src/mongo/db/auth/authorization_session.h b/src/mongo/db/auth/authorization_session.h index 6c32fa697ae..92e4e6f6552 100644 --- a/src/mongo/db/auth/authorization_session.h +++ b/src/mongo/db/auth/authorization_session.h @@ -88,8 +88,8 @@ namespace mongo { // Gets an iterator over the names of all authenticated users stored in this manager. UserNameIterator getAuthenticatedUserNames(); - // Returns a string representing all logged-in users on the current session. - // WARNING: this string will contain NUL bytes so don't call c_str()! + // Returns a std::string representing all logged-in users on the current session. + // WARNING: this std::string will contain NUL bytes so don't call c_str()! std::string getAuthenticatedUserNamesToken(); // Removes any authenticated principals whose authorization credentials came from the given @@ -160,7 +160,7 @@ namespace mongo { // Like isAuthorizedForPrivilege, above, except returns true if the session is authorized // for all of the listed privileges. - bool isAuthorizedForPrivileges(const vector<Privilege>& privileges); + bool isAuthorizedForPrivileges(const std::vector<Privilege>& privileges); // Utility function for isAuthorizedForPrivilege(Privilege(resource, action)). bool isAuthorizedForActionsOnResource(const ResourcePattern& resource, ActionType action); diff --git a/src/mongo/db/auth/authz_manager_external_state.h b/src/mongo/db/auth/authz_manager_external_state.h index 683de53b108..f637415ae91 100644 --- a/src/mongo/db/auth/authz_manager_external_state.h +++ b/src/mongo/db/auth/authz_manager_external_state.h @@ -72,7 +72,7 @@ namespace mongo { * delegation information, a full list of the user's privileges, and a full list of the * user's roles, including those roles held implicitly through other roles (indirect roles). * In the event that some of this information is inconsistent, the document will contain a - * "warnings" array, with string messages describing inconsistencies. + * "warnings" array, with std::string messages describing inconsistencies. * * If the user does not exist, returns ErrorCodes::UserNotFound. */ @@ -85,7 +85,7 @@ namespace mongo { * implicitly through other roles (indirect roles). If "showPrivileges" is true, then the * description documents will also include a full list of the role's privileges. * In the event that some of this information is inconsistent, the document will contain a - * "warnings" array, with string messages describing inconsistencies. + * "warnings" array, with std::string messages describing inconsistencies. * * If the role does not exist, returns ErrorCodes::RoleNotFound. */ @@ -103,13 +103,13 @@ namespace mongo { * contain description documents for all the builtin roles for the given database, if it * is false the result will just include user defined roles. * In the event that some of the information in a given role description is inconsistent, - * the document will contain a "warnings" array, with string messages describing + * the document will contain a "warnings" array, with std::string messages describing * inconsistencies. */ virtual Status getRoleDescriptionsForDB(const std::string dbname, bool showPrivileges, bool showBuiltinRoles, - vector<BSONObj>* result) = 0; + std::vector<BSONObj>* result) = 0; /** * Gets the privilege document for "userName" stored in the system.users collection of diff --git a/src/mongo/db/auth/authz_manager_external_state_local.h b/src/mongo/db/auth/authz_manager_external_state_local.h index 930172c6c1b..2c49c4b7cc7 100644 --- a/src/mongo/db/auth/authz_manager_external_state_local.h +++ b/src/mongo/db/auth/authz_manager_external_state_local.h @@ -61,7 +61,7 @@ namespace mongo { virtual Status getRoleDescriptionsForDB(const std::string dbname, bool showPrivileges, bool showBuiltinRoles, - vector<BSONObj>* result); + std::vector<BSONObj>* result); virtual void logOp( const char* op, diff --git a/src/mongo/db/auth/authz_manager_external_state_s.h b/src/mongo/db/auth/authz_manager_external_state_s.h index 79e39611722..203ce25f5ac 100644 --- a/src/mongo/db/auth/authz_manager_external_state_s.h +++ b/src/mongo/db/auth/authz_manager_external_state_s.h @@ -60,7 +60,7 @@ namespace mongo { virtual Status getRoleDescriptionsForDB(const std::string dbname, bool showPrivileges, bool showBuiltinRoles, - vector<BSONObj>* result); + std::vector<BSONObj>* result); virtual Status getAllDatabaseNames(std::vector<std::string>* dbnames); diff --git a/src/mongo/db/auth/privilege_parser.h b/src/mongo/db/auth/privilege_parser.h index fc39566e311..7c892602032 100644 --- a/src/mongo/db/auth/privilege_parser.h +++ b/src/mongo/db/auth/privilege_parser.h @@ -53,8 +53,8 @@ namespace mongo { static const BSONField<bool> anyResource; static const BSONField<bool> cluster; - static const BSONField<string> db; - static const BSONField<string> collection; + static const BSONField<std::string> db; + static const BSONField<std::string> collection; // // construction / destruction @@ -112,11 +112,11 @@ namespace mongo { bool _isClusterSet; // (O) database portion of the resource - string _db; + std::string _db; bool _isDbSet; // (O) collection portion of the resource - string _collection; + std::string _collection; bool _isCollectionSet; }; @@ -131,7 +131,7 @@ namespace mongo { // schema declarations // - static const BSONField<std::vector<string> > actions; + static const BSONField<std::vector<std::string> > actions; static const BSONField<ParsedResource> resource; // @@ -168,13 +168,13 @@ namespace mongo { // individual field accessors // - void setActions(const std::vector<string>& actions); - void addToActions(const string& actions); + void setActions(const std::vector<std::string>& actions); + void addToActions(const std::string& actions); void unsetActions(); bool isActionsSet() const; size_t sizeActions() const; - const std::vector<string>& getActions() const; - const string& getActionsAt(size_t pos) const; + const std::vector<std::string>& getActions() const; + const std::string& getActionsAt(size_t pos) const; void setResource(const ParsedResource& resource); void unsetResource(); @@ -185,7 +185,7 @@ namespace mongo { // Convention: (M)andatory, (O)ptional // (M) Array of action types - std::vector<string> _actions; + std::vector<std::string> _actions; bool _isActionsSet; // (M) Object describing the resource pattern of this privilege diff --git a/src/mongo/db/auth/role_graph.h b/src/mongo/db/auth/role_graph.h index af31bd3d931..bec12b6d1e2 100644 --- a/src/mongo/db/auth/role_graph.h +++ b/src/mongo/db/auth/role_graph.h @@ -305,7 +305,7 @@ namespace mongo { EdgeSet _roleToMembers; RolePrivilegeMap _directPrivilegesForRole; RolePrivilegeMap _allPrivilegesForRole; - set<RoleName> _allRoles; + std::set<RoleName> _allRoles; }; void swap(RoleGraph& lhs, RoleGraph& rhs); diff --git a/src/mongo/db/auth/user_management_commands_parser.h b/src/mongo/db/auth/user_management_commands_parser.h index 36c122607ca..90f7db97e33 100644 --- a/src/mongo/db/auth/user_management_commands_parser.h +++ b/src/mongo/db/auth/user_management_commands_parser.h @@ -78,7 +78,7 @@ namespace auth { const StringData& cmdName, const std::string& dbname, std::string* parsedName, - vector<RoleName>* parsedRoleNames, + std::vector<RoleName>* parsedRoleNames, BSONObj* parsedWriteConcern); /** diff --git a/src/mongo/db/catalog/database.h b/src/mongo/db/catalog/database.h index 206d28db060..33d9b198517 100644 --- a/src/mongo/db/catalog/database.h +++ b/src/mongo/db/catalog/database.h @@ -73,7 +73,7 @@ namespace mongo { // following 2 are mutually exclusive, can only have one set long long initialNumExtents; - vector<long long> initialExtentSizes; + std::vector<long long> initialExtentSizes; // behavior of _id index creation when collection created void setNoIdIndex() { autoIndexId = NO; } @@ -101,15 +101,15 @@ namespace mongo { Database(OperationContext* txn, const char *nm, /*out*/ bool& newDb, - const string& path = storageGlobalParams.dbpath); + const std::string& path = storageGlobalParams.dbpath); /* you must use this to close - there is essential code in this method that is not in the ~Database destructor. thus the destructor is private. this could be cleaned up one day... */ - static void closeDatabase( const string& db, const string& path ); + static void closeDatabase( const std::string& db, const std::string& path ); - const string& name() const { return _name; } - const string& path() const { return _path; } + const std::string& name() const { return _name; } + const std::string& path() const { return _path; } void clearTmpCollections(OperationContext* txn); @@ -132,7 +132,7 @@ namespace mongo { /** * @return true if success. false if bad level or error creating profile ns */ - bool setProfilingLevel( OperationContext* txn, int newLevel , string& errmsg ); + bool setProfilingLevel( OperationContext* txn, int newLevel , std::string& errmsg ); void flushFiles( bool sync ); @@ -140,7 +140,7 @@ namespace mongo { * @return true if ns is part of the database * ns=foo.bar, db=foo returns true */ - bool ownsNS( const string& ns ) const { + bool ownsNS( const std::string& ns ) const { if ( ! startsWith( ns , _name ) ) return false; return ns[_name.size()] == '.'; @@ -189,14 +189,14 @@ namespace mongo { /** * @return name of an existing database with same text name but different - * casing, if one exists. Otherwise the empty string is returned. If + * casing, if one exists. Otherwise the empty std::string is returned. If * 'duplicates' is specified, it is filled with all duplicate names. */ - static string duplicateUncasedName( bool inholderlockalready, const string &name, const string &path, set< string > *duplicates = 0 ); + static std::string duplicateUncasedName( bool inholderlockalready, const std::string &name, const std::string &path, std::set< std::string > *duplicates = 0 ); static Status validateDBName( const StringData& dbname ); - const string& getSystemIndexesName() const { return _indexesName; } + const std::string& getSystemIndexesName() const { return _indexesName; } private: void _clearCollectionCache( const StringData& fullns ); @@ -231,15 +231,15 @@ namespace mongo { const StringData& toNS, bool stayTemp ); - const string _name; // "alleyinsider" - const string _path; // "/data/db" + const std::string _name; // "alleyinsider" + const std::string _path; // "/data/db" NamespaceIndex _namespaceIndex; boost::scoped_ptr<MmapV1ExtentManager> _extentManager; - const string _profileName; // "alleyinsider.system.profile" - const string _namespacesName; // "alleyinsider.system.namespaces" - const string _indexesName; // "alleyinsider.system.indexes" + const std::string _profileName; // "alleyinsider.system.profile" + const std::string _namespacesName; // "alleyinsider.system.namespaces" + const std::string _indexesName; // "alleyinsider.system.indexes" int _profile; // 0=off. diff --git a/src/mongo/db/catalog/database_holder.h b/src/mongo/db/catalog/database_holder.h index 3f3ea937e06..a2901926db7 100644 --- a/src/mongo/db/catalog/database_holder.h +++ b/src/mongo/db/catalog/database_holder.h @@ -40,8 +40,8 @@ namespace mongo { * path + dbname -> Database */ class DatabaseHolder { - typedef map<string,Database*> DBs; - typedef map<string,DBs> Paths; + typedef std::map<std::string,Database*> DBs; + typedef std::map<std::string,DBs> Paths; // todo: we want something faster than this if called a lot: mutable SimpleMutex _m; Paths _paths; @@ -49,42 +49,42 @@ namespace mongo { public: DatabaseHolder() : _m("dbholder"),_size(0) { } - bool __isLoaded( const string& ns , const string& path ) const { + bool __isLoaded( const std::string& ns , const std::string& path ) const { SimpleMutex::scoped_lock lk(_m); Paths::const_iterator x = _paths.find( path ); if ( x == _paths.end() ) return false; const DBs& m = x->second; - string db = _todb( ns ); + std::string db = _todb( ns ); DBs::const_iterator it = m.find(db); return it != m.end(); } // must be write locked as otherwise isLoaded could go false->true on you // in the background and you might not expect that. - bool _isLoaded( const string& ns , const string& path ) const { + bool _isLoaded( const std::string& ns , const std::string& path ) const { Lock::assertWriteLocked(ns); return __isLoaded(ns,path); } - Database * get( const string& ns , const string& path ) const { + Database * get( const std::string& ns , const std::string& path ) const { SimpleMutex::scoped_lock lk(_m); Lock::assertAtLeastReadLocked(ns); Paths::const_iterator x = _paths.find( path ); if ( x == _paths.end() ) return 0; const DBs& m = x->second; - string db = _todb( ns ); + std::string db = _todb( ns ); DBs::const_iterator it = m.find(db); if ( it != m.end() ) return it->second; return 0; } - Database* getOrCreate( const string& ns , const string& path , bool& justCreated ); + Database* getOrCreate( const std::string& ns , const std::string& path , bool& justCreated ); - void erase( const string& ns , const string& path ) { + void erase( const std::string& ns , const std::string& path ) { SimpleMutex::scoped_lock lk(_m); verify( Lock::isW() ); DBs& m = _paths[path]; @@ -92,7 +92,7 @@ namespace mongo { } /** @param force - force close even if something underway - use at shutdown */ - bool closeAll( const string& path , BSONObjBuilder& result, bool force ); + bool closeAll( const std::string& path , BSONObjBuilder& result, bool force ); // "info" as this is informational only could change on you if you are not write locked int sizeInfo() const { return _size; } @@ -101,7 +101,7 @@ namespace mongo { * gets all unique db names, ignoring paths * need some lock */ - void getAllShortNames( set<string>& all ) const { + void getAllShortNames( std::set<std::string>& all ) const { SimpleMutex::scoped_lock lk(_m); for ( Paths::const_iterator i=_paths.begin(); i!=_paths.end(); i++ ) { DBs m = i->second; @@ -112,14 +112,14 @@ namespace mongo { } private: - static string _todb( const string& ns ) { - string d = __todb( ns ); - uassert( 13280 , (string)"invalid db name: " + ns , NamespaceString::validDBName( d ) ); + static std::string _todb( const std::string& ns ) { + std::string d = __todb( ns ); + uassert( 13280 , (std::string)"invalid db name: " + ns , NamespaceString::validDBName( d ) ); return d; } - static string __todb( const string& ns ) { + static std::string __todb( const std::string& ns ) { size_t i = ns.find( '.' ); - if ( i == string::npos ) { + if ( i == std::string::npos ) { uassert( 13074 , "db name can't be empty" , ns.size() ); return ns; } diff --git a/src/mongo/db/catalog/index_catalog.h b/src/mongo/db/catalog/index_catalog.h index 7cfb607ca06..b45a056cc1a 100644 --- a/src/mongo/db/catalog/index_catalog.h +++ b/src/mongo/db/catalog/index_catalog.h @@ -96,8 +96,8 @@ namespace mongo { IndexDescriptor* findIndexByPrefix( const BSONObj &keyPattern, bool requireSingleKey ) const; - void findIndexByType( const string& type, - vector<IndexDescriptor*>& matches, + void findIndexByType( const std::string& type, + std::vector<IndexDescriptor*>& matches, bool includeUnfinishedIndexes = false ) const; // never returns NULL @@ -160,7 +160,7 @@ namespace mongo { * will drop all incompleted indexes and return specs * after this, the indexes can be rebuilt */ - vector<BSONObj> getAndClearUnfinishedIndexes(OperationContext* txn); + std::vector<BSONObj> getAndClearUnfinishedIndexes(OperationContext* txn); struct IndexKillCriteria { @@ -229,12 +229,12 @@ namespace mongo { Collection* _collection; IndexCatalog* _catalog; - string _ns; + std::string _ns; BSONObj _spec; - string _indexName; - string _indexNamespace; + std::string _indexName; + std::string _indexNamespace; IndexCatalogEntry* _entry; bool _inProgress; @@ -260,12 +260,12 @@ namespace mongo { // ------- temp internal ------- - string getAccessMethodName(const BSONObj& keyPattern) { + std::string getAccessMethodName(const BSONObj& keyPattern) { return _getAccessMethodName( keyPattern ); } Status _upgradeDatabaseMinorVersionIfNeeded( OperationContext* txn, - const string& newPluginName ); + const std::string& newPluginName ); // public static helpers @@ -288,7 +288,7 @@ namespace mongo { * use, not the plugin name inside of the provided key pattern. To understand when these * differ, see shouldOverridePlugin. */ - string _getAccessMethodName(const BSONObj& keyPattern) const; + std::string _getAccessMethodName(const BSONObj& keyPattern) const; IndexDetails* _getIndexDetails( const IndexDescriptor* descriptor ) const; @@ -319,8 +319,8 @@ namespace mongo { // just does disk hanges // doesn't change memory state, etc... void _deleteIndexFromDisk( OperationContext* txn, - const string& indexName, - const string& indexNamespace, + const std::string& indexName, + const std::string& indexNamespace, int idxNo ); // descriptor ownership passes to _setupInMemoryStructures diff --git a/src/mongo/db/client.h b/src/mongo/db/client.h index af634f1e13b..996d4d8b382 100644 --- a/src/mongo/db/client.h +++ b/src/mongo/db/client.h @@ -67,7 +67,7 @@ namespace mongo { class Client : public ClientBasic { public: // always be in clientsMutex when manipulating this. killop stuff uses these. - static set<Client*>& clients; + static std::set<Client*>& clients; static mongo::mutex& clientsMutex; static int getActiveClientCount( int& writers , int& readers ); class Context; @@ -90,7 +90,7 @@ namespace mongo { */ bool shutdown(); - string clientAddress(bool includePort=false) const; + std::string clientAddress(bool includePort=false) const; CurOp* curop() const { return _curOp; } Context* getContext() const { return _context; } const StringData desc() const { return _desc; } @@ -102,7 +102,7 @@ namespace mongo { bool isGod() const { return _god; } /* this is for map/reduce writes */ bool setGod(bool newVal) { const bool prev = _god; _god = newVal; return prev; } - string toString() const; + std::string toString() const; bool gotHandshake( const BSONObj& o ); BSONObj getRemoteID() const { return _remoteId; } BSONObj getHandshake() const { return _handshake; } @@ -125,7 +125,7 @@ namespace mongo { Client(const std::string& desc, AbstractMessagingPort *p = 0); friend class CurOp; ConnectionId _connectionId; // > 0 for things "conn", 0 otherwise - string _threadId; // "" on non support systems + std::string _threadId; // "" on non support systems CurOp * _curOp; Context * _context; bool _shutdown; // to track if Client::shutdown() gets called @@ -161,7 +161,7 @@ namespace mongo { class Context : boost::noncopyable { public: /** this is probably what you want */ - Context(const string& ns, const std::string& path=storageGlobalParams.dbpath, + Context(const std::string& ns, const std::string& path=storageGlobalParams.dbpath, bool doVersion = true); /** note: this does not call finishInit -- i.e., does not call @@ -171,13 +171,13 @@ namespace mongo { Context(const std::string& ns , Database * db); // used by ReadContext - Context(const string& path, const string& ns, Database *db, bool doVersion = true); + Context(const std::string& path, const std::string& ns, Database *db, bool doVersion = true); ~Context(); Client* getClient() const { return _client; } Database* db() const { return _db; } const char * ns() const { return _ns.c_str(); } - bool equals(const string& ns, const string& path=storageGlobalParams.dbpath) const { + bool equals(const std::string& ns, const std::string& path=storageGlobalParams.dbpath) const { return _ns == ns && _path == path; } @@ -185,10 +185,10 @@ namespace mongo { bool justCreated() const { return _justCreated; } /** @return true iff the current Context is using db/path */ - bool inDB(const string& db, const string& path=storageGlobalParams.dbpath) const; + bool inDB(const std::string& db, const std::string& path=storageGlobalParams.dbpath) const; void _clear() { // this is sort of an "early destruct" indication, _ns can never be uncleared - const_cast<string&>(_ns).clear(); + const_cast<std::string&>(_ns).clear(); _db = 0; } @@ -208,10 +208,10 @@ namespace mongo { void checkNsAccess( bool doauth, int lockState ); Client * const _client; Context * const _oldContext; - const string _path; + const std::string _path; bool _justCreated; bool _doVersion; - const string _ns; + const std::string _ns; Database * _db; Timer _timer; @@ -219,7 +219,7 @@ namespace mongo { class WriteContext : boost::noncopyable { public: - WriteContext(const string& ns, + WriteContext(const std::string& ns, const std::string& path=storageGlobalParams.dbpath, bool doVersion = true); Context& ctx() { return _c; } diff --git a/src/mongo/db/clientcursor.h b/src/mongo/db/clientcursor.h index f78cc34c9df..ca8aa95ca23 100644 --- a/src/mongo/db/clientcursor.h +++ b/src/mongo/db/clientcursor.h @@ -69,7 +69,7 @@ namespace mongo { // CursorId cursorid() const { return _cursorid; } - string ns() const { return _ns; } + std::string ns() const { return _ns; } const Collection* collection() const { return _collection; } /** @@ -164,7 +164,7 @@ namespace mongo { unsigned _pinValue; // The namespace we're operating on. - string _ns; + std::string _ns; const Collection* _collection; @@ -227,7 +227,7 @@ namespace mongo { /** thread for timing out old cursors */ class ClientCursorMonitor : public BackgroundJob { public: - string name() const { return "ClientCursorMonitor"; } + std::string name() const { return "ClientCursorMonitor"; } void run(); }; diff --git a/src/mongo/db/cloner.h b/src/mongo/db/cloner.h index 4c1abbf6c42..f6f47885dbf 100644 --- a/src/mongo/db/cloner.h +++ b/src/mongo/db/cloner.h @@ -57,15 +57,15 @@ namespace mongo { /** copy the entire database */ bool go(OperationContext* txn, Client::Context& ctx, - const string& masterHost, + const std::string& masterHost, const CloneOptions& opts, - set<string>* clonedColls, - string& errmsg, int *errCode = 0); + std::set<std::string>* clonedColls, + std::string& errmsg, int *errCode = 0); bool copyCollection(OperationContext* txn, - const string& ns, + const std::string& ns, const BSONObj& query, - string& errmsg, + std::string& errmsg, bool mayYield, bool mayBeInterrupted, bool copyIndexes = true, @@ -76,8 +76,8 @@ namespace mongo { * @param errCode out Error code encountered during the query * @param errmsg out Error message encountered during the query */ - static bool validateQueryResults(const auto_ptr<DBClientCursor>& cur, int32_t* errCode, - string& errmsg); + static bool validateQueryResults(const std::auto_ptr<DBClientCursor>& cur, int32_t* errCode, + std::string& errmsg); /** * @param errmsg out - Error message (if encountered). @@ -87,17 +87,17 @@ namespace mongo { */ static bool cloneFrom(OperationContext* txn, Client::Context& context, - const string& masterHost, + const std::string& masterHost, const CloneOptions& options, - string& errmsg, + std::string& errmsg, int* errCode = 0, - set<string>* clonedCollections = 0); + std::set<std::string>* clonedCollections = 0); /** * Copy a collection (and indexes) from a remote host */ static bool copyCollectionFromRemote(OperationContext* txn, - const string& host, const string& ns, string& errmsg); + const std::string& host, const std::string& ns, std::string& errmsg); private: void copy(OperationContext* txn, @@ -113,7 +113,7 @@ namespace mongo { Query q); struct Fun; - auto_ptr<DBClientBase> _conn; + std::auto_ptr<DBClientBase> _conn; }; struct CloneOptions { @@ -130,8 +130,8 @@ namespace mongo { syncIndexes = true; } - string fromDB; - set<string> collsToIgnore; + std::string fromDB; + std::set<std::string> collsToIgnore; bool logForRepl; bool slaveOk; diff --git a/src/mongo/db/commands.h b/src/mongo/db/commands.h index 992e80cc876..4446020a94c 100644 --- a/src/mongo/db/commands.h +++ b/src/mongo/db/commands.h @@ -58,14 +58,14 @@ namespace mutablebson { protected: // The type of the first field in 'cmdObj' must be mongo::String. The first field is // interpreted as a collection name. - string parseNsFullyQualified(const string& dbname, const BSONObj& cmdObj) const; + std::string parseNsFullyQualified(const std::string& dbname, const BSONObj& cmdObj) const; public: // Return the namespace for the command. If the first field in 'cmdObj' is of type // mongo::String, then that field is interpreted as the collection name, and is // appended to 'dbname' after a '.' character. If the first field is not of type // mongo::String, then 'dbname' is returned unmodified. - virtual string parseNs(const string& dbname, const BSONObj& cmdObj) const; + virtual std::string parseNs(const std::string& dbname, const BSONObj& cmdObj) const; // Utility that returns a ResourcePattern for the namespace returned from // parseNs(dbname, cmdObj). This will be either an exact namespace resource pattern @@ -74,7 +74,7 @@ namespace mutablebson { ResourcePattern parseResourcePattern(const std::string& dbname, const BSONObj& cmdObj) const; - const string name; + const std::string name; /* run the given command implement this... @@ -85,10 +85,10 @@ namespace mutablebson { return value is true if succeeded. if false, set errmsg text. */ virtual bool run(OperationContext* txn, - const string& db, + const std::string& db, BSONObj& cmdObj, int options, - string& errmsg, + std::string& errmsg, BSONObjBuilder& result, bool fromRepl = false ) = 0; @@ -107,7 +107,7 @@ namespace mutablebson { return false; } - void htmlHelp(stringstream&) const; + void htmlHelp(std::stringstream&) const; /* Like adminOnly, but even stricter: we must either be authenticated for admin db, or, if running without auth, on the local interface. Used for things which @@ -135,7 +135,7 @@ namespace mutablebson { */ virtual bool shouldAffectCommandCounter() const { return true; } - virtual void help( stringstream& help ) const; + virtual void help( std::stringstream& help ) const; /** * Checks if the given client is authorized to run this command on database "dbname" @@ -190,25 +190,25 @@ namespace mutablebson { return BSONObj(); } - static void logIfSlow( const Timer& cmdTimer, const string& msg); + static void logIfSlow( const Timer& cmdTimer, const std::string& msg); - static map<string,Command*> * _commands; - static map<string,Command*> * _commandsByBestName; - static map<string,Command*> * _webCommands; + static std::map<std::string,Command*> * _commands; + static std::map<std::string,Command*> * _commandsByBestName; + static std::map<std::string,Command*> * _webCommands; public: // Stops all index builds required to run this command and returns index builds killed. virtual std::vector<BSONObj> stopIndexBuilds(Database* db, const BSONObj& cmdObj); - static const map<string,Command*>* commandsByBestName() { return _commandsByBestName; } - static const map<string,Command*>* webCommands() { return _webCommands; } + static const std::map<std::string,Command*>* commandsByBestName() { return _commandsByBestName; } + static const std::map<std::string,Command*>* webCommands() { return _webCommands; } /** @return if command was found */ static void runAgainstRegistered(const char *ns, BSONObj& jsobj, BSONObjBuilder& anObjBuilder, int queryOptions = 0); - static Command * findCommand( const string& name ); + static Command * findCommand( const std::string& name ); // For mongod and webserver. static void execCommand(OperationContext* txn, Command* c, diff --git a/src/mongo/db/commands/authentication_commands.h b/src/mongo/db/commands/authentication_commands.h index 0b4b0a3242a..096b66b9cab 100644 --- a/src/mongo/db/commands/authentication_commands.h +++ b/src/mongo/db/commands/authentication_commands.h @@ -44,17 +44,17 @@ namespace mongo { return true; } virtual bool isWriteCommandForConfigServer() const { return false; } - virtual void help(stringstream& ss) const { ss << "internal"; } + virtual void help(std::stringstream& ss) const { ss << "internal"; } virtual void addRequiredPrivileges(const std::string& dbname, const BSONObj& cmdObj, std::vector<Privilege>* out) {} // No auth required virtual void redactForLogging(mutablebson::Document* cmdObj); CmdAuthenticate() : Command("authenticate") {} - bool run(OperationContext* txn, const string& dbname, + bool run(OperationContext* txn, const std::string& dbname, BSONObj& cmdObj, int options, - string& errmsg, + std::string& errmsg, BSONObjBuilder& result, bool fromRepl); diff --git a/src/mongo/db/commands/dbhash.h b/src/mongo/db/commands/dbhash.h index 688ccada6a5..71885f17697 100644 --- a/src/mongo/db/commands/dbhash.h +++ b/src/mongo/db/commands/dbhash.h @@ -46,7 +46,7 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out); - virtual bool run(OperationContext* txn, const string& dbname , BSONObj& cmdObj, int, string& errmsg, BSONObjBuilder& result, bool); + virtual bool run(OperationContext* txn, const std::string& dbname , BSONObj& cmdObj, int, std::string& errmsg, BSONObjBuilder& result, bool); void wipeCacheForCollection( const StringData& ns ); @@ -54,9 +54,9 @@ namespace mongo { bool isCachable( const StringData& ns ) const; - string hashCollection( Database* db, const string& fullCollectionName, bool* fromCache ); + std::string hashCollection( Database* db, const std::string& fullCollectionName, bool* fromCache ); - map<string,string> _cachedHashed; + std::map<std::string,std::string> _cachedHashed; mutex _cachedHashedMutex; }; diff --git a/src/mongo/db/commands/mr.h b/src/mongo/db/commands/mr.h index 9eddac77efc..04d3c6b70d7 100644 --- a/src/mongo/db/commands/mr.h +++ b/src/mongo/db/commands/mr.h @@ -46,7 +46,7 @@ namespace mongo { namespace mr { - typedef vector<BSONObj> BSONList; + typedef std::vector<BSONObj> BSONList; class State; @@ -104,8 +104,8 @@ namespace mongo { ScriptingFunction func() const { return _func; } private: - string _type; - string _code; // actual javascript code + std::string _type; + std::string _code; // actual javascript code BSONObj _wantedScope; // this is for CodeWScope Scope * _scope; // this is not owned by us, and might be shared @@ -164,17 +164,17 @@ namespace mongo { } }; - typedef map< BSONObj,BSONList,TupleKeyCmp > InMemory; // from key to list of tuples + typedef std::map< BSONObj,BSONList,TupleKeyCmp > InMemory; // from key to list of tuples /** * holds map/reduce config information */ class Config { public: - Config( const string& _dbname , const BSONObj& cmdObj ); + Config( const std::string& _dbname , const BSONObj& cmdObj ); - string dbname; - string ns; + std::string dbname; + std::string ns; // options bool verbose; @@ -197,8 +197,8 @@ namespace mongo { BSONObj scopeSetup; // output tables - string incLong; - string tempNamespace; + std::string incLong; + std::string tempNamespace; enum OutputType { REPLACE , // atomically replace the collection @@ -207,15 +207,15 @@ namespace mongo { INMEMORY // only store in memory, limited in size }; struct OutputOptions { - string outDB; - string collectionName; - string finalNamespace; + std::string outDB; + std::string collectionName; + std::string finalNamespace; // if true, no lock during output operation bool outNonAtomic; OutputType outType; } outputOptions; - static OutputOptions parseOutputOptions(const string& dbname, const BSONObj& cmdObj); + static OutputOptions parseOutputOptions(const std::string& dbname, const BSONObj& cmdObj); // max number of keys allowed in JS map before switching mode long jsMaxKeys; @@ -310,7 +310,7 @@ namespace mongo { /** * inserts with correct replication semantics */ - void insert( const string& ns , const BSONObj& o ); + void insert( const std::string& ns , const BSONObj& o ); // ------ simple accessors ----- diff --git a/src/mongo/db/commands/server_status.h b/src/mongo/db/commands/server_status.h index b6313f28eba..adf761cc5a6 100644 --- a/src/mongo/db/commands/server_status.h +++ b/src/mongo/db/commands/server_status.h @@ -40,10 +40,10 @@ namespace mongo { class ServerStatusSection { public: - ServerStatusSection( const string& sectionName ); + ServerStatusSection( const std::string& sectionName ); virtual ~ServerStatusSection(){} - const string& getSectionName() const { return _sectionName; } + const std::string& getSectionName() const { return _sectionName; } /** * if this returns true, if the user doesn't mention this section @@ -77,12 +77,12 @@ namespace mongo { virtual BSONObj generateSection(const BSONElement& configElement) const = 0; private: - const string _sectionName; + const std::string _sectionName; }; class OpCounterServerStatusSection : public ServerStatusSection { public: - OpCounterServerStatusSection( const string& sectionName, OpCounters* counters ); + OpCounterServerStatusSection( const std::string& sectionName, OpCounters* counters ); virtual bool includeByDefault() const { return true; } virtual BSONObj generateSection(const BSONElement& configElement) const; diff --git a/src/mongo/db/commands/shutdown.h b/src/mongo/db/commands/shutdown.h index 3fdf347a50a..b782f4c58f6 100644 --- a/src/mongo/db/commands/shutdown.h +++ b/src/mongo/db/commands/shutdown.h @@ -47,12 +47,12 @@ namespace mongo { const BSONObj& cmdObj, std::vector<Privilege>* out); virtual bool isWriteCommandForConfigServer() const { return false; } - virtual void help( stringstream& help ) const; + virtual void help( std::stringstream& help ) const; CmdShutdown() : Command("shutdown") {} - bool run(OperationContext* txn, const string& dbname, + bool run(OperationContext* txn, const std::string& dbname, BSONObj& cmdObj, int options, - string& errmsg, + std::string& errmsg, BSONObjBuilder& result, bool fromRepl); private: diff --git a/src/mongo/db/commands/user_management_commands.h b/src/mongo/db/commands/user_management_commands.h index 6587e5e1f38..f9350f768ca 100644 --- a/src/mongo/db/commands/user_management_commands.h +++ b/src/mongo/db/commands/user_management_commands.h @@ -40,7 +40,7 @@ namespace mongo { virtual bool isWriteCommandForConfigServer() const; virtual bool slaveOk() const; virtual bool adminOnly() const; - virtual void help(stringstream& ss) const; + virtual void help(std::stringstream& ss) const; virtual Status checkAuthForCommand(ClientBasic* client, const std::string& dbname, diff --git a/src/mongo/db/commands/write_commands/write_commands.h b/src/mongo/db/commands/write_commands/write_commands.h index 42cbc3e7b87..c5f5da37cac 100644 --- a/src/mongo/db/commands/write_commands/write_commands.h +++ b/src/mongo/db/commands/write_commands/write_commands.h @@ -74,10 +74,10 @@ namespace mongo { // Write command entry point. virtual bool run( OperationContext* txn, - const string& dbname, + const std::string& dbname, BSONObj& cmdObj, int options, - string& errmsg, + std::string& errmsg, BSONObjBuilder& result, bool fromRepl); @@ -92,7 +92,7 @@ namespace mongo { void redactForLogging(mutablebson::Document* cmdObj); private: - virtual void help(stringstream& help) const; + virtual void help(std::stringstream& help) const; }; class CmdUpdate : public WriteCmd { @@ -102,7 +102,7 @@ namespace mongo { void redactForLogging(mutablebson::Document* cmdObj); private: - virtual void help(stringstream& help) const; + virtual void help(std::stringstream& help) const; }; class CmdDelete : public WriteCmd { @@ -112,7 +112,7 @@ namespace mongo { void redactForLogging(mutablebson::Document* cmdObj); private: - virtual void help(stringstream& help) const; + virtual void help(std::stringstream& help) const; }; } // namespace mongo diff --git a/src/mongo/db/curop.h b/src/mongo/db/curop.h index 60997afea88..4cc16c803f4 100644 --- a/src/mongo/db/curop.h +++ b/src/mongo/db/curop.h @@ -125,7 +125,7 @@ namespace mongo { void recordStats(); - string report( const CurOp& curop ) const; + std::string report( const CurOp& curop ) const; /** * Appends stored data and information from curop to the builder. @@ -173,7 +173,7 @@ namespace mongo { bool fastmodinsert; // upsert of an $operation. builds a default object bool upsert; // true if the update actually did an insert int keyUpdates; - ThreadSafeString planSummary; // a brief string describing the query solution + ThreadSafeString planSummary; // a brief std::string describing the query solution // New Query Framework debugging/profiling info // TODO: should this really be an opaque BSONObj? Not sure. @@ -291,12 +291,12 @@ namespace mongo { // Fetches less information than "info()"; used to search for ops with certain criteria BSONObj description(); - string getRemoteString( bool includePort = true ) { return _remote.toString(includePort); } + std::string getRemoteString( bool includePort = true ) { return _remote.toString(includePort); } ProgressMeter& setMessage(const char * msg, std::string name = "Progress", unsigned long long progressMeterTotal = 0, int secondsBetween = 3); - string getMessage() const { return _message.toString(); } + std::string getMessage() const { return _message.toString(); } ProgressMeter& getProgressMeter() { return _progressMeter; } CurOp *parent() const { return _wrapped; } void kill(bool* pNotifyFlag = NULL); diff --git a/src/mongo/db/d_concurrency.h b/src/mongo/db/d_concurrency.h index d2dc1f5688f..e51189c0129 100644 --- a/src/mongo/db/d_concurrency.h +++ b/src/mongo/db/d_concurrency.h @@ -175,7 +175,7 @@ namespace mongo { void lockTop(LockState&); void lockNestable(Nestable db); void lockOther(const StringData& db); - void lockDB(const string& ns); + void lockDB(const std::string& ns); void unlockDB(); protected: @@ -190,7 +190,7 @@ namespace mongo { bool _locked_w; bool _locked_W; WrapperForRWLock *_weLocked; - const string _what; + const std::string _what; bool _nested; }; @@ -199,7 +199,7 @@ namespace mongo { void lockTop(LockState&); void lockNestable(Nestable db); void lockOther(const StringData& db); - void lockDB(const string& ns); + void lockDB(const std::string& ns); void unlockDB(); protected: @@ -213,7 +213,7 @@ namespace mongo { private: bool _locked_r; WrapperForRWLock *_weLocked; - string _what; + std::string _what; bool _nested; }; diff --git a/src/mongo/db/dbhelpers.h b/src/mongo/db/dbhelpers.h index 76ef3271c91..758491e0297 100644 --- a/src/mongo/db/dbhelpers.h +++ b/src/mongo/db/dbhelpers.h @@ -91,7 +91,7 @@ namespace mongo { /** * have to be locked already */ - static vector<BSONObj> findAll( const string& ns , const BSONObj& query ); + static std::vector<BSONObj> findAll( const std::string& ns , const BSONObj& query ); /** * @param foundIndex if passed in will be set to 1 if ns and index found @@ -124,7 +124,7 @@ namespace mongo { * o has to have an _id field or will assert */ static void upsert( OperationContext* txn, - const string& ns, + const std::string& ns, const BSONObj& o, bool fromMigrate = false ); @@ -192,7 +192,7 @@ namespace mongo { */ static Status getLocsInRange( const KeyRange& range, long long maxChunkSizeBytes, - set<DiskLoc>* locs, + std::set<DiskLoc>* locs, long long* numDocs, long long* estChunkSizeBytes ); @@ -208,7 +208,7 @@ namespace mongo { */ class RemoveSaver : public boost::noncopyable { public: - RemoveSaver(const string& type, const string& ns, const string& why); + RemoveSaver(const std::string& type, const std::string& ns, const std::string& why); ~RemoveSaver(); void goingToDelete( const BSONObj& o ); @@ -216,7 +216,7 @@ namespace mongo { private: boost::filesystem::path _root; boost::filesystem::path _file; - ofstream* _out; + std::ofstream* _out; }; }; diff --git a/src/mongo/db/dbmessage.h b/src/mongo/db/dbmessage.h index 3e04dccd1ce..cc3df6cd787 100644 --- a/src/mongo/db/dbmessage.h +++ b/src/mongo/db/dbmessage.h @@ -57,20 +57,20 @@ namespace mongo { then for: dbInsert: - string collection; + std::string collection; a series of JSObjects dbDelete: - string collection; + std::string collection; int flags=0; // 1=DeleteSingle JSObject query; dbUpdate: - string collection; + std::string collection; int flags; // 1=upsert JSObject query; JSObject objectToUpdate; objectToUpdate may include { $inc: <field> } or { $set: ... }, see struct Mod. dbQuery: - string collection; + std::string collection; int nToSkip; int nToReturn; // how many you want back as the beginning of the cursor data (0=no limit) // greater than zero is simply a hint on how many objects to send back per "cursor batch". @@ -78,7 +78,7 @@ namespace mongo { JSObject query; [JSObject fieldsToReturn] dbGetMore: - string collection; // redundant, might use for security. + std::string collection; // redundant, might use for security. int nToReturn; int64 cursorID; dbKillCursors=2007: @@ -285,7 +285,7 @@ namespace mongo { struct DbResponse { Message *response; MSGID responseTo; - string exhaustNS; /* points to ns if exhaust mode. 0=normal mode*/ + std::string exhaustNS; /* points to ns if exhaust mode. 0=normal mode*/ DbResponse(Message *r, MSGID rt) : response(r), responseTo(rt){ } DbResponse() { response = 0; diff --git a/src/mongo/db/dbwebserver.h b/src/mongo/db/dbwebserver.h index 42e686b3315..87fd8958ab8 100644 --- a/src/mongo/db/dbwebserver.h +++ b/src/mongo/db/dbwebserver.h @@ -48,55 +48,55 @@ namespace mongo { class DbWebHandler : public Prioritizable { public: - DbWebHandler( const string& name , double priority , bool requiresREST ); + DbWebHandler( const std::string& name , double priority , bool requiresREST ); virtual ~DbWebHandler() {} - virtual bool handles( const string& url ) const { return url == _defaultUrl; } + virtual bool handles( const std::string& url ) const { return url == _defaultUrl; } - virtual bool requiresREST( const string& url ) const { return _requiresREST; } + virtual bool requiresREST( const std::string& url ) const { return _requiresREST; } virtual void handle( OperationContext* txn, const char *rq, // the full request const std::string& url, BSONObj params, // set these and return them: - string& responseMsg, + std::string& responseMsg, int& responseCode, - vector<string>& headers, // if completely empty, content-type: text/html will be added + std::vector<std::string>& headers, // if completely empty, content-type: text/html will be added const SockAddr &from ) = 0; - string toString() const { return _toString; } - static DbWebHandler * findHandler( const string& url ); + std::string toString() const { return _toString; } + static DbWebHandler * findHandler( const std::string& url ); private: - string _name; + std::string _name; bool _requiresREST; - string _defaultUrl; - string _toString; + std::string _defaultUrl; + std::string _toString; - static vector<DbWebHandler*> * _handlers; + static std::vector<DbWebHandler*> * _handlers; }; class WebStatusPlugin : public Prioritizable { public: - WebStatusPlugin( const string& secionName , double priority , const string& subheader = "" ); + WebStatusPlugin( const std::string& secionName , double priority , const std::string& subheader = "" ); virtual ~WebStatusPlugin() {} - virtual void run( stringstream& ss ) = 0; + virtual void run( std::stringstream& ss ) = 0; /** called when web server stats up */ virtual void init() = 0; static void initAll(); - static void runAll( stringstream& ss ); + static void runAll( std::stringstream& ss ); private: - string _name; - string _subHeading; - static vector<WebStatusPlugin*> * _plugins; + std::string _name; + std::string _subHeading; + static std::vector<WebStatusPlugin*> * _plugins; }; void webServerThread( const AdminAccess* admins, OperationContext::Factory transactionFactory ); - string prettyHostName(); + std::string prettyHostName(); }; diff --git a/src/mongo/db/diskloc.h b/src/mongo/db/diskloc.h index a085557138b..13daa5bf750 100644 --- a/src/mongo/db/diskloc.h +++ b/src/mongo/db/diskloc.h @@ -90,11 +90,11 @@ namespace mongo { } bool isValid() const { return _a != -2; } - string toString() const { + std::string toString() const { if ( isNull() ) return "null"; - stringstream ss; - ss << _a << ':' << hex << ofs; + std::stringstream ss; + ss << _a << ':' << std::hex << ofs; return ss.str(); } diff --git a/src/mongo/db/exec/2dcommon.h b/src/mongo/db/exec/2dcommon.h index a3a2c2a9ac2..6986e3d4a7b 100644 --- a/src/mongo/db/exec/2dcommon.h +++ b/src/mongo/db/exec/2dcommon.h @@ -94,7 +94,7 @@ namespace twod_exec { return _loc; } - string toString() const { + std::string toString() const { return str::stream() << "Point from " << _key << " - " << _o << " dist : " << _distance << (_exact ? " (ex)" : " (app)"); } @@ -152,7 +152,7 @@ namespace twod_exec { long long found() const { return _found; } virtual void getPointsFor(const BSONObj& key, const BSONObj& obj, - vector<BSONObj> &locsForNode, bool allPoints = false); + std::vector<BSONObj> &locsForNode, bool allPoints = false); virtual int addSpecific(const GeoIndexEntry& node, const Point& p, bool inBounds, double d, bool newDoc) = 0; @@ -161,7 +161,7 @@ namespace twod_exec { TwoDAccessMethod* _accessMethod; shared_ptr<GeoHashConverter> _converter; - map<DiskLoc, bool> _matched; + std::map<DiskLoc, bool> _matched; MatchExpression* _filter; @@ -185,7 +185,7 @@ namespace twod_exec { DONE } _state; - GeoBrowse(TwoDAccessMethod* accessMethod, string type, MatchExpression* filter); + GeoBrowse(TwoDAccessMethod* accessMethod, std::string type, MatchExpression* filter); virtual bool ok(); virtual bool advance(); @@ -234,9 +234,9 @@ namespace twod_exec { */ bool invalidate(const DiskLoc& dl); - string _type; - list<GeoPoint> _stack; - set<BSONObj> _seenIds; + std::string _type; + std::list<GeoPoint> _stack; + std::set<BSONObj> _seenIds; GeoPoint _cur; bool _firstCall; @@ -253,7 +253,7 @@ namespace twod_exec { GeoHash _prefix; shared_ptr<GeoHash> _lastPrefix; GeoHash _centerPrefix; - list<string> _fringe; + std::list<std::string> _fringe; int recurseDepth; Box _centerBox; @@ -262,7 +262,7 @@ namespace twod_exec { BtreeLocation _max; shared_ptr<GeoHash> _expPrefix; - mutable vector<GeoHash> _expPrefixes; + mutable std::vector<GeoHash> _expPrefixes; const IndexDescriptor* _descriptor; shared_ptr<GeoHashConverter> _converter; TwoDIndexingParams _params; diff --git a/src/mongo/db/exec/2dnear.h b/src/mongo/db/exec/2dnear.h index 5f23f541d93..f7bc255a3ef 100644 --- a/src/mongo/db/exec/2dnear.h +++ b/src/mongo/db/exec/2dnear.h @@ -138,7 +138,7 @@ namespace twod_exec { // Safe to use currently since we don't yield in $near searches. If we do start to yield, // we may need to replace dirtied disklocs in our holder / ensure our logic is correct. - map<DiskLoc, Holder::iterator> _seenPts; + std::map<DiskLoc, Holder::iterator> _seenPts; private: const Collection* _collection; @@ -172,7 +172,7 @@ namespace twod_exec { // Whether the current box overlaps our search area virtual double intersectsBox(Box& cur) { return cur.intersects(_want); } - set< pair<DiskLoc,int> > _seen; + std::set< std::pair<DiskLoc,int> > _seen; GeoHash _start; int _numWanted; double _scanDistance; diff --git a/src/mongo/db/exec/and_sorted.h b/src/mongo/db/exec/and_sorted.h index e8a88e78607..667638b684e 100644 --- a/src/mongo/db/exec/and_sorted.h +++ b/src/mongo/db/exec/and_sorted.h @@ -85,7 +85,7 @@ namespace mongo { const MatchExpression* _filter; // Owned by us. - vector<PlanStage*> _children; + std::vector<PlanStage*> _children; // The current node we're AND-ing against. size_t _targetNode; diff --git a/src/mongo/db/exec/distinct_scan.h b/src/mongo/db/exec/distinct_scan.h index 8b83100b8ad..381a77f99d7 100644 --- a/src/mongo/db/exec/distinct_scan.h +++ b/src/mongo/db/exec/distinct_scan.h @@ -122,8 +122,8 @@ namespace mongo { boost::scoped_ptr<IndexBoundsChecker> _checker; int _keyEltsToUse; bool _movePastKeyElts; - vector<const BSONElement*> _keyElts; - vector<bool> _keyEltsInc; + std::vector<const BSONElement*> _keyElts; + std::vector<bool> _keyEltsInc; // Stats CommonStats _commonStats; diff --git a/src/mongo/db/exec/index_scan.h b/src/mongo/db/exec/index_scan.h index 8e5f4697910..5a029e05990 100644 --- a/src/mongo/db/exec/index_scan.h +++ b/src/mongo/db/exec/index_scan.h @@ -136,8 +136,8 @@ namespace mongo { BtreeIndexCursor* _btreeCursor; int _keyEltsToUse; bool _movePastKeyElts; - vector<const BSONElement*> _keyElts; - vector<bool> _keyEltsInc; + std::vector<const BSONElement*> _keyElts; + std::vector<bool> _keyEltsInc; // Stats CommonStats _commonStats; diff --git a/src/mongo/db/exec/merge_sort.h b/src/mongo/db/exec/merge_sort.h index 7eeb54ae0d0..22adfd21fdf 100644 --- a/src/mongo/db/exec/merge_sort.h +++ b/src/mongo/db/exec/merge_sort.h @@ -88,7 +88,7 @@ namespace mongo { unordered_set<DiskLoc, DiskLoc::Hasher> _seen; // Owned by us. All the children we're reading from. - vector<PlanStage*> _children; + std::vector<PlanStage*> _children; // In order to pick the next smallest value, we need each child work(...) until it produces // a result. This is the queue of children that haven't given us a result yet. @@ -114,7 +114,7 @@ namespace mongo { }; // We have a priority queue of these. - typedef list<StageWithValue>::iterator MergingRef; + typedef std::list<StageWithValue>::iterator MergingRef; // The comparison function used in our priority queue. class StageWithValueComparison { @@ -132,10 +132,10 @@ namespace mongo { }; // The min heap of the results we're returning. - std::priority_queue<MergingRef, vector<MergingRef>, StageWithValueComparison> _merging; + std::priority_queue<MergingRef, std::vector<MergingRef>, StageWithValueComparison> _merging; // The data referred to by the _merging queue above. - list<StageWithValue> _mergingData; + std::list<StageWithValue> _mergingData; // Stats CommonStats _commonStats; diff --git a/src/mongo/db/exec/oplogstart.h b/src/mongo/db/exec/oplogstart.h index 7754ac1534a..c0f74573c48 100644 --- a/src/mongo/db/exec/oplogstart.h +++ b/src/mongo/db/exec/oplogstart.h @@ -111,7 +111,7 @@ namespace mongo { // WorkingSet is not owned by us. WorkingSet* _workingSet; - string _ns; + std::string _ns; MatchExpression* _filter; diff --git a/src/mongo/db/exec/or.h b/src/mongo/db/exec/or.h index fa765f67ea6..9382fbae7f8 100644 --- a/src/mongo/db/exec/or.h +++ b/src/mongo/db/exec/or.h @@ -68,7 +68,7 @@ namespace mongo { const MatchExpression* _filter; // Owned by us. - vector<PlanStage*> _children; + std::vector<PlanStage*> _children; // Which of _children are we calling work(...) on now? size_t _currentChild; diff --git a/src/mongo/db/exec/plan_stage.h b/src/mongo/db/exec/plan_stage.h index 304baf50bf5..b1f85499d2b 100644 --- a/src/mongo/db/exec/plan_stage.h +++ b/src/mongo/db/exec/plan_stage.h @@ -77,7 +77,7 @@ namespace mongo { * case PlanStage::ADVANCED: * // do something with result * WorkingSetMember* member = workingSet.get(result); - * cout << "Result: " << member->obj << endl; + * cout << "Result: " << member->obj << std::endl; * break; * case PlanStage::IS_EOF: * // All done. Will fall out of while loop. @@ -145,7 +145,7 @@ namespace mongo { NEED_FETCH, }; - static string stateStr(const StageState& state) { + static std::string stateStr(const StageState& state) { if (ADVANCED == state) { return "ADVANCED"; } diff --git a/src/mongo/db/exec/projection.h b/src/mongo/db/exec/projection.h index 8398eec6568..5284cfaac02 100644 --- a/src/mongo/db/exec/projection.h +++ b/src/mongo/db/exec/projection.h @@ -138,10 +138,10 @@ namespace mongo { // Field names can be empty in 2.4 and before so we can't use them as a sentinel value. // If the i-th entry is true we include the i-th field in the key. - vector<bool> _includeKey; + std::vector<bool> _includeKey; // If the i-th entry of _includeKey is true this is the field name for the i-th key field. - vector<StringData> _keyFieldNames; + std::vector<StringData> _keyFieldNames; }; } // namespace mongo diff --git a/src/mongo/db/exec/projection_exec.h b/src/mongo/db/exec/projection_exec.h index 9f3cb8f403b..7a4023b831e 100644 --- a/src/mongo/db/exec/projection_exec.h +++ b/src/mongo/db/exec/projection_exec.h @@ -96,12 +96,12 @@ namespace mongo { /** * Add 'field' as a field name that is included or excluded as part of the projection. */ - void add(const string& field, bool include); + void add(const std::string& field, bool include); /** * Add 'field' as a field name that is sliced as part of the projection. */ - void add(const string& field, int skip, int limit); + void add(const std::string& field, int skip, int limit); // // Execution @@ -156,7 +156,7 @@ namespace mongo { bool _special; // We must group projections with common prefixes together. - // TODO: benchmark vector<pair> vs map + // TODO: benchmark std::vector<pair> vs map // // Projection is a rooted tree. If we have {a.b: 1, a.c: 1} we don't want to // double-traverse the document when we're projecting it. Instead, we have an entry in @@ -177,7 +177,7 @@ namespace mongo { Matchers _matchers; // The matchers above point into BSONObjs and this is where those objs live. - vector<BSONObj> _elemMatchObjs; + std::vector<BSONObj> _elemMatchObjs; ArrayOpType _arrayOpType; diff --git a/src/mongo/db/exec/sort.h b/src/mongo/db/exec/sort.h index 4d232b188c1..f0ead740dc2 100644 --- a/src/mongo/db/exec/sort.h +++ b/src/mongo/db/exec/sort.h @@ -239,12 +239,12 @@ namespace mongo { // _dataSet is used instead to maintain an ordered set of the incomplete data set. // When the data set is complete, we copy the items from _dataSet to _data which will // be used to provide the results of this stage through _resultIterator. - vector<SortableDataItem> _data; + std::vector<SortableDataItem> _data; typedef std::set<SortableDataItem, WorkingSetComparator> SortableDataItemSet; scoped_ptr<SortableDataItemSet> _dataSet; // Iterates through _data post-sort returning it. - vector<SortableDataItem>::iterator _resultIterator; + std::vector<SortableDataItem>::iterator _resultIterator; // We buffer a lot of data and we want to look it up by DiskLoc quickly upon invalidation. typedef unordered_map<DiskLoc, WorkingSetID, DiskLoc::Hasher> DataMap; diff --git a/src/mongo/db/exec/working_set.h b/src/mongo/db/exec/working_set.h index 90ef451f75c..2cbdef90c15 100644 --- a/src/mongo/db/exec/working_set.h +++ b/src/mongo/db/exec/working_set.h @@ -115,7 +115,7 @@ namespace mongo { // All WorkingSetIDs are indexes into this, except for INVALID_ID. // Elements are added to _freeList rather than removed when freed. - vector<MemberHolder> _data; + std::vector<MemberHolder> _data; // Index into _data, forming a linked-list using MemberHolder::nextFreeOrSelf as the next // link. INVALID_ID is the list terminator since 0 is a valid index. @@ -221,7 +221,7 @@ namespace mongo { DiskLoc loc; BSONObj obj; - vector<IndexKeyDatum> keyData; + std::vector<IndexKeyDatum> keyData; MemberState state; bool hasLoc() const; @@ -246,7 +246,7 @@ namespace mongo { * * Returns false otherwise. Returning false indicates a query planning error. */ - bool getFieldDotted(const string& field, BSONElement* out) const; + bool getFieldDotted(const std::string& field, BSONElement* out) const; /** * Returns expected memory usage of working set member. diff --git a/src/mongo/db/extsort.h b/src/mongo/db/extsort.h index 76c032bf21d..071e4deaea7 100644 --- a/src/mongo/db/extsort.h +++ b/src/mongo/db/extsort.h @@ -36,7 +36,7 @@ namespace mongo { - typedef pair<BSONObj, DiskLoc> ExternalSortDatum; + typedef std::pair<BSONObj, DiskLoc> ExternalSortDatum; /** * To external sort, you provide a pointer to an implementation of this class. @@ -51,7 +51,7 @@ namespace mongo { // TODO This class will probably disappear in the future or be replaced with a typedef class BSONObjExternalSorter : boost::noncopyable { public: - typedef pair<BSONObj, DiskLoc> Data; + typedef std::pair<BSONObj, DiskLoc> Data; typedef SortIteratorInterface<BSONObj, DiskLoc> Iterator; BSONObjExternalSorter(const ExternalSortComparison* comp, long maxFileSize=100*1024*1024); @@ -60,7 +60,7 @@ namespace mongo { _sorter->add(o.getOwned(), loc); } - auto_ptr<Iterator> iterator() { return auto_ptr<Iterator>(_sorter->done()); } + std::auto_ptr<Iterator> iterator() { return std::auto_ptr<Iterator>(_sorter->done()); } // XXX: do we need this void sort() { } diff --git a/src/mongo/db/field_parser-inl.h b/src/mongo/db/field_parser-inl.h index 67a8ef4b436..cbcf75a504b 100644 --- a/src/mongo/db/field_parser-inl.h +++ b/src/mongo/db/field_parser-inl.h @@ -36,8 +36,8 @@ namespace mongo { template<class T> void _genFieldErrMsg(const BSONElement& elem, const BSONField<T>& field, - const string expected, - string* errMsg) + const std::string expected, + std::string* errMsg) { if (!errMsg) return; *errMsg = stream() << "wrong type for '" << field() << "' field, expected " << expected @@ -48,7 +48,7 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<T>& field, T* out, - string* errMsg) + std::string* errMsg) { BSONElement elem = doc[field.name()]; if (elem.eoo()) { @@ -77,12 +77,12 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<T*>& field, T** out, - string* errMsg) + std::string* errMsg) { BSONElement elem = doc[field.name()]; if (elem.eoo()) { if (field.hasDefault()) { - auto_ptr<T> temp(new T); + std::auto_ptr<T> temp(new T); field.getDefault()->cloneTo(temp.get()); *out = temp.release(); @@ -98,7 +98,7 @@ namespace mongo { return FIELD_INVALID; } - auto_ptr<T> temp(new T); + std::auto_ptr<T> temp(new T); if (!temp->parseBSON(elem.embeddedObject(), errMsg)) { return FIELD_INVALID; } @@ -111,7 +111,7 @@ namespace mongo { FieldParser::FieldState FieldParser::extract(BSONObj doc, const BSONField<T>& field, T** out, - string* errMsg) + std::string* errMsg) { BSONElement elem = doc[field.name()]; if (elem.eoo()) { @@ -134,7 +134,7 @@ namespace mongo { return FIELD_INVALID; } - auto_ptr<T> temp(new T); + std::auto_ptr<T> temp(new T); if (!temp->parseBSON(elem.embeddedObject(), errMsg)) { return FIELD_INVALID; } @@ -146,17 +146,17 @@ namespace mongo { // Extracts an array into a vector template<typename T> FieldParser::FieldState FieldParser::extract( BSONObj doc, - const BSONField<vector<T> >& field, - vector<T>* out, - string* errMsg ) { + const BSONField<std::vector<T> >& field, + std::vector<T>* out, + std::string* errMsg ) { return extract( doc[field.name()], field, out, errMsg ); } template<typename T> FieldParser::FieldState FieldParser::extract( BSONElement elem, - const BSONField<vector<T> >& field, - vector<T>* out, - string* errMsg ) + const BSONField<std::vector<T> >& field, + std::vector<T>* out, + std::string* errMsg ) { if (elem.eoo()) { if (field.hasDefault()) { @@ -170,7 +170,7 @@ namespace mongo { if (elem.type() == Array) { BSONArray arr = BSONArray(elem.embeddedObject()); - string elErrMsg; + std::string elErrMsg; // Append all the new elements to the end of the vector size_t initialSize = out->size(); @@ -208,9 +208,9 @@ namespace mongo { template<typename T> FieldParser::FieldState FieldParser::extract(BSONObj doc, - const BSONField<vector<T*> >& field, - vector<T*>* out, - string* errMsg) { + const BSONField<std::vector<T*> >& field, + std::vector<T*>* out, + std::string* errMsg) { dassert(!field.hasDefault()); BSONElement elem = doc[field.name()]; @@ -240,7 +240,7 @@ namespace mongo { return FIELD_INVALID; } - auto_ptr<T> toInsert(new T); + std::auto_ptr<T> toInsert(new T); if ( !toInsert->parseBSON( next.embeddedObject(), errMsg ) || !toInsert->isValid( errMsg ) ) { @@ -254,17 +254,17 @@ namespace mongo { } template<typename T> - void FieldParser::clearOwnedVector(vector<T*>* vec) { - for (typename vector<T*>::iterator it = vec->begin(); it != vec->end(); ++it) { + void FieldParser::clearOwnedVector(std::vector<T*>* vec) { + for (typename std::vector<T*>::iterator it = vec->begin(); it != vec->end(); ++it) { delete (*it); } } template<typename T> FieldParser::FieldState FieldParser::extract(BSONObj doc, - const BSONField<vector<T*> >& field, - vector<T*>** out, - string* errMsg) { + const BSONField<std::vector<T*> >& field, + std::vector<T*>** out, + std::string* errMsg) { dassert(!field.hasDefault()); BSONElement elem = doc[field.name()]; @@ -280,7 +280,7 @@ namespace mongo { return FIELD_INVALID; } - auto_ptr<vector<T*> > tempVector(new vector<T*>); + std::auto_ptr<std::vector<T*> > tempVector(new std::vector<T*>); BSONArray arr = BSONArray(elem.embeddedObject()); BSONObjIterator objIt(arr); @@ -297,7 +297,7 @@ namespace mongo { return FIELD_INVALID; } - auto_ptr<T> toInsert(new T); + std::auto_ptr<T> toInsert(new T); if (!toInsert->parseBSON(next.embeddedObject(), errMsg)) { clearOwnedVector(tempVector.get()); return FIELD_INVALID; @@ -313,17 +313,17 @@ namespace mongo { // Extracts an object into a map template<typename K, typename T> FieldParser::FieldState FieldParser::extract( BSONObj doc, - const BSONField<map<K, T> >& field, - map<K, T>* out, - string* errMsg ) { + const BSONField<std::map<K, T> >& field, + std::map<K, T>* out, + std::string* errMsg ) { return extract( doc[field.name()], field, out, errMsg ); } template<typename K, typename T> FieldParser::FieldState FieldParser::extract( BSONElement elem, - const BSONField<map<K, T> >& field, - map<K, T>* out, - string* errMsg ) + const BSONField<std::map<K, T> >& field, + std::map<K, T>* out, + std::string* errMsg ) { if (elem.eoo()) { if (field.hasDefault()) { @@ -337,7 +337,7 @@ namespace mongo { if (elem.type() == Object) { BSONObj obj = elem.embeddedObject(); - string elErrMsg; + std::string elErrMsg; BSONObjIterator objIt(obj); while (objIt.more()) { diff --git a/src/mongo/db/field_parser.h b/src/mongo/db/field_parser.h index cf3511cae92..a0897c16fdd 100644 --- a/src/mongo/db/field_parser.h +++ b/src/mongo/db/field_parser.h @@ -69,92 +69,92 @@ namespace mongo { static FieldState extract( BSONObj doc, const BSONField<bool>& field, bool* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<bool>& field, bool* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<BSONArray>& field, BSONArray* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<BSONArray>& field, BSONArray* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<BSONObj>& field, BSONObj* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<BSONObj>& field, BSONObj* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<Date_t>& field, Date_t* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<Date_t>& field, Date_t* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<OpTime>& field, OpTime* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<OpTime>& field, OpTime* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, - const BSONField<string>& field, - string* out, - string* errMsg = NULL ); + const BSONField<std::string>& field, + std::string* out, + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, - const BSONField<string>& field, - string* out, - string* errMsg = NULL ); + const BSONField<std::string>& field, + std::string* out, + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<OID>& field, OID* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<OID>& field, OID* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<int>& field, int* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<int>& field, int* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONObj doc, const BSONField<long long>& field, long long* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extract( BSONElement elem, const BSONField<long long>& field, long long* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); /** * The following extractNumber methods do implicit conversion between any numeric type and @@ -164,22 +164,22 @@ namespace mongo { static FieldState extractNumber( BSONObj doc, const BSONField<int>& field, int* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extractNumber( BSONElement elem, const BSONField<int>& field, int* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extractNumber( BSONObj doc, const BSONField<long long>& field, long long* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extractNumber( BSONElement elem, const BSONField<long long>& field, long long* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); /** * Extracts a document id from a particular field name, which may be of any type but Array. @@ -188,12 +188,12 @@ namespace mongo { static FieldState extractID( BSONObj doc, const BSONField<BSONObj>& field, BSONObj* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); static FieldState extractID( BSONElement elem, const BSONField<BSONObj>& field, BSONObj* out, - string* errMsg = NULL ); + std::string* errMsg = NULL ); // TODO: BSONElement extraction of types below @@ -209,13 +209,13 @@ namespace mongo { static FieldState extract(BSONObj doc, const BSONField<T>& field, T* out, - string* errMsg = NULL); + std::string* errMsg = NULL); template<typename T> static FieldState extract(BSONObj doc, const BSONField<T*>& field, T** out, - string* errMsg = NULL); + std::string* errMsg = NULL); /** * Similar to the mandatory 'extract' but on a optional field. '*out' would only be @@ -228,7 +228,7 @@ namespace mongo { static FieldState extract(BSONObj doc, const BSONField<T>& field, T** out, // alloc variation - string* errMsg = NULL); + std::string* errMsg = NULL); /** * Extracts a mandatory repetition of BSONSerializable structures, 'field', from the @@ -242,9 +242,9 @@ namespace mongo { */ template<typename T> static FieldState extract(BSONObj doc, - const BSONField<vector<T*> >& field, - vector<T*>* out, - string* errMsg = NULL); + const BSONField<std::vector<T*> >& field, + std::vector<T*>* out, + std::string* errMsg = NULL); /** * Similar to the mandatory repetition' extract but on an optional field. '*out' would @@ -257,9 +257,9 @@ namespace mongo { */ template<typename T> static FieldState extract(BSONObj doc, - const BSONField<vector<T*> >& field, - vector<T*>** out, - string* errMsg = NULL); + const BSONField<std::vector<T*> >& field, + std::vector<T*>** out, + std::string* errMsg = NULL); // // ==================== Below DEPRECATED; use types instead ==================== @@ -271,36 +271,36 @@ namespace mongo { * * It's possible to nest extraction of vectors and maps to any depth, i.e: * - * vector<map<string,vector<string> > > val; + * std::vector<map<std::string,vector<std::string> > > val; * FieldParser::extract(doc, field, val, &val); */ template<typename T> static FieldState extract( BSONObj doc, - const BSONField<vector<T> >& field, - vector<T>* out, - string* errMsg = NULL ); + const BSONField<std::vector<T> >& field, + std::vector<T>* out, + std::string* errMsg = NULL ); template<typename T> static FieldState extract( BSONElement elem, - const BSONField<vector<T> >& field, - vector<T>* out, - string* errMsg = NULL ); + const BSONField<std::vector<T> >& field, + std::vector<T>* out, + std::string* errMsg = NULL ); template<typename K, typename T> static FieldState extract( BSONObj doc, - const BSONField<map<K, T> >& field, - map<K, T>* out, - string* errMsg = NULL ); + const BSONField<std::map<K, T> >& field, + std::map<K, T>* out, + std::string* errMsg = NULL ); template<typename K, typename T> static FieldState extract( BSONElement elem, - const BSONField<map<K, T> >& field, - map<K, T>* out, - string* errMsg = NULL ); + const BSONField<std::map<K, T> >& field, + std::map<K, T>* out, + std::string* errMsg = NULL ); private: template<typename T> - static void clearOwnedVector(vector<T*>* vec); + static void clearOwnedVector(std::vector<T*>* vec); }; } // namespace mongo diff --git a/src/mongo/db/fts/fts_command.h b/src/mongo/db/fts/fts_command.h index 4dc84bfb6e8..4c0ced7efea 100644 --- a/src/mongo/db/fts/fts_command.h +++ b/src/mongo/db/fts/fts_command.h @@ -56,24 +56,24 @@ namespace mongo { std::vector<Privilege>* out); - bool run(OperationContext* txn, const string& dbname, + bool run(OperationContext* txn, const std::string& dbname, BSONObj& cmdObj, int options, - string& errmsg, + std::string& errmsg, BSONObjBuilder& result, bool fromRepl); protected: - bool _run( const string& dbName, + bool _run( const std::string& dbName, BSONObj& cmdObj, int cmdOptions, - const string& ns, - const string& searchString, - string language, // "" for not-set + const std::string& ns, + const std::string& searchString, + std::string language, // "" for not-set int limit, BSONObj& filter, BSONObj& projection, - string& errmsg, + std::string& errmsg, BSONObjBuilder& result ); }; diff --git a/src/mongo/db/fts/fts_index_format.h b/src/mongo/db/fts/fts_index_format.h index e7d64bc0479..75084e822ad 100644 --- a/src/mongo/db/fts/fts_index_format.h +++ b/src/mongo/db/fts/fts_index_format.h @@ -46,12 +46,12 @@ namespace mongo { /* * Helper method to get return entry from the FTSIndex as a BSONObj * @param weight, the weight of the term in the entry - * @param term, the string term in the entry + * @param term, the std::string term in the entry * @param indexPrefix, the fields that go in the index first * @param textIndexVersion, index version. affects key format. */ static BSONObj getIndexKey( double weight, - const string& term, + const std::string& term, const BSONObj& indexPrefix, TextIndexVersion textIndexVersion ); @@ -60,10 +60,10 @@ namespace mongo { * Helper method to get return entry from the FTSIndex as a BSONObj * @param b, reference to the BSONOBjBuilder * @param weight, the weight of the term in the entry - * @param term, the string term in the entry + * @param term, the std::string term in the entry * @param textIndexVersion, index version. affects key format. */ - static void _appendIndexKey( BSONObjBuilder& b, double weight, const string& term, + static void _appendIndexKey( BSONObjBuilder& b, double weight, const std::string& term, TextIndexVersion textIndexVersion ); }; diff --git a/src/mongo/db/fts/fts_language.h b/src/mongo/db/fts/fts_language.h index 3a7a471bc32..5877c8a2756 100644 --- a/src/mongo/db/fts/fts_language.h +++ b/src/mongo/db/fts/fts_language.h @@ -71,13 +71,13 @@ namespace mongo { FTSLanguage(); /** - * Returns the language as a string in canonical form (lowercased English name). It is + * Returns the language as a std::string in canonical form (lowercased English name). It is * an error to call str() on an uninitialized language. */ const std::string& str() const; /** - * Register string 'languageName' as a new language with text index version + * Register std::string 'languageName' as a new language with text index version * 'textIndexVersion'. Saves the resulting language to out-argument 'languageOut'. * Subsequent calls to FTSLanguage::make() will recognize the newly-registered language * string. @@ -97,7 +97,7 @@ namespace mongo { /** * Return the FTSLanguage associated with the given language string. Returns an error - * Status if an invalid language string is passed. + * Status if an invalid language std::string is passed. * * For textIndexVersion=TEXT_INDEX_VERSION_2, language strings are * case-insensitive, and need to be in one of the two following forms: @@ -114,7 +114,7 @@ namespace mongo { TextIndexVersion textIndexVersion ); private: - // String representation of language in canonical form. + // std::string representation of language in canonical form. std::string _canonicalName; }; diff --git a/src/mongo/db/fts/fts_matcher.h b/src/mongo/db/fts/fts_matcher.h index d32a92d11f9..3e3b971ddc3 100644 --- a/src/mongo/db/fts/fts_matcher.h +++ b/src/mongo/db/fts/fts_matcher.h @@ -52,7 +52,7 @@ namespace mongo { * so all full phrases and no negated */ bool phrasesMatch( const BSONObj& obj ) const; - bool phraseMatch( const string& phrase, const BSONObj& obj ) const; + bool phraseMatch( const std::string& phrase, const BSONObj& obj ) const; bool matchesNonTerm( const BSONObj& obj ) const { return !hasNegativeTerm( obj ) && phrasesMatch( obj ); @@ -62,12 +62,12 @@ namespace mongo { /** * @return true if raw has a negated term */ - bool _hasNegativeTerm_string( const FTSLanguage* language, const string& raw ) const; + bool _hasNegativeTerm_string( const FTSLanguage* language, const std::string& raw ) const; /** * @return true if raw has a phrase */ - bool _phraseMatches( const string& phrase, const string& raw ) const; + bool _phraseMatches( const std::string& phrase, const std::string& raw ) const; FTSQuery _query; FTSSpec _spec; diff --git a/src/mongo/db/fts/fts_query.h b/src/mongo/db/fts/fts_query.h index 953bdf15daf..1d8146c2ddc 100644 --- a/src/mongo/db/fts/fts_query.h +++ b/src/mongo/db/fts/fts_query.h @@ -49,13 +49,13 @@ namespace mongo { class FTSQuery { public: - Status parse(const string& query, const StringData& language); + Status parse(const std::string& query, const StringData& language); - const vector<string>& getTerms() const { return _terms; } - const set<string>& getNegatedTerms() const { return _negatedTerms; } + const std::vector<std::string>& getTerms() const { return _terms; } + const std::set<std::string>& getNegatedTerms() const { return _negatedTerms; } - const vector<string>& getPhr() const { return _phrases; } - const vector<string>& getNegatedPhr() const { return _negatedPhrases; } + const std::vector<std::string>& getPhr() const { return _phrases; } + const std::vector<std::string>& getNegatedPhr() const { return _negatedPhrases; } /** * @return true if any negations or phrase + or - @@ -67,25 +67,25 @@ namespace mongo { _negatedPhrases.size() > 0; } - string getSearch() const { return _search; } + std::string getSearch() const { return _search; } const FTSLanguage& getLanguage() const { return *_language; } - string toString() const; + std::string toString() const; - string debugString() const; + std::string debugString() const; BSONObj toBSON() const; protected: - string _search; + std::string _search; const FTSLanguage* _language; - vector<string> _terms; - set<string> _negatedTerms; - vector<string> _phrases; - vector<string> _negatedPhrases; + std::vector<std::string> _terms; + std::set<std::string> _negatedTerms; + std::vector<std::string> _phrases; + std::vector<std::string> _negatedPhrases; private: - void _addTerm( const StopWords* sw, Stemmer& stemmer, const string& term, bool negated ); + void _addTerm( const StopWords* sw, Stemmer& stemmer, const std::string& term, bool negated ); }; } diff --git a/src/mongo/db/fts/fts_spec.h b/src/mongo/db/fts/fts_spec.h index 8bc47fcbaad..7f6365002fb 100644 --- a/src/mongo/db/fts/fts_spec.h +++ b/src/mongo/db/fts/fts_spec.h @@ -49,8 +49,8 @@ namespace mongo { extern const double MAX_WORD_WEIGHT; extern const double DEFAULT_WEIGHT; - typedef std::map<string,double> Weights; // TODO cool map - typedef unordered_map<string,double> TermFrequencyMap; + typedef std::map<std::string,double> Weights; // TODO cool map + typedef unordered_map<std::string,double> TermFrequencyMap; struct ScoreHelperStruct { ScoreHelperStruct() @@ -60,7 +60,7 @@ namespace mongo { double count; double exp; }; - typedef unordered_map<string,ScoreHelperStruct> ScoreHelperMap; + typedef unordered_map<std::string,ScoreHelperStruct> ScoreHelperMap; class FTSSpec { @@ -82,7 +82,7 @@ namespace mongo { bool wildcard() const { return _wildcard; } const FTSLanguage& defaultLanguage() const { return *_defaultLanguage; } - const string& languageOverrideField() const { return _languageOverrideField; } + const std::string& languageOverrideField() const { return _languageOverrideField; } size_t numExtraBefore() const { return _extraBefore.size(); } const std::string& extraBefore( unsigned i ) const { return _extraBefore[i]; } @@ -161,17 +161,17 @@ namespace mongo { TextIndexVersion _textIndexVersion; const FTSLanguage* _defaultLanguage; - string _languageOverrideField; + std::string _languageOverrideField; bool _wildcard; // mapping : fieldname -> weight Weights _weights; // Prefix compound key - used to partition search index - std::vector<string> _extraBefore; + std::vector<std::string> _extraBefore; // Suffix compound key - used for covering index behavior - std::vector<string> _extraAfter; + std::vector<std::string> _extraAfter; }; } diff --git a/src/mongo/db/geo/core.h b/src/mongo/db/geo/core.h index ca4b7138be7..9ca48d86dd0 100644 --- a/src/mongo/db/geo/core.h +++ b/src/mongo/db/geo/core.h @@ -42,8 +42,8 @@ namespace mongo { inline double computeXScanDistance(double y, double maxDistDegrees) { // TODO: this overestimates for large maxDistDegrees far from the equator - return maxDistDegrees / min(cos(deg2rad(min(+89.0, y + maxDistDegrees))), - cos(deg2rad(max(-89.0, y - maxDistDegrees)))); + return maxDistDegrees / std::min(cos(deg2rad(std::min(+89.0, y + maxDistDegrees))), + cos(deg2rad(std::max(-89.0, y - maxDistDegrees)))); } } diff --git a/src/mongo/db/geo/geoquery.h b/src/mongo/db/geo/geoquery.h index 79a7c321673..13adcdfcba0 100644 --- a/src/mongo/db/geo/geoquery.h +++ b/src/mongo/db/geo/geoquery.h @@ -112,7 +112,7 @@ namespace mongo { maxDistance(std::numeric_limits<double>::max()), isNearSphere(false) { } - NearQuery(const string& f) + NearQuery(const std::string& f) : field(f), minDistance(0), maxDistance(std::numeric_limits<double>::max()), @@ -121,7 +121,7 @@ namespace mongo { Status parseFrom(const BSONObj &obj); // The name of the field that contains the geometry. - string field; + std::string field; // The starting point of the near search. PointWithCRS centroid; @@ -136,8 +136,8 @@ namespace mongo { // It's either $near or $nearSphere. bool isNearSphere; - string toString() const { - stringstream ss; + std::string toString() const { + std::stringstream ss; ss << " field=" << field; ss << " maxdist=" << maxDistance; ss << " isNearSphere=" << isNearSphere; @@ -153,7 +153,7 @@ namespace mongo { class GeoQuery { public: GeoQuery() : field(""), predicate(INVALID) {} - GeoQuery(const string& f) : field(f), predicate(INVALID) {} + GeoQuery(const std::string& f) : field(f), predicate(INVALID) {} enum Predicate { WITHIN, @@ -166,7 +166,7 @@ namespace mongo { bool hasS2Region() const; const S2Region& getRegion() const; - string getField() const { return field; } + std::string getField() const { return field; } Predicate getPred() const { return predicate; } const GeometryContainer& getGeometry() const { return geoContainer; } @@ -177,7 +177,7 @@ namespace mongo { bool parseNewQuery(const BSONObj &obj); // Name of the field in the query. - string field; + std::string field; GeometryContainer geoContainer; Predicate predicate; }; diff --git a/src/mongo/db/geo/hash.h b/src/mongo/db/geo/hash.h index b65dfbb78cb..e1a37f23555 100644 --- a/src/mongo/db/geo/hash.h +++ b/src/mongo/db/geo/hash.h @@ -48,7 +48,7 @@ namespace mongo { GeoHash(); // The strings are binary values of length <= 64, // examples: 1001010100101, 1 - explicit GeoHash(const string& hash); + explicit GeoHash(const std::string& hash); explicit GeoHash(const char *s); // bits is how many bits are used to hash each of x and y. GeoHash(unsigned x, unsigned y, unsigned bits = 32); @@ -70,8 +70,8 @@ namespace mongo { bool hasPrefix(const GeoHash& other) const; - string toString() const; - string toStringHex1() const; + std::string toString() const; + std::string toStringHex1() const; void setBit(unsigned pos, bool value); bool getBit(unsigned pos) const; @@ -117,7 +117,7 @@ namespace mongo { // XXX not sure why this is done exactly. Why does binary // data need to be reversed? byte ordering of some sort? static void _copyAndReverse(char *dst, const char *src); - // Create a hash from the provided string. Used by the string and char* cons. + // Create a hash from the provided string. Used by the std::string and char* cons. void initFromString(const char *s); /* Keep the upper _bits*2 bits of _hash, clear the lower bits. * Maybe there's junk in there? XXX Not sure why this is done. diff --git a/src/mongo/db/geo/s2common.h b/src/mongo/db/geo/s2common.h index 6cf07aa48b3..acee143c1d0 100644 --- a/src/mongo/db/geo/s2common.h +++ b/src/mongo/db/geo/s2common.h @@ -69,13 +69,13 @@ namespace mongo { double radius; - string toString() const { - stringstream ss; - ss << "maxKeysPerInsert: " << maxKeysPerInsert << endl; - ss << "maxCellsInCovering: " << maxCellsInCovering << endl; - ss << "finestIndexedLevel: " << finestIndexedLevel << endl; - ss << "coarsestIndexedLevel: " << coarsestIndexedLevel << endl; - ss << "indexVersion: " << indexVersion << endl; + std::string toString() const { + std::stringstream ss; + ss << "maxKeysPerInsert: " << maxKeysPerInsert << std::endl; + ss << "maxCellsInCovering: " << maxCellsInCovering << std::endl; + ss << "finestIndexedLevel: " << finestIndexedLevel << std::endl; + ss << "coarsestIndexedLevel: " << coarsestIndexedLevel << std::endl; + ss << "indexVersion: " << indexVersion << std::endl; return ss.str(); } @@ -91,7 +91,7 @@ namespace mongo { public: // Given a coverer, region, and field name, generate a BSONObj that we can pass to a // FieldRangeSet so that we only examine the keys that the provided region may intersect. - static BSONObj coverAsBSON(const vector<S2CellId> &cover, const string& field, + static BSONObj coverAsBSON(const std::vector<S2CellId> &cover, const std::string& field, const int coarsestIndexedLevel); static void setCoverLimitsBasedOnArea(double area, S2RegionCoverer *coverer, int coarsestIndexedLevel); static bool distanceBetween(const S2Point& us, const BSONObj& them, double *out); diff --git a/src/mongo/db/geo/shapes.h b/src/mongo/db/geo/shapes.h index 2f18f6731c2..6bd7ba3bd1d 100644 --- a/src/mongo/db/geo/shapes.h +++ b/src/mongo/db/geo/shapes.h @@ -54,7 +54,7 @@ namespace mongo { Point(double x, double y); explicit Point(const BSONElement& e); explicit Point(const BSONObj& o); - string toString() const; + std::string toString() const; double x; double y; @@ -75,7 +75,7 @@ namespace mongo { Box(Point min, Point max); BSONArray toBSON() const; - string toString() const; + std::string toString() const; bool between(double min, double max, double val, double fudge = 0) const; bool onBoundary(double bound, double val, double fudge = 0) const; @@ -98,7 +98,7 @@ namespace mongo { class Polygon { public: Polygon(); - Polygon(vector<Point> points); + Polygon(std::vector<Point> points); void add(Point p); int size() const; @@ -123,7 +123,7 @@ namespace mongo { Point _centroid; Box _bounds; bool _boundsCalculated; - vector<Point> _points; + std::vector<Point> _points; }; // Clearly this isn't right but currently it's sufficient. @@ -166,8 +166,8 @@ namespace mongo { }; struct MultiPointWithCRS { - vector<S2Point> points; - vector<S2Cell> cells; + std::vector<S2Point> points; + std::vector<S2Cell> cells; CRS crs; }; @@ -182,7 +182,7 @@ namespace mongo { }; struct GeometryCollection { - vector<PointWithCRS> points; + std::vector<PointWithCRS> points; // The amount of indirection here is painful but we can't operator= scoped_ptr or // OwnedPointerVector. diff --git a/src/mongo/db/index/2d_access_method.h b/src/mongo/db/index/2d_access_method.h index e8584bf0ae4..e7796ea0b4d 100644 --- a/src/mongo/db/index/2d_access_method.h +++ b/src/mongo/db/index/2d_access_method.h @@ -96,7 +96,7 @@ namespace mongo { TwoDIndexingParams& getParams() { return _params; } // This really gets the 'locs' from the provided obj. - void getKeys(const BSONObj& obj, vector<BSONObj>& locs) const; + void getKeys(const BSONObj& obj, std::vector<BSONObj>& locs) const; virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); diff --git a/src/mongo/db/index/2d_common.h b/src/mongo/db/index/2d_common.h index 1027a73c507..dd2dc6faff3 100644 --- a/src/mongo/db/index/2d_common.h +++ b/src/mongo/db/index/2d_common.h @@ -36,8 +36,8 @@ namespace mongo { struct TwoDIndexingParams { - string geo; - vector<pair<string, int> > other; + std::string geo; + std::vector<std::pair<std::string, int> > other; shared_ptr<GeoHashConverter> geoHashConverter; }; diff --git a/src/mongo/db/index/btree_based_access_method.h b/src/mongo/db/index/btree_based_access_method.h index cee96988710..decfbb0bc9a 100644 --- a/src/mongo/db/index/btree_based_access_method.h +++ b/src/mongo/db/index/btree_based_access_method.h @@ -139,7 +139,7 @@ namespace mongo { BSONObjSet oldKeys, newKeys; // These point into the sets oldKeys and newKeys. - vector<BSONObj*> removed, added; + std::vector<BSONObj*> removed, added; DiskLoc loc; bool dupsAllowed; diff --git a/src/mongo/db/index/btree_index_cursor.h b/src/mongo/db/index/btree_index_cursor.h index 721276338c9..e33eb68f432 100644 --- a/src/mongo/db/index/btree_index_cursor.h +++ b/src/mongo/db/index/btree_index_cursor.h @@ -55,8 +55,8 @@ namespace mongo { virtual Status seek(const BSONObj& position); // Btree-specific seeking functions. - Status seek(const vector<const BSONElement*>& position, - const vector<bool>& inclusive); + Status seek(const std::vector<const BSONElement*>& position, + const std::vector<bool>& inclusive); /** * Seek to the key 'position'. If 'afterKey' is true, seeks to the first @@ -69,8 +69,8 @@ namespace mongo { Status skip(const BSONObj& keyBegin, int keyBeginLen, bool afterKey, - const vector<const BSONElement*>& keyEnd, - const vector<bool>& keyEndInclusive); + const std::vector<const BSONElement*>& keyEnd, + const std::vector<bool>& keyEndInclusive); virtual BSONObj getKey() const; virtual DiskLoc getValue() const; @@ -87,7 +87,7 @@ namespace mongo { virtual Status restorePosition(); - virtual string toString(); + virtual std::string toString(); private: // We keep the constructor private and only allow the AM to create us. diff --git a/src/mongo/db/index/btree_key_generator.h b/src/mongo/db/index/btree_key_generator.h index f3d3dde39ff..df866e9870c 100644 --- a/src/mongo/db/index/btree_key_generator.h +++ b/src/mongo/db/index/btree_key_generator.h @@ -40,14 +40,14 @@ namespace mongo { */ class BtreeKeyGenerator { public: - BtreeKeyGenerator(vector<const char*> fieldNames, vector<BSONElement> fixed, bool isSparse); + BtreeKeyGenerator(std::vector<const char*> fieldNames, std::vector<BSONElement> fixed, bool isSparse); virtual ~BtreeKeyGenerator() { } Status getKeys(const BSONObj &obj, BSONObjSet *keys) const; protected: // These are used by the getKeysImpl(s) below. - vector<const char*> _fieldNames; + std::vector<const char*> _fieldNames; bool _isSparse; BSONObj _nullKey; // a full key with all fields null BSONObj _nullObj; // only used for _nullElt @@ -55,25 +55,25 @@ namespace mongo { BSONSizeTracker _sizeTracker; private: // We have V0 and V1. Sigh. - virtual Status getKeysImpl(vector<const char*> fieldNames, vector<BSONElement> fixed, + virtual Status getKeysImpl(std::vector<const char*> fieldNames, std::vector<BSONElement> fixed, const BSONObj &obj, BSONObjSet *keys) const = 0; - vector<BSONElement> _fixed; + std::vector<BSONElement> _fixed; }; class BtreeKeyGeneratorV0 : public BtreeKeyGenerator { public: - BtreeKeyGeneratorV0(vector<const char*> fieldNames, vector<BSONElement> fixed, + BtreeKeyGeneratorV0(std::vector<const char*> fieldNames, std::vector<BSONElement> fixed, bool isSparse); virtual ~BtreeKeyGeneratorV0() { } private: - virtual Status getKeysImpl(vector<const char*> fieldNames, vector<BSONElement> fixed, + virtual Status getKeysImpl(std::vector<const char*> fieldNames, std::vector<BSONElement> fixed, const BSONObj &obj, BSONObjSet *keys) const; }; class BtreeKeyGeneratorV1 : public BtreeKeyGenerator { public: - BtreeKeyGeneratorV1(vector<const char*> fieldNames, vector<BSONElement> fixed, + BtreeKeyGeneratorV1(std::vector<const char*> fieldNames, std::vector<BSONElement> fixed, bool isSparse); virtual ~BtreeKeyGeneratorV1() { } @@ -122,7 +122,7 @@ namespace mongo { * Returns the set of index keys generated from 'obj' according to the key pattern * in 'fieldNames' through the out-parameter 'keys'. */ - virtual Status getKeysImpl(vector<const char*> fieldNames, vector<BSONElement> fixed, + virtual Status getKeysImpl(std::vector<const char*> fieldNames, std::vector<BSONElement> fixed, const BSONObj &obj, BSONObjSet *keys) const; /** @@ -131,7 +131,7 @@ namespace mongo { */ Status getKeysForElement(const BSONElement& el, KeygenContext context, - vector<BSONElement>* out) const; + std::vector<BSONElement>* out) const; /** * getKeysForElement(...) delegates to this function if 'el' is an indexed array. Special @@ -139,7 +139,7 @@ namespace mongo { */ Status getKeysForArrayElement(const BSONElement& el, KeygenContext context, - vector<BSONElement>* out) const; + std::vector<BSONElement>* out) const; /** * A helper for getKeysForArrayElement(...) which handles key patterns that have a @@ -152,7 +152,7 @@ namespace mongo { Status handlePositionalKeypattern(const BSONElement& el, KeygenContext context, bool* isPositional, - vector<BSONElement>* out) const; + std::vector<BSONElement>* out) const; /** * getKeysForElement(...) delegates to this function if 'el' is neither an indexed @@ -160,7 +160,7 @@ namespace mongo { */ Status getKeysForSimpleElement(const BSONElement& el, KeygenContext context, - vector<BSONElement>* out) const; + std::vector<BSONElement>* out) const; /** * Outputs the final btree keys in 'keys', constructing them using the extracted @@ -216,7 +216,7 @@ namespace mongo { // [ [ "a", "b", "c" ], // [ "foo" ], // [ "bar", "0", "a" ] ] - typedef vector< vector<string> > KeyPattern; + typedef std::vector< std::vector<string> > KeyPattern; KeyPattern _keyPattern; // The BSONObj {"": undefined}. diff --git a/src/mongo/db/index/expression_index.h b/src/mongo/db/index/expression_index.h index 3806b1e1c4b..4797ea1ea36 100644 --- a/src/mongo/db/index/expression_index.h +++ b/src/mongo/db/index/expression_index.h @@ -71,14 +71,14 @@ namespace mongo { 2 + S2::kAvgEdge.GetClosestLevel(edgeLen))); coverer.set_max_level(4 + coverer.min_level()); - vector<S2CellId> cover; + std::vector<S2CellId> cover; coverer.GetCovering(region, &cover); // Look at the cells we cover and all cells that are within our covering and finer. // Anything with our cover as a strict prefix is contained within the cover and should // be intersection tested. bool considerCoarser = false; - set<string> intervalSet; + std::set<std::string> intervalSet; for (size_t i = 0; i < cover.size(); ++i) { intervalSet.insert(cover[i].toString()); // If any of our covers could be covered by something in the index, we have @@ -88,7 +88,7 @@ namespace mongo { } } - set<string> exactSet; + std::set<std::string> exactSet; if (considerCoarser) { // Look at the cells that cover us. We want to look at every cell that contains the // covering we would index on if we were to insert the query geometry. We generate @@ -113,18 +113,18 @@ namespace mongo { // We turned the cell IDs into strings which define point intervals or prefixes of // strings we want to look for. - set<string>::iterator exactIt = exactSet.begin(); - set<string>::iterator intervalIt = intervalSet.begin(); + std::set<std::string>::iterator exactIt = exactSet.begin(); + std::set<std::string>::iterator intervalIt = intervalSet.begin(); while (exactSet.end() != exactIt && intervalSet.end() != intervalIt) { - const string& exact = *exactIt; - const string& ival = *intervalIt; + const std::string& exact = *exactIt; + const std::string& ival = *intervalIt; if (exact < ival) { // add exact oilOut->intervals.push_back(IndexBoundsBuilder::makePointInterval(exact)); exactIt++; } else { - string end = ival; + std::string end = ival; end[end.size() - 1]++; oilOut->intervals.push_back( IndexBoundsBuilder::makeRangeInterval(ival, end, true, false)); @@ -142,8 +142,8 @@ namespace mongo { else if (intervalSet.end() != intervalIt) { verify(exactSet.end() == exactIt); do { - const string& ival = *intervalIt; - string end = ival; + const std::string& ival = *intervalIt; + std::string end = ival; end[end.size() - 1]++; oilOut->intervals.push_back( IndexBoundsBuilder::makeRangeInterval(ival, end, true, false)); @@ -154,7 +154,7 @@ namespace mongo { // Make sure that our intervals don't overlap each other and are ordered correctly. // This perhaps should only be done in debug mode. if (!oilOut->isValidFor(1)) { - cout << "check your assumptions! OIL = " << oilOut->toString() << endl; + cout << "check your assumptions! OIL = " << oilOut->toString() << std::endl; verify(0); } } diff --git a/src/mongo/db/index/expression_params.h b/src/mongo/db/index/expression_params.h index 90d294c5800..83e23f2778a 100644 --- a/src/mongo/db/index/expression_params.h +++ b/src/mongo/db/index/expression_params.h @@ -50,7 +50,7 @@ namespace mongo { if (e.isNumber()) { order = static_cast<int>(e.Number()); } - out->other.push_back(make_pair(e.fieldName(), order)); + out->other.push_back(std::make_pair(e.fieldName(), order)); } } @@ -72,7 +72,7 @@ namespace mongo { static void parseHashParams(const BSONObj& infoObj, HashSeed* seedOut, int* versionOut, - string* fieldOut) { + std::string* fieldOut) { // Default _seed to DEFAULT_HASH_SEED if "seed" is not included in the index spec // or if the value of "seed" is not a number @@ -101,8 +101,8 @@ namespace mongo { } static void parseHaystackParams(const BSONObj& infoObj, - string* geoFieldOut, - vector<string>* otherFieldsOut, + std::string* geoFieldOut, + std::vector<std::string>* otherFieldsOut, double* bucketSizeOut) { BSONElement e = infoObj["bucketSize"]; @@ -148,7 +148,7 @@ namespace mongo { "coarsestIndexedLevel", S2::kAvgEdge.GetClosestLevel(100 * 1000.0 / out->radius)); - static const string kIndexVersionFieldName("2dsphereIndexVersion"); + static const std::string kIndexVersionFieldName("2dsphereIndexVersion"); // Determine which version of this index we're using. If none was set in the descriptor, // assume S2_INDEX_VERSION_1 (alas, the first version predates the existence of the version @@ -171,14 +171,14 @@ namespace mongo { private: static double configValueWithDefaultDouble(const BSONObj& infoObj, - const string& name, + const std::string& name, double def) { BSONElement e = infoObj[name]; if (e.isNumber()) { return e.numberDouble(); } return def; } - static int configValueWithDefaultInt(const BSONObj& infoObj, const string& name, int def) { + static int configValueWithDefaultInt(const BSONObj& infoObj, const std::string& name, int def) { BSONElement e = infoObj[name]; if (e.isNumber()) { return e.numberInt(); } return def; diff --git a/src/mongo/db/index/hash_access_method.h b/src/mongo/db/index/hash_access_method.h index d0f46620334..e6e701158ce 100644 --- a/src/mongo/db/index/hash_access_method.h +++ b/src/mongo/db/index/hash_access_method.h @@ -57,7 +57,7 @@ namespace mongo { virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); // Only one of our fields is hashed. This is the field name for it. - string _hashedField; + std::string _hashedField; // _seed defaults to zero. HashSeed _seed; diff --git a/src/mongo/db/index/haystack_access_method.h b/src/mongo/db/index/haystack_access_method.h index 29b6485f7d2..82d8eccf6ef 100644 --- a/src/mongo/db/index/haystack_access_method.h +++ b/src/mongo/db/index/haystack_access_method.h @@ -66,8 +66,8 @@ namespace mongo { private: virtual void getKeys(const BSONObj& obj, BSONObjSet* keys); - string _geoField; - vector<string> _otherFields; + std::string _geoField; + std::vector<std::string> _otherFields; double _bucketSize; }; diff --git a/src/mongo/db/index/haystack_access_method_internal.h b/src/mongo/db/index/haystack_access_method_internal.h index c0ee96d2488..b1e8c11ec42 100644 --- a/src/mongo/db/index/haystack_access_method_internal.h +++ b/src/mongo/db/index/haystack_access_method_internal.h @@ -49,7 +49,7 @@ namespace mongo { GeoHaystackSearchHopper(const BSONObj& nearObj, double maxDistance, unsigned limit, - const string& geoField, + const std::string& geoField, const Collection* collection) : _collection(collection), _near(nearObj), @@ -83,8 +83,8 @@ namespace mongo { Point _near; double _maxDistance; unsigned _limit; - const string _geoField; - vector<DiskLoc> _locs; + const std::string _geoField; + std::vector<DiskLoc> _locs; }; } // namespace mongo diff --git a/src/mongo/db/index/index_cursor.h b/src/mongo/db/index/index_cursor.h index 6d50f243f7b..0100eb98184 100644 --- a/src/mongo/db/index/index_cursor.h +++ b/src/mongo/db/index/index_cursor.h @@ -120,8 +120,8 @@ namespace mongo { */ virtual Status restorePosition() = 0; - // Return a string describing the cursor. - virtual string toString() = 0; + // Return a std::string describing the cursor. + virtual std::string toString() = 0; /** * Add debugging info to the provided builder. diff --git a/src/mongo/db/index/index_descriptor.h b/src/mongo/db/index/index_descriptor.h index b3eb54aa6b1..ce1bb344644 100644 --- a/src/mongo/db/index/index_descriptor.h +++ b/src/mongo/db/index/index_descriptor.h @@ -141,13 +141,13 @@ namespace mongo { // Allow access to arbitrary fields in the per-index info object. Some indices stash // index-specific data there. - BSONElement getInfoElement(const string& name) const { return _infoObj[name]; } + BSONElement getInfoElement(const std::string& name) const { return _infoObj[name]; } // // "Internals" of accessing the index, used by IndexAccessMethod(s). // - // Return a (rather compact) string representation. + // Return a (rather compact) std::string representation. std::string toString() const { _checkOk(); return _infoObj.toString(); } // Return the info object. @@ -171,7 +171,7 @@ namespace mongo { return i.next().eoo(); } - static string makeIndexNamespace( const StringData& ns, + static std::string makeIndexNamespace( const StringData& ns, const StringData& name ) { return ns.toString() + ".$" + name.toString(); } diff --git a/src/mongo/db/index_names.h b/src/mongo/db/index_names.h index fd7af42675b..658ddd8459b 100644 --- a/src/mongo/db/index_names.h +++ b/src/mongo/db/index_names.h @@ -57,40 +57,40 @@ namespace mongo { }; /** - * We use the string representation of index names all over the place, so we declare them all + * We use the std::string representation of index names all over the place, so we declare them all * once here. */ class IndexNames { public: - static const string GEO_2D; - static const string GEO_HAYSTACK; - static const string GEO_2DSPHERE; - static const string TEXT; - static const string HASHED; - static const string BTREE; + static const std::string GEO_2D; + static const std::string GEO_HAYSTACK; + static const std::string GEO_2DSPHERE; + static const std::string TEXT; + static const std::string HASHED; + static const std::string BTREE; /** * True if is a regular (non-plugin) index or uses a plugin that existed before 2.4. * These plugins are grandfathered in and allowed to exist in DBs with * PDFILE_MINOR_VERSION_22_AND_OLDER */ - static bool existedBefore24(const string& name); + static bool existedBefore24(const std::string& name); /** - * Return the first string value in the provided object. For an index key pattern, + * Return the first std::string value in the provided object. For an index key pattern, * a field with a non-string value indicates a "special" (not straight Btree) index. */ - static string findPluginName(const BSONObj& keyPattern); + static std::string findPluginName(const BSONObj& keyPattern); /** * Is the provided access method name one we recognize? */ - static bool isKnownName(const string& name); + static bool isKnownName(const std::string& name); /** * Convert an index name to an IndexType. */ - static IndexType nameToType(const string& accessMethod); + static IndexType nameToType(const std::string& accessMethod); }; } // namespace mongo diff --git a/src/mongo/db/instance.h b/src/mongo/db/instance.h index e8ceb09d863..4433dcf517d 100644 --- a/src/mongo/db/instance.h +++ b/src/mongo/db/instance.h @@ -40,13 +40,13 @@ namespace mongo { - extern string dbExecCommand; + extern std::string dbExecCommand; /** a high level recording of operations to the database - sometimes used for diagnostics and debugging. */ class DiagLog { - ofstream *f; // note this is never freed + std::ofstream *f; // note this is never freed /* 0 = off; 1 = writes, 2 = reads, 3 = both 7 = log a few reads, and all writes. */ @@ -73,7 +73,7 @@ namespace mongo { DbResponse& dbresponse, const HostAndPort &client ); - void getDatabaseNames(vector<std::string> &names, + void getDatabaseNames(std::vector<std::string> &names, const std::string& usePath = storageGlobalParams.dbpath); /* returns true if there is no data on this server. useful when starting replication. @@ -91,7 +91,7 @@ namespace mongo { using DBClientBase::query; - virtual auto_ptr<DBClientCursor> query(const string &ns, Query query, int nToReturn = 0, int nToSkip = 0, + virtual std::auto_ptr<DBClientCursor> query(const std::string &ns, Query query, int nToReturn = 0, int nToSkip = 0, const BSONObj *fieldsToReturn = 0, int queryOptions = 0, int batchSize = 0); virtual bool isFailed() const { @@ -102,14 +102,14 @@ namespace mongo { return true; } - virtual string toString() const { + virtual std::string toString() const { return "DBDirectClient"; } - virtual string getServerAddress() const { + virtual std::string getServerAddress() const { return "localhost"; // TODO: should this have the port? } - virtual bool call( Message &toSend, Message &response, bool assertOk=true , string * actualServer = 0 ); - virtual void say( Message &toSend, bool isRetry = false , string * actualServer = 0 ); + virtual bool call( Message &toSend, Message &response, bool assertOk=true , std::string * actualServer = 0 ); + virtual void say( Message &toSend, bool isRetry = false , std::string * actualServer = 0 ); virtual void sayPiggyBack( Message &toSend ) { // don't need to piggy back when connected locally return say( toSend ); @@ -121,7 +121,7 @@ namespace mongo { return call( toSend , response ); } - virtual unsigned long long count(const string &ns, const BSONObj& query = BSONObj(), int options=0, int limit=0, int skip=0 ); + virtual unsigned long long count(const std::string &ns, const BSONObj& query = BSONObj(), int options=0, int limit=0, int skip=0 ); virtual ConnectionString::ConnectionType type() const { return ConnectionString::MASTER; } diff --git a/src/mongo/db/interrupt_status.h b/src/mongo/db/interrupt_status.h index 8aa418ced16..42087ac4c01 100644 --- a/src/mongo/db/interrupt_status.h +++ b/src/mongo/db/interrupt_status.h @@ -53,7 +53,7 @@ namespace mongo { /** Check for interrupt. - @returns a pointer to a string with additional information; will be + @returns a pointer to a std::string with additional information; will be "" if there hasn't been an interrupt. These strings are static and don't need to be freed. */ diff --git a/src/mongo/db/json.h b/src/mongo/db/json.h index 04c881fa77d..4df19f756d5 100644 --- a/src/mongo/db/json.h +++ b/src/mongo/db/json.h @@ -42,7 +42,7 @@ namespace mongo { * extensions extensions described here * <http://dochub.mongodb.org/core/mongodbextendedjson>, this function * accepts unquoted field names and allows single quotes to optionally be - * used when specifying field names and string values instead of double + * used when specifying field names and std::string values instead of double * quotes. JSON unicode escape sequences (of the form \uXXXX) are * converted to utf8. * @@ -130,13 +130,13 @@ namespace mongo { * context. */ /* * OIDOBJECT : - * { FIELD("$oid") : <24 character hex string> } + * { FIELD("$oid") : <24 character hex std::string> } */ Status objectIdObject(const StringData& fieldName, BSONObjBuilder&); /* * BINARYOBJECT : - * { FIELD("$binary") : <base64 representation of a binary string>, + * { FIELD("$binary") : <base64 representation of a binary std::string>, * FIELD("$type") : <hexadecimal representation of a single byte * indicating the data type> } */ @@ -169,9 +169,9 @@ namespace mongo { /* * REFOBJECT : * { FIELD("$ref") : <string representing collection name>, - * FIELD("$id") : <24 character hex string> } - * | { FIELD("$ref") : STRING , FIELD("$id") : OBJECTID } - * | { FIELD("$ref") : STRING , FIELD("$id") : OIDOBJECT } + * FIELD("$id") : <24 character hex std::string> } + * | { FIELD("$ref") : std::string , FIELD("$id") : OBJECTID } + * | { FIELD("$ref") : std::string , FIELD("$id") : OIDOBJECT } */ Status dbRefObject(const StringData& fieldName, BSONObjBuilder&); @@ -222,7 +222,7 @@ namespace mongo { /* * OBJECTID : - * ObjectId( <24 character hex string> ) + * ObjectId( <24 character hex std::string> ) */ Status objectId(const StringData& fieldName, BSONObjBuilder&); @@ -240,7 +240,7 @@ namespace mongo { /* * DBREF : - * Dbref( <namespace string> , <24 character hex string> ) + * Dbref( <namespace std::string> , <24 character hex std::string> ) */ Status dbRef(const StringData& fieldName, BSONObjBuilder&); @@ -304,7 +304,7 @@ namespace mongo { Status field(std::string* result); /* - * STRING : + * std::string : * " " * | ' ' * | " CHARS " @@ -317,7 +317,7 @@ namespace mongo { * CHAR * | CHAR CHARS * - * Note: " or ' may be allowed depending on whether the string is + * Note: " or ' may be allowed depending on whether the std::string is * double or single quoted * * CHAR : @@ -350,7 +350,7 @@ namespace mongo { /** * Converts the two byte Unicode code point to its UTF8 character - * encoding representation. This function returns a string because + * encoding representation. This function returns a std::string because * UTF8 encodings for code points from 0x0000 to 0xFFFF can range * from one to three characters. */ @@ -393,12 +393,12 @@ namespace mongo { bool match(char matchChar, const char* matchSet) const; /** - * @return true if every character in the string is a hex digit + * @return true if every character in the std::string is a hex digit */ bool isHexString(const StringData&) const; /** - * @return true if every character in the string is a valid base64 + * @return true if every character in the std::string is a valid base64 * character */ bool isBase64String(const StringData&) const; @@ -417,7 +417,7 @@ namespace mongo { * _input - cursor we advance in our input buffer * _input_end - sentinel for the end of our input buffer * - * _buf is the null terminated buffer containing the JSON string we + * _buf is the null terminated buffer containing the JSON std::string we * are parsing. _input_end points to the null byte at the end of * the buffer. strtoll, strtol, and strtod will access the null * byte at the end of the buffer because they are assuming a c-style diff --git a/src/mongo/db/keypattern.h b/src/mongo/db/keypattern.h index 3e0eebfb613..40454e3b672 100644 --- a/src/mongo/db/keypattern.h +++ b/src/mongo/db/keypattern.h @@ -45,7 +45,7 @@ namespace mongo { * and direction +1, one valid BoundList is: (1, 2); (4, 6). The same BoundList * would be valid for index {i:-1} with direction -1. */ - typedef vector<pair<BSONObj,BSONObj> > BoundList; + typedef std::vector<std::pair<BSONObj,BSONObj> > BoundList; /** A KeyPattern is an expression describing a transformation of a document into a * document key. Document keys are used to store documents in indices and to target @@ -132,7 +132,7 @@ namespace mongo { */ bool isCoveredBy( const KeyPattern& other ) const; - string toString() const{ return toBSON().toString(); } + std::string toString() const{ return toBSON().toString(); } /* Given a document, extracts the index key corresponding to this KeyPattern * Warning: assumes that there is a *single* key to be extracted! diff --git a/src/mongo/db/lasterror.h b/src/mongo/db/lasterror.h index 810b8e1bb87..45788c08ab2 100644 --- a/src/mongo/db/lasterror.h +++ b/src/mongo/db/lasterror.h @@ -139,7 +139,7 @@ namespace mongo { LastError * getSafe() { LastError * le = get(false); if ( ! le ) { - error() << " no LastError!" << endl; + error() << " no LastError!" << std::endl; verify( le ); } return le; diff --git a/src/mongo/db/lockstate.h b/src/mongo/db/lockstate.h index 042134229a2..96ec94e8f3b 100644 --- a/src/mongo/db/lockstate.h +++ b/src/mongo/db/lockstate.h @@ -80,7 +80,7 @@ namespace mongo { int nestableCount() const { return _nestableCount; } int otherCount() const { return _otherCount; } - const string& otherName() const { return _otherName; } + const std::string& otherName() const { return _otherName; } WrapperForRWLock* otherLock() const { return _otherLock; } void enterScopedLock( Lock::ScopedLock* lock ); @@ -108,7 +108,7 @@ namespace mongo { int _nestableCount; // recursive lock count on local or admin db XXX - change name int _otherCount; // >0 means write lock, <0 read lock - XXX change name - string _otherName; // which database are we locking and working with (besides local/admin) + std::string _otherName; // which database are we locking and working with (besides local/admin) WrapperForRWLock* _otherLock; // so we don't have to check the map too often (the map has a mutex) // for temprelease @@ -129,7 +129,7 @@ namespace mongo { bool sharedLatching; LockStat stats; public: - string name() const { return rw.name; } + std::string name() const { return rw.name; } LockStat& getStats() { return stats; } WrapperForRWLock(const StringData& name) diff --git a/src/mongo/db/matcher/expression.h b/src/mongo/db/matcher/expression.h index 8f37a6a7c62..1970b4bfd6f 100644 --- a/src/mongo/db/matcher/expression.h +++ b/src/mongo/db/matcher/expression.h @@ -190,7 +190,7 @@ namespace mongo { // // Debug information // - virtual string toString() const; + virtual std::string toString() const; virtual void debugString( StringBuilder& debug, int level = 0 ) const = 0; protected: diff --git a/src/mongo/db/matcher/expression_leaf.h b/src/mongo/db/matcher/expression_leaf.h index b7d88d06d14..8a843dd7703 100644 --- a/src/mongo/db/matcher/expression_leaf.h +++ b/src/mongo/db/matcher/expression_leaf.h @@ -208,8 +208,8 @@ namespace mongo { virtual bool equivalent( const MatchExpression* other ) const; - const string& getString() const { return _regex; } - const string& getFlags() const { return _flags; } + const std::string& getString() const { return _regex; } + const std::string& getFlags() const { return _flags; } private: std::string _regex; diff --git a/src/mongo/db/matcher/expression_text.h b/src/mongo/db/matcher/expression_text.h index 5842cdc3293..4fc603d9c61 100644 --- a/src/mongo/db/matcher/expression_text.h +++ b/src/mongo/db/matcher/expression_text.h @@ -51,8 +51,8 @@ namespace mongo { virtual LeafMatchExpression* shallowClone() const; - const string& getQuery() const { return _query; } - const string& getLanguage() const { return _language; } + const std::string& getQuery() const { return _query; } + const std::string& getLanguage() const { return _language; } private: std::string _query; std::string _language; diff --git a/src/mongo/db/matcher/path.h b/src/mongo/db/matcher/path.h index 5e0d17a8cf7..8fdf8ed2a11 100644 --- a/src/mongo/db/matcher/path.h +++ b/src/mongo/db/matcher/path.h @@ -143,7 +143,7 @@ namespace mongo { bool isArrayOffsetMatch( const StringData& fieldName ) const; bool nextEntireRest() const { return nextPieceOfPath.size() == restOfPath.size(); } - string restOfPath; + std::string restOfPath; bool hasMore; StringData nextPieceOfPath; bool nextPieceOfPathIsNumber; diff --git a/src/mongo/db/matcher/path_internal.h b/src/mongo/db/matcher/path_internal.h index bf0163f8d31..1e06d618b27 100644 --- a/src/mongo/db/matcher/path_internal.h +++ b/src/mongo/db/matcher/path_internal.h @@ -40,7 +40,7 @@ namespace mongo { bool isAllDigits( const StringData& str ); // XXX document me - // Replaces getFieldDottedOrArray without recursion nor string manipulation + // Replaces getFieldDottedOrArray without recursion nor std::string manipulation BSONElement getFieldDottedOrArray( const BSONObj& doc, const FieldRef& path, size_t* idxPath ); diff --git a/src/mongo/db/namespace_string.h b/src/mongo/db/namespace_string.h index fe864955992..0639c686dc5 100644 --- a/src/mongo/db/namespace_string.h +++ b/src/mongo/db/namespace_string.h @@ -207,7 +207,7 @@ namespace mongo { /** * NamespaceDBHash and NamespaceDBEquals allow you to do something like - * unordered_map<string,int,NamespaceDBHash,NamespaceDBEquals> + * unordered_map<std::string,int,NamespaceDBHash,NamespaceDBEquals> * and use the full namespace for the string * but comparisons are done only on the db piece */ diff --git a/src/mongo/db/ops/count.h b/src/mongo/db/ops/count.h index 5cfe801f979..94384529d6c 100644 --- a/src/mongo/db/ops/count.h +++ b/src/mongo/db/ops/count.h @@ -40,6 +40,6 @@ namespace mongo { * @return -1 on ns does not exist error and other errors, 0 on other errors, otherwise the * match count. */ - long long runCount(const std::string& ns, const BSONObj& cmd, string& err, int& errCode ); + long long runCount(const std::string& ns, const BSONObj& cmd, std::string& err, int& errCode ); } // namespace mongo diff --git a/src/mongo/db/ops/update_driver.h b/src/mongo/db/ops/update_driver.h index 28ca13d80d2..29a702a1917 100644 --- a/src/mongo/db/ops/update_driver.h +++ b/src/mongo/db/ops/update_driver.h @@ -147,7 +147,7 @@ namespace mongo { bool _replacementMode; // Collection of update mod instances. Owned here. - vector<ModifierInterface*> _mods; + std::vector<ModifierInterface*> _mods; // What are the list of fields in the collection over which the update is going to be // applied that participate in indices? 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; diff --git a/src/mongo/db/projection.h b/src/mongo/db/projection.h index d71f106ac14..b36ff7b88aa 100644 --- a/src/mongo/db/projection.h +++ b/src/mongo/db/projection.h @@ -52,18 +52,18 @@ namespace mongo { BSONObj hydrate( const BSONObj& key ) const; void addNo() { _add( false , "" ); } - void addYes( const string& name ) { _add( true , name ); } + void addYes( const std::string& name ) { _add( true , name ); } private: - void _add( bool b , const string& name ) { + void _add( bool b , const std::string& name ) { _include.push_back( b ); _names.push_back( name ); _stringSize += name.size(); } - vector<bool> _include; // one entry per field in key. true iff should be in output - vector<string> _names; // name of field since key doesn't have names + std::vector<bool> _include; // one entry per field in key. true iff should be in output + std::vector<std::string> _names; // name of field since key doesn't have names int _stringSize; }; @@ -129,7 +129,7 @@ namespace mongo { * Validate the given query satisfies this projection's positional operator. * NOTE: this function is only used to validate projections with a positional operator. * @param query User-supplied query specifier - * @return Field name if found, empty string otherwise. + * @return Field name if found, empty std::string otherwise. */ void validateQuery( const BSONObj query ) const; @@ -142,14 +142,14 @@ namespace mongo { void append( BSONObjBuilder& b , const BSONElement& e, const MatchDetails* details = NULL, const ArrayOpType arrayOpType = ARRAY_OP_NORMAL ) const; - void add( const string& field, bool include ); - void add( const string& field, int skip, int limit ); + void add( const std::string& field, bool include ); + void add( const std::string& field, int skip, int limit ); void appendArray( BSONObjBuilder& b , const BSONObj& a , bool nested=false) const; bool _include; // true if default at this level is to include bool _special; // true if this level can't be skipped or included without recursing - //TODO: benchmark vector<pair> vs map + //TODO: benchmark std::vector<pair> vs map typedef StringMap<boost::shared_ptr<Projection> > FieldMap; FieldMap _fields; BSONObj _source; diff --git a/src/mongo/db/query/canonical_query.h b/src/mongo/db/query/canonical_query.h index 8c3db4ed204..d4c7626e816 100644 --- a/src/mongo/db/query/canonical_query.h +++ b/src/mongo/db/query/canonical_query.h @@ -67,13 +67,13 @@ namespace mongo { const MatchExpressionParser::WhereCallback& whereCallback = MatchExpressionParser::WhereCallback()); - static Status canonicalize(const string& ns, + static Status canonicalize(const std::string& ns, const BSONObj& query, CanonicalQuery** out, const MatchExpressionParser::WhereCallback& whereCallback = MatchExpressionParser::WhereCallback()); - static Status canonicalize(const string& ns, + static Status canonicalize(const std::string& ns, const BSONObj& query, long long skip, long long limit, @@ -81,7 +81,7 @@ namespace mongo { const MatchExpressionParser::WhereCallback& whereCallback = MatchExpressionParser::WhereCallback()); - static Status canonicalize(const string& ns, + static Status canonicalize(const std::string& ns, const BSONObj& query, const BSONObj& sort, const BSONObj& proj, @@ -89,7 +89,7 @@ namespace mongo { const MatchExpressionParser::WhereCallback& whereCallback = MatchExpressionParser::WhereCallback()); - static Status canonicalize(const string& ns, + static Status canonicalize(const std::string& ns, const BSONObj& query, const BSONObj& sort, const BSONObj& proj, @@ -99,7 +99,7 @@ namespace mongo { const MatchExpressionParser::WhereCallback& whereCallback = MatchExpressionParser::WhereCallback()); - static Status canonicalize(const string& ns, + static Status canonicalize(const std::string& ns, const BSONObj& query, const BSONObj& sort, const BSONObj& proj, @@ -110,7 +110,7 @@ namespace mongo { const MatchExpressionParser::WhereCallback& whereCallback = MatchExpressionParser::WhereCallback()); - static Status canonicalize(const string& ns, + static Status canonicalize(const std::string& ns, const BSONObj& query, const BSONObj& sort, const BSONObj& proj, @@ -132,7 +132,7 @@ namespace mongo { static bool isSimpleIdQuery(const BSONObj& query); // What namespace is this query over? - const string& ns() const { return _pq->ns(); } + const std::string& ns() const { return _pq->ns(); } // // Accessors for the query diff --git a/src/mongo/db/query/explain_plan.h b/src/mongo/db/query/explain_plan.h index 7ffbd489914..1a25dbb9322 100644 --- a/src/mongo/db/query/explain_plan.h +++ b/src/mongo/db/query/explain_plan.h @@ -68,7 +68,7 @@ namespace mongo { TypeExplain** explain); /** - * Returns a short plan summary string describing the leaves of the query solution. + * Returns a short plan summary std::string describing the leaves of the query solution. * * Used for logging. */ diff --git a/src/mongo/db/query/index_bounds.h b/src/mongo/db/query/index_bounds.h index 8bf955aadaf..b5236d2d4e4 100644 --- a/src/mongo/db/query/index_bounds.h +++ b/src/mongo/db/query/index_bounds.h @@ -41,13 +41,13 @@ namespace mongo { */ struct OrderedIntervalList { OrderedIntervalList() { } - OrderedIntervalList(const string& n) : name(n) { } + OrderedIntervalList(const std::string& n) : name(n) { } // Must be ordered according to the index order. - vector<Interval> intervals; + std::vector<Interval> intervals; // TODO: We could drop this. Only used in IndexBounds::isValidFor. - string name; + std::string name; bool isValidFor(int expectedOrientation) const; std::string toString() const; @@ -74,7 +74,7 @@ namespace mongo { IndexBounds() : isSimpleRange(false), endKeyInclusive(false) { } // For each indexed field, the values that the field is allowed to take on. - vector<OrderedIntervalList> fields; + std::vector<OrderedIntervalList> fields; // Debugging check. // We must have as many fields the key pattern does. @@ -121,7 +121,7 @@ namespace mongo { * * Returns true if there is a valid start key. Returns false otherwise. */ - bool getStartKey(vector<const BSONElement*>* valueOut, vector<bool>* inclusiveOut); + bool getStartKey(std::vector<const BSONElement*>* valueOut, std::vector<bool>* inclusiveOut); /** * The states of a key from an index scan. See checkKey below. @@ -179,7 +179,7 @@ namespace mongo { * If the i-th element is true, seek to the i-th element of out. */ KeyState checkKey(const BSONObj& key, int* keyEltsToUse, bool* movePastKeyElts, - vector<const BSONElement*>* out, vector<bool>* incOut); + std::vector<const BSONElement*>* out, std::vector<bool>* incOut); /** * Relative position of a key to an interval. @@ -217,7 +217,7 @@ namespace mongo { * 'where' is the leftmost field that isn't in the interval we think it is. * 'what' is the orientation of the field with respect to that interval. */ - bool findLeftmostProblem(const vector<BSONElement>& keyValues, size_t* where, + bool findLeftmostProblem(const std::vector<BSONElement>& keyValues, size_t* where, Location* what); /** @@ -226,16 +226,16 @@ namespace mongo { * * keyValues are the elements of the index key in order. */ - bool spaceLeftToAdvance(size_t fieldsToCheck, const vector<BSONElement>& keyValues); + bool spaceLeftToAdvance(size_t fieldsToCheck, const std::vector<BSONElement>& keyValues); // The actual bounds. Must outlive this object. Not owned by us. const IndexBounds* _bounds; // For each field, which interval are we currently in? - vector<size_t> _curInterval; + std::vector<size_t> _curInterval; // Direction of scan * direction of indexing. - vector<int> _expectedDirection; + std::vector<int> _expectedDirection; }; } // namespace mongo diff --git a/src/mongo/db/query/index_bounds_builder.h b/src/mongo/db/query/index_bounds_builder.h index dceed96bc61..2e760ed663c 100644 --- a/src/mongo/db/query/index_bounds_builder.h +++ b/src/mongo/db/query/index_bounds_builder.h @@ -104,8 +104,8 @@ namespace mongo { bool startInclusive, bool endInclusive); - static Interval makeRangeInterval(const string& start, - const string& end, + static Interval makeRangeInterval(const std::string& start, + const std::string& end, bool startInclusive, bool endInclusive); @@ -114,7 +114,7 @@ namespace mongo { * The object must have exactly one field which is the value of the point interval. */ static Interval makePointInterval(const BSONObj& obj); - static Interval makePointInterval(const string& str); + static Interval makePointInterval(const std::string& str); static Interval makePointInterval(double d); /** @@ -131,13 +131,13 @@ namespace mongo { /** * Copied almost verbatim from db/queryutil.cpp. * - * returns a string that when used as a matcher, would match a super set of regex() + * returns a std::string that when used as a matcher, would match a super set of regex() * * returns "" for complex regular expressions * * used to optimize queries in some simple regex cases that start with '^' */ - static string simpleRegex(const char* regex, + static std::string simpleRegex(const char* regex, const char* flags, BoundsTightness* tightnessOut); diff --git a/src/mongo/db/query/index_entry.h b/src/mongo/db/query/index_entry.h index 9e81e78ee85..f69ca28fc5f 100644 --- a/src/mongo/db/query/index_entry.h +++ b/src/mongo/db/query/index_entry.h @@ -43,10 +43,10 @@ namespace mongo { * Use this constructor if you're making an IndexEntry from the catalog. */ IndexEntry(const BSONObj& kp, - const string& accessMethod, + const std::string& accessMethod, bool mk, bool sp, - const string& n, + const std::string& n, const BSONObj& io) : keyPattern(kp), multikey(mk), @@ -63,7 +63,7 @@ namespace mongo { IndexEntry(const BSONObj& kp, bool mk, bool sp, - const string& n, + const std::string& n, const BSONObj& io) : keyPattern(kp), multikey(mk), @@ -93,7 +93,7 @@ namespace mongo { bool sparse; - string name; + std::string name; // Geo indices have extra parameters. We need those available to plan correctly. BSONObj infoObj; diff --git a/src/mongo/db/query/index_tag.h b/src/mongo/db/query/index_tag.h index 060bf7212cc..9fb115c818d 100644 --- a/src/mongo/db/query/index_tag.h +++ b/src/mongo/db/query/index_tag.h @@ -73,7 +73,7 @@ namespace mongo { // root. We do this once and store it. // TODO: Do a FieldRef / StringData pass. // TODO: We might want this inside of the MatchExpression. - string path; + std::string path; // Points to the innermost containing $elemMatch. If this tag is // attached to an expression not contained in an $elemMatch, then diff --git a/src/mongo/db/query/interval.h b/src/mongo/db/query/interval.h index 1d3e156af4a..e4f82da8088 100644 --- a/src/mongo/db/query/interval.h +++ b/src/mongo/db/query/interval.h @@ -52,7 +52,7 @@ namespace mongo { /** Creates an empty interval */ Interval(); - string toString() const { + std::string toString() const { mongoutils::str::stream ss; if (startInclusive) { ss << "["; @@ -165,7 +165,7 @@ namespace mongo { /** * toString for IntervalComparison */ - static string cmpstr(IntervalComparison c); + static std::string cmpstr(IntervalComparison c); // // Mutation of intervals diff --git a/src/mongo/db/query/lite_parsed_query.h b/src/mongo/db/query/lite_parsed_query.h index e99a073e950..a03ef36f54f 100644 --- a/src/mongo/db/query/lite_parsed_query.h +++ b/src/mongo/db/query/lite_parsed_query.h @@ -52,7 +52,7 @@ namespace mongo { * Fills out a LiteParsedQuery. Used for debugging and testing, when we don't have a * QueryMessage. */ - static Status make(const string& ns, + static Status make(const std::string& ns, int ntoskip, int ntoreturn, int queryoptions, @@ -115,17 +115,17 @@ namespace mongo { static BSONObj normalizeSortOrder(const BSONObj& sortObj); // Names of the maxTimeMS command and query option. - static const string cmdOptionMaxTimeMS; - static const string queryOptionMaxTimeMS; + static const std::string cmdOptionMaxTimeMS; + static const std::string queryOptionMaxTimeMS; // Names of the $meta projection values. - static const string metaTextScore; - static const string metaGeoNearDistance; - static const string metaGeoNearPoint; - static const string metaDiskLoc; - static const string metaIndexKey; + static const std::string metaTextScore; + static const std::string metaGeoNearDistance; + static const std::string metaGeoNearPoint; + static const std::string metaDiskLoc; + static const std::string metaIndexKey; - const string& ns() const { return _ns; } + const std::string& ns() const { return _ns; } bool isLocalDB() const { return _ns.compare(0, 6, "local.") == 0; } const BSONObj& getFilter() const { return _filter; } @@ -153,14 +153,14 @@ namespace mongo { private: LiteParsedQuery(); - Status init(const string& ns, int ntoskip, int ntoreturn, int queryOptions, + Status init(const std::string& ns, int ntoskip, int ntoreturn, int queryOptions, const BSONObj& queryObj, const BSONObj& proj, bool fromQueryMessage); Status initFullQuery(const BSONObj& top); static StatusWith<int> parseMaxTimeMS(const BSONElement& maxTimeMSElt); - string _ns; + std::string _ns; int _ntoskip; int _ntoreturn; BSONObj _filter; diff --git a/src/mongo/db/query/parsed_projection.h b/src/mongo/db/query/parsed_projection.h index 0bcd51756a7..64c6b9d70ba 100644 --- a/src/mongo/db/query/parsed_projection.h +++ b/src/mongo/db/query/parsed_projection.h @@ -64,7 +64,7 @@ namespace mongo { * If requiresDocument() == false, what fields are required to compute * the projection? */ - const vector<string>& getRequiredFields() const { + const std::vector<std::string>& getRequiredFields() const { return _requiredFields; } @@ -114,7 +114,7 @@ namespace mongo { const std::string& matchfield); // TODO: stringdata? - vector<string> _requiredFields; + std::vector<std::string> _requiredFields; bool _requiresDocument; diff --git a/src/mongo/db/query/plan_cache.h b/src/mongo/db/query/plan_cache.h index 402633c8c5b..84dbab1fa34 100644 --- a/src/mongo/db/query/plan_cache.h +++ b/src/mongo/db/query/plan_cache.h @@ -85,7 +85,7 @@ namespace mongo { PlanCacheIndexTree() : entry(NULL), index_pos(0) { } ~PlanCacheIndexTree() { - for (vector<PlanCacheIndexTree*>::const_iterator it = children.begin(); + for (std::vector<PlanCacheIndexTree*>::const_iterator it = children.begin(); it != children.end(); ++it) { delete *it; } diff --git a/src/mongo/db/query/plan_enumerator.h b/src/mongo/db/query/plan_enumerator.h index 8cccbab61c8..5f27a6ebbf1 100644 --- a/src/mongo/db/query/plan_enumerator.h +++ b/src/mongo/db/query/plan_enumerator.h @@ -53,7 +53,7 @@ namespace mongo { MatchExpression* root; // Not owned here. - const vector<IndexEntry>* indices; + const std::vector<IndexEntry>* indices; // How many plans are we willing to ouput from an OR? We currently consider // all possibly OR plans, which means the product of the number of possibilities @@ -176,7 +176,7 @@ namespace mongo { struct PredicateAssignment { PredicateAssignment() : indexToAssign(0) { } - vector<IndexID> first; + std::vector<IndexID> first; // Not owned here. MatchExpression* expr; @@ -193,7 +193,7 @@ namespace mongo { // subsequent state it just asks all its children to move their states forward. // Must use all of subnodes. - vector<MemoID> subnodes; + std::vector<MemoID> subnodes; // The number of OR states that we've enumerated so far. size_t counter; @@ -202,20 +202,20 @@ namespace mongo { // This is used by AndAssignment and is not an actual assignment. struct OneIndexAssignment { // 'preds[i]' is uses index 'index' at position 'positions[i]' - vector<MatchExpression*> preds; - vector<IndexPosition> positions; + std::vector<MatchExpression*> preds; + std::vector<IndexPosition> positions; IndexID index; }; struct AndEnumerableState { - vector<OneIndexAssignment> assignments; - vector<MemoID> subnodesToIndex; + std::vector<OneIndexAssignment> assignments; + std::vector<MemoID> subnodesToIndex; }; struct AndAssignment { AndAssignment() : counter(0) { } - vector<AndEnumerableState> choices; + std::vector<AndEnumerableState> choices; // We're on the counter-th member of state. size_t counter; @@ -223,7 +223,7 @@ namespace mongo { struct ArrayAssignment { ArrayAssignment() : counter(0) { } - vector<MemoID> subnodes; + std::vector<MemoID> subnodes; size_t counter; }; @@ -235,7 +235,7 @@ namespace mongo { scoped_ptr<OrAssignment> orAssignment; scoped_ptr<AndAssignment> andAssignment; scoped_ptr<ArrayAssignment> arrayAssignment; - string toString() const; + std::string toString() const; }; /** @@ -268,9 +268,9 @@ namespace mongo { */ bool partitionPreds(MatchExpression* node, PrepMemoContext context, - vector<MatchExpression*>* indexOut, - vector<MemoID>* subnodesOut, - vector<MemoID>* mandatorySubnodes); + std::vector<MatchExpression*>* indexOut, + std::vector<MemoID>* subnodesOut, + std::vector<MemoID>* mandatorySubnodes); /** * Finds a set of predicates that can be safely compounded with the set @@ -334,9 +334,9 @@ namespace mongo { * and then not assign the $near because the $within is already assigned (and * has the same path). */ - void getMultikeyCompoundablePreds(const vector<MatchExpression*>& assigned, - const vector<MatchExpression*>& couldCompound, - vector<MatchExpression*>* out); + void getMultikeyCompoundablePreds(const std::vector<MatchExpression*>& assigned, + const std::vector<MatchExpression*>& couldCompound, + std::vector<MatchExpression*>* out); /** * 'andAssignment' contains assignments that we've already committed to outputting, @@ -357,12 +357,12 @@ namespace mongo { * and notice that we have already assigned this same set of predicates to * the single index {a: 1, b: 1} via compounding. */ - bool alreadyCompounded(const set<MatchExpression*>& ixisectAssigned, + bool alreadyCompounded(const std::set<MatchExpression*>& ixisectAssigned, const AndAssignment* andAssignment); /** * Output index intersection assignments inside of an AND node. */ - typedef unordered_map<IndexID, vector<MatchExpression*> > IndexToPredMap; + typedef unordered_map<IndexID, std::vector<MatchExpression*> > IndexToPredMap; /** * Generate index intersection assignments given the predicate/index structure in idxToFirst @@ -371,7 +371,7 @@ namespace mongo { */ void enumerateAndIntersect(const IndexToPredMap& idxToFirst, const IndexToPredMap& idxToNotFirst, - const vector<MemoID>& subnodes, + const std::vector<MemoID>& subnodes, AndAssignment* andAssignment); /** @@ -381,7 +381,7 @@ namespace mongo { */ void enumerateOneIndex(const IndexToPredMap& idxToFirst, const IndexToPredMap& idxToNotFirst, - const vector<MemoID>& subnodes, + const std::vector<MemoID>& subnodes, AndAssignment* andAssignment); /** @@ -399,7 +399,7 @@ namespace mongo { * Try to assign predicates in 'tryCompound' to 'thisIndex' as compound assignments. * Output the assignments in 'assign'. */ - void compound(const vector<MatchExpression*>& tryCompound, + void compound(const std::vector<MatchExpression*>& tryCompound, const IndexEntry& thisIndex, OneIndexAssignment* assign); @@ -429,7 +429,7 @@ namespace mongo { MatchExpression* _root; // Indices we're allowed to enumerate with. Not owned here. - const vector<IndexEntry>* _indices; + const std::vector<IndexEntry>* _indices; // Do we output >1 index per AND (index intersection)? bool _ixisect; diff --git a/src/mongo/db/query/plan_ranker.h b/src/mongo/db/query/plan_ranker.h index 41049febbfc..8ffdece195b 100644 --- a/src/mongo/db/query/plan_ranker.h +++ b/src/mongo/db/query/plan_ranker.h @@ -53,7 +53,7 @@ namespace mongo { * Caller owns pointers in 'why'. * 'candidateOrder' holds indices into candidates ordered by score (winner in first element). */ - static size_t pickBestPlan(const vector<CandidatePlan>& candidates, + static size_t pickBestPlan(const std::vector<CandidatePlan>& candidates, PlanRankingDecision* why); /** diff --git a/src/mongo/db/query/planner_access.h b/src/mongo/db/query/planner_access.h index 71dd60d9f39..43300261fd4 100644 --- a/src/mongo/db/query/planner_access.h +++ b/src/mongo/db/query/planner_access.h @@ -140,7 +140,7 @@ namespace mongo { static QuerySolutionNode* buildIndexedDataAccess(const CanonicalQuery& query, MatchExpression* root, bool inArrayOperator, - const vector<IndexEntry>& indices); + const std::vector<IndexEntry>& indices); /** * Takes ownership of 'root'. @@ -148,7 +148,7 @@ namespace mongo { static QuerySolutionNode* buildIndexedAnd(const CanonicalQuery& query, MatchExpression* root, bool inArrayOperator, - const vector<IndexEntry>& indices); + const std::vector<IndexEntry>& indices); /** * Takes ownership of 'root'. @@ -156,7 +156,7 @@ namespace mongo { static QuerySolutionNode* buildIndexedOr(const CanonicalQuery& query, MatchExpression* root, bool inArrayOperator, - const vector<IndexEntry>& indices); + const std::vector<IndexEntry>& indices); /** * Traverses the tree rooted at the $elemMatch expression 'node', @@ -170,8 +170,8 @@ namespace mongo { * tagged to use an index. */ static void findElemMatchChildren(const MatchExpression* node, - vector<MatchExpression*>* out, - vector<MatchExpression*>* subnodesOut); + std::vector<MatchExpression*>* out, + std::vector<MatchExpression*>* subnodesOut); /** * Helper used by buildIndexedAnd and buildIndexedOr. @@ -189,8 +189,8 @@ namespace mongo { static bool processIndexScans(const CanonicalQuery& query, MatchExpression* root, bool inArrayOperator, - const vector<IndexEntry>& indices, - vector<QuerySolutionNode*>* out); + const std::vector<IndexEntry>& indices, + std::vector<QuerySolutionNode*>* out); // // Helpers for creating an index scan. diff --git a/src/mongo/db/query/planner_ixselect.h b/src/mongo/db/query/planner_ixselect.h index a68837af352..ca385bd35fa 100644 --- a/src/mongo/db/query/planner_ixselect.h +++ b/src/mongo/db/query/planner_ixselect.h @@ -46,15 +46,15 @@ namespace mongo { * The 'prefix' argument is a path prefix to be prepended to any fields mentioned in * predicates encountered. Some array operators specify a path prefix. */ - static void getFields(MatchExpression* node, string prefix, unordered_set<string>* out); + static void getFields(MatchExpression* node, std::string prefix, unordered_set<std::string>* out); /** * Find all indices prefixed by fields we have predicates over. Only these indices are * useful in answering the query. */ - static void findRelevantIndices(const unordered_set<string>& fields, - const vector<IndexEntry>& indices, - vector<IndexEntry>* out); + static void findRelevantIndices(const unordered_set<std::string>& fields, + const std::vector<IndexEntry>& indices, + std::vector<IndexEntry>* out); /** * Return true if the index key pattern field 'elt' (which belongs to 'index') can be used @@ -84,8 +84,8 @@ namespace mongo { * original predicate by having an AND as a parent. */ static void rateIndices(MatchExpression* node, - string prefix, - const vector<IndexEntry>& indices); + std::string prefix, + const std::vector<IndexEntry>& indices); /** * Amend the RelevantTag lists for all predicates in the subtree rooted at 'node' to remove @@ -94,7 +94,7 @@ namespace mongo { * See the body of this function and the specific stripInvalidAssignments functions for details. */ static void stripInvalidAssignments(MatchExpression* node, - const vector<IndexEntry>& indices); + const std::vector<IndexEntry>& indices); private: /** @@ -129,7 +129,7 @@ namespace mongo { * those annotations get removed here. */ static void stripInvalidAssignmentsToTextIndexes(MatchExpression* node, - const vector<IndexEntry>& indices); + const std::vector<IndexEntry>& indices); /** * For V1 2dsphere indices we ignore the sparse option. As such we can use an index @@ -149,7 +149,7 @@ namespace mongo { * predicate on every geo field in the index. */ static void stripInvalidAssignmentsTo2dsphereIndices(MatchExpression* node, - const vector<IndexEntry>& indices); + const std::vector<IndexEntry>& indices); }; } // namespace mongo diff --git a/src/mongo/db/query/query_planner.h b/src/mongo/db/query/query_planner.h index e314e1f132c..151c7278728 100644 --- a/src/mongo/db/query/query_planner.h +++ b/src/mongo/db/query/query_planner.h @@ -102,7 +102,7 @@ namespace mongo { * On failure, 'out' is set to NULL. */ static Status cacheDataFromTaggedTree(const MatchExpression* const taggedTree, - const vector<IndexEntry>& relevantIndices, + const std::vector<IndexEntry>& relevantIndices, PlanCacheIndexTree** out); /** @@ -124,7 +124,7 @@ namespace mongo { */ static Status tagAccordingToCache(MatchExpression* filter, const PlanCacheIndexTree* const indexTree, - const map<BSONObj, size_t>& indexMap); + const std::map<BSONObj, size_t>& indexMap); }; } // namespace mongo diff --git a/src/mongo/db/query/query_planner_common.h b/src/mongo/db/query/query_planner_common.h index e1c858ab98c..2caa2545be3 100644 --- a/src/mongo/db/query/query_planner_common.h +++ b/src/mongo/db/query/query_planner_common.h @@ -95,7 +95,7 @@ namespace mongo { } else { for (size_t i = 0; i < isn->bounds.fields.size(); ++i) { - vector<Interval>& iv = isn->bounds.fields[i].intervals; + std::vector<Interval>& iv = isn->bounds.fields[i].intervals; // Step 1: reverse the list. std::reverse(iv.begin(), iv.end()); // Step 2: reverse each interval. @@ -106,7 +106,7 @@ namespace mongo { } if (!isn->bounds.isValidFor(isn->indexKeyPattern, isn->direction)) { - QLOG() << "Invalid bounds: " << isn->bounds.toString() << endl; + QLOG() << "Invalid bounds: " << isn->bounds.toString() << std::endl; verify(0); } diff --git a/src/mongo/db/query/query_planner_params.h b/src/mongo/db/query/query_planner_params.h index 6d51291f1fb..38429bd014d 100644 --- a/src/mongo/db/query/query_planner_params.h +++ b/src/mongo/db/query/query_planner_params.h @@ -88,7 +88,7 @@ namespace mongo { size_t options; // What indices are available for planning? - vector<IndexEntry> indices; + std::vector<IndexEntry> indices; // What's our shard key? If INCLUDE_SHARD_FILTER is set we will create a shard filtering // stage. If we know the shard key, we can perform covering analysis instead of always diff --git a/src/mongo/db/query/query_planner_test_lib.h b/src/mongo/db/query/query_planner_test_lib.h index 9c7d7eb9caf..8e4b9abdeab 100644 --- a/src/mongo/db/query/query_planner_test_lib.h +++ b/src/mongo/db/query/query_planner_test_lib.h @@ -53,7 +53,7 @@ namespace mongo { */ static bool solutionMatches(const BSONObj& testSoln, const QuerySolutionNode* trueSoln); - static bool solutionMatches(const string& testSoln, const QuerySolutionNode* trueSoln) { + static bool solutionMatches(const std::string& testSoln, const QuerySolutionNode* trueSoln) { return solutionMatches(fromjson(testSoln), trueSoln); } }; diff --git a/src/mongo/db/query/query_solution.h b/src/mongo/db/query/query_solution.h index 45908539398..6000c823528 100644 --- a/src/mongo/db/query/query_solution.h +++ b/src/mongo/db/query/query_solution.h @@ -53,9 +53,9 @@ namespace mongo { } /** - * Return a string representation of this node and any children. + * Return a std::string representation of this node and any children. */ - string toString() const; + std::string toString() const; /** * What stage should this be transcribed to? See stage_types.h. @@ -103,7 +103,7 @@ namespace mongo { * * TODO: 'field' is probably more appropriate as a FieldRef or string. */ - virtual bool hasField(const string& field) const = 0; + virtual bool hasField(const std::string& field) const = 0; /** * Returns true if the tree rooted at this node provides data that is sorted by the @@ -143,7 +143,7 @@ namespace mongo { } // These are owned here. - vector<QuerySolutionNode*> children; + std::vector<QuerySolutionNode*> children; // If a stage has a non-NULL filter all values outputted from that stage must pass that // filter. @@ -199,9 +199,9 @@ namespace mongo { boost::scoped_ptr<SolutionCacheData> cacheData; /** - * Output a human-readable string representing the plan. + * Output a human-readable std::string representing the plan. */ - string toString() { + std::string toString() { if (NULL == root) { return "empty query solution"; } @@ -224,7 +224,7 @@ namespace mongo { // text's return is LOC_AND_UNOWNED_OBJ so it's fetched and has all fields. bool fetched() const { return true; } - bool hasField(const string& field) const { return true; } + bool hasField(const std::string& field) const { return true; } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sort; } @@ -251,7 +251,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return true; } - bool hasField(const string& field) const { return true; } + bool hasField(const std::string& field) const { return true; } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sort; } @@ -260,7 +260,7 @@ namespace mongo { BSONObjSet _sort; // Name of the namespace. - string name; + std::string name; // Should we make a tailable cursor? bool tailable; @@ -280,7 +280,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const; - bool hasField(const string& field) const; + bool hasField(const std::string& field) const; bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return children.back()->getSort(); } @@ -298,7 +298,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const; - bool hasField(const string& field) const; + bool hasField(const std::string& field) const; bool sortedByDiskLoc() const { return true; } const BSONObjSet& getSort() const { return _sort; } @@ -316,7 +316,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const; - bool hasField(const string& field) const; + bool hasField(const std::string& field) const; bool sortedByDiskLoc() const { // Even if our children are sorted by their diskloc or other fields, we don't maintain // any order on the output. @@ -340,7 +340,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const; - bool hasField(const string& field) const; + bool hasField(const std::string& field) const; bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sorts; } @@ -370,7 +370,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return true; } - bool hasField(const string& field) const { return true; } + bool hasField(const std::string& field) const { return true; } bool sortedByDiskLoc() const { return children[0]->sortedByDiskLoc(); } const BSONObjSet& getSort() const { return children[0]->getSort(); } @@ -390,7 +390,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return false; } - bool hasField(const string& field) const; + bool hasField(const std::string& field) const; bool sortedByDiskLoc() const; const BSONObjSet& getSort() const { return _sorts; } @@ -448,7 +448,7 @@ namespace mongo { */ bool fetched() const { return true; } - bool hasField(const string& field) const { + bool hasField(const std::string& field) const { // TODO: Returning false isn't always the right answer -- we may either be including // certain fields, or we may be dropping fields (in which case hasField returns true). // @@ -502,7 +502,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return children[0]->fetched(); } - bool hasField(const string& field) const { return children[0]->hasField(field); } + bool hasField(const std::string& field) const { return children[0]->hasField(field); } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sorts; } @@ -536,7 +536,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return children[0]->fetched(); } - bool hasField(const string& field) const { return children[0]->hasField(field); } + bool hasField(const std::string& field) const { return children[0]->hasField(field); } bool sortedByDiskLoc() const { return children[0]->sortedByDiskLoc(); } const BSONObjSet& getSort() const { return children[0]->getSort(); } @@ -553,7 +553,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return children[0]->fetched(); } - bool hasField(const string& field) const { return children[0]->hasField(field); } + bool hasField(const std::string& field) const { return children[0]->hasField(field); } bool sortedByDiskLoc() const { return children[0]->sortedByDiskLoc(); } const BSONObjSet& getSort() const { return children[0]->getSort(); } @@ -576,7 +576,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return false; } - bool hasField(const string& field) const; + bool hasField(const std::string& field) const; bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sorts; } BSONObjSet _sorts; @@ -596,7 +596,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return true; } - bool hasField(const string& field) const { return true; } + bool hasField(const std::string& field) const { return true; } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sorts; } @@ -620,7 +620,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return true; } - bool hasField(const string& field) const { return true; } + bool hasField(const std::string& field) const { return true; } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return _sorts; } @@ -654,7 +654,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return children[0]->fetched(); } - bool hasField(const string& field) const { return children[0]->hasField(field); } + bool hasField(const std::string& field) const { return children[0]->hasField(field); } bool sortedByDiskLoc() const { return children[0]->sortedByDiskLoc(); } const BSONObjSet& getSort() const { return children[0]->getSort(); } @@ -677,7 +677,7 @@ namespace mongo { bool fetched() const { return children[0]->fetched(); } // Any flagged results are OWNED_OBJ and as such they'll have any field we need. - bool hasField(const string& field) const { return children[0]->hasField(field); } + bool hasField(const std::string& field) const { return children[0]->hasField(field); } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return sorts; } @@ -702,7 +702,7 @@ namespace mongo { // This stage is created "on top" of normal planning and as such the properties // below don't really matter. bool fetched() const { return false; } - bool hasField(const string& field) const { return !indexKeyPattern[field].eoo(); } + bool hasField(const std::string& field) const { return !indexKeyPattern[field].eoo(); } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return sorts; } @@ -729,7 +729,7 @@ namespace mongo { virtual void appendToString(mongoutils::str::stream* ss, int indent) const; bool fetched() const { return true; } - bool hasField(const string& field) const { return true; } + bool hasField(const std::string& field) const { return true; } bool sortedByDiskLoc() const { return false; } const BSONObjSet& getSort() const { return sorts; } diff --git a/src/mongo/db/query/runner.h b/src/mongo/db/query/runner.h index 474b93c1fd3..ebcc12f82a4 100644 --- a/src/mongo/db/query/runner.h +++ b/src/mongo/db/query/runner.h @@ -64,7 +64,7 @@ namespace mongo { RUNNER_ERROR, }; - static string statestr(RunnerState s) { + static std::string statestr(RunnerState s) { if (RUNNER_ADVANCED == s) { return "RUNNER_ADVANCED"; } @@ -154,7 +154,7 @@ namespace mongo { /** * Return the NS that the query is running over. */ - virtual const string& ns() = 0; + virtual const std::string& ns() = 0; /** * Return the Collection that the query is running over. diff --git a/src/mongo/db/query/type_explain.h b/src/mongo/db/query/type_explain.h index 1048e591c85..a151c78715d 100644 --- a/src/mongo/db/query/type_explain.h +++ b/src/mongo/db/query/type_explain.h @@ -42,7 +42,7 @@ namespace mongo { * query. The exception is the multi plan runner, in which * case plan selection depends on actually running the query. * - * Currently, just a summary string describing the plan + * Currently, just a summary std::string describing the plan * used to run the query. */ struct PlanInfo { diff --git a/src/mongo/db/range_deleter.h b/src/mongo/db/range_deleter.h index 9c47659bf0d..9a3b8c6b1fa 100644 --- a/src/mongo/db/range_deleter.h +++ b/src/mongo/db/range_deleter.h @@ -304,7 +304,7 @@ namespace mongo { * Must be a synchronous call. CursorIds should be populated after call. * Must not throw exception. */ - virtual void getCursorIds(const StringData& ns, set<CursorId>* openCursors) = 0; + virtual void getCursorIds(const StringData& ns, std::set<CursorId>* openCursors) = 0; }; } // namespace mongo diff --git a/src/mongo/db/range_deleter_mock_env.h b/src/mongo/db/range_deleter_mock_env.h index 2bffc7a418b..ce9457889d6 100644 --- a/src/mongo/db/range_deleter_mock_env.h +++ b/src/mongo/db/range_deleter_mock_env.h @@ -45,7 +45,7 @@ namespace mongo { }; /** - * Comparator function object compatible with std::set. + * Comparator function object compatible with set. */ struct DeletedRangeCmp { bool operator()(const DeletedRange& lhs, const DeletedRange& rhs) const; @@ -132,14 +132,14 @@ namespace mongo { const BSONObj& max, const BSONObj& shardKeyPattern, bool secondaryThrottle, - string* errMsg); + std::string* errMsg); /** * Basic implementation of gathering open cursors that matches the signature for * RangeDeleterEnv::getCursorIds. The cursors returned can be modified with * the setCursorId and clearCursorMap methods. */ - void getCursorIds(const StringData& ns, set<CursorId>* in); + void getCursorIds(const StringData& ns, std::set<CursorId>* in); private: // mutex acquisition ordering: diff --git a/src/mongo/db/repl/connections.h b/src/mongo/db/repl/connections.h index 9be9c36e04e..a32c77ed924 100644 --- a/src/mongo/db/repl/connections.h +++ b/src/mongo/db/repl/connections.h @@ -81,18 +81,18 @@ namespace mongo { So here what we do is wrapper known safe methods and not allow cursor-style queries at all. This makes ScopedConn limited in functionality but very safe. More non-cursor wrappers can be added here if needed. */ - bool runCommand(const string &dbname, const BSONObj& cmd, BSONObj &info, int options=0) { + bool runCommand(const std::string &dbname, const BSONObj& cmd, BSONObj &info, int options=0) { return conn()->runCommand(dbname, cmd, info, options); } - unsigned long long count(const string &ns) { + unsigned long long count(const std::string &ns) { return conn()->count(ns); } - BSONObj findOne(const string &ns, const Query& q, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { + BSONObj findOne(const std::string &ns, const Query& q, const BSONObj *fieldsToReturn = 0, int queryOptions = 0) { return conn()->findOne(ns, q, fieldsToReturn, queryOptions); } private: - auto_ptr<scoped_lock> connLock; + std::auto_ptr<scoped_lock> connLock; static mongo::mutex mapMutex; struct ConnectionInfo { mongo::mutex lock; @@ -123,14 +123,14 @@ namespace mongo { private: int _timeout; } *connInfo; - typedef map<string,ScopedConn::ConnectionInfo*> M; + typedef std::map<std::string,ScopedConn::ConnectionInfo*> M; static M& _map; scoped_ptr<DBClientConnection>& conn() { return connInfo->cc; } - const string _hostport; + const std::string _hostport; // we should already be locked... bool connect() { - string err; + std::string err; if (!connInfo->cc->connect(_hostport, err)) { log() << "couldn't connect to " << _hostport << ": " << err << rsLog; return false; diff --git a/src/mongo/db/repl/master_slave.h b/src/mongo/db/repl/master_slave.h index dbcd0953fb5..740a767cc4e 100644 --- a/src/mongo/db/repl/master_slave.h +++ b/src/mongo/db/repl/master_slave.h @@ -51,7 +51,7 @@ namespace mongo { extern volatile int relinquishSyncingSome; extern volatile int syncing; - // Global variable that contains a string telling why master/slave halted + // Global variable that contains a std::string telling why master/slave halted extern const char *replAllDead; /* A replication exception */ @@ -92,18 +92,18 @@ namespace mongo { back to read more transactions. (Imagine a scenario of slave startup where we try to clone 100 databases in one pass.) */ - set<string> addDbNextPass; + std::set<std::string> addDbNextPass; - set<string> incompleteCloneDbs; + std::set<std::string> incompleteCloneDbs; BSONObj _me; ReplSource(); - void resyncDrop( OperationContext* txn, const string& db ); + void resyncDrop( OperationContext* txn, const std::string& db ); // call without the db mutex void syncToTailOfRemoteLog(); - string ns() const { return string( "local.oplog.$" ) + sourceName(); } + std::string ns() const { return std::string( "local.oplog.$" ) + sourceName(); } unsigned _sleepAdviceTime; /** @@ -124,17 +124,17 @@ namespace mongo { OplogReader oplogReader; void applyOperation(OperationContext* txn, Database* db, const BSONObj& op); - string hostName; // ip addr or hostname plus optionally, ":<port>" - string _sourceName; // a logical source name. - string sourceName() const { return _sourceName.empty() ? "main" : _sourceName; } - string only; // only a certain db. note that in the sources collection, this may not be changed once you start replicating. + std::string hostName; // ip addr or hostname plus optionally, ":<port>" + std::string _sourceName; // a logical source name. + std::string sourceName() const { return _sourceName.empty() ? "main" : _sourceName; } + std::string only; // only a certain db. note that in the sources collection, this may not be changed once you start replicating. /* the last time point we have already synced up to (in the remote/master's oplog). */ OpTime syncedTo; int nClonedThisPass; - typedef vector< shared_ptr< ReplSource > > SourceVector; + typedef std::vector< shared_ptr< ReplSource > > SourceVector; static void loadAll(SourceVector&); explicit ReplSource(BSONObj); @@ -150,7 +150,7 @@ namespace mongo { bool operator==(const ReplSource&r) const { return hostName == r.hostName && sourceName() == r.sourceName(); } - string toString() const { return sourceName() + "@" + hostName; } + std::string toString() const { return sourceName() + "@" + hostName; } bool haveMoreDbsToSync() const { return !addDbNextPass.empty(); } int sleepAdvice() const { @@ -172,14 +172,14 @@ namespace mongo { class DatabaseIgnorer { public: /** Indicate that operations for 'db' should be ignored until after 'futureOplogTime' */ - void doIgnoreUntilAfter( const string &db, const OpTime &futureOplogTime ); + void doIgnoreUntilAfter( const std::string &db, const OpTime &futureOplogTime ); /** * Query ignore state of 'db'; if 'currentOplogTime' is after the ignore * limit, the ignore state will be cleared. */ - bool ignoreAt( const string &db, const OpTime ¤tOplogTime ); + bool ignoreAt( const std::string &db, const OpTime ¤tOplogTime ); private: - map< string, OpTime > _ignores; + std::map< std::string, OpTime > _ignores; }; } diff --git a/src/mongo/db/repl/member_state.h b/src/mongo/db/repl/member_state.h index 587f729568d..d9c1801dd59 100644 --- a/src/mongo/db/repl/member_state.h +++ b/src/mongo/db/repl/member_state.h @@ -69,7 +69,7 @@ namespace mongo { bool readable() const { return s == RS_PRIMARY || s == RS_SECONDARY; } bool shunned() const { return s == RS_SHUNNED; } - string toString() const; + std::string toString() const; bool operator==(const MemberState& r) const { return s == r.s; } bool operator!=(const MemberState& r) const { return s != r.s; } diff --git a/src/mongo/db/repl/multicmd.h b/src/mongo/db/repl/multicmd.h index 0f8b8df9bc5..02f53e2796e 100644 --- a/src/mongo/db/repl/multicmd.h +++ b/src/mongo/db/repl/multicmd.h @@ -36,9 +36,9 @@ namespace mongo { struct Target { - Target(string hostport) : toHost(hostport), ok(false) { } + Target(std::string hostport) : toHost(hostport), ok(false) { } //Target() : ok(false) { } - const string toHost; + const std::string toHost; bool ok; BSONObj result; }; @@ -49,7 +49,7 @@ namespace mongo { in: Target::toHost out: Target::result and Target::ok */ - void multiCommand(BSONObj cmd, list<Target>& L); + void multiCommand(BSONObj cmd, std::list<Target>& L); class _MultiCommandJob : public BackgroundJob { public: @@ -58,7 +58,7 @@ namespace mongo { _MultiCommandJob(BSONObj& _cmd, Target& _d) : cmd(_cmd), d(_d) { } private: - string name() const { return "MultiCommandJob"; } + std::string name() const { return "MultiCommandJob"; } void run() { try { ScopedConn c(d.toHost); @@ -72,17 +72,17 @@ namespace mongo { } }; - inline void multiCommand(BSONObj cmd, list<Target>& L) { - list< shared_ptr<BackgroundJob> > jobs; + inline void multiCommand(BSONObj cmd, std::list<Target>& L) { + std::list< shared_ptr<BackgroundJob> > jobs; - for( list<Target>::iterator i = L.begin(); i != L.end(); i++ ) { + for( std::list<Target>::iterator i = L.begin(); i != L.end(); i++ ) { Target& d = *i; _MultiCommandJob *j = new _MultiCommandJob(cmd, d); jobs.push_back( shared_ptr<BackgroundJob>(j) ); j->go(); } - for( list< shared_ptr<BackgroundJob> >::iterator i = jobs.begin(); i != jobs.end(); i++ ) { + for( std::list< shared_ptr<BackgroundJob> >::iterator i = jobs.begin(); i != jobs.end(); i++ ) { (*i)->wait(); } } diff --git a/src/mongo/db/repl/oplogreader.h b/src/mongo/db/repl/oplogreader.h index 40979dc2538..9121c466f66 100644 --- a/src/mongo/db/repl/oplogreader.h +++ b/src/mongo/db/repl/oplogreader.h @@ -76,11 +76,11 @@ namespace mongo { bool connect(const std::string& hostname, const BSONObj& me); - bool connect(const mongo::OID& rid, const int from, const string& to); + bool connect(const mongo::OID& rid, const int from, const std::string& to); void tailCheck() { if( cursor.get() && cursor->isDead() ) { - log() << "repl: old cursor isDead, will initiate a new one" << endl; + log() << "repl: old cursor isDead, will initiate a new one" << std::endl; resetCursor(); } } @@ -149,7 +149,7 @@ namespace mongo { int getTailingQueryOptions() const { return _tailingQueryOptions; } void setTailingQueryOptions( int tailingQueryOptions ) { _tailingQueryOptions = tailingQueryOptions; } - void peek(vector<BSONObj>& v, int n) { + void peek(std::vector<BSONObj>& v, int n) { if( cursor.get() ) cursor->peek(v,n); } @@ -159,7 +159,7 @@ namespace mongo { private: /** @return true iff connection was successful */ - bool commonConnect(const string& hostName); + bool commonConnect(const std::string& hostName); bool passthroughHandshake(const mongo::OID& rid, const int f); }; diff --git a/src/mongo/db/repl/rs.h b/src/mongo/db/repl/rs.h index 549a0cb948d..7be93804842 100644 --- a/src/mongo/db/repl/rs.h +++ b/src/mongo/db/repl/rs.h @@ -73,6 +73,7 @@ namespace mongo { // Main entry point for replica sets void startReplSets(ReplSetCmdline *replSetCmdline); + /** * does local authentication * directly authorizes against AuthenticationInfo diff --git a/src/mongo/db/repl/rs_config.h b/src/mongo/db/repl/rs_config.h index 27b38774185..f25984a9ddf 100644 --- a/src/mongo/db/repl/rs_config.h +++ b/src/mongo/db/repl/rs_config.h @@ -38,7 +38,7 @@ namespace mongo { class Member; - const string rsConfigNs = "local.system.replset"; + const std::string rsConfigNs = "local.system.replset"; class ReplSetConfig { enum { EMPTYCONFIG = -2 }; @@ -82,14 +82,14 @@ namespace mongo { int slaveDelay; /* seconds. int rather than unsigned for convenient to/front bson conversion. */ bool hidden; /* if set, don't advertise to drives in isMaster. for non-primaries (priority 0) */ bool buildIndexes; /* if false, do not create any non-_id indexes */ - map<string,string> tags; /* tagging for data center, rack, etc. */ + std::map<std::string,std::string> tags; /* tagging for data center, rack, etc. */ private: - set<TagSubgroup*> _groups; // the subgroups this member belongs to + std::set<TagSubgroup*> _groups; // the subgroups this member belongs to public: - const set<TagSubgroup*>& groups() const { + const std::set<TagSubgroup*>& groups() const { return _groups; } - set<TagSubgroup*>& groupsw() { + std::set<TagSubgroup*>& groupsw() { return _groups; } void check() const; /* check validity, assert if not. */ @@ -98,7 +98,7 @@ namespace mongo { void updateGroups(const OpTime& last) { RACECHECK scoped_lock lk(ReplSetConfig::groupMx); - for (set<TagSubgroup*>::const_iterator it = groups().begin(); it != groups().end(); it++) { + for (std::set<TagSubgroup*>::const_iterator it = groups().begin(); it != groups().end(); it++) { (*it)->updateLast(last); } } @@ -115,8 +115,8 @@ namespace mongo { // if they are the same size and not equal, at least one // element in A must be different in B - for (map<string,string>::const_iterator lit = tags.begin(); lit != tags.end(); lit++) { - map<string,string>::const_iterator rit = r.tags.find((*lit).first); + for (std::map<std::string,std::string>::const_iterator lit = tags.begin(); lit != tags.end(); lit++) { + std::map<std::string,std::string>::const_iterator rit = r.tags.find((*lit).first); if (rit == r.tags.end() || (*lit).second != (*rit).second) { return false; @@ -129,8 +129,8 @@ namespace mongo { bool operator!=(const MemberCfg& r) const { return !(*this == r); } }; - vector<MemberCfg> members; - string _id; + std::vector<MemberCfg> members; + std::string _id; int version; struct HealthOptions { @@ -156,26 +156,26 @@ namespace mongo { }; HealthOptions ho; - string md5; + std::string md5; BSONObj getLastErrorDefaults; - map<string,TagRule*> rules; + std::map<std::string,TagRule*> rules; - list<HostAndPort> otherMemberHostnames() const; // except self + std::list<HostAndPort> otherMemberHostnames() const; // except self /** @return true if could connect, and there is no cfg object there at all */ bool empty() const { return version == EMPTYCONFIG; } - string toString() const { return asBson().toString(); } + std::string toString() const { return asBson().toString(); } /** validate the settings. does not call check() on each member, you have to do that separately. */ void checkRsConfig() const; /** check if modification makes sense */ - static bool legalChange(const ReplSetConfig& old, const ReplSetConfig& n, string& errmsg); + static bool legalChange(const ReplSetConfig& old, const ReplSetConfig& n, std::string& errmsg); //static void receivedNewConfig(BSONObj); void saveConfigLocally(BSONObj comment); // to local db - string saveConfigEverywhere(); // returns textual info on what happened + std::string saveConfigEverywhere(); // returns textual info on what happened /** * Update members' groups when the config changes but members stay the same. @@ -248,14 +248,14 @@ namespace mongo { struct TagSubgroup : boost::noncopyable { ~TagSubgroup(); // never called; not defined TagSubgroup(const std::string& nm) : name(nm) { } - const string name; + const std::string name; OpTime last; - vector<TagClause*> clauses; + std::vector<TagClause*> clauses; // this probably won't actually point to valid members after the // subgroup is created, as initFromConfig() makes a copy of the // config - set<MemberCfg*> m; + std::set<MemberCfg*> m; void updateLast(const OpTime& op); @@ -279,9 +279,9 @@ namespace mongo { */ struct TagClause { OpTime last; - map<string,TagSubgroup*> subgroups; + std::map<std::string,TagSubgroup*> subgroups; TagRule *rule; - string name; + std::string name; /** * If we have get a clause like {machines : 3} and this server is * tagged with "machines", then it's really {machines : 2}, as we @@ -292,7 +292,7 @@ namespace mongo { int actualTarget; void updateLast(const OpTime& op); - string toString() const; + std::string toString() const; }; /** @@ -316,15 +316,15 @@ namespace mongo { * "ny" -> {A, B},{C} * "sf" -> {D},{E} */ - void _populateTagMap(map<string,TagClause> &tagMap); + void _populateTagMap(std::map<std::string,TagClause> &tagMap); public: struct TagRule { - vector<TagClause*> clauses; + std::vector<TagClause*> clauses; OpTime last; void updateLast(const OpTime& op); - string toString() const; + std::string toString() const; }; }; diff --git a/src/mongo/db/repl/rs_sync.h b/src/mongo/db/repl/rs_sync.h index 5765172b070..f5df70b1b85 100644 --- a/src/mongo/db/repl/rs_sync.h +++ b/src/mongo/db/repl/rs_sync.h @@ -46,7 +46,7 @@ namespace replset { // TODO: move hbmsg into an error-keeping class (SERVER-4444) - void sethbmsg(const string& s, const int logLevel=0); + void sethbmsg(const std::string& s, const int logLevel=0); } // namespace replset } // namespace mongo diff --git a/src/mongo/db/repl/server.h b/src/mongo/db/repl/server.h index d84dcd56ad4..9216c0bc87d 100644 --- a/src/mongo/db/repl/server.h +++ b/src/mongo/db/repl/server.h @@ -62,12 +62,12 @@ namespace mongo { private: virtual bool initClient() { return true; } - virtual string name() const { return _name; } + virtual std::string name() const { return _name; } void doWork(); std::deque<lam> d; mongo::mutex m; boost::condition c; - string _name; + std::string _name; bool rq; }; diff --git a/src/mongo/db/repl/sync.h b/src/mongo/db/repl/sync.h index 9edca0b585b..18ecaa63e54 100644 --- a/src/mongo/db/repl/sync.h +++ b/src/mongo/db/repl/sync.h @@ -38,9 +38,9 @@ namespace mongo { class Sync { protected: - string hn; + std::string hn; public: - Sync(const string& hostname) : hn(hostname) {} + Sync(const std::string& hostname) : hn(hostname) {} virtual ~Sync() {} virtual BSONObj getMissingDoc(Database* db, const BSONObj& o); @@ -48,7 +48,7 @@ namespace mongo { * If applyOperation_inlock should be called again after an update fails. */ virtual bool shouldRetry(const BSONObj& o); - void setHostname(const string& hostname); + void setHostname(const std::string& hostname); }; } diff --git a/src/mongo/db/repl/sync_source_feedback.h b/src/mongo/db/repl/sync_source_feedback.h index dd2bfbcf9b3..ba1fe483e45 100644 --- a/src/mongo/db/repl/sync_source_feedback.h +++ b/src/mongo/db/repl/sync_source_feedback.h @@ -107,8 +107,8 @@ namespace mongo { // protects cond and maps and the indicator bools boost::mutex _mtx; // contains the most recent optime of each member syncing to us - map<mongo::OID, OpTime> _slaveMap; - typedef map<mongo::OID, Member*> OIDMemberMap; + std::map<mongo::OID, OpTime> _slaveMap; + typedef std::map<mongo::OID, Member*> OIDMemberMap; // contains a pointer to each member, which we can look up by oid OIDMemberMap _members; // used to alert our thread of changes which need to be passed up the chain diff --git a/src/mongo/db/repl/write_concern.h b/src/mongo/db/repl/write_concern.h index 5dd332cf2f5..9c9aab87dc9 100644 --- a/src/mongo/db/repl/write_concern.h +++ b/src/mongo/db/repl/write_concern.h @@ -47,7 +47,7 @@ namespace mongo { /** @return true if op has made it to w servers */ bool opReplicatedEnough( OpTime op , int w ); - bool opReplicatedEnough( OpTime op , const string& w ); + bool opReplicatedEnough( OpTime op , const std::string& w ); bool opReplicatedEnough( OpTime op , BSONElement w ); bool waitForReplication( OpTime op , int w , int maxSecondsToWait ); diff --git a/src/mongo/db/server_parameters.h b/src/mongo/db/server_parameters.h index 1d7e0610021..c4feb946ad5 100644 --- a/src/mongo/db/server_parameters.h +++ b/src/mongo/db/server_parameters.h @@ -66,14 +66,14 @@ namespace mongo { bool allowedToChangeAtRuntime() const { return _allowedToChangeAtRuntime; } - virtual void append( BSONObjBuilder& b, const string& name ) = 0; + virtual void append( BSONObjBuilder& b, const std::string& name ) = 0; virtual Status set( const BSONElement& newValueElement ) = 0; - virtual Status setFromString( const string& str ) = 0; + virtual Status setFromString( const std::string& str ) = 0; private: - string _name; + std::string _name; bool _allowedToChangeAtStartup; bool _allowedToChangeAtRuntime; }; @@ -114,7 +114,7 @@ namespace mongo { _value( value ) {} virtual ~ExportedServerParameter() {} - virtual void append( BSONObjBuilder& b, const string& name ) { + virtual void append( BSONObjBuilder& b, const std::string& name ) { b.append( name, *_value ); } @@ -123,7 +123,7 @@ namespace mongo { virtual const T& get() const { return *_value; } - virtual Status setFromString( const string& str ); + virtual Status setFromString( const std::string& str ); protected: diff --git a/src/mongo/db/sorter/sorter.h b/src/mongo/db/sorter/sorter.h index 3789bccff63..c5955e67911 100644 --- a/src/mongo/db/sorter/sorter.h +++ b/src/mongo/db/sorter/sorter.h @@ -62,7 +62,7 @@ * // Return *this if your type doesn't have an unowned state * Type getOwned() const; * - * Comparators are functors that that compare pair<Key, Value> and return an + * Comparators are functors that that compare std::pair<Key, Value> and return an * int less than, equal to, or greater than 0 depending on how the two pairs * compare with the same semantics as memcmp. * Example for Key=BSONObj, Value=int: diff --git a/src/mongo/db/startup_warnings.cpp b/src/mongo/db/startup_warnings.cpp index ac708bb2127..930e08dec10 100644 --- a/src/mongo/db/startup_warnings.cpp +++ b/src/mongo/db/startup_warnings.cpp @@ -26,6 +26,8 @@ * then also delete it in the license file. */ +#include "mongo/platform/basic.h" + #include "mongo/db/startup_warnings.h" #include <boost/filesystem/operations.hpp> diff --git a/src/mongo/db/stats/service_stats.h b/src/mongo/db/stats/service_stats.h index da8b121aa55..168a7f104ac 100644 --- a/src/mongo/db/stats/service_stats.h +++ b/src/mongo/db/stats/service_stats.h @@ -59,10 +59,10 @@ namespace mongo { void logResponse( uint64_t duration, uint64_t bytes ); /** - * Render the histogram as string that can be used inside an + * Render the histogram as std::string that can be used inside an * HTML doc. */ - string toHTML() const; + std::string toHTML() const; private: SpinLock _spinLock; // protects state below diff --git a/src/mongo/db/stats/snapshots.h b/src/mongo/db/stats/snapshots.h index 9ea639a6fc8..29c8fc5bdfe 100644 --- a/src/mongo/db/stats/snapshots.h +++ b/src/mongo/db/stats/snapshots.h @@ -101,10 +101,10 @@ namespace mongo { int numDeltas() const { return _stored-1; } const SnapshotData& getPrev( int numBack = 0 ); - auto_ptr<SnapshotDelta> computeDelta( int numBack = 0 ); + std::auto_ptr<SnapshotDelta> computeDelta( int numBack = 0 ); - void outputLockInfoHTML( stringstream& ss ); + void outputLockInfoHTML( std::stringstream& ss ); private: mongo::mutex _lock; int _n; @@ -115,7 +115,7 @@ namespace mongo { class SnapshotThread : public BackgroundJob { public: - virtual string name() const { return "snapshot"; } + virtual std::string name() const { return "snapshot"; } void run(); }; diff --git a/src/mongo/db/stats/top.h b/src/mongo/db/stats/top.h index 9ab16ade79e..a90b1503e81 100644 --- a/src/mongo/db/stats/top.h +++ b/src/mongo/db/stats/top.h @@ -96,7 +96,7 @@ namespace mongo { mutable SimpleMutex _lock; CollectionData _global; UsageMap _usage; - string _lastDropped; + std::string _lastDropped; }; } // namespace mongo diff --git a/src/mongo/db/storage/durable_mapped_file.h b/src/mongo/db/storage/durable_mapped_file.h index 7511692b598..628327252f5 100644 --- a/src/mongo/db/storage/durable_mapped_file.h +++ b/src/mongo/db/storage/durable_mapped_file.h @@ -55,7 +55,7 @@ namespace mongo { /** @return file length */ unsigned long long length() const { return MemoryMappedFile::length(); } - string filename() const { return MemoryMappedFile::filename(); } + std::string filename() const { return MemoryMappedFile::filename(); } void flush(bool sync) { MemoryMappedFile::flush(sync); } @@ -139,13 +139,13 @@ namespace mongo { mutex& _mutex() { return _m; } DurableMappedFile* find_inlock(void *p, /*out*/ size_t& ofs); - map<void*,DurableMappedFile*>::iterator finditer_inlock(void *p) { return _views.upper_bound(p); } + std::map<void*,DurableMappedFile*>::iterator finditer_inlock(void *p) { return _views.upper_bound(p); } unsigned numberOfViews_inlock() const { return _views.size(); } private: mutex _m; - map<void*, DurableMappedFile*> _views; + std::map<void*, DurableMappedFile*> _views; }; // allows a pointer into any private view of a DurableMappedFile to be resolved to the DurableMappedFile object diff --git a/src/mongo/db/storage/extent.h b/src/mongo/db/storage/extent.h index 175180f2171..8a27e271c04 100644 --- a/src/mongo/db/storage/extent.h +++ b/src/mongo/db/storage/extent.h @@ -66,7 +66,7 @@ namespace mongo { // ----- - bool validates(const DiskLoc diskLoc, std::vector<string>* errors = NULL) const; + bool validates(const DiskLoc diskLoc, std::vector<std::string>* errors = NULL) const; BSONObj dump() const; diff --git a/src/mongo/db/storage/mmap_v1/dur.h b/src/mongo/db/storage/mmap_v1/dur.h index f1c760549b5..b777b048a88 100644 --- a/src/mongo/db/storage/mmap_v1/dur.h +++ b/src/mongo/db/storage/mmap_v1/dur.h @@ -56,7 +56,7 @@ namespace mongo { class DurableInterface : boost::noncopyable { public: - virtual ~DurableInterface() { log() << "ERROR warning ~DurableInterface not intended to be called" << endl; } + virtual ~DurableInterface() { log() << "ERROR warning ~DurableInterface not intended to be called" << std::endl; } /** Declare that a file has been created Normally writes are applied only after journaling, for safety. But here the file @@ -97,7 +97,7 @@ namespace mongo { range length. @return new buffer pointer. this is modified when testIntent is true. */ - virtual void* writingRangesAtOffsets(void *buf, const vector< pair< long long, unsigned > > &ranges ) = 0; + virtual void* writingRangesAtOffsets(void *buf, const std::vector< std::pair< long long, unsigned > > &ranges ) = 0; /** Wait for acknowledgement of the next group commit. @return true if --dur is on. There will be delay. @@ -194,7 +194,7 @@ namespace mongo { class NonDurableImpl : public DurableInterface { void* writingPtr(void *x, unsigned len); void* writingAtOffset(void *buf, unsigned ofs, unsigned len) { return buf; } - void* writingRangesAtOffsets(void *buf, const vector< pair< long long, unsigned > > &ranges) { return buf; } + void* writingRangesAtOffsets(void *buf, const std::vector< std::pair< long long, unsigned > > &ranges) { return buf; } void declareWriteIntent(void *, unsigned); void createdFile(const std::string& filename, unsigned long long len) { } bool awaitCommit() { return false; } @@ -209,7 +209,7 @@ namespace mongo { bool _aCommitIsNeeded(); void* writingPtr(void *x, unsigned len); void* writingAtOffset(void *buf, unsigned ofs, unsigned len); - void* writingRangesAtOffsets(void *buf, const vector< pair< long long, unsigned > > &ranges); + void* writingRangesAtOffsets(void *buf, const std::vector< std::pair< long long, unsigned > > &ranges); void declareWriteIntent(void *, unsigned); void createdFile(const std::string& filename, unsigned long long len); bool awaitCommit(); diff --git a/src/mongo/db/storage/mmap_v1/dur_commitjob.h b/src/mongo/db/storage/mmap_v1/dur_commitjob.h index 4a1d5b66b69..5f32ee46e35 100644 --- a/src/mongo/db/storage/mmap_v1/dur_commitjob.h +++ b/src/mongo/db/storage/mmap_v1/dur_commitjob.h @@ -57,7 +57,7 @@ namespace mongo { bool contains(const WriteIntent& rhs) const { return (start() <= rhs.start() && end() >= rhs.end()); } // merge into me: void absorb(const WriteIntent& other); - friend ostream& operator << (ostream& out, const WriteIntent& wi) { + friend std::ostream& operator << (std::ostream& out, const WriteIntent& wi) { return (out << "p: " << wi.p << " end: " << wi.end() << " len: " << wi.len); } private: @@ -79,7 +79,7 @@ namespace mongo { */ bool checkAndSet(void* p, int len) { unsigned x = mongoutils::hashPointer(p); - pair<void*, int>& nd = nodes[x % N]; + std::pair<void*, int>& nd = nodes[x % N]; if( nd.first == p ) { if( nd.second < len ) { nd.second = len; @@ -93,15 +93,15 @@ namespace mongo { } private: enum { N = Prime }; // this should be small the idea is that it fits in the cpu cache easily - pair<void*,int> nodes[N]; + std::pair<void*,int> nodes[N]; }; /** our record of pending/uncommitted write intents */ class IntentsAndDurOps : boost::noncopyable { public: - vector<WriteIntent> _intents; + std::vector<WriteIntent> _intents; Already<127> _alreadyNoted; - vector< shared_ptr<DurOp> > _durOps; // all the ops other than basic writes + std::vector< shared_ptr<DurOp> > _durOps; // all the ops other than basic writes /** reset the IntentsAndDurOps structure (empties all the above) */ void clear(); @@ -111,7 +111,7 @@ namespace mongo { wassert( _intents.size() < 2000000 ); } #if defined(DEBUG_WRITE_INTENT) - map<void*,int> _debug; + std::map<void*,int> _debug; #endif }; @@ -152,7 +152,7 @@ namespace mongo { /** note an operation other than a "basic write". threadsafe (locks in the impl) */ void noteOp(shared_ptr<DurOp> p); - vector< shared_ptr<DurOp> >& ops() { + std::vector< shared_ptr<DurOp> >& ops() { dassert( Lock::isLocked() ); // a rather weak check, we require more than that groupCommitMutex.dassertLocked(); // this is what really makes the below safe return _intentsAndDurOps._durOps; @@ -184,7 +184,7 @@ namespace mongo { /** used in prepbasicwrites. sorted so that overlapping and duplicate items * can be merged. we sort here so the caller receives something they must * keep const from their pov. */ - const vector<WriteIntent>& getIntentsSorted() { + const std::vector<WriteIntent>& getIntentsSorted() { groupCommitMutex.dassertLocked(); sort(_intentsAndDurOps._intents.begin(), _intentsAndDurOps._intents.end()); return _intentsAndDurOps._intents; diff --git a/src/mongo/db/storage/mmap_v1/dur_journalformat.h b/src/mongo/db/storage/mmap_v1/dur_journalformat.h index 9e35e10cfe2..5bf73bacfb8 100644 --- a/src/mongo/db/storage/mmap_v1/dur_journalformat.h +++ b/src/mongo/db/storage/mmap_v1/dur_journalformat.h @@ -42,7 +42,7 @@ namespace mongo { */ struct JHeader { JHeader() { } - JHeader(string fname); + JHeader(std::string fname); char magic[2]; // "j\n". j means journal, then a linefeed, fwiw if you were to run "less" on the file or something... @@ -133,9 +133,9 @@ namespace mongo { bool isLocalDbContext() const { return _fileNo & LocalDbBit; } void clearLocalDbContextBit() { _fileNo = getFileNo(); } - static string suffix(int fileno) { + static std::string suffix(int fileno) { if( fileno == DotNsSuffix ) return "ns"; - stringstream ss; + std::stringstream ss; ss << fileno; return ss.str(); } diff --git a/src/mongo/db/storage/mmap_v1/dur_journalimpl.h b/src/mongo/db/storage/mmap_v1/dur_journalimpl.h index 6be3515dda5..04aca13e69d 100644 --- a/src/mongo/db/storage/mmap_v1/dur_journalimpl.h +++ b/src/mongo/db/storage/mmap_v1/dur_journalimpl.h @@ -39,7 +39,7 @@ namespace mongo { /** the writeahead journal for durability */ class Journal { public: - string dir; // set by journalMakeDir() during initialization + std::string dir; // set by journalMakeDir() during initialization Journal(); @@ -92,13 +92,13 @@ namespace mongo { unsigned long long _curFileId; // current file id see JHeader::fileId struct JFile { - string filename; + std::string filename; unsigned long long lastEventTimeMs; }; // files which have been closed but not unlinked (rotated out) yet // ordered oldest to newest - list<JFile> _oldJournalFiles; // use _curLogFileMutex + std::list<JFile> _oldJournalFiles; // use _curLogFileMutex // lsn related static void preFlush(); diff --git a/src/mongo/db/storage/mmap_v1/dur_recover.h b/src/mongo/db/storage/mmap_v1/dur_recover.h index c7eac7e0546..fc81ba23fd1 100644 --- a/src/mongo/db/storage/mmap_v1/dur_recover.h +++ b/src/mongo/db/storage/mmap_v1/dur_recover.h @@ -52,13 +52,13 @@ namespace mongo { DurableMappedFile* newEntry(const ParsedJournalEntry&, RecoveryJob&); private: DurableMappedFile *mmf; - string dbName; + std::string dbName; int fileNo; } last; public: RecoveryJob() : _lastDataSyncedFromLastRun(0), _mx("recovery"), _recovering(false) { _lastSeqMentionedInConsoleLog = 1; } - void go(vector<boost::filesystem::path>& files); + void go(std::vector<boost::filesystem::path>& files); ~RecoveryJob(); /** @param data data between header and footer. compressed if recovering. */ @@ -70,13 +70,13 @@ namespace mongo { private: void write(Last& last, const ParsedJournalEntry& entry); // actually writes to the file void applyEntry(Last& last, const ParsedJournalEntry& entry, bool apply, bool dump); - void applyEntries(const vector<ParsedJournalEntry> &entries); + void applyEntries(const std::vector<ParsedJournalEntry> &entries); bool processFileBuffer(const void *, unsigned len); bool processFile(boost::filesystem::path journalfile); void _close(); // doesn't lock DurableMappedFile* getDurableMappedFile(const ParsedJournalEntry& entry); - list<boost::shared_ptr<DurableMappedFile> > _mmfs; + std::list<boost::shared_ptr<DurableMappedFile> > _mmfs; unsigned long long _lastDataSyncedFromLastRun; unsigned long long _lastSeqMentionedInConsoleLog; diff --git a/src/mongo/db/storage/mmap_v1/dur_stats.h b/src/mongo/db/storage/mmap_v1/dur_stats.h index e2c0b29353e..d97c48d5a39 100644 --- a/src/mongo/db/storage/mmap_v1/dur_stats.h +++ b/src/mongo/db/storage/mmap_v1/dur_stats.h @@ -41,8 +41,8 @@ namespace mongo { unsigned _intervalMicros; struct S { BSONObj _asObj(); - string _asCSV(); - string _CSVHeader(); + std::string _asCSV(); + std::string _CSVHeader(); void reset(); unsigned _commits; diff --git a/src/mongo/db/storage/mmap_v1/durop.h b/src/mongo/db/storage/mmap_v1/durop.h index 562ddb0a490..43af9efe6de 100644 --- a/src/mongo/db/storage/mmap_v1/durop.h +++ b/src/mongo/db/storage/mmap_v1/durop.h @@ -72,7 +72,7 @@ namespace mongo { */ virtual void replay() = 0; - virtual string toString() = 0; + virtual std::string toString() = 0; /** if the op requires all file to be closed before doing its work, returns true. */ virtual bool needFilesClosed() { return false; } @@ -92,7 +92,7 @@ namespace mongo { /** param f filename to create with path */ FileCreatedOp(const std::string& f, unsigned long long l); virtual void replay(); - virtual string toString(); + virtual std::string toString(); virtual bool needFilesClosed(); protected: virtual void _serialize(AlignedBuilder& ab); @@ -108,12 +108,12 @@ namespace mongo { DropDbOp(const std::string& db) : DurOp(JEntry::OpCode_DropDb), _db(db) { } virtual void replay(); - virtual string toString() { return string("DropDbOp ") + _db; } + virtual std::string toString() { return std::string("DropDbOp ") + _db; } virtual bool needFilesClosed() { return true; } protected: virtual void _serialize(AlignedBuilder& ab); private: - string _db; + std::string _db; }; } diff --git a/src/mongo/db/structure/btree/btree_logic.h b/src/mongo/db/structure/btree/btree_logic.h index 872384e6f88..e0c9942c12e 100644 --- a/src/mongo/db/structure/btree/btree_logic.h +++ b/src/mongo/db/structure/btree/btree_logic.h @@ -425,7 +425,7 @@ namespace mongo { const DiskLoc leftChild, const DiskLoc rightChild); - string dupKeyError(const KeyDataType& key) const; + std::string dupKeyError(const KeyDataType& key) const; void setInternalKey(OperationContext* txn, BucketType* bucket, @@ -510,8 +510,8 @@ namespace mongo { const BSONObj& rBegin, int rBeginLen, bool rSup, - const vector<const BSONElement*>& rEnd, - const vector<bool>& rEndInclusive, + const std::vector<const BSONElement*>& rEnd, + const std::vector<bool>& rEndInclusive, const Ordering& o, int direction) const; diff --git a/src/mongo/db/structure/btree/btree_ondisk.h b/src/mongo/db/structure/btree/btree_ondisk.h index c32cda92375..1c8e5ad3efe 100644 --- a/src/mongo/db/structure/btree/btree_ondisk.h +++ b/src/mongo/db/structure/btree/btree_ondisk.h @@ -267,7 +267,7 @@ namespace mongo { invariant( la <= 0xffffff ); // must fit in 3 bytes if( la < 0 ) { if ( la != -1 ) { - log() << "btree diskloc isn't negative 1: " << la << endl; + log() << "btree diskloc isn't negative 1: " << la << std::endl; invariant ( la == -1 ); } la = 0; @@ -287,7 +287,7 @@ namespace mongo { return DiskLoc(a >> 8, ofs); } - string toString() const { return DiskLoc(*this).toString(); } + std::string toString() const { return DiskLoc(*this).toString(); } }; struct BtreeBucketV1 { diff --git a/src/mongo/db/structure/btree/key.h b/src/mongo/db/structure/btree/key.h index 214bfacf1e4..83203b0fee2 100644 --- a/src/mongo/db/structure/btree/key.h +++ b/src/mongo/db/structure/btree/key.h @@ -47,7 +47,7 @@ namespace mongo { explicit KeyBson(const BSONObj& obj) : _o(obj) { } int woCompare(const KeyBson& r, const Ordering &o) const; BSONObj toBson() const { return _o; } - string toString() const { return _o.toString(); } + std::string toString() const { return _o.toString(); } int dataSize() const { return _o.objsize(); } const char * data() const { return _o.objdata(); } BSONElement _firstElement() const { return _o.firstElement(); } @@ -86,7 +86,7 @@ namespace mongo { int woCompare(const KeyV1& r, const Ordering &o) const; bool woEqual(const KeyV1& r) const; BSONObj toBson() const; - string toString() const { return toBson().toString(); } + std::string toString() const { return toBson().toString(); } /** get the key data we want to store in the btree bucket */ const char * data() const { return (const char *) _keyData; } diff --git a/src/mongo/db/structure/catalog/hashtab.h b/src/mongo/db/structure/catalog/hashtab.h index ac15b506ebf..e73962ee31d 100644 --- a/src/mongo/db/structure/catalog/hashtab.h +++ b/src/mongo/db/structure/catalog/hashtab.h @@ -87,7 +87,7 @@ namespace mongo { if ( nodes(i).hash == h && nodes(i).k == k ) { if ( chain >= 200 ) - out() << "warning: hashtable " << name << " long chain " << endl; + out() << "warning: hashtable " << name << " long chain " << std::endl; found = true; return i; } @@ -95,13 +95,13 @@ namespace mongo { i = (i+1) % n; if ( i == start ) { // shouldn't get here / defensive for infinite loops - out() << "error: hashtable " << name << " is full n:" << n << endl; + out() << "error: hashtable " << name << " is full n:" << n << std::endl; return -1; } if( chain >= maxChain ) { if ( firstNonUsed >= 0 ) return firstNonUsed; - out() << "error: hashtable " << name << " max chain reached:" << maxChain << endl; + out() << "error: hashtable " << name << " max chain reached:" << maxChain << std::endl; return -1; } } @@ -111,7 +111,7 @@ namespace mongo { /* buf must be all zeroes on initialization. */ HashTable(void* buf, int buflen, const char *_name) : name(_name) { int m = sizeof(Node); - // out() << "hashtab init, buflen:" << buflen << " m:" << m << endl; + // out() << "hashtab init, buflen:" << buflen << " m:" << m << std::endl; n = buflen / m; if ( (n & 1) == 0 ) n--; @@ -120,7 +120,7 @@ namespace mongo { //nodes = (Node *) buf; if ( sizeof(Node) != 628 ) { - out() << "HashTable() " << _name << " sizeof(node):" << sizeof(Node) << " n:" << n << " sizeof(Key): " << sizeof(Key) << " sizeof(Type):" << sizeof(Type) << endl; + out() << "HashTable() " << _name << " sizeof(node):" << sizeof(Node) << " n:" << n << " sizeof(Key): " << sizeof(Key) << " sizeof(Type):" << sizeof(Type) << std::endl; verify( sizeof(Node) == 628 ); } diff --git a/src/mongo/db/structure/catalog/namespace-inl.h b/src/mongo/db/structure/catalog/namespace-inl.h index 2de1e2edbd0..5cd45963f1f 100644 --- a/src/mongo/db/structure/catalog/namespace-inl.h +++ b/src/mongo/db/structure/catalog/namespace-inl.h @@ -43,15 +43,15 @@ namespace mongo { // memset( buf, 0, sizeof(buf) ); uassert( 10080 , "ns name too long, max size is 127 bytes", ns.size() <= MaxNsLen); - uassert( 17380 , "ns name can't contain embedded '\0' byte", ns.find('\0') == string::npos); + uassert( 17380 , "ns name can't contain embedded '\0' byte", ns.find('\0') == std::string::npos); ns.copyTo( buf, true ); return *this; } - inline string Namespace::extraName(int i) const { + inline std::string Namespace::extraName(int i) const { char ex[] = "$extra"; ex[5] += i; - string s = string(buf) + ex; + std::string s = std::string(buf) + ex; massert( 10348 , "$extra: ns name too long", s.size() <= MaxNsLen); return s; } diff --git a/src/mongo/db/structure/catalog/namespace.h b/src/mongo/db/structure/catalog/namespace.h index bd5e36bffc6..02c8721b0cf 100644 --- a/src/mongo/db/structure/catalog/namespace.h +++ b/src/mongo/db/structure/catalog/namespace.h @@ -75,11 +75,11 @@ namespace mongo { // This includes rum for the NUL byte so it can be used when sizing buffers. MaxNsLenWithNUL = 128, - // MaxNsLenWithNUL excluding the NUL byte. Use this when comparing string lengths. + // MaxNsLenWithNUL excluding the NUL byte. Use this when comparing std::string lengths. MaxNsLen = MaxNsLenWithNUL - 1, // Maximum allowed length of fully qualified namespace name of any real collection. - // Does not include NUL so it can be directly compared to string lengths. + // Does not include NUL so it can be directly compared to std::string lengths. MaxNsColletionLen = MaxNsLen - 7/*strlen(".$extra")*/, }; private: diff --git a/src/mongo/db/structure/catalog/namespace_details.h b/src/mongo/db/structure/catalog/namespace_details.h index 1deda0ff3f3..468e5e967b1 100644 --- a/src/mongo/db/structure/catalog/namespace_details.h +++ b/src/mongo/db/structure/catalog/namespace_details.h @@ -264,7 +264,7 @@ namespace mongo { */ void paddingFits( OperationContext* txn ) { MONGO_SOMETIMES(sometimes, 4) { // do this on a sampled basis to journal less - double x = max(1.0, _paddingFactor - 0.001 ); + double x = std::max(1.0, _paddingFactor - 0.001 ); setPaddingFactor( txn, x ); } } @@ -277,8 +277,8 @@ namespace mongo { can pushes this down considerably. further tweaking will be a good idea but this should be an adequate starting point. */ - double N = min(_nIndexes,7) + 3; - double x = min(2.0,_paddingFactor + (0.001 * N)); + double N = std::min(_nIndexes,7) + 3; + double x = std::min(2.0,_paddingFactor + (0.001 * N)); setPaddingFactor( txn, x ); } } diff --git a/src/mongo/db/structure/catalog/namespace_index.h b/src/mongo/db/structure/catalog/namespace_index.h index 85d05fc861d..f5871ba8e0c 100644 --- a/src/mongo/db/structure/catalog/namespace_index.h +++ b/src/mongo/db/structure/catalog/namespace_index.h @@ -84,7 +84,7 @@ namespace mongo { void maybeMkdir() const; DurableMappedFile _f; - auto_ptr<HashTable<Namespace,NamespaceDetails> > _ht; + std::auto_ptr<HashTable<Namespace,NamespaceDetails> > _ht; std::string _dir; std::string _database; }; diff --git a/src/mongo/db/write_concern.h b/src/mongo/db/write_concern.h index bfa31571a45..6e4a1c30087 100644 --- a/src/mongo/db/write_concern.h +++ b/src/mongo/db/write_concern.h @@ -59,9 +59,9 @@ namespace mongo { bool wTimedOut; int wTime; - vector<BSONObj> writtenTo; + std::vector<BSONObj> writtenTo; - string err; // this is the old err field, should deprecate + std::string err; // this is the old err field, should deprecate }; /** |