summaryrefslogtreecommitdiff
path: root/src/mongo/db/auth/role_name.h
diff options
context:
space:
mode:
authorSpencer T Brody <spencer@10gen.com>2013-05-16 18:04:07 -0400
committerSpencer T Brody <spencer@10gen.com>2013-05-23 12:09:58 -0400
commitc95bf3ff714f9dad17288e3cb8dcfab7d7ebe6fc (patch)
tree6e0d4b26840c53a5d184abeb41c6e3f85beef917 /src/mongo/db/auth/role_name.h
parent23a185462b83a4f0f7ea5f3ada89ff819313c992 (diff)
downloadmongo-c95bf3ff714f9dad17288e3cb8dcfab7d7ebe6fc.tar.gz
SERVER-9518 Initial implementation of new User class
Diffstat (limited to 'src/mongo/db/auth/role_name.h')
-rw-r--r--src/mongo/db/auth/role_name.h30
1 files changed, 29 insertions, 1 deletions
diff --git a/src/mongo/db/auth/role_name.h b/src/mongo/db/auth/role_name.h
index 12062c83a5d..130f7a98e70 100644
--- a/src/mongo/db/auth/role_name.h
+++ b/src/mongo/db/auth/role_name.h
@@ -23,6 +23,7 @@
#include "mongo/base/disallow_copying.h"
#include "mongo/base/string_data.h"
#include "mongo/platform/hash_namespace.h"
+#include "mongo/platform/unordered_set.h"
#include "mongo/util/assert_util.h"
namespace mongo {
@@ -118,7 +119,7 @@ namespace mongo {
boost::scoped_ptr<Impl> _impl;
};
-} // namespace mongo
+} // namespace mongo
// Define hash function for RoleNames so they can be keys in std::unordered_map
MONGO_HASH_NAMESPACE_START
@@ -128,3 +129,30 @@ MONGO_HASH_NAMESPACE_START
}
};
MONGO_HASH_NAMESPACE_END
+
+namespace mongo {
+
+ // RoleNameIterator for iterating over an unordered_set of RoleNames.
+ class RoleNameSetIterator : public RoleNameIterator::Impl {
+ MONGO_DISALLOW_COPYING(RoleNameSetIterator);
+
+ public:
+ RoleNameSetIterator(const unordered_set<RoleName>::const_iterator& begin,
+ const unordered_set<RoleName>::const_iterator& end);
+
+ virtual ~RoleNameSetIterator();
+
+ virtual bool more() const;
+
+ virtual const RoleName& next();
+
+ virtual const RoleName& get() const;
+
+ private:
+ virtual Impl* doClone() const;
+
+ unordered_set<RoleName>::const_iterator _begin;
+ unordered_set<RoleName>::const_iterator _end;
+ };
+
+} // namespace mongo