urls.h

Go to the documentation of this file.
00001 /// @file   include/dmlite/cpp/utils/urls.h
00002 /// @brief  Common methods and functions for URL and path.
00003 /// @author Alejandro Álvarez Ayllón <aalvarez@cern.ch>
00004 #ifndef DMLITE_CPP_UTILS_URLS_H
00005 #define DMLITE_CPP_UTILS_URLS_H
00006 
00007 #include <string>
00008 #include <vector>
00009 
00010 namespace dmlite {
00011   
00012   struct Url {
00013     std::string scheme;
00014     std::string domain;
00015     unsigned    port;
00016     std::string path;
00017     std::string query;
00018     
00019     explicit Url(const std::string& url) throw ();
00020     
00021     // Operators
00022     bool operator == (const Url&) const;
00023     bool operator != (const Url&) const;
00024     bool operator <  (const Url&) const;
00025     bool operator >  (const Url&) const;
00026     
00027     /// Split a path into a list of components.
00028     /// @param path The path to split.
00029     /// @return     A list with the extracted components.
00030     static std::vector<std::string> splitPath(const std::string& path) throw ();
00031     
00032     /// Build a path from a list of components
00033     static std::string joinPath(const std::vector<std::string>& components) throw();
00034     
00035     /// Remove multiple slashes.
00036     static std::string normalizePath(const std::string& path) throw ();
00037   };
00038 
00039 };
00040 
00041 #endif // DMLITE_CPP_UTILS_URLS_H

Generated on 3 Mar 2013 for dmlite by  doxygen 1.4.7