diff options
| author | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 02:14:08 +0000 |
|---|---|---|
| committer | Mike Buland <eichlan@xagasoft.com> | 2011-01-20 02:14:08 +0000 |
| commit | f5aca1a1b402bd7ebc944dc6e6fe65828d863365 (patch) | |
| tree | 4a0fdd8e166d5c4b03543279d332b9a858ef62df /src | |
| parent | 10c557562e1d67c55314c212371ea9cb7f802863 (diff) | |
| download | libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.gz libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.bz2 libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.tar.xz libbu++-f5aca1a1b402bd7ebc944dc6e6fe65828d863365.zip | |
Bu::FString is now String, and there's a shell script to fix any other programs
that were using fstring, I hope.
Diffstat (limited to '')
133 files changed, 879 insertions, 953 deletions
diff --git a/src/archive.h b/src/archive.h index 9d2aee2..5294c15 100644 --- a/src/archive.h +++ b/src/archive.h | |||
| @@ -111,7 +111,7 @@ namespace Bu | |||
| 111 | void readID( const void *ptr, uint32_t id ); | 111 | void readID( const void *ptr, uint32_t id ); |
| 112 | 112 | ||
| 113 | template<typename t> | 113 | template<typename t> |
| 114 | void setProp( const Bu::FString &sId, const t &val ) | 114 | void setProp( const Bu::String &sId, const t &val ) |
| 115 | { | 115 | { |
| 116 | if( !hProps.has( sId ) ) | 116 | if( !hProps.has( sId ) ) |
| 117 | { | 117 | { |
| @@ -121,7 +121,7 @@ namespace Bu | |||
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | template<typename t> | 123 | template<typename t> |
| 124 | t getProp( const Bu::FString &sId ) | 124 | t getProp( const Bu::String &sId ) |
| 125 | { | 125 | { |
| 126 | return hProps.get( sId ); | 126 | return hProps.get( sId ); |
| 127 | } | 127 | } |
| @@ -131,7 +131,7 @@ namespace Bu | |||
| 131 | uint32_t nNextID; | 131 | uint32_t nNextID; |
| 132 | Hash<uint32_t,uint32_t> hPtrID; | 132 | Hash<uint32_t,uint32_t> hPtrID; |
| 133 | Hash<uint32_t,List<void **> > hPtrDest; | 133 | Hash<uint32_t,List<void **> > hPtrDest; |
| 134 | Hash<Bu::FString, Variant> hProps; | 134 | Hash<Bu::String, Variant> hProps; |
| 135 | }; | 135 | }; |
| 136 | } | 136 | } |
| 137 | 137 | ||
diff --git a/src/bitstring.cpp b/src/bitstring.cpp index 207a036..39c2e63 100644 --- a/src/bitstring.cpp +++ b/src/bitstring.cpp | |||
| @@ -444,9 +444,9 @@ long Bu::BitString::getHighestOrderBitPos() | |||
| 444 | return -1; | 444 | return -1; |
| 445 | } | 445 | } |
| 446 | 446 | ||
| 447 | Bu::FString Bu::BitString::toString() | 447 | Bu::String Bu::BitString::toString() |
| 448 | { | 448 | { |
| 449 | Bu::FString sRet; | 449 | Bu::String sRet; |
| 450 | for( int j = iBits-1; j >= 0; j-- ) | 450 | for( int j = iBits-1; j >= 0; j-- ) |
| 451 | sRet.append( getBit( j )?'1':'0' ); | 451 | sRet.append( getBit( j )?'1':'0' ); |
| 452 | return sRet; | 452 | return sRet; |
diff --git a/src/bitstring.h b/src/bitstring.h index 4d0437a..a8aec57 100644 --- a/src/bitstring.h +++ b/src/bitstring.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_BITSTRING_H | 9 | #define BU_BITSTRING_H |
| 10 | 10 | ||
| 11 | #include "bu/util.h" | 11 | #include "bu/util.h" |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| 15 | { | 15 | { |
| @@ -203,7 +203,7 @@ namespace Bu | |||
| 203 | */ | 203 | */ |
| 204 | long toLong( long iStart = 0, long iSize = 32 ); | 204 | long toLong( long iStart = 0, long iSize = 32 ); |
| 205 | 205 | ||
| 206 | Bu::FString toString(); | 206 | Bu::String toString(); |
| 207 | 207 | ||
| 208 | //operators | 208 | //operators |
| 209 | BitString &operator=( const BitString &xSrc ); | 209 | BitString &operator=( const BitString &xSrc ); |
diff --git a/src/cachestorefiles.h b/src/cachestorefiles.h index c2cf091..5a9478d 100644 --- a/src/cachestorefiles.h +++ b/src/cachestorefiles.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_CACHE_STORE_FILES_H | 8 | #ifndef BU_CACHE_STORE_FILES_H |
| 9 | #define BU_CACHE_STORE_FILES_H | 9 | #define BU_CACHE_STORE_FILES_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/file.h" | 12 | #include "bu/file.h" |
| 13 | #include "bu/cachestore.h" | 13 | #include "bu/cachestore.h" |
| 14 | #include "bu/archive.h" | 14 | #include "bu/archive.h" |
| @@ -53,7 +53,7 @@ namespace Bu | |||
| 53 | class CacheStoreFiles : public CacheStore<keytype, obtype> | 53 | class CacheStoreFiles : public CacheStore<keytype, obtype> |
| 54 | { | 54 | { |
| 55 | public: | 55 | public: |
| 56 | CacheStoreFiles( const Bu::FString &sPrefix ) : | 56 | CacheStoreFiles( const Bu::String &sPrefix ) : |
| 57 | sPrefix( sPrefix ) | 57 | sPrefix( sPrefix ) |
| 58 | { | 58 | { |
| 59 | if( access( sPrefix.getStr(), W_OK|R_OK|X_OK ) ) | 59 | if( access( sPrefix.getStr(), W_OK|R_OK|X_OK ) ) |
| @@ -138,7 +138,7 @@ namespace Bu | |||
| 138 | Bu::MemBuf mb; | 138 | Bu::MemBuf mb; |
| 139 | Bu::Formatter f( mb ); | 139 | Bu::Formatter f( mb ); |
| 140 | f << sPrefix << "/"; | 140 | f << sPrefix << "/"; |
| 141 | Bu::FString sBase = mb.getString(); | 141 | Bu::String sBase = mb.getString(); |
| 142 | f << key; | 142 | f << key; |
| 143 | 143 | ||
| 144 | if( sBase == mb.getString() ) | 144 | if( sBase == mb.getString() ) |
| @@ -199,7 +199,7 @@ namespace Bu | |||
| 199 | } | 199 | } |
| 200 | 200 | ||
| 201 | private: | 201 | private: |
| 202 | Bu::FString sPrefix; | 202 | Bu::String sPrefix; |
| 203 | }; | 203 | }; |
| 204 | 204 | ||
| 205 | }; | 205 | }; |
diff --git a/src/cachestoremyriad.h b/src/cachestoremyriad.h index 21c84e6..1928840 100644 --- a/src/cachestoremyriad.h +++ b/src/cachestoremyriad.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_CACHE_STORE_MYRIAD_H | 8 | #ifndef BU_CACHE_STORE_MYRIAD_H |
| 9 | #define BU_CACHE_STORE_MYRIAD_H | 9 | #define BU_CACHE_STORE_MYRIAD_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/stream.h" | 12 | #include "bu/stream.h" |
| 13 | #include "bu/myriad.h" | 13 | #include "bu/myriad.h" |
| 14 | #include "bu/cachestore.h" | 14 | #include "bu/cachestore.h" |
diff --git a/src/client.cpp b/src/client.cpp index b635c8b..c8d5dd4 100644 --- a/src/client.cpp +++ b/src/client.cpp | |||
| @@ -109,12 +109,12 @@ void Bu::Client::clearProtocol() | |||
| 109 | pProto = NULL; | 109 | pProto = NULL; |
| 110 | } | 110 | } |
| 111 | /* | 111 | /* |
| 112 | Bu::FString &Bu::Client::getInput() | 112 | Bu::String &Bu::Client::getInput() |
| 113 | { | 113 | { |
| 114 | return sReadBuf; | 114 | return sReadBuf; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | Bu::FString &Bu::Client::getOutput() | 117 | Bu::String &Bu::Client::getOutput() |
| 118 | { | 118 | { |
| 119 | return sWriteBuf; | 119 | return sWriteBuf; |
| 120 | } | 120 | } |
| @@ -126,7 +126,7 @@ bool Bu::Client::isOpen() | |||
| 126 | return pTopStream->isOpen(); | 126 | return pTopStream->isOpen(); |
| 127 | } | 127 | } |
| 128 | 128 | ||
| 129 | size_t Bu::Client::write( const Bu::FString &sData ) | 129 | size_t Bu::Client::write( const Bu::String &sData ) |
| 130 | { | 130 | { |
| 131 | return qbWrite.write( sData.getStr(), sData.getSize() ); | 131 | return qbWrite.write( sData.getStr(), sData.getSize() ); |
| 132 | } | 132 | } |
| @@ -221,7 +221,7 @@ Bu::ClientLink *Bu::Client::getLink() | |||
| 221 | return pfLink->createLink( this ); | 221 | return pfLink->createLink( this ); |
| 222 | } | 222 | } |
| 223 | 223 | ||
| 224 | void Bu::Client::onMessage( const Bu::FString &sMsg ) | 224 | void Bu::Client::onMessage( const Bu::String &sMsg ) |
| 225 | { | 225 | { |
| 226 | if( pProto ) | 226 | if( pProto ) |
| 227 | pProto->onMessage( this, sMsg ); | 227 | pProto->onMessage( this, sMsg ); |
diff --git a/src/client.h b/src/client.h index 98b31f7..871acad 100644 --- a/src/client.h +++ b/src/client.h | |||
| @@ -11,7 +11,7 @@ | |||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | 12 | ||
| 13 | #include "bu/config.h" | 13 | #include "bu/config.h" |
| 14 | #include "bu/fstring.h" | 14 | #include "bu/string.h" |
| 15 | #include "bu/queuebuf.h" | 15 | #include "bu/queuebuf.h" |
| 16 | 16 | ||
| 17 | namespace Bu | 17 | namespace Bu |
| @@ -33,9 +33,9 @@ namespace Bu | |||
| 33 | void processInput(); | 33 | void processInput(); |
| 34 | void processOutput(); | 34 | void processOutput(); |
| 35 | 35 | ||
| 36 | //Bu::FString &getInput(); | 36 | //Bu::String &getInput(); |
| 37 | //Bu::FString &getOutput(); | 37 | //Bu::String &getOutput(); |
| 38 | size_t write( const Bu::FString &sData ); | 38 | size_t write( const Bu::String &sData ); |
| 39 | size_t write( const void *pData, size_t nBytes ); | 39 | size_t write( const void *pData, size_t nBytes ); |
| 40 | size_t write( int8_t nData ); | 40 | size_t write( int8_t nData ); |
| 41 | size_t write( int16_t nData ); | 41 | size_t write( int16_t nData ); |
| @@ -66,7 +66,7 @@ namespace Bu | |||
| 66 | 66 | ||
| 67 | class ClientLink *getLink(); | 67 | class ClientLink *getLink(); |
| 68 | 68 | ||
| 69 | void onMessage( const Bu::FString &sMsg ); | 69 | void onMessage( const Bu::String &sMsg ); |
| 70 | 70 | ||
| 71 | bool hasOutput() { return qbWrite.getSize() > 0; } | 71 | bool hasOutput() { return qbWrite.getSize() > 0; } |
| 72 | bool hasInput() { return qbRead.getSize() > 0; } | 72 | bool hasInput() { return qbRead.getSize() > 0; } |
diff --git a/src/clientlink.h b/src/clientlink.h index aa6d362..28910bb 100644 --- a/src/clientlink.h +++ b/src/clientlink.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_CLIENT_LINK_H | 8 | #ifndef BU_CLIENT_LINK_H |
| 9 | #define BU_CLIENT_LINK_H | 9 | #define BU_CLIENT_LINK_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | 12 | ||
| 13 | namespace Bu | 13 | namespace Bu |
| 14 | { | 14 | { |
| @@ -18,7 +18,7 @@ namespace Bu | |||
| 18 | ClientLink(); | 18 | ClientLink(); |
| 19 | virtual ~ClientLink(); | 19 | virtual ~ClientLink(); |
| 20 | 20 | ||
| 21 | virtual void sendMessage( const Bu::FString &sMsg )=0; | 21 | virtual void sendMessage( const Bu::String &sMsg )=0; |
| 22 | }; | 22 | }; |
| 23 | }; | 23 | }; |
| 24 | 24 | ||
diff --git a/src/compat/win32.h b/src/compat/win32.h index 6304d4c..82ab4d6 100644 --- a/src/compat/win32.h +++ b/src/compat/win32.h | |||
| @@ -18,7 +18,7 @@ extern "C" | |||
| 18 | } | 18 | } |
| 19 | #endif | 19 | #endif |
| 20 | 20 | ||
| 21 | #include "bu/fstring.h" | 21 | #include "bu/string.h" |
| 22 | #include "bu/singleton.h" | 22 | #include "bu/singleton.h" |
| 23 | 23 | ||
| 24 | #ifndef TEMP_FAILURE_RETRY | 24 | #ifndef TEMP_FAILURE_RETRY |
diff --git a/src/conduit.h b/src/conduit.h index 7125fc5..f8ad4fa 100644 --- a/src/conduit.h +++ b/src/conduit.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_CONDUIT_H | 9 | #define BU_CONDUIT_H |
| 10 | 10 | ||
| 11 | #include "bu/stream.h" | 11 | #include "bu/stream.h" |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| 15 | { | 15 | { |
diff --git a/src/crypt.cpp b/src/crypt.cpp index ae04353..97260c9 100644 --- a/src/crypt.cpp +++ b/src/crypt.cpp | |||
| @@ -11,14 +11,14 @@ | |||
| 11 | #include "bu/membuf.h" | 11 | #include "bu/membuf.h" |
| 12 | #include "bu/file.h" | 12 | #include "bu/file.h" |
| 13 | 13 | ||
| 14 | Bu::FString Bu::cryptPass( const Bu::FString &sPass, const Bu::FString &sSalt ) | 14 | Bu::String Bu::cryptPass( const Bu::String &sPass, const Bu::String &sSalt ) |
| 15 | { | 15 | { |
| 16 | Bu::Md5 md5; | 16 | Bu::Md5 md5; |
| 17 | Bu::MemBuf mbOut; | 17 | Bu::MemBuf mbOut; |
| 18 | Bu::Base64 b64Out( mbOut ); | 18 | Bu::Base64 b64Out( mbOut ); |
| 19 | 19 | ||
| 20 | Bu::FString::const_iterator i = sSalt.find('$'); | 20 | Bu::String::const_iterator i = sSalt.find('$'); |
| 21 | Bu::FString sSaltSml = sSalt.getSubStr( sSalt.begin(), i ); | 21 | Bu::String sSaltSml = sSalt.getSubStr( sSalt.begin(), i ); |
| 22 | 22 | ||
| 23 | md5.addData( sPass ); | 23 | md5.addData( sPass ); |
| 24 | md5.addData( sSaltSml ); | 24 | md5.addData( sSaltSml ); |
| @@ -29,7 +29,7 @@ Bu::FString Bu::cryptPass( const Bu::FString &sPass, const Bu::FString &sSalt ) | |||
| 29 | return sSaltSml + "$" + mbOut.getString(); | 29 | return sSaltSml + "$" + mbOut.getString(); |
| 30 | } | 30 | } |
| 31 | 31 | ||
| 32 | Bu::FString Bu::cryptPass( const Bu::FString &sPass ) | 32 | Bu::String Bu::cryptPass( const Bu::String &sPass ) |
| 33 | { | 33 | { |
| 34 | Bu::MemBuf mbSalt; | 34 | Bu::MemBuf mbSalt; |
| 35 | Bu::Base64 b64Salt( mbSalt ); | 35 | Bu::Base64 b64Salt( mbSalt ); |
diff --git a/src/crypt.h b/src/crypt.h index cf7fb97..d6bfe4b 100644 --- a/src/crypt.h +++ b/src/crypt.h | |||
| @@ -8,12 +8,12 @@ | |||
| 8 | #ifndef BU_CRYPT_H | 8 | #ifndef BU_CRYPT_H |
| 9 | #define BU_CRYPT_H | 9 | #define BU_CRYPT_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | 12 | ||
| 13 | namespace Bu | 13 | namespace Bu |
| 14 | { | 14 | { |
| 15 | FString cryptPass( const Bu::FString &sPass, const Bu::FString &sSalt ); | 15 | String cryptPass( const Bu::String &sPass, const Bu::String &sSalt ); |
| 16 | FString cryptPass( const Bu::FString &sPass ); | 16 | String cryptPass( const Bu::String &sPass ); |
| 17 | }; | 17 | }; |
| 18 | 18 | ||
| 19 | #endif | 19 | #endif |
diff --git a/src/cryptohash.cpp b/src/cryptohash.cpp index 8aee415..bb07a4b 100644 --- a/src/cryptohash.cpp +++ b/src/cryptohash.cpp | |||
| @@ -15,15 +15,15 @@ Bu::CryptoHash::~CryptoHash() | |||
| 15 | { | 15 | { |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | void Bu::CryptoHash::addData( const Bu::FString &sData ) | 18 | void Bu::CryptoHash::addData( const Bu::String &sData ) |
| 19 | { | 19 | { |
| 20 | addData( sData.getStr(), sData.getSize() ); | 20 | addData( sData.getStr(), sData.getSize() ); |
| 21 | } | 21 | } |
| 22 | 22 | ||
| 23 | Bu::FString Bu::CryptoHash::getHexResult() | 23 | Bu::String Bu::CryptoHash::getHexResult() |
| 24 | { | 24 | { |
| 25 | Bu::FString sResult = getResult(); | 25 | Bu::String sResult = getResult(); |
| 26 | Bu::FString sRet( 2*sResult.getSize() ); | 26 | Bu::String sRet( 2*sResult.getSize() ); |
| 27 | static const char hex_tab[] = {"0123456789abcdef"}; | 27 | static const char hex_tab[] = {"0123456789abcdef"}; |
| 28 | 28 | ||
| 29 | int k = 0; | 29 | int k = 0; |
diff --git a/src/cryptohash.h b/src/cryptohash.h index 5d83895..56dc356 100644 --- a/src/cryptohash.h +++ b/src/cryptohash.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_CRYPTO_HASH_H | 8 | #ifndef BU_CRYPTO_HASH_H |
| 9 | #define BU_CRYPTO_HASH_H | 9 | #define BU_CRYPTO_HASH_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | 12 | ||
| 13 | namespace Bu | 13 | namespace Bu |
| 14 | { | 14 | { |
| @@ -21,12 +21,12 @@ namespace Bu | |||
| 21 | virtual ~CryptoHash(); | 21 | virtual ~CryptoHash(); |
| 22 | 22 | ||
| 23 | virtual void reset() = 0; | 23 | virtual void reset() = 0; |
| 24 | virtual void setSalt( const Bu::FString &sSalt ) = 0; | 24 | virtual void setSalt( const Bu::String &sSalt ) = 0; |
| 25 | virtual void addData( const void *sData, int iSize ) = 0; | 25 | virtual void addData( const void *sData, int iSize ) = 0; |
| 26 | virtual void addData( const Bu::FString &sData ); | 26 | virtual void addData( const Bu::String &sData ); |
| 27 | virtual FString getResult() = 0; | 27 | virtual String getResult() = 0; |
| 28 | virtual void writeResult( Stream &sOut ) = 0; | 28 | virtual void writeResult( Stream &sOut ) = 0; |
| 29 | virtual Bu::FString getHexResult(); | 29 | virtual Bu::String getHexResult(); |
| 30 | }; | 30 | }; |
| 31 | }; | 31 | }; |
| 32 | 32 | ||
diff --git a/src/csvreader.cpp b/src/csvreader.cpp index f3133c2..22b0608 100644 --- a/src/csvreader.cpp +++ b/src/csvreader.cpp | |||
| @@ -41,12 +41,12 @@ Bu::StrArray Bu::CsvReader::readLine() | |||
| 41 | { | 41 | { |
| 42 | Bu::StrArray aVals; | 42 | Bu::StrArray aVals; |
| 43 | 43 | ||
| 44 | Bu::FString sLine = sIn.readLine(); | 44 | Bu::String sLine = sIn.readLine(); |
| 45 | 45 | ||
| 46 | if( !sLine.isSet() ) | 46 | if( !sLine.isSet() ) |
| 47 | return Bu::StrArray(); | 47 | return Bu::StrArray(); |
| 48 | 48 | ||
| 49 | Bu::FString::iterator i = sLine.begin(); | 49 | Bu::String::iterator i = sLine.begin(); |
| 50 | 50 | ||
| 51 | aVals.append( sDecode( i ) ); | 51 | aVals.append( sDecode( i ) ); |
| 52 | 52 | ||
| @@ -73,9 +73,9 @@ Bu::StrArray Bu::CsvReader::readLine() | |||
| 73 | return aVals; | 73 | return aVals; |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | Bu::FString Bu::CsvReader::decodeExcel( Bu::FString::iterator &i ) | 76 | Bu::String Bu::CsvReader::decodeExcel( Bu::String::iterator &i ) |
| 77 | { | 77 | { |
| 78 | Bu::FString sRet; | 78 | Bu::String sRet; |
| 79 | 79 | ||
| 80 | for(; i && (*i == ' ' || *i == '\t'); i++ ) { } | 80 | for(; i && (*i == ' ' || *i == '\t'); i++ ) { } |
| 81 | 81 | ||
| @@ -123,7 +123,7 @@ Bu::FString Bu::CsvReader::decodeExcel( Bu::FString::iterator &i ) | |||
| 123 | return sRet; | 123 | return sRet; |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | Bu::FString Bu::CsvReader::decodeC( Bu::FString::iterator & ) | 126 | Bu::String Bu::CsvReader::decodeC( Bu::String::iterator & ) |
| 127 | { | 127 | { |
| 128 | return ""; | 128 | return ""; |
| 129 | } | 129 | } |
diff --git a/src/csvreader.h b/src/csvreader.h index 9ad65fd..1c3525c 100644 --- a/src/csvreader.h +++ b/src/csvreader.h | |||
| @@ -8,19 +8,19 @@ | |||
| 8 | #ifndef BU_CSV_READER_H | 8 | #ifndef BU_CSV_READER_H |
| 9 | #define BU_CSV_READER_H | 9 | #define BU_CSV_READER_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/array.h" | 12 | #include "bu/array.h" |
| 13 | #include "bu/signals.h" | 13 | #include "bu/signals.h" |
| 14 | 14 | ||
| 15 | namespace Bu | 15 | namespace Bu |
| 16 | { | 16 | { |
| 17 | class Stream; | 17 | class Stream; |
| 18 | typedef Bu::Array<Bu::FString> StrArray; | 18 | typedef Bu::Array<Bu::String> StrArray; |
| 19 | 19 | ||
| 20 | class CsvReader | 20 | class CsvReader |
| 21 | { | 21 | { |
| 22 | public: | 22 | public: |
| 23 | typedef Bu::Signal1<Bu::FString, Bu::FString::iterator &> DecodeSignal; | 23 | typedef Bu::Signal1<Bu::String, Bu::String::iterator &> DecodeSignal; |
| 24 | enum Style | 24 | enum Style |
| 25 | { | 25 | { |
| 26 | styleExcel, ///< Excel style quotes around things that need em | 26 | styleExcel, ///< Excel style quotes around things that need em |
| @@ -37,8 +37,8 @@ namespace Bu | |||
| 37 | Stream &sIn; | 37 | Stream &sIn; |
| 38 | DecodeSignal sDecode; | 38 | DecodeSignal sDecode; |
| 39 | 39 | ||
| 40 | static Bu::FString decodeExcel( Bu::FString::iterator &i ); | 40 | static Bu::String decodeExcel( Bu::String::iterator &i ); |
| 41 | static Bu::FString decodeC( Bu::FString::iterator &i ); | 41 | static Bu::String decodeC( Bu::String::iterator &i ); |
| 42 | }; | 42 | }; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
diff --git a/src/csvwriter.cpp b/src/csvwriter.cpp index 3e2816b..6b50ed0 100644 --- a/src/csvwriter.cpp +++ b/src/csvwriter.cpp | |||
| @@ -36,7 +36,7 @@ Bu::CsvWriter::~CsvWriter() | |||
| 36 | 36 | ||
| 37 | void Bu::CsvWriter::writeLine( const StrArray &aStrs ) | 37 | void Bu::CsvWriter::writeLine( const StrArray &aStrs ) |
| 38 | { | 38 | { |
| 39 | Bu::FString sBuf; | 39 | Bu::String sBuf; |
| 40 | for( StrArray::const_iterator i = aStrs.begin(); i; i++ ) | 40 | for( StrArray::const_iterator i = aStrs.begin(); i; i++ ) |
| 41 | { | 41 | { |
| 42 | if( i != aStrs.begin() ) | 42 | if( i != aStrs.begin() ) |
| @@ -48,12 +48,12 @@ void Bu::CsvWriter::writeLine( const StrArray &aStrs ) | |||
| 48 | sOut.write( sBuf ); | 48 | sOut.write( sBuf ); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | Bu::FString Bu::CsvWriter::encodeExcel( const Bu::FString &sIn ) | 51 | Bu::String Bu::CsvWriter::encodeExcel( const Bu::String &sIn ) |
| 52 | { | 52 | { |
| 53 | if( sIn.find('\"') ) | 53 | if( sIn.find('\"') ) |
| 54 | { | 54 | { |
| 55 | Bu::FString sOut = "\""; | 55 | Bu::String sOut = "\""; |
| 56 | for( Bu::FString::const_iterator i = sIn.begin(); i; i++ ) | 56 | for( Bu::String::const_iterator i = sIn.begin(); i; i++ ) |
| 57 | { | 57 | { |
| 58 | if( *i == '\"' ) | 58 | if( *i == '\"' ) |
| 59 | sOut += "\"\""; | 59 | sOut += "\"\""; |
| @@ -65,10 +65,10 @@ Bu::FString Bu::CsvWriter::encodeExcel( const Bu::FString &sIn ) | |||
| 65 | return sIn; | 65 | return sIn; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | Bu::FString Bu::CsvWriter::encodeC( const Bu::FString &sIn ) | 68 | Bu::String Bu::CsvWriter::encodeC( const Bu::String &sIn ) |
| 69 | { | 69 | { |
| 70 | Bu::FString sOut = ""; | 70 | Bu::String sOut = ""; |
| 71 | for( Bu::FString::const_iterator i = sIn.begin(); i; i++ ) | 71 | for( Bu::String::const_iterator i = sIn.begin(); i; i++ ) |
| 72 | { | 72 | { |
| 73 | if( *i == ',' ) | 73 | if( *i == ',' ) |
| 74 | sOut += "\\,"; | 74 | sOut += "\\,"; |
diff --git a/src/csvwriter.h b/src/csvwriter.h index 289d25c..8da5eee 100644 --- a/src/csvwriter.h +++ b/src/csvwriter.h | |||
| @@ -8,19 +8,19 @@ | |||
| 8 | #ifndef BU_CSV_WRITER_H | 8 | #ifndef BU_CSV_WRITER_H |
| 9 | #define BU_CSV_WRITER_H | 9 | #define BU_CSV_WRITER_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/array.h" | 12 | #include "bu/array.h" |
| 13 | #include "bu/signals.h" | 13 | #include "bu/signals.h" |
| 14 | 14 | ||
| 15 | namespace Bu | 15 | namespace Bu |
| 16 | { | 16 | { |
| 17 | class Stream; | 17 | class Stream; |
| 18 | typedef Bu::Array<Bu::FString> StrArray; | 18 | typedef Bu::Array<Bu::String> StrArray; |
| 19 | 19 | ||
| 20 | class CsvWriter | 20 | class CsvWriter |
| 21 | { | 21 | { |
| 22 | public: | 22 | public: |
| 23 | typedef Bu::Signal1<Bu::FString, const Bu::FString &> EncodeSignal; | 23 | typedef Bu::Signal1<Bu::String, const Bu::String &> EncodeSignal; |
| 24 | enum Style | 24 | enum Style |
| 25 | { | 25 | { |
| 26 | styleExcel, ///< Excel style quotes around things that need em | 26 | styleExcel, ///< Excel style quotes around things that need em |
| @@ -37,8 +37,8 @@ namespace Bu | |||
| 37 | Stream &sOut; | 37 | Stream &sOut; |
| 38 | EncodeSignal sEncode; | 38 | EncodeSignal sEncode; |
| 39 | 39 | ||
| 40 | static Bu::FString encodeExcel( const Bu::FString &sIn ); | 40 | static Bu::String encodeExcel( const Bu::String &sIn ); |
| 41 | static Bu::FString encodeC( const Bu::FString &sIn ); | 41 | static Bu::String encodeC( const Bu::String &sIn ); |
| 42 | }; | 42 | }; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
diff --git a/src/fastcgi.cpp b/src/fastcgi.cpp index ca3010e..1b012e8 100644 --- a/src/fastcgi.cpp +++ b/src/fastcgi.cpp | |||
| @@ -114,14 +114,14 @@ void Bu::FastCgi::readPair( Bu::TcpSocket &s, StrHash &hParams, uint16_t &uRead | |||
| 114 | uRead += uName + uValue; | 114 | uRead += uName + uValue; |
| 115 | unsigned char *sName = new unsigned char[uName]; | 115 | unsigned char *sName = new unsigned char[uName]; |
| 116 | s.read( sName, uName ); | 116 | s.read( sName, uName ); |
| 117 | Bu::FString fsName( (char *)sName, uName ); | 117 | Bu::String fsName( (char *)sName, uName ); |
| 118 | delete[] sName; | 118 | delete[] sName; |
| 119 | 119 | ||
| 120 | if( uValue > 0 ) | 120 | if( uValue > 0 ) |
| 121 | { | 121 | { |
| 122 | unsigned char *sValue = new unsigned char[uValue]; | 122 | unsigned char *sValue = new unsigned char[uValue]; |
| 123 | s.read( sValue, uValue ); | 123 | s.read( sValue, uValue ); |
| 124 | Bu::FString fsValue( (char *)sValue, uValue ); | 124 | Bu::String fsValue( (char *)sValue, uValue ); |
| 125 | hParams.insert( fsName, fsValue ); | 125 | hParams.insert( fsName, fsValue ); |
| 126 | delete[] sValue; | 126 | delete[] sValue; |
| 127 | } | 127 | } |
| @@ -305,8 +305,8 @@ void Bu::FastCgi::run() | |||
| 305 | mStdOut, mStdErr | 305 | mStdOut, mStdErr |
| 306 | ); | 306 | ); |
| 307 | 307 | ||
| 308 | Bu::FString &sStdOut = mStdOut.getString(); | 308 | Bu::String &sStdOut = mStdOut.getString(); |
| 309 | Bu::FString &sStdErr = mStdErr.getString(); | 309 | Bu::String &sStdErr = mStdErr.getString(); |
| 310 | 310 | ||
| 311 | Record rOut; | 311 | Record rOut; |
| 312 | memset( &rOut, 0, sizeof(rOut) ); | 312 | memset( &rOut, 0, sizeof(rOut) ); |
diff --git a/src/fastcgi.h b/src/fastcgi.h index 7c1c04c..4463bee 100644 --- a/src/fastcgi.h +++ b/src/fastcgi.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_FAST_CGI_H | 8 | #ifndef BU_FAST_CGI_H |
| 9 | #define BU_FAST_CGI_H | 9 | #define BU_FAST_CGI_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/hash.h" | 12 | #include "bu/hash.h" |
| 13 | #include "bu/array.h" | 13 | #include "bu/array.h" |
| 14 | #include "bu/tcpsocket.h" | 14 | #include "bu/tcpsocket.h" |
| @@ -27,7 +27,7 @@ namespace Bu | |||
| 27 | 27 | ||
| 28 | static bool isEmbedded(); | 28 | static bool isEmbedded(); |
| 29 | 29 | ||
| 30 | typedef Bu::Hash<Bu::FString, Bu::FString> StrHash; | 30 | typedef Bu::Hash<Bu::String, Bu::String> StrHash; |
| 31 | enum RequestType | 31 | enum RequestType |
| 32 | { | 32 | { |
| 33 | typeBeginRequest = 1, | 33 | typeBeginRequest = 1, |
| @@ -86,8 +86,8 @@ namespace Bu | |||
| 86 | typedef struct Channel { | 86 | typedef struct Channel { |
| 87 | Channel() : uFlags( 0 ) { } | 87 | Channel() : uFlags( 0 ) { } |
| 88 | StrHash hParams; | 88 | StrHash hParams; |
| 89 | Bu::FString sStdIn; | 89 | Bu::String sStdIn; |
| 90 | Bu::FString sData; | 90 | Bu::String sData; |
| 91 | uint8_t uFlags; | 91 | uint8_t uFlags; |
| 92 | } Channel; | 92 | } Channel; |
| 93 | 93 | ||
| @@ -104,7 +104,7 @@ namespace Bu | |||
| 104 | 104 | ||
| 105 | virtual void onInit() { }; | 105 | virtual void onInit() { }; |
| 106 | virtual int onRequest( const StrHash &hParams, | 106 | virtual int onRequest( const StrHash &hParams, |
| 107 | const Bu::FString &sStdIn, Bu::Stream &sStdOut, | 107 | const Bu::String &sStdIn, Bu::Stream &sStdOut, |
| 108 | Bu::Stream &sStdErr )=0; | 108 | Bu::Stream &sStdErr )=0; |
| 109 | virtual void onUninit() { }; | 109 | virtual void onUninit() { }; |
| 110 | 110 | ||
diff --git a/src/fbasicstring.cpp b/src/fbasicstring.cpp deleted file mode 100644 index 4834301..0000000 --- a/src/fbasicstring.cpp +++ /dev/null | |||
| @@ -1,9 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007-2010 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 | #include "bu/fbasicstring.h" | ||
| 9 | |||
diff --git a/src/fifo.cpp b/src/fifo.cpp index d1fa960..d6106cc 100644 --- a/src/fifo.cpp +++ b/src/fifo.cpp | |||
| @@ -16,7 +16,7 @@ | |||
| 16 | 16 | ||
| 17 | namespace Bu { subExceptionDef( FifoException ) } | 17 | namespace Bu { subExceptionDef( FifoException ) } |
| 18 | 18 | ||
| 19 | Bu::Fifo::Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc ) : | 19 | Bu::Fifo::Fifo( const Bu::String &sName, int iFlags, mode_t mAcc ) : |
| 20 | iFlags( iFlags ), | 20 | iFlags( iFlags ), |
| 21 | iIn( -1 ), | 21 | iIn( -1 ), |
| 22 | iOut( -1 ) | 22 | iOut( -1 ) |
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <stdlib.h> | 13 | #include <stdlib.h> |
| 14 | 14 | ||
| 15 | #include "bu/stream.h" | 15 | #include "bu/stream.h" |
| 16 | #include "bu/fstring.h" | 16 | #include "bu/string.h" |
| 17 | #include "bu/exceptionbase.h" | 17 | #include "bu/exceptionbase.h" |
| 18 | 18 | ||
| 19 | namespace Bu | 19 | namespace Bu |
| @@ -27,7 +27,7 @@ namespace Bu | |||
| 27 | class Fifo : public Bu::Stream | 27 | class Fifo : public Bu::Stream |
| 28 | { | 28 | { |
| 29 | public: | 29 | public: |
| 30 | Fifo( const Bu::FString &sName, int iFlags, mode_t mAcc=-1 ); | 30 | Fifo( const Bu::String &sName, int iFlags, mode_t mAcc=-1 ); |
| 31 | virtual ~Fifo(); | 31 | virtual ~Fifo(); |
| 32 | 32 | ||
| 33 | virtual void close(); | 33 | virtual void close(); |
diff --git a/src/file.cpp b/src/file.cpp index 008b88e..6634a62 100644 --- a/src/file.cpp +++ b/src/file.cpp | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | 17 | ||
| 18 | namespace Bu { subExceptionDef( FileException ) } | 18 | namespace Bu { subExceptionDef( FileException ) } |
| 19 | 19 | ||
| 20 | Bu::File::File( const Bu::FString &sName, int iFlags ) : | 20 | Bu::File::File( const Bu::String &sName, int iFlags ) : |
| 21 | fd( -1 ), | 21 | fd( -1 ), |
| 22 | bEos( true ) | 22 | bEos( true ) |
| 23 | { | 23 | { |
| @@ -187,7 +187,7 @@ void Bu::File::setBlocking( bool bBlocking ) | |||
| 187 | #endif | 187 | #endif |
| 188 | } | 188 | } |
| 189 | 189 | ||
| 190 | Bu::File Bu::File::tempFile( Bu::FString &sName ) | 190 | Bu::File Bu::File::tempFile( Bu::String &sName ) |
| 191 | { | 191 | { |
| 192 | uint32_t iX; | 192 | uint32_t iX; |
| 193 | iX = time( NULL ) + getpid(); | 193 | iX = time( NULL ) + getpid(); |
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <sys/types.h> | 12 | #include <sys/types.h> |
| 13 | 13 | ||
| 14 | #include "bu/stream.h" | 14 | #include "bu/stream.h" |
| 15 | #include "bu/fstring.h" | 15 | #include "bu/string.h" |
| 16 | #include "bu/exceptionbase.h" | 16 | #include "bu/exceptionbase.h" |
| 17 | 17 | ||
| 18 | namespace Bu | 18 | namespace Bu |
| @@ -26,7 +26,7 @@ namespace Bu | |||
| 26 | class File : public Bu::Stream | 26 | class File : public Bu::Stream |
| 27 | { | 27 | { |
| 28 | public: | 28 | public: |
| 29 | File( const Bu::FString &sName, int iFlags ); | 29 | File( const Bu::String &sName, int iFlags ); |
| 30 | File( int fd ); | 30 | File( int fd ); |
| 31 | virtual ~File(); | 31 | virtual ~File(); |
| 32 | 32 | ||
| @@ -75,12 +75,12 @@ namespace Bu | |||
| 75 | /** | 75 | /** |
| 76 | * Create a temp file and return its handle. The file is opened | 76 | * Create a temp file and return its handle. The file is opened |
| 77 | * Read/Write. | 77 | * Read/Write. |
| 78 | *@param sName (Bu::FString) Give in the form: "/tmp/tmpfileXXXXXXXX" | 78 | *@param sName (Bu::String) Give in the form: "/tmp/tmpfileXXXXXXXX" |
| 79 | * It will alter your (sName) setting the 'X's to random | 79 | * It will alter your (sName) setting the 'X's to random |
| 80 | * characters. | 80 | * characters. |
| 81 | *@returns (Bu::File) A file object representing your temp file. | 81 | *@returns (Bu::File) A file object representing your temp file. |
| 82 | */ | 82 | */ |
| 83 | static Bu::File tempFile( Bu::FString &sName ); | 83 | static Bu::File tempFile( Bu::String &sName ); |
| 84 | 84 | ||
| 85 | #ifndef WIN32 | 85 | #ifndef WIN32 |
| 86 | /** | 86 | /** |
diff --git a/src/formatter.cpp b/src/formatter.cpp index 7eaa1e2..9288e91 100644 --- a/src/formatter.cpp +++ b/src/formatter.cpp | |||
| @@ -21,7 +21,7 @@ Bu::Formatter::~Formatter() | |||
| 21 | { | 21 | { |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | void Bu::Formatter::write( const Bu::FString &sStr ) | 24 | void Bu::Formatter::write( const Bu::String &sStr ) |
| 25 | { | 25 | { |
| 26 | rStream.write( sStr ); | 26 | rStream.write( sStr ); |
| 27 | } | 27 | } |
| @@ -31,7 +31,7 @@ void Bu::Formatter::write( const void *sStr, int iLen ) | |||
| 31 | rStream.write( sStr, iLen ); | 31 | rStream.write( sStr, iLen ); |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | void Bu::Formatter::writeAligned( const Bu::FString &sStr ) | 34 | void Bu::Formatter::writeAligned( const Bu::String &sStr ) |
| 35 | { | 35 | { |
| 36 | int iLen = sStr.getSize(); | 36 | int iLen = sStr.getSize(); |
| 37 | if( iLen > fLast.uMinWidth ) | 37 | if( iLen > fLast.uMinWidth ) |
| @@ -117,9 +117,9 @@ void Bu::Formatter::read( void *sStr, int iLen ) | |||
| 117 | rStream.read( sStr, iLen ); | 117 | rStream.read( sStr, iLen ); |
| 118 | } | 118 | } |
| 119 | 119 | ||
| 120 | Bu::FString Bu::Formatter::readToken() | 120 | Bu::String Bu::Formatter::readToken() |
| 121 | { | 121 | { |
| 122 | Bu::FString sRet; | 122 | Bu::String sRet; |
| 123 | if( fLast.bTokenize ) | 123 | if( fLast.bTokenize ) |
| 124 | { | 124 | { |
| 125 | for(;;) | 125 | for(;;) |
| @@ -292,7 +292,7 @@ Bu::Formatter &Bu::operator<<( Bu::Formatter &f, char *sStr ) | |||
| 292 | return f; | 292 | return f; |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::FString &sStr ) | 295 | Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::String &sStr ) |
| 296 | { | 296 | { |
| 297 | f.writeAligned( sStr ); | 297 | f.writeAligned( sStr ); |
| 298 | return f; | 298 | return f; |
| @@ -388,7 +388,7 @@ Bu::Formatter &Bu::operator<<( Bu::Formatter &f, bool b ) | |||
| 388 | return f; | 388 | return f; |
| 389 | } | 389 | } |
| 390 | 390 | ||
| 391 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, Bu::FString &sStr ) | 391 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, Bu::String &sStr ) |
| 392 | { | 392 | { |
| 393 | sStr = f.readToken(); | 393 | sStr = f.readToken(); |
| 394 | return f; | 394 | return f; |
| @@ -480,7 +480,7 @@ Bu::Formatter &Bu::operator>>( Bu::Formatter &f, long double &flt ) | |||
| 480 | 480 | ||
| 481 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, bool &b ) | 481 | Bu::Formatter &Bu::operator>>( Bu::Formatter &f, bool &b ) |
| 482 | { | 482 | { |
| 483 | Bu::FString sStr = f.readToken(); | 483 | Bu::String sStr = f.readToken(); |
| 484 | if( !sStr.isSet() ) | 484 | if( !sStr.isSet() ) |
| 485 | return f; | 485 | return f; |
| 486 | char c = *sStr.begin(); | 486 | char c = *sStr.begin(); |
diff --git a/src/formatter.h b/src/formatter.h index 7e0c54b..fb51c81 100644 --- a/src/formatter.h +++ b/src/formatter.h | |||
| @@ -103,13 +103,13 @@ namespace Bu | |||
| 103 | unsigned short bTokenize : 1; | 103 | unsigned short bTokenize : 1; |
| 104 | } Fmt; | 104 | } Fmt; |
| 105 | 105 | ||
| 106 | void write( const Bu::FString &sStr ); | 106 | void write( const Bu::String &sStr ); |
| 107 | void write( const void *sStr, int iLen ); | 107 | void write( const void *sStr, int iLen ); |
| 108 | void writeAligned( const Bu::FString &sStr ); | 108 | void writeAligned( const Bu::String &sStr ); |
| 109 | void writeAligned( const char *sStr, int iLen ); | 109 | void writeAligned( const char *sStr, int iLen ); |
| 110 | 110 | ||
| 111 | void read( void *sStr, int iLen ); | 111 | void read( void *sStr, int iLen ); |
| 112 | Bu::FString readToken(); | 112 | Bu::String readToken(); |
| 113 | 113 | ||
| 114 | void incIndent(); | 114 | void incIndent(); |
| 115 | void decIndent(); | 115 | void decIndent(); |
| @@ -199,7 +199,7 @@ namespace Bu | |||
| 199 | template<typename type> | 199 | template<typename type> |
| 200 | void ffmt( type f ) | 200 | void ffmt( type f ) |
| 201 | { | 201 | { |
| 202 | Bu::FString fTmp; | 202 | Bu::String fTmp; |
| 203 | fTmp.format("%f", f ); | 203 | fTmp.format("%f", f ); |
| 204 | // writeAligned("**make floats work**"); | 204 | // writeAligned("**make floats work**"); |
| 205 | writeAligned( fTmp ); | 205 | writeAligned( fTmp ); |
| @@ -207,7 +207,7 @@ namespace Bu | |||
| 207 | } | 207 | } |
| 208 | 208 | ||
| 209 | template<typename type> | 209 | template<typename type> |
| 210 | void iparse( type &i, const Bu::FString &sBuf ) | 210 | void iparse( type &i, const Bu::String &sBuf ) |
| 211 | { | 211 | { |
| 212 | if( !sBuf.isSet() ) | 212 | if( !sBuf.isSet() ) |
| 213 | return; | 213 | return; |
| @@ -233,7 +233,7 @@ namespace Bu | |||
| 233 | } | 233 | } |
| 234 | 234 | ||
| 235 | template<typename type> | 235 | template<typename type> |
| 236 | void uparse( type &i, const Bu::FString &sBuf ) | 236 | void uparse( type &i, const Bu::String &sBuf ) |
| 237 | { | 237 | { |
| 238 | if( !sBuf.isSet() ) | 238 | if( !sBuf.isSet() ) |
| 239 | return; | 239 | return; |
| @@ -257,7 +257,7 @@ namespace Bu | |||
| 257 | } | 257 | } |
| 258 | 258 | ||
| 259 | template<typename type> | 259 | template<typename type> |
| 260 | void fparse( type &f, const Bu::FString &sBuf ) | 260 | void fparse( type &f, const Bu::String &sBuf ) |
| 261 | { | 261 | { |
| 262 | sscanf( sBuf.getStr(), "%f", &f ); | 262 | sscanf( sBuf.getStr(), "%f", &f ); |
| 263 | usedFormat(); | 263 | usedFormat(); |
| @@ -288,7 +288,7 @@ namespace Bu | |||
| 288 | Formatter &operator<<( Formatter &f, Formatter::Special s ); | 288 | Formatter &operator<<( Formatter &f, Formatter::Special s ); |
| 289 | Formatter &operator<<( Formatter &f, const char *sStr ); | 289 | Formatter &operator<<( Formatter &f, const char *sStr ); |
| 290 | Formatter &operator<<( Formatter &f, char *sStr ); | 290 | Formatter &operator<<( Formatter &f, char *sStr ); |
| 291 | Formatter &operator<<( Formatter &f, const Bu::FString &sStr ); | 291 | Formatter &operator<<( Formatter &f, const Bu::String &sStr ); |
| 292 | Formatter &operator<<( Formatter &f, signed char c ); | 292 | Formatter &operator<<( Formatter &f, signed char c ); |
| 293 | Formatter &operator<<( Formatter &f, char c ); | 293 | Formatter &operator<<( Formatter &f, char c ); |
| 294 | Formatter &operator<<( Formatter &f, unsigned char c ); | 294 | Formatter &operator<<( Formatter &f, unsigned char c ); |
| @@ -305,7 +305,7 @@ namespace Bu | |||
| 305 | Formatter &operator<<( Formatter &f, long double flt ); | 305 | Formatter &operator<<( Formatter &f, long double flt ); |
| 306 | Formatter &operator<<( Formatter &f, bool b ); | 306 | Formatter &operator<<( Formatter &f, bool b ); |
| 307 | 307 | ||
| 308 | Formatter &operator>>( Formatter &f, Bu::FString &sStr ); | 308 | Formatter &operator>>( Formatter &f, Bu::String &sStr ); |
| 309 | Formatter &operator>>( Formatter &f, signed char &c ); | 309 | Formatter &operator>>( Formatter &f, signed char &c ); |
| 310 | Formatter &operator>>( Formatter &f, char &c ); | 310 | Formatter &operator>>( Formatter &f, char &c ); |
| 311 | Formatter &operator>>( Formatter &f, unsigned char &c ); | 311 | Formatter &operator>>( Formatter &f, unsigned char &c ); |
diff --git a/src/formula.h b/src/formula.h index d93e27b..757884f 100644 --- a/src/formula.h +++ b/src/formula.h | |||
| @@ -17,7 +17,7 @@ | |||
| 17 | #include "bu/stack.h" | 17 | #include "bu/stack.h" |
| 18 | #include "bu/exceptionbase.h" | 18 | #include "bu/exceptionbase.h" |
| 19 | #include "bu/hash.h" | 19 | #include "bu/hash.h" |
| 20 | #include "bu/fstring.h" | 20 | #include "bu/string.h" |
| 21 | 21 | ||
| 22 | namespace Bu | 22 | namespace Bu |
| 23 | { | 23 | { |
| @@ -41,8 +41,8 @@ namespace Bu | |||
| 41 | virtual prec operator()( prec )=0; | 41 | virtual prec operator()( prec )=0; |
| 42 | }; | 42 | }; |
| 43 | 43 | ||
| 44 | typedef Hash<Bu::FString, prec> varHash; | 44 | typedef Hash<Bu::String, prec> varHash; |
| 45 | typedef Hash<Bu::FString, Func *> funcHash; | 45 | typedef Hash<Bu::String, Func *> funcHash; |
| 46 | 46 | ||
| 47 | Formula() | 47 | Formula() |
| 48 | { | 48 | { |
| @@ -57,7 +57,7 @@ namespace Bu | |||
| 57 | } | 57 | } |
| 58 | } | 58 | } |
| 59 | 59 | ||
| 60 | prec run( const Bu::FString &sFormulaSrc ) | 60 | prec run( const Bu::String &sFormulaSrc ) |
| 61 | { | 61 | { |
| 62 | if( sFormulaSrc.isEmpty() ) | 62 | if( sFormulaSrc.isEmpty() ) |
| 63 | throw FormulaException("Empty formula, nothing to do."); | 63 | throw FormulaException("Empty formula, nothing to do."); |
| @@ -158,7 +158,7 @@ namespace Bu | |||
| 158 | 158 | ||
| 159 | Bu::Stack<symType> sOper; | 159 | Bu::Stack<symType> sOper; |
| 160 | Bu::Stack<prec> sValue; | 160 | Bu::Stack<prec> sValue; |
| 161 | Bu::Stack<Bu::FString> sFunc; | 161 | Bu::Stack<Bu::String> sFunc; |
| 162 | 162 | ||
| 163 | private: | 163 | private: |
| 164 | symType getPrec( symType nOper ) | 164 | symType getPrec( symType nOper ) |
diff --git a/src/fstring.h b/src/fstring.h deleted file mode 100644 index 0f9d81a..0000000 --- a/src/fstring.h +++ /dev/null | |||
| @@ -1,53 +0,0 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (C) 2007-2010 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_F_STRING_H | ||
| 9 | #define BU_F_STRING_H | ||
| 10 | |||
| 11 | #include "bu/fbasicstring.h" | ||
| 12 | |||
| 13 | namespace Bu | ||
| 14 | { | ||
| 15 | typedef FBasicString<char> FString; | ||
| 16 | |||
| 17 | template<typename T> | ||
| 18 | uint32_t __calcHashCode( const T &k ); | ||
| 19 | |||
| 20 | template<typename T> | ||
| 21 | bool __cmpHashKeys( const T &a, const T &b ); | ||
| 22 | |||
| 23 | template<> uint32_t __calcHashCode<FString>( const FString &k ); | ||
| 24 | template<> bool __cmpHashKeys<FString>( | ||
| 25 | const FString &a, const FString &b ); | ||
| 26 | |||
| 27 | template<typename t> void __tracer_format( const t &v ); | ||
| 28 | template<> void __tracer_format<FString>( const FString &v ); | ||
| 29 | |||
| 30 | bool &operator<<( bool &dst, const FString &sIn ); | ||
| 31 | uint8_t &operator<<( uint8_t &dst, const FString &sIn ); | ||
| 32 | int8_t &operator<<( int8_t &dst, const FString &sIn ); | ||
| 33 | char &operator<<( char &dst, const FString &sIn ); | ||
| 34 | uint16_t &operator<<( uint16_t &dst, const FString &sIn ); | ||
| 35 | int16_t &operator<<( int16_t &dst, const FString &sIn ); | ||
| 36 | uint32_t &operator<<( uint32_t &dst, const FString &sIn ); | ||
| 37 | int32_t &operator<<( int32_t &dst, const FString &sIn ); | ||
| 38 | uint64_t &operator<<( uint64_t &dst, const FString &sIn ); | ||
| 39 | int64_t &operator<<( int64_t &dst, const FString &sIn ); | ||
| 40 | float &operator<<( float &dst, const FString &sIn ); | ||
| 41 | double &operator<<( double &dst, const FString &sIn ); | ||
| 42 | long double &operator<<( long double &dst, const FString &sIn ); | ||
| 43 | Bu::FString &operator<<( Bu::FString &dst, const FString &sIn ); | ||
| 44 | |||
| 45 | } | ||
| 46 | |||
| 47 | /***** I dunno about this block, I don't really want to have it... ***** | ||
| 48 | #include <ostream> | ||
| 49 | std::basic_ostream<char>& operator<< (std::basic_ostream<char> &os, | ||
| 50 | const Bu::FString &val ); | ||
| 51 | */ | ||
| 52 | |||
| 53 | #endif | ||
| @@ -411,7 +411,7 @@ namespace Bu | |||
| 411 | * In order to use it, I recommend the following for all basic usage: | 411 | * In order to use it, I recommend the following for all basic usage: |
| 412 | *@code | 412 | *@code |
| 413 | // Define a Hash typedef with strings as keys and ints as values. | 413 | // Define a Hash typedef with strings as keys and ints as values. |
| 414 | typedef Bu::Hash<Bu::FString, int> StrIntHash; | 414 | typedef Bu::Hash<Bu::String, int> StrIntHash; |
| 415 | 415 | ||
| 416 | // Create one | 416 | // Create one |
| 417 | StrIntHash hInts; | 417 | StrIntHash hInts; |
diff --git a/src/httpget.cpp b/src/httpget.cpp index 2347167..673cdd6 100644 --- a/src/httpget.cpp +++ b/src/httpget.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "bu/httpget.h" | 8 | #include "bu/httpget.h" |
| 9 | 9 | ||
| 10 | Bu::HttpGet::HttpGet( const Bu::Url &uSrc, const Bu::FString &sMethod ) : | 10 | Bu::HttpGet::HttpGet( const Bu::Url &uSrc, const Bu::String &sMethod ) : |
| 11 | uSrc( uSrc ), | 11 | uSrc( uSrc ), |
| 12 | sMethod( sMethod ), | 12 | sMethod( sMethod ), |
| 13 | sSrv( uSrc.getHost(), uSrc.getPort() ) | 13 | sSrv( uSrc.getHost(), uSrc.getPort() ) |
diff --git a/src/httpget.h b/src/httpget.h index 783f880..58982c0 100644 --- a/src/httpget.h +++ b/src/httpget.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_HTTP_GET_H | 9 | #define BU_HTTP_GET_H |
| 10 | 10 | ||
| 11 | #include "bu/stream.h" | 11 | #include "bu/stream.h" |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | #include "bu/url.h" | 13 | #include "bu/url.h" |
| 14 | #include "bu/tcpsocket.h" | 14 | #include "bu/tcpsocket.h" |
| 15 | #include "bu/hash.h" | 15 | #include "bu/hash.h" |
| @@ -19,7 +19,7 @@ namespace Bu | |||
| 19 | class HttpGet : public Bu::Stream | 19 | class HttpGet : public Bu::Stream |
| 20 | { | 20 | { |
| 21 | public: | 21 | public: |
| 22 | HttpGet( const Bu::Url &uSrc, const Bu::FString &sMethod="GET" ); | 22 | HttpGet( const Bu::Url &uSrc, const Bu::String &sMethod="GET" ); |
| 23 | virtual ~HttpGet(); | 23 | virtual ~HttpGet(); |
| 24 | 24 | ||
| 25 | void get(); | 25 | void get(); |
| @@ -51,9 +51,9 @@ namespace Bu | |||
| 51 | 51 | ||
| 52 | private: | 52 | private: |
| 53 | Bu::Url uSrc; | 53 | Bu::Url uSrc; |
| 54 | Bu::FString sMethod; | 54 | Bu::String sMethod; |
| 55 | Bu::TcpSocket sSrv; | 55 | Bu::TcpSocket sSrv; |
| 56 | typedef Bu::Hash<Bu::FString,Bu::FString> MimeHash; | 56 | typedef Bu::Hash<Bu::String,Bu::String> MimeHash; |
| 57 | MimeHash hMimeIn; | 57 | MimeHash hMimeIn; |
| 58 | MimeHash hMimeOut; | 58 | MimeHash hMimeOut; |
| 59 | }; | 59 | }; |
diff --git a/src/itoserver.cpp b/src/itoserver.cpp index ea737bf..80e5bfb 100644 --- a/src/itoserver.cpp +++ b/src/itoserver.cpp | |||
| @@ -47,7 +47,7 @@ void Bu::ItoServer::addPort( int nPort, int nPoolSize ) | |||
| 47 | hServers.insert( nSocket, s ); | 47 | hServers.insert( nSocket, s ); |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | void Bu::ItoServer::addPort( const FString &sAddr, int nPort, int nPoolSize ) | 50 | void Bu::ItoServer::addPort( const String &sAddr, int nPort, int nPoolSize ) |
| 51 | { | 51 | { |
| 52 | TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize ); | 52 | TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize ); |
| 53 | int nSocket = s->getSocket(); | 53 | int nSocket = s->getSocket(); |
| @@ -163,7 +163,7 @@ void Bu::ItoServer::ItoClient::run() | |||
| 163 | while( !qMsg.isEmpty() ) | 163 | while( !qMsg.isEmpty() ) |
| 164 | { | 164 | { |
| 165 | imProto.lock(); | 165 | imProto.lock(); |
| 166 | Bu::FString *pMsg = qMsg.dequeue(); | 166 | Bu::String *pMsg = qMsg.dequeue(); |
| 167 | pClient->onMessage( *pMsg ); | 167 | pClient->onMessage( *pMsg ); |
| 168 | delete pMsg; | 168 | delete pMsg; |
| 169 | pClient->processOutput(); | 169 | pClient->processOutput(); |
| @@ -205,7 +205,7 @@ Bu::ItoServer::SrvClientLink::~SrvClientLink() | |||
| 205 | { | 205 | { |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | void Bu::ItoServer::SrvClientLink::sendMessage( const Bu::FString &sMsg ) | 208 | void Bu::ItoServer::SrvClientLink::sendMessage( const Bu::String &sMsg ) |
| 209 | { | 209 | { |
| 210 | if( !pClient->imProto.trylock() ) | 210 | if( !pClient->imProto.trylock() ) |
| 211 | { | 211 | { |
| @@ -215,7 +215,7 @@ void Bu::ItoServer::SrvClientLink::sendMessage( const Bu::FString &sMsg ) | |||
| 215 | } | 215 | } |
| 216 | else | 216 | else |
| 217 | { | 217 | { |
| 218 | Bu::FString *pMsg = new Bu::FString( sMsg ); | 218 | Bu::String *pMsg = new Bu::String( sMsg ); |
| 219 | pClient->qMsg.enqueue( pMsg ); | 219 | pClient->qMsg.enqueue( pMsg ); |
| 220 | } | 220 | } |
| 221 | } | 221 | } |
diff --git a/src/itoserver.h b/src/itoserver.h index 81e42cc..83e7552 100644 --- a/src/itoserver.h +++ b/src/itoserver.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <sys/select.h> | 14 | #include <sys/select.h> |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | #include "bu/fstring.h" | 17 | #include "bu/string.h" |
| 18 | #include "bu/list.h" | 18 | #include "bu/list.h" |
| 19 | #include "bu/ito.h" | 19 | #include "bu/ito.h" |
| 20 | #include "bu/itomutex.h" | 20 | #include "bu/itomutex.h" |
| @@ -59,7 +59,7 @@ namespace Bu | |||
| 59 | virtual ~ItoServer(); | 59 | virtual ~ItoServer(); |
| 60 | 60 | ||
| 61 | void addPort( int nPort, int nPoolSize=40 ); | 61 | void addPort( int nPort, int nPoolSize=40 ); |
| 62 | void addPort( const FString &sAddr, int nPort, int nPoolSize=40 ); | 62 | void addPort( const String &sAddr, int nPort, int nPoolSize=40 ); |
| 63 | 63 | ||
| 64 | //void scan(); | 64 | //void scan(); |
| 65 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ); | 65 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ); |
| @@ -82,7 +82,7 @@ namespace Bu | |||
| 82 | int nTimeoutSec, int nTimeoutUSec ); | 82 | int nTimeoutSec, int nTimeoutUSec ); |
| 83 | virtual ~ItoClient(); | 83 | virtual ~ItoClient(); |
| 84 | 84 | ||
| 85 | typedef ItoQueue<Bu::FString *> StringQueue; | 85 | typedef ItoQueue<Bu::String *> StringQueue; |
| 86 | StringQueue qMsg; | 86 | StringQueue qMsg; |
| 87 | 87 | ||
| 88 | protected: | 88 | protected: |
| @@ -105,7 +105,7 @@ namespace Bu | |||
| 105 | SrvClientLink( ItoClient *pClient ); | 105 | SrvClientLink( ItoClient *pClient ); |
| 106 | virtual ~SrvClientLink(); | 106 | virtual ~SrvClientLink(); |
| 107 | 107 | ||
| 108 | virtual void sendMessage( const Bu::FString &sMsg ); | 108 | virtual void sendMessage( const Bu::String &sMsg ); |
| 109 | 109 | ||
| 110 | private: | 110 | private: |
| 111 | ItoClient *pClient; | 111 | ItoClient *pClient; |
diff --git a/src/lexer.cpp b/src/lexer.cpp index af9a23f..5db6bbc 100644 --- a/src/lexer.cpp +++ b/src/lexer.cpp | |||
| @@ -18,7 +18,7 @@ Bu::Lexer::Token::Token( Bu::Lexer::TokenType iToken ) : | |||
| 18 | { | 18 | { |
| 19 | } | 19 | } |
| 20 | 20 | ||
| 21 | Bu::FString Bu::Lexer::tokenToString( const Bu::Lexer::Token &t ) | 21 | Bu::String Bu::Lexer::tokenToString( const Bu::Lexer::Token &t ) |
| 22 | { | 22 | { |
| 23 | Bu::MemBuf mb; | 23 | Bu::MemBuf mb; |
| 24 | Bu::Formatter f( mb ); | 24 | Bu::Formatter f( mb ); |
diff --git a/src/lexer.h b/src/lexer.h index 9840afe..f4e0479 100644 --- a/src/lexer.h +++ b/src/lexer.h | |||
| @@ -44,7 +44,7 @@ namespace Bu | |||
| 44 | 44 | ||
| 45 | virtual Token *nextToken()=0; | 45 | virtual Token *nextToken()=0; |
| 46 | 46 | ||
| 47 | virtual Bu::FString tokenToString( const Token &t ); | 47 | virtual Bu::String tokenToString( const Token &t ); |
| 48 | }; | 48 | }; |
| 49 | }; | 49 | }; |
| 50 | 50 | ||
diff --git a/src/logger.cpp b/src/logger.cpp index 9f734a9..eb5ac2d 100644 --- a/src/logger.cpp +++ b/src/logger.cpp | |||
| @@ -69,7 +69,7 @@ void Bu::Logger::log( uint32_t nLevel, const char *sFile, const char *sFunction, | |||
| 69 | #endif | 69 | #endif |
| 70 | } | 70 | } |
| 71 | 71 | ||
| 72 | void Bu::Logger::setFormat( const Bu::FString &str ) | 72 | void Bu::Logger::setFormat( const Bu::String &str ) |
| 73 | { | 73 | { |
| 74 | sLogFormat = ""; | 74 | sLogFormat = ""; |
| 75 | 75 | ||
| @@ -93,7 +93,7 @@ void Bu::Logger::setFormat( const Bu::FString &str ) | |||
| 93 | if( *s == '%' ) | 93 | if( *s == '%' ) |
| 94 | { | 94 | { |
| 95 | sLogFormat += '%'; | 95 | sLogFormat += '%'; |
| 96 | Bu::FString sBuf; | 96 | Bu::String sBuf; |
| 97 | for(;;) | 97 | for(;;) |
| 98 | { | 98 | { |
| 99 | s++; | 99 | s++; |
| @@ -166,10 +166,10 @@ void Bu::Logger::hexDump( uint32_t nLevel, const char *sFile, | |||
| 166 | log( nLevel, sFile, sFunction, nLine, "Displaying %ld bytes of %s.", nDataLen, lpName ); | 166 | log( nLevel, sFile, sFunction, nLine, "Displaying %ld bytes of %s.", nDataLen, lpName ); |
| 167 | const unsigned char *pData = (const unsigned char *)pDataV; | 167 | const unsigned char *pData = (const unsigned char *)pDataV; |
| 168 | int j = 0; | 168 | int j = 0; |
| 169 | Bu::FString sBorder; | 169 | Bu::String sBorder; |
| 170 | for( int l = 0; l < 8*3+2*8+2+5; l++ ) sBorder += ((l!=11&&l!=37)?("-"):("+")); | 170 | for( int l = 0; l < 8*3+2*8+2+5; l++ ) sBorder += ((l!=11&&l!=37)?("-"):("+")); |
| 171 | log( nLevel, sFile, sFunction, nLine, sBorder.getStr() ); | 171 | log( nLevel, sFile, sFunction, nLine, sBorder.getStr() ); |
| 172 | Bu::FString sLine; | 172 | Bu::String sLine; |
| 173 | for(;;) | 173 | for(;;) |
| 174 | { | 174 | { |
| 175 | { | 175 | { |
diff --git a/src/logger.h b/src/logger.h index 6a7a2d5..9a4b030 100644 --- a/src/logger.h +++ b/src/logger.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_LOGGER_H | 9 | #define BU_LOGGER_H |
| 10 | 10 | ||
| 11 | #include "bu/singleton.h" | 11 | #include "bu/singleton.h" |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| 15 | { | 15 | { |
| @@ -78,7 +78,7 @@ namespace Bu | |||
| 78 | public: | 78 | public: |
| 79 | void log( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const char *sFormat, ...); | 79 | void log( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const char *sFormat, ...); |
| 80 | 80 | ||
| 81 | void setFormat( const Bu::FString &str ); | 81 | void setFormat( const Bu::String &str ); |
| 82 | void setMask( uint32_t n ); | 82 | void setMask( uint32_t n ); |
| 83 | void setLevel( uint32_t n ); | 83 | void setLevel( uint32_t n ); |
| 84 | uint32_t getMask(); | 84 | uint32_t getMask(); |
| @@ -86,7 +86,7 @@ namespace Bu | |||
| 86 | void hexDump( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const void *pData, long nDataLen, const char *lpName ); | 86 | void hexDump( uint32_t nLevel, const char *sFile, const char *sFunction, int nLine, const void *pData, long nDataLen, const char *lpName ); |
| 87 | 87 | ||
| 88 | private: | 88 | private: |
| 89 | Bu::FString sLogFormat; | 89 | Bu::String sLogFormat; |
| 90 | uint32_t nLevelMask; | 90 | uint32_t nLevelMask; |
| 91 | }; | 91 | }; |
| 92 | } | 92 | } |
diff --git a/src/md5.cpp b/src/md5.cpp index abf4bfa..db70ddc 100644 --- a/src/md5.cpp +++ b/src/md5.cpp | |||
| @@ -60,7 +60,7 @@ void Bu::Md5::reset() | |||
| 60 | iFill = 0; | 60 | iFill = 0; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | void Bu::Md5::setSalt( const Bu::FString & /*sSalt*/ ) | 63 | void Bu::Md5::setSalt( const Bu::String & /*sSalt*/ ) |
| 64 | { | 64 | { |
| 65 | } | 65 | } |
| 66 | 66 | ||
| @@ -84,11 +84,11 @@ void Bu::Md5::addData( const void *sVData, int iSize ) | |||
| 84 | iBytes += iSize; | 84 | iBytes += iSize; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | Bu::FString Bu::Md5::getResult() | 87 | Bu::String Bu::Md5::getResult() |
| 88 | { | 88 | { |
| 89 | long lsum[4]; | 89 | long lsum[4]; |
| 90 | compCap( lsum ); | 90 | compCap( lsum ); |
| 91 | return Bu::FString( (const char *)lsum, 4*4 ); | 91 | return Bu::String( (const char *)lsum, 4*4 ); |
| 92 | } | 92 | } |
| 93 | 93 | ||
| 94 | void Bu::Md5::writeResult( Bu::Stream &sOut ) | 94 | void Bu::Md5::writeResult( Bu::Stream &sOut ) |
| @@ -26,10 +26,10 @@ namespace Bu | |||
| 26 | virtual ~Md5(); | 26 | virtual ~Md5(); |
| 27 | 27 | ||
| 28 | virtual void reset(); | 28 | virtual void reset(); |
| 29 | virtual void setSalt( const Bu::FString &sSalt ); | 29 | virtual void setSalt( const Bu::String &sSalt ); |
| 30 | virtual void addData( const void *sData, int iSize ); | 30 | virtual void addData( const void *sData, int iSize ); |
| 31 | using Bu::CryptoHash::addData; | 31 | using Bu::CryptoHash::addData; |
| 32 | virtual FString getResult(); | 32 | virtual String getResult(); |
| 33 | virtual void writeResult( Bu::Stream &sOut ); | 33 | virtual void writeResult( Bu::Stream &sOut ); |
| 34 | 34 | ||
| 35 | private: | 35 | private: |
diff --git a/src/membuf.cpp b/src/membuf.cpp index 1a6bf9a..2dc266f 100644 --- a/src/membuf.cpp +++ b/src/membuf.cpp | |||
| @@ -14,7 +14,7 @@ Bu::MemBuf::MemBuf() : | |||
| 14 | { | 14 | { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | Bu::MemBuf::MemBuf( const Bu::FString &str ) : | 17 | Bu::MemBuf::MemBuf( const Bu::String &str ) : |
| 18 | sBuf( str ), | 18 | sBuf( str ), |
| 19 | nPos( 0 ) | 19 | nPos( 0 ) |
| 20 | { | 20 | { |
| @@ -149,12 +149,12 @@ void Bu::MemBuf::setSize( size iSize ) | |||
| 149 | nPos = iSize; | 149 | nPos = iSize; |
| 150 | } | 150 | } |
| 151 | 151 | ||
| 152 | Bu::FString &Bu::MemBuf::getString() | 152 | Bu::String &Bu::MemBuf::getString() |
| 153 | { | 153 | { |
| 154 | return sBuf; | 154 | return sBuf; |
| 155 | } | 155 | } |
| 156 | 156 | ||
| 157 | void Bu::MemBuf::setString( const Bu::FString &sNewData ) | 157 | void Bu::MemBuf::setString( const Bu::String &sNewData ) |
| 158 | { | 158 | { |
| 159 | sBuf = sNewData; | 159 | sBuf = sNewData; |
| 160 | nPos = 0; | 160 | nPos = 0; |
diff --git a/src/membuf.h b/src/membuf.h index a75aca1..7faa956 100644 --- a/src/membuf.h +++ b/src/membuf.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include "bu/config.h" | 13 | #include "bu/config.h" |
| 14 | #include "bu/stream.h" | 14 | #include "bu/stream.h" |
| 15 | #include "bu/fstring.h" | 15 | #include "bu/string.h" |
| 16 | 16 | ||
| 17 | namespace Bu | 17 | namespace Bu |
| 18 | { | 18 | { |
| @@ -24,7 +24,7 @@ namespace Bu | |||
| 24 | { | 24 | { |
| 25 | public: | 25 | public: |
| 26 | MemBuf(); | 26 | MemBuf(); |
| 27 | MemBuf( const Bu::FString &str ); | 27 | MemBuf( const Bu::String &str ); |
| 28 | virtual ~MemBuf(); | 28 | virtual ~MemBuf(); |
| 29 | 29 | ||
| 30 | virtual void close(); | 30 | virtual void close(); |
| @@ -48,11 +48,11 @@ namespace Bu | |||
| 48 | virtual void setBlocking( bool bBlocking=true ); | 48 | virtual void setBlocking( bool bBlocking=true ); |
| 49 | virtual void setSize( size iSize ); | 49 | virtual void setSize( size iSize ); |
| 50 | 50 | ||
| 51 | Bu::FString &getString(); | 51 | Bu::String &getString(); |
| 52 | void setString( const Bu::FString &sNewData ); | 52 | void setString( const Bu::String &sNewData ); |
| 53 | 53 | ||
| 54 | private: | 54 | private: |
| 55 | Bu::FString sBuf; | 55 | Bu::String sBuf; |
| 56 | size nPos; | 56 | size nPos; |
| 57 | }; | 57 | }; |
| 58 | } | 58 | } |
diff --git a/src/minicron.cpp b/src/minicron.cpp index 491d143..307880e 100644 --- a/src/minicron.cpp +++ b/src/minicron.cpp | |||
| @@ -73,7 +73,7 @@ void Bu::MiniCron::poll() | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | Bu::MiniCron::JobId Bu::MiniCron::addJob( const Bu::FString &sName, | 76 | Bu::MiniCron::JobId Bu::MiniCron::addJob( const Bu::String &sName, |
| 77 | Bu::MiniCron::CronSignal sigJob, const Bu::MiniCron::Timer &t ) | 77 | Bu::MiniCron::CronSignal sigJob, const Bu::MiniCron::Timer &t ) |
| 78 | { | 78 | { |
| 79 | JobId jid = jidNext++; | 79 | JobId jid = jidNext++; |
| @@ -86,7 +86,7 @@ Bu::MiniCron::JobId Bu::MiniCron::addJob( const Bu::FString &sName, | |||
| 86 | return jid; | 86 | return jid; |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | Bu::MiniCron::JobId Bu::MiniCron::addJobOnce( const Bu::FString &sName, | 89 | Bu::MiniCron::JobId Bu::MiniCron::addJobOnce( const Bu::String &sName, |
| 90 | Bu::MiniCron::CronSignal sigJob, const Bu::MiniCron::Timer &t ) | 90 | Bu::MiniCron::CronSignal sigJob, const Bu::MiniCron::Timer &t ) |
| 91 | { | 91 | { |
| 92 | JobId jid = jidNext++; | 92 | JobId jid = jidNext++; |
| @@ -132,7 +132,7 @@ Bu::MiniCron::JobInfoList Bu::MiniCron::getJobInfo() | |||
| 132 | return lRet; | 132 | return lRet; |
| 133 | } | 133 | } |
| 134 | 134 | ||
| 135 | Bu::MiniCron::Job::Job( const Bu::FString &sName, JobId jid, bool bRepeat ) : | 135 | Bu::MiniCron::Job::Job( const Bu::String &sName, JobId jid, bool bRepeat ) : |
| 136 | sName( sName ), | 136 | sName( sName ), |
| 137 | pTimer( NULL ), | 137 | pTimer( NULL ), |
| 138 | bContinue( bRepeat ), | 138 | bContinue( bRepeat ), |
| @@ -202,12 +202,12 @@ time_t Bu::MiniCron::Job::getNextRunTime() const | |||
| 202 | return tNextRun; | 202 | return tNextRun; |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | Bu::FString Bu::MiniCron::Job::getName() const | 205 | Bu::String Bu::MiniCron::Job::getName() const |
| 206 | { | 206 | { |
| 207 | return sName; | 207 | return sName; |
| 208 | } | 208 | } |
| 209 | 209 | ||
| 210 | Bu::MiniCron::JobInfo::JobInfo( const Bu::FString &sName, JobId jid, | 210 | Bu::MiniCron::JobInfo::JobInfo( const Bu::String &sName, JobId jid, |
| 211 | time_t tNext ) : | 211 | time_t tNext ) : |
| 212 | sName( sName ), | 212 | sName( sName ), |
| 213 | jid( jid ), | 213 | jid( jid ), |
| @@ -249,7 +249,7 @@ time_t Bu::MiniCron::TimerInterval::nextTime() | |||
| 249 | return tRet; | 249 | return tRet; |
| 250 | } | 250 | } |
| 251 | 251 | ||
| 252 | Bu::MiniCron::TimerBasic::TimerBasic( const Bu::FString &s ) : | 252 | Bu::MiniCron::TimerBasic::TimerBasic( const Bu::String &s ) : |
| 253 | tLast( -1 ), | 253 | tLast( -1 ), |
| 254 | sSpec( s ) | 254 | sSpec( s ) |
| 255 | { | 255 | { |
| @@ -264,7 +264,7 @@ time_t Bu::MiniCron::TimerBasic::nextTime() | |||
| 264 | if( tLast == -1 ) | 264 | if( tLast == -1 ) |
| 265 | tLast = time( NULL ); | 265 | tLast = time( NULL ); |
| 266 | 266 | ||
| 267 | Bu::FString::const_iterator i = sSpec.begin(); | 267 | Bu::String::const_iterator i = sSpec.begin(); |
| 268 | switch( lex( i ) ) | 268 | switch( lex( i ) ) |
| 269 | { | 269 | { |
| 270 | case tokDaily: | 270 | case tokDaily: |
| @@ -343,19 +343,19 @@ time_t Bu::MiniCron::TimerBasic::nextTime() | |||
| 343 | } | 343 | } |
| 344 | 344 | ||
| 345 | Bu::MiniCron::TimerBasic::Token Bu::MiniCron::TimerBasic::lex( | 345 | Bu::MiniCron::TimerBasic::Token Bu::MiniCron::TimerBasic::lex( |
| 346 | Bu::FString::const_iterator &i ) | 346 | Bu::String::const_iterator &i ) |
| 347 | { | 347 | { |
| 348 | if( !i ) | 348 | if( !i ) |
| 349 | { | 349 | { |
| 350 | return tokEos; | 350 | return tokEos; |
| 351 | } | 351 | } |
| 352 | 352 | ||
| 353 | Bu::FString::const_iterator b = i; | 353 | Bu::String::const_iterator b = i; |
| 354 | 354 | ||
| 355 | for(; b && (*b == ' ' || *b == '\t'); b++ ) { i = b+1; } | 355 | for(; b && (*b == ' ' || *b == '\t'); b++ ) { i = b+1; } |
| 356 | for(; b && *b != ' ' && *b != '\t'; b++ ) { } | 356 | for(; b && *b != ' ' && *b != '\t'; b++ ) { } |
| 357 | 357 | ||
| 358 | Bu::FString sTok( i, b ); | 358 | Bu::String sTok( i, b ); |
| 359 | i = b; | 359 | i = b; |
| 360 | 360 | ||
| 361 | if( sTok == "daily" ) | 361 | if( sTok == "daily" ) |
| @@ -412,7 +412,7 @@ Bu::MiniCron::TimerBasic::Token Bu::MiniCron::TimerBasic::lex( | |||
| 412 | return tokErr; | 412 | return tokErr; |
| 413 | } | 413 | } |
| 414 | 414 | ||
| 415 | int Bu::MiniCron::TimerBasic::lexInt( Bu::FString::const_iterator &i ) | 415 | int Bu::MiniCron::TimerBasic::lexInt( Bu::String::const_iterator &i ) |
| 416 | { | 416 | { |
| 417 | Token t = lex( i ); | 417 | Token t = lex( i ); |
| 418 | if( t == tokEos ) | 418 | if( t == tokEos ) |
diff --git a/src/minicron.h b/src/minicron.h index b045e79..42369f5 100644 --- a/src/minicron.h +++ b/src/minicron.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include "bu/signals.h" | 11 | #include "bu/signals.h" |
| 12 | #include "bu/heap.h" | 12 | #include "bu/heap.h" |
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | 14 | ||
| 15 | #include <time.h> | 15 | #include <time.h> |
| 16 | 16 | ||
| @@ -89,7 +89,7 @@ namespace Bu | |||
| 89 | * JobId which can be used at a later time to control the execution of | 89 | * JobId which can be used at a later time to control the execution of |
| 90 | * the job. | 90 | * the job. |
| 91 | */ | 91 | */ |
| 92 | virtual JobId addJob( const Bu::FString &sName, CronSignal sigJob, | 92 | virtual JobId addJob( const Bu::String &sName, CronSignal sigJob, |
| 93 | const Timer &t ); | 93 | const Timer &t ); |
| 94 | 94 | ||
| 95 | /** | 95 | /** |
| @@ -98,7 +98,7 @@ namespace Bu | |||
| 98 | * function returns a JobId which can be used at a later time to control | 98 | * function returns a JobId which can be used at a later time to control |
| 99 | * the execution of the job. | 99 | * the execution of the job. |
| 100 | */ | 100 | */ |
| 101 | virtual JobId addJobOnce( const Bu::FString &sName, CronSignal sigJob, | 101 | virtual JobId addJobOnce( const Bu::String &sName, CronSignal sigJob, |
| 102 | const Timer &t ); | 102 | const Timer &t ); |
| 103 | 103 | ||
| 104 | /** | 104 | /** |
| @@ -113,12 +113,12 @@ namespace Bu | |||
| 113 | class JobInfo | 113 | class JobInfo |
| 114 | { | 114 | { |
| 115 | public: | 115 | public: |
| 116 | JobInfo( const Bu::FString &sName, JobId jid, time_t tNext ); | 116 | JobInfo( const Bu::String &sName, JobId jid, time_t tNext ); |
| 117 | virtual ~JobInfo(); | 117 | virtual ~JobInfo(); |
| 118 | 118 | ||
| 119 | bool operator<( const JobInfo &rhs ) const; | 119 | bool operator<( const JobInfo &rhs ) const; |
| 120 | 120 | ||
| 121 | Bu::FString sName; | 121 | Bu::String sName; |
| 122 | JobId jid; | 122 | JobId jid; |
| 123 | time_t tNext; | 123 | time_t tNext; |
| 124 | }; | 124 | }; |
| @@ -189,7 +189,7 @@ namespace Bu | |||
| 189 | class TimerBasic : public Timer | 189 | class TimerBasic : public Timer |
| 190 | { | 190 | { |
| 191 | public: | 191 | public: |
| 192 | TimerBasic( const Bu::FString &s ); | 192 | TimerBasic( const Bu::String &s ); |
| 193 | virtual ~TimerBasic(); | 193 | virtual ~TimerBasic(); |
| 194 | 194 | ||
| 195 | virtual time_t nextTime(); | 195 | virtual time_t nextTime(); |
| @@ -208,11 +208,11 @@ namespace Bu | |||
| 208 | tokErr, | 208 | tokErr, |
| 209 | tokEos | 209 | tokEos |
| 210 | }; | 210 | }; |
| 211 | Token lex( Bu::FString::const_iterator &i ); | 211 | Token lex( Bu::String::const_iterator &i ); |
| 212 | int lexInt( Bu::FString::const_iterator &i ); | 212 | int lexInt( Bu::String::const_iterator &i ); |
| 213 | int iVal; //< A temp variable for parsing. | 213 | int iVal; //< A temp variable for parsing. |
| 214 | time_t tLast; | 214 | time_t tLast; |
| 215 | Bu::FString sSpec; | 215 | Bu::String sSpec; |
| 216 | }; | 216 | }; |
| 217 | 217 | ||
| 218 | /** | 218 | /** |
| @@ -225,7 +225,7 @@ namespace Bu | |||
| 225 | { | 225 | { |
| 226 | friend class Bu::MiniCron; | 226 | friend class Bu::MiniCron; |
| 227 | private: | 227 | private: |
| 228 | Job( const Bu::FString &sName, JobId jid, bool bRepeat=true ); | 228 | Job( const Bu::String &sName, JobId jid, bool bRepeat=true ); |
| 229 | virtual ~Job(); | 229 | virtual ~Job(); |
| 230 | 230 | ||
| 231 | public: | 231 | public: |
| @@ -290,10 +290,10 @@ namespace Bu | |||
| 290 | /** | 290 | /** |
| 291 | * Gets the name that was set when the job was created. | 291 | * Gets the name that was set when the job was created. |
| 292 | */ | 292 | */ |
| 293 | Bu::FString getName() const; | 293 | Bu::String getName() const; |
| 294 | 294 | ||
| 295 | private: | 295 | private: |
| 296 | Bu::FString sName; | 296 | Bu::String sName; |
| 297 | CronSignal sigJob; | 297 | CronSignal sigJob; |
| 298 | time_t tNextRun; | 298 | time_t tNextRun; |
| 299 | Timer *pTimer; | 299 | Timer *pTimer; |
diff --git a/src/minimacro.cpp b/src/minimacro.cpp index df1a5c9..6c5a7c9 100644 --- a/src/minimacro.cpp +++ b/src/minimacro.cpp | |||
| @@ -25,10 +25,10 @@ Bu::MiniMacro::~MiniMacro() | |||
| 25 | { | 25 | { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn ) | 28 | Bu::String Bu::MiniMacro::parse( const Bu::String &sIn ) |
| 29 | { | 29 | { |
| 30 | bContinue = true; | 30 | bContinue = true; |
| 31 | Bu::FString sOut; | 31 | Bu::String sOut; |
| 32 | for( sCur = sIn.getStr(); *sCur && bContinue; sCur++ ) | 32 | for( sCur = sIn.getStr(); *sCur && bContinue; sCur++ ) |
| 33 | { | 33 | { |
| 34 | if( *sCur == '{' ) | 34 | if( *sCur == '{' ) |
| @@ -66,16 +66,16 @@ Bu::FString Bu::MiniMacro::parse( const Bu::FString &sIn ) | |||
| 66 | return sOut; | 66 | return sOut; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | Bu::FString Bu::MiniMacro::parseRepl() | 69 | Bu::String Bu::MiniMacro::parseRepl() |
| 70 | { | 70 | { |
| 71 | Bu::FString sOut; | 71 | Bu::String sOut; |
| 72 | bool bIsFirst = true; | 72 | bool bIsFirst = true; |
| 73 | for( const char *sNext = sCur;;) | 73 | for( const char *sNext = sCur;;) |
| 74 | { | 74 | { |
| 75 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } | 75 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } |
| 76 | if( *sNext == '\0' ) | 76 | if( *sNext == '\0' ) |
| 77 | break; | 77 | break; |
| 78 | Bu::FString sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); | 78 | Bu::String sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); |
| 79 | if( bIsFirst ) | 79 | if( bIsFirst ) |
| 80 | { | 80 | { |
| 81 | sOut = hVars[sName]; | 81 | sOut = hVars[sName]; |
| @@ -101,21 +101,21 @@ Bu::FString Bu::MiniMacro::parseRepl() | |||
| 101 | return sOut; | 101 | return sOut; |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | Bu::FString Bu::MiniMacro::parseCond() | 104 | Bu::String Bu::MiniMacro::parseCond() |
| 105 | { | 105 | { |
| 106 | Bu::FString sOut; | 106 | Bu::String sOut; |
| 107 | //printf("%20s\n", sCur ); | 107 | //printf("%20s\n", sCur ); |
| 108 | return sOut; | 108 | return sOut; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | Bu::FString Bu::MiniMacro::parseCmd() | 111 | Bu::String Bu::MiniMacro::parseCmd() |
| 112 | { | 112 | { |
| 113 | Bu::FString sOut; | 113 | Bu::String sOut; |
| 114 | const char *sNext = sCur; | 114 | const char *sNext = sCur; |
| 115 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } | 115 | for(; *sNext != ':' && *sNext != '}' && *sNext != '\0'; sNext++ ) { } |
| 116 | if( *sNext != '\0' ) | 116 | if( *sNext != '\0' ) |
| 117 | { | 117 | { |
| 118 | Bu::FString sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); | 118 | Bu::String sName( sCur, (ptrdiff_t)sNext-(ptrdiff_t)sCur ); |
| 119 | if( sName == "end" ) | 119 | if( sName == "end" ) |
| 120 | { | 120 | { |
| 121 | sCur = sNext; | 121 | sCur = sNext; |
| @@ -138,20 +138,20 @@ Bu::FString Bu::MiniMacro::parseCmd() | |||
| 138 | return sOut; | 138 | return sOut; |
| 139 | } | 139 | } |
| 140 | 140 | ||
| 141 | Bu::FString Bu::MiniMacro::callFunc( | 141 | Bu::String Bu::MiniMacro::callFunc( |
| 142 | const Bu::FString &sIn, const Bu::FString &sFunc ) | 142 | const Bu::String &sIn, const Bu::String &sFunc ) |
| 143 | { | 143 | { |
| 144 | int i = sFunc.findIdx('('); | 144 | int i = sFunc.findIdx('('); |
| 145 | if( i < 0 ) | 145 | if( i < 0 ) |
| 146 | throw Bu::ExceptionBase("That doesn't look like a function call"); | 146 | throw Bu::ExceptionBase("That doesn't look like a function call"); |
| 147 | Bu::FString sName( sFunc.getStr(), i ); | 147 | Bu::String sName( sFunc.getStr(), i ); |
| 148 | StrList lsParams; | 148 | StrList lsParams; |
| 149 | for( const char *s = sFunc.getStr()+i+1; *s && *s != ')'; s++ ) | 149 | for( const char *s = sFunc.getStr()+i+1; *s && *s != ')'; s++ ) |
| 150 | { | 150 | { |
| 151 | for(; *s == ' ' || *s == '\t' || *s == '\r' || *s == '\n'; s++ ) { } | 151 | for(; *s == ' ' || *s == '\t' || *s == '\r' || *s == '\n'; s++ ) { } |
| 152 | const char *sNext; | 152 | const char *sNext; |
| 153 | for( sNext = s; *sNext && *sNext != ')' && *sNext != ','; sNext++ ) { } | 153 | for( sNext = s; *sNext && *sNext != ')' && *sNext != ','; sNext++ ) { } |
| 154 | Bu::FString p( s, (ptrdiff_t)sNext-(ptrdiff_t)s ); | 154 | Bu::String p( s, (ptrdiff_t)sNext-(ptrdiff_t)s ); |
| 155 | lsParams.append( p ); | 155 | lsParams.append( p ); |
| 156 | sNext++; | 156 | sNext++; |
| 157 | s = sNext; | 157 | s = sNext; |
| @@ -160,17 +160,17 @@ Bu::FString Bu::MiniMacro::callFunc( | |||
| 160 | } | 160 | } |
| 161 | 161 | ||
| 162 | void Bu::MiniMacro::addVar( | 162 | void Bu::MiniMacro::addVar( |
| 163 | const Bu::FString &sName, const Bu::FString &sValue ) | 163 | const Bu::String &sName, const Bu::String &sValue ) |
| 164 | { | 164 | { |
| 165 | hVars.insert( sName, sValue ); | 165 | hVars.insert( sName, sValue ); |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | bool Bu::MiniMacro::hasVar( const Bu::FString &sName ) | 168 | bool Bu::MiniMacro::hasVar( const Bu::String &sName ) |
| 169 | { | 169 | { |
| 170 | return hVars.has( sName ); | 170 | return hVars.has( sName ); |
| 171 | } | 171 | } |
| 172 | 172 | ||
| 173 | const Bu::FString &Bu::MiniMacro::getVar( const Bu::FString &sName ) | 173 | const Bu::String &Bu::MiniMacro::getVar( const Bu::String &sName ) |
| 174 | { | 174 | { |
| 175 | return hVars.get( sName ); | 175 | return hVars.get( sName ); |
| 176 | } | 176 | } |
diff --git a/src/minimacro.h b/src/minimacro.h index 2a1fe23..0483190 100644 --- a/src/minimacro.h +++ b/src/minimacro.h | |||
| @@ -9,11 +9,11 @@ | |||
| 9 | #define BU_MINI_MACRO_H | 9 | #define BU_MINI_MACRO_H |
| 10 | 10 | ||
| 11 | #include "bu/hash.h" | 11 | #include "bu/hash.h" |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| 15 | { | 15 | { |
| 16 | typedef Bu::Hash<Bu::FString, Bu::FString> StrHash; | 16 | typedef Bu::Hash<Bu::String, Bu::String> StrHash; |
| 17 | /** | 17 | /** |
| 18 | * A processor for Libbu++ brand Mini Macros. These are really simple, but | 18 | * A processor for Libbu++ brand Mini Macros. These are really simple, but |
| 19 | * still fairly flexible. It's mainly text replacement, but with a few | 19 | * still fairly flexible. It's mainly text replacement, but with a few |
| @@ -67,34 +67,34 @@ namespace Bu | |||
| 67 | MiniMacro( const StrHash &sVarSrc ); | 67 | MiniMacro( const StrHash &sVarSrc ); |
| 68 | virtual ~MiniMacro(); | 68 | virtual ~MiniMacro(); |
| 69 | 69 | ||
| 70 | Bu::FString parse( const Bu::FString &sIn ); | 70 | Bu::String parse( const Bu::String &sIn ); |
| 71 | void addVar( const Bu::FString &sName, const Bu::FString &sValue ); | 71 | void addVar( const Bu::String &sName, const Bu::String &sValue ); |
| 72 | bool hasVar( const Bu::FString &sName ); | 72 | bool hasVar( const Bu::String &sName ); |
| 73 | const Bu::FString &getVar( const Bu::FString &sName ); | 73 | const Bu::String &getVar( const Bu::String &sName ); |
| 74 | const StrHash &getVars(); | 74 | const StrHash &getVars(); |
| 75 | int getPosition(); | 75 | int getPosition(); |
| 76 | 76 | ||
| 77 | private: | 77 | private: |
| 78 | const char *sCur; | 78 | const char *sCur; |
| 79 | Bu::FString parseRepl(); | 79 | Bu::String parseRepl(); |
| 80 | Bu::FString parseCond(); | 80 | Bu::String parseCond(); |
| 81 | Bu::FString parseCmd(); | 81 | Bu::String parseCmd(); |
| 82 | Bu::FString callFunc( | 82 | Bu::String callFunc( |
| 83 | const Bu::FString &sIn, const Bu::FString &sFunc ); | 83 | const Bu::String &sIn, const Bu::String &sFunc ); |
| 84 | 84 | ||
| 85 | StrHash hVars; | 85 | StrHash hVars; |
| 86 | bool bContinue; | 86 | bool bContinue; |
| 87 | int iLastPos; | 87 | int iLastPos; |
| 88 | 88 | ||
| 89 | public: | 89 | public: |
| 90 | typedef Bu::List<Bu::FString> StrList; | 90 | typedef Bu::List<Bu::String> StrList; |
| 91 | class Func | 91 | class Func |
| 92 | { | 92 | { |
| 93 | public: | 93 | public: |
| 94 | Func(){} | 94 | Func(){} |
| 95 | virtual ~Func(){} | 95 | virtual ~Func(){} |
| 96 | virtual Bu::FString call( | 96 | virtual Bu::String call( |
| 97 | const Bu::FString &sIn, StrList &lsParam )=0; | 97 | const Bu::String &sIn, StrList &lsParam )=0; |
| 98 | }; | 98 | }; |
| 99 | 99 | ||
| 100 | class FuncToUpper : public Func | 100 | class FuncToUpper : public Func |
| @@ -102,10 +102,10 @@ namespace Bu | |||
| 102 | public: | 102 | public: |
| 103 | FuncToUpper(){} | 103 | FuncToUpper(){} |
| 104 | virtual ~FuncToUpper(){} | 104 | virtual ~FuncToUpper(){} |
| 105 | virtual Bu::FString call( | 105 | virtual Bu::String call( |
| 106 | const Bu::FString &sIn, StrList & ) | 106 | const Bu::String &sIn, StrList & ) |
| 107 | { | 107 | { |
| 108 | Bu::FString sOut( sIn ); | 108 | Bu::String sOut( sIn ); |
| 109 | sOut.toUpper(); | 109 | sOut.toUpper(); |
| 110 | return sOut; | 110 | return sOut; |
| 111 | } | 111 | } |
| @@ -116,17 +116,17 @@ namespace Bu | |||
| 116 | public: | 116 | public: |
| 117 | FuncToLower(){} | 117 | FuncToLower(){} |
| 118 | virtual ~FuncToLower(){} | 118 | virtual ~FuncToLower(){} |
| 119 | virtual Bu::FString call( | 119 | virtual Bu::String call( |
| 120 | const Bu::FString &sIn, StrList & ) | 120 | const Bu::String &sIn, StrList & ) |
| 121 | { | 121 | { |
| 122 | Bu::FString sOut( sIn ); | 122 | Bu::String sOut( sIn ); |
| 123 | sOut.toLower(); | 123 | sOut.toLower(); |
| 124 | return sOut; | 124 | return sOut; |
| 125 | } | 125 | } |
| 126 | }; | 126 | }; |
| 127 | 127 | ||
| 128 | private: | 128 | private: |
| 129 | typedef Bu::Hash<Bu::FString,class Func *> FuncHash; | 129 | typedef Bu::Hash<Bu::String,class Func *> FuncHash; |
| 130 | FuncHash hFuncs; | 130 | FuncHash hFuncs; |
| 131 | }; | 131 | }; |
| 132 | }; | 132 | }; |
diff --git a/src/multiserver.cpp b/src/multiserver.cpp index a6cee36..58f2a7c 100644 --- a/src/multiserver.cpp +++ b/src/multiserver.cpp | |||
| @@ -26,7 +26,7 @@ void Bu::MultiServer::addProtocol( Bu::Protocol *(*proc)(), int iPort, | |||
| 26 | addPort( iPort, nPoolSize ); | 26 | addPort( iPort, nPoolSize ); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | void Bu::MultiServer::addProtocol( Protocol *(*proc)(), const FString &sAddr, | 29 | void Bu::MultiServer::addProtocol( Protocol *(*proc)(), const String &sAddr, |
| 30 | int iPort, int nPoolSize ) | 30 | int iPort, int nPoolSize ) |
| 31 | { | 31 | { |
| 32 | hProtos[iPort] = proc; | 32 | hProtos[iPort] = proc; |
diff --git a/src/multiserver.h b/src/multiserver.h index 6b98c1d..d529d0c 100644 --- a/src/multiserver.h +++ b/src/multiserver.h | |||
| @@ -29,7 +29,7 @@ namespace Bu | |||
| 29 | virtual ~MultiServer(); | 29 | virtual ~MultiServer(); |
| 30 | 30 | ||
| 31 | void addProtocol( Protocol *(*proc)(), int iPort, int nPoolSize=40 ); | 31 | void addProtocol( Protocol *(*proc)(), int iPort, int nPoolSize=40 ); |
| 32 | void addProtocol( Protocol *(*proc)(), const FString &sAddr, int iPort, | 32 | void addProtocol( Protocol *(*proc)(), const String &sAddr, int iPort, |
| 33 | int nPoolSize=40 ); | 33 | int nPoolSize=40 ); |
| 34 | 34 | ||
| 35 | void scan() | 35 | void scan() |
diff --git a/src/nullstream.cpp b/src/nullstream.cpp index 40c636c..6f792e3 100644 --- a/src/nullstream.cpp +++ b/src/nullstream.cpp | |||
| @@ -22,10 +22,10 @@ size_t Bu::NullStream::read( void *pBuf, size_t nBytes ) | |||
| 22 | return nBytes; | 22 | return nBytes; |
| 23 | } | 23 | } |
| 24 | 24 | ||
| 25 | Bu::FString Bu::NullStream::readLine() | 25 | Bu::String Bu::NullStream::readLine() |
| 26 | { | 26 | { |
| 27 | sRead++; | 27 | sRead++; |
| 28 | return Bu::FString("\0", 1 ); | 28 | return Bu::String("\0", 1 ); |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | size_t Bu::NullStream::write( const void *, size_t nBytes ) | 31 | size_t Bu::NullStream::write( const void *, size_t nBytes ) |
diff --git a/src/nullstream.h b/src/nullstream.h index 1537ffb..8c1f744 100644 --- a/src/nullstream.h +++ b/src/nullstream.h | |||
| @@ -25,7 +25,7 @@ namespace Bu | |||
| 25 | 25 | ||
| 26 | virtual void close(); | 26 | virtual void close(); |
| 27 | virtual size_t read( void *pBuf, size_t nBytes ); | 27 | virtual size_t read( void *pBuf, size_t nBytes ); |
| 28 | virtual Bu::FString readLine(); | 28 | virtual Bu::String readLine(); |
| 29 | virtual size_t write( const void *pBuf, size_t nBytes ); | 29 | virtual size_t write( const void *pBuf, size_t nBytes ); |
| 30 | using Bu::Stream::write; | 30 | using Bu::Stream::write; |
| 31 | virtual long tell(); | 31 | virtual long tell(); |
diff --git a/src/optparser.cpp b/src/optparser.cpp index b81691d..7b4e0d0 100644 --- a/src/optparser.cpp +++ b/src/optparser.cpp | |||
| @@ -32,9 +32,9 @@ void Bu::OptParser::parse( int argc, char **argv ) | |||
| 32 | for( iEPos = 2; argv[j][iEPos] != '\0' && | 32 | for( iEPos = 2; argv[j][iEPos] != '\0' && |
| 33 | argv[j][iEPos] != '='; iEPos++ ) { } | 33 | argv[j][iEPos] != '='; iEPos++ ) { } |
| 34 | 34 | ||
| 35 | Bu::FString sOpt; | 35 | Bu::String sOpt; |
| 36 | int iCount = argc-j; | 36 | int iCount = argc-j; |
| 37 | Bu::FString sExtraParam; | 37 | Bu::String sExtraParam; |
| 38 | if( argv[j][iEPos] == '=' ) | 38 | if( argv[j][iEPos] == '=' ) |
| 39 | { | 39 | { |
| 40 | sOpt.set( argv[j]+2, iEPos-2 ); | 40 | sOpt.set( argv[j]+2, iEPos-2 ); |
| @@ -92,7 +92,7 @@ void Bu::OptParser::parse( int argc, char **argv ) | |||
| 92 | { | 92 | { |
| 93 | if( !hsOption.has( argv[j][iCPos] ) ) | 93 | if( !hsOption.has( argv[j][iCPos] ) ) |
| 94 | { | 94 | { |
| 95 | Bu::FString sOpt("-"); | 95 | Bu::String sOpt("-"); |
| 96 | sOpt += argv[j][iCPos]; | 96 | sOpt += argv[j][iCPos]; |
| 97 | optionError( sOpt ); | 97 | optionError( sOpt ); |
| 98 | } | 98 | } |
| @@ -181,17 +181,17 @@ void Bu::OptParser::setOverride( char cOpt, const Bu::Variant &sOverride ) | |||
| 181 | hsOption.get( cOpt )->sOverride = sOverride; | 181 | hsOption.get( cOpt )->sOverride = sOverride; |
| 182 | } | 182 | } |
| 183 | 183 | ||
| 184 | void Bu::OptParser::setOverride( const Bu::FString &sOpt, const Bu::Variant &sOverride ) | 184 | void Bu::OptParser::setOverride( const Bu::String &sOpt, const Bu::Variant &sOverride ) |
| 185 | { | 185 | { |
| 186 | hlOption.get( sOpt )->sOverride = sOverride; | 186 | hlOption.get( sOpt )->sOverride = sOverride; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | void Bu::OptParser::setHelpDefault( const Bu::FString &sOpt, const Bu::FString &sTxt ) | 189 | void Bu::OptParser::setHelpDefault( const Bu::String &sOpt, const Bu::String &sTxt ) |
| 190 | { | 190 | { |
| 191 | hlOption.get( sOpt )->sHelpDefault = sTxt; | 191 | hlOption.get( sOpt )->sHelpDefault = sTxt; |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | void Bu::OptParser::addHelpOption( char c, const Bu::FString &s, const Bu::FString &sHelp ) | 194 | void Bu::OptParser::addHelpOption( char c, const Bu::String &s, const Bu::String &sHelp ) |
| 195 | { | 195 | { |
| 196 | Option o; | 196 | Option o; |
| 197 | o.sUsed = slot( this, &OptParser::optHelp ); | 197 | o.sUsed = slot( this, &OptParser::optHelp ); |
| @@ -201,7 +201,7 @@ void Bu::OptParser::addHelpOption( char c, const Bu::FString &s, const Bu::FStri | |||
| 201 | addOption( o ); | 201 | addOption( o ); |
| 202 | } | 202 | } |
| 203 | 203 | ||
| 204 | void Bu::OptParser::addHelpBanner( const Bu::FString &sText, bool bFormatted ) | 204 | void Bu::OptParser::addHelpBanner( const Bu::String &sText, bool bFormatted ) |
| 205 | { | 205 | { |
| 206 | Banner b; | 206 | Banner b; |
| 207 | b.sText = sText; | 207 | b.sText = sText; |
| @@ -290,7 +290,7 @@ int Bu::OptParser::optHelp( StrArray /*aParams*/ ) | |||
| 290 | return 0; | 290 | return 0; |
| 291 | } | 291 | } |
| 292 | 292 | ||
| 293 | void Bu::OptParser::optionError( const Bu::FString &sOption ) | 293 | void Bu::OptParser::optionError( const Bu::String &sOption ) |
| 294 | { | 294 | { |
| 295 | sio << "Unregcognized option discovered: " << sOption << sio.nl << sio.nl; | 295 | sio << "Unregcognized option discovered: " << sOption << sio.nl << sio.nl; |
| 296 | exit( 1 ); | 296 | exit( 1 ); |
| @@ -301,11 +301,11 @@ void Bu::OptParser::setNonOption( OptionSignal sSignal ) | |||
| 301 | sNonOption = sSignal; | 301 | sNonOption = sSignal; |
| 302 | } | 302 | } |
| 303 | 303 | ||
| 304 | Bu::FString Bu::OptParser::format( const Bu::FString &sIn, int iWidth, | 304 | Bu::String Bu::OptParser::format( const Bu::String &sIn, int iWidth, |
| 305 | int iIndent ) | 305 | int iIndent ) |
| 306 | { | 306 | { |
| 307 | Bu::FString sOut; | 307 | Bu::String sOut; |
| 308 | Bu::FString sIndent; | 308 | Bu::String sIndent; |
| 309 | for( int j = 0; j < iIndent; j++ ) | 309 | for( int j = 0; j < iIndent; j++ ) |
| 310 | sIndent.append(" ", 1); | 310 | sIndent.append(" ", 1); |
| 311 | bool bFirst = true; | 311 | bool bFirst = true; |
| @@ -314,8 +314,8 @@ Bu::FString Bu::OptParser::format( const Bu::FString &sIn, int iWidth, | |||
| 314 | int iPrevLineLen; | 314 | int iPrevLineLen; |
| 315 | int iLineLen = 0; | 315 | int iLineLen = 0; |
| 316 | char c; | 316 | char c; |
| 317 | Bu::FString::const_iterator iLastSpace, iStart; | 317 | Bu::String::const_iterator iLastSpace, iStart; |
| 318 | for( Bu::FString::const_iterator i = iLastSpace = iStart = sIn.begin(); i; i++ ) | 318 | for( Bu::String::const_iterator i = iLastSpace = iStart = sIn.begin(); i; i++ ) |
| 319 | { | 319 | { |
| 320 | c = *i; | 320 | c = *i; |
| 321 | if( *i == ' ' ) | 321 | if( *i == ' ' ) |
| @@ -346,7 +346,7 @@ Bu::FString Bu::OptParser::format( const Bu::FString &sIn, int iWidth, | |||
| 346 | float fFill = 0.0; | 346 | float fFill = 0.0; |
| 347 | int iSubSpaceCount = 0; | 347 | int iSubSpaceCount = 0; |
| 348 | float fAdd = ((float)iExtraSpaces/(float)iSpaceCount); | 348 | float fAdd = ((float)iExtraSpaces/(float)iSpaceCount); |
| 349 | for( Bu::FString::const_iterator k = iStart; k != iLastSpace; k++ ) | 349 | for( Bu::String::const_iterator k = iStart; k != iLastSpace; k++ ) |
| 350 | { | 350 | { |
| 351 | sOut += *k; | 351 | sOut += *k; |
| 352 | if( *k == ' ' ) | 352 | if( *k == ' ' ) |
diff --git a/src/optparser.h b/src/optparser.h index 7ec69e5..9781542 100644 --- a/src/optparser.h +++ b/src/optparser.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_OPT_PARSER_H | 8 | #ifndef BU_OPT_PARSER_H |
| 9 | #define BU_OPT_PARSER_H | 9 | #define BU_OPT_PARSER_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/list.h" | 12 | #include "bu/list.h" |
| 13 | #include "bu/hash.h" | 13 | #include "bu/hash.h" |
| 14 | #include "bu/signals.h" | 14 | #include "bu/signals.h" |
| @@ -19,7 +19,7 @@ | |||
| 19 | 19 | ||
| 20 | namespace Bu | 20 | namespace Bu |
| 21 | { | 21 | { |
| 22 | typedef Bu::Array<Bu::FString> StrArray; | 22 | typedef Bu::Array<Bu::String> StrArray; |
| 23 | 23 | ||
| 24 | /** | 24 | /** |
| 25 | * POSIX/Gnu style command line parser. Handles long and short options in | 25 | * POSIX/Gnu style command line parser. Handles long and short options in |
| @@ -41,7 +41,7 @@ namespace Bu | |||
| 41 | _ValueProxy(); | 41 | _ValueProxy(); |
| 42 | virtual ~_ValueProxy(); | 42 | virtual ~_ValueProxy(); |
| 43 | 43 | ||
| 44 | virtual void setValueFromStr( const Bu::FString & )=0; | 44 | virtual void setValueFromStr( const Bu::String & )=0; |
| 45 | virtual void setValue( const Bu::Variant &vVar )=0; | 45 | virtual void setValue( const Bu::Variant &vVar )=0; |
| 46 | virtual _ValueProxy *clone()=0; | 46 | virtual _ValueProxy *clone()=0; |
| 47 | }; | 47 | }; |
| @@ -59,7 +59,7 @@ namespace Bu | |||
| 59 | { | 59 | { |
| 60 | } | 60 | } |
| 61 | 61 | ||
| 62 | virtual void setValueFromStr( const Bu::FString &sVal ) | 62 | virtual void setValueFromStr( const Bu::String &sVal ) |
| 63 | { | 63 | { |
| 64 | Bu::MemBuf mb( sVal ); | 64 | Bu::MemBuf mb( sVal ); |
| 65 | Bu::Formatter f( mb ); | 65 | Bu::Formatter f( mb ); |
| @@ -72,9 +72,9 @@ namespace Bu | |||
| 72 | { | 72 | { |
| 73 | v = vVar.get<ptype>(); | 73 | v = vVar.get<ptype>(); |
| 74 | } | 74 | } |
| 75 | else if( vVar.getType() == typeid(Bu::FString) ) | 75 | else if( vVar.getType() == typeid(Bu::String) ) |
| 76 | { | 76 | { |
| 77 | setValueFromStr( vVar.get<Bu::FString>() ); | 77 | setValueFromStr( vVar.get<Bu::String>() ); |
| 78 | } | 78 | } |
| 79 | else | 79 | else |
| 80 | { | 80 | { |
| @@ -101,23 +101,23 @@ namespace Bu | |||
| 101 | virtual ~Option(); | 101 | virtual ~Option(); |
| 102 | 102 | ||
| 103 | char cOpt; | 103 | char cOpt; |
| 104 | Bu::FString sOpt; | 104 | Bu::String sOpt; |
| 105 | Bu::FString sHelp; | 105 | Bu::String sHelp; |
| 106 | OptionSignal sUsed; | 106 | OptionSignal sUsed; |
| 107 | _ValueProxy *pProxy; | 107 | _ValueProxy *pProxy; |
| 108 | Bu::Variant sOverride; | 108 | Bu::Variant sOverride; |
| 109 | Bu::FString sHelpDefault; | 109 | Bu::String sHelpDefault; |
| 110 | }; | 110 | }; |
| 111 | 111 | ||
| 112 | private: | 112 | private: |
| 113 | typedef Bu::List<Option> OptionList; | 113 | typedef Bu::List<Option> OptionList; |
| 114 | typedef Bu::Hash<char, Option *> ShortOptionHash; | 114 | typedef Bu::Hash<char, Option *> ShortOptionHash; |
| 115 | typedef Bu::Hash<Bu::FString, Option *> LongOptionHash; | 115 | typedef Bu::Hash<Bu::String, Option *> LongOptionHash; |
| 116 | 116 | ||
| 117 | class Banner | 117 | class Banner |
| 118 | { | 118 | { |
| 119 | public: | 119 | public: |
| 120 | Bu::FString sText; | 120 | Bu::String sText; |
| 121 | bool bFormatted; | 121 | bool bFormatted; |
| 122 | OptionList::const_iterator iAfter; | 122 | OptionList::const_iterator iAfter; |
| 123 | }; | 123 | }; |
| @@ -133,8 +133,8 @@ namespace Bu | |||
| 133 | void addOption( const Option &opt ); | 133 | void addOption( const Option &opt ); |
| 134 | 134 | ||
| 135 | template<typename vtype> | 135 | template<typename vtype> |
| 136 | void addOption( vtype &var, char cOpt, const Bu::FString &sOpt, | 136 | void addOption( vtype &var, char cOpt, const Bu::String &sOpt, |
| 137 | const Bu::FString &sHelp ) | 137 | const Bu::String &sHelp ) |
| 138 | { | 138 | { |
| 139 | Option o; | 139 | Option o; |
| 140 | o.cOpt = cOpt; | 140 | o.cOpt = cOpt; |
| @@ -145,20 +145,20 @@ namespace Bu | |||
| 145 | } | 145 | } |
| 146 | 146 | ||
| 147 | template<typename vtype> | 147 | template<typename vtype> |
| 148 | void addOption( vtype &var, const Bu::FString &sOpt, | 148 | void addOption( vtype &var, const Bu::String &sOpt, |
| 149 | const Bu::FString &sHelp ) | 149 | const Bu::String &sHelp ) |
| 150 | { | 150 | { |
| 151 | addOption( var, '\0', sOpt, sHelp ); | 151 | addOption( var, '\0', sOpt, sHelp ); |
| 152 | } | 152 | } |
| 153 | 153 | ||
| 154 | template<typename vtype> | 154 | template<typename vtype> |
| 155 | void addOption( vtype &var, char cOpt, const Bu::FString &sHelp ) | 155 | void addOption( vtype &var, char cOpt, const Bu::String &sHelp ) |
| 156 | { | 156 | { |
| 157 | addOption( var, cOpt, "", sHelp ); | 157 | addOption( var, cOpt, "", sHelp ); |
| 158 | } | 158 | } |
| 159 | 159 | ||
| 160 | void addOption( OptionSignal sUsed, char cOpt, const Bu::FString &sOpt, | 160 | void addOption( OptionSignal sUsed, char cOpt, const Bu::String &sOpt, |
| 161 | const Bu::FString &sHelp ) | 161 | const Bu::String &sHelp ) |
| 162 | { | 162 | { |
| 163 | Option o; | 163 | Option o; |
| 164 | o.cOpt = cOpt; | 164 | o.cOpt = cOpt; |
| @@ -168,27 +168,27 @@ namespace Bu | |||
| 168 | addOption( o ); | 168 | addOption( o ); |
| 169 | } | 169 | } |
| 170 | 170 | ||
| 171 | void addOption( OptionSignal sUsed, const Bu::FString &sOpt, | 171 | void addOption( OptionSignal sUsed, const Bu::String &sOpt, |
| 172 | const Bu::FString &sHelp ) | 172 | const Bu::String &sHelp ) |
| 173 | { | 173 | { |
| 174 | addOption( sUsed, '\0', sOpt, sHelp ); | 174 | addOption( sUsed, '\0', sOpt, sHelp ); |
| 175 | } | 175 | } |
| 176 | 176 | ||
| 177 | void addOption( OptionSignal sUsed, char cOpt, | 177 | void addOption( OptionSignal sUsed, char cOpt, |
| 178 | const Bu::FString &sHelp ) | 178 | const Bu::String &sHelp ) |
| 179 | { | 179 | { |
| 180 | addOption( sUsed, cOpt, "", sHelp ); | 180 | addOption( sUsed, cOpt, "", sHelp ); |
| 181 | } | 181 | } |
| 182 | 182 | ||
| 183 | void setOverride( char cOpt, const Bu::Variant &sOverride ); | 183 | void setOverride( char cOpt, const Bu::Variant &sOverride ); |
| 184 | void setOverride( const Bu::FString &sOpt, | 184 | void setOverride( const Bu::String &sOpt, |
| 185 | const Bu::Variant &sOverride ); | 185 | const Bu::Variant &sOverride ); |
| 186 | 186 | ||
| 187 | void setHelpDefault( const Bu::FString &sOpt, const Bu::FString &sTxt ); | 187 | void setHelpDefault( const Bu::String &sOpt, const Bu::String &sTxt ); |
| 188 | 188 | ||
| 189 | void addHelpOption( char c='h', const Bu::FString &s="help", | 189 | void addHelpOption( char c='h', const Bu::String &s="help", |
| 190 | const Bu::FString &sHelp="This help." ); | 190 | const Bu::String &sHelp="This help." ); |
| 191 | void addHelpBanner( const Bu::FString &sText, bool bFormatted=true ); | 191 | void addHelpBanner( const Bu::String &sText, bool bFormatted=true ); |
| 192 | 192 | ||
| 193 | int optHelp( StrArray aParams ); | 193 | int optHelp( StrArray aParams ); |
| 194 | 194 | ||
| @@ -200,12 +200,12 @@ namespace Bu | |||
| 200 | * been handled by an option, and isn't an option (starts with - or --). | 200 | * been handled by an option, and isn't an option (starts with - or --). |
| 201 | * To change this behaviour call | 201 | * To change this behaviour call |
| 202 | */ | 202 | */ |
| 203 | virtual void optionError( const Bu::FString &sOption ); | 203 | virtual void optionError( const Bu::String &sOption ); |
| 204 | 204 | ||
| 205 | void setNonOption( OptionSignal sSignal ); | 205 | void setNonOption( OptionSignal sSignal ); |
| 206 | 206 | ||
| 207 | private: | 207 | private: |
| 208 | Bu::FString format( const Bu::FString &sIn, int iWidth, int iIndent ); | 208 | Bu::String format( const Bu::String &sIn, int iWidth, int iIndent ); |
| 209 | 209 | ||
| 210 | OptionList lOption; | 210 | OptionList lOption; |
| 211 | ShortOptionHash hsOption; | 211 | ShortOptionHash hsOption; |
diff --git a/src/parser.cpp b/src/parser.cpp index 4ad4ff9..e46967c 100644 --- a/src/parser.cpp +++ b/src/parser.cpp | |||
| @@ -172,12 +172,12 @@ void Bu::Parser::setRootNonTerminal( int iRoot ) | |||
| 172 | iRootNonTerminal = iRoot; | 172 | iRootNonTerminal = iRoot; |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | void Bu::Parser::setRootNonTerminal( const Bu::FString &sRoot ) | 175 | void Bu::Parser::setRootNonTerminal( const Bu::String &sRoot ) |
| 176 | { | 176 | { |
| 177 | setRootNonTerminal( hNonTerminalName.get( sRoot ) ); | 177 | setRootNonTerminal( hNonTerminalName.get( sRoot ) ); |
| 178 | } | 178 | } |
| 179 | 179 | ||
| 180 | int Bu::Parser::addNonTerminal( const Bu::FString &sName, NonTerminal &nt ) | 180 | int Bu::Parser::addNonTerminal( const Bu::String &sName, NonTerminal &nt ) |
| 181 | { | 181 | { |
| 182 | int iId = aNonTerminal.getSize(); | 182 | int iId = aNonTerminal.getSize(); |
| 183 | aNonTerminal.append( nt ); | 183 | aNonTerminal.append( nt ); |
| @@ -186,7 +186,7 @@ int Bu::Parser::addNonTerminal( const Bu::FString &sName, NonTerminal &nt ) | |||
| 186 | return iId; | 186 | return iId; |
| 187 | } | 187 | } |
| 188 | 188 | ||
| 189 | int Bu::Parser::addNonTerminal( const Bu::FString &sName ) | 189 | int Bu::Parser::addNonTerminal( const Bu::String &sName ) |
| 190 | { | 190 | { |
| 191 | int iId = aNonTerminal.getSize(); | 191 | int iId = aNonTerminal.getSize(); |
| 192 | aNonTerminal.append( NonTerminal() ); | 192 | aNonTerminal.append( NonTerminal() ); |
| @@ -195,22 +195,22 @@ int Bu::Parser::addNonTerminal( const Bu::FString &sName ) | |||
| 195 | return iId; | 195 | return iId; |
| 196 | } | 196 | } |
| 197 | 197 | ||
| 198 | void Bu::Parser::setNonTerminal( const Bu::FString &sName, NonTerminal &nt ) | 198 | void Bu::Parser::setNonTerminal( const Bu::String &sName, NonTerminal &nt ) |
| 199 | { | 199 | { |
| 200 | aNonTerminal[hNonTerminalName.get(sName)] = nt; | 200 | aNonTerminal[hNonTerminalName.get(sName)] = nt; |
| 201 | } | 201 | } |
| 202 | 202 | ||
| 203 | int Bu::Parser::getNonTerminalId( const Bu::FString &sName ) | 203 | int Bu::Parser::getNonTerminalId( const Bu::String &sName ) |
| 204 | { | 204 | { |
| 205 | return hNonTerminalName.get( sName ); | 205 | return hNonTerminalName.get( sName ); |
| 206 | } | 206 | } |
| 207 | 207 | ||
| 208 | bool Bu::Parser::hasNonTerminal( const Bu::FString &sName ) | 208 | bool Bu::Parser::hasNonTerminal( const Bu::String &sName ) |
| 209 | { | 209 | { |
| 210 | return hNonTerminalName.has( sName ); | 210 | return hNonTerminalName.has( sName ); |
| 211 | } | 211 | } |
| 212 | 212 | ||
| 213 | int Bu::Parser::addReduction( const Bu::FString &sName, const Reduction &r ) | 213 | int Bu::Parser::addReduction( const Bu::String &sName, const Reduction &r ) |
| 214 | { | 214 | { |
| 215 | int iId = aReduction.getSize(); | 215 | int iId = aReduction.getSize(); |
| 216 | aReduction.append( r ); | 216 | aReduction.append( r ); |
| @@ -218,7 +218,7 @@ int Bu::Parser::addReduction( const Bu::FString &sName, const Reduction &r ) | |||
| 218 | return iId; | 218 | return iId; |
| 219 | } | 219 | } |
| 220 | 220 | ||
| 221 | int Bu::Parser::addReduction( const Bu::FString &sName ) | 221 | int Bu::Parser::addReduction( const Bu::String &sName ) |
| 222 | { | 222 | { |
| 223 | int iId = aReduction.getSize(); | 223 | int iId = aReduction.getSize(); |
| 224 | aReduction.append( Reduction() ); | 224 | aReduction.append( Reduction() ); |
| @@ -226,17 +226,17 @@ int Bu::Parser::addReduction( const Bu::FString &sName ) | |||
| 226 | return iId; | 226 | return iId; |
| 227 | } | 227 | } |
| 228 | 228 | ||
| 229 | void Bu::Parser::setReduction( const Bu::FString &sName, const Reduction &r ) | 229 | void Bu::Parser::setReduction( const Bu::String &sName, const Reduction &r ) |
| 230 | { | 230 | { |
| 231 | aReduction[hReductionName.get(sName)] = r; | 231 | aReduction[hReductionName.get(sName)] = r; |
| 232 | } | 232 | } |
| 233 | 233 | ||
| 234 | int Bu::Parser::getReductionId( const Bu::FString &sName ) | 234 | int Bu::Parser::getReductionId( const Bu::String &sName ) |
| 235 | { | 235 | { |
| 236 | return hReductionName.get( sName ); | 236 | return hReductionName.get( sName ); |
| 237 | } | 237 | } |
| 238 | 238 | ||
| 239 | bool Bu::Parser::hasReduction( const Bu::FString &sName ) | 239 | bool Bu::Parser::hasReduction( const Bu::String &sName ) |
| 240 | { | 240 | { |
| 241 | return hReductionName.has( sName ); | 241 | return hReductionName.has( sName ); |
| 242 | } | 242 | } |
diff --git a/src/parser.h b/src/parser.h index a925188..f4c4a74 100644 --- a/src/parser.h +++ b/src/parser.h | |||
| @@ -1,7 +1,7 @@ | |||
| 1 | #ifndef BU_PARSER_H | 1 | #ifndef BU_PARSER_H |
| 2 | #define BU_PARSER_H | 2 | #define BU_PARSER_H |
| 3 | 3 | ||
| 4 | #include "bu/fstring.h" | 4 | #include "bu/string.h" |
| 5 | #include "bu/list.h" | 5 | #include "bu/list.h" |
| 6 | #include "bu/array.h" | 6 | #include "bu/array.h" |
| 7 | #include "bu/hash.h" | 7 | #include "bu/hash.h" |
| @@ -43,7 +43,7 @@ namespace Bu | |||
| 43 | void parse(); | 43 | void parse(); |
| 44 | 44 | ||
| 45 | void setRootNonTerminal( int iRoot ); | 45 | void setRootNonTerminal( int iRoot ); |
| 46 | void setRootNonTerminal( const Bu::FString &sRoot ); | 46 | void setRootNonTerminal( const Bu::String &sRoot ); |
| 47 | 47 | ||
| 48 | typedef Bu::Signal1<void, Parser &> Reduction; | 48 | typedef Bu::Signal1<void, Parser &> Reduction; |
| 49 | 49 | ||
| @@ -87,17 +87,17 @@ namespace Bu | |||
| 87 | bool bCanSkip; | 87 | bool bCanSkip; |
| 88 | }; | 88 | }; |
| 89 | 89 | ||
| 90 | int addNonTerminal( const Bu::FString &sName, NonTerminal &nt ); | 90 | int addNonTerminal( const Bu::String &sName, NonTerminal &nt ); |
| 91 | int addNonTerminal( const Bu::FString &sName ); | 91 | int addNonTerminal( const Bu::String &sName ); |
| 92 | void setNonTerminal( const Bu::FString &sName, NonTerminal &nt ); | 92 | void setNonTerminal( const Bu::String &sName, NonTerminal &nt ); |
| 93 | int getNonTerminalId( const Bu::FString &sName ); | 93 | int getNonTerminalId( const Bu::String &sName ); |
| 94 | bool hasNonTerminal( const Bu::FString &sName ); | 94 | bool hasNonTerminal( const Bu::String &sName ); |
| 95 | 95 | ||
| 96 | int addReduction( const Bu::FString &sName, const Reduction &r ); | 96 | int addReduction( const Bu::String &sName, const Reduction &r ); |
| 97 | int addReduction( const Bu::FString &sName ); | 97 | int addReduction( const Bu::String &sName ); |
| 98 | void setReduction( const Bu::FString &sName, const Reduction &r ); | 98 | void setReduction( const Bu::String &sName, const Reduction &r ); |
| 99 | int getReductionId( const Bu::FString &sName ); | 99 | int getReductionId( const Bu::String &sName ); |
| 100 | bool hasReduction( const Bu::FString &sName ); | 100 | bool hasReduction( const Bu::String &sName ); |
| 101 | 101 | ||
| 102 | private: | 102 | private: |
| 103 | bool selectProduction( int iNt, Lexer::Token *ptCur ); | 103 | bool selectProduction( int iNt, Lexer::Token *ptCur ); |
| @@ -108,7 +108,7 @@ namespace Bu | |||
| 108 | typedef Bu::List<Lexer::Token *> TokenStack; | 108 | typedef Bu::List<Lexer::Token *> TokenStack; |
| 109 | typedef Bu::List<Production::const_iterator> StateStack; | 109 | typedef Bu::List<Production::const_iterator> StateStack; |
| 110 | typedef Bu::Array<Reduction> ReductionArray; | 110 | typedef Bu::Array<Reduction> ReductionArray; |
| 111 | typedef Bu::Hash<Bu::FString,int> NameIndexHash; | 111 | typedef Bu::Hash<Bu::String,int> NameIndexHash; |
| 112 | typedef Bu::Array<NonTerminal> NonTerminalArray; | 112 | typedef Bu::Array<NonTerminal> NonTerminalArray; |
| 113 | 113 | ||
| 114 | LexerStack sLexer; | 114 | LexerStack sLexer; |
diff --git a/src/plugger.h b/src/plugger.h index 9a74029..ef0cb53 100644 --- a/src/plugger.h +++ b/src/plugger.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include "bu/list.h" | 14 | #include "bu/list.h" |
| 15 | #include <dlfcn.h> | 15 | #include <dlfcn.h> |
| 16 | #include "bu/exceptionbase.h" | 16 | #include "bu/exceptionbase.h" |
| 17 | #include "bu/fstring.h" | 17 | #include "bu/string.h" |
| 18 | #include <stddef.h> | 18 | #include <stddef.h> |
| 19 | 19 | ||
| 20 | namespace Bu | 20 | namespace Bu |
| @@ -89,7 +89,7 @@ namespace Bu | |||
| 89 | class Plugger | 89 | class Plugger |
| 90 | { | 90 | { |
| 91 | public: | 91 | public: |
| 92 | typedef Bu::Hash<Bu::FString, PluginReg *> PluginHash; | 92 | typedef Bu::Hash<Bu::String, PluginReg *> PluginHash; |
| 93 | typedef Bu::Hash<ptrdiff_t, void *> InstHash; | 93 | typedef Bu::Hash<ptrdiff_t, void *> InstHash; |
| 94 | 94 | ||
| 95 | public: | 95 | public: |
| @@ -125,8 +125,8 @@ namespace Bu | |||
| 125 | hPlugin.insert( pInfo->sID, pReg ); | 125 | hPlugin.insert( pInfo->sID, pReg ); |
| 126 | } | 126 | } |
| 127 | 127 | ||
| 128 | void registerExternalPlugin( const Bu::FString &sFName, | 128 | void registerExternalPlugin( const Bu::String &sFName, |
| 129 | const Bu::FString &sPluginName ) | 129 | const Bu::String &sPluginName ) |
| 130 | { | 130 | { |
| 131 | PluginReg *pReg; | 131 | PluginReg *pReg; |
| 132 | try { | 132 | try { |
| @@ -158,7 +158,7 @@ namespace Bu | |||
| 158 | hPlugin.insert( pReg->pInfo->sID, pReg ); | 158 | hPlugin.insert( pReg->pInfo->sID, pReg ); |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | T *instantiate( const Bu::FString &lpName ) | 161 | T *instantiate( const Bu::String &lpName ) |
| 162 | { | 162 | { |
| 163 | PluginReg *pReg = (PluginReg *)hPlugin[lpName]; | 163 | PluginReg *pReg = (PluginReg *)hPlugin[lpName]; |
| 164 | if( pReg == NULL ) | 164 | if( pReg == NULL ) |
| @@ -171,7 +171,7 @@ namespace Bu | |||
| 171 | return p; | 171 | return p; |
| 172 | } | 172 | } |
| 173 | 173 | ||
| 174 | bool hasPlugin( const Bu::FString &lpName ) | 174 | bool hasPlugin( const Bu::String &lpName ) |
| 175 | { | 175 | { |
| 176 | return hPlugin.has( lpName ); | 176 | return hPlugin.has( lpName ); |
| 177 | } | 177 | } |
| @@ -202,7 +202,7 @@ namespace Bu | |||
| 202 | hPlugin.clear(); | 202 | hPlugin.clear(); |
| 203 | } | 203 | } |
| 204 | 204 | ||
| 205 | Bu::List<Bu::FString> getPluginList() | 205 | Bu::List<Bu::String> getPluginList() |
| 206 | { | 206 | { |
| 207 | return hPlugin.getKeys(); | 207 | return hPlugin.getKeys(); |
| 208 | } | 208 | } |
diff --git a/src/process.h b/src/process.h index 68678bd..d787854 100644 --- a/src/process.h +++ b/src/process.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | #include <sys/types.h> | 12 | #include <sys/types.h> |
| 13 | 13 | ||
| 14 | #include "bu/stream.h" | 14 | #include "bu/stream.h" |
| 15 | #include "bu/fstring.h" | 15 | #include "bu/string.h" |
| 16 | 16 | ||
| 17 | namespace Bu | 17 | namespace Bu |
| 18 | { | 18 | { |
diff --git a/src/protocol.cpp b/src/protocol.cpp index 28d8c08..7e992b4 100644 --- a/src/protocol.cpp +++ b/src/protocol.cpp | |||
| @@ -25,7 +25,7 @@ void Bu::Protocol::onNewData( Bu::Client * ) | |||
| 25 | { | 25 | { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | void Bu::Protocol::onMessage( Bu::Client *, const Bu::FString & ) | 28 | void Bu::Protocol::onMessage( Bu::Client *, const Bu::String & ) |
| 29 | { | 29 | { |
| 30 | } | 30 | } |
| 31 | 31 | ||
diff --git a/src/protocol.h b/src/protocol.h index f462060..28a70d0 100644 --- a/src/protocol.h +++ b/src/protocol.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | 12 | ||
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | 14 | ||
| 15 | namespace Bu | 15 | namespace Bu |
| 16 | { | 16 | { |
| @@ -27,7 +27,7 @@ namespace Bu | |||
| 27 | 27 | ||
| 28 | virtual void onNewConnection( Bu::Client *pClient ); | 28 | virtual void onNewConnection( Bu::Client *pClient ); |
| 29 | virtual void onNewData( Bu::Client *pClient ); | 29 | virtual void onNewData( Bu::Client *pClient ); |
| 30 | virtual void onMessage( Bu::Client *pClient, const Bu::FString &sMsg ); | 30 | virtual void onMessage( Bu::Client *pClient, const Bu::String &sMsg ); |
| 31 | virtual void onTick( Bu::Client *pClient ); | 31 | virtual void onTick( Bu::Client *pClient ); |
| 32 | 32 | ||
| 33 | private: | 33 | private: |
diff --git a/src/protocolhttp.cpp b/src/protocolhttp.cpp index 2a7fbdf..2fe447a 100644 --- a/src/protocolhttp.cpp +++ b/src/protocolhttp.cpp | |||
| @@ -51,7 +51,7 @@ void Bu::ProtocolHttp::onNewData( Bu::Client *pClient ) | |||
| 51 | 51 | ||
| 52 | for(;;) | 52 | for(;;) |
| 53 | { | 53 | { |
| 54 | Bu::FString sToken; | 54 | Bu::String sToken; |
| 55 | TokenType tt = getToken( sToken ); | 55 | TokenType tt = getToken( sToken ); |
| 56 | 56 | ||
| 57 | if( tt == ttOutOfData ) | 57 | if( tt == ttOutOfData ) |
| @@ -148,7 +148,7 @@ void Bu::ProtocolHttp::onNewData( Bu::Client *pClient ) | |||
| 148 | } | 148 | } |
| 149 | } | 149 | } |
| 150 | 150 | ||
| 151 | Bu::ProtocolHttp::TokenType Bu::ProtocolHttp::getToken( Bu::FString &line ) | 151 | Bu::ProtocolHttp::TokenType Bu::ProtocolHttp::getToken( Bu::String &line ) |
| 152 | { | 152 | { |
| 153 | char s; | 153 | char s; |
| 154 | int jmax = pClient->getInputSize(); | 154 | int jmax = pClient->getInputSize(); |
| @@ -330,7 +330,7 @@ Bu::ProtocolHttp::Response::Response( int iCode ) : | |||
| 330 | } | 330 | } |
| 331 | } | 331 | } |
| 332 | 332 | ||
| 333 | Bu::ProtocolHttp::Response::Response( int iCode, const Bu::FString &sReason ) : | 333 | Bu::ProtocolHttp::Response::Response( int iCode, const Bu::String &sReason ) : |
| 334 | iCode( iCode ), | 334 | iCode( iCode ), |
| 335 | sReason( sReason ) | 335 | sReason( sReason ) |
| 336 | { | 336 | { |
| @@ -341,12 +341,12 @@ Bu::ProtocolHttp::Response::~Response() | |||
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | void Bu::ProtocolHttp::Response::setHeader( | 343 | void Bu::ProtocolHttp::Response::setHeader( |
| 344 | const Bu::FString &sKey, const Bu::FString &sVal ) | 344 | const Bu::String &sKey, const Bu::String &sVal ) |
| 345 | { | 345 | { |
| 346 | hHeaders.insert( sKey, sVal ); | 346 | hHeaders.insert( sKey, sVal ); |
| 347 | } | 347 | } |
| 348 | 348 | ||
| 349 | void Bu::ProtocolHttp::Response::setContent( const Bu::FString &sCont ) | 349 | void Bu::ProtocolHttp::Response::setContent( const Bu::String &sCont ) |
| 350 | { | 350 | { |
| 351 | sContent = sCont; | 351 | sContent = sCont; |
| 352 | } | 352 | } |
diff --git a/src/protocolhttp.h b/src/protocolhttp.h index 80a0db6..6f4af9b 100644 --- a/src/protocolhttp.h +++ b/src/protocolhttp.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | 13 | ||
| 14 | #include "bu/protocol.h" | 14 | #include "bu/protocol.h" |
| 15 | #include "bu/client.h" | 15 | #include "bu/client.h" |
| 16 | #include "bu/fstring.h" | 16 | #include "bu/string.h" |
| 17 | #include "bu/hash.h" | 17 | #include "bu/hash.h" |
| 18 | 18 | ||
| 19 | namespace Bu | 19 | namespace Bu |
| @@ -32,7 +32,7 @@ namespace Bu | |||
| 32 | class ProtocolHttp : public Protocol | 32 | class ProtocolHttp : public Protocol |
| 33 | { | 33 | { |
| 34 | public: /* Types */ | 34 | public: /* Types */ |
| 35 | typedef Bu::List<Bu::FString> TokenList; | 35 | typedef Bu::List<Bu::String> TokenList; |
| 36 | 36 | ||
| 37 | public: /* Interface */ | 37 | public: /* Interface */ |
| 38 | ProtocolHttp(); | 38 | ProtocolHttp(); |
| @@ -42,25 +42,25 @@ namespace Bu | |||
| 42 | virtual void onNewData( Bu::Client *pClient ); | 42 | virtual void onNewData( Bu::Client *pClient ); |
| 43 | 43 | ||
| 44 | virtual void onRequest( | 44 | virtual void onRequest( |
| 45 | const Bu::FString &sMethod, const Bu::FString &sPath )=0; | 45 | const Bu::String &sMethod, const Bu::String &sPath )=0; |
| 46 | 46 | ||
| 47 | class Response | 47 | class Response |
| 48 | { | 48 | { |
| 49 | friend class Bu::ProtocolHttp; | 49 | friend class Bu::ProtocolHttp; |
| 50 | public: | 50 | public: |
| 51 | Response( int iCode ); | 51 | Response( int iCode ); |
| 52 | Response( int iCode, const Bu::FString &sReason ); | 52 | Response( int iCode, const Bu::String &sReason ); |
| 53 | virtual ~Response(); | 53 | virtual ~Response(); |
| 54 | 54 | ||
| 55 | void setHeader( const Bu::FString &sKey, const Bu::FString &sVal ); | 55 | void setHeader( const Bu::String &sKey, const Bu::String &sVal ); |
| 56 | void setContent( const Bu::FString &sCont ); | 56 | void setContent( const Bu::String &sCont ); |
| 57 | 57 | ||
| 58 | private: | 58 | private: |
| 59 | int iCode; | 59 | int iCode; |
| 60 | Bu::FString sReason; | 60 | Bu::String sReason; |
| 61 | typedef Bu::Hash<Bu::FString,Bu::FString> StringHash; | 61 | typedef Bu::Hash<Bu::String,Bu::String> StringHash; |
| 62 | StringHash hHeaders; | 62 | StringHash hHeaders; |
| 63 | Bu::FString sContent; | 63 | Bu::String sContent; |
| 64 | }; | 64 | }; |
| 65 | 65 | ||
| 66 | void sendResponse( const Response &rRes ); | 66 | void sendResponse( const Response &rRes ); |
| @@ -83,7 +83,7 @@ namespace Bu | |||
| 83 | * processed, false if the end-of-line has not been reached, and more | 83 | * processed, false if the end-of-line has not been reached, and more |
| 84 | * data needs to be read before this operation can continue. | 84 | * data needs to be read before this operation can continue. |
| 85 | */ | 85 | */ |
| 86 | TokenType getToken( Bu::FString &line ); | 86 | TokenType getToken( Bu::String &line ); |
| 87 | bool isWS( char buf ); | 87 | bool isWS( char buf ); |
| 88 | bool isSeperator( char buf ); | 88 | bool isSeperator( char buf ); |
| 89 | 89 | ||
| @@ -96,8 +96,8 @@ namespace Bu | |||
| 96 | 96 | ||
| 97 | int iState; | 97 | int iState; |
| 98 | 98 | ||
| 99 | Bu::FString sMethod; | 99 | Bu::String sMethod; |
| 100 | Bu::FString sPath; | 100 | Bu::String sPath; |
| 101 | int iMajor; | 101 | int iMajor; |
| 102 | int iMinor; | 102 | int iMinor; |
| 103 | }; | 103 | }; |
diff --git a/src/protocoltelnet.cpp b/src/protocoltelnet.cpp index 362b1cc..e07f275 100644 --- a/src/protocoltelnet.cpp +++ b/src/protocoltelnet.cpp | |||
| @@ -273,7 +273,7 @@ bool Bu::ProtocolTelnet::isCanonical() | |||
| 273 | return bCanonical; | 273 | return bCanonical; |
| 274 | } | 274 | } |
| 275 | 275 | ||
| 276 | void Bu::ProtocolTelnet::write( const Bu::FString &sData ) | 276 | void Bu::ProtocolTelnet::write( const Bu::String &sData ) |
| 277 | { | 277 | { |
| 278 | write( sData.getStr(), sData.getSize() ); | 278 | write( sData.getStr(), sData.getSize() ); |
| 279 | } | 279 | } |
diff --git a/src/protocoltelnet.h b/src/protocoltelnet.h index 253be79..e7a9af1 100644 --- a/src/protocoltelnet.h +++ b/src/protocoltelnet.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include "bu/protocol.h" | 11 | #include "bu/protocol.h" |
| 12 | #include "bu/hash.h" | 12 | #include "bu/hash.h" |
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | 14 | ||
| 15 | // #define __TELNET_DEBUG | 15 | // #define __TELNET_DEBUG |
| 16 | 16 | ||
| @@ -88,7 +88,7 @@ namespace Bu | |||
| 88 | * the line or not, the data will be cleared from the buffer when this | 88 | * the line or not, the data will be cleared from the buffer when this |
| 89 | * function returns, any changes made to the buffer will be destroyed. | 89 | * function returns, any changes made to the buffer will be destroyed. |
| 90 | */ | 90 | */ |
| 91 | virtual void gotLine( Bu::FString & /*sLine*/ ){}; | 91 | virtual void gotLine( Bu::String & /*sLine*/ ){}; |
| 92 | 92 | ||
| 93 | /** | 93 | /** |
| 94 | * Override this function to be notified of any new data that comes in | 94 | * Override this function to be notified of any new data that comes in |
| @@ -98,7 +98,7 @@ namespace Bu | |||
| 98 | * child class in this function, the buffer will never be cleared unless | 98 | * child class in this function, the buffer will never be cleared unless |
| 99 | * it happens in this function's override. | 99 | * it happens in this function's override. |
| 100 | */ | 100 | */ |
| 101 | virtual void gotData( Bu::FString & /*sData*/ ){}; | 101 | virtual void gotData( Bu::String & /*sData*/ ){}; |
| 102 | 102 | ||
| 103 | /** | 103 | /** |
| 104 | * Using this function to enable or disable canonical mode only affects | 104 | * Using this function to enable or disable canonical mode only affects |
| @@ -117,11 +117,11 @@ namespace Bu | |||
| 117 | void setCanonical( bool bCon=true ); | 117 | void setCanonical( bool bCon=true ); |
| 118 | bool isCanonical(); | 118 | bool isCanonical(); |
| 119 | 119 | ||
| 120 | void write( const Bu::FString &sData ); | 120 | void write( const Bu::String &sData ); |
| 121 | void write( const char *pData, int iSize ); | 121 | void write( const char *pData, int iSize ); |
| 122 | void write( char cData ); | 122 | void write( char cData ); |
| 123 | 123 | ||
| 124 | const Bu::FString &getBuffer() { return sDataBuf; } | 124 | const Bu::String &getBuffer() { return sDataBuf; } |
| 125 | 125 | ||
| 126 | public: | 126 | public: |
| 127 | /** | 127 | /** |
| @@ -138,7 +138,7 @@ namespace Bu | |||
| 138 | * sSubBuf, it will be cleared as soon as this function returns anyway. | 138 | * sSubBuf, it will be cleared as soon as this function returns anyway. |
| 139 | */ | 139 | */ |
| 140 | virtual void onSubUnknown( char /*cSubOpt*/, | 140 | virtual void onSubUnknown( char /*cSubOpt*/, |
| 141 | Bu::FString & /*sSubBuf*/ ){}; | 141 | Bu::String & /*sSubBuf*/ ){}; |
| 142 | 142 | ||
| 143 | private: | 143 | private: |
| 144 | /** | 144 | /** |
| @@ -208,8 +208,8 @@ namespace Bu | |||
| 208 | private: | 208 | private: |
| 209 | Client *pClient; | 209 | Client *pClient; |
| 210 | 210 | ||
| 211 | Bu::FString sDataBuf; /**< Buffer for regular line data. */ | 211 | Bu::String sDataBuf; /**< Buffer for regular line data. */ |
| 212 | Bu::FString sSubBuf; /**< Buffer for subnegotiation data. */ | 212 | Bu::String sSubBuf; /**< Buffer for subnegotiation data. */ |
| 213 | char cSubOpt; /**< Which suboption are we processing. */ | 213 | char cSubOpt; /**< Which suboption are we processing. */ |
| 214 | 214 | ||
| 215 | bool bCanonical; /**< Are we canonicalizing incoming data? */ | 215 | bool bCanonical; /**< Are we canonicalizing incoming data? */ |
diff --git a/src/regex.cpp b/src/regex.cpp index e634639..8c28333 100644 --- a/src/regex.cpp +++ b/src/regex.cpp | |||
| @@ -19,7 +19,7 @@ Bu::RegEx::RegEx() : | |||
| 19 | { | 19 | { |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | Bu::RegEx::RegEx( const Bu::FString &sSrc ) : | 22 | Bu::RegEx::RegEx( const Bu::String &sSrc ) : |
| 23 | pRegEx( NULL ), | 23 | pRegEx( NULL ), |
| 24 | bCompiled( false ), | 24 | bCompiled( false ), |
| 25 | paSubStr( NULL ) | 25 | paSubStr( NULL ) |
| @@ -37,7 +37,7 @@ Bu::RegEx::~RegEx() | |||
| 37 | } | 37 | } |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void Bu::RegEx::compile( const Bu::FString &sSrc ) | 40 | void Bu::RegEx::compile( const Bu::String &sSrc ) |
| 41 | { | 41 | { |
| 42 | if( bCompiled ) | 42 | if( bCompiled ) |
| 43 | { | 43 | { |
| @@ -54,7 +54,7 @@ void Bu::RegEx::compile( const Bu::FString &sSrc ) | |||
| 54 | size_t length = regerror( nErr, re, NULL, 0 ); | 54 | size_t length = regerror( nErr, re, NULL, 0 ); |
| 55 | char *buffer = new char[length]; | 55 | char *buffer = new char[length]; |
| 56 | (void) regerror( nErr, re, buffer, length ); | 56 | (void) regerror( nErr, re, buffer, length ); |
| 57 | Bu::FString s( buffer ); | 57 | Bu::String s( buffer ); |
| 58 | delete[] buffer; | 58 | delete[] buffer; |
| 59 | throw "???"; // BuildException( s.getStr() ); | 59 | throw "???"; // BuildException( s.getStr() ); |
| 60 | } | 60 | } |
| @@ -70,7 +70,7 @@ int Bu::RegEx::getNumSubStrings() | |||
| 70 | return nSubStr; | 70 | return nSubStr; |
| 71 | } | 71 | } |
| 72 | 72 | ||
| 73 | bool Bu::RegEx::execute( const Bu::FString &sSrc ) | 73 | bool Bu::RegEx::execute( const Bu::String &sSrc ) |
| 74 | { | 74 | { |
| 75 | sTest = sSrc; | 75 | sTest = sSrc; |
| 76 | if( regexec( re, sSrc.getStr(), nSubStr, aSubStr, 0 ) ) | 76 | if( regexec( re, sSrc.getStr(), nSubStr, aSubStr, 0 ) ) |
| @@ -84,10 +84,10 @@ void Bu::RegEx::getSubStringRange( int nIndex, int &iStart, int &iEnd ) | |||
| 84 | iEnd = aSubStr[nIndex].rm_eo; | 84 | iEnd = aSubStr[nIndex].rm_eo; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | Bu::FString Bu::RegEx::getSubString( int nIndex ) | 87 | Bu::String Bu::RegEx::getSubString( int nIndex ) |
| 88 | { | 88 | { |
| 89 | // regmatch_t *Subs = aSubStr; | 89 | // regmatch_t *Subs = aSubStr; |
| 90 | return Bu::FString( | 90 | return Bu::String( |
| 91 | sTest.getStr()+aSubStr[nIndex].rm_so, | 91 | sTest.getStr()+aSubStr[nIndex].rm_so, |
| 92 | aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so | 92 | aSubStr[nIndex].rm_eo - aSubStr[nIndex].rm_so |
| 93 | ); | 93 | ); |
diff --git a/src/regex.h b/src/regex.h index 6aac8e3..06b6352 100644 --- a/src/regex.h +++ b/src/regex.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_REG_EX_H | 8 | #ifndef BU_REG_EX_H |
| 9 | #define BU_REG_EX_H | 9 | #define BU_REG_EX_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | 12 | ||
| 13 | #include <stdint.h> | 13 | #include <stdint.h> |
| 14 | 14 | ||
| @@ -18,22 +18,22 @@ namespace Bu | |||
| 18 | { | 18 | { |
| 19 | public: | 19 | public: |
| 20 | RegEx(); | 20 | RegEx(); |
| 21 | RegEx( const Bu::FString &sSrc ); | 21 | RegEx( const Bu::String &sSrc ); |
| 22 | virtual ~RegEx(); | 22 | virtual ~RegEx(); |
| 23 | 23 | ||
| 24 | void compile( const Bu::FString &sSrc ); | 24 | void compile( const Bu::String &sSrc ); |
| 25 | int getNumSubStrings(); | 25 | int getNumSubStrings(); |
| 26 | bool execute( const Bu::FString &sSrc ); | 26 | bool execute( const Bu::String &sSrc ); |
| 27 | void getSubStringRange( int nIndex, int &iStart, int &iEnd ); | 27 | void getSubStringRange( int nIndex, int &iStart, int &iEnd ); |
| 28 | Bu::FString getSubString( int nIndex ); | 28 | Bu::String getSubString( int nIndex ); |
| 29 | const Bu::FString &getSource() | 29 | const Bu::String &getSource() |
| 30 | { | 30 | { |
| 31 | return sSrc; | 31 | return sSrc; |
| 32 | } | 32 | } |
| 33 | 33 | ||
| 34 | private: | 34 | private: |
| 35 | Bu::FString sSrc; | 35 | Bu::String sSrc; |
| 36 | Bu::FString sTest; | 36 | Bu::String sTest; |
| 37 | void *pRegEx; | 37 | void *pRegEx; |
| 38 | bool bCompiled; | 38 | bool bCompiled; |
| 39 | int nSubStr; | 39 | int nSubStr; |
diff --git a/src/server.cpp b/src/server.cpp index e701a69..3348d3c 100644 --- a/src/server.cpp +++ b/src/server.cpp | |||
| @@ -34,7 +34,7 @@ void Bu::Server::addPort( int nPort, int nPoolSize ) | |||
| 34 | hServers.insert( nSocket, s ); | 34 | hServers.insert( nSocket, s ); |
| 35 | } | 35 | } |
| 36 | 36 | ||
| 37 | void Bu::Server::addPort( const FString &sAddr, int nPort, int nPoolSize ) | 37 | void Bu::Server::addPort( const String &sAddr, int nPort, int nPoolSize ) |
| 38 | { | 38 | { |
| 39 | TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize ); | 39 | TcpServerSocket *s = new TcpServerSocket( sAddr, nPort, nPoolSize ); |
| 40 | int nSocket = s->getSocket(); | 40 | int nSocket = s->getSocket(); |
| @@ -153,7 +153,7 @@ Bu::Server::SrvClientLink::~SrvClientLink() | |||
| 153 | { | 153 | { |
| 154 | } | 154 | } |
| 155 | 155 | ||
| 156 | void Bu::Server::SrvClientLink::sendMessage( const Bu::FString &sMsg ) | 156 | void Bu::Server::SrvClientLink::sendMessage( const Bu::String &sMsg ) |
| 157 | { | 157 | { |
| 158 | pClient->onMessage( sMsg ); | 158 | pClient->onMessage( sMsg ); |
| 159 | } | 159 | } |
diff --git a/src/server.h b/src/server.h index d6726fd..f22d01b 100644 --- a/src/server.h +++ b/src/server.h | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | #include <sys/select.h> | 14 | #include <sys/select.h> |
| 15 | #endif | 15 | #endif |
| 16 | 16 | ||
| 17 | #include "bu/fstring.h" | 17 | #include "bu/string.h" |
| 18 | #include "bu/list.h" | 18 | #include "bu/list.h" |
| 19 | 19 | ||
| 20 | #include "bu/clientlink.h" | 20 | #include "bu/clientlink.h" |
| @@ -56,7 +56,7 @@ namespace Bu | |||
| 56 | virtual ~Server(); | 56 | virtual ~Server(); |
| 57 | 57 | ||
| 58 | void addPort( int nPort, int nPoolSize=40 ); | 58 | void addPort( int nPort, int nPoolSize=40 ); |
| 59 | void addPort( const FString &sAddr, int nPort, int nPoolSize=40 ); | 59 | void addPort( const String &sAddr, int nPort, int nPoolSize=40 ); |
| 60 | 60 | ||
| 61 | virtual void scan(); | 61 | virtual void scan(); |
| 62 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ); | 62 | void setTimeout( int nTimeoutSec, int nTimeoutUSec=0 ); |
| @@ -79,7 +79,7 @@ namespace Bu | |||
| 79 | SrvClientLink( Bu::Client *pClient ); | 79 | SrvClientLink( Bu::Client *pClient ); |
| 80 | virtual ~SrvClientLink(); | 80 | virtual ~SrvClientLink(); |
| 81 | 81 | ||
| 82 | virtual void sendMessage( const Bu::FString &sMsg ); | 82 | virtual void sendMessage( const Bu::String &sMsg ); |
| 83 | 83 | ||
| 84 | private: | 84 | private: |
| 85 | Bu::Client *pClient; | 85 | Bu::Client *pClient; |
diff --git a/src/sha1.cpp b/src/sha1.cpp index a206a78..f3e4eb1 100644 --- a/src/sha1.cpp +++ b/src/sha1.cpp | |||
| @@ -38,7 +38,7 @@ void Bu::Sha1::reset() | |||
| 38 | uTotalBytes = 0; | 38 | uTotalBytes = 0; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | void Bu::Sha1::setSalt( const Bu::FString & /*sSalt*/ ) | 41 | void Bu::Sha1::setSalt( const Bu::String & /*sSalt*/ ) |
| 42 | { | 42 | { |
| 43 | } | 43 | } |
| 44 | 44 | ||
| @@ -73,7 +73,7 @@ void Bu::Sha1::addData( const void *sDataRaw, int iSize ) | |||
| 73 | } | 73 | } |
| 74 | } | 74 | } |
| 75 | 75 | ||
| 76 | Bu::FString Bu::Sha1::getResult() | 76 | Bu::String Bu::Sha1::getResult() |
| 77 | { | 77 | { |
| 78 | // save the message size | 78 | // save the message size |
| 79 | uint32_t totalBitsL = uTotalBytes << 3; | 79 | uint32_t totalBitsL = uTotalBytes << 3; |
| @@ -102,7 +102,7 @@ Bu::FString Bu::Sha1::getResult() | |||
| 102 | // finish the final block | 102 | // finish the final block |
| 103 | addData( (char*)footer, iNeededZeros + 8 ); | 103 | addData( (char*)footer, iNeededZeros + 8 ); |
| 104 | 104 | ||
| 105 | Bu::FString sRet( 20 ); | 105 | Bu::String sRet( 20 ); |
| 106 | 106 | ||
| 107 | unsigned char *digest = (unsigned char *)sRet.getStr(); | 107 | unsigned char *digest = (unsigned char *)sRet.getStr(); |
| 108 | 108 | ||
| @@ -26,10 +26,10 @@ namespace Bu | |||
| 26 | ~Sha1(); | 26 | ~Sha1(); |
| 27 | 27 | ||
| 28 | virtual void reset(); | 28 | virtual void reset(); |
| 29 | virtual void setSalt( const Bu::FString &sSalt ); | 29 | virtual void setSalt( const Bu::String &sSalt ); |
| 30 | virtual void addData( const void *sData, int iSize ); | 30 | virtual void addData( const void *sData, int iSize ); |
| 31 | using CryptoHash::addData; | 31 | using CryptoHash::addData; |
| 32 | virtual FString getResult(); | 32 | virtual String getResult(); |
| 33 | virtual void writeResult( Stream &sOut ); | 33 | virtual void writeResult( Stream &sOut ); |
| 34 | 34 | ||
| 35 | void update( const char* data, int num ); | 35 | void update( const char* data, int num ); |
diff --git a/src/stream.cpp b/src/stream.cpp index f13d33a..33817de 100644 --- a/src/stream.cpp +++ b/src/stream.cpp | |||
| @@ -15,9 +15,9 @@ Bu::Stream::~Stream() | |||
| 15 | { | 15 | { |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | Bu::FString Bu::Stream::readLine() | 18 | Bu::String Bu::Stream::readLine() |
| 19 | { | 19 | { |
| 20 | Bu::FString sRet; | 20 | Bu::String sRet; |
| 21 | 21 | ||
| 22 | for(;;) | 22 | for(;;) |
| 23 | { | 23 | { |
| @@ -30,7 +30,7 @@ Bu::FString Bu::Stream::readLine() | |||
| 30 | } | 30 | } |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | Bu::size Bu::Stream::write( const Bu::FString &sBuf ) | 33 | Bu::size Bu::Stream::write( const Bu::String &sBuf ) |
| 34 | { | 34 | { |
| 35 | return write( sBuf.getStr(), sBuf.getSize() ); | 35 | return write( sBuf.getStr(), sBuf.getSize() ); |
| 36 | } | 36 | } |
diff --git a/src/stream.h b/src/stream.h index e7db7af..abbc9e8 100644 --- a/src/stream.h +++ b/src/stream.h | |||
| @@ -13,7 +13,7 @@ | |||
| 13 | #include <stdint.h> | 13 | #include <stdint.h> |
| 14 | #include <stdio.h> | 14 | #include <stdio.h> |
| 15 | 15 | ||
| 16 | #include "bu/fstring.h" | 16 | #include "bu/string.h" |
| 17 | 17 | ||
| 18 | namespace Bu | 18 | namespace Bu |
| 19 | { | 19 | { |
| @@ -53,7 +53,7 @@ namespace Bu | |||
| 53 | * data in a non-blocking stream. | 53 | * data in a non-blocking stream. |
| 54 | *@returns The line read, not including newline character. | 54 | *@returns The line read, not including newline character. |
| 55 | */ | 55 | */ |
| 56 | virtual Bu::FString readLine(); | 56 | virtual Bu::String readLine(); |
| 57 | 57 | ||
| 58 | /** | 58 | /** |
| 59 | * Write data to the stream. | 59 | * Write data to the stream. |
| @@ -63,7 +63,7 @@ namespace Bu | |||
| 63 | */ | 63 | */ |
| 64 | virtual size write( const void *pBuf, size iBytes ) = 0; | 64 | virtual size write( const void *pBuf, size iBytes ) = 0; |
| 65 | 65 | ||
| 66 | virtual size write( const Bu::FString &sBuf ); | 66 | virtual size write( const Bu::String &sBuf ); |
| 67 | 67 | ||
| 68 | /** | 68 | /** |
| 69 | * Get the current position in the stream. | 69 | * Get the current position in the stream. |
| @@ -185,7 +185,7 @@ namespace Bu | |||
| 185 | * it may give you an ip address, etc. If it isn't supported, an empty | 185 | * it may give you an ip address, etc. If it isn't supported, an empty |
| 186 | * string may be returned. | 186 | * string may be returned. |
| 187 | */ | 187 | */ |
| 188 | virtual Bu::FString getLocation() const = 0; | 188 | virtual Bu::String getLocation() const = 0; |
| 189 | 189 | ||
| 190 | private: | 190 | private: |
| 191 | 191 | ||
diff --git a/src/streamstack.cpp b/src/streamstack.cpp index 011c721..f400364 100644 --- a/src/streamstack.cpp +++ b/src/streamstack.cpp | |||
| @@ -86,7 +86,7 @@ size_t Bu::StreamStack::write( const void *pBuf, size_t nBytes ) | |||
| 86 | return lFilts.first()->write( pBuf, nBytes ); | 86 | return lFilts.first()->write( pBuf, nBytes ); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | size_t Bu::StreamStack::write( const Bu::FString &sBuf ) | 89 | size_t Bu::StreamStack::write( const Bu::String &sBuf ) |
| 90 | { | 90 | { |
| 91 | checkStack(); | 91 | checkStack(); |
| 92 | 92 | ||
diff --git a/src/streamstack.h b/src/streamstack.h index f40a760..2554bd2 100644 --- a/src/streamstack.h +++ b/src/streamstack.h | |||
| @@ -106,7 +106,7 @@ namespace Bu | |||
| 106 | virtual size_t read( void *pBuf, size_t nBytes ); | 106 | virtual size_t read( void *pBuf, size_t nBytes ); |
| 107 | virtual size_t write( const void *pBuf, size_t nBytes ); | 107 | virtual size_t write( const void *pBuf, size_t nBytes ); |
| 108 | 108 | ||
| 109 | virtual size_t write( const Bu::FString &sBuf ); | 109 | virtual size_t write( const Bu::String &sBuf ); |
| 110 | virtual long tell(); | 110 | virtual long tell(); |
| 111 | virtual void seek( long offset ); | 111 | virtual void seek( long offset ); |
| 112 | virtual void setPos( long pos ); | 112 | virtual void setPos( long pos ); |
diff --git a/src/fstring.cpp b/src/string.cpp index a3e0cb1..3f895dc 100644 --- a/src/fstring.cpp +++ b/src/string.cpp | |||
| @@ -8,12 +8,12 @@ | |||
| 8 | #define BU_TRACE | 8 | #define BU_TRACE |
| 9 | #include "bu/trace.h" | 9 | #include "bu/trace.h" |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/hash.h" | 12 | #include "bu/hash.h" |
| 13 | 13 | ||
| 14 | template class Bu::FBasicString<char>; | 14 | template class Bu::BasicString<char>; |
| 15 | 15 | ||
| 16 | template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) | 16 | template<> uint32_t Bu::__calcHashCode<Bu::String>( const Bu::String &k ) |
| 17 | { | 17 | { |
| 18 | long j, sz = k.getSize(); | 18 | long j, sz = k.getSize(); |
| 19 | const char *s = k.getStr(); | 19 | const char *s = k.getStr(); |
| @@ -27,18 +27,18 @@ template<> uint32_t Bu::__calcHashCode<Bu::FString>( const Bu::FString &k ) | |||
| 27 | return nPos; | 27 | return nPos; |
| 28 | } | 28 | } |
| 29 | 29 | ||
| 30 | template<> bool Bu::__cmpHashKeys<Bu::FString>( | 30 | template<> bool Bu::__cmpHashKeys<Bu::String>( |
| 31 | const Bu::FString &a, const Bu::FString &b ) | 31 | const Bu::String &a, const Bu::String &b ) |
| 32 | { | 32 | { |
| 33 | return a == b; | 33 | return a == b; |
| 34 | } | 34 | } |
| 35 | 35 | ||
| 36 | template<> void Bu::__tracer_format<Bu::FString>( const Bu::FString &v ) | 36 | template<> void Bu::__tracer_format<Bu::String>( const Bu::String &v ) |
| 37 | { | 37 | { |
| 38 | printf("(%ld)\"%s\"", v.getSize(), v.getStr() ); | 38 | printf("(%ld)\"%s\"", v.getSize(), v.getStr() ); |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | bool &Bu::operator<<( bool &dst, const Bu::FString &sIn ) | 41 | bool &Bu::operator<<( bool &dst, const Bu::String &sIn ) |
| 42 | { | 42 | { |
| 43 | if( sIn == "true" || sIn == "yes" || sIn == "t" ) | 43 | if( sIn == "true" || sIn == "yes" || sIn == "t" ) |
| 44 | dst = true; | 44 | dst = true; |
| @@ -48,79 +48,79 @@ bool &Bu::operator<<( bool &dst, const Bu::FString &sIn ) | |||
| 48 | return dst; | 48 | return dst; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | uint8_t &Bu::operator<<( uint8_t &dst, const Bu::FString &sIn ) | 51 | uint8_t &Bu::operator<<( uint8_t &dst, const Bu::String &sIn ) |
| 52 | { | 52 | { |
| 53 | sscanf( sIn.getStr(), "%hhu", &dst ); | 53 | sscanf( sIn.getStr(), "%hhu", &dst ); |
| 54 | return dst; | 54 | return dst; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | int8_t &Bu::operator<<( int8_t &dst, const Bu::FString &sIn ) | 57 | int8_t &Bu::operator<<( int8_t &dst, const Bu::String &sIn ) |
| 58 | { | 58 | { |
| 59 | sscanf( sIn.getStr(), "%hhd", &dst ); | 59 | sscanf( sIn.getStr(), "%hhd", &dst ); |
| 60 | return dst; | 60 | return dst; |
| 61 | } | 61 | } |
| 62 | 62 | ||
| 63 | char &Bu::operator<<( char &dst, const Bu::FString &sIn ) | 63 | char &Bu::operator<<( char &dst, const Bu::String &sIn ) |
| 64 | { | 64 | { |
| 65 | sscanf( sIn.getStr(), "%hhd", &dst ); | 65 | sscanf( sIn.getStr(), "%hhd", &dst ); |
| 66 | return dst; | 66 | return dst; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | uint16_t &Bu::operator<<( uint16_t &dst, const Bu::FString &sIn ) | 69 | uint16_t &Bu::operator<<( uint16_t &dst, const Bu::String &sIn ) |
| 70 | { | 70 | { |
| 71 | sscanf( sIn.getStr(), "%hu", &dst ); | 71 | sscanf( sIn.getStr(), "%hu", &dst ); |
| 72 | return dst; | 72 | return dst; |
| 73 | } | 73 | } |
| 74 | 74 | ||
| 75 | int16_t &Bu::operator<<( int16_t &dst, const Bu::FString &sIn ) | 75 | int16_t &Bu::operator<<( int16_t &dst, const Bu::String &sIn ) |
| 76 | { | 76 | { |
| 77 | sscanf( sIn.getStr(), "%hd", &dst ); | 77 | sscanf( sIn.getStr(), "%hd", &dst ); |
| 78 | return dst; | 78 | return dst; |
| 79 | } | 79 | } |
| 80 | 80 | ||
| 81 | uint32_t &Bu::operator<<( uint32_t &dst, const Bu::FString &sIn ) | 81 | uint32_t &Bu::operator<<( uint32_t &dst, const Bu::String &sIn ) |
| 82 | { | 82 | { |
| 83 | sscanf( sIn.getStr(), "%u", &dst ); | 83 | sscanf( sIn.getStr(), "%u", &dst ); |
| 84 | return dst; | 84 | return dst; |
| 85 | } | 85 | } |
| 86 | 86 | ||
| 87 | int32_t &Bu::operator<<( int32_t &dst, const Bu::FString &sIn ) | 87 | int32_t &Bu::operator<<( int32_t &dst, const Bu::String &sIn ) |
| 88 | { | 88 | { |
| 89 | sscanf( sIn.getStr(), "%d", &dst ); | 89 | sscanf( sIn.getStr(), "%d", &dst ); |
| 90 | return dst; | 90 | return dst; |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | uint64_t &Bu::operator<<( uint64_t &dst, const Bu::FString &sIn ) | 93 | uint64_t &Bu::operator<<( uint64_t &dst, const Bu::String &sIn ) |
| 94 | { | 94 | { |
| 95 | sscanf( sIn.getStr(), "%llu", &dst ); | 95 | sscanf( sIn.getStr(), "%llu", &dst ); |
| 96 | return dst; | 96 | return dst; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | int64_t &Bu::operator<<( int64_t &dst, const Bu::FString &sIn ) | 99 | int64_t &Bu::operator<<( int64_t &dst, const Bu::String &sIn ) |
| 100 | { | 100 | { |
| 101 | sscanf( sIn.getStr(), "%lld", &dst ); | 101 | sscanf( sIn.getStr(), "%lld", &dst ); |
| 102 | return dst; | 102 | return dst; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | float &Bu::operator<<( float &dst, const Bu::FString &sIn ) | 105 | float &Bu::operator<<( float &dst, const Bu::String &sIn ) |
| 106 | { | 106 | { |
| 107 | sscanf( sIn.getStr(), "%f", &dst ); | 107 | sscanf( sIn.getStr(), "%f", &dst ); |
| 108 | return dst; | 108 | return dst; |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | double &Bu::operator<<( double &dst, const Bu::FString &sIn ) | 111 | double &Bu::operator<<( double &dst, const Bu::String &sIn ) |
| 112 | { | 112 | { |
| 113 | sscanf( sIn.getStr(), "%lf", &dst ); | 113 | sscanf( sIn.getStr(), "%lf", &dst ); |
| 114 | return dst; | 114 | return dst; |
| 115 | } | 115 | } |
| 116 | 116 | ||
| 117 | long double &Bu::operator<<( long double &dst, const Bu::FString &sIn ) | 117 | long double &Bu::operator<<( long double &dst, const Bu::String &sIn ) |
| 118 | { | 118 | { |
| 119 | sscanf( sIn.getStr(), "%Lf", &dst ); | 119 | sscanf( sIn.getStr(), "%Lf", &dst ); |
| 120 | return dst; | 120 | return dst; |
| 121 | } | 121 | } |
| 122 | 122 | ||
| 123 | Bu::FString &Bu::operator<<( Bu::FString &dst, const Bu::FString &sIn ) | 123 | Bu::String &Bu::operator<<( Bu::String &dst, const Bu::String &sIn ) |
| 124 | { | 124 | { |
| 125 | dst = sIn; | 125 | dst = sIn; |
| 126 | return dst; | 126 | return dst; |
diff --git a/src/fbasicstring.h b/src/string.h index 064ff16..5a0c471 100644 --- a/src/fbasicstring.h +++ b/src/string.h | |||
| @@ -5,8 +5,8 @@ | |||
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #ifndef BU_F_BASIC_STRING_H | 8 | #ifndef BU_STRING_H |
| 9 | #define BU_F_BASIC_STRING_H | 9 | #define BU_STRING_H |
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include <memory> | 12 | #include <memory> |
| @@ -27,17 +27,15 @@ namespace Bu | |||
| 27 | { | 27 | { |
| 28 | /** @cond DEVEL */ | 28 | /** @cond DEVEL */ |
| 29 | template< typename chr > | 29 | template< typename chr > |
| 30 | struct FStringChunk | 30 | struct StringChunk |
| 31 | { | 31 | { |
| 32 | long nLength; | 32 | long nLength; |
| 33 | chr *pData; | 33 | chr *pData; |
| 34 | FStringChunk *pNext; | 34 | StringChunk *pNext; |
| 35 | }; | 35 | }; |
| 36 | 36 | ||
| 37 | #define cpy( dest, src, size ) Bu::memcpy( dest, src, size*sizeof(chr) ) | ||
| 38 | |||
| 39 | template< typename chr, int nMinSize, typename chralloc, | 37 | template< typename chr, int nMinSize, typename chralloc, |
| 40 | typename chunkalloc> class FBasicString; | 38 | typename chunkalloc> class BasicString; |
| 41 | 39 | ||
| 42 | template<typename chr> | 40 | template<typename chr> |
| 43 | size_t strlen( const chr *pData ) | 41 | size_t strlen( const chr *pData ) |
| @@ -76,24 +74,24 @@ namespace Bu | |||
| 76 | } | 74 | } |
| 77 | 75 | ||
| 78 | template<typename chr, int nMinSize, typename chralloc, typename chunkalloc> | 76 | template<typename chr, int nMinSize, typename chralloc, typename chunkalloc> |
| 79 | struct FStringCore | 77 | struct StringCore |
| 80 | { | 78 | { |
| 81 | friend class FBasicString<chr, nMinSize, chralloc, chunkalloc>; | 79 | friend class BasicString<chr, nMinSize, chralloc, chunkalloc>; |
| 82 | friend class SharedCore< | 80 | friend class SharedCore< |
| 83 | FBasicString<chr, nMinSize, chralloc, chunkalloc>, | 81 | BasicString<chr, nMinSize, chralloc, chunkalloc>, |
| 84 | FStringCore<chr, nMinSize, chralloc, chunkalloc> | 82 | StringCore<chr, nMinSize, chralloc, chunkalloc> |
| 85 | >; | 83 | >; |
| 86 | private: | 84 | private: |
| 87 | typedef struct FStringCore<chr, nMinSize, chralloc, chunkalloc> MyType; | 85 | typedef struct StringCore<chr, nMinSize, chralloc, chunkalloc> MyType; |
| 88 | typedef struct FStringChunk<chr> Chunk; | 86 | typedef struct StringChunk<chr> Chunk; |
| 89 | FStringCore() : | 87 | StringCore() : |
| 90 | nLength( 0 ), | 88 | nLength( 0 ), |
| 91 | pFirst( NULL ), | 89 | pFirst( NULL ), |
| 92 | pLast( NULL ) | 90 | pLast( NULL ) |
| 93 | { | 91 | { |
| 94 | } | 92 | } |
| 95 | 93 | ||
| 96 | FStringCore( const MyType &rSrc ) : | 94 | StringCore( const MyType &rSrc ) : |
| 97 | nLength( rSrc.nLength ), | 95 | nLength( rSrc.nLength ), |
| 98 | pFirst( NULL ), | 96 | pFirst( NULL ), |
| 99 | pLast( NULL ), | 97 | pLast( NULL ), |
| @@ -111,14 +109,14 @@ namespace Bu | |||
| 111 | int iPos = 0; | 109 | int iPos = 0; |
| 112 | while( pLink != NULL ) | 110 | while( pLink != NULL ) |
| 113 | { | 111 | { |
| 114 | cpy( pFirst->pData+iPos, pLink->pData, pLink->nLength ); | 112 | memcpy( pFirst->pData+iPos, pLink->pData, pLink->nLength ); |
| 115 | iPos += pLink->nLength; | 113 | iPos += pLink->nLength; |
| 116 | pLink = pLink->pNext; | 114 | pLink = pLink->pNext; |
| 117 | } | 115 | } |
| 118 | } | 116 | } |
| 119 | } | 117 | } |
| 120 | 118 | ||
| 121 | virtual ~FStringCore() | 119 | virtual ~StringCore() |
| 122 | { | 120 | { |
| 123 | clear(); | 121 | clear(); |
| 124 | } | 122 | } |
| @@ -172,7 +170,7 @@ namespace Bu | |||
| 172 | pNew->pNext = pSrc->pNext; | 170 | pNew->pNext = pSrc->pNext; |
| 173 | pNew->nLength = pSrc->nLength; | 171 | pNew->nLength = pSrc->nLength; |
| 174 | pNew->pData = aChr.allocate( pSrc->nLength+1 ); | 172 | pNew->pData = aChr.allocate( pSrc->nLength+1 ); |
| 175 | cpy( pNew->pData, pSrc->pData, pSrc->nLength ); | 173 | memcpy( pNew->pData, pSrc->pData, pSrc->nLength ); |
| 176 | pNew->pData[pNew->nLength] = (chr)0; | 174 | pNew->pData[pNew->nLength] = (chr)0; |
| 177 | return pNew; | 175 | return pNew; |
| 178 | } | 176 | } |
| @@ -214,7 +212,7 @@ namespace Bu | |||
| 214 | * internal ref-counting means that if you pass strings around between | 212 | * internal ref-counting means that if you pass strings around between |
| 215 | * functions there's almost no overhead in time or memory since a reference | 213 | * functions there's almost no overhead in time or memory since a reference |
| 216 | * is created and no data is actually copied. This also means that you | 214 | * is created and no data is actually copied. This also means that you |
| 217 | * never need to put any FBasicString into a ref-counting container class. | 215 | * never need to put any BasicString into a ref-counting container class. |
| 218 | * | 216 | * |
| 219 | *@param chr (typename) Type of character (i.e. char) | 217 | *@param chr (typename) Type of character (i.e. char) |
| 220 | *@param nMinSize (int) Chunk size (default: 256) | 218 | *@param nMinSize (int) Chunk size (default: 256) |
| @@ -223,15 +221,15 @@ namespace Bu | |||
| 223 | */ | 221 | */ |
| 224 | template< typename chr, int nMinSize=256, | 222 | template< typename chr, int nMinSize=256, |
| 225 | typename chralloc=std::allocator<chr>, | 223 | typename chralloc=std::allocator<chr>, |
| 226 | typename chunkalloc=std::allocator<struct FStringChunk<chr> > > | 224 | typename chunkalloc=std::allocator<struct StringChunk<chr> > > |
| 227 | class FBasicString : public SharedCore< | 225 | class BasicString : public SharedCore< |
| 228 | FBasicString<chr, nMinSize, chralloc, chunkalloc>, | 226 | BasicString<chr, nMinSize, chralloc, chunkalloc>, |
| 229 | FStringCore<chr, nMinSize, chralloc, chunkalloc> > | 227 | StringCore<chr, nMinSize, chralloc, chunkalloc> > |
| 230 | { | 228 | { |
| 231 | protected: | 229 | protected: |
| 232 | typedef struct FStringChunk<chr> Chunk; | 230 | typedef struct StringChunk<chr> Chunk; |
| 233 | typedef struct FBasicString<chr, nMinSize, chralloc, chunkalloc> MyType; | 231 | typedef struct BasicString<chr, nMinSize, chralloc, chunkalloc> MyType; |
| 234 | typedef struct FStringCore<chr, nMinSize, chralloc, chunkalloc> Core; | 232 | typedef struct StringCore<chr, nMinSize, chralloc, chunkalloc> Core; |
| 235 | 233 | ||
| 236 | using SharedCore<MyType, Core >::core; | 234 | using SharedCore<MyType, Core >::core; |
| 237 | using SharedCore<MyType, Core >::_hardCopy; | 235 | using SharedCore<MyType, Core >::_hardCopy; |
| @@ -240,7 +238,7 @@ namespace Bu | |||
| 240 | struct iterator; | 238 | struct iterator; |
| 241 | typedef struct const_iterator | 239 | typedef struct const_iterator |
| 242 | { | 240 | { |
| 243 | friend class FBasicString<chr, nMinSize, chralloc, chunkalloc>; | 241 | friend class BasicString<chr, nMinSize, chralloc, chunkalloc>; |
| 244 | friend struct iterator; | 242 | friend struct iterator; |
| 245 | private: | 243 | private: |
| 246 | const_iterator( Chunk *pChunk, int iPos ) : | 244 | const_iterator( Chunk *pChunk, int iPos ) : |
| @@ -474,7 +472,7 @@ namespace Bu | |||
| 474 | 472 | ||
| 475 | typedef struct iterator | 473 | typedef struct iterator |
| 476 | { | 474 | { |
| 477 | friend class FBasicString<chr, nMinSize, chralloc, chunkalloc>; | 475 | friend class BasicString<chr, nMinSize, chralloc, chunkalloc>; |
| 478 | friend struct const_iterator; | 476 | friend struct const_iterator; |
| 479 | private: | 477 | private: |
| 480 | iterator( Chunk *pChunk, int iPos ) : | 478 | iterator( Chunk *pChunk, int iPos ) : |
| @@ -719,52 +717,52 @@ namespace Bu | |||
| 719 | } iterator; | 717 | } iterator; |
| 720 | 718 | ||
| 721 | public: | 719 | public: |
| 722 | FBasicString() | 720 | BasicString() |
| 723 | { | 721 | { |
| 724 | } | 722 | } |
| 725 | 723 | ||
| 726 | FBasicString( const chr *pData ) | 724 | BasicString( const chr *pData ) |
| 727 | { | 725 | { |
| 728 | append( pData ); | 726 | append( pData ); |
| 729 | } | 727 | } |
| 730 | 728 | ||
| 731 | FBasicString( const chr *pData, long nLength ) | 729 | BasicString( const chr *pData, long nLength ) |
| 732 | { | 730 | { |
| 733 | append( pData, nLength ); | 731 | append( pData, nLength ); |
| 734 | } | 732 | } |
| 735 | 733 | ||
| 736 | FBasicString( const MyType &rSrc ) : | 734 | BasicString( const MyType &rSrc ) : |
| 737 | SharedCore<MyType, Core>( rSrc ) | 735 | SharedCore<MyType, Core>( rSrc ) |
| 738 | { | 736 | { |
| 739 | } | 737 | } |
| 740 | 738 | ||
| 741 | FBasicString( const MyType &rSrc, long nLength ) | 739 | BasicString( const MyType &rSrc, long nLength ) |
| 742 | { | 740 | { |
| 743 | append( rSrc, nLength ); | 741 | append( rSrc, nLength ); |
| 744 | } | 742 | } |
| 745 | 743 | ||
| 746 | FBasicString( const MyType &rSrc, long nStart, long nLength ) | 744 | BasicString( const MyType &rSrc, long nStart, long nLength ) |
| 747 | { | 745 | { |
| 748 | append( rSrc, nStart, nLength ); | 746 | append( rSrc, nStart, nLength ); |
| 749 | } | 747 | } |
| 750 | 748 | ||
| 751 | FBasicString( long nSize ) | 749 | BasicString( long nSize ) |
| 752 | { | 750 | { |
| 753 | core->pFirst = core->pLast = core->newChunk( nSize ); | 751 | core->pFirst = core->pLast = core->newChunk( nSize ); |
| 754 | core->nLength = nSize; | 752 | core->nLength = nSize; |
| 755 | } | 753 | } |
| 756 | 754 | ||
| 757 | FBasicString( const const_iterator &s ) | 755 | BasicString( const const_iterator &s ) |
| 758 | { | 756 | { |
| 759 | append( s ); | 757 | append( s ); |
| 760 | } | 758 | } |
| 761 | 759 | ||
| 762 | FBasicString( const const_iterator &s, const const_iterator &e ) | 760 | BasicString( const const_iterator &s, const const_iterator &e ) |
| 763 | { | 761 | { |
| 764 | append( s, e ); | 762 | append( s, e ); |
| 765 | } | 763 | } |
| 766 | 764 | ||
| 767 | virtual ~FBasicString() | 765 | virtual ~BasicString() |
| 768 | { | 766 | { |
| 769 | } | 767 | } |
| 770 | 768 | ||
| @@ -812,7 +810,7 @@ namespace Bu | |||
| 812 | int nAmnt = nMinSize - core->pLast->nLength; | 810 | int nAmnt = nMinSize - core->pLast->nLength; |
| 813 | if( nAmnt > nLen ) | 811 | if( nAmnt > nLen ) |
| 814 | nAmnt = nLen; | 812 | nAmnt = nLen; |
| 815 | cpy( | 813 | memcpy( |
| 816 | core->pLast->pData+core->pLast->nLength, | 814 | core->pLast->pData+core->pLast->nLength, |
| 817 | pData, | 815 | pData, |
| 818 | nAmnt | 816 | nAmnt |
| @@ -826,7 +824,7 @@ namespace Bu | |||
| 826 | if( nLen > 0 ) | 824 | if( nLen > 0 ) |
| 827 | { | 825 | { |
| 828 | Chunk *pNew = core->newChunk( nLen ); | 826 | Chunk *pNew = core->newChunk( nLen ); |
| 829 | cpy( pNew->pData, pData, nLen ); | 827 | memcpy( pNew->pData, pData, nLen ); |
| 830 | core->appendChunk( pNew ); | 828 | core->appendChunk( pNew ); |
| 831 | // core->nLength += nLen; | 829 | // core->nLength += nLen; |
| 832 | } | 830 | } |
| @@ -852,8 +850,8 @@ namespace Bu | |||
| 852 | } | 850 | } |
| 853 | 851 | ||
| 854 | /** | 852 | /** |
| 855 | * Append another FString to this one. | 853 | * Append another String to this one. |
| 856 | *@param sData (MyType &) The FString to append. | 854 | *@param sData (MyType &) The String to append. |
| 857 | *@todo This function can be made much faster by not using getStr() | 855 | *@todo This function can be made much faster by not using getStr() |
| 858 | */ | 856 | */ |
| 859 | void append( const MyType & sData ) | 857 | void append( const MyType & sData ) |
| @@ -862,8 +860,8 @@ namespace Bu | |||
| 862 | } | 860 | } |
| 863 | 861 | ||
| 864 | /** | 862 | /** |
| 865 | * Append another FString to this one. | 863 | * Append another String to this one. |
| 866 | *@param sData (MyType &) The FString to append. | 864 | *@param sData (MyType &) The String to append. |
| 867 | *@param nLen How much data to append. | 865 | *@param nLen How much data to append. |
| 868 | *@todo This function can be made much faster by not using getStr() | 866 | *@todo This function can be made much faster by not using getStr() |
| 869 | */ | 867 | */ |
| @@ -873,8 +871,8 @@ namespace Bu | |||
| 873 | } | 871 | } |
| 874 | 872 | ||
| 875 | /** | 873 | /** |
| 876 | * Append another FString to this one. | 874 | * Append another String to this one. |
| 877 | *@param sData (MyType &) The FString to append. | 875 | *@param sData (MyType &) The String to append. |
| 878 | *@param nStart Start position in sData to start copying from. | 876 | *@param nStart Start position in sData to start copying from. |
| 879 | *@param nLen How much data to append. | 877 | *@param nLen How much data to append. |
| 880 | *@todo This function can be made much faster by not using getStr() | 878 | *@todo This function can be made much faster by not using getStr() |
| @@ -887,9 +885,9 @@ namespace Bu | |||
| 887 | } | 885 | } |
| 888 | 886 | ||
| 889 | /** | 887 | /** |
| 890 | * Append data to this FString using the passed in iterator as a base. | 888 | * Append data to this String using the passed in iterator as a base. |
| 891 | * The iterator is const, it is not changed. | 889 | * The iterator is const, it is not changed. |
| 892 | *@param s Iterator from any compatible FBasicString to copy data from. | 890 | *@param s Iterator from any compatible BasicString to copy data from. |
| 893 | */ | 891 | */ |
| 894 | void append( const const_iterator &s ) | 892 | void append( const const_iterator &s ) |
| 895 | { | 893 | { |
| @@ -898,7 +896,7 @@ namespace Bu | |||
| 898 | Chunk *pSrc = s.pChunk; | 896 | Chunk *pSrc = s.pChunk; |
| 899 | 897 | ||
| 900 | Chunk *pNew = core->newChunk( pSrc->nLength-s.iPos ); | 898 | Chunk *pNew = core->newChunk( pSrc->nLength-s.iPos ); |
| 901 | cpy( pNew->pData, pSrc->pData+s.iPos, pSrc->nLength-s.iPos ); | 899 | memcpy( pNew->pData, pSrc->pData+s.iPos, pSrc->nLength-s.iPos ); |
| 902 | 900 | ||
| 903 | _hardCopy(); | 901 | _hardCopy(); |
| 904 | core->appendChunk( pNew ); | 902 | core->appendChunk( pNew ); |
| @@ -910,9 +908,9 @@ namespace Bu | |||
| 910 | } | 908 | } |
| 911 | 909 | ||
| 912 | /** | 910 | /** |
| 913 | * Append data to this FString using the passed in iterator as a base. | 911 | * Append data to this String using the passed in iterator as a base. |
| 914 | * The iterator is const, it is not changed. | 912 | * The iterator is const, it is not changed. |
| 915 | *@param s Iterator from any compatible FBasicString to copy data from. | 913 | *@param s Iterator from any compatible BasicString to copy data from. |
| 916 | */ | 914 | */ |
| 917 | void append( const iterator &s ) // I get complaints without this one | 915 | void append( const iterator &s ) // I get complaints without this one |
| 918 | { | 916 | { |
| @@ -920,11 +918,11 @@ namespace Bu | |||
| 920 | } | 918 | } |
| 921 | 919 | ||
| 922 | /** | 920 | /** |
| 923 | * Append data to this FString using the passed in iterator as a base, | 921 | * Append data to this String using the passed in iterator as a base, |
| 924 | * and copy data until the ending iterator is reached. The character | 922 | * and copy data until the ending iterator is reached. The character |
| 925 | * at the ending iterator is not copied. | 923 | * at the ending iterator is not copied. |
| 926 | * The iterators are const, they are not changed. | 924 | * The iterators are const, they are not changed. |
| 927 | *@param s Iterator from any compatible FBasicString to copy data from. | 925 | *@param s Iterator from any compatible BasicString to copy data from. |
| 928 | *@param e Iterator to stop copying at. | 926 | *@param e Iterator to stop copying at. |
| 929 | */ | 927 | */ |
| 930 | void append( const const_iterator &s, const const_iterator &e ) | 928 | void append( const const_iterator &s, const const_iterator &e ) |
| @@ -941,7 +939,7 @@ namespace Bu | |||
| 941 | { | 939 | { |
| 942 | // Simple case, they're the same chunk | 940 | // Simple case, they're the same chunk |
| 943 | Chunk *pNew = core->newChunk( e.iPos-s.iPos ); | 941 | Chunk *pNew = core->newChunk( e.iPos-s.iPos ); |
| 944 | cpy( pNew->pData, s.pChunk->pData+s.iPos, e.iPos-s.iPos ); | 942 | memcpy( pNew->pData, s.pChunk->pData+s.iPos, e.iPos-s.iPos ); |
| 945 | core->appendChunk( pNew ); | 943 | core->appendChunk( pNew ); |
| 946 | } | 944 | } |
| 947 | else | 945 | else |
| @@ -949,7 +947,7 @@ namespace Bu | |||
| 949 | // A little trickier, scan the blocks... | 947 | // A little trickier, scan the blocks... |
| 950 | Chunk *pSrc = s.pChunk; | 948 | Chunk *pSrc = s.pChunk; |
| 951 | Chunk *pNew = core->newChunk( pSrc->nLength-s.iPos ); | 949 | Chunk *pNew = core->newChunk( pSrc->nLength-s.iPos ); |
| 952 | cpy( pNew->pData, pSrc->pData+s.iPos, pSrc->nLength-s.iPos ); | 950 | memcpy( pNew->pData, pSrc->pData+s.iPos, pSrc->nLength-s.iPos ); |
| 953 | core->appendChunk( pNew ); | 951 | core->appendChunk( pNew ); |
| 954 | 952 | ||
| 955 | while( (pSrc = pSrc->pNext) != e.pChunk ) | 953 | while( (pSrc = pSrc->pNext) != e.pChunk ) |
| @@ -958,14 +956,14 @@ namespace Bu | |||
| 958 | } | 956 | } |
| 959 | 957 | ||
| 960 | pNew = core->newChunk( e.iPos ); | 958 | pNew = core->newChunk( e.iPos ); |
| 961 | cpy( pNew->pData, pSrc->pData, e.iPos ); | 959 | memcpy( pNew->pData, pSrc->pData, e.iPos ); |
| 962 | core->appendChunk( pNew ); | 960 | core->appendChunk( pNew ); |
| 963 | } | 961 | } |
| 964 | } | 962 | } |
| 965 | 963 | ||
| 966 | /** | 964 | /** |
| 967 | * Prepend another FString to this one. | 965 | * Prepend another String to this one. |
| 968 | *@param sData (MyType &) The FString to prepend. | 966 | *@param sData (MyType &) The String to prepend. |
| 969 | *@todo This function can be made much faster by not using getStr() | 967 | *@todo This function can be made much faster by not using getStr() |
| 970 | */ | 968 | */ |
| 971 | void prepend( const MyType & sData ) | 969 | void prepend( const MyType & sData ) |
| @@ -987,7 +985,7 @@ namespace Bu | |||
| 987 | for( nLen = 0; pData[nLen] != (chr)0; nLen++ ) { } | 985 | for( nLen = 0; pData[nLen] != (chr)0; nLen++ ) { } |
| 988 | 986 | ||
| 989 | Chunk *pNew = core->newChunk( nLen ); | 987 | Chunk *pNew = core->newChunk( nLen ); |
| 990 | cpy( pNew->pData, pData, nLen ); | 988 | memcpy( pNew->pData, pData, nLen ); |
| 991 | 989 | ||
| 992 | core->prependChunk( pNew ); | 990 | core->prependChunk( pNew ); |
| 993 | } | 991 | } |
| @@ -1001,7 +999,7 @@ namespace Bu | |||
| 1001 | { | 999 | { |
| 1002 | Chunk *pNew = core->newChunk( nLen ); | 1000 | Chunk *pNew = core->newChunk( nLen ); |
| 1003 | 1001 | ||
| 1004 | cpy( pNew->pData, pData, nLen ); | 1002 | memcpy( pNew->pData, pData, nLen ); |
| 1005 | 1003 | ||
| 1006 | _hardCopy(); | 1004 | _hardCopy(); |
| 1007 | core->prependChunk( pNew ); | 1005 | core->prependChunk( pNew ); |
| @@ -1037,9 +1035,9 @@ namespace Bu | |||
| 1037 | Chunk *p1 = core->newChunk( nPos ); | 1035 | Chunk *p1 = core->newChunk( nPos ); |
| 1038 | Chunk *p2 = core->newChunk( nLen ); | 1036 | Chunk *p2 = core->newChunk( nLen ); |
| 1039 | Chunk *p3 = core->newChunk( core->nLength-nPos ); | 1037 | Chunk *p3 = core->newChunk( core->nLength-nPos ); |
| 1040 | cpy( p1->pData, core->pFirst->pData, nPos ); | 1038 | memcpy( p1->pData, core->pFirst->pData, nPos ); |
| 1041 | cpy( p2->pData, pData, nLen ); | 1039 | memcpy( p2->pData, pData, nLen ); |
| 1042 | cpy( p3->pData, core->pFirst->pData+nPos, core->nLength-nPos ); | 1040 | memcpy( p3->pData, core->pFirst->pData+nPos, core->nLength-nPos ); |
| 1043 | core->clear(); | 1041 | core->clear(); |
| 1044 | core->appendChunk( p1 ); | 1042 | core->appendChunk( p1 ); |
| 1045 | core->appendChunk( p2 ); | 1043 | core->appendChunk( p2 ); |
| @@ -1063,8 +1061,8 @@ namespace Bu | |||
| 1063 | _hardCopy(); | 1061 | _hardCopy(); |
| 1064 | Chunk *p1 = core->newChunk( nPos ); | 1062 | Chunk *p1 = core->newChunk( nPos ); |
| 1065 | Chunk *p3 = core->newChunk( core->nLength-nPos ); | 1063 | Chunk *p3 = core->newChunk( core->nLength-nPos ); |
| 1066 | cpy( p1->pData, core->pFirst->pData, nPos ); | 1064 | memcpy( p1->pData, core->pFirst->pData, nPos ); |
| 1067 | cpy( p3->pData, core->pFirst->pData+nPos, core->nLength-nPos ); | 1065 | memcpy( p3->pData, core->pFirst->pData+nPos, core->nLength-nPos ); |
| 1068 | core->clear(); | 1066 | core->clear(); |
| 1069 | core->appendChunk( p1 ); | 1067 | core->appendChunk( p1 ); |
| 1070 | for( Chunk *pChnk = str.core->pFirst; pChnk; | 1068 | for( Chunk *pChnk = str.core->pFirst; pChnk; |
| @@ -1148,7 +1146,7 @@ namespace Bu | |||
| 1148 | long nNewLen = (nNewSize<core->nLength)?(nNewSize):(core->nLength); | 1146 | long nNewLen = (nNewSize<core->nLength)?(nNewSize):(core->nLength); |
| 1149 | if( core->nLength > 0 ) | 1147 | if( core->nLength > 0 ) |
| 1150 | { | 1148 | { |
| 1151 | cpy( pNew->pData, core->pFirst->pData, nNewLen ); | 1149 | memcpy( pNew->pData, core->pFirst->pData, nNewLen ); |
| 1152 | core->aChr.deallocate( core->pFirst->pData, core->pFirst->nLength+1 ); | 1150 | core->aChr.deallocate( core->pFirst->pData, core->pFirst->nLength+1 ); |
| 1153 | core->aChunk.deallocate( core->pFirst, 1 ); | 1151 | core->aChunk.deallocate( core->pFirst, 1 ); |
| 1154 | } | 1152 | } |
| @@ -1282,8 +1280,8 @@ namespace Bu | |||
| 1282 | } | 1280 | } |
| 1283 | 1281 | ||
| 1284 | /** | 1282 | /** |
| 1285 | * Plus equals operator for FString. | 1283 | * Plus equals operator for String. |
| 1286 | *@param pData (const chr *) The data to append to your FString. | 1284 | *@param pData (const chr *) The data to append to your String. |
| 1287 | */ | 1285 | */ |
| 1288 | MyType &operator+=( const chr *pData ) | 1286 | MyType &operator+=( const chr *pData ) |
| 1289 | { | 1287 | { |
| @@ -1293,8 +1291,8 @@ namespace Bu | |||
| 1293 | } | 1291 | } |
| 1294 | 1292 | ||
| 1295 | /** | 1293 | /** |
| 1296 | * Plus equals operator for FString. | 1294 | * Plus equals operator for String. |
| 1297 | *@param rSrc (const MyType &) The FString to append to your FString. | 1295 | *@param rSrc (const MyType &) The String to append to your String. |
| 1298 | */ | 1296 | */ |
| 1299 | MyType &operator+=( const MyType &rSrc ) | 1297 | MyType &operator+=( const MyType &rSrc ) |
| 1300 | { | 1298 | { |
| @@ -1311,8 +1309,8 @@ namespace Bu | |||
| 1311 | } | 1309 | } |
| 1312 | 1310 | ||
| 1313 | /** | 1311 | /** |
| 1314 | * Plus equals operator for FString. | 1312 | * Plus equals operator for String. |
| 1315 | *@param cData (const chr) The character to append to your FString. | 1313 | *@param cData (const chr) The character to append to your String. |
| 1316 | */ | 1314 | */ |
| 1317 | MyType &operator+=( const chr cData ) | 1315 | MyType &operator+=( const chr cData ) |
| 1318 | { | 1316 | { |
| @@ -1335,7 +1333,7 @@ namespace Bu | |||
| 1335 | /** | 1333 | /** |
| 1336 | * Assignment operator. | 1334 | * Assignment operator. |
| 1337 | *@param pData (const chr *) The character array to append to your | 1335 | *@param pData (const chr *) The character array to append to your |
| 1338 | * FString. | 1336 | * String. |
| 1339 | */ | 1337 | */ |
| 1340 | MyType &operator=( const chr *pData ) | 1338 | MyType &operator=( const chr *pData ) |
| 1341 | { | 1339 | { |
| @@ -1366,8 +1364,8 @@ namespace Bu | |||
| 1366 | } | 1364 | } |
| 1367 | 1365 | ||
| 1368 | /** | 1366 | /** |
| 1369 | * Reset your FString to this character array. | 1367 | * Reset your String to this character array. |
| 1370 | *@param pData (const chr *) The character array to set your FString to. | 1368 | *@param pData (const chr *) The character array to set your String to. |
| 1371 | */ | 1369 | */ |
| 1372 | void set( const chr *pData ) | 1370 | void set( const chr *pData ) |
| 1373 | { | 1371 | { |
| @@ -1376,8 +1374,8 @@ namespace Bu | |||
| 1376 | } | 1374 | } |
| 1377 | 1375 | ||
| 1378 | /** | 1376 | /** |
| 1379 | * Reset your FString to this character array. | 1377 | * Reset your String to this character array. |
| 1380 | *@param pData (const chr *) The character array to set your FString to. | 1378 | *@param pData (const chr *) The character array to set your String to. |
| 1381 | *@param nSize (long) The length of the inputted character array. | 1379 | *@param nSize (long) The length of the inputted character array. |
| 1382 | */ | 1380 | */ |
| 1383 | void set( const chr *pData, long nSize ) | 1381 | void set( const chr *pData, long nSize ) |
| @@ -1467,7 +1465,7 @@ namespace Bu | |||
| 1467 | 1465 | ||
| 1468 | /** | 1466 | /** |
| 1469 | * Assignment operator. | 1467 | * Assignment operator. |
| 1470 | *@param rSrc (const MyType &) The FString to set your FString to. | 1468 | *@param rSrc (const MyType &) The String to set your String to. |
| 1471 | */ | 1469 | */ |
| 1472 | /* MyType &operator=( const MyType &rSrc ) | 1470 | /* MyType &operator=( const MyType &rSrc ) |
| 1473 | { | 1471 | { |
| @@ -1478,7 +1476,7 @@ namespace Bu | |||
| 1478 | 1476 | ||
| 1479 | /** | 1477 | /** |
| 1480 | * Equals comparison operator. | 1478 | * Equals comparison operator. |
| 1481 | *@param pData (const chr *) The character array to compare your FString | 1479 | *@param pData (const chr *) The character array to compare your String |
| 1482 | * to. | 1480 | * to. |
| 1483 | */ | 1481 | */ |
| 1484 | bool operator==( const chr *pData ) const | 1482 | bool operator==( const chr *pData ) const |
| @@ -1508,7 +1506,7 @@ namespace Bu | |||
| 1508 | 1506 | ||
| 1509 | /** | 1507 | /** |
| 1510 | * Equals comparison operator. | 1508 | * Equals comparison operator. |
| 1511 | *@param pData (const MyType &) The FString to compare your FString to. | 1509 | *@param pData (const MyType &) The String to compare your String to. |
| 1512 | */ | 1510 | */ |
| 1513 | bool operator==( const MyType &pData ) const | 1511 | bool operator==( const MyType &pData ) const |
| 1514 | { | 1512 | { |
| @@ -1538,7 +1536,7 @@ namespace Bu | |||
| 1538 | 1536 | ||
| 1539 | /** | 1537 | /** |
| 1540 | * Not equals comparison operator. | 1538 | * Not equals comparison operator. |
| 1541 | *@param pData (const chr *) The character array to compare your FString | 1539 | *@param pData (const chr *) The character array to compare your String |
| 1542 | * to. | 1540 | * to. |
| 1543 | */ | 1541 | */ |
| 1544 | bool operator!=(const chr *pData ) const | 1542 | bool operator!=(const chr *pData ) const |
| @@ -1548,7 +1546,7 @@ namespace Bu | |||
| 1548 | 1546 | ||
| 1549 | /** | 1547 | /** |
| 1550 | * Not equals comparison operator. | 1548 | * Not equals comparison operator. |
| 1551 | *@param pData (const MyType &) The FString to compare your FString to. | 1549 | *@param pData (const MyType &) The String to compare your String to. |
| 1552 | */ | 1550 | */ |
| 1553 | bool operator!=(const MyType &pData ) const | 1551 | bool operator!=(const MyType &pData ) const |
| 1554 | { | 1552 | { |
| @@ -1939,7 +1937,7 @@ namespace Bu | |||
| 1939 | long nNewLen = core->nLength - nAmnt; | 1937 | long nNewLen = core->nLength - nAmnt; |
| 1940 | flatten(); | 1938 | flatten(); |
| 1941 | Chunk *pNew = core->newChunk( nNewLen ); | 1939 | Chunk *pNew = core->newChunk( nNewLen ); |
| 1942 | cpy( pNew->pData, core->pFirst->pData+nAmnt, nNewLen ); | 1940 | memcpy( pNew->pData, core->pFirst->pData+nAmnt, nNewLen ); |
| 1943 | _hardCopy(); | 1941 | _hardCopy(); |
| 1944 | core->clear(); | 1942 | core->clear(); |
| 1945 | core->appendChunk( pNew ); | 1943 | core->appendChunk( pNew ); |
| @@ -2051,7 +2049,7 @@ namespace Bu | |||
| 2051 | Chunk *i = core->pFirst; | 2049 | Chunk *i = core->pFirst; |
| 2052 | for(;;) | 2050 | for(;;) |
| 2053 | { | 2051 | { |
| 2054 | cpy( pos, i->pData, i->nLength ); | 2052 | memcpy( pos, i->pData, i->nLength ); |
| 2055 | pos += i->nLength; | 2053 | pos += i->nLength; |
| 2056 | i = i->pNext; | 2054 | i = i->pNext; |
| 2057 | if( i == NULL ) | 2055 | if( i == NULL ) |
| @@ -2069,15 +2067,15 @@ namespace Bu | |||
| 2069 | } | 2067 | } |
| 2070 | }; | 2068 | }; |
| 2071 | 2069 | ||
| 2072 | template<class T> FBasicString<T> operator+( const T *pLeft, const FBasicString<T> &rRight ) | 2070 | template<class T> BasicString<T> operator+( const T *pLeft, const BasicString<T> &rRight ) |
| 2073 | { | 2071 | { |
| 2074 | Bu::FBasicString<T> ret( pLeft ); | 2072 | Bu::BasicString<T> ret( pLeft ); |
| 2075 | ret.append( rRight ); | 2073 | ret.append( rRight ); |
| 2076 | return ret; | 2074 | return ret; |
| 2077 | } | 2075 | } |
| 2078 | 2076 | ||
| 2079 | template<class chr, int b, class c, class d> | 2077 | template<class chr, int b, class c, class d> |
| 2080 | ArchiveBase &operator<<( ArchiveBase &ar, const FBasicString<chr, b, c, d> &s ) | 2078 | ArchiveBase &operator<<( ArchiveBase &ar, const BasicString<chr, b, c, d> &s ) |
| 2081 | { | 2079 | { |
| 2082 | long n = s.getSize(); | 2080 | long n = s.getSize(); |
| 2083 | ar << n; | 2081 | ar << n; |
| @@ -2086,7 +2084,7 @@ namespace Bu | |||
| 2086 | } | 2084 | } |
| 2087 | 2085 | ||
| 2088 | template<class chr, int b, class c, class d> | 2086 | template<class chr, int b, class c, class d> |
| 2089 | ArchiveBase &operator>>( ArchiveBase &ar, FBasicString<chr, b, c, d> &s ) | 2087 | ArchiveBase &operator>>( ArchiveBase &ar, BasicString<chr, b, c, d> &s ) |
| 2090 | { | 2088 | { |
| 2091 | long n; | 2089 | long n; |
| 2092 | ar >> n; | 2090 | ar >> n; |
| @@ -2094,8 +2092,38 @@ namespace Bu | |||
| 2094 | ar.read( s.getStr(), n ); | 2092 | ar.read( s.getStr(), n ); |
| 2095 | return ar; | 2093 | return ar; |
| 2096 | } | 2094 | } |
| 2097 | } | ||
| 2098 | 2095 | ||
| 2099 | #undef cpy | 2096 | typedef BasicString<char> String; |
| 2097 | |||
| 2098 | template<typename T> | ||
| 2099 | uint32_t __calcHashCode( const T &k ); | ||
| 2100 | |||
| 2101 | template<typename T> | ||
| 2102 | bool __cmpHashKeys( const T &a, const T &b ); | ||
| 2103 | |||
| 2104 | template<> uint32_t __calcHashCode<String>( const String &k ); | ||
| 2105 | template<> bool __cmpHashKeys<String>( | ||
| 2106 | const String &a, const String &b ); | ||
| 2107 | |||
| 2108 | template<typename t> void __tracer_format( const t &v ); | ||
| 2109 | template<> void __tracer_format<String>( const String &v ); | ||
| 2110 | |||
| 2111 | bool &operator<<( bool &dst, const String &sIn ); | ||
| 2112 | uint8_t &operator<<( uint8_t &dst, const String &sIn ); | ||
| 2113 | int8_t &operator<<( int8_t &dst, const String &sIn ); | ||
| 2114 | char &operator<<( char &dst, const String &sIn ); | ||
| 2115 | uint16_t &operator<<( uint16_t &dst, const String &sIn ); | ||
| 2116 | int16_t &operator<<( int16_t &dst, const String &sIn ); | ||
| 2117 | uint32_t &operator<<( uint32_t &dst, const String &sIn ); | ||
| 2118 | int32_t &operator<<( int32_t &dst, const String &sIn ); | ||
| 2119 | uint64_t &operator<<( uint64_t &dst, const String &sIn ); | ||
| 2120 | int64_t &operator<<( int64_t &dst, const String &sIn ); | ||
| 2121 | float &operator<<( float &dst, const String &sIn ); | ||
| 2122 | double &operator<<( double &dst, const String &sIn ); | ||
| 2123 | long double &operator<<( long double &dst, const String &sIn ); | ||
| 2124 | Bu::String &operator<<( Bu::String &dst, const String &sIn ); | ||
| 2125 | |||
| 2126 | typedef Bu::List<String> StringList; | ||
| 2127 | }; | ||
| 2100 | 2128 | ||
| 2101 | #endif | 2129 | #endif |
diff --git a/src/tafcomment.cpp b/src/tafcomment.cpp index 77b7ee4..2f0dc17 100644 --- a/src/tafcomment.cpp +++ b/src/tafcomment.cpp | |||
| @@ -14,7 +14,7 @@ Bu::TafComment::TafComment( const Bu::TafComment &rSrc ) : | |||
| 14 | { | 14 | { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | Bu::TafComment::TafComment( const Bu::FString &sText, bool bEOL ) : | 17 | Bu::TafComment::TafComment( const Bu::String &sText, bool bEOL ) : |
| 18 | TafNode( typeComment ), | 18 | TafNode( typeComment ), |
| 19 | sText( sText ), | 19 | sText( sText ), |
| 20 | bEOL( bEOL ) | 20 | bEOL( bEOL ) |
| @@ -25,7 +25,7 @@ Bu::TafComment::~TafComment() | |||
| 25 | { | 25 | { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | const Bu::FString &Bu::TafComment::getText() const | 28 | const Bu::String &Bu::TafComment::getText() const |
| 29 | { | 29 | { |
| 30 | return sText; | 30 | return sText; |
| 31 | } | 31 | } |
diff --git a/src/tafcomment.h b/src/tafcomment.h index 5b51f99..942beb3 100644 --- a/src/tafcomment.h +++ b/src/tafcomment.h | |||
| @@ -21,14 +21,14 @@ namespace Bu | |||
| 21 | { | 21 | { |
| 22 | public: | 22 | public: |
| 23 | TafComment( const Bu::TafComment &rSrc ); | 23 | TafComment( const Bu::TafComment &rSrc ); |
| 24 | TafComment( const Bu::FString &sText, bool bEOL=false ); | 24 | TafComment( const Bu::String &sText, bool bEOL=false ); |
| 25 | virtual ~TafComment(); | 25 | virtual ~TafComment(); |
| 26 | 26 | ||
| 27 | const Bu::FString &getText() const; | 27 | const Bu::String &getText() const; |
| 28 | bool isEOLStyle() const; | 28 | bool isEOLStyle() const; |
| 29 | 29 | ||
| 30 | private: | 30 | private: |
| 31 | Bu::FString sText; | 31 | Bu::String sText; |
| 32 | bool bEOL; | 32 | bool bEOL; |
| 33 | }; | 33 | }; |
| 34 | } | 34 | } |
diff --git a/src/tafgroup.cpp b/src/tafgroup.cpp index c3f5b1e..42f4610 100644 --- a/src/tafgroup.cpp +++ b/src/tafgroup.cpp | |||
| @@ -32,7 +32,7 @@ Bu::TafGroup::TafGroup( const TafGroup &rSrc ) : | |||
| 32 | } | 32 | } |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | Bu::TafGroup::TafGroup( const Bu::FString &sName ) : | 35 | Bu::TafGroup::TafGroup( const Bu::String &sName ) : |
| 36 | TafNode( typeGroup ), | 36 | TafNode( typeGroup ), |
| 37 | sName( sName ) | 37 | sName( sName ) |
| 38 | { | 38 | { |
| @@ -46,12 +46,12 @@ Bu::TafGroup::~TafGroup() | |||
| 46 | } | 46 | } |
| 47 | } | 47 | } |
| 48 | 48 | ||
| 49 | const Bu::FString &Bu::TafGroup::getName() const | 49 | const Bu::String &Bu::TafGroup::getName() const |
| 50 | { | 50 | { |
| 51 | return sName; | 51 | return sName; |
| 52 | } | 52 | } |
| 53 | 53 | ||
| 54 | void Bu::TafGroup::setName( const Bu::FString &sName ) | 54 | void Bu::TafGroup::setName( const Bu::String &sName ) |
| 55 | { | 55 | { |
| 56 | this->sName = sName; | 56 | this->sName = sName; |
| 57 | } | 57 | } |
| @@ -102,23 +102,23 @@ Bu::TafComment *Bu::TafGroup::addChild( TafComment *pNode ) | |||
| 102 | return pNode; | 102 | return pNode; |
| 103 | } | 103 | } |
| 104 | 104 | ||
| 105 | Bu::TafGroup *Bu::TafGroup::addGroup( const Bu::FString &sName ) | 105 | Bu::TafGroup *Bu::TafGroup::addGroup( const Bu::String &sName ) |
| 106 | { | 106 | { |
| 107 | return addChild( new TafGroup( sName ) ); | 107 | return addChild( new TafGroup( sName ) ); |
| 108 | } | 108 | } |
| 109 | 109 | ||
| 110 | Bu::TafProperty *Bu::TafGroup::addProperty( | 110 | Bu::TafProperty *Bu::TafGroup::addProperty( |
| 111 | const Bu::FString &sName, const Bu::FString &sValue ) | 111 | const Bu::String &sName, const Bu::String &sValue ) |
| 112 | { | 112 | { |
| 113 | return addChild( new TafProperty( sName, sValue ) ); | 113 | return addChild( new TafProperty( sName, sValue ) ); |
| 114 | } | 114 | } |
| 115 | 115 | ||
| 116 | bool Bu::TafGroup::hasChild( const Bu::FString &sName ) const | 116 | bool Bu::TafGroup::hasChild( const Bu::String &sName ) const |
| 117 | { | 117 | { |
| 118 | return hChildren.has( sName ); | 118 | return hChildren.has( sName ); |
| 119 | } | 119 | } |
| 120 | 120 | ||
| 121 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::FString &sName ) const | 121 | const Bu::TafGroup::GroupList &Bu::TafGroup::getChildren( const Bu::String &sName ) const |
| 122 | { | 122 | { |
| 123 | try { | 123 | try { |
| 124 | return hChildren.get( sName ); | 124 | return hChildren.get( sName ); |
| @@ -134,7 +134,7 @@ const Bu::TafGroup::NodeList &Bu::TafGroup::getChildren() const | |||
| 134 | return lChildren; | 134 | return lChildren; |
| 135 | } | 135 | } |
| 136 | 136 | ||
| 137 | const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const | 137 | const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::String &sName ) const |
| 138 | { | 138 | { |
| 139 | try { | 139 | try { |
| 140 | return hChildren.get( sName ).first(); | 140 | return hChildren.get( sName ).first(); |
| @@ -145,12 +145,12 @@ const Bu::TafGroup *Bu::TafGroup::getChild( const Bu::FString &sName ) const | |||
| 145 | } | 145 | } |
| 146 | } | 146 | } |
| 147 | 147 | ||
| 148 | bool Bu::TafGroup::hasProperty( const Bu::FString &sName ) const | 148 | bool Bu::TafGroup::hasProperty( const Bu::String &sName ) const |
| 149 | { | 149 | { |
| 150 | return hProp.has( sName ); | 150 | return hProp.has( sName ); |
| 151 | } | 151 | } |
| 152 | 152 | ||
| 153 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sName ) const | 153 | const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::String &sName ) const |
| 154 | { | 154 | { |
| 155 | try { | 155 | try { |
| 156 | return hProp.get( sName ); | 156 | return hProp.get( sName ); |
| @@ -161,7 +161,7 @@ const Bu::TafGroup::PropList &Bu::TafGroup::getProperties( const Bu::FString &sN | |||
| 161 | } | 161 | } |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const | 164 | const Bu::String &Bu::TafGroup::getProperty( const Bu::String &sName ) const |
| 165 | { | 165 | { |
| 166 | try { | 166 | try { |
| 167 | return hProp.get( sName ).first(); | 167 | return hProp.get( sName ).first(); |
| @@ -172,8 +172,8 @@ const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName ) const | |||
| 172 | } | 172 | } |
| 173 | } | 173 | } |
| 174 | 174 | ||
| 175 | const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, | 175 | const Bu::String &Bu::TafGroup::getProperty( const Bu::String &sName, |
| 176 | const Bu::FString &sDef ) const | 176 | const Bu::String &sDef ) const |
| 177 | { | 177 | { |
| 178 | try | 178 | try |
| 179 | { | 179 | { |
| @@ -186,7 +186,7 @@ const Bu::FString &Bu::TafGroup::getProperty( const Bu::FString &sName, | |||
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | const Bu::TafGroup *Bu::TafGroup::getChildByPath( | 188 | const Bu::TafGroup *Bu::TafGroup::getChildByPath( |
| 189 | const Bu::FString &sPath ) const | 189 | const Bu::String &sPath ) const |
| 190 | { | 190 | { |
| 191 | return getChildByPath( sPath.split('/') ); | 191 | return getChildByPath( sPath.split('/') ); |
| 192 | } | 192 | } |
| @@ -203,12 +203,12 @@ const Bu::TafGroup *Bu::TafGroup::getChildByPath( Bu::StrList lPath ) const | |||
| 203 | return cur; | 203 | return cur; |
| 204 | } | 204 | } |
| 205 | 205 | ||
| 206 | const Bu::FString &Bu::TafGroup::getByPath( const Bu::FString &sPath ) const | 206 | const Bu::String &Bu::TafGroup::getByPath( const Bu::String &sPath ) const |
| 207 | { | 207 | { |
| 208 | return getByPath( sPath.split('/') ); | 208 | return getByPath( sPath.split('/') ); |
| 209 | } | 209 | } |
| 210 | 210 | ||
| 211 | const Bu::FString &Bu::TafGroup::getByPath( Bu::StrList lPath ) const | 211 | const Bu::String &Bu::TafGroup::getByPath( Bu::StrList lPath ) const |
| 212 | { | 212 | { |
| 213 | const Bu::TafGroup *cur = this; | 213 | const Bu::TafGroup *cur = this; |
| 214 | 214 | ||
diff --git a/src/tafgroup.h b/src/tafgroup.h index ed70e8c..096a32f 100644 --- a/src/tafgroup.h +++ b/src/tafgroup.h | |||
| @@ -10,13 +10,13 @@ | |||
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include "bu/tafnode.h" | 12 | #include "bu/tafnode.h" |
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | #include "bu/hash.h" | 14 | #include "bu/hash.h" |
| 15 | #include "bu/list.h" | 15 | #include "bu/list.h" |
| 16 | 16 | ||
| 17 | namespace Bu | 17 | namespace Bu |
| 18 | { | 18 | { |
| 19 | typedef Bu::List<Bu::FString> StrList; | 19 | typedef Bu::List<Bu::String> StrList; |
| 20 | class TafProperty; | 20 | class TafProperty; |
| 21 | class TafComment; | 21 | class TafComment; |
| 22 | /** | 22 | /** |
| @@ -26,42 +26,42 @@ namespace Bu | |||
| 26 | class TafGroup : public TafNode | 26 | class TafGroup : public TafNode |
| 27 | { | 27 | { |
| 28 | public: | 28 | public: |
| 29 | typedef Bu::List<Bu::FString> PropList; | 29 | typedef Bu::List<Bu::String> PropList; |
| 30 | typedef Bu::Hash<Bu::FString, PropList> PropHash; | 30 | typedef Bu::Hash<Bu::String, PropList> PropHash; |
| 31 | typedef Bu::List<class Bu::TafGroup *> GroupList; | 31 | typedef Bu::List<class Bu::TafGroup *> GroupList; |
| 32 | typedef Bu::Hash<Bu::FString, GroupList> GroupHash; | 32 | typedef Bu::Hash<Bu::String, GroupList> GroupHash; |
| 33 | typedef Bu::List<class Bu::TafNode *> NodeList; | 33 | typedef Bu::List<class Bu::TafNode *> NodeList; |
| 34 | 34 | ||
| 35 | TafGroup( const TafGroup &rSrc ); | 35 | TafGroup( const TafGroup &rSrc ); |
| 36 | TafGroup( const Bu::FString &sName ); | 36 | TafGroup( const Bu::String &sName ); |
| 37 | virtual ~TafGroup(); | 37 | virtual ~TafGroup(); |
| 38 | 38 | ||
| 39 | const Bu::FString &getName() const; | 39 | const Bu::String &getName() const; |
| 40 | void setName( const Bu::FString &sName ); | 40 | void setName( const Bu::String &sName ); |
| 41 | 41 | ||
| 42 | bool hasProperty( const Bu::FString &sName ) const; | 42 | bool hasProperty( const Bu::String &sName ) const; |
| 43 | const Bu::FString &getProperty( const Bu::FString &sName ) const; | 43 | const Bu::String &getProperty( const Bu::String &sName ) const; |
| 44 | const Bu::FString &getProperty( const Bu::FString &sName, | 44 | const Bu::String &getProperty( const Bu::String &sName, |
| 45 | const Bu::FString &sDef ) const; | 45 | const Bu::String &sDef ) const; |
| 46 | const PropList &getProperties( const Bu::FString &sName ) const; | 46 | const PropList &getProperties( const Bu::String &sName ) const; |
| 47 | bool hasChild( const Bu::FString &sName ) const; | 47 | bool hasChild( const Bu::String &sName ) const; |
| 48 | const TafGroup *getChild( const Bu::FString &sName ) const; | 48 | const TafGroup *getChild( const Bu::String &sName ) const; |
| 49 | const GroupList &getChildren( const Bu::FString &sName ) const; | 49 | const GroupList &getChildren( const Bu::String &sName ) const; |
| 50 | TafNode *addChild( TafNode *pNode ); | 50 | TafNode *addChild( TafNode *pNode ); |
| 51 | TafGroup *addChild( TafGroup *pNode ); | 51 | TafGroup *addChild( TafGroup *pNode ); |
| 52 | TafProperty *addChild( TafProperty *pNode ); | 52 | TafProperty *addChild( TafProperty *pNode ); |
| 53 | TafComment *addChild( TafComment *pNode ); | 53 | TafComment *addChild( TafComment *pNode ); |
| 54 | TafGroup *addGroup( const Bu::FString &sName ); | 54 | TafGroup *addGroup( const Bu::String &sName ); |
| 55 | TafProperty *addProperty( | 55 | TafProperty *addProperty( |
| 56 | const Bu::FString &sName, const Bu::FString &sValue ); | 56 | const Bu::String &sName, const Bu::String &sValue ); |
| 57 | const NodeList &getChildren() const; | 57 | const NodeList &getChildren() const; |
| 58 | const TafGroup *getChildByPath( const Bu::FString &sPath ) const; | 58 | const TafGroup *getChildByPath( const Bu::String &sPath ) const; |
| 59 | const TafGroup *getChildByPath( StrList lPath ) const; | 59 | const TafGroup *getChildByPath( StrList lPath ) const; |
| 60 | const Bu::FString &getByPath( const Bu::FString &sPath ) const; | 60 | const Bu::String &getByPath( const Bu::String &sPath ) const; |
| 61 | const Bu::FString &getByPath( StrList lPath ) const; | 61 | const Bu::String &getByPath( StrList lPath ) const; |
| 62 | 62 | ||
| 63 | private: | 63 | private: |
| 64 | Bu::FString sName; | 64 | Bu::String sName; |
| 65 | PropHash hProp; | 65 | PropHash hProp; |
| 66 | GroupHash hChildren; | 66 | GroupHash hChildren; |
| 67 | NodeList lChildren; | 67 | NodeList lChildren; |
diff --git a/src/tafnode.h b/src/tafnode.h index a535f65..6c7123d 100644 --- a/src/tafnode.h +++ b/src/tafnode.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_TAF_NODE_H | 9 | #define BU_TAF_NODE_H |
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | #include "bu/hash.h" | 13 | #include "bu/hash.h" |
| 14 | #include "bu/exceptionbase.h" | 14 | #include "bu/exceptionbase.h" |
| 15 | 15 | ||
diff --git a/src/tafproperty.cpp b/src/tafproperty.cpp index c847344..96f8501 100644 --- a/src/tafproperty.cpp +++ b/src/tafproperty.cpp | |||
| @@ -14,7 +14,7 @@ Bu::TafProperty::TafProperty( const Bu::TafProperty &rSrc ) : | |||
| 14 | { | 14 | { |
| 15 | } | 15 | } |
| 16 | 16 | ||
| 17 | Bu::TafProperty::TafProperty( const Bu::FString &sName, const Bu::FString &sValue ) : | 17 | Bu::TafProperty::TafProperty( const Bu::String &sName, const Bu::String &sValue ) : |
| 18 | TafNode( typeProperty ), | 18 | TafNode( typeProperty ), |
| 19 | sName( sName ), | 19 | sName( sName ), |
| 20 | sValue( sValue ) | 20 | sValue( sValue ) |
| @@ -25,12 +25,12 @@ Bu::TafProperty::~TafProperty() | |||
| 25 | { | 25 | { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | const Bu::FString &Bu::TafProperty::getName() const | 28 | const Bu::String &Bu::TafProperty::getName() const |
| 29 | { | 29 | { |
| 30 | return sName; | 30 | return sName; |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | const Bu::FString &Bu::TafProperty::getValue() const | 33 | const Bu::String &Bu::TafProperty::getValue() const |
| 34 | { | 34 | { |
| 35 | return sValue; | 35 | return sValue; |
| 36 | } | 36 | } |
diff --git a/src/tafproperty.h b/src/tafproperty.h index 62cc517..10a1c1a 100644 --- a/src/tafproperty.h +++ b/src/tafproperty.h | |||
| @@ -21,15 +21,15 @@ namespace Bu | |||
| 21 | { | 21 | { |
| 22 | public: | 22 | public: |
| 23 | TafProperty( const Bu::TafProperty &rSrc ); | 23 | TafProperty( const Bu::TafProperty &rSrc ); |
| 24 | TafProperty( const Bu::FString &sName, const Bu::FString &sValue ); | 24 | TafProperty( const Bu::String &sName, const Bu::String &sValue ); |
| 25 | virtual ~TafProperty(); | 25 | virtual ~TafProperty(); |
| 26 | 26 | ||
| 27 | const Bu::FString &getName() const; | 27 | const Bu::String &getName() const; |
| 28 | const Bu::FString &getValue() const; | 28 | const Bu::String &getValue() const; |
| 29 | 29 | ||
| 30 | private: | 30 | private: |
| 31 | Bu::FString sName; | 31 | Bu::String sName; |
| 32 | Bu::FString sValue; | 32 | Bu::String sValue; |
| 33 | }; | 33 | }; |
| 34 | } | 34 | } |
| 35 | 35 | ||
diff --git a/src/tafreader.cpp b/src/tafreader.cpp index ca06daf..f409170 100644 --- a/src/tafreader.cpp +++ b/src/tafreader.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/taf.h" | 8 | #include "bu/taf.h" |
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | #include "bu/stream.h" | 10 | #include "bu/stream.h" |
| 11 | 11 | ||
| 12 | #include <stdlib.h> | 12 | #include <stdlib.h> |
| @@ -34,7 +34,7 @@ Bu::TafGroup *Bu::TafReader::readGroup() | |||
| 34 | throw TafException("%d:%d: Expected '{' got '%c'.", iLine, iCol, c ); | 34 | throw TafException("%d:%d: Expected '{' got '%c'.", iLine, iCol, c ); |
| 35 | next(); | 35 | next(); |
| 36 | ws(); | 36 | ws(); |
| 37 | FString sName = readStr(); | 37 | String sName = readStr(); |
| 38 | TafGroup *pGroup = new TafGroup( sName ); | 38 | TafGroup *pGroup = new TafGroup( sName ); |
| 39 | try | 39 | try |
| 40 | { | 40 | { |
| @@ -88,7 +88,7 @@ void Bu::TafReader::groupContent( Bu::TafGroup *pGroup ) | |||
| 88 | 88 | ||
| 89 | Bu::TafProperty *Bu::TafReader::readProperty() | 89 | Bu::TafProperty *Bu::TafReader::readProperty() |
| 90 | { | 90 | { |
| 91 | FString sName = readStr(); | 91 | String sName = readStr(); |
| 92 | ws(); | 92 | ws(); |
| 93 | if( c != '=' ) | 93 | if( c != '=' ) |
| 94 | { | 94 | { |
| @@ -96,14 +96,14 @@ Bu::TafProperty *Bu::TafReader::readProperty() | |||
| 96 | return new Bu::TafProperty( "", sName ); | 96 | return new Bu::TafProperty( "", sName ); |
| 97 | } | 97 | } |
| 98 | next(); | 98 | next(); |
| 99 | FString sValue = readStr(); | 99 | String sValue = readStr(); |
| 100 | return new Bu::TafProperty( sName, sValue ); | 100 | return new Bu::TafProperty( sName, sValue ); |
| 101 | //printf(" %s = %s\n", sName.getStr(), sValue.getStr() ); | 101 | //printf(" %s = %s\n", sName.getStr(), sValue.getStr() ); |
| 102 | } | 102 | } |
| 103 | 103 | ||
| 104 | Bu::TafComment *Bu::TafReader::readComment( bool bEOL ) | 104 | Bu::TafComment *Bu::TafReader::readComment( bool bEOL ) |
| 105 | { | 105 | { |
| 106 | FString sCmnt; | 106 | String sCmnt; |
| 107 | next(); | 107 | next(); |
| 108 | if( bEOL ) | 108 | if( bEOL ) |
| 109 | { | 109 | { |
| @@ -140,10 +140,10 @@ Bu::TafComment *Bu::TafReader::readComment( bool bEOL ) | |||
| 140 | return new TafComment( sCmnt, bEOL ); | 140 | return new TafComment( sCmnt, bEOL ); |
| 141 | } | 141 | } |
| 142 | 142 | ||
| 143 | Bu::FString Bu::TafReader::readStr() | 143 | Bu::String Bu::TafReader::readStr() |
| 144 | { | 144 | { |
| 145 | ws(); | 145 | ws(); |
| 146 | FString s; | 146 | String s; |
| 147 | if( c == '"' ) | 147 | if( c == '"' ) |
| 148 | { | 148 | { |
| 149 | next(); | 149 | next(); |
diff --git a/src/tafreader.h b/src/tafreader.h index d60f4d2..c91d1b1 100644 --- a/src/tafreader.h +++ b/src/tafreader.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_TAF_READER_H | 9 | #define BU_TAF_READER_H |
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| 15 | { | 15 | { |
| @@ -38,7 +38,7 @@ namespace Bu | |||
| 38 | void ws(); | 38 | void ws(); |
| 39 | bool isws(); | 39 | bool isws(); |
| 40 | void next(); | 40 | void next(); |
| 41 | Bu::FString readStr(); | 41 | Bu::String readStr(); |
| 42 | void rawread( char *c ); | 42 | void rawread( char *c ); |
| 43 | char c, la; | 43 | char c, la; |
| 44 | Bu::Stream &sIn; | 44 | Bu::Stream &sIn; |
diff --git a/src/tafwriter.cpp b/src/tafwriter.cpp index 215cb68..78d4060 100644 --- a/src/tafwriter.cpp +++ b/src/tafwriter.cpp | |||
| @@ -88,10 +88,10 @@ void Bu::TafWriter::writeComment( const Bu::TafComment *pComment ) | |||
| 88 | } | 88 | } |
| 89 | } | 89 | } |
| 90 | 90 | ||
| 91 | void Bu::TafWriter::writeString( const Bu::FString &str ) | 91 | void Bu::TafWriter::writeString( const Bu::String &str ) |
| 92 | { | 92 | { |
| 93 | sOut.write("\"", 1 ); | 93 | sOut.write("\"", 1 ); |
| 94 | for( Bu::FString::const_iterator s = str.begin(); s != str.end(); s++ ) | 94 | for( Bu::String::const_iterator s = str.begin(); s != str.end(); s++ ) |
| 95 | { | 95 | { |
| 96 | if( *s == '\"' ) | 96 | if( *s == '\"' ) |
| 97 | sOut.write("\\\"", 2 ); | 97 | sOut.write("\\\"", 2 ); |
diff --git a/src/tafwriter.h b/src/tafwriter.h index 5b7bd74..2bdd291 100644 --- a/src/tafwriter.h +++ b/src/tafwriter.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | 12 | ||
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | 14 | ||
| 15 | namespace Bu | 15 | namespace Bu |
| 16 | { | 16 | { |
| @@ -35,7 +35,7 @@ namespace Bu | |||
| 35 | private: | 35 | private: |
| 36 | void writeProperty( const Bu::TafProperty *pProp ); | 36 | void writeProperty( const Bu::TafProperty *pProp ); |
| 37 | void writeComment( const Bu::TafComment *pComment ); | 37 | void writeComment( const Bu::TafComment *pComment ); |
| 38 | void writeString( const Bu::FString &str ); | 38 | void writeString( const Bu::String &str ); |
| 39 | void ident(); | 39 | void ident(); |
| 40 | Bu::Stream &sOut; | 40 | Bu::Stream &sOut; |
| 41 | int iDepth; | 41 | int iDepth; |
diff --git a/src/tcpserversocket.cpp b/src/tcpserversocket.cpp index 7d7f6e4..0de6593 100644 --- a/src/tcpserversocket.cpp +++ b/src/tcpserversocket.cpp | |||
| @@ -48,7 +48,7 @@ Bu::TcpServerSocket::TcpServerSocket( int nPort, int nPoolSize ) : | |||
| 48 | startServer( name, nPoolSize ); | 48 | startServer( name, nPoolSize ); |
| 49 | } | 49 | } |
| 50 | 50 | ||
| 51 | Bu::TcpServerSocket::TcpServerSocket(const FString &sAddr,int nPort, int nPoolSize) : | 51 | Bu::TcpServerSocket::TcpServerSocket(const String &sAddr,int nPort, int nPoolSize) : |
| 52 | nPort( nPort ) | 52 | nPort( nPort ) |
| 53 | { | 53 | { |
| 54 | #ifdef WIN32 | 54 | #ifdef WIN32 |
diff --git a/src/tcpserversocket.h b/src/tcpserversocket.h index b1d7e02..b6c6f87 100644 --- a/src/tcpserversocket.h +++ b/src/tcpserversocket.h | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | #define BU_TCP_SERVER_SOCKET_H | 9 | #define BU_TCP_SERVER_SOCKET_H |
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include "bu/fstring.h" | 12 | #include "bu/string.h" |
| 13 | #include "bu/exceptionbase.h" | 13 | #include "bu/exceptionbase.h" |
| 14 | 14 | ||
| 15 | #ifdef WIN32 | 15 | #ifdef WIN32 |
| @@ -38,7 +38,7 @@ namespace Bu | |||
| 38 | { | 38 | { |
| 39 | public: | 39 | public: |
| 40 | TcpServerSocket( int nPort, int nPoolSize=40 ); | 40 | TcpServerSocket( int nPort, int nPoolSize=40 ); |
| 41 | TcpServerSocket( const FString &sAddr, int nPort, int nPoolSize=40 ); | 41 | TcpServerSocket( const String &sAddr, int nPort, int nPoolSize=40 ); |
| 42 | TcpServerSocket( int nSocket, bool bInit, int nPoolSize=40 ); | 42 | TcpServerSocket( int nSocket, bool bInit, int nPoolSize=40 ); |
| 43 | TcpServerSocket( const TcpServerSocket &rSrc ); | 43 | TcpServerSocket( const TcpServerSocket &rSrc ); |
| 44 | virtual ~TcpServerSocket(); | 44 | virtual ~TcpServerSocket(); |
diff --git a/src/tcpsocket.cpp b/src/tcpsocket.cpp index 22acdf7..522a6b7 100644 --- a/src/tcpsocket.cpp +++ b/src/tcpsocket.cpp | |||
| @@ -42,7 +42,7 @@ Bu::TcpSocket::TcpSocket( int nTcpSocket ) : | |||
| 42 | setAddress(); | 42 | setAddress(); |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | Bu::TcpSocket::TcpSocket( const Bu::FString &sAddr, int nPort, int nTimeout, | 45 | Bu::TcpSocket::TcpSocket( const Bu::String &sAddr, int nPort, int nTimeout, |
| 46 | bool bBlocking ) : | 46 | bool bBlocking ) : |
| 47 | nTcpSocket( 0 ), | 47 | nTcpSocket( 0 ), |
| 48 | bActive( false ), | 48 | bActive( false ), |
| @@ -440,7 +440,7 @@ void Bu::TcpSocket::setAddress() | |||
| 440 | printf("%d\n", IP_MTU ); | 440 | printf("%d\n", IP_MTU ); |
| 441 | } | 441 | } |
| 442 | 442 | ||
| 443 | Bu::FString Bu::TcpSocket::getAddress() const | 443 | Bu::String Bu::TcpSocket::getAddress() const |
| 444 | { | 444 | { |
| 445 | return sAddress; | 445 | return sAddress; |
| 446 | } | 446 | } |
| @@ -460,7 +460,7 @@ Bu::size Bu::TcpSocket::getBlockSize() const | |||
| 460 | 460 | ||
| 461 | } | 461 | } |
| 462 | 462 | ||
| 463 | Bu::FString Bu::TcpSocket::getLocation() const | 463 | Bu::String Bu::TcpSocket::getLocation() const |
| 464 | { | 464 | { |
| 465 | } | 465 | } |
| 466 | 466 | ||
diff --git a/src/tcpsocket.h b/src/tcpsocket.h index 8543ad0..0941c65 100644 --- a/src/tcpsocket.h +++ b/src/tcpsocket.h | |||
| @@ -12,7 +12,7 @@ | |||
| 12 | 12 | ||
| 13 | #include "bu/config.h" | 13 | #include "bu/config.h" |
| 14 | #include "bu/stream.h" | 14 | #include "bu/stream.h" |
| 15 | #include "bu/fstring.h" | 15 | #include "bu/string.h" |
| 16 | #include "bu/exceptionbase.h" | 16 | #include "bu/exceptionbase.h" |
| 17 | 17 | ||
| 18 | namespace Bu | 18 | namespace Bu |
| @@ -61,7 +61,7 @@ namespace Bu | |||
| 61 | { | 61 | { |
| 62 | public: | 62 | public: |
| 63 | TcpSocket( int nTcpSocket ); | 63 | TcpSocket( int nTcpSocket ); |
| 64 | TcpSocket( const FString &sAddr, int nPort, int nTimeout=30, | 64 | TcpSocket( const String &sAddr, int nPort, int nTimeout=30, |
| 65 | bool bBlocking=true ); | 65 | bool bBlocking=true ); |
| 66 | virtual ~TcpSocket(); | 66 | virtual ~TcpSocket(); |
| 67 | 67 | ||
| @@ -96,12 +96,12 @@ namespace Bu | |||
| 96 | 96 | ||
| 97 | virtual void setSize( size iSize ); | 97 | virtual void setSize( size iSize ); |
| 98 | 98 | ||
| 99 | Bu::FString getAddress() const; | 99 | Bu::String getAddress() const; |
| 100 | operator int() const; | 100 | operator int() const; |
| 101 | 101 | ||
| 102 | virtual size getSize() const; | 102 | virtual size getSize() const; |
| 103 | virtual size getBlockSize() const; | 103 | virtual size getBlockSize() const; |
| 104 | virtual Bu::FString getLocation() const; | 104 | virtual Bu::String getLocation() const; |
| 105 | 105 | ||
| 106 | private: | 106 | private: |
| 107 | void setAddress(); | 107 | void setAddress(); |
| @@ -113,8 +113,8 @@ namespace Bu | |||
| 113 | #endif | 113 | #endif |
| 114 | bool bActive; | 114 | bool bActive; |
| 115 | bool bBlocking; | 115 | bool bBlocking; |
| 116 | FString sReadBuf; | 116 | String sReadBuf; |
| 117 | FString sAddress; | 117 | String sAddress; |
| 118 | }; | 118 | }; |
| 119 | } | 119 | } |
| 120 | 120 | ||
diff --git a/src/tests/archive.cpp b/src/tests/archive.cpp index 08e3b17..de227b0 100644 --- a/src/tests/archive.cpp +++ b/src/tests/archive.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include "bu/archive.h" | 8 | #include "bu/archive.h" |
| 9 | #include "bu/file.h" | 9 | #include "bu/file.h" |
| 10 | #include "bu/fstring.h" | 10 | #include "bu/string.h" |
| 11 | 11 | ||
| 12 | using namespace Bu; | 12 | using namespace Bu; |
| 13 | 13 | ||
| @@ -16,7 +16,7 @@ int main() | |||
| 16 | File f("test.dat", File::WriteNew ); | 16 | File f("test.dat", File::WriteNew ); |
| 17 | Archive ar( f, Archive::save ); | 17 | Archive ar( f, Archive::save ); |
| 18 | 18 | ||
| 19 | Bu::FString s("Hello there"); | 19 | Bu::String s("Hello there"); |
| 20 | ar << s; | 20 | ar << s; |
| 21 | 21 | ||
| 22 | ar.setProp("hi", 45 ); | 22 | ar.setProp("hi", 45 ); |
diff --git a/src/tests/cache.cpp b/src/tests/cache.cpp index 7fe660a..38a5591 100644 --- a/src/tests/cache.cpp +++ b/src/tests/cache.cpp | |||
| @@ -14,7 +14,7 @@ | |||
| 14 | 14 | ||
| 15 | #include "bu/cache.h" | 15 | #include "bu/cache.h" |
| 16 | #include "bu/file.h" | 16 | #include "bu/file.h" |
| 17 | #include "bu/fstring.h" | 17 | #include "bu/string.h" |
| 18 | #include "bu/cachecalc.h" | 18 | #include "bu/cachecalc.h" |
| 19 | 19 | ||
| 20 | class Bob | 20 | class Bob |
| @@ -90,7 +90,7 @@ public: | |||
| 90 | writeNum("bobcache/last", cLastId ); | 90 | writeNum("bobcache/last", cLastId ); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | long readNum( const Bu::FString &sFile ) | 93 | long readNum( const Bu::String &sFile ) |
| 94 | { | 94 | { |
| 95 | TRACE( sFile ); | 95 | TRACE( sFile ); |
| 96 | Bu::File f( sFile, Bu::File::Read ); | 96 | Bu::File f( sFile, Bu::File::Read ); |
| @@ -99,13 +99,13 @@ public: | |||
| 99 | return strtol( buf, NULL, 0 ); | 99 | return strtol( buf, NULL, 0 ); |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | void writeNum( const Bu::FString &sFile, long num ) | 102 | void writeNum( const Bu::String &sFile, long num ) |
| 103 | { | 103 | { |
| 104 | TRACE( sFile, num ); | 104 | TRACE( sFile, num ); |
| 105 | Bu::File f( sFile, | 105 | Bu::File f( sFile, |
| 106 | Bu::File::Write|Bu::File::Create|Bu::File::Truncate | 106 | Bu::File::Write|Bu::File::Create|Bu::File::Truncate |
| 107 | ); | 107 | ); |
| 108 | Bu::FString s; | 108 | Bu::String s; |
| 109 | s.format("%d", num ); | 109 | s.format("%d", num ); |
| 110 | f.write( s ); | 110 | f.write( s ); |
| 111 | } | 111 | } |
| @@ -126,7 +126,7 @@ public: | |||
| 126 | virtual Bob *load( const long &key ) | 126 | virtual Bob *load( const long &key ) |
| 127 | { | 127 | { |
| 128 | TRACE( key ); | 128 | TRACE( key ); |
| 129 | Bu::FString sDest; | 129 | Bu::String sDest; |
| 130 | sDest.format("bobcache/%d", key ); | 130 | sDest.format("bobcache/%d", key ); |
| 131 | return new Bob( readNum( sDest ) ); | 131 | return new Bob( readNum( sDest ) ); |
| 132 | } | 132 | } |
| @@ -134,7 +134,7 @@ public: | |||
| 134 | virtual void unload( Bob *pObj, const long &key ) | 134 | virtual void unload( Bob *pObj, const long &key ) |
| 135 | { | 135 | { |
| 136 | TRACE( pObj, key ); | 136 | TRACE( pObj, key ); |
| 137 | Bu::FString sDest; | 137 | Bu::String sDest; |
| 138 | sDest.format("bobcache/%d", key ); | 138 | sDest.format("bobcache/%d", key ); |
| 139 | writeNum( sDest, pObj->getInt() ); | 139 | writeNum( sDest, pObj->getInt() ); |
| 140 | delete pObj; | 140 | delete pObj; |
| @@ -144,7 +144,7 @@ public: | |||
| 144 | { | 144 | { |
| 145 | TRACE( rSrc ); | 145 | TRACE( rSrc ); |
| 146 | long id = ++cLastId; | 146 | long id = ++cLastId; |
| 147 | Bu::FString sDest; | 147 | Bu::String sDest; |
| 148 | sDest.format("bobcache/%d", id ); | 148 | sDest.format("bobcache/%d", id ); |
| 149 | writeNum( sDest, rSrc->getInt() ); | 149 | writeNum( sDest, rSrc->getInt() ); |
| 150 | return id; | 150 | return id; |
| @@ -153,7 +153,7 @@ public: | |||
| 153 | virtual void destroy( Bob *pObj, const long &key ) | 153 | virtual void destroy( Bob *pObj, const long &key ) |
| 154 | { | 154 | { |
| 155 | TRACE( pObj, key ); | 155 | TRACE( pObj, key ); |
| 156 | Bu::FString sDest; | 156 | Bu::String sDest; |
| 157 | sDest.format("bobcache/%d", key ); | 157 | sDest.format("bobcache/%d", key ); |
| 158 | if( !access( sDest.getStr(), F_OK ) ) | 158 | if( !access( sDest.getStr(), F_OK ) ) |
| 159 | unlink( sDest.getStr() ); | 159 | unlink( sDest.getStr() ); |
| @@ -163,7 +163,7 @@ public: | |||
| 163 | virtual void destroy( const long &key ) | 163 | virtual void destroy( const long &key ) |
| 164 | { | 164 | { |
| 165 | TRACE( pObj, key ); | 165 | TRACE( pObj, key ); |
| 166 | Bu::FString sDest; | 166 | Bu::String sDest; |
| 167 | sDest.format("bobcache/%d", key ); | 167 | sDest.format("bobcache/%d", key ); |
| 168 | if( !access( sDest.getStr(), F_OK ) ) | 168 | if( !access( sDest.getStr(), F_OK ) ) |
| 169 | unlink( sDest.getStr() ); | 169 | unlink( sDest.getStr() ); |
diff --git a/src/tests/fastcgi.cpp b/src/tests/fastcgi.cpp index a3fa675..5f7758e 100644 --- a/src/tests/fastcgi.cpp +++ b/src/tests/fastcgi.cpp | |||
| @@ -27,10 +27,10 @@ public: | |||
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | virtual int onRequest( const StrHash &hParams, | 29 | virtual int onRequest( const StrHash &hParams, |
| 30 | const Bu::FString &sStdIn, Bu::Stream &sStdOut, | 30 | const Bu::String &sStdIn, Bu::Stream &sStdOut, |
| 31 | Bu::Stream &/*sStdErr*/ ) | 31 | Bu::Stream &/*sStdErr*/ ) |
| 32 | { | 32 | { |
| 33 | Bu::FString sOut("Content-Type: text/html\r\n\r\n"); | 33 | Bu::String sOut("Content-Type: text/html\r\n\r\n"); |
| 34 | sOut += "<html><body><h1>Environment:</h1><ul>"; | 34 | sOut += "<html><body><h1>Environment:</h1><ul>"; |
| 35 | for( StrHash::const_iterator i = hParams.begin(); i; i++ ) | 35 | for( StrHash::const_iterator i = hParams.begin(); i; i++ ) |
| 36 | { | 36 | { |
| @@ -44,8 +44,8 @@ public: | |||
| 44 | sOut += "</li></ul>"; | 44 | sOut += "</li></ul>"; |
| 45 | sOut += "<h1>Stdin:</h1>"; | 45 | sOut += "<h1>Stdin:</h1>"; |
| 46 | sOut.formatAppend("%d bytes<pre>", sStdIn.getSize() ); | 46 | sOut.formatAppend("%d bytes<pre>", sStdIn.getSize() ); |
| 47 | Bu::FString sL, sR; | 47 | Bu::String sL, sR; |
| 48 | for( Bu::FString::const_iterator i = sStdIn.begin(); | 48 | for( Bu::String::const_iterator i = sStdIn.begin(); |
| 49 | i; i++ ) | 49 | i; i++ ) |
| 50 | { | 50 | { |
| 51 | sL.formatAppend("%02X ", | 51 | sL.formatAppend("%02X ", |
diff --git a/src/tests/fstratsptr.cpp b/src/tests/fstratsptr.cpp index 2303d6a..fa38459 100644 --- a/src/tests/fstratsptr.cpp +++ b/src/tests/fstratsptr.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/fstring.h" | 8 | #include "bu/string.h" |
| 9 | #include "bu/atom.h" | 9 | #include "bu/atom.h" |
| 10 | #include "bu/sptr.h" | 10 | #include "bu/sptr.h" |
| 11 | 11 | ||
| @@ -15,8 +15,8 @@ public: | |||
| 15 | Person(){}; | 15 | Person(){}; |
| 16 | virtual ~Person(){}; | 16 | virtual ~Person(){}; |
| 17 | 17 | ||
| 18 | Bu::Atom<Bu::FString> sFirstName; | 18 | Bu::Atom<Bu::String> sFirstName; |
| 19 | Bu::Atom<Bu::FString> sLastName; | 19 | Bu::Atom<Bu::String> sLastName; |
| 20 | }; | 20 | }; |
| 21 | 21 | ||
| 22 | typedef Bu::SPtr<Person> PersonPtr; | 22 | typedef Bu::SPtr<Person> PersonPtr; |
| @@ -45,7 +45,7 @@ int main() | |||
| 45 | Swap(one, two); | 45 | Swap(one, two); |
| 46 | */ | 46 | */ |
| 47 | 47 | ||
| 48 | Bu::Atom<Bu::FString> sOne, sTwo; | 48 | Bu::Atom<Bu::String> sOne, sTwo; |
| 49 | sOne = "Hello"; | 49 | sOne = "Hello"; |
| 50 | sTwo = sOne; | 50 | sTwo = sOne; |
| 51 | 51 | ||
diff --git a/src/tests/fstrformat.cpp b/src/tests/fstrformat.cpp index a8e9def..2f04fe9 100644 --- a/src/tests/fstrformat.cpp +++ b/src/tests/fstrformat.cpp | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/fstring.h" | 8 | #include "bu/string.h" |
| 9 | #include <stdio.h> | 9 | #include <stdio.h> |
| 10 | 10 | ||
| 11 | int main() | 11 | int main() |
| 12 | { | 12 | { |
| 13 | Bu::FString s; | 13 | Bu::String s; |
| 14 | 14 | ||
| 15 | s.format("%d, %f, \'%s\'", 144, 12.5, "bob" ); | 15 | s.format("%d, %f, \'%s\'", 144, 12.5, "bob" ); |
| 16 | 16 | ||
diff --git a/src/tests/fstring.cpp b/src/tests/fstring.cpp index c343172..acc3558 100644 --- a/src/tests/fstring.cpp +++ b/src/tests/fstring.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/hash.h" | 8 | #include "bu/hash.h" |
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | #include <sys/time.h> | 10 | #include <sys/time.h> |
| 11 | #include <string> | 11 | #include <string> |
| 12 | 12 | ||
| @@ -27,9 +27,9 @@ inline double getTime() | |||
| 27 | } | 27 | } |
| 28 | #endif | 28 | #endif |
| 29 | 29 | ||
| 30 | Bu::FString genThing() | 30 | Bu::String genThing() |
| 31 | { | 31 | { |
| 32 | Bu::FString bob; | 32 | Bu::String bob; |
| 33 | bob.append("ab "); | 33 | bob.append("ab "); |
| 34 | bob += "cd "; | 34 | bob += "cd "; |
| 35 | bob += "efg"; | 35 | bob += "efg"; |
| @@ -39,7 +39,7 @@ Bu::FString genThing() | |||
| 39 | return bob; | 39 | return bob; |
| 40 | } | 40 | } |
| 41 | 41 | ||
| 42 | void thing( Bu::FString str ) | 42 | void thing( Bu::String str ) |
| 43 | { | 43 | { |
| 44 | printf("Hey: %s\n", str.getStr() ); | 44 | printf("Hey: %s\n", str.getStr() ); |
| 45 | } | 45 | } |
| @@ -49,21 +49,21 @@ void copyfunc( std::string temp ) | |||
| 49 | temp += "Hi"; | 49 | temp += "Hi"; |
| 50 | } | 50 | } |
| 51 | 51 | ||
| 52 | void copyfunc( Bu::FString temp ) | 52 | void copyfunc( Bu::String temp ) |
| 53 | { | 53 | { |
| 54 | temp += "Hi"; | 54 | temp += "Hi"; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | void doTimings() | 57 | void doTimings() |
| 58 | { | 58 | { |
| 59 | Bu::FString fs1, fs2; | 59 | Bu::String fs1, fs2; |
| 60 | std::string ss1, ss2; | 60 | std::string ss1, ss2; |
| 61 | double dStart, dEnd, tfs1, tfs2, tfs3, tss1, tss2, tss3; | 61 | double dStart, dEnd, tfs1, tfs2, tfs3, tss1, tss2, tss3; |
| 62 | int nChars = 500000, nChunks=5000, nCopies=5000000, nChunkSize=1024*4; | 62 | int nChars = 500000, nChunks=5000, nCopies=5000000, nChunkSize=1024*4; |
| 63 | char *buf = new char[nChunkSize]; | 63 | char *buf = new char[nChunkSize]; |
| 64 | memset( buf, '!', nChunkSize ); | 64 | memset( buf, '!', nChunkSize ); |
| 65 | 65 | ||
| 66 | printf("Timing Bu::FString single chars...\n"); | 66 | printf("Timing Bu::String single chars...\n"); |
| 67 | dStart = getTime(); | 67 | dStart = getTime(); |
| 68 | for( int j = 0; j < nChars; j++ ) fs1 += (char)('a'+(j%26)); | 68 | for( int j = 0; j < nChars; j++ ) fs1 += (char)('a'+(j%26)); |
| 69 | fs1.getStr(); | 69 | fs1.getStr(); |
| @@ -77,7 +77,7 @@ void doTimings() | |||
| 77 | dEnd = getTime(); | 77 | dEnd = getTime(); |
| 78 | tss1 = dEnd-dStart; | 78 | tss1 = dEnd-dStart; |
| 79 | 79 | ||
| 80 | printf("Timing Bu::FString %d char chunks...\n", nChunkSize); | 80 | printf("Timing Bu::String %d char chunks...\n", nChunkSize); |
| 81 | dStart = getTime(); | 81 | dStart = getTime(); |
| 82 | for( int j = 0; j < nChunks; j++ ) fs2.append(buf, nChunkSize); | 82 | for( int j = 0; j < nChunks; j++ ) fs2.append(buf, nChunkSize); |
| 83 | fs2.getStr(); | 83 | fs2.getStr(); |
| @@ -93,9 +93,9 @@ void doTimings() | |||
| 93 | 93 | ||
| 94 | fs2 = "Hello there."; | 94 | fs2 = "Hello there."; |
| 95 | ss2 = "Hello there."; | 95 | ss2 = "Hello there."; |
| 96 | printf("Timing Bu::FString copies...\n"); | 96 | printf("Timing Bu::String copies...\n"); |
| 97 | dStart = getTime(); | 97 | dStart = getTime(); |
| 98 | for( int j = 0; j < nCopies; j++ ) Bu::FString stmp = fs2; | 98 | for( int j = 0; j < nCopies; j++ ) Bu::String stmp = fs2; |
| 99 | dEnd = getTime(); | 99 | dEnd = getTime(); |
| 100 | tfs3 = dEnd-dStart; | 100 | tfs3 = dEnd-dStart; |
| 101 | 101 | ||
| @@ -107,7 +107,7 @@ void doTimings() | |||
| 107 | 107 | ||
| 108 | printf( | 108 | printf( |
| 109 | "Results: singles: chunks: copies:\n" | 109 | "Results: singles: chunks: copies:\n" |
| 110 | "Bu::FString %10.2f/s %10.2f/s %10.2f/s\n" | 110 | "Bu::String %10.2f/s %10.2f/s %10.2f/s\n" |
| 111 | "std::string %10.2f/s %10.2f/s %10.2f/s\n", | 111 | "std::string %10.2f/s %10.2f/s %10.2f/s\n", |
| 112 | nChars/tfs1, nChunks/tfs2, nCopies/tfs3, | 112 | nChars/tfs1, nChunks/tfs2, nCopies/tfs3, |
| 113 | nChars/tss1, nChunks/tss2, nCopies/tss3 ); | 113 | nChars/tss1, nChunks/tss2, nCopies/tss3 ); |
| @@ -118,16 +118,16 @@ void doTimings() | |||
| 118 | #define pem printf("---------\n%08tX: %s\n%08tX: %s\n", (ptrdiff_t)str.getStr(), str.getStr(), (ptrdiff_t)str2.getStr(), str2.getStr() ); | 118 | #define pem printf("---------\n%08tX: %s\n%08tX: %s\n", (ptrdiff_t)str.getStr(), str.getStr(), (ptrdiff_t)str2.getStr(), str2.getStr() ); |
| 119 | int main( ) | 119 | int main( ) |
| 120 | { | 120 | { |
| 121 | Bu::FString fs1; | 121 | Bu::String fs1; |
| 122 | for( int j = 0; j < 500000; j++ ) fs1 += (char)('a'+(j%26)); | 122 | for( int j = 0; j < 500000; j++ ) fs1 += (char)('a'+(j%26)); |
| 123 | return 0; | 123 | return 0; |
| 124 | 124 | ||
| 125 | Bu::FString str("th"); | 125 | Bu::String str("th"); |
| 126 | 126 | ||
| 127 | str.prepend("Hello "); | 127 | str.prepend("Hello "); |
| 128 | str.append("ere."); | 128 | str.append("ere."); |
| 129 | 129 | ||
| 130 | Bu::FString str2( str ); | 130 | Bu::String str2( str ); |
| 131 | pem; | 131 | pem; |
| 132 | str += " What's up?"; | 132 | str += " What's up?"; |
| 133 | pem; | 133 | pem; |
diff --git a/src/tests/fstrstd.cpp b/src/tests/fstrstd.cpp index 86d7c5c..4209c65 100644 --- a/src/tests/fstrstd.cpp +++ b/src/tests/fstrstd.cpp | |||
| @@ -6,11 +6,11 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <iostream> | 8 | #include <iostream> |
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | 10 | ||
| 11 | int main() | 11 | int main() |
| 12 | { | 12 | { |
| 13 | Bu::FString s("Hey there, dude.\n"); | 13 | Bu::String s("Hey there, dude.\n"); |
| 14 | 14 | ||
| 15 | // std::cout << s << 5; | 15 | // std::cout << s << 5; |
| 16 | } | 16 | } |
diff --git a/src/tests/hash2.cpp b/src/tests/hash2.cpp index 4db248e..5f1dd09 100644 --- a/src/tests/hash2.cpp +++ b/src/tests/hash2.cpp | |||
| @@ -5,12 +5,12 @@ | |||
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include <bu/fstring.h> | 8 | #include <bu/string.h> |
| 9 | #include <bu/hash.h> | 9 | #include <bu/hash.h> |
| 10 | 10 | ||
| 11 | int main() | 11 | int main() |
| 12 | { | 12 | { |
| 13 | Bu::Hash<Bu::FString, int> hCmd; | 13 | Bu::Hash<Bu::String, int> hCmd; |
| 14 | 14 | ||
| 15 | hCmd.insert("help", 5 ); | 15 | hCmd.insert("help", 5 ); |
| 16 | hCmd.insert("exit", 5 ); | 16 | hCmd.insert("exit", 5 ); |
diff --git a/src/tests/heap.cpp b/src/tests/heap.cpp index 7538936..3576f25 100644 --- a/src/tests/heap.cpp +++ b/src/tests/heap.cpp | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include "bu/formatter.h" | 11 | #include "bu/formatter.h" |
| 12 | #include "bu/heap.h" | 12 | #include "bu/heap.h" |
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | #include "bu/file.h" | 14 | #include "bu/file.h" |
| 15 | 15 | ||
| 16 | typedef struct num | 16 | typedef struct num |
| @@ -38,15 +38,15 @@ typedef struct num | |||
| 38 | } | 38 | } |
| 39 | } num; | 39 | } num; |
| 40 | 40 | ||
| 41 | void printHeap( Bu::Heap<Bu::FString> &h, int j ) | 41 | void printHeap( Bu::Heap<Bu::String> &h, int j ) |
| 42 | { | 42 | { |
| 43 | // return; | 43 | // return; |
| 44 | Bu::FString sFName; | 44 | Bu::String sFName; |
| 45 | sFName.format("graph-step-%02d.dot", j ); | 45 | sFName.format("graph-step-%02d.dot", j ); |
| 46 | Bu::File fOut( sFName, Bu::File::WriteNew ); | 46 | Bu::File fOut( sFName, Bu::File::WriteNew ); |
| 47 | Bu::Formatter f( fOut ); | 47 | Bu::Formatter f( fOut ); |
| 48 | f << "Graph step: " << j << ", total size: " << h.getSize() << f.nl; | 48 | f << "Graph step: " << j << ", total size: " << h.getSize() << f.nl; |
| 49 | for( Bu::Heap<Bu::FString>::iterator i = h.begin(); i; i++ ) | 49 | for( Bu::Heap<Bu::String>::iterator i = h.begin(); i; i++ ) |
| 50 | { | 50 | { |
| 51 | f << *i << f.nl; | 51 | f << *i << f.nl; |
| 52 | } | 52 | } |
| @@ -73,7 +73,7 @@ int main() | |||
| 73 | } | 73 | } |
| 74 | printf("\n"); | 74 | printf("\n"); |
| 75 | */ | 75 | */ |
| 76 | Bu::Heap<Bu::FString> hStr; | 76 | Bu::Heap<Bu::String> hStr; |
| 77 | int j = 0; | 77 | int j = 0; |
| 78 | 78 | ||
| 79 | hStr.enqueue("George"); | 79 | hStr.enqueue("George"); |
| @@ -100,7 +100,7 @@ int main() | |||
| 100 | } | 100 | } |
| 101 | printf("\n"); | 101 | printf("\n"); |
| 102 | 102 | ||
| 103 | Bu::List<Bu::FString> lStr; | 103 | Bu::List<Bu::String> lStr; |
| 104 | 104 | ||
| 105 | lStr.insertSorted("George"); | 105 | lStr.insertSorted("George"); |
| 106 | lStr.insertSorted("George"); | 106 | lStr.insertSorted("George"); |
| @@ -110,7 +110,7 @@ int main() | |||
| 110 | lStr.insertSorted("Brianna"); | 110 | lStr.insertSorted("Brianna"); |
| 111 | lStr.insertSorted("Kate"); | 111 | lStr.insertSorted("Kate"); |
| 112 | lStr.insertSorted("Soggy"); | 112 | lStr.insertSorted("Soggy"); |
| 113 | for( Bu::List<Bu::FString>::iterator i = lStr.begin(); i; i++ ) | 113 | for( Bu::List<Bu::String>::iterator i = lStr.begin(); i; i++ ) |
| 114 | { | 114 | { |
| 115 | printf("\"%s\" ", (*i).getStr() ); | 115 | printf("\"%s\" ", (*i).getStr() ); |
| 116 | } | 116 | } |
diff --git a/src/tests/listsort.cpp b/src/tests/listsort.cpp index 60d9611..00e7268 100644 --- a/src/tests/listsort.cpp +++ b/src/tests/listsort.cpp | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | 7 | ||
| 8 | #include <bu/list.h> | 8 | #include <bu/list.h> |
| 9 | #include <bu/sio.h> | 9 | #include <bu/sio.h> |
| 10 | #include <bu/fstring.h> | 10 | #include <bu/string.h> |
| 11 | 11 | ||
| 12 | using namespace Bu; | 12 | using namespace Bu; |
| 13 | 13 | ||
| @@ -25,7 +25,7 @@ int main() | |||
| 25 | il.sortI( cmp ); | 25 | il.sortI( cmp ); |
| 26 | */ | 26 | */ |
| 27 | 27 | ||
| 28 | FString a("Soggy"), b("Sam"); | 28 | String a("Soggy"), b("Sam"); |
| 29 | 29 | ||
| 30 | if( a < b ) | 30 | if( a < b ) |
| 31 | { | 31 | { |
| @@ -36,7 +36,7 @@ int main() | |||
| 36 | sio << "Good" << sio.nl; | 36 | sio << "Good" << sio.nl; |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | typedef List<FString> StrList; | 39 | typedef List<String> StrList; |
| 40 | 40 | ||
| 41 | StrList lNames; | 41 | StrList lNames; |
| 42 | 42 | ||
diff --git a/src/tests/mmparse.cpp b/src/tests/mmparse.cpp index b2c3bf5..1123d21 100644 --- a/src/tests/mmparse.cpp +++ b/src/tests/mmparse.cpp | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/minimacro.h" | 8 | #include "bu/minimacro.h" |
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | 10 | ||
| 11 | int main() | 11 | int main() |
| 12 | { | 12 | { |
diff --git a/src/tests/optparser.cpp b/src/tests/optparser.cpp index f5d1512..ae658df 100644 --- a/src/tests/optparser.cpp +++ b/src/tests/optparser.cpp | |||
| @@ -72,7 +72,7 @@ public: | |||
| 72 | 72 | ||
| 73 | int iBob; | 73 | int iBob; |
| 74 | float dBob; | 74 | float dBob; |
| 75 | Bu::FString sVar; | 75 | Bu::String sVar; |
| 76 | }; | 76 | }; |
| 77 | 77 | ||
| 78 | int main( int argc, char *argv[] ) | 78 | int main( int argc, char *argv[] ) |
diff --git a/src/tests/sha1.cpp b/src/tests/sha1.cpp index b1c798a..84cebe5 100644 --- a/src/tests/sha1.cpp +++ b/src/tests/sha1.cpp | |||
| @@ -28,8 +28,8 @@ int main( int argc, char *argv[] ) | |||
| 28 | break; | 28 | break; |
| 29 | } | 29 | } |
| 30 | 30 | ||
| 31 | Bu::FString sRes = m.getResult(); | 31 | Bu::String sRes = m.getResult(); |
| 32 | for( Bu::FString::iterator i = sRes.begin(); i; i++ ) | 32 | for( Bu::String::iterator i = sRes.begin(); i; i++ ) |
| 33 | { | 33 | { |
| 34 | sio << Fmt::hex(2,false) << (int)(unsigned char)(*i); | 34 | sio << Fmt::hex(2,false) << (int)(unsigned char)(*i); |
| 35 | } | 35 | } |
diff --git a/src/tests/signals.cpp b/src/tests/signals.cpp index e53c16e..a8c8c4e 100644 --- a/src/tests/signals.cpp +++ b/src/tests/signals.cpp | |||
| @@ -32,22 +32,22 @@ public: | |||
| 32 | sio << iState << ": void fnc1( " << a << " )" << sio.nl; | 32 | sio << iState << ": void fnc1( " << a << " )" << sio.nl; |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | void fnc2( int a, Bu::FString b ) | 35 | void fnc2( int a, Bu::String b ) |
| 36 | { | 36 | { |
| 37 | sio << iState << ": void fnc2( " << a << ", \"" << b << "\" )" << sio.nl; | 37 | sio << iState << ": void fnc2( " << a << ", \"" << b << "\" )" << sio.nl; |
| 38 | } | 38 | } |
| 39 | 39 | ||
| 40 | void fnc3( int a, Bu::FString b, double c ) | 40 | void fnc3( int a, Bu::String b, double c ) |
| 41 | { | 41 | { |
| 42 | sio << iState << ": void fnc3( " << a << ", \"" << b << "\", " << c << " )" << sio.nl; | 42 | sio << iState << ": void fnc3( " << a << ", \"" << b << "\", " << c << " )" << sio.nl; |
| 43 | } | 43 | } |
| 44 | 44 | ||
| 45 | void fnc4( int a, Bu::FString b, double c, char d ) | 45 | void fnc4( int a, Bu::String b, double c, char d ) |
| 46 | { | 46 | { |
| 47 | sio << iState << ": void fnc4( " << a << ", \"" << b << "\", " << c << ", '" << d << "' )" << sio.nl; | 47 | sio << iState << ": void fnc4( " << a << ", \"" << b << "\", " << c << ", '" << d << "' )" << sio.nl; |
| 48 | } | 48 | } |
| 49 | 49 | ||
| 50 | void fnc5( int a, Bu::FString b, double c, char d, long e ) | 50 | void fnc5( int a, Bu::String b, double c, char d, long e ) |
| 51 | { | 51 | { |
| 52 | sio << iState << ": void fnc5( " << a << ", \"" << b << "\", " << c << ", '" << d << "', " << e << " )" << sio.nl; | 52 | sio << iState << ": void fnc5( " << a << ", \"" << b << "\", " << c << ", '" << d << "', " << e << " )" << sio.nl; |
| 53 | } | 53 | } |
| @@ -66,22 +66,22 @@ void pfnc1( int a ) | |||
| 66 | sio << ": void pfnc1( " << a << " )" << sio.nl; | 66 | sio << ": void pfnc1( " << a << " )" << sio.nl; |
| 67 | } | 67 | } |
| 68 | 68 | ||
| 69 | void pfnc2( int a, Bu::FString b ) | 69 | void pfnc2( int a, Bu::String b ) |
| 70 | { | 70 | { |
| 71 | sio << ": void pfnc2( " << a << ", \"" << b << "\" )" << sio.nl; | 71 | sio << ": void pfnc2( " << a << ", \"" << b << "\" )" << sio.nl; |
| 72 | } | 72 | } |
| 73 | 73 | ||
| 74 | void pfnc3( int a, Bu::FString b, double c ) | 74 | void pfnc3( int a, Bu::String b, double c ) |
| 75 | { | 75 | { |
| 76 | sio << ": void pfnc3( " << a << ", \"" << b << "\", " << c << " )" << sio.nl; | 76 | sio << ": void pfnc3( " << a << ", \"" << b << "\", " << c << " )" << sio.nl; |
| 77 | } | 77 | } |
| 78 | 78 | ||
| 79 | void pfnc4( int a, Bu::FString b, double c, char d ) | 79 | void pfnc4( int a, Bu::String b, double c, char d ) |
| 80 | { | 80 | { |
| 81 | sio << ": void pfnc4( " << a << ", \"" << b << "\", " << c << ", '" << d << "' )" << sio.nl; | 81 | sio << ": void pfnc4( " << a << ", \"" << b << "\", " << c << ", '" << d << "' )" << sio.nl; |
| 82 | } | 82 | } |
| 83 | 83 | ||
| 84 | void pfnc5( int a, Bu::FString b, double c, char d, long e ) | 84 | void pfnc5( int a, Bu::String b, double c, char d, long e ) |
| 85 | { | 85 | { |
| 86 | sio << ": void pfnc5( " << a << ", \"" << b << "\", " << c << ", '" << d << "', " << e << " )" << sio.nl; | 86 | sio << ": void pfnc5( " << a << ", \"" << b << "\", " << c << ", '" << d << "', " << e << " )" << sio.nl; |
| 87 | } | 87 | } |
| @@ -105,22 +105,22 @@ int main() | |||
| 105 | cb1 = slot( &pfnc1 ); | 105 | cb1 = slot( &pfnc1 ); |
| 106 | cb1( 5 ); | 106 | cb1( 5 ); |
| 107 | 107 | ||
| 108 | Signal2<void, int, Bu::FString> cb2( slot( &t, &Thing::fnc2 ) ); | 108 | Signal2<void, int, Bu::String> cb2( slot( &t, &Thing::fnc2 ) ); |
| 109 | cb2( 5, "Hi there" ); | 109 | cb2( 5, "Hi there" ); |
| 110 | cb2 = slot( &pfnc2 ); | 110 | cb2 = slot( &pfnc2 ); |
| 111 | cb2( 5, "Hi there" ); | 111 | cb2( 5, "Hi there" ); |
| 112 | 112 | ||
| 113 | Signal3<void, int, Bu::FString, double> cb3( slot( &t, &Thing::fnc3 ) ); | 113 | Signal3<void, int, Bu::String, double> cb3( slot( &t, &Thing::fnc3 ) ); |
| 114 | cb3( 5, "Hi there", 12.85 ); | 114 | cb3( 5, "Hi there", 12.85 ); |
| 115 | cb3 = slot( &pfnc3 ); | 115 | cb3 = slot( &pfnc3 ); |
| 116 | cb3( 5, "Hi there", 12.85 ); | 116 | cb3( 5, "Hi there", 12.85 ); |
| 117 | 117 | ||
| 118 | Signal4<void, int, Bu::FString, double, char> cb4( slot( &t, &Thing::fnc4 ) ); | 118 | Signal4<void, int, Bu::String, double, char> cb4( slot( &t, &Thing::fnc4 ) ); |
| 119 | cb4( 5, "Hi there", 12.85, 'z' ); | 119 | cb4( 5, "Hi there", 12.85, 'z' ); |
| 120 | cb4 = slot( &pfnc4 ); | 120 | cb4 = slot( &pfnc4 ); |
| 121 | cb4( 5, "Hi there", 12.85, 'z' ); | 121 | cb4( 5, "Hi there", 12.85, 'z' ); |
| 122 | 122 | ||
| 123 | Signal5<void, int, Bu::FString, double, char, long> cb5( slot( &t, &Thing::fnc5 ) ); | 123 | Signal5<void, int, Bu::String, double, char, long> cb5( slot( &t, &Thing::fnc5 ) ); |
| 124 | cb5( 5, "Hi there", 12.85, 'z', 849 ); | 124 | cb5( 5, "Hi there", 12.85, 'z', 849 ); |
| 125 | cb5 = slot( &pfnc5 ); | 125 | cb5 = slot( &pfnc5 ); |
| 126 | cb5( 5, "Hi there", 12.85, 'z', 849 ); | 126 | cb5( 5, "Hi there", 12.85, 'z', 849 ); |
diff --git a/src/tests/size.cpp b/src/tests/size.cpp index a9a921d..841325d 100644 --- a/src/tests/size.cpp +++ b/src/tests/size.cpp | |||
| @@ -6,15 +6,15 @@ | |||
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/hash.h" | 8 | #include "bu/hash.h" |
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | 10 | ||
| 11 | #define pSize( t ) printf("%15s: %db\n", #t, sizeof( t ) ); | 11 | #define pSize( t ) printf("%15s: %db\n", #t, sizeof( t ) ); |
| 12 | 12 | ||
| 13 | int main() | 13 | int main() |
| 14 | { | 14 | { |
| 15 | typedef Bu::Hash<char, char> charcharHash; | 15 | typedef Bu::Hash<char, char> charcharHash; |
| 16 | typedef Bu::Hash<Bu::FString, Bu::FString> strstrHash; | 16 | typedef Bu::Hash<Bu::String, Bu::String> strstrHash; |
| 17 | pSize( Bu::FString ); | 17 | pSize( Bu::String ); |
| 18 | pSize( charcharHash ); | 18 | pSize( charcharHash ); |
| 19 | pSize( strstrHash ); | 19 | pSize( strstrHash ); |
| 20 | } | 20 | } |
diff --git a/src/tests/speed.cpp b/src/tests/speed.cpp index c6770de..c78dded 100644 --- a/src/tests/speed.cpp +++ b/src/tests/speed.cpp | |||
| @@ -5,7 +5,7 @@ | |||
| 5 | * terms of the license contained in the file LICENSE. | 5 | * terms of the license contained in the file LICENSE. |
| 6 | */ | 6 | */ |
| 7 | 7 | ||
| 8 | #include "bu/fstring.h" | 8 | #include "bu/string.h" |
| 9 | #include <sys/time.h> | 9 | #include <sys/time.h> |
| 10 | 10 | ||
| 11 | template<typename a> | 11 | template<typename a> |
| @@ -50,9 +50,9 @@ void fullTest( tst t ) | |||
| 50 | 50 | ||
| 51 | int main() | 51 | int main() |
| 52 | { | 52 | { |
| 53 | Bu::FString str; | 53 | Bu::String str; |
| 54 | for( int j = 0; j < 500; j++ ) | 54 | for( int j = 0; j < 500; j++ ) |
| 55 | str.append("Hey, this is a test string. It will be reapeated many, many times. How's that?"); | 55 | str.append("Hey, this is a test string. It will be reapeated many, many times. How's that?"); |
| 56 | fullTest( tstCopy<Bu::FString>( str ) ); | 56 | fullTest( tstCopy<Bu::String>( str ) ); |
| 57 | } | 57 | } |
| 58 | 58 | ||
diff --git a/src/tests/streamstack.cpp b/src/tests/streamstack.cpp index b8c48e7..ea9ec0b 100644 --- a/src/tests/streamstack.cpp +++ b/src/tests/streamstack.cpp | |||
| @@ -24,7 +24,7 @@ public: | |||
| 24 | 24 | ||
| 25 | void write() | 25 | void write() |
| 26 | { | 26 | { |
| 27 | Bu::FString s; | 27 | Bu::String s; |
| 28 | time_t tNow = time( NULL ); | 28 | time_t tNow = time( NULL ); |
| 29 | s = ctime( &tNow ); | 29 | s = ctime( &tNow ); |
| 30 | long lSize = s.getSize()-1; | 30 | long lSize = s.getSize()-1; |
| @@ -34,7 +34,7 @@ public: | |||
| 34 | 34 | ||
| 35 | void read() | 35 | void read() |
| 36 | { | 36 | { |
| 37 | Bu::FString s; | 37 | Bu::String s; |
| 38 | long lSize; | 38 | long lSize; |
| 39 | rStream.read( &lSize, sizeof(long) ); | 39 | rStream.read( &lSize, sizeof(long) ); |
| 40 | s.setSize( lSize ); | 40 | s.setSize( lSize ); |
diff --git a/src/tests/telnetsrv.cpp b/src/tests/telnetsrv.cpp index 4504aaf..f62714a 100644 --- a/src/tests/telnetsrv.cpp +++ b/src/tests/telnetsrv.cpp | |||
| @@ -36,7 +36,7 @@ public: | |||
| 36 | printf("New dim = (%dx%d)\n", iWidth, iHeight ); | 36 | printf("New dim = (%dx%d)\n", iWidth, iHeight ); |
| 37 | } | 37 | } |
| 38 | 38 | ||
| 39 | virtual void gotLine( Bu::FString &sLine ) | 39 | virtual void gotLine( Bu::String &sLine ) |
| 40 | { | 40 | { |
| 41 | printf("Line: \"%s\"\n", sLine.getStr() ); | 41 | printf("Line: \"%s\"\n", sLine.getStr() ); |
| 42 | write("\n\r", 2 ); | 42 | write("\n\r", 2 ); |
diff --git a/src/tools/bnfcompile.cpp b/src/tools/bnfcompile.cpp index 16e75a5..b7b363c 100644 --- a/src/tools/bnfcompile.cpp +++ b/src/tools/bnfcompile.cpp | |||
| @@ -123,7 +123,7 @@ public: | |||
| 123 | } | 123 | } |
| 124 | } | 124 | } |
| 125 | 125 | ||
| 126 | virtual FString tokenToString( const Token &t ) | 126 | virtual String tokenToString( const Token &t ) |
| 127 | { | 127 | { |
| 128 | switch( (TokenType)t.iToken ) | 128 | switch( (TokenType)t.iToken ) |
| 129 | { | 129 | { |
| @@ -146,7 +146,7 @@ public: | |||
| 146 | private: | 146 | private: |
| 147 | Stream &rSrc; | 147 | Stream &rSrc; |
| 148 | QueueBuf qbIn; | 148 | QueueBuf qbIn; |
| 149 | FString sBuf; | 149 | String sBuf; |
| 150 | }; | 150 | }; |
| 151 | 151 | ||
| 152 | class BnfParser | 152 | class BnfParser |
| @@ -201,9 +201,9 @@ private: | |||
| 201 | next(); | 201 | next(); |
| 202 | if( pCur->iToken == tokIdentifier ) | 202 | if( pCur->iToken == tokIdentifier ) |
| 203 | { | 203 | { |
| 204 | hTokens.insert( pCur->vExtra.get<Bu::FString>(), ++iLastToken ); | 204 | hTokens.insert( pCur->vExtra.get<Bu::String>(), ++iLastToken ); |
| 205 | sio << "Added token[" << iLastToken << "]: " | 205 | sio << "Added token[" << iLastToken << "]: " |
| 206 | << pCur->vExtra.get<Bu::FString>() << sio.nl; | 206 | << pCur->vExtra.get<Bu::String>() << sio.nl; |
| 207 | } | 207 | } |
| 208 | else if( pCur->iToken == tokSemiColon ) | 208 | else if( pCur->iToken == tokSemiColon ) |
| 209 | break; | 209 | break; |
| @@ -214,7 +214,7 @@ private: | |||
| 214 | 214 | ||
| 215 | void nonTerminal() | 215 | void nonTerminal() |
| 216 | { | 216 | { |
| 217 | Bu::FString sNtName = pCur->vExtra.get<Bu::FString>(); | 217 | Bu::String sNtName = pCur->vExtra.get<Bu::String>(); |
| 218 | Parser::NonTerminal nt; | 218 | Parser::NonTerminal nt; |
| 219 | p.addNonTerminal( sNtName ); | 219 | p.addNonTerminal( sNtName ); |
| 220 | sio.incIndent(); | 220 | sio.incIndent(); |
| @@ -258,8 +258,8 @@ private: | |||
| 258 | { | 258 | { |
| 259 | case tokIdentifier: | 259 | case tokIdentifier: |
| 260 | { | 260 | { |
| 261 | const Bu::FString &sName = | 261 | const Bu::String &sName = |
| 262 | pCur->vExtra.get<Bu::FString>(); | 262 | pCur->vExtra.get<Bu::String>(); |
| 263 | if( hTokens.has( sName ) ) | 263 | if( hTokens.has( sName ) ) |
| 264 | { | 264 | { |
| 265 | pr.append( | 265 | pr.append( |
| @@ -292,8 +292,8 @@ private: | |||
| 292 | next(); | 292 | next(); |
| 293 | if( pCur->iToken != tokIdentifier ) | 293 | if( pCur->iToken != tokIdentifier ) |
| 294 | tokenError("tokIdentifier"); | 294 | tokenError("tokIdentifier"); |
| 295 | Bu::FString sName = | 295 | Bu::String sName = |
| 296 | pCur->vExtra.get<Bu::FString>(); | 296 | pCur->vExtra.get<Bu::String>(); |
| 297 | next(); | 297 | next(); |
| 298 | if( pCur->iToken != tokCloseSquare ) | 298 | if( pCur->iToken != tokCloseSquare ) |
| 299 | tokenError("tokCloseSquare"); | 299 | tokenError("tokCloseSquare"); |
| @@ -317,8 +317,8 @@ private: | |||
| 317 | next(); | 317 | next(); |
| 318 | if( pCur->iToken != tokIdentifier ) | 318 | if( pCur->iToken != tokIdentifier ) |
| 319 | tokenError("tokIdentifier"); | 319 | tokenError("tokIdentifier"); |
| 320 | Bu::FString sName = | 320 | Bu::String sName = |
| 321 | pCur->vExtra.get<Bu::FString>(); | 321 | pCur->vExtra.get<Bu::String>(); |
| 322 | next(); | 322 | next(); |
| 323 | if( pCur->iToken != tokCloseCurly ) | 323 | if( pCur->iToken != tokCloseCurly ) |
| 324 | tokenError("tokCloseCurly"); | 324 | tokenError("tokCloseCurly"); |
| @@ -366,14 +366,14 @@ private: | |||
| 366 | pCur = l.nextToken(); | 366 | pCur = l.nextToken(); |
| 367 | } | 367 | } |
| 368 | 368 | ||
| 369 | void tokenError( const FString &s ) | 369 | void tokenError( const String &s ) |
| 370 | { | 370 | { |
| 371 | throw ExceptionBase( ("Expected " + s + " but found " | 371 | throw ExceptionBase( ("Expected " + s + " but found " |
| 372 | + l.tokenToString( *pCur ) + ".").getStr() ); | 372 | + l.tokenToString( *pCur ) + ".").getStr() ); |
| 373 | } | 373 | } |
| 374 | 374 | ||
| 375 | private: | 375 | private: |
| 376 | typedef Bu::Hash<Bu::FString, int> TokenHash; | 376 | typedef Bu::Hash<Bu::String, int> TokenHash; |
| 377 | TokenHash hTokens; | 377 | TokenHash hTokens; |
| 378 | BnfLexer &l; | 378 | BnfLexer &l; |
| 379 | BnfLexer::Token *pCur; | 379 | BnfLexer::Token *pCur; |
diff --git a/src/tools/mkunit.cpp b/src/tools/mkunit.cpp index 12ce65f..c0b7b8b 100644 --- a/src/tools/mkunit.cpp +++ b/src/tools/mkunit.cpp | |||
| @@ -15,7 +15,7 @@ public: | |||
| 15 | { | 15 | { |
| 16 | } | 16 | } |
| 17 | 17 | ||
| 18 | Bu::FString sName; | 18 | Bu::String sName; |
| 19 | bool bExpectPass; | 19 | bool bExpectPass; |
| 20 | }; | 20 | }; |
| 21 | typedef Bu::List<Test> TestList; | 21 | typedef Bu::List<Test> TestList; |
| @@ -23,7 +23,7 @@ typedef Bu::List<Test> TestList; | |||
| 23 | class Suite | 23 | class Suite |
| 24 | { | 24 | { |
| 25 | public: | 25 | public: |
| 26 | Bu::FString sName; | 26 | Bu::String sName; |
| 27 | TestList lTest; | 27 | TestList lTest; |
| 28 | }; | 28 | }; |
| 29 | //typedef Bu::List<Suite> SuiteList; | 29 | //typedef Bu::List<Suite> SuiteList; |
| @@ -66,7 +66,7 @@ Bu::Formatter &operator<<( Bu::Formatter &f, const Suite &s ) | |||
| 66 | class Parser | 66 | class Parser |
| 67 | { | 67 | { |
| 68 | public: | 68 | public: |
| 69 | Parser( const Bu::FString &sFile ) : | 69 | Parser( const Bu::String &sFile ) : |
| 70 | sIn( sFile ), | 70 | sIn( sFile ), |
| 71 | fIn( sFile, File::Read ), | 71 | fIn( sFile, File::Read ), |
| 72 | bIn( fIn ), | 72 | bIn( fIn ), |
| @@ -99,10 +99,10 @@ public: | |||
| 99 | return cBuf; | 99 | return cBuf; |
| 100 | } | 100 | } |
| 101 | 101 | ||
| 102 | TokType nextToken( Variant &v, Bu::FString &sWsOut, int &iLineStart, | 102 | TokType nextToken( Variant &v, Bu::String &sWsOut, int &iLineStart, |
| 103 | int &iCharStart ) | 103 | int &iCharStart ) |
| 104 | { | 104 | { |
| 105 | Bu::FString sTok, sWs; | 105 | Bu::String sTok, sWs; |
| 106 | 106 | ||
| 107 | char buf; | 107 | char buf; |
| 108 | try | 108 | try |
| @@ -307,7 +307,7 @@ public: | |||
| 307 | void firstPass() | 307 | void firstPass() |
| 308 | { | 308 | { |
| 309 | Variant v; | 309 | Variant v; |
| 310 | Bu::FString sWs; | 310 | Bu::String sWs; |
| 311 | int iL, iC; | 311 | int iL, iC; |
| 312 | for(;;) | 312 | for(;;) |
| 313 | { | 313 | { |
| @@ -322,7 +322,7 @@ public: | |||
| 322 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) | 322 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) |
| 323 | throw Bu::ExceptionBase("%d:%d: Expected string " | 323 | throw Bu::ExceptionBase("%d:%d: Expected string " |
| 324 | "following suite.", iL, iC ); | 324 | "following suite.", iL, iC ); |
| 325 | s.sName = v.get<Bu::FString>(); | 325 | s.sName = v.get<Bu::String>(); |
| 326 | if( nextToken( v, sWs, iL, iC ) != tokChar || | 326 | if( nextToken( v, sWs, iL, iC ) != tokChar || |
| 327 | v.get<char>() != '{' ) | 327 | v.get<char>() != '{' ) |
| 328 | throw Bu::ExceptionBase("%d:%d: Expected {, got " | 328 | throw Bu::ExceptionBase("%d:%d: Expected {, got " |
| @@ -346,7 +346,7 @@ public: | |||
| 346 | throw Bu::ExceptionBase("%d:%d: Expected " | 346 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 347 | "string following test.", iL, iC ); | 347 | "string following test.", iL, iC ); |
| 348 | Test t; | 348 | Test t; |
| 349 | t.sName = v.get<Bu::FString>(); | 349 | t.sName = v.get<Bu::String>(); |
| 350 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) | 350 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) |
| 351 | throw Bu::ExceptionBase("%d:%d: Expected " | 351 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 352 | "{...} block.", | 352 | "{...} block.", |
| @@ -380,7 +380,7 @@ public: | |||
| 380 | } | 380 | } |
| 381 | } | 381 | } |
| 382 | 382 | ||
| 383 | void secondPass( const Bu::FString &sOut ) | 383 | void secondPass( const Bu::String &sOut ) |
| 384 | { | 384 | { |
| 385 | File fOut( sOut, File::WriteNew ); | 385 | File fOut( sOut, File::WriteNew ); |
| 386 | Formatter f( fOut ); | 386 | Formatter f( fOut ); |
| @@ -393,7 +393,7 @@ public: | |||
| 393 | iChar = 0; | 393 | iChar = 0; |
| 394 | bool bHasIncluded = false; | 394 | bool bHasIncluded = false; |
| 395 | 395 | ||
| 396 | Bu::FString sWs; | 396 | Bu::String sWs; |
| 397 | Variant v; | 397 | Variant v; |
| 398 | int iL, iC; | 398 | int iL, iC; |
| 399 | for(;;) | 399 | for(;;) |
| @@ -408,7 +408,7 @@ public: | |||
| 408 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) | 408 | if( nextToken( v, sWs, iL, iC ) != tokFluff ) |
| 409 | throw Bu::ExceptionBase("%d:%d: Expected string " | 409 | throw Bu::ExceptionBase("%d:%d: Expected string " |
| 410 | "following suite.", iL, iC ); | 410 | "following suite.", iL, iC ); |
| 411 | s.sName = v.get<Bu::FString>(); | 411 | s.sName = v.get<Bu::String>(); |
| 412 | if( nextToken( v, sWs, iL, iC ) != tokChar || | 412 | if( nextToken( v, sWs, iL, iC ) != tokChar || |
| 413 | v.get<char>() != '{' ) | 413 | v.get<char>() != '{' ) |
| 414 | throw Bu::ExceptionBase("%d:%d: Expected {", | 414 | throw Bu::ExceptionBase("%d:%d: Expected {", |
| @@ -421,7 +421,7 @@ public: | |||
| 421 | bHasIncluded = true; | 421 | bHasIncluded = true; |
| 422 | } | 422 | } |
| 423 | 423 | ||
| 424 | Bu::FString sClass = "_UnitSuite_" + s.sName; | 424 | Bu::String sClass = "_UnitSuite_" + s.sName; |
| 425 | f << "class " << sClass | 425 | f << "class " << sClass |
| 426 | << " : public Bu::UnitSuite" << f.nl | 426 | << " : public Bu::UnitSuite" << f.nl |
| 427 | << "{" << f.nl << "public:" << f.nl | 427 | << "{" << f.nl << "public:" << f.nl |
| @@ -441,7 +441,7 @@ public: | |||
| 441 | } | 441 | } |
| 442 | else if( t == tokEof ) | 442 | else if( t == tokEof ) |
| 443 | { | 443 | { |
| 444 | Bu::FString sClass = "_UnitSuite_" + s.sName; | 444 | Bu::String sClass = "_UnitSuite_" + s.sName; |
| 445 | f << sWs << f.nl << "int main( int argc, char *argv[] )" | 445 | f << sWs << f.nl << "int main( int argc, char *argv[] )" |
| 446 | << f.nl << "{" << f.nl << "\treturn " << sClass | 446 | << f.nl << "{" << f.nl << "\treturn " << sClass |
| 447 | << "().run( argc, argv );" << f.nl << "}" << f.nl; | 447 | << "().run( argc, argv );" << f.nl << "}" << f.nl; |
| @@ -458,7 +458,7 @@ public: | |||
| 458 | { | 458 | { |
| 459 | case tokFluff: | 459 | case tokFluff: |
| 460 | fOut.write( sWs ); | 460 | fOut.write( sWs ); |
| 461 | fOut.write( v.get<Bu::FString>() ); | 461 | fOut.write( v.get<Bu::String>() ); |
| 462 | break; | 462 | break; |
| 463 | 463 | ||
| 464 | case tokTest: | 464 | case tokTest: |
| @@ -468,7 +468,7 @@ public: | |||
| 468 | throw Bu::ExceptionBase("%d:%d: Expected " | 468 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 469 | "string following test.", iL, iC ); | 469 | "string following test.", iL, iC ); |
| 470 | Test t; | 470 | Test t; |
| 471 | t.sName = v.get<Bu::FString>(); | 471 | t.sName = v.get<Bu::String>(); |
| 472 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) | 472 | if( nextToken( v, sWs, iL, iC ) != tokBlock ) |
| 473 | throw Bu::ExceptionBase("%d:%d: Expected " | 473 | throw Bu::ExceptionBase("%d:%d: Expected " |
| 474 | "{...} block.", | 474 | "{...} block.", |
| @@ -499,7 +499,7 @@ public: | |||
| 499 | fOut.write( sWs ); | 499 | fOut.write( sWs ); |
| 500 | f << f.nl << "#line " << iL << " \"" << sIn | 500 | f << f.nl << "#line " << iL << " \"" << sIn |
| 501 | << "\"" << f.nl; | 501 | << "\"" << f.nl; |
| 502 | fOut.write( v.get<Bu::FString>() ); | 502 | fOut.write( v.get<Bu::String>() ); |
| 503 | 503 | ||
| 504 | break; | 504 | break; |
| 505 | 505 | ||
| @@ -521,7 +521,7 @@ public: | |||
| 521 | } | 521 | } |
| 522 | 522 | ||
| 523 | private: | 523 | private: |
| 524 | Bu::FString sIn; | 524 | Bu::String sIn; |
| 525 | File fIn; | 525 | File fIn; |
| 526 | Buffer bIn; | 526 | Buffer bIn; |
| 527 | char cBuf; | 527 | char cBuf; |
diff --git a/src/tools/myriad.cpp b/src/tools/myriad.cpp index b6e435d..7d7956e 100644 --- a/src/tools/myriad.cpp +++ b/src/tools/myriad.cpp | |||
| @@ -75,9 +75,9 @@ public: | |||
| 75 | int iBlockSize; | 75 | int iBlockSize; |
| 76 | int iPreallocate; | 76 | int iPreallocate; |
| 77 | int iStream; | 77 | int iStream; |
| 78 | Bu::FString sFile; | 78 | Bu::String sFile; |
| 79 | Bu::FString sSrc; | 79 | Bu::String sSrc; |
| 80 | Bu::FString sDst; | 80 | Bu::String sDst; |
| 81 | }; | 81 | }; |
| 82 | 82 | ||
| 83 | Bu::Formatter &operator>>( Bu::Formatter &f, Mode &e ) | 83 | Bu::Formatter &operator>>( Bu::Formatter &f, Mode &e ) |
diff --git a/src/tools/parser.cpp b/src/tools/parser.cpp index 7933f31..8350343 100644 --- a/src/tools/parser.cpp +++ b/src/tools/parser.cpp | |||
| @@ -118,7 +118,7 @@ public: | |||
| 118 | case '8': | 118 | case '8': |
| 119 | case '9': | 119 | case '9': |
| 120 | { | 120 | { |
| 121 | Bu::FString sTmp; | 121 | Bu::String sTmp; |
| 122 | sTmp += b; | 122 | sTmp += b; |
| 123 | qbIn.seek( 1 ); | 123 | qbIn.seek( 1 ); |
| 124 | for(;;) | 124 | for(;;) |
diff --git a/src/tools/viewcsv.cpp b/src/tools/viewcsv.cpp index d81525e..9be1291 100644 --- a/src/tools/viewcsv.cpp +++ b/src/tools/viewcsv.cpp | |||
| @@ -38,7 +38,7 @@ public: | |||
| 38 | return 0; | 38 | return 0; |
| 39 | } | 39 | } |
| 40 | 40 | ||
| 41 | Bu::FString sFileIn; | 41 | Bu::String sFileIn; |
| 42 | bool bHeader; | 42 | bool bHeader; |
| 43 | }; | 43 | }; |
| 44 | 44 | ||
| @@ -245,10 +245,10 @@ public: | |||
| 245 | setHeaderRow( !bHeaderRow ); | 245 | setHeaderRow( !bHeaderRow ); |
| 246 | } | 246 | } |
| 247 | 247 | ||
| 248 | Bu::FString prompt( const Bu::FString &sPrompt ) | 248 | Bu::String prompt( const Bu::String &sPrompt ) |
| 249 | { | 249 | { |
| 250 | int maxx, maxy; | 250 | int maxx, maxy; |
| 251 | Bu::FString sStr; | 251 | Bu::String sStr; |
| 252 | 252 | ||
| 253 | RegEx re( sPrompt ); | 253 | RegEx re( sPrompt ); |
| 254 | 254 | ||
| @@ -292,7 +292,7 @@ public: | |||
| 292 | sysCaret.reset(); | 292 | sysCaret.reset(); |
| 293 | } | 293 | } |
| 294 | 294 | ||
| 295 | void findNext( const Bu::FString &sTerm ) | 295 | void findNext( const Bu::String &sTerm ) |
| 296 | { | 296 | { |
| 297 | RegEx re( sTerm ); | 297 | RegEx re( sTerm ); |
| 298 | 298 | ||
| @@ -398,7 +398,7 @@ int main( int argc, char *argv[] ) | |||
| 398 | CsvView view( doc ); | 398 | CsvView view( doc ); |
| 399 | view.setHeaderRow( opt.bHeader ); | 399 | view.setHeaderRow( opt.bHeader ); |
| 400 | 400 | ||
| 401 | Bu::FString sSearchTerm; | 401 | Bu::String sSearchTerm; |
| 402 | 402 | ||
| 403 | bool bRun = true; | 403 | bool bRun = true; |
| 404 | do | 404 | do |
diff --git a/src/unit/archive.unit b/src/unit/archive.unit index a7f2640..07e5e11 100644 --- a/src/unit/archive.unit +++ b/src/unit/archive.unit | |||
| @@ -105,7 +105,7 @@ suite Archive | |||
| 105 | MemBuf mb; | 105 | MemBuf mb; |
| 106 | { | 106 | { |
| 107 | Archive ar( mb, Archive::save ); | 107 | Archive ar( mb, Archive::save ); |
| 108 | FString sStr("This is a test string."); | 108 | String sStr("This is a test string."); |
| 109 | List<int> lList; | 109 | List<int> lList; |
| 110 | lList.append( 10 ); | 110 | lList.append( 10 ); |
| 111 | lList.append( 20 ); | 111 | lList.append( 20 ); |
| @@ -118,7 +118,7 @@ suite Archive | |||
| 118 | mb.setPos( 0 ); | 118 | mb.setPos( 0 ); |
| 119 | { | 119 | { |
| 120 | Archive ar( mb, Archive::load ); | 120 | Archive ar( mb, Archive::load ); |
| 121 | FString sStr; | 121 | String sStr; |
| 122 | List<int> lList; | 122 | List<int> lList; |
| 123 | ar >> sStr; | 123 | ar >> sStr; |
| 124 | ar >> lList; | 124 | ar >> lList; |
| @@ -138,7 +138,7 @@ suite Archive | |||
| 138 | MemBuf mb; | 138 | MemBuf mb; |
| 139 | { | 139 | { |
| 140 | Archive ar( mb, Archive::save ); | 140 | Archive ar( mb, Archive::save ); |
| 141 | FString sStr("This is a test string."); | 141 | String sStr("This is a test string."); |
| 142 | Array<int> lArray; | 142 | Array<int> lArray; |
| 143 | lArray.append( 10 ); | 143 | lArray.append( 10 ); |
| 144 | lArray.append( 20 ); | 144 | lArray.append( 20 ); |
| @@ -151,7 +151,7 @@ suite Archive | |||
| 151 | mb.setPos( 0 ); | 151 | mb.setPos( 0 ); |
| 152 | { | 152 | { |
| 153 | Archive ar( mb, Archive::load ); | 153 | Archive ar( mb, Archive::load ); |
| 154 | FString sStr; | 154 | String sStr; |
| 155 | Array<int> lArray; | 155 | Array<int> lArray; |
| 156 | ar >> sStr; | 156 | ar >> sStr; |
| 157 | ar >> lArray; | 157 | ar >> lArray; |
| @@ -171,7 +171,7 @@ suite Archive | |||
| 171 | MemBuf mb; | 171 | MemBuf mb; |
| 172 | { | 172 | { |
| 173 | Archive ar( mb, Archive::save ); | 173 | Archive ar( mb, Archive::save ); |
| 174 | Array<FString> lArray; | 174 | Array<String> lArray; |
| 175 | lArray.append( "10" ); | 175 | lArray.append( "10" ); |
| 176 | lArray.append( "20" ); | 176 | lArray.append( "20" ); |
| 177 | lArray.append( "30" ); | 177 | lArray.append( "30" ); |
| @@ -182,10 +182,10 @@ suite Archive | |||
| 182 | mb.setPos( 0 ); | 182 | mb.setPos( 0 ); |
| 183 | { | 183 | { |
| 184 | Archive ar( mb, Archive::load ); | 184 | Archive ar( mb, Archive::load ); |
| 185 | Array<FString> lArray; | 185 | Array<String> lArray; |
| 186 | ar >> lArray; | 186 | ar >> lArray; |
| 187 | unitTest( lArray.getSize() == 4 ); | 187 | unitTest( lArray.getSize() == 4 ); |
| 188 | Array<FString>::iterator i = lArray.begin(); | 188 | Array<String>::iterator i = lArray.begin(); |
| 189 | unitTest( *i == "10" ); i++; | 189 | unitTest( *i == "10" ); i++; |
| 190 | unitTest( *i == "20" ); i++; | 190 | unitTest( *i == "20" ); i++; |
| 191 | unitTest( *i == "30" ); i++; | 191 | unitTest( *i == "30" ); i++; |
diff --git a/src/unit/array.unit b/src/unit/array.unit index f3fdeda..4dc75d8 100644 --- a/src/unit/array.unit +++ b/src/unit/array.unit | |||
| @@ -55,7 +55,7 @@ suite Array | |||
| 55 | 55 | ||
| 56 | test copy | 56 | test copy |
| 57 | { | 57 | { |
| 58 | typedef Bu::Hash<Bu::FString, Bu::FString> StrHash; | 58 | typedef Bu::Hash<Bu::String, Bu::String> StrHash; |
| 59 | typedef Bu::Array<StrHash> StrHashArray; | 59 | typedef Bu::Array<StrHash> StrHashArray; |
| 60 | 60 | ||
| 61 | StrHash h1; | 61 | StrHash h1; |
diff --git a/src/unit/buffer.unit b/src/unit/buffer.unit index 8ed1ec5..2a8f846 100644 --- a/src/unit/buffer.unit +++ b/src/unit/buffer.unit | |||
| @@ -14,12 +14,12 @@ suite Buffer | |||
| 14 | { | 14 | { |
| 15 | test emptyFile | 15 | test emptyFile |
| 16 | { | 16 | { |
| 17 | Bu::FString sTmp("empty-XXXXXX"); | 17 | Bu::String sTmp("empty-XXXXXX"); |
| 18 | Bu::File fEmpty = tempFile(sTmp); | 18 | Bu::File fEmpty = tempFile(sTmp); |
| 19 | Bu::Buffer buf( fEmpty ); | 19 | Bu::Buffer buf( fEmpty ); |
| 20 | 20 | ||
| 21 | unitTest( buf.isEos() == false ); | 21 | unitTest( buf.isEos() == false ); |
| 22 | Bu::FString sLine = buf.readLine(); | 22 | Bu::String sLine = buf.readLine(); |
| 23 | unitTest( sLine == "" ); | 23 | unitTest( sLine == "" ); |
| 24 | unitTest( fEmpty.isEos() == true ); | 24 | unitTest( fEmpty.isEos() == true ); |
| 25 | unitTest( buf.isEos() == true ); | 25 | unitTest( buf.isEos() == true ); |
diff --git a/src/unit/fstring.unit b/src/unit/fstring.unit index c6d7414..d282052 100644 --- a/src/unit/fstring.unit +++ b/src/unit/fstring.unit | |||
| @@ -6,29 +6,29 @@ | |||
| 6 | * terms of the license contained in the file LICENSE. | 6 | * terms of the license contained in the file LICENSE. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | 10 | ||
| 11 | #include <dirent.h> | 11 | #include <dirent.h> |
| 12 | 12 | ||
| 13 | suite FString | 13 | suite String |
| 14 | { | 14 | { |
| 15 | test compare1 | 15 | test compare1 |
| 16 | { | 16 | { |
| 17 | Bu::FString b("Bob"); | 17 | Bu::String b("Bob"); |
| 18 | unitTest( !(b == "Bobo") ); | 18 | unitTest( !(b == "Bobo") ); |
| 19 | unitTest( b == "Bob" ); | 19 | unitTest( b == "Bob" ); |
| 20 | } | 20 | } |
| 21 | 21 | ||
| 22 | test compare2 | 22 | test compare2 |
| 23 | { | 23 | { |
| 24 | Bu::FString b("Bobo"); | 24 | Bu::String b("Bobo"); |
| 25 | unitTest( !(b == "Bob") ); | 25 | unitTest( !(b == "Bob") ); |
| 26 | unitTest( b == "Bobo" ); | 26 | unitTest( b == "Bobo" ); |
| 27 | } | 27 | } |
| 28 | 28 | ||
| 29 | test appendSingle | 29 | test appendSingle |
| 30 | { | 30 | { |
| 31 | Bu::FString b; | 31 | Bu::String b; |
| 32 | for( char l = 'a'; l < 'g'; l++ ) | 32 | for( char l = 'a'; l < 'g'; l++ ) |
| 33 | b += l; | 33 | b += l; |
| 34 | unitTest( b == "abcdef" ); | 34 | unitTest( b == "abcdef" ); |
| @@ -37,8 +37,8 @@ suite FString | |||
| 37 | 37 | ||
| 38 | test shared1 | 38 | test shared1 |
| 39 | { | 39 | { |
| 40 | Bu::FString a("Hey there"); | 40 | Bu::String a("Hey there"); |
| 41 | Bu::FString b( a ); | 41 | Bu::String b( a ); |
| 42 | unitTest( a.getConstStr() == b.getConstStr() ); | 42 | unitTest( a.getConstStr() == b.getConstStr() ); |
| 43 | b += " guy"; | 43 | b += " guy"; |
| 44 | unitTest( a.getConstStr() != b.getConstStr() ); | 44 | unitTest( a.getConstStr() != b.getConstStr() ); |
| @@ -48,7 +48,7 @@ suite FString | |||
| 48 | 48 | ||
| 49 | test insert | 49 | test insert |
| 50 | { | 50 | { |
| 51 | Bu::FString a("abcd"); | 51 | Bu::String a("abcd"); |
| 52 | a.insert( 2, "-!-", 3 ); | 52 | a.insert( 2, "-!-", 3 ); |
| 53 | unitTest( a == "ab-!-cd" ); | 53 | unitTest( a == "ab-!-cd" ); |
| 54 | 54 | ||
| @@ -67,7 +67,7 @@ suite FString | |||
| 67 | 67 | ||
| 68 | test remove | 68 | test remove |
| 69 | { | 69 | { |
| 70 | Bu::FString a("abHEYcd"); | 70 | Bu::String a("abHEYcd"); |
| 71 | a.remove( 2, 3 ); | 71 | a.remove( 2, 3 ); |
| 72 | unitTest( a == "abcd" ); | 72 | unitTest( a == "abcd" ); |
| 73 | a.remove( 2, 5 ); | 73 | a.remove( 2, 5 ); |
| @@ -79,42 +79,42 @@ suite FString | |||
| 79 | 79 | ||
| 80 | test add1 | 80 | test add1 |
| 81 | { | 81 | { |
| 82 | Bu::FString a("hi there"); | 82 | Bu::String a("hi there"); |
| 83 | Bu::FString b(", yeah!"); | 83 | Bu::String b(", yeah!"); |
| 84 | Bu::FString c = a + b; | 84 | Bu::String c = a + b; |
| 85 | 85 | ||
| 86 | unitTest( c == "hi there, yeah!" ); | 86 | unitTest( c == "hi there, yeah!" ); |
| 87 | } | 87 | } |
| 88 | 88 | ||
| 89 | test add2 | 89 | test add2 |
| 90 | { | 90 | { |
| 91 | Bu::FString a("hi there"); | 91 | Bu::String a("hi there"); |
| 92 | Bu::FString c = a + ", yeah!"; | 92 | Bu::String c = a + ", yeah!"; |
| 93 | 93 | ||
| 94 | unitTest( c == "hi there, yeah!" ); | 94 | unitTest( c == "hi there, yeah!" ); |
| 95 | } | 95 | } |
| 96 | 96 | ||
| 97 | test add3 | 97 | test add3 |
| 98 | { | 98 | { |
| 99 | Bu::FString a("hi there"); | 99 | Bu::String a("hi there"); |
| 100 | Bu::FString b(", yeah!"); | 100 | Bu::String b(", yeah!"); |
| 101 | Bu::FString c = a + ", Mr. Man" + b; | 101 | Bu::String c = a + ", Mr. Man" + b; |
| 102 | 102 | ||
| 103 | unitTest( c == "hi there, Mr. Man, yeah!" ); | 103 | unitTest( c == "hi there, Mr. Man, yeah!" ); |
| 104 | } | 104 | } |
| 105 | 105 | ||
| 106 | test add4 | 106 | test add4 |
| 107 | { | 107 | { |
| 108 | Bu::FString b(", yeah!"); | 108 | Bu::String b(", yeah!"); |
| 109 | Bu::FString c = "hi there" + b; | 109 | Bu::String c = "hi there" + b; |
| 110 | 110 | ||
| 111 | unitTest( c == "hi there, yeah!" ); | 111 | unitTest( c == "hi there, yeah!" ); |
| 112 | } | 112 | } |
| 113 | 113 | ||
| 114 | test add5 | 114 | test add5 |
| 115 | { | 115 | { |
| 116 | Bu::FString b; | 116 | Bu::String b; |
| 117 | Bu::FString c = "sup?"; | 117 | Bu::String c = "sup?"; |
| 118 | b += "hey, " + c; | 118 | b += "hey, " + c; |
| 119 | 119 | ||
| 120 | unitTest( b == "hey, sup?" ); | 120 | unitTest( b == "hey, sup?" ); |
| @@ -122,17 +122,17 @@ suite FString | |||
| 122 | 122 | ||
| 123 | test add6 | 123 | test add6 |
| 124 | { | 124 | { |
| 125 | Bu::FString a("Hello"); | 125 | Bu::String a("Hello"); |
| 126 | char b[256] = {"Dude"}; | 126 | char b[256] = {"Dude"}; |
| 127 | Bu::FString c = a + "/" + b; | 127 | Bu::String c = a + "/" + b; |
| 128 | 128 | ||
| 129 | unitTest( c == "Hello/Dude" ); | 129 | unitTest( c == "Hello/Dude" ); |
| 130 | } | 130 | } |
| 131 | 131 | ||
| 132 | test add7 | 132 | test add7 |
| 133 | { | 133 | { |
| 134 | const Bu::FString a("hello "); | 134 | const Bu::String a("hello "); |
| 135 | Bu::FString b(" how "); | 135 | Bu::String b(" how "); |
| 136 | unitTest( a == "hello " ); | 136 | unitTest( a == "hello " ); |
| 137 | unitTest( a + "dude" == "hello dude" ); | 137 | unitTest( a + "dude" == "hello dude" ); |
| 138 | unitTest( a + "dude" + b + "are you?" == "hello dude how are you?" ); | 138 | unitTest( a + "dude" + b + "are you?" == "hello dude how are you?" ); |
| @@ -140,16 +140,16 @@ suite FString | |||
| 140 | 140 | ||
| 141 | test subStr1 | 141 | test subStr1 |
| 142 | { | 142 | { |
| 143 | Bu::FString a("abcdefghijklmnop"); | 143 | Bu::String a("abcdefghijklmnop"); |
| 144 | Bu::FString::iterator i = a.find('f'); | 144 | Bu::String::iterator i = a.find('f'); |
| 145 | unitTest( a.getSubStr( i, Bu::FString::iterator() ) == "fghijklmnop" ); | 145 | unitTest( a.getSubStr( i, Bu::String::iterator() ) == "fghijklmnop" ); |
| 146 | Bu::FString::iterator j = i.find('l'); | 146 | Bu::String::iterator j = i.find('l'); |
| 147 | unitTest( a.getSubStr( i, j ) == "fghijk" ); | 147 | unitTest( a.getSubStr( i, j ) == "fghijk" ); |
| 148 | } | 148 | } |
| 149 | 149 | ||
| 150 | test compareSub1 | 150 | test compareSub1 |
| 151 | { | 151 | { |
| 152 | Bu::FString a("just a string."); | 152 | Bu::String a("just a string."); |
| 153 | unitTest( a.compareSub("a ", 5, 2) == true ); | 153 | unitTest( a.compareSub("a ", 5, 2) == true ); |
| 154 | unitTest( a.compareSub("string.aoeu", 7, 11 ) == false ); | 154 | unitTest( a.compareSub("string.aoeu", 7, 11 ) == false ); |
| 155 | unitTest( a.compareSub("string.aoeu", 7, 3 ) == true ); | 155 | unitTest( a.compareSub("string.aoeu", 7, 3 ) == true ); |
| @@ -157,17 +157,17 @@ suite FString | |||
| 157 | 157 | ||
| 158 | test compareSub2 | 158 | test compareSub2 |
| 159 | { | 159 | { |
| 160 | Bu::FString a("just a string."); | 160 | Bu::String a("just a string."); |
| 161 | unitTest( a.compareSub(Bu::FString("a "), 5, 2) == true ); | 161 | unitTest( a.compareSub(Bu::String("a "), 5, 2) == true ); |
| 162 | unitTest( a.compareSub(Bu::FString("string.aoeu"), 7, 11 ) == false ); | 162 | unitTest( a.compareSub(Bu::String("string.aoeu"), 7, 11 ) == false ); |
| 163 | unitTest( a.compareSub(Bu::FString("string.aoeu"), 7, 3 ) == true ); | 163 | unitTest( a.compareSub(Bu::String("string.aoeu"), 7, 3 ) == true ); |
| 164 | } | 164 | } |
| 165 | 165 | ||
| 166 | test iterator1 | 166 | test iterator1 |
| 167 | { | 167 | { |
| 168 | Bu::FString a("This is a test."); | 168 | Bu::String a("This is a test."); |
| 169 | Bu::FString b; | 169 | Bu::String b; |
| 170 | for( Bu::FString::iterator i = a.begin(); i; i++ ) | 170 | for( Bu::String::iterator i = a.begin(); i; i++ ) |
| 171 | { | 171 | { |
| 172 | b += *i; | 172 | b += *i; |
| 173 | } | 173 | } |
| @@ -176,10 +176,10 @@ suite FString | |||
| 176 | 176 | ||
| 177 | test iterator2 | 177 | test iterator2 |
| 178 | { | 178 | { |
| 179 | Bu::FString a("This is a test."); | 179 | Bu::String a("This is a test."); |
| 180 | Bu::FString b("--This is a test."); | 180 | Bu::String b("--This is a test."); |
| 181 | Bu::FString::iterator ai = a.begin(); | 181 | Bu::String::iterator ai = a.begin(); |
| 182 | Bu::FString::iterator bi = b.begin(); | 182 | Bu::String::iterator bi = b.begin(); |
| 183 | unitTest( ai.compare( bi ) == false ); | 183 | unitTest( ai.compare( bi ) == false ); |
| 184 | unitTest( bi.compare( ai ) == false ); | 184 | unitTest( bi.compare( ai ) == false ); |
| 185 | bi++; bi++; | 185 | bi++; bi++; |
| @@ -189,10 +189,10 @@ suite FString | |||
| 189 | 189 | ||
| 190 | test iterator3 | 190 | test iterator3 |
| 191 | { | 191 | { |
| 192 | Bu::FString a("1234honour"); | 192 | Bu::String a("1234honour"); |
| 193 | Bu::FString b("--1234ueje"); | 193 | Bu::String b("--1234ueje"); |
| 194 | Bu::FString::iterator ai = a.begin(); | 194 | Bu::String::iterator ai = a.begin(); |
| 195 | Bu::FString::iterator bi = b.begin(); | 195 | Bu::String::iterator bi = b.begin(); |
| 196 | unitTest( ai.compare( bi, 4 ) == false ); | 196 | unitTest( ai.compare( bi, 4 ) == false ); |
| 197 | unitTest( bi.compare( ai, 4 ) == false ); | 197 | unitTest( bi.compare( ai, 4 ) == false ); |
| 198 | bi++; bi++; | 198 | bi++; bi++; |
| @@ -205,8 +205,8 @@ suite FString | |||
| 205 | 205 | ||
| 206 | test iterator4 | 206 | test iterator4 |
| 207 | { | 207 | { |
| 208 | Bu::FString a("1234aoeu"); | 208 | Bu::String a("1234aoeu"); |
| 209 | Bu::FString::iterator ai = a.begin(); | 209 | Bu::String::iterator ai = a.begin(); |
| 210 | unitTest( ai.compare("1234") == false ); | 210 | unitTest( ai.compare("1234") == false ); |
| 211 | unitTest( ai.compare("1234aoeu") == true ); | 211 | unitTest( ai.compare("1234aoeu") == true ); |
| 212 | unitTest( ai.compare("1234aoeuee") == false ); | 212 | unitTest( ai.compare("1234aoeuee") == false ); |
| @@ -214,8 +214,8 @@ suite FString | |||
| 214 | 214 | ||
| 215 | test iterator5 | 215 | test iterator5 |
| 216 | { | 216 | { |
| 217 | Bu::FString a("1234aoeu"); | 217 | Bu::String a("1234aoeu"); |
| 218 | Bu::FString::iterator ai = a.begin(); | 218 | Bu::String::iterator ai = a.begin(); |
| 219 | unitTest( ai.compare("1234", 4) == true ); | 219 | unitTest( ai.compare("1234", 4) == true ); |
| 220 | unitTest( ai.compare("1234aoeu", 8) == true ); | 220 | unitTest( ai.compare("1234aoeu", 8) == true ); |
| 221 | unitTest( ai.compare("1234aoeuee", 10) == false ); | 221 | unitTest( ai.compare("1234aoeuee", 10) == false ); |
| @@ -223,9 +223,9 @@ suite FString | |||
| 223 | 223 | ||
| 224 | test iterator6 | 224 | test iterator6 |
| 225 | { | 225 | { |
| 226 | Bu::FString a("just ->this part"); | 226 | Bu::String a("just ->this part"); |
| 227 | Bu::FString b; | 227 | Bu::String b; |
| 228 | Bu::FString::iterator s = a.begin(); | 228 | Bu::String::iterator s = a.begin(); |
| 229 | for(; s; s++ ) | 229 | for(; s; s++ ) |
| 230 | { | 230 | { |
| 231 | if( *s == '>' ) | 231 | if( *s == '>' ) |
| @@ -239,7 +239,7 @@ suite FString | |||
| 239 | 239 | ||
| 240 | b.append( s ); | 240 | b.append( s ); |
| 241 | 241 | ||
| 242 | Bu::FString c; | 242 | Bu::String c; |
| 243 | c.set( b.begin() ); | 243 | c.set( b.begin() ); |
| 244 | 244 | ||
| 245 | // This is here because the comparison operator used to cause flattening. | 245 | // This is here because the comparison operator used to cause flattening. |
| @@ -249,9 +249,9 @@ suite FString | |||
| 249 | 249 | ||
| 250 | test iterator7 | 250 | test iterator7 |
| 251 | { | 251 | { |
| 252 | Bu::FString a("just [this] part"); | 252 | Bu::String a("just [this] part"); |
| 253 | Bu::FString b; | 253 | Bu::String b; |
| 254 | Bu::FString::iterator s = a.begin(); | 254 | Bu::String::iterator s = a.begin(); |
| 255 | for(; s; s++ ) | 255 | for(; s; s++ ) |
| 256 | { | 256 | { |
| 257 | if( *s == '[' ) | 257 | if( *s == '[' ) |
| @@ -260,7 +260,7 @@ suite FString | |||
| 260 | break; | 260 | break; |
| 261 | } | 261 | } |
| 262 | } | 262 | } |
| 263 | Bu::FString::iterator e = s; | 263 | Bu::String::iterator e = s; |
| 264 | for(; e; e++ ) | 264 | for(; e; e++ ) |
| 265 | { | 265 | { |
| 266 | if( *e == ']' ) | 266 | if( *e == ']' ) |
| @@ -273,9 +273,9 @@ suite FString | |||
| 273 | 273 | ||
| 274 | b.append( s, e ); | 274 | b.append( s, e ); |
| 275 | 275 | ||
| 276 | for( Bu::FString::iterator i = b.begin(); i;) | 276 | for( Bu::String::iterator i = b.begin(); i;) |
| 277 | { | 277 | { |
| 278 | Bu::FString::iterator k = i; | 278 | Bu::String::iterator k = i; |
| 279 | k++; | 279 | k++; |
| 280 | if( !k ) | 280 | if( !k ) |
| 281 | { | 281 | { |
| @@ -284,12 +284,12 @@ suite FString | |||
| 284 | } | 284 | } |
| 285 | i = k; | 285 | i = k; |
| 286 | } | 286 | } |
| 287 | Bu::FString l; | 287 | Bu::String l; |
| 288 | l.set( b.begin() ); | 288 | l.set( b.begin() ); |
| 289 | unitTest( l == "thisthisthisthi" ); | 289 | unitTest( l == "thisthisthisthi" ); |
| 290 | for( Bu::FString::iterator i = b.begin(); i;) | 290 | for( Bu::String::iterator i = b.begin(); i;) |
| 291 | { | 291 | { |
| 292 | Bu::FString::iterator k = i; | 292 | Bu::String::iterator k = i; |
| 293 | k++; | 293 | k++; |
| 294 | if( !k ) | 294 | if( !k ) |
| 295 | { | 295 | { |
| @@ -304,7 +304,7 @@ suite FString | |||
| 304 | 304 | ||
| 305 | test isSet1 | 305 | test isSet1 |
| 306 | { | 306 | { |
| 307 | Bu::FString bob; | 307 | Bu::String bob; |
| 308 | 308 | ||
| 309 | unitTest( bob.isSet() == false ); | 309 | unitTest( bob.isSet() == false ); |
| 310 | bob = "something"; | 310 | bob = "something"; |
| @@ -315,7 +315,7 @@ suite FString | |||
| 315 | 315 | ||
| 316 | test swap1 | 316 | test swap1 |
| 317 | { | 317 | { |
| 318 | Bu::FString a, b; | 318 | Bu::String a, b; |
| 319 | a = "Goodbye"; | 319 | a = "Goodbye"; |
| 320 | b = "Hello"; | 320 | b = "Hello"; |
| 321 | Bu::swap( a, b ); | 321 | Bu::swap( a, b ); |
| @@ -325,7 +325,7 @@ suite FString | |||
| 325 | 325 | ||
| 326 | test swap2 | 326 | test swap2 |
| 327 | { | 327 | { |
| 328 | Bu::FString a, b; | 328 | Bu::String a, b; |
| 329 | a = "Goodbye"; | 329 | a = "Goodbye"; |
| 330 | b = "Hello"; | 330 | b = "Hello"; |
| 331 | std::swap( a, b ); | 331 | std::swap( a, b ); |
| @@ -335,14 +335,14 @@ suite FString | |||
| 335 | 335 | ||
| 336 | test replace1 | 336 | test replace1 |
| 337 | { | 337 | { |
| 338 | Bu::FString a; | 338 | Bu::String a; |
| 339 | a = "This is a test."; | 339 | a = "This is a test."; |
| 340 | unitTest( a.replace("i", "ooo") == "Thooos ooos a test." ); | 340 | unitTest( a.replace("i", "ooo") == "Thooos ooos a test." ); |
| 341 | } | 341 | } |
| 342 | 342 | ||
| 343 | test coreDerefBug1 | 343 | test coreDerefBug1 |
| 344 | { | 344 | { |
| 345 | Bu::FString a, b; | 345 | Bu::String a, b; |
| 346 | a = "bob"; | 346 | a = "bob"; |
| 347 | a.setSize( 0 ); | 347 | a.setSize( 0 ); |
| 348 | b = a; | 348 | b = a; |
diff --git a/src/unit/hash.unit b/src/unit/hash.unit index 124b074..2c1cf6a 100644 --- a/src/unit/hash.unit +++ b/src/unit/hash.unit | |||
| @@ -6,14 +6,14 @@ | |||
| 6 | * terms of the license contained in the file LICENSE. | 6 | * terms of the license contained in the file LICENSE. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | #include "bu/hash.h" | 10 | #include "bu/hash.h" |
| 11 | 11 | ||
| 12 | #include <stdio.h> | 12 | #include <stdio.h> |
| 13 | 13 | ||
| 14 | typedef Bu::Hash<Bu::FString, int> StrIntHash; | 14 | typedef Bu::Hash<Bu::String, int> StrIntHash; |
| 15 | typedef Bu::Hash<Bu::FString, Bu::FString> StrStrHash; | 15 | typedef Bu::Hash<Bu::String, Bu::String> StrStrHash; |
| 16 | typedef Bu::Hash<int, Bu::FString> IntStrHash; | 16 | typedef Bu::Hash<int, Bu::String> IntStrHash; |
| 17 | 17 | ||
| 18 | suite Hash | 18 | suite Hash |
| 19 | { | 19 | { |
| @@ -24,7 +24,7 @@ suite Hash | |||
| 24 | for(int i=1;i<10000;i++) | 24 | for(int i=1;i<10000;i++) |
| 25 | { | 25 | { |
| 26 | sprintf(buf,"%d",i); | 26 | sprintf(buf,"%d",i); |
| 27 | Bu::FString sTmp(buf); | 27 | Bu::String sTmp(buf); |
| 28 | h[sTmp] = i; | 28 | h[sTmp] = i; |
| 29 | unitTest( h.has(sTmp) ); | 29 | unitTest( h.has(sTmp) ); |
| 30 | } | 30 | } |
diff --git a/src/unit/list.unit b/src/unit/list.unit index 66e45b2..24346a3 100644 --- a/src/unit/list.unit +++ b/src/unit/list.unit | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * terms of the license contained in the file LICENSE. | 6 | * terms of the license contained in the file LICENSE. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | #include "bu/list.h" | 10 | #include "bu/list.h" |
| 11 | 11 | ||
| 12 | typedef Bu::List<int> IntList; | 12 | typedef Bu::List<int> IntList; |
diff --git a/src/unit/myriad.unit b/src/unit/myriad.unit index ad8fb5d..5ac80a0 100644 --- a/src/unit/myriad.unit +++ b/src/unit/myriad.unit | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * terms of the license contained in the file LICENSE. | 6 | * terms of the license contained in the file LICENSE. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | #include "bu/file.h" | 10 | #include "bu/file.h" |
| 11 | #include "bu/myriad.h" | 11 | #include "bu/myriad.h" |
| 12 | #include "bu/myriadstream.h" | 12 | #include "bu/myriadstream.h" |
| @@ -56,7 +56,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) | |||
| 56 | { | 56 | { |
| 57 | int iRand = random()%128; | 57 | int iRand = random()%128; |
| 58 | // ar << iRand; | 58 | // ar << iRand; |
| 59 | Bu::FString sDat( iRand ); | 59 | Bu::String sDat( iRand ); |
| 60 | for( int j = 0; j < iRand; j++ ) | 60 | for( int j = 0; j < iRand; j++ ) |
| 61 | sDat[j] = (char)((uint8_t)(random()%256)); | 61 | sDat[j] = (char)((uint8_t)(random()%256)); |
| 62 | ar << sDat; | 62 | ar << sDat; |
| @@ -64,7 +64,7 @@ Bu::ArchiveBase &operator<<( Bu::ArchiveBase &ar, const VerifyObject &vo ) | |||
| 64 | sum.addData( sDat.getStr(), iRand ); | 64 | sum.addData( sDat.getStr(), iRand ); |
| 65 | vo.iBytesWritten += 4 + iRand; | 65 | vo.iBytesWritten += 4 + iRand; |
| 66 | } | 66 | } |
| 67 | Bu::FString sRes = sum.getResult(); | 67 | Bu::String sRes = sum.getResult(); |
| 68 | ar << sRes; | 68 | ar << sRes; |
| 69 | vo.iBytesWritten += 4 + sRes.getSize(); | 69 | vo.iBytesWritten += 4 + sRes.getSize(); |
| 70 | return ar; | 70 | return ar; |
| @@ -79,13 +79,13 @@ Bu::ArchiveBase &operator>>( Bu::ArchiveBase &ar, VerifyObject &vo ) | |||
| 79 | { | 79 | { |
| 80 | int iRand; | 80 | int iRand; |
| 81 | // ar >> iRand; | 81 | // ar >> iRand; |
| 82 | Bu::FString sStr; | 82 | Bu::String sStr; |
| 83 | ar >> sStr; | 83 | ar >> sStr; |
| 84 | iRand = sStr.getSize(); | 84 | iRand = sStr.getSize(); |
| 85 | sum.addData( &iRand, 4 ); | 85 | sum.addData( &iRand, 4 ); |
| 86 | sum.addData( sStr.getStr(), iRand ); | 86 | sum.addData( sStr.getStr(), iRand ); |
| 87 | } | 87 | } |
| 88 | Bu::FString sSum; | 88 | Bu::String sSum; |
| 89 | ar >> sSum; | 89 | ar >> sSum; |
| 90 | unitTest( sSum == sum.getResult() ); | 90 | unitTest( sSum == sum.getResult() ); |
| 91 | int iTooMuch; | 91 | int iTooMuch; |
| @@ -104,7 +104,7 @@ suite Myriad | |||
| 104 | { | 104 | { |
| 105 | test setSize | 105 | test setSize |
| 106 | { | 106 | { |
| 107 | FString sFileName("myriad-XXXXXXX"); | 107 | String sFileName("myriad-XXXXXXX"); |
| 108 | 108 | ||
| 109 | File fMyriad = tempFile( sFileName ); | 109 | File fMyriad = tempFile( sFileName ); |
| 110 | Myriad m( fMyriad, 32 ); | 110 | Myriad m( fMyriad, 32 ); |
| @@ -194,7 +194,7 @@ suite Myriad | |||
| 194 | 194 | ||
| 195 | test stressGrow | 195 | test stressGrow |
| 196 | { | 196 | { |
| 197 | FString sFileName("myriad-XXXXXXX"); | 197 | String sFileName("myriad-XXXXXXX"); |
| 198 | 198 | ||
| 199 | File fMyriad = tempFile( sFileName ); | 199 | File fMyriad = tempFile( sFileName ); |
| 200 | Myriad m( fMyriad ); | 200 | Myriad m( fMyriad ); |
| @@ -256,7 +256,7 @@ suite Myriad | |||
| 256 | 256 | ||
| 257 | test stressTruncate | 257 | test stressTruncate |
| 258 | { | 258 | { |
| 259 | FString sFileName("myriad-XXXXXXX"); | 259 | String sFileName("myriad-XXXXXXX"); |
| 260 | 260 | ||
| 261 | File fMyriad = tempFile( sFileName ); | 261 | File fMyriad = tempFile( sFileName ); |
| 262 | Myriad m( fMyriad ); | 262 | Myriad m( fMyriad ); |
| @@ -289,7 +289,7 @@ suite Myriad | |||
| 289 | 289 | ||
| 290 | test stressTruncate2 | 290 | test stressTruncate2 |
| 291 | { | 291 | { |
| 292 | FString sFileName("myriad-XXXXXXX"); | 292 | String sFileName("myriad-XXXXXXX"); |
| 293 | 293 | ||
| 294 | Array<int> aStream; | 294 | Array<int> aStream; |
| 295 | 295 | ||
| @@ -329,7 +329,7 @@ suite Myriad | |||
| 329 | 329 | ||
| 330 | test stressArchive | 330 | test stressArchive |
| 331 | { | 331 | { |
| 332 | FString sFileName("myriad-XXXXXX"); | 332 | String sFileName("myriad-XXXXXX"); |
| 333 | Array<int> aStream; | 333 | Array<int> aStream; |
| 334 | 334 | ||
| 335 | srandom( 2096 ); | 335 | srandom( 2096 ); |
diff --git a/src/unit/queuebuf.unit b/src/unit/queuebuf.unit index 29ba858..8de29e4 100644 --- a/src/unit/queuebuf.unit +++ b/src/unit/queuebuf.unit | |||
| @@ -30,7 +30,7 @@ suite QueueBuf | |||
| 30 | unitTest( qb.read( buf, 7 ) == 0 ); | 30 | unitTest( qb.read( buf, 7 ) == 0 ); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | void QBUF_RANDSTR( Bu::FString &fill, unsigned int iSize ) | 33 | void QBUF_RANDSTR( Bu::String &fill, unsigned int iSize ) |
| 34 | { | 34 | { |
| 35 | char c; | 35 | char c; |
| 36 | for( unsigned int i=0; i<iSize; ++i ) | 36 | for( unsigned int i=0; i<iSize; ++i ) |
| @@ -44,7 +44,7 @@ suite QueueBuf | |||
| 44 | { | 44 | { |
| 45 | srandom(time(NULL)); | 45 | srandom(time(NULL)); |
| 46 | Bu::QueueBuf qb; | 46 | Bu::QueueBuf qb; |
| 47 | Bu::FString sTmp; | 47 | Bu::String sTmp; |
| 48 | char buf[4096]; | 48 | char buf[4096]; |
| 49 | 49 | ||
| 50 | for( int i=0; i<200; ++i ) | 50 | for( int i=0; i<200; ++i ) |
| @@ -65,12 +65,12 @@ suite QueueBuf | |||
| 65 | printf("%02x",(int)(uint8_t)s[i]); | 65 | printf("%02x",(int)(uint8_t)s[i]); |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | void QBUF_HASH( Bu::FString &fill, const char *s, int iSize ) | 68 | void QBUF_HASH( Bu::String &fill, const char *s, int iSize ) |
| 69 | { | 69 | { |
| 70 | Bu::Md5 hash; | 70 | Bu::Md5 hash; |
| 71 | hash.reset(); | 71 | hash.reset(); |
| 72 | hash.addData( s, iSize ); | 72 | hash.addData( s, iSize ); |
| 73 | const Bu::FString &sTmp = hash.getResult(); | 73 | const Bu::String &sTmp = hash.getResult(); |
| 74 | fill.append( sTmp.getStr(), 16 ); | 74 | fill.append( sTmp.getStr(), 16 ); |
| 75 | } | 75 | } |
| 76 | 76 | ||
| @@ -78,8 +78,8 @@ suite QueueBuf | |||
| 78 | { | 78 | { |
| 79 | srandom(time(NULL)); | 79 | srandom(time(NULL)); |
| 80 | Bu::QueueBuf qb; | 80 | Bu::QueueBuf qb; |
| 81 | Bu::FString sTmp; | 81 | Bu::String sTmp; |
| 82 | Bu::FString sTmp2; | 82 | Bu::String sTmp2; |
| 83 | char buf[4096]; | 83 | char buf[4096]; |
| 84 | 84 | ||
| 85 | for( int i=0; i<200; ++i ) | 85 | for( int i=0; i<200; ++i ) |
diff --git a/src/unit/taf.unit b/src/unit/taf.unit index cab04d2..908e591 100644 --- a/src/unit/taf.unit +++ b/src/unit/taf.unit | |||
| @@ -18,7 +18,7 @@ suite Taf | |||
| 18 | test read1 | 18 | test read1 |
| 19 | { | 19 | { |
| 20 | #define FN_TMP ("/tmp/tmpXXXXXXXX") | 20 | #define FN_TMP ("/tmp/tmpXXXXXXXX") |
| 21 | Bu::FString sFnTmp(FN_TMP); | 21 | Bu::String sFnTmp(FN_TMP); |
| 22 | Bu::File fOut = Bu::File::tempFile( sFnTmp ); | 22 | Bu::File fOut = Bu::File::tempFile( sFnTmp ); |
| 23 | const char *data = | 23 | const char *data = |
| 24 | "{test: name=\"Bob\"}" | 24 | "{test: name=\"Bob\"}" |
| @@ -43,7 +43,7 @@ suite Taf | |||
| 43 | Bu::TafWriter tw( mb ); | 43 | Bu::TafWriter tw( mb ); |
| 44 | 44 | ||
| 45 | Bu::TafGroup g("Test data"); | 45 | Bu::TafGroup g("Test data"); |
| 46 | Bu::FString sData( 256 ); | 46 | Bu::String sData( 256 ); |
| 47 | for( int j = 0; j < 256; j++ ) | 47 | for( int j = 0; j < 256; j++ ) |
| 48 | sData[j] = (unsigned char)j; | 48 | sData[j] = (unsigned char)j; |
| 49 | g.addChild( new Bu::TafProperty("Encoded", sData) ); | 49 | g.addChild( new Bu::TafProperty("Encoded", sData) ); |
| @@ -87,7 +87,7 @@ suite Taf | |||
| 87 | Bu::TafWriter tw( mb ); | 87 | Bu::TafWriter tw( mb ); |
| 88 | 88 | ||
| 89 | Bu::TafGroup g("Test Group"); | 89 | Bu::TafGroup g("Test Group"); |
| 90 | Bu::FString sVal; | 90 | Bu::String sVal; |
| 91 | g.addChild( new Bu::TafProperty("Lame", sVal) ); | 91 | g.addChild( new Bu::TafProperty("Lame", sVal) ); |
| 92 | tw.writeGroup( &g ); | 92 | tw.writeGroup( &g ); |
| 93 | 93 | ||
diff --git a/src/unit/xml.unit b/src/unit/xml.unit index 67216f0..b4340e8 100644 --- a/src/unit/xml.unit +++ b/src/unit/xml.unit | |||
| @@ -6,7 +6,7 @@ | |||
| 6 | * terms of the license contained in the file LICENSE. | 6 | * terms of the license contained in the file LICENSE. |
| 7 | */ | 7 | */ |
| 8 | 8 | ||
| 9 | #include "bu/fstring.h" | 9 | #include "bu/string.h" |
| 10 | #include "bu/xmlreader.h" | 10 | #include "bu/xmlreader.h" |
| 11 | #include "bu/membuf.h" | 11 | #include "bu/membuf.h" |
| 12 | 12 | ||
| @@ -14,7 +14,7 @@ suite Xml | |||
| 14 | { | 14 | { |
| 15 | test declaration | 15 | test declaration |
| 16 | { | 16 | { |
| 17 | Bu::FString sXml("<?xml ?> <hi />"); | 17 | Bu::String sXml("<?xml ?> <hi />"); |
| 18 | Bu::MemBuf buf( sXml ); | 18 | Bu::MemBuf buf( sXml ); |
| 19 | Bu::XmlReader xr( buf ); | 19 | Bu::XmlReader xr( buf ); |
| 20 | } | 20 | } |
diff --git a/src/unitsuite.cpp b/src/unitsuite.cpp index ce6d037..58646a0 100644 --- a/src/unitsuite.cpp +++ b/src/unitsuite.cpp | |||
| @@ -158,14 +158,14 @@ int Bu::UnitSuite::run( int argc, char *argv[] ) | |||
| 158 | return 0; | 158 | return 0; |
| 159 | } | 159 | } |
| 160 | 160 | ||
| 161 | Bu::File Bu::UnitSuite::tempFile( Bu::FString &sFileName ) | 161 | Bu::File Bu::UnitSuite::tempFile( Bu::String &sFileName ) |
| 162 | { | 162 | { |
| 163 | Bu::File f = Bu::File::tempFile( sFileName ); | 163 | Bu::File f = Bu::File::tempFile( sFileName ); |
| 164 | lFileCleanup.append( sFileName ); | 164 | lFileCleanup.append( sFileName ); |
| 165 | return f; | 165 | return f; |
| 166 | } | 166 | } |
| 167 | 167 | ||
| 168 | void Bu::UnitSuite::add( Test fTest, const Bu::FString &sName, Expect e ) | 168 | void Bu::UnitSuite::add( Test fTest, const Bu::String &sName, Expect e ) |
| 169 | { | 169 | { |
| 170 | TestInfo ti; | 170 | TestInfo ti; |
| 171 | ti.sName = sName; | 171 | ti.sName = sName; |
| @@ -173,7 +173,7 @@ void Bu::UnitSuite::add( Test fTest, const Bu::FString &sName, Expect e ) | |||
| 173 | long index = ti.sName.rfindIdx("::"); | 173 | long index = ti.sName.rfindIdx("::"); |
| 174 | if( index != -1 ) | 174 | if( index != -1 ) |
| 175 | { | 175 | { |
| 176 | FString tmp = sSuiteName; | 176 | String tmp = sSuiteName; |
| 177 | tmp += ti.sName.getStr()+index; | 177 | tmp += ti.sName.getStr()+index; |
| 178 | ti.sName = tmp; | 178 | ti.sName = tmp; |
| 179 | } | 179 | } |
| @@ -183,7 +183,7 @@ void Bu::UnitSuite::add( Test fTest, const Bu::FString &sName, Expect e ) | |||
| 183 | iNameWidth = ti.sName.getSize(); | 183 | iNameWidth = ti.sName.getSize(); |
| 184 | } | 184 | } |
| 185 | 185 | ||
| 186 | void Bu::UnitSuite::setName( const FString &sName ) | 186 | void Bu::UnitSuite::setName( const String &sName ) |
| 187 | { | 187 | { |
| 188 | sSuiteName = sName; | 188 | sSuiteName = sName; |
| 189 | } | 189 | } |
diff --git a/src/unitsuite.h b/src/unitsuite.h index 475ee48..6ac4f3e 100644 --- a/src/unitsuite.h +++ b/src/unitsuite.h | |||
| @@ -10,7 +10,7 @@ | |||
| 10 | 10 | ||
| 11 | #include <stdint.h> | 11 | #include <stdint.h> |
| 12 | #include "bu/list.h" | 12 | #include "bu/list.h" |
| 13 | #include "bu/fstring.h" | 13 | #include "bu/string.h" |
| 14 | #include "bu/file.h" | 14 | #include "bu/file.h" |
| 15 | #include "bu/array.h" | 15 | #include "bu/array.h" |
| 16 | 16 | ||
| @@ -63,7 +63,7 @@ namespace Bu | |||
| 63 | 63 | ||
| 64 | int run( int argc=0, char *argv[]=NULL ); | 64 | int run( int argc=0, char *argv[]=NULL ); |
| 65 | 65 | ||
| 66 | Bu::File tempFile( Bu::FString &sFileName ); | 66 | Bu::File tempFile( Bu::String &sFileName ); |
| 67 | 67 | ||
| 68 | typedef void (UnitSuite::*Test)(); | 68 | typedef void (UnitSuite::*Test)(); |
| 69 | 69 | ||
| @@ -71,12 +71,12 @@ namespace Bu | |||
| 71 | { | 71 | { |
| 72 | public: | 72 | public: |
| 73 | Failed() : str(""), bFile( false ) { } | 73 | Failed() : str(""), bFile( false ) { } |
| 74 | Failed( const FString &s ) : str( s ), bFile( false ) { } | 74 | Failed( const String &s ) : str( s ), bFile( false ) { } |
| 75 | Failed( const FString &s, const FString &sFile, int nLine ) : | 75 | Failed( const String &s, const String &sFile, int nLine ) : |
| 76 | str( s ), sFile( sFile ), nLine( nLine ), bFile( true ) { } | 76 | str( s ), sFile( sFile ), nLine( nLine ), bFile( true ) { } |
| 77 | 77 | ||
| 78 | FString str; | 78 | String str; |
| 79 | FString sFile; | 79 | String sFile; |
| 80 | int nLine; | 80 | int nLine; |
| 81 | bool bFile; | 81 | bool bFile; |
| 82 | }; | 82 | }; |
| @@ -93,8 +93,8 @@ namespace Bu | |||
| 93 | }; | 93 | }; |
| 94 | 94 | ||
| 95 | protected: | 95 | protected: |
| 96 | void add( Test fTest, const Bu::FString &sName, Expect e=expectPass ); | 96 | void add( Test fTest, const Bu::String &sName, Expect e=expectPass ); |
| 97 | void setName( const FString &sName ); | 97 | void setName( const String &sName ); |
| 98 | 98 | ||
| 99 | void dispProgress(); | 99 | void dispProgress(); |
| 100 | void setStepCount( int iSteps ); | 100 | void setStepCount( int iSteps ); |
| @@ -102,23 +102,23 @@ namespace Bu | |||
| 102 | void setProgress( int iAmnt ); | 102 | void setProgress( int iAmnt ); |
| 103 | 103 | ||
| 104 | private: | 104 | private: |
| 105 | int onListCases( Bu::Array<Bu::FString> aParam ); | 105 | int onListCases( Bu::Array<Bu::String> aParam ); |
| 106 | 106 | ||
| 107 | private: | 107 | private: |
| 108 | typedef struct TestInfo | 108 | typedef struct TestInfo |
| 109 | { | 109 | { |
| 110 | FString sName; | 110 | String sName; |
| 111 | Test fTest; | 111 | Test fTest; |
| 112 | Expect eExpect; | 112 | Expect eExpect; |
| 113 | } TestInfo; | 113 | } TestInfo; |
| 114 | 114 | ||
| 115 | typedef Bu::List<TestInfo> TestList; | 115 | typedef Bu::List<TestInfo> TestList; |
| 116 | TestList lTests; | 116 | TestList lTests; |
| 117 | FString sSuiteName; | 117 | String sSuiteName; |
| 118 | 118 | ||
| 119 | int iOptions; | 119 | int iOptions; |
| 120 | 120 | ||
| 121 | typedef Bu::List<Bu::FString> StrList; | 121 | typedef Bu::List<Bu::String> StrList; |
| 122 | StrList lFileCleanup; | 122 | StrList lFileCleanup; |
| 123 | int iNameWidth; | 123 | int iNameWidth; |
| 124 | int iStepCount; | 124 | int iStepCount; |
diff --git a/src/url.cpp b/src/url.cpp index 1f9f563..943b855 100644 --- a/src/url.cpp +++ b/src/url.cpp | |||
| @@ -21,7 +21,7 @@ Bu::Url::Url() | |||
| 21 | { | 21 | { |
| 22 | } | 22 | } |
| 23 | 23 | ||
| 24 | Bu::Url::Url( const Bu::FString &sUrl ) | 24 | Bu::Url::Url( const Bu::String &sUrl ) |
| 25 | { | 25 | { |
| 26 | parseUrl( sUrl ); | 26 | parseUrl( sUrl ); |
| 27 | } | 27 | } |
| @@ -30,22 +30,22 @@ Bu::Url::~Url() | |||
| 30 | { | 30 | { |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | void Bu::Url::parseUrl( const Bu::FString &sUrl ) | 33 | void Bu::Url::parseUrl( const Bu::String &sUrl ) |
| 34 | { | 34 | { |
| 35 | clear(); | 35 | clear(); |
| 36 | 36 | ||
| 37 | Bu::FString::const_iterator i = sUrl.begin(); | 37 | Bu::String::const_iterator i = sUrl.begin(); |
| 38 | parseProtocol( i ); | 38 | parseProtocol( i ); |
| 39 | parseUserPass( i ); | 39 | parseUserPass( i ); |
| 40 | parseHost( i ); | 40 | parseHost( i ); |
| 41 | parsePath( i ); | 41 | parsePath( i ); |
| 42 | } | 42 | } |
| 43 | 43 | ||
| 44 | Bu::FString Bu::Url::decode( const Bu::FString &sStr ) | 44 | Bu::String Bu::Url::decode( const Bu::String &sStr ) |
| 45 | { | 45 | { |
| 46 | Bu::FString sRet; | 46 | Bu::String sRet; |
| 47 | char buf[3] = {0, 0, 0}; | 47 | char buf[3] = {0, 0, 0}; |
| 48 | for( Bu::FString::const_iterator i = sStr.begin(); i; i++ ) | 48 | for( Bu::String::const_iterator i = sStr.begin(); i; i++ ) |
| 49 | { | 49 | { |
| 50 | if( *i == '+' ) | 50 | if( *i == '+' ) |
| 51 | { | 51 | { |
| @@ -67,10 +67,10 @@ Bu::FString Bu::Url::decode( const Bu::FString &sStr ) | |||
| 67 | return sRet; | 67 | return sRet; |
| 68 | } | 68 | } |
| 69 | 69 | ||
| 70 | Bu::FString Bu::Url::encode( const Bu::FString &sStr ) | 70 | Bu::String Bu::Url::encode( const Bu::String &sStr ) |
| 71 | { | 71 | { |
| 72 | Bu::FString sRet; | 72 | Bu::String sRet; |
| 73 | for( Bu::FString::const_iterator i = sStr.begin(); i; i++ ) | 73 | for( Bu::String::const_iterator i = sStr.begin(); i; i++ ) |
| 74 | { | 74 | { |
| 75 | if( *i == ' ' ) | 75 | if( *i == ' ' ) |
| 76 | { | 76 | { |
| @@ -96,17 +96,17 @@ Bu::FString Bu::Url::encode( const Bu::FString &sStr ) | |||
| 96 | return sRet; | 96 | return sRet; |
| 97 | } | 97 | } |
| 98 | 98 | ||
| 99 | void Bu::Url::parseProtocol( Bu::FString::const_iterator &i ) | 99 | void Bu::Url::parseProtocol( Bu::String::const_iterator &i ) |
| 100 | { | 100 | { |
| 101 | Bu::FString::const_iterator s = i.find("://", 3); | 101 | Bu::String::const_iterator s = i.find("://", 3); |
| 102 | if( !s ) | 102 | if( !s ) |
| 103 | throw Bu::ExceptionBase("No :// in url"); | 103 | throw Bu::ExceptionBase("No :// in url"); |
| 104 | Bu::FString sTmp( i, s ); | 104 | Bu::String sTmp( i, s ); |
| 105 | setProtocol( sTmp ); | 105 | setProtocol( sTmp ); |
| 106 | i = s + 3; | 106 | i = s + 3; |
| 107 | } | 107 | } |
| 108 | 108 | ||
| 109 | void Bu::Url::setProtocol( const Bu::FString &sNewProto, bool bAutoSetPort ) | 109 | void Bu::Url::setProtocol( const Bu::String &sNewProto, bool bAutoSetPort ) |
| 110 | { | 110 | { |
| 111 | sProtocol = sNewProto; | 111 | sProtocol = sNewProto; |
| 112 | #ifndef WIN32 | 112 | #ifndef WIN32 |
| @@ -121,13 +121,13 @@ void Bu::Url::setProtocol( const Bu::FString &sNewProto, bool bAutoSetPort ) | |||
| 121 | #endif | 121 | #endif |
| 122 | } | 122 | } |
| 123 | 123 | ||
| 124 | void Bu::Url::parseUserPass( Bu::FString::const_iterator &i ) | 124 | void Bu::Url::parseUserPass( Bu::String::const_iterator &i ) |
| 125 | { | 125 | { |
| 126 | Bu::FString::const_iterator s = i.find('@'); | 126 | Bu::String::const_iterator s = i.find('@'); |
| 127 | if( !s ) | 127 | if( !s ) |
| 128 | return; | 128 | return; |
| 129 | 129 | ||
| 130 | Bu::FString::const_iterator p = i.find(':'); | 130 | Bu::String::const_iterator p = i.find(':'); |
| 131 | if( p ) | 131 | if( p ) |
| 132 | { | 132 | { |
| 133 | sUser.set( i, p ); | 133 | sUser.set( i, p ); |
| @@ -141,9 +141,9 @@ void Bu::Url::parseUserPass( Bu::FString::const_iterator &i ) | |||
| 141 | i = s + 1; | 141 | i = s + 1; |
| 142 | } | 142 | } |
| 143 | 143 | ||
| 144 | void Bu::Url::parseHost( Bu::FString::const_iterator &i ) | 144 | void Bu::Url::parseHost( Bu::String::const_iterator &i ) |
| 145 | { | 145 | { |
| 146 | Bu::FString::const_iterator s = i; | 146 | Bu::String::const_iterator s = i; |
| 147 | for( ; s && *s != '/'; s++ ) | 147 | for( ; s && *s != '/'; s++ ) |
| 148 | { | 148 | { |
| 149 | if( *s == ':' ) | 149 | if( *s == ':' ) |
| @@ -151,7 +151,7 @@ void Bu::Url::parseHost( Bu::FString::const_iterator &i ) | |||
| 151 | sHost.set( i, s ); | 151 | sHost.set( i, s ); |
| 152 | i = s + 1; | 152 | i = s + 1; |
| 153 | s = i.find('/'); | 153 | s = i.find('/'); |
| 154 | Bu::FString sPort( i, s ); | 154 | Bu::String sPort( i, s ); |
| 155 | iPort = strtol( sPort.getStr(), NULL, 10 ); | 155 | iPort = strtol( sPort.getStr(), NULL, 10 ); |
| 156 | i = s; | 156 | i = s; |
| 157 | return; | 157 | return; |
| @@ -161,17 +161,17 @@ void Bu::Url::parseHost( Bu::FString::const_iterator &i ) | |||
| 161 | i = s; | 161 | i = s; |
| 162 | } | 162 | } |
| 163 | 163 | ||
| 164 | void Bu::Url::parsePath( const Bu::FString &sPath ) | 164 | void Bu::Url::parsePath( const Bu::String &sPath ) |
| 165 | { | 165 | { |
| 166 | Bu::FString::const_iterator i = sPath.begin(); | 166 | Bu::String::const_iterator i = sPath.begin(); |
| 167 | parsePath( i ); | 167 | parsePath( i ); |
| 168 | } | 168 | } |
| 169 | 169 | ||
| 170 | void Bu::Url::parsePath( Bu::FString::const_iterator &i ) | 170 | void Bu::Url::parsePath( Bu::String::const_iterator &i ) |
| 171 | { | 171 | { |
| 172 | if( i ) | 172 | if( i ) |
| 173 | { | 173 | { |
| 174 | Bu::FString::const_iterator s = i.find('?'); | 174 | Bu::String::const_iterator s = i.find('?'); |
| 175 | sPath.set( i, s ); | 175 | sPath.set( i, s ); |
| 176 | i = s + 1; | 176 | i = s + 1; |
| 177 | if( s ) | 177 | if( s ) |
| @@ -185,17 +185,17 @@ void Bu::Url::parsePath( Bu::FString::const_iterator &i ) | |||
| 185 | } | 185 | } |
| 186 | } | 186 | } |
| 187 | 187 | ||
| 188 | void Bu::Url::parseParams( const Bu::FString &sQuery ) | 188 | void Bu::Url::parseParams( const Bu::String &sQuery ) |
| 189 | { | 189 | { |
| 190 | Bu::FString::const_iterator i = sQuery.begin(); | 190 | Bu::String::const_iterator i = sQuery.begin(); |
| 191 | parseParams( i ); | 191 | parseParams( i ); |
| 192 | } | 192 | } |
| 193 | 193 | ||
| 194 | void Bu::Url::parseParams( Bu::FString::const_iterator &i ) | 194 | void Bu::Url::parseParams( Bu::String::const_iterator &i ) |
| 195 | { | 195 | { |
| 196 | bool bName = true; | 196 | bool bName = true; |
| 197 | Bu::FString sName, sValue; | 197 | Bu::String sName, sValue; |
| 198 | for( Bu::FString::const_iterator s = i; s; s++ ) | 198 | for( Bu::String::const_iterator s = i; s; s++ ) |
| 199 | { | 199 | { |
| 200 | if( bName ) | 200 | if( bName ) |
| 201 | { | 201 | { |
| @@ -239,7 +239,7 @@ void Bu::Url::parseParams( Bu::FString::const_iterator &i ) | |||
| 239 | } | 239 | } |
| 240 | } | 240 | } |
| 241 | 241 | ||
| 242 | void Bu::Url::addParam( const Bu::FString &n, const Bu::FString &v ) | 242 | void Bu::Url::addParam( const Bu::String &n, const Bu::String &v ) |
| 243 | { | 243 | { |
| 244 | lParam.append( Param( n, v ) ); | 244 | lParam.append( Param( n, v ) ); |
| 245 | } | 245 | } |
| @@ -254,9 +254,9 @@ void Bu::Url::clear() | |||
| 254 | iPort.clear(); | 254 | iPort.clear(); |
| 255 | } | 255 | } |
| 256 | 256 | ||
| 257 | Bu::FString Bu::Url::getFullPath() const | 257 | Bu::String Bu::Url::getFullPath() const |
| 258 | { | 258 | { |
| 259 | Bu::FString sBuf = sPath; | 259 | Bu::String sBuf = sPath; |
| 260 | if( !lParam.isEmpty() ) | 260 | if( !lParam.isEmpty() ) |
| 261 | { | 261 | { |
| 262 | for( ParamList::const_iterator i = lParam.begin(); i; i++ ) | 262 | for( ParamList::const_iterator i = lParam.begin(); i; i++ ) |
| @@ -277,9 +277,9 @@ Bu::FString Bu::Url::getFullPath() const | |||
| 277 | return sBuf; | 277 | return sBuf; |
| 278 | } | 278 | } |
| 279 | 279 | ||
| 280 | Bu::FString Bu::Url::getUrl() const | 280 | Bu::String Bu::Url::getUrl() const |
| 281 | { | 281 | { |
| 282 | Bu::FString sBuf = sProtocol + "://" + sHost + getFullPath(); | 282 | Bu::String sBuf = sProtocol + "://" + sHost + getFullPath(); |
| 283 | return sBuf; | 283 | return sBuf; |
| 284 | } | 284 | } |
| 285 | 285 | ||
| @@ -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 | ||
diff --git a/src/utfstring.cpp b/src/utfstring.cpp index ae5efaf..7ba04ec 100644 --- a/src/utfstring.cpp +++ b/src/utfstring.cpp | |||
| @@ -1,29 +1,2 @@ | |||
| 1 | #include "bu/utfstring.h" | 1 | #include "bu/utfstring.h" |
| 2 | 2 | ||
| 3 | template class Bu::FBasicString<short>; | ||
| 4 | |||
| 5 | template<> uint32_t Bu::__calcHashCode<Bu::UtfString>( const Bu::UtfString &k ) | ||
| 6 | { | ||
| 7 | long j, sz = k.getSize()*2; | ||
| 8 | const char *s = (const char *)k.getStr(); | ||
| 9 | |||
| 10 | long nPos = 0; | ||
| 11 | for( j = 0; j < sz; j++, s++ ) | ||
| 12 | { | ||
| 13 | nPos = *s + (nPos << 6) + (nPos << 16) - nPos; | ||
| 14 | } | ||
| 15 | |||
| 16 | return nPos; | ||
| 17 | } | ||
| 18 | |||
| 19 | template<> bool Bu::__cmpHashKeys<Bu::UtfString>( | ||
| 20 | const Bu::UtfString &a, const Bu::UtfString &b ) | ||
| 21 | { | ||
| 22 | return a == b; | ||
| 23 | } | ||
| 24 | |||
| 25 | template<> void Bu::__tracer_format<Bu::UtfString>( const Bu::UtfString &v ) | ||
| 26 | { | ||
| 27 | printf("(%ld)\"%s\"", v.getSize(), (const char *)v.getStr() ); | ||
| 28 | } | ||
| 29 | |||
diff --git a/src/utfstring.h b/src/utfstring.h index bbacb74..cfbd5f0 100644 --- a/src/utfstring.h +++ b/src/utfstring.h | |||
| @@ -1,24 +1,11 @@ | |||
| 1 | #ifndef BU_UTF_STRING_H | 1 | #ifndef BU_UTF_STRING_H |
| 2 | #define BU_UTF_STRING_H | 2 | #define BU_UTF_STRING_H |
| 3 | 3 | ||
| 4 | #include "bu/fbasicstring.h" | ||
| 5 | |||
| 6 | namespace Bu | 4 | namespace Bu |
| 7 | { | 5 | { |
| 8 | typedef FBasicString<short> UtfString; | 6 | class UtfString |
| 9 | 7 | { | |
| 10 | template<typename T> | 8 | }; |
| 11 | uint32_t __calcHashCode( const T &k ); | 9 | }; |
| 12 | |||
| 13 | template<typename T> | ||
| 14 | bool __cmpHashKeys( const T &a, const T &b ); | ||
| 15 | |||
| 16 | template<> uint32_t __calcHashCode<UtfString>( const UtfString &k ); | ||
| 17 | template<> bool __cmpHashKeys<UtfString>( | ||
| 18 | const UtfString &a, const UtfString &b ); | ||
| 19 | |||
| 20 | template<typename t> void __tracer_format( const t &v ); | ||
| 21 | template<> void __tracer_format<UtfString>( const UtfString &v ); | ||
| 22 | } | ||
| 23 | 10 | ||
| 24 | #endif | 11 | #endif |
diff --git a/src/uuid.cpp b/src/uuid.cpp index 410cf6b..f46d2ae 100644 --- a/src/uuid.cpp +++ b/src/uuid.cpp | |||
| @@ -25,12 +25,12 @@ Bu::Uuid::~Uuid() | |||
| 25 | { | 25 | { |
| 26 | } | 26 | } |
| 27 | 27 | ||
| 28 | Bu::FString Bu::Uuid::toRawString() | 28 | Bu::String Bu::Uuid::toRawString() |
| 29 | { | 29 | { |
| 30 | return Bu::FString( (char *)data, 16 ); | 30 | return Bu::String( (char *)data, 16 ); |
| 31 | } | 31 | } |
| 32 | 32 | ||
| 33 | Bu::FString Bu::Uuid::toString() | 33 | Bu::String Bu::Uuid::toString() |
| 34 | { | 34 | { |
| 35 | Bu::MemBuf mb; | 35 | Bu::MemBuf mb; |
| 36 | Bu::Formatter f( mb ); | 36 | Bu::Formatter f( mb ); |
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_UUID_H | 8 | #ifndef BU_UUID_H |
| 9 | #define BU_UUID_H | 9 | #define BU_UUID_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | 12 | ||
| 13 | namespace Bu | 13 | namespace Bu |
| 14 | { | 14 | { |
| @@ -19,8 +19,8 @@ namespace Bu | |||
| 19 | Uuid( const Uuid &src ); | 19 | Uuid( const Uuid &src ); |
| 20 | virtual ~Uuid(); | 20 | virtual ~Uuid(); |
| 21 | 21 | ||
| 22 | Bu::FString toRawString(); | 22 | Bu::String toRawString(); |
| 23 | Bu::FString toString(); | 23 | Bu::String toString(); |
| 24 | 24 | ||
| 25 | static Uuid gen(); | 25 | static Uuid gen(); |
| 26 | static Uuid genV1(); | 26 | static Uuid genV1(); |
diff --git a/src/variant.cpp b/src/variant.cpp index a239e0f..a23a422 100644 --- a/src/variant.cpp +++ b/src/variant.cpp | |||
| @@ -9,7 +9,7 @@ | |||
| 9 | 9 | ||
| 10 | namespace Bu | 10 | namespace Bu |
| 11 | { | 11 | { |
| 12 | Formatter &operator<<( Formatter &f, const FString &s ); | 12 | Formatter &operator<<( Formatter &f, const String &s ); |
| 13 | }; | 13 | }; |
| 14 | 14 | ||
| 15 | Bu::VariantTypeRoot::VariantTypeRoot() | 15 | Bu::VariantTypeRoot::VariantTypeRoot() |
| @@ -37,7 +37,7 @@ Bu::Variant::Variant( const Variant &v ) : | |||
| 37 | Bu::Variant::Variant( const char *t ) : | 37 | Bu::Variant::Variant( const char *t ) : |
| 38 | pCore( NULL ) | 38 | pCore( NULL ) |
| 39 | { | 39 | { |
| 40 | set( Bu::FString( t ) ); | 40 | set( Bu::String( t ) ); |
| 41 | } | 41 | } |
| 42 | 42 | ||
| 43 | Bu::Variant::~Variant() | 43 | Bu::Variant::~Variant() |
| @@ -54,7 +54,7 @@ bool Bu::Variant::isSet() const | |||
| 54 | return pCore != NULL; | 54 | return pCore != NULL; |
| 55 | } | 55 | } |
| 56 | 56 | ||
| 57 | Bu::FString Bu::Variant::toString() const | 57 | Bu::String Bu::Variant::toString() const |
| 58 | { | 58 | { |
| 59 | if( !pCore ) | 59 | if( !pCore ) |
| 60 | return "***NO DATA***"; | 60 | return "***NO DATA***"; |
| @@ -90,14 +90,14 @@ Bu::Formatter &Bu::operator<<( Bu::Formatter &f, const Bu::Variant &v ) | |||
| 90 | return f << v.toString(); | 90 | return f << v.toString(); |
| 91 | } | 91 | } |
| 92 | 92 | ||
| 93 | template<> Bu::FString Bu::VariantType<int>::toString() const | 93 | template<> Bu::String Bu::VariantType<int>::toString() const |
| 94 | { | 94 | { |
| 95 | Bu::FString s; | 95 | Bu::String s; |
| 96 | s.format("%d", data ); | 96 | s.format("%d", data ); |
| 97 | return s; | 97 | return s; |
| 98 | } | 98 | } |
| 99 | 99 | ||
| 100 | template<> Bu::FString Bu::VariantType<bool>::toString() const | 100 | template<> Bu::String Bu::VariantType<bool>::toString() const |
| 101 | { | 101 | { |
| 102 | return data?"true":"false"; | 102 | return data?"true":"false"; |
| 103 | } | 103 | } |
diff --git a/src/variant.h b/src/variant.h index f659ad2..80f1bb9 100644 --- a/src/variant.h +++ b/src/variant.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_VARIANT_H | 8 | #ifndef BU_VARIANT_H |
| 9 | #define BU_VARIANT_H | 9 | #define BU_VARIANT_H |
| 10 | 10 | ||
| 11 | #include <bu/fstring.h> | 11 | #include <bu/string.h> |
| 12 | #include <typeinfo> | 12 | #include <typeinfo> |
| 13 | #include <bu/membuf.h> | 13 | #include <bu/membuf.h> |
| 14 | #include <bu/formatter.h> | 14 | #include <bu/formatter.h> |
| @@ -26,7 +26,7 @@ namespace Bu | |||
| 26 | VariantTypeRoot(); | 26 | VariantTypeRoot(); |
| 27 | virtual ~VariantTypeRoot(); | 27 | virtual ~VariantTypeRoot(); |
| 28 | 28 | ||
| 29 | virtual Bu::FString toString() const=0; | 29 | virtual Bu::String toString() const=0; |
| 30 | virtual const std::type_info &getType() const=0; | 30 | virtual const std::type_info &getType() const=0; |
| 31 | virtual VariantTypeRoot *clone() const=0; | 31 | virtual VariantTypeRoot *clone() const=0; |
| 32 | }; | 32 | }; |
| @@ -65,7 +65,7 @@ namespace Bu | |||
| 65 | return data; | 65 | return data; |
| 66 | } | 66 | } |
| 67 | 67 | ||
| 68 | virtual Bu::FString toString() const | 68 | virtual Bu::String toString() const |
| 69 | { | 69 | { |
| 70 | MemBuf mb; | 70 | MemBuf mb; |
| 71 | Formatter f( mb ); | 71 | Formatter f( mb ); |
| @@ -124,7 +124,7 @@ namespace Bu | |||
| 124 | virtual ~Variant(); | 124 | virtual ~Variant(); |
| 125 | 125 | ||
| 126 | bool isSet() const; | 126 | bool isSet() const; |
| 127 | Bu::FString toString() const; | 127 | Bu::String toString() const; |
| 128 | const std::type_info &getType() const; | 128 | const std::type_info &getType() const; |
| 129 | 129 | ||
| 130 | Variant &operator=( const Variant &rhs ); | 130 | Variant &operator=( const Variant &rhs ); |
| @@ -228,8 +228,8 @@ namespace Bu | |||
| 228 | 228 | ||
| 229 | Bu::Formatter &operator<<( Bu::Formatter &f, const Variant &v ); | 229 | Bu::Formatter &operator<<( Bu::Formatter &f, const Variant &v ); |
| 230 | 230 | ||
| 231 | template<> Bu::FString VariantType<int>::toString() const; | 231 | template<> Bu::String VariantType<int>::toString() const; |
| 232 | template<> Bu::FString VariantType<bool>::toString() const; | 232 | template<> Bu::String VariantType<bool>::toString() const; |
| 233 | }; | 233 | }; |
| 234 | 234 | ||
| 235 | #endif | 235 | #endif |
diff --git a/src/xmlreader.h b/src/xmlreader.h index 8533c1a..a217ac5 100644 --- a/src/xmlreader.h +++ b/src/xmlreader.h | |||
| @@ -8,7 +8,7 @@ | |||
| 8 | #ifndef BU_XML_READER_H | 8 | #ifndef BU_XML_READER_H |
| 9 | #define BU_XML_READER_H | 9 | #define BU_XML_READER_H |
| 10 | 10 | ||
| 11 | #include "bu/fstring.h" | 11 | #include "bu/string.h" |
| 12 | #include "bu/exceptionbase.h" | 12 | #include "bu/exceptionbase.h" |
| 13 | 13 | ||
| 14 | namespace Bu | 14 | namespace Bu |
| @@ -27,8 +27,8 @@ namespace Bu | |||
| 27 | Stream &rInput; | 27 | Stream &rInput; |
| 28 | int iCurToken; | 28 | int iCurToken; |
| 29 | int iNextToken; | 29 | int iNextToken; |
| 30 | Bu::FString sBuf; | 30 | Bu::String sBuf; |
| 31 | Bu::FString sStr; | 31 | Bu::String sStr; |
| 32 | bool bIgnoreWS; | 32 | bool bIgnoreWS; |
| 33 | typedef struct StreamPos | 33 | typedef struct StreamPos |
| 34 | { | 34 | { |
