blob: 6103bff5871ac9037d5d3c5c1542ebedf2ba2e61 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
|
#ifndef URI_HPP
#define URI_HPP
/**
* @file Uri.hpp
*
* This module declares the Uri::Uri class.
*
* © 2018 by Richard Walters
*/
#include <memory>
#include <string>
#include <vector>
namespace Uri {
/**
* This class represents a Uniform Resource Identifier (URI),
* as defined in RFC 3986 (https://tools.ietf.org/html/rfc3986).
*/
class Uri {
// Lifecycle management
public:
~Uri();
Uri(const Uri&) = delete;
Uri(Uri&&) = delete;
Uri& operator=(const Uri&) = delete;
Uri& operator=(Uri&&) = delete;
// Public methods
public:
/**
* This is the default constructor.
*/
Uri();
/**
* This method sets the character or character sequence
* that should be interpreted as a path delimiter.
*
* @param[in] newPathDelimiter
* This is the character or character sequence
* that should be interpreted as a path delimiter.
*/
void SetPathDelimiter(const std::string& newPathDelimiter);
/**
* This method builds the URI from the elements parsed
* from the given string rendering of a URI.
*
* @param[in] uriString
* This is the string rendering of the URI to parse.
*
* @return
* An indication of whether or not the URI was
* parsed successfully is returned.
*/
bool ParseFromString(const std::string& uriString);
/**
* This method returns the "scheme" element of the URI.
*
* @return
* The "scheme" element of the URI is returned.
*
* @retval ""
* This is returned if there is no "scheme" element in the URI.
*/
std::string GetScheme() const;
/**
* This method returns the "host" element of the URI.
*
* @return
* The "host" element of the URI is returned.
*
* @retval ""
* This is returned if there is no "host" element in the URI.
*/
std::string GetHost() const;
/**
* This method returns the "path" element of the URI,
* as a sequence of steps.
*
* @note
* If the first step of the path is an empty string,
* then the URI has an absolute path.
*
* @return
* The "path" element of the URI is returned
* as a sequence of steps.
*/
std::vector< std::string > GetPath() const;
// Private properties
private:
/**
* This is the type of structure that contains the private
* properties of the instance. It is defined in the implementation
* and declared here to ensure that it is scoped inside the class.
*/
struct Impl;
/**
* This contains the private properties of the instance.
*/
std::unique_ptr< struct Impl > impl_;
};
}
#endif /* URI_HPP */
|