diff options
Diffstat (limited to 'src/unstable/url.h')
-rw-r--r-- | src/unstable/url.h | 114 |
1 files changed, 57 insertions, 57 deletions
diff --git a/src/unstable/url.h b/src/unstable/url.h index 34a335d..3edf94b 100644 --- a/src/unstable/url.h +++ b/src/unstable/url.h | |||
@@ -13,73 +13,73 @@ | |||
13 | 13 | ||
14 | namespace Bu | 14 | namespace Bu |
15 | { | 15 | { |
16 | class Url | 16 | class Url |
17 | { | 17 | { |
18 | public: | 18 | public: |
19 | typedef struct Param | 19 | typedef struct Param |
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::String &n, const Bu::String &v ) : | 23 | Param( const Bu::String &n, const Bu::String &v ) : |
24 | sName( n ), sValue( v ) { } | 24 | sName( n ), sValue( v ) { } |
25 | Bu::String sName; | 25 | Bu::String sName; |
26 | Bu::String 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::String &sUrl ); | 32 | Url( const Bu::String &sUrl ); |
33 | virtual ~Url(); | 33 | virtual ~Url(); |
34 | 34 | ||
35 | void parseUrl( const Bu::String &sUrl ); | 35 | void parseUrl( const Bu::String &sUrl ); |
36 | void parseParams( const Bu::String &sQuery ); | 36 | void parseParams( const Bu::String &sQuery ); |
37 | void parseParams( Bu::String::const_iterator &i ); | 37 | void parseParams( Bu::String::const_iterator &i ); |
38 | void parsePath( const Bu::String &sPath ); | 38 | void parsePath( const Bu::String &sPath ); |
39 | void parsePath( Bu::String::const_iterator &i ); | 39 | void parsePath( Bu::String::const_iterator &i ); |
40 | void clear(); | 40 | void clear(); |
41 | 41 | ||
42 | Bu::String getUrl() const; | 42 | Bu::String getUrl() const; |
43 | Bu::String getFullPath() const; | 43 | Bu::String getFullPath() const; |
44 | 44 | ||
45 | const Bu::String &getProtocol() const { return sProtocol; } | 45 | const Bu::String &getProtocol() const { return sProtocol; } |
46 | const Bu::String &getUser() const { return sUser; } | 46 | const Bu::String &getUser() const { return sUser; } |
47 | const Bu::String &getPass() const { return sPass; } | 47 | const Bu::String &getPass() const { return sPass; } |
48 | const Bu::String &getHost() const { return sHost; } | 48 | const Bu::String &getHost() const { return sHost; } |
49 | const Bu::String &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::String &sNewHost, bool bAutoSetPort=true ); | 54 | void setProtocol( const Bu::String &sNewHost, bool bAutoSetPort=true ); |
55 | void setUser( const Bu::String &s ) { sUser = s; } | 55 | void setUser( const Bu::String &s ) { sUser = s; } |
56 | void setPass( const Bu::String &s ) { sPass = s; } | 56 | void setPass( const Bu::String &s ) { sPass = s; } |
57 | void setHost( const Bu::String &s ) { sHost = s; } | 57 | void setHost( const Bu::String &s ) { sHost = s; } |
58 | void setPath( const Bu::String &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::String &n, const Bu::String &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::String decode( const Bu::String &sStr ); | 64 | static Bu::String decode( const Bu::String &sStr ); |
65 | static Bu::String encode( const Bu::String &sStr ); | 65 | static Bu::String encode( const Bu::String &sStr ); |
66 | 66 | ||
67 | private: // Parsing code | 67 | private: // Parsing code |
68 | void parseProtocol( Bu::String::const_iterator &i ); | 68 | void parseProtocol( Bu::String::const_iterator &i ); |
69 | void parseUserPass( Bu::String::const_iterator &i ); | 69 | void parseUserPass( Bu::String::const_iterator &i ); |
70 | void parseHost( Bu::String::const_iterator &i ); | 70 | void parseHost( Bu::String::const_iterator &i ); |
71 | 71 | ||
72 | private: | 72 | private: |
73 | Bu::String sProtocol; | 73 | Bu::String sProtocol; |
74 | Bu::String sUser; | 74 | Bu::String sUser; |
75 | Bu::String sPass; | 75 | Bu::String sPass; |
76 | Bu::String sHost; | 76 | Bu::String sHost; |
77 | Bu::String sPath; | 77 | Bu::String sPath; |
78 | Bu::Atom<int> iPort; | 78 | Bu::Atom<int> iPort; |
79 | ParamList lParam; | 79 | ParamList lParam; |
80 | 80 | ||
81 | static char hexcode[16]; | 81 | static char hexcode[16]; |
82 | }; | 82 | }; |
83 | }; | 83 | }; |
84 | 84 | ||
85 | #endif | 85 | #endif |