diff options
author | Philippe Pebay <pppebay@sandia.gov> | 2007-12-05 17:24:27 (GMT) |
---|---|---|
committer | Philippe Pebay <pppebay@sandia.gov> | 2007-12-05 17:24:27 (GMT) |
commit | f18ae2234c6fecedd440670e9651fb06761049df (patch) | |
tree | b4b15dfda017ca2f438f99f0ed71610c2a2746db /Source/kwsys/SystemTools.hxx.in | |
parent | 8eea168c232463b3623ec621932b689232b98699 (diff) | |
download | CMake-f18ae2234c6fecedd440670e9651fb06761049df.zip CMake-f18ae2234c6fecedd440670e9651fb06761049df.tar.gz CMake-f18ae2234c6fecedd440670e9651fb06761049df.tar.bz2 |
ENH: added two functions for URL parsing:
1. an "abridged" version that separates protocol from dataglom in
an expression with the form protocol://dataglom
2. a "full" version that parses protocol, username, password,
hostname, port, and path in a standard URL (all of these variables
are optional, except for protocol and hostname).
Diffstat (limited to 'Source/kwsys/SystemTools.hxx.in')
-rw-r--r-- | Source/kwsys/SystemTools.hxx.in | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/Source/kwsys/SystemTools.hxx.in b/Source/kwsys/SystemTools.hxx.in index 7cad203..568643b 100644 --- a/Source/kwsys/SystemTools.hxx.in +++ b/Source/kwsys/SystemTools.hxx.in @@ -783,6 +783,36 @@ public: static void ConvertWindowsCommandLineToUnixArguments( const char *cmd_line, int *argc, char ***argv); + /** ----------------------------------------------------------------- + * URL Manipulation Routines + * ----------------------------------------------------------------- + */ + + /** + * Parse a character string : + * protocol://dataglom + * and fill protocol as appropriate. + * Return false if the URL does not have the required form, true otherwise. + */ + static bool ParseURLProtocol( const kwsys_stl::string& URL, + kwsys_stl::string& protocol, + kwsys_stl::string& dataglom ); + + /** + * Parse a string (a URL without protocol prefix) with the form: + * protocol://[[username[':'password]'@']hostname[':'dataport]]'/'[datapath] + * and fill protocol, username, password, hostname, dataport, and datapath + * when values are found. + * Return true if the string matches the format; false otherwise. + */ + static bool ParseURL( const kwsys_stl::string& URL, + kwsys_stl::string& protocol, + kwsys_stl::string& username, + kwsys_stl::string& password, + kwsys_stl::string& hostname, + kwsys_stl::string& dataport, + kwsys_stl::string& datapath ); + private: /** * Allocate the std::map that serve as the Path Translation table. |