aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Buland <eichlan@xagasoft.com>2009-07-31 07:50:54 +0000
committerMike Buland <eichlan@xagasoft.com>2009-07-31 07:50:54 +0000
commit63c5f358e696298950dd03db431b92d4decd015a (patch)
tree5c8db031d9de4ca008a6affda076b6de8f089b29
parent745a9ec043fdbe91faf26a3cfec4ecd12355f94a (diff)
downloadlibbu++-63c5f358e696298950dd03db431b92d4decd015a.tar.gz
libbu++-63c5f358e696298950dd03db431b92d4decd015a.tar.bz2
libbu++-63c5f358e696298950dd03db431b92d4decd015a.tar.xz
libbu++-63c5f358e696298950dd03db431b92d4decd015a.zip
Added a character based splitting function to FBasicString and made more of the
parsing functions publicly accessible in Url, and added some more helpers.
-rw-r--r--src/fbasicstring.h15
-rw-r--r--src/url.cpp6
-rw-r--r--src/url.h3
3 files changed, 23 insertions, 1 deletions
diff --git a/src/fbasicstring.h b/src/fbasicstring.h
index b232005..6b681dd 100644
--- a/src/fbasicstring.h
+++ b/src/fbasicstring.h
@@ -1051,6 +1051,21 @@ namespace Bu
1051 return pFirst->pData; 1051 return pFirst->pData;
1052 } 1052 }
1053 1053
1054 Bu::List<MyType> split( const chr c ) const
1055 {
1056 Bu::List<MyType> ret;
1057 const_iterator l, r;
1058 l = begin();
1059 for(r=l; l;)
1060 {
1061 for( r = l; r && r != c; r++ );
1062 ret.append( MyType( l, r ) );
1063 l = r;
1064 l++;
1065 }
1066 return ret;
1067 }
1068
1054 /** 1069 /**
1055 * Plus equals operator for FString. 1070 * Plus equals operator for FString.
1056 *@param pData (const chr *) The data to append to your FString. 1071 *@param pData (const chr *) The data to append to your FString.
diff --git a/src/url.cpp b/src/url.cpp
index 251e678..7f03043 100644
--- a/src/url.cpp
+++ b/src/url.cpp
@@ -154,6 +154,12 @@ void Bu::Url::parseHost( Bu::FString::const_iterator &i )
154 i = s; 154 i = s;
155} 155}
156 156
157void Bu::Url::parsePath( const Bu::FString &sPath )
158{
159 Bu::FString::const_iterator i = sPath.begin();
160 parsePath( i );
161}
162
157void Bu::Url::parsePath( Bu::FString::const_iterator &i ) 163void Bu::Url::parsePath( Bu::FString::const_iterator &i )
158{ 164{
159 if( i ) 165 if( i )
diff --git a/src/url.h b/src/url.h
index cf1210b..88d128b 100644
--- a/src/url.h
+++ b/src/url.h
@@ -28,6 +28,8 @@ namespace Bu
28 void parseUrl( const Bu::FString &sUrl ); 28 void parseUrl( const Bu::FString &sUrl );
29 void parseParams( const Bu::FString &sQuery ); 29 void parseParams( const Bu::FString &sQuery );
30 void parseParams( Bu::FString::const_iterator &i ); 30 void parseParams( Bu::FString::const_iterator &i );
31 void parsePath( const Bu::FString &sPath );
32 void parsePath( Bu::FString::const_iterator &i );
31 void clear(); 33 void clear();
32 34
33 Bu::FString getUrl() const; 35 Bu::FString getUrl() const;
@@ -59,7 +61,6 @@ namespace Bu
59 void parseProtocol( Bu::FString::const_iterator &i ); 61 void parseProtocol( Bu::FString::const_iterator &i );
60 void parseUserPass( Bu::FString::const_iterator &i ); 62 void parseUserPass( Bu::FString::const_iterator &i );
61 void parseHost( Bu::FString::const_iterator &i ); 63 void parseHost( Bu::FString::const_iterator &i );
62 void parsePath( Bu::FString::const_iterator &i );
63 64
64 private: 65 private:
65 Bu::FString sProtocol; 66 Bu::FString sProtocol;