URI query component. More...
#include <query.h>
  
 Public Member Functions | |
| std::string | encoding () const | 
| Calculate encoded string.  More... | |
| const_iterator | find (const std::string &key) const | 
| Find the const_iterator for the key.  More... | |
| iterator | find (const std::string &key) | 
| Find the iterator for the key.  More... | |
| template<typename T > | |
| bool | find (const std::string &key, T &value, bool &is_null) const | 
| Find the key and convert its associated value, returning true if the key is found and is_null true if the key is found but the value string is empty or isspace.  More... | |
| query () | |
| Construct.  More... | |
| query (const std::string &v, bool dosort=false) | |
Construct from encoded string, for example "a=foo%20bar&b=1", and sort the keys if dosort is true.  More... | |
| void | sort () | 
| Sort the pairs by key.  More... | |
| bool | sorted () const | 
| Test if sort() has been called.  More... | |
Static Public Attributes | |
| static const char | KEY_VALUE_SEP_CHAR | 
| key-value separator char ('=')  More... | |
| static const char | PAIRS_SEP_CHAR | 
| pairs separator char ('&')  More... | |
| static const char | PAIRS_SEP_CHAR2 | 
| pairs separator char (';') // added by Lauro  More... | |
Private Attributes | |
| bool | sorted_ | 
Friends | |
| bool TECOMMONEXPORT | parse (std::string::const_iterator &first, std::string::const_iterator last, query &v, std::string *errs) | 
| Parse URI query, returning whether found or not and advancing first and setting query if found.  More... | |
URI query component.
This parses the query component into a list of string pairs, the first is the key and the second the value.
Syntax (see uri_path for additional definitions): Both key and value are pct-decoded after parsing.
query = kv-pair *( "&" kv-pair ) kv-pair = key "=" [ value ] key = 1*qchar value = 1*qchar qchar = <pchar except "=" and "&"> | "/" | "?"
Note that this provides optional sorting for faster finds when there are a non-trivial number of pairs. However, once the query is sorted pairs must not be inserted.
| te::common::uri::query::query | ( | ) | 
Construct.
| te::common::uri::query::query | ( | const std::string & | v, | 
| bool | dosort = false  | 
        ||
| ) | 
Construct from encoded string, for example "a=foo%20bar&b=1", and sort the keys if dosort is true. 
Note that this should not contain the leading '?'. See parse() for less strict construction. 
| std::invalid_argument | if missing key or invalid encoding | 
| std::string te::common::uri::query::encoding | ( | ) | const | 
Calculate encoded string.
Referenced by te::common::uri::operator<<().
| const_iterator te::common::uri::query::find | ( | const std::string & | key | ) | const | 
Find the const_iterator for the key.
Note the search is linear if not sorted.
| iterator te::common::uri::query::find | ( | const std::string & | key | ) | 
Find the iterator for the key.
Note the search is linear if not sorted.
      
  | 
  inline | 
Find the key and convert its associated value, returning true if the key is found and is_null true if the key is found but the value string is empty or isspace.
The value is only set if found but not null. Note the search is linear.
| std::invalid_argument | if not null and cannot convert | 
Definition at line 79 of file query.h.
References te::common::uri::convert().
| void te::common::uri::query::sort | ( | ) | 
Sort the pairs by key.
This will speed the find methods if there are more than a trivial number of pairs.
      
  | 
  inline | 
      
  | 
  friend | 
Parse URI query, returning whether found or not and advancing first and setting query if found.
Does not skip leading space.
If errs is specified the following take place:
errs. 
      
  | 
  static | 
      
  | 
  static | 
      
  | 
  static |