From 63c5f358e696298950dd03db431b92d4decd015a Mon Sep 17 00:00:00 2001 From: Mike Buland Date: Fri, 31 Jul 2009 07:50:54 +0000 Subject: Added a character based splitting function to FBasicString and made more of the parsing functions publicly accessible in Url, and added some more helpers. --- src/fbasicstring.h | 15 +++++++++++++++ src/url.cpp | 6 ++++++ src/url.h | 3 ++- 3 files changed, 23 insertions(+), 1 deletion(-) (limited to 'src') 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 return pFirst->pData; } + Bu::List split( const chr c ) const + { + Bu::List ret; + const_iterator l, r; + l = begin(); + for(r=l; l;) + { + for( r = l; r && r != c; r++ ); + ret.append( MyType( l, r ) ); + l = r; + l++; + } + return ret; + } + /** * Plus equals operator for FString. *@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 ) i = s; } +void Bu::Url::parsePath( const Bu::FString &sPath ) +{ + Bu::FString::const_iterator i = sPath.begin(); + parsePath( i ); +} + void Bu::Url::parsePath( Bu::FString::const_iterator &i ) { 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 void parseUrl( const Bu::FString &sUrl ); void parseParams( const Bu::FString &sQuery ); void parseParams( Bu::FString::const_iterator &i ); + void parsePath( const Bu::FString &sPath ); + void parsePath( Bu::FString::const_iterator &i ); void clear(); Bu::FString getUrl() const; @@ -59,7 +61,6 @@ namespace Bu void parseProtocol( Bu::FString::const_iterator &i ); void parseUserPass( Bu::FString::const_iterator &i ); void parseHost( Bu::FString::const_iterator &i ); - void parsePath( Bu::FString::const_iterator &i ); private: Bu::FString sProtocol; -- cgit v1.2.3