You.i Engine
YiUrlQuery.h
Go to the documentation of this file.
1 // © You i Labs Inc. 2000-2020. All rights reserved.
2 #ifndef _YI_URL_QUERY_H_
3 #define _YI_URL_QUERY_H_
4 
5 #include "framework/YiPredef.h"
6 #include "network/YiUrl.h"
7 #include "utility/YiString.h"
8 
29 {
30 public:
31  CYIUrlQuery();
32  CYIUrlQuery(const CYIUrl &url);
33 
42 
43  bool operator==(const CYIUrlQuery &other) const;
44  bool operator!=(const CYIUrlQuery &other) const;
45 
57  void Add(const CYIString &key, const CYIString &value, CYIUrl::Encoding encoding = CYIUrl::Encoding::Decoded);
58 
66  void Remove(const CYIString &rKey, CYIUrl::Encoding encoding = CYIUrl::Encoding::Decoded);
67 
75  void RemoveAll(const CYIString &rKey, CYIUrl::Encoding encoding = CYIUrl::Encoding::Decoded);
76 
84  const CYIString &GetValue(const CYIString &key, bool *pNotFound = nullptr) const;
85 
93  CYIString GetValue(const CYIString &key, CYIUrl::Encoding encoding, bool *pNotFound = nullptr) const;
94 
102  std::vector<CYIString> GetValues(const CYIString &key, CYIUrl::Encoding encoding = CYIUrl::Encoding::Decoded) const;
103 
111  bool HasKey(const CYIString &key, CYIUrl::Encoding encoding = CYIUrl::Encoding::Decoded) const;
112 
118  void Clear();
119 
125  void SetParameters(const std::vector<std::pair<CYIString, CYIString>> &parameters, CYIUrl::Encoding encoding = CYIUrl::Encoding::Decoded);
126 
136  void SetString(const CYIString &query, CYIUrl::Encoding encoding = CYIUrl::Encoding::Encoded);
137 
141  bool IsEmpty() const;
142 
148  const std::vector<std::pair<CYIString, CYIString>> &GetParameters() const;
149  std::vector<std::pair<CYIString, CYIString>> GetParameters(CYIUrl::Encoding encoding) const;
150 
162 
166  CYIString RetrieveAndRemoveQueryString(const CYIString &key, bool *pSuccess = nullptr);
167 
168 private:
169  std::vector<std::pair<CYIString, CYIString>> m_parameters;
170 };
171 
176 #endif
Container class for Unicode strings. Conceptually, a CYIString object is a sequence of Unicode charac...
Definition: YiString.h:36
void Clear()
CYIString RetrieveAndRemoveQueryString(const CYIString &key, bool *pSuccess=nullptr)
void Remove(const CYIString &rKey, CYIUrl::Encoding encoding=CYIUrl::Encoding::Decoded)
bool IsEmpty() const
void SetString(const CYIString &query, CYIUrl::Encoding encoding=CYIUrl::Encoding::Encoded)
CYIString ToString(CYIUrl::Encoding encoding=CYIUrl::Encoding::Encoded) const
bool HasKey(const CYIString &key, CYIUrl::Encoding encoding=CYIUrl::Encoding::Decoded) const
const CYIString & GetValue(const CYIString &key, bool *pNotFound=nullptr) const
void Add(const CYIString &key, const CYIString &value, CYIUrl::Encoding encoding=CYIUrl::Encoding::Decoded)
void SetParameters(const std::vector< std::pair< CYIString, CYIString >> &parameters, CYIUrl::Encoding encoding=CYIUrl::Encoding::Decoded)
An URL query builder.
Definition: YiUrlQuery.h:28
A class used to encapsulate an URL.
Definition: YiUrl.h:24
bool operator==(const CYIUrlQuery &other) const
Encoding
Definition: YiUrl.h:45
std::vector< CYIString > GetValues(const CYIString &key, CYIUrl::Encoding encoding=CYIUrl::Encoding::Decoded) const
bool operator!=(const CYIUrlQuery &other) const
void RemoveAll(const CYIString &rKey, CYIUrl::Encoding encoding=CYIUrl::Encoding::Decoded)
const std::vector< std::pair< CYIString, CYIString > > & GetParameters() const