dmlite 0.6
urls.h
Go to the documentation of this file.
1/// @file include/dmlite/cpp/utils/urls.h
2/// @brief Common methods and functions for URL and path.
3/// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
4#ifndef DMLITE_CPP_UTILS_URLS_H
5#define DMLITE_CPP_UTILS_URLS_H
6
7#include <string>
8#include <vector>
9#include "extensible.h"
10
11namespace dmlite {
12
13 class Url {
14 public:
15 std::string scheme;
16 std::string domain;
17 unsigned port;
18 std::string path;
20
21 Url() throw();
22 explicit Url(const std::string& url) throw ();
23 Url(const Url & _u);
24
25 // Operators
26 bool operator == (const Url&) const;
27 bool operator != (const Url&) const;
28 bool operator < (const Url&) const;
29 bool operator > (const Url&) const;
30
31 Url & operator = (const Url & _u);
32
33 std::string queryToString(void) const;
34 void queryFromString(const std::string& str);
35
36
37 std::string toString(void) const;
38
39 /// Split a path into a list of components.
40 /// @param path The path to split.
41 /// @return A list with the extracted components.
42 static std::vector<std::string> splitPath(const std::string& path) throw ();
43
44 /// Build a path from a list of components
45 static std::string joinPath(const std::vector<std::string>& components) throw();
46
47 /// Remove multiple slashes.
48 static std::string normalizePath(const std::string& path, const bool add_trailing_slash = true) throw ();
49
50 };
51};
52
53#endif // DMLITE_CPP_UTILS_URLS_H
Helpful typedef for KeyValue containers.
Definition extensible.h:20
Definition urls.h:13
static std::vector< std::string > splitPath(const std::string &path)
static std::string normalizePath(const std::string &path, const bool add_trailing_slash=true)
Remove multiple slashes.
std::string domain
Definition urls.h:16
static std::string joinPath(const std::vector< std::string > &components)
Build a path from a list of components.
Extensible query
Definition urls.h:19
std::string scheme
Definition urls.h:15
std::string queryToString(void) const
std::string path
Definition urls.h:18
std::string toString(void) const
unsigned port
Definition urls.h:17
void queryFromString(const std::string &str)
Extensible types (hold metadata).
Namespace for the dmlite C++ API.
Definition authn.h:16