#include <URI.hpp>
|
void | cleanup () |
| Cleans up the stored string, i.e. remove multiple / in sequence, ... More...
|
|
Uniform Resource Identifier (see http://en.wikipedia.org/wiki/Uniform_Resource_Identifier) Used to describe a component path (cpath://), a file path (file://, or a URL (http://, https://)
- Author
- Willem Deconinck
Definition at line 39 of file URI.hpp.
Empty constructor.
Definition at line 89 of file URI.cpp.
Copy constructor from other path object
- Parameters
-
Definition at line 95 of file URI.cpp.
URI |
( |
const std::string & |
s | ) |
|
Constructor from string object
- Parameters
-
Definition at line 100 of file URI.cpp.
Constructor from const char*
- Parameters
-
Definition at line 108 of file URI.cpp.
Constructor from string object and separate protocol
- Precondition
- assumes that string does not have a protocol, just the path
- Parameters
-
s | string with path |
p | scheme type e.g. (HTTP,CPATH,FILE) |
- Todo:
- check path
Definition at line 117 of file URI.cpp.
std::string base_name |
( |
| ) |
const |
Filename without extension.
Definition at line 300 of file URI.cpp.
- Returns
- the base path
Definition at line 199 of file URI.cpp.
Cleans up the stored string, i.e. remove multiple / in sequence, ...
Definition at line 306 of file URI.cpp.
- Returns
- if the path is empty
Definition at line 137 of file URI.hpp.
std::string extension |
( |
| ) |
const |
Extension of a filename.
Definition at line 294 of file URI.cpp.
bool is_absolute |
( |
| ) |
const |
Check if path is absolute. Should start with "//"
- Returns
- true if the path is absolute
Definition at line 194 of file URI.cpp.
bool is_complete |
( |
| ) |
const |
check this path is complete
- Postcondition
- true if does not contain ".." or "."
Definition at line 174 of file URI.cpp.
bool is_relative |
( |
| ) |
const |
Check is path is relative. Should not start with "//"
- Returns
- true if the path is a relative path
Definition at line 189 of file URI.cpp.
bool is_valid_element |
( |
const std::string & |
str | ) |
|
|
static |
check that the passed string is a valid path element
Definition at line 181 of file URI.cpp.
std::string name |
( |
| ) |
const |
- Returns
- the name of the object, without the path
Definition at line 221 of file URI.cpp.
bool operator!= |
( |
const URI & |
right | ) |
const |
URI operator/ |
( |
const URI & |
p | ) |
const |
concatenation operator with URI
Definition at line 159 of file URI.cpp.
URI & operator/= |
( |
const URI & |
rhs | ) |
|
concatenation and assignement operator with URI
Definition at line 137 of file URI.cpp.
URI & operator/= |
( |
const std::string & |
s | ) |
|
concatenation and assignement operator with std::string
Definition at line 145 of file URI.cpp.
URI & operator/= |
( |
const char * |
c | ) |
|
concatenation and assignement operator with C string
Definition at line 153 of file URI.cpp.
URI & operator= |
( |
const URI & |
p | ) |
|
assignement operator with URI
Definition at line 166 of file URI.cpp.
bool operator== |
( |
const URI & |
right | ) |
const |
comparison operator
Definition at line 126 of file URI.cpp.
std::string path |
( |
| ) |
const |
Gives the URI path, which is the URI without the scheme (protocol)
- Returns
- Returns the URI path
Definition at line 253 of file URI.cpp.
void path |
( |
const std::string & |
path | ) |
|
Changes the URI path
- Postcondition
- path() will return the supplied path
Definition at line 242 of file URI.cpp.
Gives the protocol (if any).
- Returns
- Returns the protocol. May return
URI::Protocol::INVALID
if no protocol has been specified.
Definition at line 248 of file URI.cpp.
Changes the protocol to the supplied scheme
- Postcondition
- scheme() will return the supplied protocol
Definition at line 237 of file URI.cpp.
const std::string separator |
( |
| ) |
|
|
static |
separator for path tokens
Definition at line 232 of file URI.cpp.
void split_path |
( |
const std::string & |
path, |
|
|
URI::Scheme::Type & |
protocol, |
|
|
std::string & |
real_path |
|
) |
| |
|
static |
Splits a given path into the URI protocol and the real path.
- Parameters
-
path | Path to split. |
protocol | Variable where to store the found protocol. The value is set to URI::Protocol::INVALID if no protocol found. |
real_path | Variable where to store the path. |
- Exceptions
-
Definition at line 267 of file URI.cpp.
std::string string |
( |
| ) |
const |
- Returns
- the full URI as a string
Definition at line 258 of file URI.cpp.
std::ostream& operator<< |
( |
std::ostream & |
out, |
|
|
const URI & |
path |
|
) |
| |
|
friend |
Overloading of the stream operator "<<" for the output. No "\n"ine introduced.
- Parameters
-
[in] | out | the out stream |
[in] | path | the path to output |
- Returns
- the out stream
Definition at line 73 of file URI.cpp.
std::istream& operator>> |
( |
std::istream & |
in, |
|
|
URI & |
path |
|
) |
| |
|
friend |
Overloading of the stream operator ">>" for the input
- Parameters
-
[in] | in | the in stream |
[out] | path | the path to read |
- Returns
- the in stream
Definition at line 79 of file URI.cpp.
path string
Definition at line 198 of file URI.hpp.
The documentation for this class was generated from the following files: