include/dmlite/cpp/utils/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 #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     // Operators
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     /// Split a path into a list of components.
00039     /// @param path The path to split.
00040     /// @return     A list with the extracted components.
00041     static std::vector<std::string> splitPath(const std::string& path) throw ();
00042     
00043     /// Build a path from a list of components
00044     static std::string joinPath(const std::vector<std::string>& components) throw();
00045     
00046     /// Remove multiple slashes.
00047     static std::string normalizePath(const std::string& path) throw ();
00048      
00049   };
00050 };
00051 
00052 #endif // DMLITE_CPP_UTILS_URLS_H

Generated on 28 Apr 2014 for dmlite by  doxygen 1.4.7