AWS SDK for C++  1.8.95
AWS SDK for C++
URI.h
Go to the documentation of this file.
1 
6 #pragma once
7 
9 
10 #include <aws/core/http/Scheme.h>
13 
14 #include <stdint.h>
15 
16 namespace Aws
17 {
18  namespace Http
19  {
20  extern AWS_CORE_API const char* SEPARATOR;
21  static const uint16_t HTTP_DEFAULT_PORT = 80;
22  static const uint16_t HTTPS_DEFAULT_PORT = 443;
23 
24  //per https://tools.ietf.org/html/rfc3986#section-3.4 there is nothing preventing servers from allowing
25  //multiple values for the same key. So use a multimap instead of a map.
27 
32  {
33  public:
37  URI();
41  URI(const Aws::String&);
45  URI(const char*);
46 
47  URI& operator = (const Aws::String&);
48  URI& operator = (const char*);
49 
50  bool operator == (const URI&) const;
51  bool operator == (const Aws::String&) const;
52  bool operator == (const char*) const;
53  bool operator != (const URI&) const;
54  bool operator != (const Aws::String&) const;
55  bool operator != (const char*) const;
56 
60  inline Scheme GetScheme() const { return m_scheme; }
61 
65  void SetScheme(Scheme value);
66 
70  inline const Aws::String& GetAuthority() const { return m_authority; }
71 
75  inline void SetAuthority(const Aws::String& value) { m_authority = value; }
76 
80  inline uint16_t GetPort() const { return m_port; }
81 
86  inline void SetPort(uint16_t value) { m_port = value; }
87 
92  inline const Aws::String& GetPath() const { return m_path; }
93 
97  inline Aws::String GetURLEncodedPath() const { return URLEncodePath(m_path); }
98 
102  void SetPath(const Aws::String& value);
103 
107  inline const Aws::String& GetQueryString() const { return m_queryString; }
108 
112  void SetQueryString(const Aws::String& str);
113 
114  Aws::String GetFormParameters() const;
115 
119  void CanonicalizeQueryString();
120 
125  QueryStringParameterCollection GetQueryStringParameters(bool decode = true) const;
126 
130  void AddQueryStringParameter(const char* key, const Aws::String& value);
131 
135  void AddQueryStringParameter(const Aws::Map<Aws::String, Aws::String>& queryStringPairs);
136 
140  Aws::String GetURIString(bool includeQueryString = true) const;
141 
146  static Aws::String URLEncodePath(const Aws::String& path);
147 
151  static Aws::String URLEncodePathRFC3986(const Aws::String& path);
152 
153  private:
154  void ParseURIParts(const Aws::String& uri);
155  void ExtractAndSetScheme(const Aws::String& uri);
156  void ExtractAndSetAuthority(const Aws::String& uri);
157  void ExtractAndSetPort(const Aws::String& uri);
158  void ExtractAndSetPath(const Aws::String& uri);
159  void ExtractAndSetQueryString(const Aws::String& uri);
160  bool CompareURIParts(const URI& other) const;
161 
162  Scheme m_scheme;
163  Aws::String m_authority;
164  uint16_t m_port;
165  Aws::String m_path;
166  Aws::String m_queryString;
167  };
168 
169  } // namespace Http
170 } // namespace Aws
171 
const Aws::String & GetQueryString() const
Definition: URI.h:107
Scheme GetScheme() const
Definition: URI.h:60
uint16_t GetPort() const
Definition: URI.h:80
Aws::String GetURLEncodedPath() const
Definition: URI.h:97
std::map< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > Map
Definition: AWSMap.h:19
static const uint16_t HTTP_DEFAULT_PORT
Definition: URI.h:21
Aws::MultiMap< Aws::String, Aws::String > QueryStringParameterCollection
Definition: URI.h:26
const Aws::String & GetAuthority() const
Definition: URI.h:70
void SetPort(uint16_t value)
Definition: URI.h:86
AWS_CORE_API const char * SEPARATOR
std::basic_string< char, std::char_traits< char >, Aws::Allocator< char > > String
Definition: AWSString.h:97
static const uint16_t HTTPS_DEFAULT_PORT
Definition: URI.h:22
std::multimap< K, V, std::less< K >, Aws::Allocator< std::pair< const K, V > > > MultiMap
Definition: AWSMap.h:21
const Aws::String & GetPath() const
Definition: URI.h:92
void SetAuthority(const Aws::String &value)
Definition: URI.h:75
#define AWS_CORE_API
Definition: Core_EXPORTS.h:25