Page Speed Optimization Libraries  1.13.35.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
query_params.h
Go to the documentation of this file.
1 // Copyright 2010-2011 Google Inc.
16 
17 #ifndef PAGESPEED_KERNEL_HTTP_QUERY_PARAMS_H_
18 #define PAGESPEED_KERNEL_HTTP_QUERY_PARAMS_H_
19 
21 
25 
26 namespace net_instaweb {
27 
28 class GoogleUrl;
29 
31 class QueryParams {
32  public:
33  QueryParams() { }
34 
39  void ParseFromUrl(const GoogleUrl& gurl);
40 
50  void ParseFromUntrustedString(StringPiece query_param_string);
51 
54 
55  int size() const { return map_.num_values(); }
56  bool empty() const { return map_.empty(); }
57  void Clear() { map_.Clear(); }
58 
71  bool LookupEscaped(const StringPiece& name,
72  ConstStringStarVector* values) const {
73  return map_.Lookup(name, values);
74  }
80 
87  const GoogleString* Lookup1Escaped(const StringPiece& name) const {
88  return map_.Lookup1(name);
89  }
90 
94  bool Lookup1Unescaped(const StringPiece& name,
95  GoogleString* escaped_value) const;
96 
97  bool Has(const StringPiece& name) const { return map_.Has(name); }
98 
100  bool RemoveAll(const StringPiece& key) { return map_.RemoveAll(key); }
101 
105  bool RemoveAllFromSortedArray(const StringPiece* names, int names_size) {
106  return map_.RemoveAllFromSortedArray(names, names_size);
107  }
108 
109  StringPiece name(int index) const { return map_.name(index); }
110 
117  const GoogleString* EscapedValue(int index) const {
118  return map_.value(index);
119  }
120 
124  bool UnescapedValue(int index, GoogleString* escaped_val) const;
125 
127  void AddEscaped(const StringPiece& key, const StringPiece& value) {
128  return map_.Add(key, value);
129  }
130 
131  void CopyFrom(const QueryParams& query_param) {
132  map_.CopyFrom(query_param.map_);
133  }
134 
135  private:
136  StringMultiMapSensitive map_;
137 
138 
139 };
140 
141 }
142 
143 #endif
class GoogleUrl
Definition: google_url.h:58
Parses and rewrites URL query parameters.
Definition: query_params.h:31
void ParseFromUrl(const GoogleUrl &gurl)
bool UnescapedValue(int index, GoogleString *escaped_val) const
bool LookupEscaped(const StringPiece &name, ConstStringStarVector *values) const
Definition: query_params.h:71
bool RemoveAll(const StringPiece &key)
Remove all variables by name. Returns true if anything was removed.
Definition: query_params.h:100
void ParseFromUntrustedString(StringPiece query_param_string)
const GoogleString * EscapedValue(int index) const
Definition: query_params.h:117
void AddEscaped(const StringPiece &key, const StringPiece &value)
Add a new variable. The value can be null.
Definition: query_params.h:127
void Add(const StringPiece &key, const StringPiece &value)
Add a new variable. The value can be null.
Definition: string_multi_map.h:169
bool Lookup(const StringPiece &name, ConstStringStarVector *values) const
Definition: string_multi_map.h:69
bool RemoveAll(const StringPiece &key)
Remove all variables by name. Returns true if anything was removed.
Definition: string_multi_map.h:97
int num_values() const
Definition: string_multi_map.h:63
std::string GoogleString
PAGESPEED_KERNEL_BASE_STRING_H_.
Definition: string.h:24
bool Lookup1Unescaped(const StringPiece &name, GoogleString *escaped_value) const
const GoogleString * Lookup1Escaped(const StringPiece &name) const
Definition: query_params.h:87
const GoogleString * value(int index) const
Note that the value can be NULL.
Definition: string_multi_map.h:166
bool RemoveAllFromSortedArray(const StringPiece *names, int names_size)
Definition: query_params.h:105
const GoogleString * Lookup1(const StringPiece &name) const
Definition: string_multi_map.h:83
GoogleString ToEscapedString() const
Generates an escaped query-string.
bool RemoveAllFromSortedArray(const StringPiece *names, int names_size)
Definition: string_multi_map.h:104