Main Page   Class Hierarchy   Alphabetical List   Data Structures   File List   Data Fields  

network.Url.h

00001 /*----------------------------------------------------------------------------
00002   SWORD 2000 - Software With Objects for Rapid Development
00003   Copyright (C) 2003 Eric NICOLAS
00004   ----------------------------------------------------------------------------
00005   SWORD is free software; you can redistribute it and/or modify
00006   it under the terms of the GNU Lesser General Public License as published by
00007   the Free Software Foundation; either version 2 of the License, or
00008   (at your option) any later version.
00009 
00010   SWORD is distributed in the hope that it will be useful,
00011   but WITHOUT ANY WARRANTY; without even the implied warranty of
00012   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013   GNU Lesser General Public License for more details.
00014 
00015   You should have received a copy of the GNU Lesser General Public License
00016   along with SWORD; if not, write to the Free Software
00017   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
00018   --------------------------------------------------------------------------*/
00019 #ifndef _SWORD_NETWORK_URL_
00020 #define _SWORD_NETWORK_URL_
00021 
00022 namespace sword {
00023 
00025 
00036         class SWORDDECL URL {
00037         public:
00039                 URL();
00040 
00042                 URL(const std::string &url);
00043 
00045                 URL(const URL &url);
00046 
00047                 ~URL();
00048 
00050                 URL &operator=(const URL &url);
00051 
00053 
00057                 void parse(const std::string &url, bool needAbsolute = false);
00058 
00060 
00064                 void navigate(const std::string &move);
00065 
00066                 //: Stringify the URL
00067                 std::string toString() const;
00068 
00069                 enum Scheme {
00070                         http,
00071                         ftp,
00072                         nntp,
00073 
00074                         invalid
00075                 };
00076 
00078                 bool empty() const;
00079 
00081                 const std::string &server() const;
00082 
00084                 const int port() const;
00085 
00087                 const std::string &pathname() const;
00088 
00090                 std::string path() const;
00091 
00093                 std::string filename() const;
00094 
00096                 Scheme scheme() const;
00097 
00099                 bool hasCredentials() const;
00100 
00102 
00103                 const std::string &login() const;
00104 
00106 
00107                 const std::string &password() const;
00108 
00109         private:
00110                 // status
00111                 bool        empty_;
00112                 // absolute part
00113                 Scheme      scheme_;
00114                 std::string login_;             // empty if no credentials
00115                 std::string password_;  // empty if no credentials
00116                 std::string server_;
00117                 int         port_;
00118                 // navigatable part
00119                 std::string pathname_;
00120         };
00121 
00122         class UrlInvalidException : public Exception {};
00123 
00124 } // namespace sword
00125 
00126 #include "sword.private/network.Url.inl"
00127 
00128 #endif // _SWORD_NETWORK_URL_

Generated on Tue Dec 23 20:08:56 2003 for SWORD by doxygen1.3-rc2