From 48649cdfb8671fb49a28b33c1ba1cd71c0999a07 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Wed, 15 Feb 2012 10:05:30 +0000 Subject: lock in those ByteString gains so there's no back-sliding --- tools/inc/tools/string.hxx | 55 +++++++++++----------------------------------- 1 file changed, 13 insertions(+), 42 deletions(-) (limited to 'tools/inc/tools/string.hxx') diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index b91170a5249b..c232c07ff43e 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -148,26 +148,36 @@ private: sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making something to fit ByteString( const sal_Unicode* pUniStr, xub_StrLen nLen, rtl_TextEncoding eTextEncoding, - sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making somethiing to fit + sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making something to fit ByteString( const UniString& rUniStr, rtl_TextEncoding eTextEncoding, - sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making somethiing to fit + sal_uInt32 nCvtFlags = UNISTRING_TO_BYTESTRING_CVTFLAGS ); //not implemented, to detect use of removed methods without compiler making something to fit + ByteString( const sal_Char* pCharStr, xub_StrLen nLen ); //not implemented, to detect use of removed methods without compiler making something to fit void Assign(int); // not implemented; to detect misuses of // Assign(sal_Char) + ByteString& Assign( const sal_Char* pCharStr, xub_StrLen nLen ); //not implemented, to detect use of removed methods without compiler making something to fit + ByteString& operator =(const sal_Char); //not implemented, to detect use of removed methods without compiler making something to fit + + ByteString& Assign(sal_Char); //not implemented, to detect use of removed methods without compiler making something to fit void operator =(int); // not implemented; to detect misuses // of operator =(sal_Char) void Append(int); // not implemented; to detect misuses of // Append(char) + ByteString& Append( const sal_Char* pCharStr, xub_StrLen nLen ); // not implemented, to detect use of removed methods without compiler making something to fit + ByteString& operator +=(sal_Char); //not implemented, to detect use of removed methods without compiler making something to fit + ByteString& Append( char c ); //not implemented, to detect use of removed methods without compiler making something to fit void operator +=(int); // not implemented; to detect misuses // of operator +=(sal_Char) + friend sal_Bool operator == ( const ByteString& rStr1, const ByteString& rStr2 ); //not implemented, to detect use of removed methods without compiler making something to fit + friend sal_Bool operator < ( const ByteString& rStr1, const ByteString& rStr2 ); //not implemented, to detect use of removed methods without compiler making something to fit + friend sal_Bool operator > ( const ByteString& rStr1, const ByteString& rStr2 ); //not implemented, to detect use of removed methods without compiler making something to fit public: ByteString(); ByteString( const ByteString& rStr ); ByteString( const ByteString& rStr, xub_StrLen nPos, xub_StrLen nLen ); ByteString( const rtl::OString& rStr ); ByteString( const sal_Char* pCharStr ); - ByteString( const sal_Char* pCharStr, xub_StrLen nLen ); ~ByteString(); operator rtl::OString () const @@ -178,27 +188,19 @@ public: ByteString& Assign( const ByteString& rStr ); ByteString& Assign( const rtl::OString& rStr ); ByteString& Assign( const sal_Char* pCharStr ); - ByteString& Assign( const sal_Char* pCharStr, xub_StrLen nLen ); - ByteString& Assign( sal_Char c ); ByteString& operator =( const ByteString& rStr ) { return Assign( rStr ); } ByteString& operator =( const rtl::OString& rStr ) { return Assign( rStr ); } ByteString& operator =( const sal_Char* pCharStr ) { return Assign( pCharStr ); } - ByteString& operator =( const sal_Char c ) - { return Assign( c ); } ByteString& Append( const ByteString& rStr ); ByteString& Append( const sal_Char* pCharStr ); - ByteString& Append( const sal_Char* pCharStr, xub_StrLen nLen ); - ByteString& Append( char c ); ByteString& operator +=( const ByteString& rStr ) { return Append( rStr ); } ByteString& operator +=( const sal_Char* pCharStr ) { return Append( pCharStr ); } - ByteString& operator +=( sal_Char c ) - { return Append( c ); } void SetChar( xub_StrLen nIndex, sal_Char c ); sal_Char GetChar( xub_StrLen nIndex ) const @@ -207,54 +209,33 @@ public: xub_StrLen Len() const { return (xub_StrLen)mpData->mnLen; } ByteString& Insert( const ByteString& rStr, xub_StrLen nIndex = STRING_LEN ); - ByteString& Insert( const sal_Char* pCharStr, xub_StrLen nIndex = STRING_LEN ); - ByteString& Insert( sal_Char c, xub_StrLen nIndex = STRING_LEN ); ByteString& Replace( xub_StrLen nIndex, xub_StrLen nCount, const ByteString& rStr ); ByteString& Erase( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ); ByteString Copy( xub_StrLen nIndex = 0, xub_StrLen nCount = STRING_LEN ) const; ByteString& ToLowerAscii(); - ByteString& ToUpperAscii(); - StringCompare CompareTo( const ByteString& rStr, - xub_StrLen nLen = STRING_LEN ) const; StringCompare CompareTo( const sal_Char* pCharStr, xub_StrLen nLen = STRING_LEN ) const; StringCompare CompareIgnoreCaseToAscii( const sal_Char* pCharStr, xub_StrLen nLen = STRING_LEN ) const; - sal_Bool Equals( const ByteString& rStr ) const; sal_Bool Equals( const sal_Char* pCharStr ) const; - sal_Bool EqualsIgnoreCaseAscii( const ByteString& rStr ) const; sal_Bool EqualsIgnoreCaseAscii( const sal_Char* pCharStr ) const; - sal_Bool Equals( const ByteString& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool Equals( const sal_Char* pCharStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - - xub_StrLen Match( const ByteString& rStr ) const; xub_StrLen Search( sal_Char c, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( const ByteString& rStr, xub_StrLen nIndex = 0 ) const; xub_StrLen Search( const sal_Char* pCharStr, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchBackward( sal_Char c, xub_StrLen nIndex = STRING_LEN ) const; xub_StrLen SearchAndReplace( const ByteString& rStr, const ByteString& rRepStr, xub_StrLen nIndex = 0 ); xub_StrLen SearchAndReplace( const sal_Char* pCharStr, const ByteString& rRepStr, xub_StrLen nIndex = 0 ); void SearchAndReplaceAll( sal_Char c, sal_Char cRep ); - void SearchAndReplaceAll( const ByteString& rStr, const ByteString& rRepStr ); - void SearchAndReplaceAll( const sal_Char* pCharStr, const ByteString& rRepStr ); - void SetToken( xub_StrLen nToken, sal_Char cTok, const ByteString& rStr, - xub_StrLen nIndex = 0 ); - ByteString GetToken( xub_StrLen nToken, sal_Char cTok, xub_StrLen& rIndex ) const; ByteString GetToken( xub_StrLen nToken, sal_Char cTok = ';' ) const; const sal_Char* GetBuffer() const { return mpData->maStr; } - friend sal_Bool operator == ( const ByteString& rStr1, const ByteString& rStr2 ) - { return rStr1.Equals( rStr2 ); } friend sal_Bool operator == ( const ByteString& rStr, const sal_Char* pCharStr ) { return rStr.Equals( pCharStr ); } friend sal_Bool operator == ( const sal_Char* pCharStr, const ByteString& rStr ) @@ -265,14 +246,10 @@ public: { return !(operator == ( rStr, pCharStr )); } friend sal_Bool operator != ( const sal_Char* pCharStr, const ByteString& rStr ) { return !(operator == ( pCharStr, rStr )); } - friend sal_Bool operator < ( const ByteString& rStr1, const ByteString& rStr2 ) - { return (rStr1.CompareTo( rStr2 ) == COMPARE_LESS); } friend sal_Bool operator < ( const ByteString& rStr, const sal_Char* pCharStr ) { return (rStr.CompareTo( pCharStr ) == COMPARE_LESS); } friend sal_Bool operator < ( const sal_Char* pCharStr, const ByteString& rStr ) { return (rStr.CompareTo( pCharStr ) >= COMPARE_EQUAL); } - friend sal_Bool operator > ( const ByteString& rStr1, const ByteString& rStr2 ) - { return (rStr1.CompareTo( rStr2 ) == COMPARE_GREATER); } friend sal_Bool operator > ( const ByteString& rStr, const sal_Char* pCharStr ) { return (rStr.CompareTo( pCharStr ) == COMPARE_GREATER); } friend sal_Bool operator > ( const sal_Char* pCharStr, const ByteString& rStr ) @@ -296,12 +273,6 @@ inline ByteString ByteString::Copy( xub_StrLen nIndex, xub_StrLen nCount ) const return ByteString( *this, nIndex, nCount ); } -inline ByteString ByteString::GetToken( xub_StrLen nToken, sal_Char cTok ) const -{ - xub_StrLen nTempPos = 0; - return GetToken( nToken, cTok, nTempPos ); -} - // ----------------------------------------------------------------------- // ------------------------ -- cgit v1.2.3