diff options
author | yang-g <yangg@google.com> | 2015-07-15 00:50:15 -0700 |
---|---|---|
committer | yang-g <yangg@google.com> | 2015-07-15 00:55:30 -0700 |
commit | 811536efce1ba1203c4cb469e455a41fdd207e86 (patch) | |
tree | 6a8f916b5c82ca1351526116d92dfea2094cd816 /include | |
parent | 1cbeeb508b033c84f73ec79756bb4f7c0227a0d0 (diff) |
auth context iterator
Diffstat (limited to 'include')
-rw-r--r-- | include/grpc++/auth_context.h | 32 |
1 files changed, 32 insertions, 0 deletions
diff --git a/include/grpc++/auth_context.h b/include/grpc++/auth_context.h index 158f8e3f07..394cb34ec4 100644 --- a/include/grpc++/auth_context.h +++ b/include/grpc++/auth_context.h @@ -34,15 +34,43 @@ #ifndef GRPCXX_AUTH_CONTEXT_H #define GRPCXX_AUTH_CONTEXT_H +#include <iterator> #include <vector> #include <grpc++/config.h> +struct grpc_auth_context; +struct grpc_auth_property; +struct grpc_auth_property_iterator; + namespace grpc { +class SecureAuthContext; class AuthContext { public: typedef std::pair<grpc::string, grpc::string> Property; + class PropertyIterator + : public std::iterator<std::input_iterator_tag, const Property> { + public: + ~PropertyIterator(); + PropertyIterator& operator++(); + PropertyIterator operator++(int); + bool operator==(const PropertyIterator& rhs) const; + bool operator!=(const PropertyIterator& rhs) const; + const Property operator*(); + + private: + friend SecureAuthContext; + PropertyIterator(); + PropertyIterator(const grpc_auth_property* property, + const grpc_auth_property_iterator* iter); + const grpc_auth_property* property_; + // The following items form a grpc_auth_property_iterator. + const grpc_auth_context* ctx_; + size_t index_; + const char* name_; + }; + typedef PropertyIterator const_iterator; virtual ~AuthContext() {} @@ -54,6 +82,10 @@ class AuthContext { // Returns all the property values with the given name. virtual std::vector<grpc::string> FindPropertyValues( const grpc::string& name) const = 0; + + // Iteration over all the properties. + virtual const_iterator begin() const = 0; + virtual const_iterator end() const = 0; }; } // namespace grpc |