00001
00002
00003
00004 #ifndef DMLITE_CPP_UTILS_URLS_H
00005 #define DMLITE_CPP_UTILS_URLS_H
00006
00007 #include <string>
00008 #include <vector>
00009 #include "extensible.h"
00010
00011 namespace dmlite {
00012
00013 struct Url {
00014 std::string scheme;
00015 std::string domain;
00016 unsigned port;
00017 std::string path;
00018 Extensible query;
00019
00020 Url() throw();
00021 explicit Url(const std::string& url) throw ();
00022 Url(const Url & _u);
00023
00024
00025 bool operator == (const Url&) const;
00026 bool operator != (const Url&) const;
00027 bool operator < (const Url&) const;
00028 bool operator > (const Url&) const;
00029
00030 Url & operator = (const Url & _u);
00031
00032 std::string queryToString(void) const;
00033 void queryFromString(const std::string& str);
00034
00035
00036 std::string toString(void) const;
00037
00038
00039
00040
00041 static std::vector<std::string> splitPath(const std::string& path) throw ();
00042
00043
00044 static std::string joinPath(const std::vector<std::string>& components) throw();
00045
00046
00047 static std::string normalizePath(const std::string& path, const bool add_trailing_slash = true) throw ();
00048
00049 };
00050 };
00051
00052 #endif // DMLITE_CPP_UTILS_URLS_H