diff options
author | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
---|---|---|
committer | Mike Buland <eichlan@xagasoft.com> | 2012-03-25 20:00:08 +0000 |
commit | 469bbcf0701e1eb8a6670c23145b0da87357e178 (patch) | |
tree | b5b062a16e46a6c5d3410b4e574cd0cc09057211 /src/url.h | |
parent | ee1b79396076edc4e30aefb285fada03bb45e80d (diff) | |
download | libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.gz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.bz2 libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.tar.xz libbu++-469bbcf0701e1eb8a6670c23145b0da87357e178.zip |
Code is all reorganized. We're about ready to release. I should write up a
little explenation of the arrangement.
Diffstat (limited to 'src/url.h')
-rw-r--r-- | src/url.h | 85 |
1 files changed, 0 insertions, 85 deletions
diff --git a/src/url.h b/src/url.h deleted file mode 100644 index d751578..0000000 --- a/src/url.h +++ /dev/null | |||
@@ -1,85 +0,0 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007-2011 Xagasoft, All rights reserved. | ||
3 | * | ||
4 | * This file is part of the libbu++ library and is released under the | ||
5 | * terms of the license contained in the file LICENSE. | ||
6 | */ | ||
7 | |||
8 | #ifndef BU_URL_H | ||
9 | #define BU_URL_H | ||
10 | |||
11 | #include "bu/string.h" | ||
12 | #include "bu/atom.h" | ||
13 | |||
14 | namespace Bu | ||
15 | { | ||
16 | class Url | ||
17 | { | ||
18 | public: | ||
19 | typedef struct Param | ||
20 | { | ||
21 | Param() { } | ||
22 | Param( const Param &r ) : sName( r.sName ), sValue( r.sValue ) { } | ||
23 | Param( const Bu::String &n, const Bu::String &v ) : | ||
24 | sName( n ), sValue( v ) { } | ||
25 | Bu::String sName; | ||
26 | Bu::String sValue; | ||
27 | } Param; | ||
28 | typedef Bu::List<Param> ParamList; | ||
29 | |||
30 | public: | ||
31 | Url(); | ||
32 | Url( const Bu::String &sUrl ); | ||
33 | virtual ~Url(); | ||
34 | |||
35 | void parseUrl( const Bu::String &sUrl ); | ||
36 | void parseParams( const Bu::String &sQuery ); | ||
37 | void parseParams( Bu::String::const_iterator &i ); | ||
38 | void parsePath( const Bu::String &sPath ); | ||
39 | void parsePath( Bu::String::const_iterator &i ); | ||
40 | void clear(); | ||
41 | |||
42 | Bu::String getUrl() const; | ||
43 | Bu::String getFullPath() const; | ||
44 | |||
45 | const Bu::String &getProtocol() const { return sProtocol; } | ||
46 | const Bu::String &getUser() const { return sUser; } | ||
47 | const Bu::String &getPass() const { return sPass; } | ||
48 | const Bu::String &getHost() const { return sHost; } | ||
49 | const Bu::String &getPath() const { return sPath; } | ||
50 | int getPort() const { return iPort; } | ||
51 | ParamList::const_iterator getParamBegin() const | ||
52 | { return lParam.begin(); } | ||
53 | |||
54 | void setProtocol( const Bu::String &sNewHost, bool bAutoSetPort=true ); | ||
55 | void setUser( const Bu::String &s ) { sUser = s; } | ||
56 | void setPass( const Bu::String &s ) { sPass = s; } | ||
57 | void setHost( const Bu::String &s ) { sHost = s; } | ||
58 | void setPath( const Bu::String &s ) { sPath = s; } | ||
59 | void setPort( int i ) { iPort = i; } | ||
60 | void addParam( const Bu::String &n, const Bu::String &v ); | ||
61 | |||
62 | bool hasPort() const { return iPort.has(); } | ||
63 | |||
64 | static Bu::String decode( const Bu::String &sStr ); | ||
65 | static Bu::String encode( const Bu::String &sStr ); | ||
66 | |||
67 | private: // Parsing code | ||
68 | void parseProtocol( Bu::String::const_iterator &i ); | ||
69 | void parseUserPass( Bu::String::const_iterator &i ); | ||
70 | void parseHost( Bu::String::const_iterator &i ); | ||
71 | |||
72 | private: | ||
73 | Bu::String sProtocol; | ||
74 | Bu::String sUser; | ||
75 | Bu::String sPass; | ||
76 | Bu::String sHost; | ||
77 | Bu::String sPath; | ||
78 | Bu::Atom<int> iPort; | ||
79 | ParamList lParam; | ||
80 | |||
81 | static char hexcode[16]; | ||
82 | }; | ||
83 | }; | ||
84 | |||
85 | #endif | ||