[Libreoffice-commits] .: 2 commits - binfilter/bf_sch binfilter/bf_svtools binfilter/bf_sw binfilter/inc
Caolán McNamara
caolan at kemper.freedesktop.org
Tue Apr 10 04:50:21 PDT 2012
binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx | 5
binfilter/bf_svtools/source/misc/tl_strimp.cxx | 426 ----------------
binfilter/bf_svtools/source/misc/tl_tstring.cxx | 94 ---
binfilter/bf_svtools/source/misc/tl_tustring.cxx | 426 ++++++++++++++++
binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx | 30 -
binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx | 12
binfilter/inc/bf_sw/iodetect.hxx | 2
binfilter/inc/bf_tools/string.hxx | 64 --
8 files changed, 454 insertions(+), 605 deletions(-)
New commits:
commit c1ed15532ca066c67d05432c3e2f99c7feccbaf9
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Apr 10 12:49:13 2012 +0100
WaE: msvc potentially used uninitialized
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx
index 4cd3f56..b8e0722 100644
--- a/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3field.cxx
@@ -1180,7 +1180,7 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ pType = lcl_sw3io_InSetExpFieldType( rIo );
/*N*/ else
/*N*/ {
-/*N*/ USHORT nPoolId;
+/*N*/ USHORT nPoolId=0;
/*N*/ *rIo.pStrm >> nPoolId;
/*N*/
/*N*/ // fix #26064#: Namen der 3 Label-Numernkreise: Hier wird die
@@ -1196,8 +1196,8 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ }
/*N*/ }
/*N*/
-/*N*/ UINT16 nSeqNo;
-/*N*/ BYTE cFlags;
+/*N*/ UINT16 nSeqNo=0;
+/*N*/ BYTE cFlags=0;
/*N*/ String aFormula, aExpand, aPrompt;
/*N*/ *rIo.pStrm >> cFlags;
/*N*/ rIo.InString( *rIo.pStrm, aFormula );
@@ -1256,8 +1256,8 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ {
/*N*/ pType = 0;
/*N*/
-/*N*/ BYTE cFlags;
-/*N*/ UINT16 nPoolId, nSeqNo=0, nSeqVal=0;
+/*N*/ BYTE cFlags=0;
+/*N*/ UINT16 nPoolId=0, nSeqNo=0, nSeqVal=0;
/*N*/ String aFormula, aPrompt, aExpand;
/*N*/ *rIo.pStrm >> cFlags >> nPoolId;
/*N*/ rIo.InString( *rIo.pStrm, aFormula );
@@ -1314,9 +1314,9 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ SwField* lcl_sw3io_InHiddenParaField( Sw3IoImp& rIo, SwFieldType* pType,
/*N*/ USHORT, UINT32& )
/*N*/ {
-/*N*/ BYTE bHidden;
-/*N*/ String aCond;
+/*N*/ BYTE bHidden=FALSE;
/*N*/ *rIo.pStrm >> bHidden;
+/*N*/ String aCond;
/*N*/ rIo.InString( *rIo.pStrm, aCond );
/*N*/ SwHiddenParaField* pFld = new SwHiddenParaField( (SwHiddenParaFieldType*)pType, aCond );
/*N*/ pFld->SetHidden( (BOOL) bHidden );
@@ -1326,7 +1326,7 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ SwField* lcl_sw3io_InDocInfoField40( Sw3IoImp& rIo, SwFieldType* pType,
/*N*/ USHORT nSubType, UINT32& rFmt )
/*N*/ {
-/*N*/ UINT16 nSub;
+/*N*/ UINT16 nSub=0;
/*N*/ *rIo.pStrm >> nSub;
/*N*/ nSubType |= nSub;
/*N*/
@@ -1338,12 +1338,12 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ SwField* lcl_sw3io_InDocInfoField( Sw3IoImp& rIo, SwFieldType* pType,
/*N*/ USHORT nSubType, UINT32& rFmt )
/*N*/ {
-/*N*/ BYTE cFlags;
/*N*/ SwDocInfoField *pFld = new SwDocInfoField( (SwDocInfoFieldType*)pType,
/*N*/ nSubType, rFmt );
/*N*/
-/*N*/ String aContent;
+/*N*/ BYTE cFlags=FALSE;
/*N*/ *rIo.pStrm >> cFlags;
+/*N*/ String aContent;
/*N*/ rIo.InString( *rIo.pStrm, aContent );
/*N*/ pFld->SetExpansion(aContent);
/*N*/ if( cFlags & 0x01 )
@@ -1415,9 +1415,9 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ SwField* lcl_sw3io_InDBSetNumberField( Sw3IoImp& rIo, SwFieldType* pType,
/*N*/ USHORT, UINT32& )
/*N*/ {
-/*N*/ String aDBName;
-/*N*/ INT32 n;
+/*N*/ INT32 n=0;
/*N*/ *rIo.pStrm >> n;
+/*N*/ String aDBName;
/*N*/ if( rIo.IsVersion( SWG_MULTIDB, SWG_EXPORT31, SWG_DESKTOP40 ) )
/*N*/ {
/*N*/ USHORT nPoolId;
@@ -1436,8 +1436,8 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ USHORT, UINT32& )
/*N*/ {
/*N*/ String aData;
-/*N*/ UINT16 nSubType;
/*N*/ rIo.InString( *rIo.pStrm, aData );
+/*N*/ UINT16 nSubType=0;
/*N*/ *rIo.pStrm >> nSubType;
/*N*/ SwExtUserField* pFld = new SwExtUserField( (SwExtUserFieldType*)pType, nSubType );
/*N*/ ((SwExtUserFieldType*)pType)->SetData( aData );
@@ -1466,8 +1466,8 @@ SwAuthorityFieldType* lcl_sw3io_InAuthorityFieldType( Sw3IoImp& rIo )
/*N*/ SwField* lcl_sw3io_InRefPageSetField( Sw3IoImp& rIo, SwFieldType* pType,
/*N*/ USHORT, UINT32& )
/*N*/ {
- INT16 nOffset;
- BYTE cIsOn;
+ INT16 nOffset=0;
+ BYTE cIsOn=FALSE;
*rIo.pStrm >> nOffset >> cIsOn;
return new SwRefPageSetField( (SwRefPageSetFieldType*)pType, nOffset, cIsOn!=0 );
/*N*/ }
diff --git a/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx b/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx
index 00f8128..74321cb 100644
--- a/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx
+++ b/binfilter/bf_sw/source/core/sw3io/sw_sw3npool.cxx
@@ -379,7 +379,7 @@ namespace binfilter {
/*N*/ SfxPoolItem* SwFmtFtn::Create( SvStream& rStrm, USHORT nIVer ) const
/*N*/ {
-/*N*/ UINT16 nNumber1;
+/*N*/ UINT16 nNumber1 = 0;
/*N*/ rStrm >> nNumber1;
/*N*/ String aNumber1 = rStrm.ReadUniOrByteString( rStrm.GetStreamCharSet() );
/*N*/
@@ -406,7 +406,7 @@ namespace binfilter {
/*N*/ }
/*N*/
/*N*/ // die Seq-Nummer einlesen - fuer die Querverweise auf Fussnoten
-/*N*/ USHORT nSeqNo;
+/*N*/ USHORT nSeqNo = 0;
/*N*/ BOOL bEndNote1 = FALSE;
/*N*/ if( 1 <= nIVer )
/*N*/ {
@@ -414,7 +414,7 @@ namespace binfilter {
/*N*/ }
/*N*/ if( 2 <= nIVer )
/*N*/ {
-/*N*/ BYTE nFlags;
+/*N*/ BYTE nFlags = 0;
/*N*/ rStrm >> nFlags;
/*N*/ bEndNote1 = (nFlags & 0x01) != 0;
/*N*/ }
@@ -463,8 +463,8 @@ namespace binfilter {
/*N*/ SfxPoolItem* SwTOXMark::Create( SvStream& rStrm, USHORT nIVer ) const
/*N*/ {
-/*N*/ BYTE cType;
-/*N*/ UINT16 nLevel1, nStrIdx = IDX_NO_VALUE;
+/*N*/ BYTE cType = 0;
+/*N*/ UINT16 nLevel1 = 0, nStrIdx = IDX_NO_VALUE;
/*N*/ String aTypeName, aAltText1, aPrimKey, aSecKey;
/*N*/ Sw3IoImp* pIo = Sw3IoImp::GetCurrentIo();
/*N*/ rStrm >> cType
@@ -566,7 +566,7 @@ SfxPoolItem* SwFmtRuby::Create(SvStream & rStrm, USHORT /*nVer*/) const
String sRubyTxt1;
SwFmtRuby* pRet = new SwFmtRuby( sRubyTxt1 );
- BOOL bVal;
+ BOOL bVal = FALSE;
rStrm >> bVal;
return pRet;
diff --git a/binfilter/inc/bf_sw/iodetect.hxx b/binfilter/inc/bf_sw/iodetect.hxx
index b939acd..e4d14dd 100644
--- a/binfilter/inc/bf_sw/iodetect.hxx
+++ b/binfilter/inc/bf_sw/iodetect.hxx
@@ -451,7 +451,7 @@ const SfxFilter* SwIoSystem::GetFileFilter( const String& rFileName, \
/* nie erkannt und es wird auch der ASCII-Filter returnt. */ \
/* !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!*/ \
{ \
- const SfxFilter* pLclFilter; \
+ const SfxFilter* pLclFilter=NULL; \
const sal_Char* pNm; \
for( USHORT n = 0; n < MAXFILTER; ++n ) \
if( 0 != ( pNm = aReaderWriter[n].IsReader(aBuffer, nBytesRead)) && \
commit 167dd1197d5189736045a714ccc3ec328e8e8fe5
Author: Caolán McNamara <caolanm at redhat.com>
Date: Tue Apr 10 09:41:03 2012 +0100
reduce binfilter ByteString to used parts
diff --git a/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx b/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx
index e7be100..8ef403b 100644
--- a/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx
+++ b/binfilter/bf_sch/source/core/sch_SchAddInCollection.cxx
@@ -91,14 +91,15 @@ using namespace ::com::sun::star;
/*N*/ }
/*N*/ mbInitialized = sal_True;
/*N*/ }
-/*N*/ catch( const uno::Exception& aEx )
+/*N*/ catch( const uno::Exception& rEx )
/*N*/ {
/*N*/ OSL_FAIL( ::rtl::OUStringToOString(
/*N*/ ::rtl::OUString(
/*N*/ RTL_CONSTASCII_USTRINGPARAM(
/*N*/ "Couldn't initialize add-in collection: " )) +
-/*N*/ aEx.Message,
+/*N*/ rEx.Message,
/*N*/ RTL_TEXTENCODING_ASCII_US ).getStr() );
+/*N*/ (void)rEx;
/*N*/ }
/*N*/ }
diff --git a/binfilter/bf_svtools/source/misc/tl_strimp.cxx b/binfilter/bf_svtools/source/misc/tl_strimp.cxx
index 5ced5bc..7b82b64 100644
--- a/binfilter/bf_svtools/source/misc/tl_strimp.cxx
+++ b/binfilter/bf_svtools/source/misc/tl_strimp.cxx
@@ -29,22 +29,6 @@
namespace binfilter
{
-static sal_Int32 ImplStringCompare( const STRCODE* pStr1, const STRCODE* pStr2,
- xub_StrLen nCount )
-{
- sal_Int32 nRet = 0;
- while ( nCount &&
- ((nRet = ((sal_Int32)((STRCODEU)*pStr1))-((sal_Int32)((STRCODEU)*pStr2))) == 0) &&
- *pStr2 )
- {
- ++pStr1,
- ++pStr2,
- --nCount;
- }
-
- return nRet;
-}
-
// -----------------------------------------------------------------------
static sal_Int32 ImplStringCompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2,
@@ -62,65 +46,6 @@ static sal_Int32 ImplStringCompareWithoutZero( const STRCODE* pStr1, const STRCO
return nRet;
}
-// -----------------------------------------------------------------------
-
-static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2 )
-{
- sal_Int32 nRet;
- STRCODE c1;
- STRCODE c2;
- do
- {
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
- c1 = *pStr1;
- c2 = *pStr2;
- if ( (c1 >= 65) && (c1 <= 90) )
- c1 += 32;
- if ( (c2 >= 65) && (c2 <= 90) )
- c2 += 32;
- nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
- if ( nRet != 0 )
- break;
-
- ++pStr1,
- ++pStr2;
- }
- while ( c2 );
-
- return nRet;
-}
-
-// -----------------------------------------------------------------------
-
-static sal_Int32 ImplStringICompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2,
- sal_Int32 nCount )
-{
- sal_Int32 nRet = 0;
- STRCODE c1;
- STRCODE c2;
- do
- {
- if ( !nCount )
- break;
-
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
- c1 = *pStr1;
- c2 = *pStr2;
- if ( (c1 >= 65) && (c1 <= 90) )
- c1 += 32;
- if ( (c2 >= 65) && (c2 <= 90) )
- c2 += 32;
- nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
-
- ++pStr1,
- ++pStr2,
- --nCount;
- }
- while ( nRet == 0 );
-
- return nRet;
-}
-
// =======================================================================
#ifdef DBG_UTIL
@@ -290,43 +215,6 @@ STRING::STRING( const STRCODE* pCharStr )
// -----------------------------------------------------------------------
-STRING::STRING( const STRCODE* pCharStr, xub_StrLen nLen )
-: mpData(NULL)
-{
- DBG_CTOR( STRING, DBGCHECKSTRING );
- DBG_ASSERT( pCharStr, "String::String() - pCharStr is NULL" );
-
- if ( nLen == STRING_LEN )
- nLen = ImplStringLen( pCharStr );
-
-#ifdef DBG_UTIL
- if ( DbgIsAssert() )
- {
- for ( xub_StrLen i = 0; i < nLen; i++ )
- {
- if ( !pCharStr[i] )
- {
- OSL_FAIL( "String::String() : nLen is wrong" );
- }
- }
- }
-#endif
-
- // Ist es kein leerer String
- if ( nLen )
- {
- // Verwaltungsdaten anlegen und String kopieren
- mpData = ImplAllocData( nLen );
- memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
- }
- else
- {
- STRING_NEW((STRING_TYPE **)&mpData);
- }
-}
-
-// -----------------------------------------------------------------------
-
STRING::~STRING()
{
DBG_DTOR( STRING, DBGCHECKSTRING );
@@ -383,20 +271,6 @@ STRING& STRING::Assign( const STRCODE* pCharStr )
// -----------------------------------------------------------------------
-STRING& STRING::Assign( STRCODE c )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_ASSERT( c, "String::Assign() - c is 0" );
-
- // Verwaltungsdaten anlegen und initialisieren
- STRING_RELEASE((STRING_TYPE *)mpData);
- mpData = ImplAllocData( 1 );
- mpData->maStr[0] = c;
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
STRING& STRING::Append( const STRING& rStr )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -513,43 +387,6 @@ STRING& STRING::Append( const STRCODE* pCharStr, xub_StrLen nCharLen )
// -----------------------------------------------------------------------
-STRING& STRING::Append( STRCODE c )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- // kein 0-Character und maximale Stringlaenge nicht ueberschreiten
- sal_Int32 nLen = mpData->mnLen;
- if ( c && (nLen < STRING_MAXLEN) )
- {
- // Neue Datenstruktur und neuen String erzeugen
- STRINGDATA* pNewData = ImplAllocData( nLen+1 );
-
- // String kopieren
- memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
- pNewData->maStr[nLen] = c;
-
- // Alte Daten loeschen und Neue zuweisen
- STRING_RELEASE((STRING_TYPE *)mpData);
- mpData = pNewData;
- }
-
- return *this;
-}
-
-// -----------------------------------------------------------------------
-
-void STRING::SetChar( xub_StrLen nIndex, STRCODE c )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_ASSERT( nIndex < mpData->mnLen, "String::SetChar() - nIndex > String.Len()" );
-
- // Daten kopieren, wenn noetig und Character zuweisen
- ImplCopyData();
- mpData->maStr[nIndex] = c;
-}
-
-// -----------------------------------------------------------------------
-
STRING& STRING::Insert( const STRING& rStr, xub_StrLen nIndex )
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -738,35 +575,6 @@ STRING& STRING::ToLowerAscii()
// -----------------------------------------------------------------------
-StringCompare STRING::CompareTo( const STRING& rStr, xub_StrLen nLen ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
-
- // Auf Gleichheit der Pointer testen
- if ( mpData == rStr.mpData )
- return COMPARE_EQUAL;
-
- // Maximale Laenge ermitteln
- if ( mpData->mnLen < nLen )
- nLen = static_cast< xub_StrLen >(mpData->mnLen+1);
- if ( rStr.mpData->mnLen < nLen )
- nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1);
-
- // String vergleichen
- sal_Int32 nCompare = ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );
-
- // Rueckgabewert anpassen
- if ( nCompare == 0 )
- return COMPARE_EQUAL;
- else if ( nCompare < 0 )
- return COMPARE_LESS;
- else
- return COMPARE_GREATER;
-}
-
-// -----------------------------------------------------------------------
-
sal_Bool STRING::Equals( const STRING& rStr ) const
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -786,97 +594,6 @@ sal_Bool STRING::Equals( const STRING& rStr ) const
// -----------------------------------------------------------------------
-sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
-
- // Sind die Daten gleich
- if ( mpData == rStr.mpData )
- return sal_True;
-
- // Gleiche Laenge
- if ( mpData->mnLen != rStr.mpData->mnLen )
- return sal_False;
-
- // String vergleichen
- return (ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0);
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- return (ImplStringICompare( mpData->maStr, pCharStr ) == 0);
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool STRING::Equals( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
-
- // Are there enough codes for comparing?
- if ( nIndex > mpData->mnLen )
- return (rStr.mpData->mnLen == 0);
- sal_Int32 nMaxLen = mpData->mnLen-nIndex;
- if ( nMaxLen < nLen )
- {
- if ( rStr.mpData->mnLen != nMaxLen )
- return sal_False;
- nLen = static_cast< xub_StrLen >(nMaxLen);
- }
-
- // String vergleichen
- return (ImplStringCompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
-}
-
-// -----------------------------------------------------------------------
-
-sal_Bool STRING::Equals( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- // Are there enough codes for comparing?
- if ( nIndex > mpData->mnLen )
- return (*pCharStr == 0);
-
- return (ImplStringCompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0);
-}
-
-// -----------------------------------------------------------------------
-
-xub_StrLen STRING::Match( const STRING& rStr ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
-
- // Ist dieser String leer
- if ( !mpData->mnLen )
- return STRING_MATCH;
-
- // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
- const STRCODE* pStr1 = mpData->maStr;
- const STRCODE* pStr2 = rStr.mpData->maStr;
- xub_StrLen i = 0;
- while ( i < mpData->mnLen )
- {
- // Stimmt das Zeichen nicht ueberein, dann abbrechen
- if ( *pStr1 != *pStr2 )
- return i;
- ++pStr1,
- ++pStr2,
- ++i;
- }
-
- return STRING_MATCH;
-}
-
-// -----------------------------------------------------------------------
-
xub_StrLen STRING::Search( STRCODE c, xub_StrLen nIndex ) const
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -988,60 +705,6 @@ xub_StrLen STRING::Search( const STRCODE* pCharStr, xub_StrLen nIndex ) const
// -----------------------------------------------------------------------
-xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr,
- xub_StrLen nIndex )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
- xub_StrLen nSPos = Search( rStr, nIndex );
- if ( nSPos != STRING_NOTFOUND )
- Replace( nSPos, rStr.Len(), rRepStr );
-
- return nSPos;
-}
-
-// -----------------------------------------------------------------------
-
-void STRING::SearchAndReplaceAll( STRCODE c, STRCODE cRep )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- sal_Int32 nLen = mpData->mnLen;
- const STRCODE* pStr = mpData->maStr;
- sal_Int32 nIndex = 0;
- while ( nIndex < nLen )
- {
- if ( *pStr == c )
- {
- ImplCopyData();
- mpData->maStr[nIndex] = cRep;
- }
- ++pStr,
- ++nIndex;
- }
-}
-
-// -----------------------------------------------------------------------
-
-void STRING::SearchAndReplaceAll( const STRING& rStr, const STRING& rRepStr )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
- xub_StrLen nSPos = Search( rStr, 0 );
- while ( nSPos != STRING_NOTFOUND )
- {
- Replace( nSPos, rStr.Len(), rRepStr );
- nSPos = nSPos + rRepStr.Len();
- nSPos = Search( rStr, nSPos );
- }
-}
-
-// -----------------------------------------------------------------------
-
xub_StrLen STRING::GetTokenCount( STRCODE cTok ) const
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -1066,95 +729,6 @@ xub_StrLen STRING::GetTokenCount( STRCODE cTok ) const
return nTokCount;
}
-// -----------------------------------------------------------------------
-
-void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr,
- xub_StrLen nIndex )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
-
- const STRCODE* pStr = mpData->maStr;
- xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
- xub_StrLen nTok = 0;
- xub_StrLen nFirstChar = nIndex;
- xub_StrLen i = nFirstChar;
-
- // Bestimme die Token-Position und Laenge
- pStr += i;
- while ( i < nLen )
- {
- // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
- if ( *pStr == cTok )
- {
- ++nTok;
-
- if ( nTok == nToken )
- nFirstChar = i+1;
- else
- {
- if ( nTok > nToken )
- break;
- }
- }
-
- ++pStr,
- ++i;
- }
-
- if ( nTok >= nToken )
- Replace( nFirstChar, i-nFirstChar, rStr );
-}
-
-// -----------------------------------------------------------------------
-
-STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- const STRCODE* pStr = mpData->maStr;
- xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
- xub_StrLen nTok = 0;
- xub_StrLen nFirstChar = rIndex;
- xub_StrLen i = nFirstChar;
-
- // Bestimme die Token-Position und Laenge
- pStr += i;
- while ( i < nLen )
- {
- // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
- if ( *pStr == cTok )
- {
- ++nTok;
-
- if ( nTok == nToken )
- nFirstChar = i+1;
- else
- {
- if ( nTok > nToken )
- break;
- }
- }
-
- ++pStr,
- ++i;
- }
-
- if ( nTok >= nToken )
- {
- if ( i < nLen )
- rIndex = i+1;
- else
- rIndex = STRING_NOTFOUND;
- return Copy( nFirstChar, i-nFirstChar );
- }
- else
- {
- rIndex = STRING_NOTFOUND;
- return STRING();
- }
-}
-
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/bf_svtools/source/misc/tl_tstring.cxx b/binfilter/bf_svtools/source/misc/tl_tstring.cxx
index 8161777..168a9ae 100644
--- a/binfilter/bf_svtools/source/misc/tl_tstring.cxx
+++ b/binfilter/bf_svtools/source/misc/tl_tstring.cxx
@@ -90,100 +90,6 @@ xub_StrLen ImplStringLen( const sal_Unicode* pStr )
namespace binfilter
{
-void STRING::SearchAndReplaceAll( const STRCODE* pCharStr, const STRING& rRepStr )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
- xub_StrLen nCharLen = ImplStringLen( pCharStr );
- xub_StrLen nSPos = Search( pCharStr, 0 );
- while ( nSPos != STRING_NOTFOUND )
- {
- Replace( nSPos, nCharLen, rRepStr );
- nSPos = nSPos + rRepStr.Len();
- nSPos = Search( pCharStr, nSPos );
- }
-}
-
-xub_StrLen STRING::SearchAndReplace( const STRCODE* pCharStr, const STRING& rRepStr,
- xub_StrLen nIndex )
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
- DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
-
- xub_StrLen nSPos = Search( pCharStr, nIndex );
- if ( nSPos != STRING_NOTFOUND )
- Replace( nSPos, ImplStringLen( pCharStr ), rRepStr );
-
- return nSPos;
-}
-
-static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2,
- xub_StrLen nCount )
-{
- sal_Int32 nRet = 0;
- STRCODE c1;
- STRCODE c2;
- do
- {
- if ( !nCount )
- break;
-
- // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
- c1 = *pStr1;
- c2 = *pStr2;
- if ( (c1 >= 65) && (c1 <= 90) )
- c1 += 32;
- if ( (c2 >= 65) && (c2 <= 90) )
- c2 += 32;
- nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
- if ( nRet != 0 )
- break;
-
- ++pStr1,
- ++pStr2,
- --nCount;
- }
- while ( c2 );
-
- return nRet;
-}
-
-StringCompare STRING::CompareIgnoreCaseToAscii( const STRCODE* pCharStr,
- xub_StrLen nLen ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- // String vergleichen
- sal_Int32 nCompare = ImplStringICompare( mpData->maStr, pCharStr, nLen );
-
- // Rueckgabewert anpassen
- if ( nCompare == 0 )
- return COMPARE_EQUAL;
- else if ( nCompare < 0 )
- return COMPARE_LESS;
- else
- return COMPARE_GREATER;
-}
-
-StringCompare STRING::CompareTo( const STRCODE* pCharStr, xub_StrLen nLen ) const
-{
- DBG_CHKTHIS( STRING, DBGCHECKSTRING );
-
- // String vergleichen
- sal_Int32 nCompare = ImplStringCompare( mpData->maStr, pCharStr, nLen );
-
- // Rueckgabewert anpassen
- if ( nCompare == 0 )
- return COMPARE_EQUAL;
- else if ( nCompare < 0 )
- return COMPARE_LESS;
- else
- return COMPARE_GREATER;
-}
-
-// =======================================================================
-
static sal_Int32 ImplStringCompare( const STRCODE* pStr1, const STRCODE* pStr2 )
{
sal_Int32 nRet;
diff --git a/binfilter/bf_svtools/source/misc/tl_tustring.cxx b/binfilter/bf_svtools/source/misc/tl_tustring.cxx
index 58036d5..eb29ea1 100644
--- a/binfilter/bf_svtools/source/misc/tl_tustring.cxx
+++ b/binfilter/bf_svtools/source/misc/tl_tustring.cxx
@@ -389,6 +389,37 @@ STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs,
// -----------------------------------------------------------------------
+static sal_Int32 ImplStringICompareWithoutZero( const STRCODE* pStr1, const STRCODE* pStr2,
+ sal_Int32 nCount )
+{
+ sal_Int32 nRet = 0;
+ STRCODE c1;
+ STRCODE c2;
+ do
+ {
+ if ( !nCount )
+ break;
+
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+ nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
+
+ ++pStr1,
+ ++pStr2,
+ --nCount;
+ }
+ while ( nRet == 0 );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const
{
DBG_CHKTHIS( STRING, DBGCHECKSTRING );
@@ -713,6 +744,401 @@ STRING& STRING::ToUpperAscii()
return *this;
}
+// -----------------------------------------------------------------------
+
+STRING& STRING::Append( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // kein 0-Character und maximale Stringlaenge nicht ueberschreiten
+ sal_Int32 nLen = mpData->mnLen;
+ if ( c && (nLen < STRING_MAXLEN) )
+ {
+ // Neue Datenstruktur und neuen String erzeugen
+ STRINGDATA* pNewData = ImplAllocData( nLen+1 );
+
+ // String kopieren
+ memcpy( pNewData->maStr, mpData->maStr, nLen*sizeof( STRCODE ) );
+ pNewData->maStr[nLen] = c;
+
+ // Alte Daten loeschen und Neue zuweisen
+ STRING_RELEASE((STRING_TYPE *)mpData);
+ mpData = pNewData;
+ }
+
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+STRING& STRING::Assign( STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( c, "String::Assign() - c is 0" );
+
+ // Verwaltungsdaten anlegen und initialisieren
+ STRING_RELEASE((STRING_TYPE *)mpData);
+ mpData = ImplAllocData( 1 );
+ mpData->maStr[0] = c;
+ return *this;
+}
+
+// -----------------------------------------------------------------------
+
+StringCompare STRING::CompareTo( const STRING& rStr, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Auf Gleichheit der Pointer testen
+ if ( mpData == rStr.mpData )
+ return COMPARE_EQUAL;
+
+ // Maximale Laenge ermitteln
+ if ( mpData->mnLen < nLen )
+ nLen = static_cast< xub_StrLen >(mpData->mnLen+1);
+ if ( rStr.mpData->mnLen < nLen )
+ nLen = static_cast< xub_StrLen >(rStr.mpData->mnLen+1);
+
+ // String vergleichen
+ sal_Int32 nCompare = ImplStringCompareWithoutZero( mpData->maStr, rStr.mpData->maStr, nLen );
+
+ // Rueckgabewert anpassen
+ if ( nCompare == 0 )
+ return COMPARE_EQUAL;
+ else if ( nCompare < 0 )
+ return COMPARE_LESS;
+ else
+ return COMPARE_GREATER;
+}
+
+// -----------------------------------------------------------------------
+
+STRING::STRING( const STRCODE* pCharStr, xub_StrLen nLen )
+: mpData(NULL)
+{
+ DBG_CTOR( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( pCharStr, "String::String() - pCharStr is NULL" );
+
+ if ( nLen == STRING_LEN )
+ nLen = ImplStringLen( pCharStr );
+
+#ifdef DBG_UTIL
+ if ( DbgIsAssert() )
+ {
+ for ( xub_StrLen i = 0; i < nLen; i++ )
+ {
+ if ( !pCharStr[i] )
+ {
+ OSL_FAIL( "String::String() : nLen is wrong" );
+ }
+ }
+ }
+#endif
+
+ // Ist es kein leerer String
+ if ( nLen )
+ {
+ // Verwaltungsdaten anlegen und String kopieren
+ mpData = ImplAllocData( nLen );
+ memcpy( mpData->maStr, pCharStr, nLen*sizeof( STRCODE ) );
+ }
+ else
+ {
+ STRING_NEW((STRING_TYPE **)&mpData);
+ }
+}
+
+// -----------------------------------------------------------------------
+
+STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
+ xub_StrLen nTok = 0;
+ xub_StrLen nFirstChar = rIndex;
+ xub_StrLen i = nFirstChar;
+
+ // Bestimme die Token-Position und Laenge
+ pStr += i;
+ while ( i < nLen )
+ {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( *pStr == cTok )
+ {
+ ++nTok;
+
+ if ( nTok == nToken )
+ nFirstChar = i+1;
+ else
+ {
+ if ( nTok > nToken )
+ break;
+ }
+ }
+
+ ++pStr,
+ ++i;
+ }
+
+ if ( nTok >= nToken )
+ {
+ if ( i < nLen )
+ rIndex = i+1;
+ else
+ rIndex = STRING_NOTFOUND;
+ return Copy( nFirstChar, i-nFirstChar );
+ }
+ else
+ {
+ rIndex = STRING_NOTFOUND;
+ return STRING();
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SetToken( xub_StrLen nToken, STRCODE cTok, const STRING& rStr,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ const STRCODE* pStr = mpData->maStr;
+ xub_StrLen nLen = (xub_StrLen)mpData->mnLen;
+ xub_StrLen nTok = 0;
+ xub_StrLen nFirstChar = nIndex;
+ xub_StrLen i = nFirstChar;
+
+ // Bestimme die Token-Position und Laenge
+ pStr += i;
+ while ( i < nLen )
+ {
+ // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount
+ if ( *pStr == cTok )
+ {
+ ++nTok;
+
+ if ( nTok == nToken )
+ nFirstChar = i+1;
+ else
+ {
+ if ( nTok > nToken )
+ break;
+ }
+ }
+
+ ++pStr,
+ ++i;
+ }
+
+ if ( nTok >= nToken )
+ Replace( nFirstChar, i-nFirstChar, rStr );
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SetChar( xub_StrLen nIndex, STRCODE c )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_ASSERT( nIndex < mpData->mnLen, "String::SetChar() - nIndex > String.Len()" );
+
+ // Daten kopieren, wenn noetig und Character zuweisen
+ ImplCopyData();
+ mpData->maStr[nIndex] = c;
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::Match( const STRING& rStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Ist dieser String leer
+ if ( !mpData->mnLen )
+ return STRING_MATCH;
+
+ // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen
+ const STRCODE* pStr1 = mpData->maStr;
+ const STRCODE* pStr2 = rStr.mpData->maStr;
+ xub_StrLen i = 0;
+ while ( i < mpData->mnLen )
+ {
+ // Stimmt das Zeichen nicht ueberein, dann abbrechen
+ if ( *pStr1 != *pStr2 )
+ return i;
+ ++pStr1,
+ ++pStr2,
+ ++i;
+ }
+
+ return STRING_MATCH;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool STRING::EqualsIgnoreCaseAscii( const STRING& rStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Sind die Daten gleich
+ if ( mpData == rStr.mpData )
+ return sal_True;
+
+ // Gleiche Laenge
+ if ( mpData->mnLen != rStr.mpData->mnLen )
+ return sal_False;
+
+ // String vergleichen
+ return (ImplStringICompareWithoutZero( mpData->maStr, rStr.mpData->maStr, mpData->mnLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+static sal_Int32 ImplStringICompare( const STRCODE* pStr1, const STRCODE* pStr2 )
+{
+ sal_Int32 nRet;
+ STRCODE c1;
+ STRCODE c2;
+ do
+ {
+ // Ist das Zeichen zwischen 'A' und 'Z' dann umwandeln
+ c1 = *pStr1;
+ c2 = *pStr2;
+ if ( (c1 >= 65) && (c1 <= 90) )
+ c1 += 32;
+ if ( (c2 >= 65) && (c2 <= 90) )
+ c2 += 32;
+ nRet = ((sal_Int32)((STRCODEU)c1))-((sal_Int32)((STRCODEU)c2));
+ if ( nRet != 0 )
+ break;
+
+ ++pStr1,
+ ++pStr2;
+ }
+ while ( c2 );
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool STRING::EqualsIgnoreCaseAscii( const STRCODE* pCharStr ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ return (ImplStringICompare( mpData->maStr, pCharStr ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool STRING::Equals( const STRING& rStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (rStr.mpData->mnLen == 0);
+ sal_Int32 nMaxLen = mpData->mnLen-nIndex;
+ if ( nMaxLen < nLen )
+ {
+ if ( rStr.mpData->mnLen != nMaxLen )
+ return sal_False;
+ nLen = static_cast< xub_StrLen >(nMaxLen);
+ }
+
+ // String vergleichen
+ return (ImplStringCompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0);
+}
+
+static sal_Int32 ImplStringCompare( const STRCODE* pStr1, const STRCODE* pStr2,
+ xub_StrLen nCount )
+{
+ sal_Int32 nRet = 0;
+ while ( nCount &&
+ ((nRet = ((sal_Int32)((STRCODEU)*pStr1))-((sal_Int32)((STRCODEU)*pStr2))) == 0) &&
+ *pStr2 )
+ {
+ ++pStr1,
+ ++pStr2,
+ --nCount;
+ }
+
+ return nRet;
+}
+
+// -----------------------------------------------------------------------
+
+sal_Bool STRING::Equals( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ // Are there enough codes for comparing?
+ if ( nIndex > mpData->mnLen )
+ return (*pCharStr == 0);
+
+ return (ImplStringCompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0);
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SearchAndReplaceAll( STRCODE c, STRCODE cRep )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+
+ sal_Int32 nLen = mpData->mnLen;
+ const STRCODE* pStr = mpData->maStr;
+ sal_Int32 nIndex = 0;
+ while ( nIndex < nLen )
+ {
+ if ( *pStr == c )
+ {
+ ImplCopyData();
+ mpData->maStr[nIndex] = cRep;
+ }
+ ++pStr,
+ ++nIndex;
+ }
+}
+
+// -----------------------------------------------------------------------
+
+void STRING::SearchAndReplaceAll( const STRING& rStr, const STRING& rRepStr )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nSPos = Search( rStr, 0 );
+ while ( nSPos != STRING_NOTFOUND )
+ {
+ Replace( nSPos, rStr.Len(), rRepStr );
+ nSPos = nSPos + rRepStr.Len();
+ nSPos = Search( rStr, nSPos );
+ }
+}
+
+// -----------------------------------------------------------------------
+
+xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr,
+ xub_StrLen nIndex )
+{
+ DBG_CHKTHIS( STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING );
+ DBG_CHKOBJ( &rRepStr, STRING, DBGCHECKSTRING );
+
+ xub_StrLen nSPos = Search( rStr, nIndex );
+ if ( nSPos != STRING_NOTFOUND )
+ Replace( nSPos, rStr.Len(), rRepStr );
+
+ return nSPos;
+}
+
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/binfilter/inc/bf_tools/string.hxx b/binfilter/inc/bf_tools/string.hxx
index b421f5b..d81a51c 100644
--- a/binfilter/inc/bf_tools/string.hxx
+++ b/binfilter/inc/bf_tools/string.hxx
@@ -129,23 +129,24 @@ private:
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 something to fit
+ ByteString( const sal_Char* pCharStr, xub_StrLen nLen ); //not implemented
ByteString& Assign( 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( sal_Char c ); //not implemented
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( char c ); //not implemented
void operator +=(int); // not implemented; to detect misuses
// of operator +=(sal_Char)
-
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
@@ -156,7 +157,6 @@ public:
ByteString& Assign( const ByteString& rStr );
ByteString& Assign( const rtl::OString& rStr );
ByteString& Assign( const sal_Char* pCharStr );
- ByteString& Assign( sal_Char c );
ByteString& operator =( const ByteString& rStr )
{ return Assign( rStr ); }
ByteString& operator =( const rtl::OString& rStr )
@@ -169,7 +169,6 @@ public:
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 )
@@ -177,7 +176,6 @@ public:
ByteString& operator +=( sal_Char c )
{ return Append( c ); }
- void SetChar( xub_StrLen nIndex, sal_Char c );
sal_Char GetChar( xub_StrLen nIndex ) const
{ return mpData->maStr[nIndex]; }
@@ -200,40 +198,14 @@ public:
ByteString& ToLowerAscii();
- 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 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 );
-
xub_StrLen GetTokenCount( sal_Char cTok = ';' ) const;
- 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; }
@@ -249,30 +221,6 @@ 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 )
- { return (rStr.CompareTo( pCharStr ) <= COMPARE_EQUAL); }
- friend sal_Bool operator <= ( const ByteString& rStr1, const ByteString& rStr2 )
- { return !(operator > ( rStr1, rStr2 )); }
- friend sal_Bool operator <= ( const ByteString& rStr, const sal_Char* pCharStr )
- { 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 !(operator < ( rStr1, rStr2 )); }
- friend sal_Bool operator >= ( const ByteString& rStr, const sal_Char* pCharStr )
- { return !(operator < ( rStr, pCharStr )); }
- friend sal_Bool operator >= ( const sal_Char* pCharStr, const ByteString& rStr )
- { return !(operator < ( pCharStr, rStr )); }
};
inline ByteString ByteString::Copy( xub_StrLen nIndex, xub_StrLen nCount ) const
@@ -280,12 +228,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 );
-}
-
// -----------------------------------------------------------------------
// ------------------------
More information about the Libreoffice-commits
mailing list