16 #ifndef INCLUDE_NN_NLIB_URI_H_ 17 #define INCLUDE_NN_NLIB_URI_H_ 23 #include "nn/nlib/Swap.h" 29 class MemoryOutputStream;
41 static errno_t DecodeUriComponent(
size_t* written,
char* buf,
size_t n,
const char* first,
44 const char* s) NLIB_NOEXCEPT {
45 return DecodeUriComponent(written, buf, n, s, s +
nlib_strlen(s));
47 static errno_t EncodeUriComponent(
size_t* written,
char* buf,
size_t n,
const char* first,
50 bool fragment_mode) NLIB_NOEXCEPT {
51 return EncodeUriComponent(written, buf, n, s, s +
nlib_strlen(s), fragment_mode);
58 const char* s) NLIB_NOEXCEPT {
59 return DecodeUriComponent(written, buf, N, s);
63 const char* last) NLIB_NOEXCEPT {
64 return DecodeUriComponent(written, buf, N, first, last);
68 bool fragment_mode) NLIB_NOEXCEPT {
69 return EncodeUriComponent(written, buf, N, s, fragment_mode);
73 const char* last,
bool fragment_mode) NLIB_NOEXCEPT {
74 return EncodeUriComponent(written, buf, N, first, last, fragment_mode);
78 return DecodePath(written, buf, N, s);
82 return EncodePath(written, buf, N, s);
86 Uri() NLIB_NOEXCEPT : prv_(NULL) {}
88 NLIB_MOVE_MEMBER_HELPER_1(
Uri, prv_);
99 bool SetUri(
const char* scheme,
const char* userinfo,
const char* host,
100 const char* port,
const char* path,
const char* query,
102 bool ComposeString(
char* buf,
size_t size)
const NLIB_NOEXCEPT;
105 return this->ComposeString(buf, N);
127 void swap(
Uri& rhs) NLIB_NOEXCEPT {
129 swap(prv_, rhs.prv_);
145 mutable UriPrivate* prv_;
151 #endif // INCLUDE_NN_NLIB_URI_H_ static errno_t DecodeUriComponent(size_t *written, char *buf, size_t n, const char *s) noexcept
Decodes a percent-encoded string.
static errno_t EncodeUriComponent(size_t *written, char *buf, size_t n, const char *s, bool fragment_mode) noexcept
Percent-encodes a string.
static errno_t DecodePath(size_t *written, char(&buf)[N], const char *s) noexcept
Calls DecodePath(written, buf, N, s) .
static errno_t DecodeUriComponent(size_t *written, char(&buf)[N], const char *s) noexcept
Calls DecodeUriComponent(written, buf, N, s).
#define NLIB_DISALLOW_COPY_AND_ASSIGN(TypeName)
Prohibits use of the copy constructor and assignment operator for the class specified by TypeName...
static errno_t EncodePath(size_t *written, char(&buf)[N], const char *s) noexcept
Calls EncodePath(written, buf, N, s).
Uri() noexcept
Instantiates the object with default parameters (default constructor). Initializes an object...
static errno_t DecodeUriComponent(size_t *written, char(&buf)[N], const char *first, const char *last) noexcept
Calls DecodeUriComponent(written, buf, N, first, last).
Defines the class that resembles std::vector but can store objects that cannot be copied...
static errno_t EncodeUriComponent(size_t *written, char(&buf)[N], const char *first, const char *last, bool fragment_mode) noexcept
Calls EncodeUriComponent(written, buf, N, first, last, fragment_mode).
static errno_t EncodeUriComponent(size_t *written, char(&buf)[N], const char *s, bool fragment_mode) noexcept
Calls EncodeUriComponent(written, buf, N, s, fragment_mode).
bool ComposeString(char(&buf)[N]) const noexcept
Writes a URI string.
#define NLIB_NOEXCEPT
Defines noexcept geared to the environment, or the equivalent.
A file that contains the configuration information for each development environment.
The class for parsing and constructing regular URIs.
#define NLIB_FINAL
Defines final if it is available for use. If not, holds an empty string.