Url.hpp

Go to the documentation of this file.
00001 /*---------------------------------------------------------------------\
00002 |                                                                      |
00003 |                     _     _   _   _     __     _                     |
00004 |                    | |   | | | \_/ |   /  \   | |                    |
00005 |                    | |   | | | |_| |  / /\ \  | |                    |
00006 |                    | |__ | | | | | | / ____ \ | |__                  |
00007 |                    |____||_| |_| |_|/ /    \ \|____|                 |
00008 |                                                                      |
00009 |                             core library                             |
00010 |                                                                      |
00011 |                                         (C) SUSE Linux Products GmbH |
00012 \----------------------------------------------------------------------/
00013 
00014   File:       Url.hpp
00015 
00016   Author:     Marius Tomaschewski
00017   Maintainer: Marius Tomaschewski
00018 
00019 /-*/
00024 #ifndef   LIMAL_URL_HPP
00025 #define   LIMAL_URL_HPP
00026 
00027 #include <limal/config.h>
00028 #include <limal/UrlBase.hpp>
00029 
00030 
00031 // -------------------------------------------------------------------
00032 namespace LIMAL_NAMESPACE
00033 {
00034 namespace url
00035 {
00036 
00096 class Url
00097 {
00098 public:
00102         typedef limal::url::EEncoding    EEncoding;
00103 
00107         typedef limal::url::ViewOptions  ViewOptions;
00108 
00109 
00110         ~Url();
00111         Url();
00112 
00123         Url(const Url &url);
00124 
00125 
00136         Url(const limal::url::UrlRef &url);
00137 
00138 
00149         Url(const blocxx::String &urlString);
00150 
00151 
00152         // -----------------
00170         static url::UrlRef
00171         parseUrl(const blocxx::String &urlString);
00172 
00173 
00174         // -----------------
00186         Url&
00187         operator = (const blocxx::String &urlString);
00188 
00189 
00200         Url&
00201         operator = (const Url &url);
00202 
00203 
00204         // -----------------
00209         blocxx::StringArray
00210         getKnownSchemes() const;
00211 
00212 
00227         bool
00228         isValidScheme(const blocxx::String &scheme) const;
00229 
00230 
00240         bool
00241         isValid() const;
00242 
00243 
00244         // -----------------
00252         blocxx::String
00253         toString() const;
00254 
00267         blocxx::String
00268         toString(const ViewOptions &opts) const;
00269 
00279         blocxx::String
00280         toCompleteString() const;
00281 
00282 
00283         // -----------------
00288         blocxx::String
00289         getScheme() const;
00290 
00291 
00292         // -----------------
00302         blocxx::String
00303         getAuthority() const;
00304 
00312         blocxx::String
00313         getUsername(EEncoding eflag = limal::url::E_DECODED) const;
00314 
00322         blocxx::String
00323         getPassword(EEncoding eflag = limal::url::E_DECODED) const;
00324 
00337         blocxx::String
00338         getHost(EEncoding eflag = limal::url::E_DECODED) const;
00339 
00344         blocxx::String
00345         getPort() const;
00346 
00347 
00348         // -----------------
00358         blocxx::String
00359         getPathData() const;
00360 
00369         blocxx::String
00370         getPathName(EEncoding eflag = limal::url::E_DECODED) const;
00371 
00376         blocxx::String
00377         getPathParams() const;
00378 
00391         blocxx::StringArray
00392         getPathParamsArray() const;
00393 
00413         limal::url::ParamMap
00414         getPathParamsMap(EEncoding eflag = limal::url::E_DECODED) const;
00415 
00432         blocxx::String
00433         getPathParam(const blocxx::String &param,
00434                      EEncoding            eflag = limal::url::E_DECODED) const;
00435 
00436 
00437         // -----------------
00447         blocxx::String
00448         getQueryString() const;
00449 
00463         blocxx::StringArray
00464         getQueryStringArray() const;
00465 
00484         limal::url::ParamMap
00485         getQueryStringMap(EEncoding eflag = limal::url::E_DECODED) const;
00486 
00503         blocxx::String
00504         getQueryParam(const blocxx::String &param,
00505                       EEncoding            eflag = limal::url::E_DECODED) const;
00506 
00507 
00508         // -----------------
00516         blocxx::String
00517         getFragment(EEncoding eflag = limal::url::E_DECODED) const;
00518 
00519 
00520         // -----------------
00527         void
00528         setScheme(const blocxx::String &scheme);
00529 
00530 
00531         // -----------------
00545         void
00546         setAuthority(const blocxx::String &authority);
00547 
00557         void
00558         setUsername(const blocxx::String &user,
00559                     EEncoding            eflag = limal::url::E_DECODED);
00560 
00570         void
00571         setPassword(const blocxx::String &pass,
00572                     EEncoding            eflag = limal::url::E_DECODED);
00573 
00594         void
00595         setHost(const blocxx::String &host,
00596                 EEncoding            eflag = limal::url::E_DECODED);
00597 
00605         void
00606         setPort(const blocxx::String &port);
00607 
00608 
00609         // -----------------
00620         void
00621         setPathData(const blocxx::String &pathdata);
00622 
00630         void
00631         setPathName(const blocxx::String &path,
00632                     EEncoding            eflag = limal::url::E_DECODED);
00633 
00640         void
00641         setPathParams(const blocxx::String &params);
00642 
00649         void
00650         setPathParamsArray(const blocxx::StringArray &parray);
00651 
00658         void
00659         setPathParamsMap(const limal::url::ParamMap &pmap);
00660 
00670         void
00671         setPathParam(const blocxx::String &param, const blocxx::String &value);
00672 
00673 
00674         // -----------------
00681         void
00682         setQueryString(const blocxx::String &querystr);
00683 
00690         void
00691         setQueryStringArray(const blocxx::StringArray &qarray);
00692 
00699         void
00700         setQueryStringMap(const limal::url::ParamMap &qmap);
00701 
00711         void
00712         setQueryParam(const blocxx::String &param, const blocxx::String &value);
00713 
00714 
00715         // -----------------
00723         void
00724         setFragment(const blocxx::String &fragment,
00725                     EEncoding            eflag = limal::url::E_DECODED);
00726 
00727 
00728         // -----------------
00737         ViewOptions
00738         getViewOptions() const;
00739 
00748         void
00749         setViewOptions(const ViewOptions &vopts);
00750 
00757         friend std::ostream &
00758         operator<<(std::ostream &os, const Url &url);
00759 
00760 private:
00761         url::UrlRef m_impl;
00762 };
00763 
00764 
00765 // -------------------------------------------------------------------
00766 }      // End url namespace
00767 }      // End of LIMAL_NAMESPACE
00768 #endif // LIMAL_URLUTILS_HPP
00769 // vim: set ts=8 sts=8 sw=8 ai noet:

Generated on Mon Nov 27 22:20:57 2006 for limal by  doxygen 1.5.0