diff options
Diffstat (limited to 'src/url.h')
| -rw-r--r-- | src/url.h | 68 | 
1 files changed, 34 insertions, 34 deletions
| @@ -1,5 +1,5 @@ | |||
| 1 | /* | 1 | /* | 
| 2 | * Copyright (C) 2007-2010 Xagasoft, All rights reserved. | 2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | 
| 3 | * | 3 | * | 
| 4 | * This file is part of the libbu++ library and is released under the | 4 | * This file is part of the libbu++ library and is released under the | 
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. | 
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_URL_H | 8 | #ifndef BU_URL_H | 
| 9 | #define BU_URL_H | 9 | #define BU_URL_H | 
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" | 
| 12 | #include "bu/atom.h" | 12 | #include "bu/atom.h" | 
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu | 
| @@ -20,61 +20,61 @@ namespace Bu | |||
| 20 | { | 20 | { | 
| 21 | Param() { } | 21 | Param() { } | 
| 22 | Param( const Param &r ) : sName( r.sName ), sValue( r.sValue ) { } | 22 | Param( const Param &r ) : sName( r.sName ), sValue( r.sValue ) { } | 
| 23 | Param( const Bu::FString &n, const Bu::FString &v ) : | 23 | Param( const Bu::String &n, const Bu::String &v ) : | 
| 24 | sName( n ), sValue( v ) { } | 24 | sName( n ), sValue( v ) { } | 
| 25 | Bu::FString sName; | 25 | Bu::String sName; | 
| 26 | Bu::FString sValue; | 26 | Bu::String sValue; | 
| 27 | } Param; | 27 | } Param; | 
| 28 | typedef Bu::List<Param> ParamList; | 28 | typedef Bu::List<Param> ParamList; | 
| 29 | 29 | ||
| 30 | public: | 30 | public: | 
| 31 | Url(); | 31 | Url(); | 
| 32 | Url( const Bu::FString &sUrl ); | 32 | Url( const Bu::String &sUrl ); | 
| 33 | virtual ~Url(); | 33 | virtual ~Url(); | 
| 34 | 34 | ||
| 35 | void parseUrl( const Bu::FString &sUrl ); | 35 | void parseUrl( const Bu::String &sUrl ); | 
| 36 | void parseParams( const Bu::FString &sQuery ); | 36 | void parseParams( const Bu::String &sQuery ); | 
| 37 | void parseParams( Bu::FString::const_iterator &i ); | 37 | void parseParams( Bu::String::const_iterator &i ); | 
| 38 | void parsePath( const Bu::FString &sPath ); | 38 | void parsePath( const Bu::String &sPath ); | 
| 39 | void parsePath( Bu::FString::const_iterator &i ); | 39 | void parsePath( Bu::String::const_iterator &i ); | 
| 40 | void clear(); | 40 | void clear(); | 
| 41 | 41 | ||
| 42 | Bu::FString getUrl() const; | 42 | Bu::String getUrl() const; | 
| 43 | Bu::FString getFullPath() const; | 43 | Bu::String getFullPath() const; | 
| 44 | 44 | ||
| 45 | const Bu::FString &getProtocol() const { return sProtocol; } | 45 | const Bu::String &getProtocol() const { return sProtocol; } | 
| 46 | const Bu::FString &getUser() const { return sUser; } | 46 | const Bu::String &getUser() const { return sUser; } | 
| 47 | const Bu::FString &getPass() const { return sPass; } | 47 | const Bu::String &getPass() const { return sPass; } | 
| 48 | const Bu::FString &getHost() const { return sHost; } | 48 | const Bu::String &getHost() const { return sHost; } | 
| 49 | const Bu::FString &getPath() const { return sPath; } | 49 | const Bu::String &getPath() const { return sPath; } | 
| 50 | int getPort() const { return iPort; } | 50 | int getPort() const { return iPort; } | 
| 51 | ParamList::const_iterator getParamBegin() const | 51 | ParamList::const_iterator getParamBegin() const | 
| 52 | { return lParam.begin(); } | 52 | { return lParam.begin(); } | 
| 53 | 53 | ||
| 54 | void setProtocol( const Bu::FString &sNewHost, bool bAutoSetPort=true ); | 54 | void setProtocol( const Bu::String &sNewHost, bool bAutoSetPort=true ); | 
| 55 | void setUser( const Bu::FString &s ) { sUser = s; } | 55 | void setUser( const Bu::String &s ) { sUser = s; } | 
| 56 | void setPass( const Bu::FString &s ) { sPass = s; } | 56 | void setPass( const Bu::String &s ) { sPass = s; } | 
| 57 | void setHost( const Bu::FString &s ) { sHost = s; } | 57 | void setHost( const Bu::String &s ) { sHost = s; } | 
| 58 | void setPath( const Bu::FString &s ) { sPath = s; } | 58 | void setPath( const Bu::String &s ) { sPath = s; } | 
| 59 | void setPort( int i ) { iPort = i; } | 59 | void setPort( int i ) { iPort = i; } | 
| 60 | void addParam( const Bu::FString &n, const Bu::FString &v ); | 60 | void addParam( const Bu::String &n, const Bu::String &v ); | 
| 61 | 61 | ||
| 62 | bool hasPort() const { return iPort.has(); } | 62 | bool hasPort() const { return iPort.has(); } | 
| 63 | 63 | ||
| 64 | static Bu::FString decode( const Bu::FString &sStr ); | 64 | static Bu::String decode( const Bu::String &sStr ); | 
| 65 | static Bu::FString encode( const Bu::FString &sStr ); | 65 | static Bu::String encode( const Bu::String &sStr ); | 
| 66 | 66 | ||
| 67 | private: // Parsing code | 67 | private: // Parsing code | 
| 68 | void parseProtocol( Bu::FString::const_iterator &i ); | 68 | void parseProtocol( Bu::String::const_iterator &i ); | 
| 69 | void parseUserPass( Bu::FString::const_iterator &i ); | 69 | void parseUserPass( Bu::String::const_iterator &i ); | 
| 70 | void parseHost( Bu::FString::const_iterator &i ); | 70 | void parseHost( Bu::String::const_iterator &i ); | 
| 71 | 71 | ||
| 72 | private: | 72 | private: | 
| 73 | Bu::FString sProtocol; | 73 | Bu::String sProtocol; | 
| 74 | Bu::FString sUser; | 74 | Bu::String sUser; | 
| 75 | Bu::FString sPass; | 75 | Bu::String sPass; | 
| 76 | Bu::FString sHost; | 76 | Bu::String sHost; | 
| 77 | Bu::FString sPath; | 77 | Bu::String sPath; | 
| 78 | Bu::Atom<int> iPort; | 78 | Bu::Atom<int> iPort; | 
| 79 | ParamList lParam; | 79 | ParamList lParam; | 
| 80 | 80 | ||
