LibPkg
uri.h
Go to the documentation of this file.
1 // This file is part of LibPkg.
2 //
3 // Copyright 2004-2020 Graham Shaw
4 //
5 // Licensed under the Apache License, Version 2.0 (the "License");
6 // you may not use this file except in compliance with the License.
7 // You may obtain a copy of the License at
8 //
9 // http://www.apache.org/licenses/LICENSE-2.0
10 //
11 // Unless required by applicable law or agreed to in writing, software
12 // distributed under the License is distributed on an "AS IS" BASIS,
13 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 // See the License for the specific language governing permissions and
15 // limitations under the License.
16 
17 #ifndef LIBPKG_URI
18 #define LIBPKG_URI
19 
20 #include <string>
21 
22 namespace pkg {
23 
24 using std::string;
25 
36 class uri
37 {
38 private:
43  string _scheme;
44 
49  string _authority;
50 
52  string _path;
53 
58  string _query;
59 
64  string _fragment;
65 public:
67  uri();
68 
70  explicit uri(const string& s);
71 
75  operator string();
76 
82  uri operator+(const uri& rel_uri);
83 
89  uri& operator+=(const uri& rel_uri);
90 
96  const string& scheme() const
97  { return _scheme; }
98 
104  const string& authority() const
105  { return _authority; }
106 
110  const string& path() const
111  { return _path; }
112 
118  const string& query() const
119  { return _query; }
120 
126  const string& fragment() const
127  { return _fragment; }
128 
135  uri& scheme(const string& scheme);
136 
143  uri& authority(const string& authority);
144 
149  uri& path(const string& path);
150 
157  uri& query(const string& query);
158 
165  uri& fragment(const string& fragment);
166 };
167 
168 }; /* namespace pkg */
169 
170 #endif
A class to represent a uniform resource identifier.
Definition: uri.h:36
const string & query() const
Get query component.
Definition: uri.h:118
The namespace used to hold the package management library.
Definition: auto_dir.cc:23
uri & operator+=(const uri &rel_uri)
Resolve relative URI to produce absolute URI.
Definition: uri.cc:141
const string & authority() const
Get authority component.
Definition: uri.h:104
const string & fragment() const
Get fragment component.
Definition: uri.h:126
uri()
Construct empty URI.
uri operator+(const uri &rel_uri)
Resolve relative URI to produce absolute URI.
Definition: uri.cc:76
const string & scheme() const
Get scheme component.
Definition: uri.h:96
const string & path() const
Get path component.
Definition: uri.h:110

Reference Manual LibPkg Version 0.9.0 (4 Sep 2020)