Index: net/base/url_util.h |
diff --git a/net/base/url_util.h b/net/base/url_util.h |
index 5d5e58bc617950158014ad22f0f62f5d24d5dfcc..83d03562f86abf57a3db81b4ca408cb2f0956945 100644 |
--- a/net/base/url_util.h |
+++ b/net/base/url_util.h |
@@ -7,7 +7,9 @@ |
#include <string> |
+#include "base/compiler_specific.h" |
#include "net/base/net_export.h" |
+#include "url/url_parse.h" |
class GURL; |
@@ -44,6 +46,30 @@ NET_EXPORT GURL AppendOrReplaceQueryParameter(const GURL& url, |
const std::string& name, |
const std::string& value); |
+// Iterates over the key-value pairs in the query portion of |url|. |
+class NET_EXPORT QueryIterator { |
+ public: |
+ explicit QueryIterator(const GURL& url); |
+ ~QueryIterator(); |
+ |
+ std::string GetKey() const; |
+ std::string GetValue() const; |
+ const std::string& GetUnescapedValue(); |
+ |
+ bool IsAtEnd() const; |
+ void Advance(); |
+ |
+ private: |
+ const GURL& url_; |
+ url_parse::Component query_; |
+ bool at_end_; |
+ url_parse::Component key_; |
+ url_parse::Component value_; |
+ std::string unescaped_value_; |
+ |
+ DISALLOW_COPY_AND_ASSIGN(QueryIterator); |
+}; |
+ |
// Looks for |search_key| in the query portion of |url|. Returns true if the |
// key is found and sets |out_value| to the unescaped value for the key. |
// Returns false if the key is not found. |