diff options
author | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
---|---|---|
committer | Bjoern Michaelsen <bjoern.michaelsen@canonical.com> | 2011-07-21 18:56:16 +0200 |
commit | a233dac0653f3f3054f7ad2da114ed989747e89a (patch) | |
tree | bf1e11438321c06125a94308649c496648061ccb /tools | |
parent | acb6133d89abe071108577f821d7eaa381378879 (diff) | |
parent | e5647de7dd26775e45af24f11ac4f82a5518bd9e (diff) |
resyncing to master
Diffstat (limited to 'tools')
53 files changed, 649 insertions, 3038 deletions
diff --git a/tools/Executable_mkunroll.mk b/tools/Executable_mkunroll.mk index c81bfb19b4b3..d423b73c755b 100644 --- a/tools/Executable_mkunroll.mk +++ b/tools/Executable_mkunroll.mk @@ -49,8 +49,4 @@ $(eval $(call gb_Executable_add_exception_objects,mkunroll,\ tools/bootstrp/mkunroll/mkunroll \ )) -$(eval $(call gb_Executable_add_linked_static_libs,rscdep,\ - toolshelpers \ -)) - # vim: set noet sw=4 ts=4: diff --git a/tools/Library_tl.mk b/tools/Library_tl.mk index 297484b39583..439f171f406b 100644 --- a/tools/Library_tl.mk +++ b/tools/Library_tl.mk @@ -38,7 +38,6 @@ $(eval $(call gb_Library_set_include,tl,\ -I$(realpath $(SRCDIR)/tools/inc/pch) \ -I$(SRCDIR)/solenv/inc \ -I$(SRCDIR)/solenv/inc/Xp31 \ - -I$(OUTDIR)/inc/offuh \ -I$(WORKDIR)/CustomTarget/tools/source/reversemap \ )) @@ -47,6 +46,11 @@ $(eval $(call gb_Library_add_defs,tl,\ -DVCL \ )) +$(eval $(call gb_Library_add_api,tl,\ + udkapi \ + offapi \ +)) + $(eval $(call gb_Library_add_linked_libs,tl,\ basegfx \ comphelper \ diff --git a/tools/Module_tools.mk b/tools/Module_tools.mk index a16310587a1f..064f6d74de7d 100644 --- a/tools/Module_tools.mk +++ b/tools/Module_tools.mk @@ -29,10 +29,6 @@ $(eval $(call gb_Module_Module,tools)) $(eval $(call gb_Module_add_targets,tools,\ - Executable_bestreversemap \ - Executable_mkunroll \ - Executable_rscdep \ - Executable_so_checksum \ Library_tl \ Package_inc \ Package_reversemap \ @@ -40,4 +36,13 @@ $(eval $(call gb_Module_add_targets,tools,\ StaticLibrary_toolshelpers \ )) +ifneq ($(CROSS_COMPILING),YES) +$(eval $(call gb_Module_add_targets,tools,\ + Executable_bestreversemap \ + Executable_mkunroll \ + Executable_rscdep \ + Executable_so_checksum \ +)) +endif + # vim: set noet sw=4 ts=4: diff --git a/tools/StaticLibrary_ooopathutils.mk b/tools/StaticLibrary_ooopathutils.mk index e58becb175d3..c5b2ea6ad846 100644 --- a/tools/StaticLibrary_ooopathutils.mk +++ b/tools/StaticLibrary_ooopathutils.mk @@ -39,7 +39,7 @@ $(eval $(call gb_StaticLibrary_add_exception_objects,ooopathutils,\ # Instead of this evil linking of an object from $(OUTDIR) define StaticLibrary_ooopathutils_hack $(call gb_StaticLibrary_get_target,ooopathutils) : $(OUTDIR)/lib/$(1) -$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils))) +$$(eval $$(call gb_Deliver_add_deliverable,$(OUTDIR)/lib/$(1),$(call gb_CxxObject_get_target,tools/source/misc/pathutils),$(1))) $(OUTDIR)/lib/$(1) : $(call gb_CxxObject_get_target,tools/source/misc/pathutils) $$(call gb_Deliver_deliver,$$<,$$@) diff --git a/tools/StaticLibrary_toolshelpers.mk b/tools/StaticLibrary_toolshelpers.mk index f8e306aab99d..5583c8b4a056 100644 --- a/tools/StaticLibrary_toolshelpers.mk +++ b/tools/StaticLibrary_toolshelpers.mk @@ -39,7 +39,6 @@ $(eval $(call gb_StaticLibrary_add_cxxflags,toolshelpers,\ )) $(eval $(call gb_StaticLibrary_add_exception_objects,toolshelpers,\ - tools/bootstrp/appdef \ tools/bootstrp/cppdep \ tools/bootstrp/prj \ )) diff --git a/tools/bootstrp/appdef.cxx b/tools/bootstrp/appdef.cxx deleted file mode 100644 index 9600272ca858..000000000000 --- a/tools/bootstrp/appdef.cxx +++ /dev/null @@ -1,54 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -// MARKER(update_precomp.py): autogen include statement, do not remove -#include "precompiled_tools.hxx" - -#include <stdlib.h> -#include <stdio.h> -#include <string.h> - -#include "bootstrp/appdef.hxx" - -const char* GetEnv( const char *pVar ) -{ - char const *pRet = getenv( pVar ); - if ( !pRet ) - pRet = ""; - return pRet; -} - -const char* GetEnv( const char *pVar, const char *pDefault ) -{ - char *pRet = getenv( pVar ); - if ( !pRet ) - return pDefault; - return pRet; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/md5.cxx b/tools/bootstrp/md5.cxx index 1df85d32ff80..18ecb46ceb9d 100644 --- a/tools/bootstrp/md5.cxx +++ b/tools/bootstrp/md5.cxx @@ -34,7 +34,7 @@ #include <cstddef> #include <stdio.h> -#include <tools/string.hxx> +#include <rtl/strbuf.hxx> #ifdef WNT #define FILE_OPEN_READ "rb" @@ -93,13 +93,14 @@ void normalize_pe_image(sal_uInt8* buffer, size_t nBufferSize) } } -rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) +rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum) { const size_t BUFFER_SIZE = 0x1000; const size_t MINIMAL_SIZE = 512; sal_uInt8 checksum[RTL_DIGEST_LENGTH_MD5]; - rtlDigestError error = rtl_Digest_E_None; + rtlDigestError error = rtl_Digest_E_None; + rtl::OStringBuffer aChecksumBuf; FILE *fp = fopen( filename, FILE_OPEN_READ ); @@ -136,8 +137,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) for ( std::size_t i = 0; i < sizeof(checksum); i++ ) { if ( checksum[i] < 16 ) - aChecksum.Append( "0" ); - aChecksum += ByteString::CreateFromInt32( checksum[i], 16 ); + aChecksumBuf.append('0'); + aChecksumBuf.append(static_cast<sal_Int32>(checksum[i]), 16); } } @@ -146,6 +147,8 @@ rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ) else error = rtl_Digest_E_Unknown; + rChecksum = aChecksumBuf.makeStringAndClear(); + return error; } diff --git a/tools/bootstrp/md5.hxx b/tools/bootstrp/md5.hxx index f8d6e6b9695a..9f6e4aea6100 100644 --- a/tools/bootstrp/md5.hxx +++ b/tools/bootstrp/md5.hxx @@ -27,8 +27,8 @@ ************************************************************************/ #include <rtl/digest.h> -class ByteString; +#include <rtl/string.hxx> -rtlDigestError calc_md5_checksum( const char *filename, ByteString &aChecksum ); +rtlDigestError calc_md5_checksum(const char *filename, rtl::OString &rChecksum); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/bootstrp/mkunroll/mkunroll.cxx b/tools/bootstrp/mkunroll/mkunroll.cxx index ff958ba8e717..c1b0252a65ca 100644 --- a/tools/bootstrp/mkunroll/mkunroll.cxx +++ b/tools/bootstrp/mkunroll/mkunroll.cxx @@ -212,7 +212,7 @@ void MkFilter::Filter() { MkLine *pMkLine = (*pLine->pPrivateTnrLst)[ i ]; ByteString aLine = pMkLine->aLine; - while( aLine.SearchAndReplace( aTnr, ByteString::CreateFromInt32( n )) != (sal_uInt16)-1 ) ; + while( aLine.SearchAndReplace( aTnr, rtl::OString::valueOf(static_cast<sal_Int32>(n)) ) != (sal_uInt16)-1 ) ; fputs( aLine.GetBuffer(), pOut ); fprintf( stderr, "o" ); } diff --git a/tools/bootstrp/prj.cxx b/tools/bootstrp/prj.cxx index 00be3bedddee..b44592c562ec 100644 --- a/tools/bootstrp/prj.cxx +++ b/tools/bootstrp/prj.cxx @@ -53,26 +53,26 @@ SimpleConfig::~SimpleConfig() aFileStream.Close (); } -ByteString SimpleConfig::GetNext() +rtl::OString SimpleConfig::getNext() { - if ( aStringBuffer =="" ) + if (aStringBuffer == "") while ((aStringBuffer = GetNextLine()) == "\t") ; //solange bis != "\t" - if ( aStringBuffer =="" ) - return ByteString(); + if ( aStringBuffer == "" ) + return rtl::OString(); - ByteString aString = aStringBuffer.GetToken(0,'\t'); - aStringBuffer.Erase(0, aString.Len()+1); + rtl::OString aString = aStringBuffer.GetToken(0,'\t'); + aStringBuffer.Erase(0, aString.getLength()+1); aStringBuffer.EraseLeadingChars( '\t' ); return aString; } -ByteString SimpleConfig::GetNextLine() +rtl::OString SimpleConfig::GetNextLine() { aFileStream.ReadLine ( aTmpStr ); if ( aTmpStr.Search( "#" ) == 0 ) - return "\t"; + return rtl::OString('\t'); aTmpStr = aTmpStr.EraseLeadingChars(); aTmpStr = aTmpStr.EraseTrailingChars(); while ( aTmpStr.SearchAndReplace(ByteString(' '),ByteString('\t') ) != STRING_NOTFOUND ) ; diff --git a/tools/bootstrp/rscdep.cxx b/tools/bootstrp/rscdep.cxx index 1ebd9e85ac9a..d1e26f21d27a 100644 --- a/tools/bootstrp/rscdep.cxx +++ b/tools/bootstrp/rscdep.cxx @@ -125,13 +125,13 @@ int main( int argc, char** argv ) } if (aBuf[0] == '@' ) { - ByteString aToken; + rtl::OString aToken; String aRespName( &aBuf[1], gsl_getSystemTextEncoding()); SimpleConfig aConfig( aRespName ); - while ( (aToken = aConfig.GetNext()) != "") + while ((aToken = aConfig.getNext()).getLength()) { char aBuf2[255]; - (void) strcpy( aBuf2, aToken.GetBuffer()); + strcpy( aBuf2, aToken.getStr()); if ( aBuf[0] == '-' && aBuf[1] == 'p' && aBuf[2] == '=' ) { strcpy(pFileNamePrefix, &aBuf[3]); diff --git a/tools/bootstrp/so_checksum.cxx b/tools/bootstrp/so_checksum.cxx index e38252ea2f70..9ff6a6832379 100644 --- a/tools/bootstrp/so_checksum.cxx +++ b/tools/bootstrp/so_checksum.cxx @@ -31,20 +31,20 @@ #include "md5.hxx" -#include <stdio.h> +#include <rtl/string.hxx> -#include <tools/string.hxx> +#include <stdio.h> int main( int argc, char * argv[] ) { - for ( int n = 1; n < argc; n++ ) + for (int n = 1; n < argc; ++n) { - ByteString aChecksum; - rtlDigestError error = calc_md5_checksum( argv[n], aChecksum ); + rtl::OString aChecksum; + rtlDigestError error = calc_md5_checksum(argv[n], aChecksum); if ( rtl_Digest_E_None == error ) { - printf( "%s %s\n", aChecksum.GetBuffer(), argv[n] ); + printf( "%s %s\n", aChecksum.getStr(), argv[n] ); } else printf( "ERROR: Unable to calculate MD5 checksum for %s\n", argv[n] ); diff --git a/tools/inc/bootstrp/appdef.hxx b/tools/inc/bootstrp/appdef.hxx deleted file mode 100644 index 833cd404847f..000000000000 --- a/tools/inc/bootstrp/appdef.hxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/************************************************************************* - * - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. - * - * Copyright 2000, 2010 Oracle and/or its affiliates. - * - * OpenOffice.org - a multi-platform office productivity suite - * - * This file is part of OpenOffice.org. - * - * OpenOffice.org is free software: you can redistribute it and/or modify - * it under the terms of the GNU Lesser General Public License version 3 - * only, as published by the Free Software Foundation. - * - * OpenOffice.org is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Lesser General Public License version 3 for more details - * (a copy is included in the LICENSE file that accompanied this code). - * - * You should have received a copy of the GNU Lesser General Public License - * version 3 along with OpenOffice.org. If not, see - * <http://www.openoffice.org/license.html> - * for a copy of the LGPLv3 License. - * - ************************************************************************/ - -#ifndef _MHAPPDEF_HXX -#define _MHAPPDEF_HXX - - -#ifdef UNX -#define PATH_SEPARATOR '/' -#define S_PATH_SEPARATOR "/" -#else -#define PATH_SEPARATOR '\\' -#define S_PATH_SEPARATOR "\\" -#endif - -// path conversion - -const char* GetEnv( const char *pVar ); -const char* GetEnv( const char *pVar, const char *pDefault ); - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/bootstrp/prj.hxx b/tools/inc/bootstrp/prj.hxx index 496f47bc88d1..35896065d159 100644 --- a/tools/inc/bootstrp/prj.hxx +++ b/tools/inc/bootstrp/prj.hxx @@ -31,6 +31,7 @@ #include <tools/fsys.hxx> #include <tools/stream.hxx> +#include <rtl/string.hxx> /********************************************************************* * @@ -45,11 +46,11 @@ class SimpleConfig ByteString aTmpStr; ByteString aStringBuffer; - ByteString GetNextLine(); + rtl::OString GetNextLine(); public: SimpleConfig(const String& rSimpleConfigFileName); ~SimpleConfig(); - ByteString GetNext(); + rtl::OString getNext(); }; #endif diff --git a/tools/inc/impstrg.hxx b/tools/inc/impstrg.hxx index e99e2b3990b3..178bccec26e8 100644 --- a/tools/inc/impstrg.hxx +++ b/tools/inc/impstrg.hxx @@ -46,12 +46,6 @@ const char* DbgCheckUniString( const void* pString ); xub_StrLen ImplStringLen( const sal_Char* pStr ); xub_StrLen ImplStringLen( const sal_Unicode* pStr ); -// ------------------------------------ -// - Zugriff fuer International class - -// ------------------------------------ - -sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding ); - #endif // _IMPSTRG_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/inc/tools/b3dtrans.hxx b/tools/inc/tools/b3dtrans.hxx index 2c136870d72b..420db468291a 100644 --- a/tools/inc/tools/b3dtrans.hxx +++ b/tools/inc/tools/b3dtrans.hxx @@ -147,7 +147,6 @@ public: void Reset(); // ObjectTrans - void SetObjectTrans(const basegfx::B3DHomMatrix& rObj); const basegfx::B3DHomMatrix& GetObjectTrans() { return maObjectTrans; } const basegfx::B3DHomMatrix& GetInvObjectTrans() { return maInvObjectTrans; } @@ -156,35 +155,26 @@ public: basegfx::B3DPoint aVRP = basegfx::B3DPoint(0.0,0.0,1.0), basegfx::B3DVector aVPN = basegfx::B3DVector(0.0,0.0,1.0), basegfx::B3DVector aVUP = basegfx::B3DVector(0.0,1.0,0.0)); - void SetOrientation(basegfx::B3DHomMatrix& mOrient); const basegfx::B3DHomMatrix& GetOrientation() { return maOrientation; } const basegfx::B3DHomMatrix& GetInvOrientation() { return maInvOrientation; } // Projection void SetProjection(const basegfx::B3DHomMatrix& mProject); const basegfx::B3DHomMatrix& GetProjection(); - const basegfx::B3DHomMatrix& GetInvProjection(); // Texture - void SetTexture(const basegfx::B2DHomMatrix& rTxt); const basegfx::B2DHomMatrix& GetTexture() { return maTexture; } // Seitenverhaeltnis und Modus zu dessen Aufrechterhaltung double GetRatio() { return mfRatio; } void SetRatio(double fNew=1.0); Base3DRatio GetRatioMode() { return meRatio; } - void SetRatioMode(Base3DRatio eNew=Base3DRatioGrow); // Parameter der ViewportTransformation void SetDeviceRectangle(double fL=-1.0, double fR=1.0, double fB=-1.0, double fT=1.0, sal_Bool bBroadCastChange=sal_True); - void SetDeviceVolume(const basegfx::B3DRange& rVol, sal_Bool bBroadCastChange=sal_True); - void GetDeviceRectangle(double &fL, double &fR, double& fB, double& fT); - basegfx::B3DRange GetDeviceVolume(); double GetDeviceRectangleWidth() const { return mfRightBound - mfLeftBound; } double GetDeviceRectangleHeight() const { return mfTopBound - mfBottomBound; } - void SetFrontClippingPlane(double fF=0.0); double GetFrontClippingPlane() { return mfNearBound; } - void SetBackClippingPlane(double fB=1.0); double GetBackClippingPlane() { return mfFarBound; } void SetPerspective(sal_Bool bNew); sal_Bool GetPerspective() { return mbPerspective; } @@ -193,44 +183,13 @@ public: const Rectangle& GetViewportRectangle() { return maViewportRectangle; } void CalcViewport(); - // Spezielle Matritzen anfordern - basegfx::B3DHomMatrix GetMatFromObjectToView(); - - // Transponierte Inverse fuer Vectortransformationen - const basegfx::B3DHomMatrix& GetInvTransObjectToEye(); - - // Speziell zum Umwandeln von Punkten Objekt -> Device - const basegfx::B3DHomMatrix& GetObjectToDevice(); - - // Speziell zum Umwandeln von Punkten World -> View - const basegfx::B3DHomMatrix& GetMatFromWorldToView(); - const basegfx::B3DHomMatrix& GetInvMatFromWorldToView(); - // Bounds des Viewports lesen - const Rectangle& GetLogicalViewportBounds(); const basegfx::B3DVector& GetScale(); const basegfx::B3DVector& GetTranslate(); // Direkter Zugriff auf verschiedene Transformationen const basegfx::B3DPoint WorldToEyeCoor(const basegfx::B3DPoint& rVec); const basegfx::B3DPoint EyeToWorldCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint WorldToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToWorldCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint DeviceToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToDeviceCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ObjectToWorldCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint WorldToObjectCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ObjectToViewCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ViewToObjectCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint ObjectToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToObjectCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint DeviceToEyeCoor(const basegfx::B3DPoint& rVec); - const basegfx::B3DPoint EyeToDeviceCoor(const basegfx::B3DPoint& rVec); - - const basegfx::B3DPoint InvTransObjectToEye(const basegfx::B3DPoint& rVec); - const basegfx::B2DPoint TransTextureCoor(const basegfx::B2DPoint& rVec); static void Frustum( basegfx::B3DHomMatrix& rTarget, @@ -252,7 +211,6 @@ protected: void PostSetObjectTrans(); void PostSetOrientation(); void PostSetProjection(); - void PostSetTexture(); void PostSetViewport(); void CalcMatObjectToDevice(); @@ -282,8 +240,6 @@ public: B3dViewport(); virtual ~B3dViewport(); - void SetVRP(const basegfx::B3DPoint& rNewVRP); - void SetVPN(const basegfx::B3DVector& rNewVPN); void SetVUV(const basegfx::B3DVector& rNewVUV); void SetViewportValues( const basegfx::B3DPoint& rNewVRP, @@ -324,22 +280,16 @@ public: virtual ~B3dCamera(); // Positionen - void SetPosition(const basegfx::B3DPoint& rNewPos); const basegfx::B3DPoint& GetPosition() const { return aPosition; } - void SetLookAt(const basegfx::B3DVector& rNewLookAt); const basegfx::B3DVector& GetLookAt() const { return aLookAt; } - void SetPositionAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DVector& rNewLookAt); // Brennweite in mm - void SetFocalLength(double fLen); double GetFocalLength() const { return fFocalLength; } // Neigung links/rechts - void SetBankAngle(double fAngle); double GetBankAngle() const { return fBankAngle; } // FocalLength Flag - void SetUseFocalLength(sal_Bool bNew); sal_Bool GetUseFocalLength() const { return (sal_Bool)bUseFocalLength; } protected: diff --git a/tools/inc/tools/bigint.hxx b/tools/inc/tools/bigint.hxx index 58810fffdd99..1b1d60bdb6e3 100644 --- a/tools/inc/tools/bigint.hxx +++ b/tools/inc/tools/bigint.hxx @@ -105,7 +105,6 @@ public: sal_Bool IsOne() const; sal_Bool IsLong() const { return !bIsBig; } void Abs(); - void DivMod( const BigInt &rDivisor, BigInt &rMod ); #ifdef _TLBIGINT_INT64 sal_Bool INT64 ( SbxINT64 *p ) const; sal_Bool UINT64( SbxUINT64 *p ) const; diff --git a/tools/inc/tools/fsys.hxx b/tools/inc/tools/fsys.hxx index 440d3aeaeabb..a0a494f538ad 100644 --- a/tools/inc/tools/fsys.hxx +++ b/tools/inc/tools/fsys.hxx @@ -215,9 +215,6 @@ public: static sal_uIntPtr SetReadOnlyFlag( const DirEntry &rEntry, sal_Bool bRO = sal_True ); static sal_Bool GetReadOnlyFlag( const DirEntry &rEntry ); - static ErrCode QueryDiskSpace( const String &rPath, - BigInt &rFreeBytes, BigInt &rTotalBytes ); - static void SetDateTime( const String& rFileName, const DateTime& rNewDateTime ); }; @@ -254,10 +251,13 @@ private: TOOLS_DLLPRIVATE FSysError ImpParseName( const ByteString& rIntiName, FSysPathStyle eParser ); +#if defined(WNT) TOOLS_DLLPRIVATE FSysError ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eStyle ); +#else TOOLS_DLLPRIVATE FSysError ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eStyle ); +#endif TOOLS_DLLPRIVATE const DirEntry* ImpGetTopPtr() const; TOOLS_DLLPRIVATE DirEntry* ImpGetTopPtr(); @@ -290,7 +290,6 @@ public: void SetExtension( const String& rExt, char cSep = '.' ); String GetExtension( char cSep = '.' ) const; - String CutExtension( char cSep = '.' ); void SetName( const String& rName, FSysPathStyle eFormatter = FSYS_STYLE_HOST ); inline const String GetNameDirect() const { return String(aName, osl_getThreadTextEncoding()); } String GetName( FSysPathStyle eFormatter = FSYS_STYLE_HOST ) const; @@ -336,19 +335,20 @@ public: sal_Bool operator !=( const DirEntry& rAnotherDir ) const { return !(DirEntry::operator==( rAnotherDir )); } - StringCompare NameCompare( const DirEntry &rWith ) const; inline StringCompare NameCompareDirect( const DirEntry &rWith ) const { #ifdef UNX return rWith.aName.CompareTo( aName ); #else - return rWith.aName.CompareIgnoreCaseToAscii( aName ); + rtl::OString aThis(rtl::OString(aName).toAsciiLowerCase()); + rtl::OString aWith(rtl::OString(rWith.aName).toAsciiLowerCase()); + return static_cast<StringCompare>(aWith.compareTo(aThis)); #endif } static String GetAccessDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); static String GetSearchDelimiter( FSysPathStyle eFormatter = FSYS_STYLE_HOST ); - static FSysPathStyle GetPathStyle( const String &rDevice ); + static FSysPathStyle GetPathStyle(); }; // -------------- @@ -445,18 +445,10 @@ protected: #endif public: - Dir(); Dir( const DirEntry& rDirEntry, DirEntryKind nKind = FSYS_KIND_ALL ); - Dir( const DirEntry& rDirEntry, - DirEntryKind nKind, - FSysSort nSort, ... ); ~Dir(); - const WildCard& GetNameMask() const { return aNameMask; } - - FSysError SetSort( FSysSort nSort, ... ); - void Reset(); sal_uInt16 Scan( sal_uInt16 nCount = 5 ); size_t Count( sal_Bool bUpdated = sal_True ) const; @@ -522,12 +514,6 @@ public: #endif // BOOTSTRP -//======================================================================== - -void FSysEnableSysErrorBox( sal_Bool bEnable ); - -//======================================================================== - #if defined(DBG_UTIL) void FSysTest(); #endif diff --git a/tools/inc/tools/inetmime.hxx b/tools/inc/tools/inetmime.hxx index d5b56b090725..4a3abe577101 100644 --- a/tools/inc/tools/inetmime.hxx +++ b/tools/inc/tools/inetmime.hxx @@ -352,15 +352,6 @@ public: */ static inline int getBase64Weight(sal_uInt32 nChar); - /** Get a decimal digit encoded as US-ASCII. - - @param nWeight Must be in the range 0--9, inclusive. - - @return The decimal digit corresponding to nWeight (US-ASCII - '0'--'9'). - */ - static sal_uInt32 getDigit(int nWeight); - /** Get a hexadecimal digit encoded as US-ASCII. @param nWeight Must be in the range 0--15, inclusive. @@ -370,15 +361,6 @@ public: */ static sal_uInt32 getHexDigit(int nWeight); - /** Get a Base 64 digit encoded as US-ASCII. - - @param nWeight Must be in the range 0--63, inclusive. - - @return The Base 64 digit corresponding to nWeight (US-ASCII 'A'-- - 'Z', 'a'--'z', '0'--'9', '+' or '/'). - */ - static sal_uInt32 getBase64Digit(int nWeight); - static inline bool isHighSurrogate(sal_uInt32 nUTF16); static inline bool isLowSurrogate(sal_uInt32 nUTF16); @@ -394,28 +376,6 @@ public: @param pEnd1 Points past the end of the first string, must be >= pBegin1. - @param pBegin2 Points to the start of the second string, must not be - null. - - @param pEnd2 Points past the end of the second string, must be >= - pBegin2. - - @return True if the two strings are equal, ignoring the case of US- - ASCII alphabetic characters (US-ASCII 'A'--'Z' and 'a'--'z'). - */ - static bool equalIgnoreCase(const sal_Char * pBegin1, - const sal_Char * pEnd1, - const sal_Char * pBegin2, - const sal_Char * pEnd2); - - /** Check two US-ASCII strings for equality, ignoring case. - - @param pBegin1 Points to the start of the first string, must not be - null. - - @param pEnd1 Points past the end of the first string, must be >= - pBegin1. - @param pString2 Points to the start of the null terminated second string, must not be null. @@ -472,9 +432,6 @@ public: static bool startsWithLinearWhiteSpace(const sal_Char * pBegin, const sal_Char * pEnd); - static const sal_Char * skipLinearWhiteSpace(const sal_Char * pBegin, - const sal_Char * pEnd); - static const sal_Unicode * skipLinearWhiteSpace(const sal_Unicode * pBegin, const sal_Unicode * pEnd); @@ -503,12 +460,6 @@ public: static const sal_Unicode * skipQuotedString(const sal_Unicode * pBegin, const sal_Unicode * pEnd); - static const sal_Char * scanAtom(const sal_Char * pBegin, - const sal_Char * pEnd); - - static const sal_Unicode * scanAtom(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - static bool scanUnsigned(const sal_Char *& rBegin, const sal_Char * pEnd, bool bLeadingZeroes, sal_uInt32 & rValue); @@ -516,21 +467,6 @@ public: const sal_Unicode * pEnd, bool bLeadingZeroes, sal_uInt32 & rValue); - static bool scanUnsignedHex(const sal_Char *& rBegin, - const sal_Char * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue); - - static bool scanUnsignedHex(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue); - - static const sal_Char * scanQuotedBlock(const sal_Char * pBegin, - const sal_Char * pEnd, - sal_uInt32 nOpening, - sal_uInt32 nClosing, - sal_Size & rLength, - bool & rModify); - static const sal_Unicode * scanQuotedBlock(const sal_Unicode * pBegin, const sal_Unicode * pEnd, sal_uInt32 nOpening, @@ -559,9 +495,6 @@ public: static rtl_TextEncoding getCharsetEncoding(const sal_Char * pBegin, const sal_Char * pEnd); - static rtl_TextEncoding getCharsetEncoding(const sal_Unicode * pBegin, - const sal_Unicode * pEnd); - static inline bool isMIMECharsetEncoding(rtl_TextEncoding eEncoding); static INetMIMECharsetList_Impl * @@ -591,18 +524,6 @@ public: static void writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar); - static void writeUnsigned(INetMIMEOutputSink & rSink, sal_uInt32 nValue, - int nMinDigits = 1); - - static void writeDateTime(INetMIMEOutputSink & rSink, - const DateTime & rUTC); - - static void writeHeaderFieldBody(INetMIMEOutputSink & rSink, - HeaderFieldType eType, - const ByteString & rBody, - rtl_TextEncoding ePreferredEncoding, - bool bInitialSpace = true); - static void writeHeaderFieldBody(INetMIMEOutputSink & rSink, HeaderFieldType eType, const UniString & rBody, diff --git a/tools/inc/tools/inetmsg.hxx b/tools/inc/tools/inetmsg.hxx index f59f9d1d3590..b06541a8323d 100644 --- a/tools/inc/tools/inetmsg.hxx +++ b/tools/inc/tools/inetmsg.hxx @@ -36,6 +36,7 @@ #include <tools/inetmime.hxx> #include <tools/stream.hxx> #include <tools/string.hxx> +#include <vector> class DateTime; @@ -108,13 +109,14 @@ public: * INetMessage Interface. * *=====================================================================*/ + typedef ::std::vector< INetMessageHeader* > HeaderList_impl; class INetMessage { - List m_aHeaderList; + HeaderList_impl m_aHeaderList; - sal_uIntPtr m_nDocSize; - UniString m_aDocName; - SvLockBytesRef m_xDocLB; + sal_uIntPtr m_nDocSize; + UniString m_aDocName; + SvLockBytesRef m_xDocLB; void ListCleanup_Impl (void); void ListCopy (const INetMessage& rMsg); @@ -123,38 +125,36 @@ protected: UniString GetHeaderName_Impl ( sal_uIntPtr nIndex, rtl_TextEncoding eEncoding) const { - INetMessageHeader *p = - (INetMessageHeader*)(m_aHeaderList.GetObject(nIndex)); - if (p) - return UniString(p->GetName(), eEncoding); - else + if ( nIndex < m_aHeaderList.size() ) { + return UniString( m_aHeaderList[ nIndex ]->GetName(), eEncoding ); + } else { return UniString(); + } } UniString GetHeaderValue_Impl ( sal_uIntPtr nIndex, INetMIME::HeaderFieldType eType) const { - INetMessageHeader *p = - (INetMessageHeader*)(m_aHeaderList.GetObject(nIndex)); - if (p) - return INetMIME::decodeHeaderFieldBody (eType, p->GetValue()); - else + if ( nIndex < m_aHeaderList.size() ) { + return INetMIME::decodeHeaderFieldBody(eType, m_aHeaderList[ nIndex ]->GetValue()); + } else { return UniString(); + } } void SetHeaderField_Impl ( const INetMessageHeader &rHeader, sal_uIntPtr &rnIndex) { INetMessageHeader *p = new INetMessageHeader (rHeader); - if (m_aHeaderList.Count() <= rnIndex) + if (m_aHeaderList.size() <= rnIndex) { - m_aHeaderList.Insert (p, LIST_APPEND); - rnIndex = m_aHeaderList.Count() - 1; + rnIndex = m_aHeaderList.size(); + m_aHeaderList.push_back( p ); } else { - p = (INetMessageHeader*)(m_aHeaderList.Replace(p, rnIndex)); - delete p; + delete m_aHeaderList[ rnIndex ]; + m_aHeaderList[ rnIndex ] = p; } } @@ -188,7 +188,7 @@ public: return *this; } - sal_uIntPtr GetHeaderCount (void) const { return m_aHeaderList.Count(); } + sal_uIntPtr GetHeaderCount (void) const { return m_aHeaderList.size(); } UniString GetHeaderName (sal_uIntPtr nIndex) const { @@ -202,21 +202,17 @@ public: INetMessageHeader GetHeaderField (sal_uIntPtr nIndex) const { - INetMessageHeader *p = - (INetMessageHeader*)(m_aHeaderList.GetObject(nIndex)); - if (p) - return INetMessageHeader(*p); - else + if ( nIndex < m_aHeaderList.size() ) { + return INetMessageHeader( *m_aHeaderList[ nIndex ] ); + } else { return INetMessageHeader(); + } } - sal_uIntPtr SetHeaderField ( - const UniString& rName, - const UniString& rValue, - sal_uIntPtr nIndex = LIST_APPEND); - virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rField, sal_uIntPtr nIndex = LIST_APPEND); + const INetMessageHeader &rField, + sal_uIntPtr nIndex = ((sal_uIntPtr)-1) + ); sal_uIntPtr GetDocumentSize (void) const { return m_nDocSize; } void SetDocumentSize (sal_uIntPtr nSize) { m_nDocSize = nSize; } @@ -242,36 +238,6 @@ public: /*======================================================================= * - * INetMessageHeaderIterator Interface. - * - *=====================================================================*/ -class INetMessageHeaderIterator -{ - sal_uIntPtr nValueCount; - List aValueList; - UniString aEmptyString; - -public: - INetMessageHeaderIterator ( - const INetMessage& rMsg, const UniString& rHdrName); - virtual ~INetMessageHeaderIterator (void); - - sal_uIntPtr GetValueCount (void) const { return nValueCount; } - const UniString& GetValue (sal_uIntPtr nIndex) const - { - if (nIndex < nValueCount) - { - return *((UniString*)(aValueList.GetObject(nIndex))); - } - else - { - return aEmptyString; - } - } -}; - -/*======================================================================= - * * INetRFC822Message Interface. * *=====================================================================*/ @@ -310,18 +276,17 @@ public: INetRFC822Message& operator= (const INetRFC822Message& rMsg); - static sal_Bool GenerateDateField ( - const DateTime& rDateTime, UniString& rDateField); static sal_Bool ParseDateField ( const UniString& rDateField, DateTime& rDateTime); using INetMessage::SetHeaderField; virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, sal_uIntPtr nIndex = LIST_APPEND); + const INetMessageHeader &rHeader, + sal_uIntPtr nIndex = ((sal_uIntPtr)-1) + ); /** Header fields. */ - void SetBCC (const UniString& rBCC); UniString GetBCC (void) const { return GetHeaderValue_Impl ( @@ -329,7 +294,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetCC (const UniString& rCC); UniString GetCC (void) const { return GetHeaderValue_Impl ( @@ -337,7 +301,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetComments (const UniString& rComments); UniString GetComments (void) const { return GetHeaderValue_Impl ( @@ -345,7 +308,6 @@ public: INetMIME::HEADER_FIELD_TEXT); } - void SetDate (const UniString& rDate); UniString GetDate (void) const { return GetHeaderValue_Impl ( @@ -353,7 +315,6 @@ public: INetMIME::HEADER_FIELD_STRUCTURED); } - void SetFrom (const UniString& rFrom); UniString GetFrom (void) const { return GetHeaderValue_Impl ( @@ -361,7 +322,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetInReplyTo (const UniString& rInReplyTo); UniString GetInReplyTo (void) const { return GetHeaderValue_Impl ( @@ -369,7 +329,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); // ??? MESSAGE_ID ??? } - void SetKeywords (const UniString& rKeywords); UniString GetKeywords (void) const { return GetHeaderValue_Impl ( @@ -377,7 +336,6 @@ public: INetMIME::HEADER_FIELD_PHRASE); } - void SetMessageID (const UniString& rMessageID); UniString GetMessageID (void) const { return GetHeaderValue_Impl ( @@ -385,7 +343,6 @@ public: INetMIME::HEADER_FIELD_MESSAGE_ID); } - void SetReferences (const UniString& rReferences); UniString GetReferences (void) const { return GetHeaderValue_Impl ( @@ -393,7 +350,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetReplyTo (const UniString& rReplyTo); UniString GetReplyTo (void) const { return GetHeaderValue_Impl ( @@ -401,7 +357,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetReturnPath (const UniString& rReturnPath); UniString GetReturnPath (void) const { return GetHeaderValue_Impl ( @@ -409,7 +364,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetReturnReceiptTo (const UniString& rReturnReceiptTo); UniString GetReturnReceiptTo (void) const { return GetHeaderValue_Impl ( @@ -417,7 +371,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetSender (const UniString& rSender); UniString GetSender (void) const { return GetHeaderValue_Impl ( @@ -425,7 +378,6 @@ public: INetMIME::HEADER_FIELD_ADDRESS); } - void SetSubject (const UniString& rSubject); UniString GetSubject (void) const { return GetHeaderValue_Impl ( @@ -433,7 +385,6 @@ public: INetMIME::HEADER_FIELD_TEXT); } - void SetTo (const UniString& rTo); UniString GetTo (void) const { return GetHeaderValue_Impl ( @@ -481,19 +432,19 @@ enum INetMessageContainerType INETMSG_MULTIPART_FORM_DATA }; +class INetMIMEMessage; +typedef ::std::vector< INetMIMEMessage* > INetMIMEMessgeList_impl; class TOOLS_DLLPUBLIC INetMIMEMessage : public INetRFC822Message { - sal_uIntPtr m_nIndex[INETMSG_MIME_NUMHDR]; + sal_uIntPtr m_nIndex[INETMSG_MIME_NUMHDR]; - INetMIMEMessage *pParent; - sal_uIntPtr nNumChildren; - List aChildren; - ByteString m_aBoundary; - sal_Bool bHeaderParsed; + INetMIMEMessage* pParent; + INetMIMEMessgeList_impl aChildren; + ByteString m_aBoundary; + sal_Bool bHeaderParsed; friend class INetMIMEMessageStream; - void SetChildCount (sal_uIntPtr nCount) { nNumChildren = nCount; } const ByteString& GetMultipartBoundary (void) const { return m_aBoundary; } void SetMultipartBoundary (const ByteString& rBnd) { m_aBoundary = rBnd; } @@ -519,7 +470,9 @@ public: using INetRFC822Message::SetHeaderField; virtual sal_uIntPtr SetHeaderField ( - const INetMessageHeader &rHeader, sal_uIntPtr nIndex = LIST_APPEND); + const INetMessageHeader &rHeader, + sal_uIntPtr nIndex = ((sal_uIntPtr)-1) + ); /** Header fields. */ @@ -529,7 +482,6 @@ public: return GetHeaderValue (m_nIndex[INETMSG_MIME_VERSION]); } - void SetContentDescription (const UniString& rDescription); UniString GetContentDescription (void) const { return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); @@ -541,7 +493,6 @@ public: return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); } - void SetContentID (const UniString& rID); UniString GetContentID (void) const { return GetHeaderValue (m_nIndex[INETMSG_MIME_CONTENT_ID]); @@ -578,10 +529,9 @@ public: return (aType.CompareIgnoreCaseToAscii("multipart/", 10) == 0); } - sal_uIntPtr GetChildCount (void) const { return nNumChildren; } INetMIMEMessage* GetChild (sal_uIntPtr nIndex) const { - return ((INetMIMEMessage *)(aChildren.GetObject (nIndex))); + return ( nIndex < aChildren.size() ) ? aChildren[ nIndex ] : NULL; } INetMIMEMessage* GetParent (void) const { return pParent; } @@ -589,8 +539,6 @@ public: INetMessageContainerType eType = INETMSG_MULTIPART_MIXED); sal_Bool AttachChild ( INetMIMEMessage& rChildMsg, sal_Bool bOwner = sal_True); - sal_Bool DetachChild ( - sal_uIntPtr nIndex, INetMIMEMessage& rChildMsg) const; /** Stream operators. */ diff --git a/tools/inc/tools/inetstrm.hxx b/tools/inc/tools/inetstrm.hxx index 16de7beedd98..4d82c8de9791 100644 --- a/tools/inc/tools/inetstrm.hxx +++ b/tools/inc/tools/inetstrm.hxx @@ -68,9 +68,6 @@ public: virtual ~INetIStream (void); int Read (sal_Char *pData, sal_uIntPtr nSize); - - static void Decode64 (SvStream& rIn, SvStream& rOut); - static void Encode64 (SvStream& rIn, SvStream& rOut); }; /* @@ -93,20 +90,6 @@ public: int Write (const sal_Char *pData, sal_uIntPtr nSize); }; -/* - * INetIOStream. - */ -class INetIOStream : public INetIStream, public INetOStream -{ - // Not implemented. - INetIOStream (const INetIOStream& rStrm); - INetIOStream& operator= (const INetIOStream& rStrm); - -public: - INetIOStream (sal_uIntPtr nIBufferSize = 0, sal_uIntPtr nOBufferSize = 0); - virtual ~INetIOStream (void); -}; - /*========================================================================= * * INetMessageStream Interface. diff --git a/tools/inc/tools/prex.h b/tools/inc/tools/prex.h index 151b0fe46279..e1e11f256b5a 100644 --- a/tools/inc/tools/prex.h +++ b/tools/inc/tools/prex.h @@ -44,22 +44,12 @@ extern "C" { #endif -// FIXME: should really check for xfree86 or for X11R6.1 and higher -#if defined(LINUX) || defined(FREEBSD) || defined(MACOSX) || defined(NETBSD) || \ - defined(OPENBSD) || defined(DRAGONFLY) -#define __XKeyboardExtension__ 1 -#else -#define __XKeyboardExtension__ 0 -#endif - #include <X11/X.h> #include <X11/Xlib.h> #include <X11/Xutil.h> #include <X11/StringDefs.h> #include <X11/extensions/Xrender.h> -#if __XKeyboardExtension__ #include <X11/XKBlib.h> -#endif typedef unsigned long Pixel; #undef DestroyAll diff --git a/tools/inc/tools/stream.hxx b/tools/inc/tools/stream.hxx index 0e5094561734..dc097b8c563f 100644 --- a/tools/inc/tools/stream.hxx +++ b/tools/inc/tools/stream.hxx @@ -34,6 +34,7 @@ #include <tools/errinf.hxx> #include <tools/ref.hxx> #include <tools/rtti.hxx> +#include <rtl/string.hxx> class FileCopier; class StreamData; @@ -304,7 +305,6 @@ public: SvStream( SvLockBytes *pLockBytes); virtual ~SvStream(); - ErrCode SetLockBytes( SvLockBytesRef& rBytes ); SvLockBytes* GetLockBytes() const { return xLockBytes; } sal_uInt32 GetError() const { return ERRCODE_TOERROR(nError); } @@ -390,6 +390,8 @@ public: sal_Size Seek( sal_Size nPos ); sal_Size SeekRel( sal_sSize nPos ); sal_Size Tell() const { return nBufFilePos+nBufActualPos; } + //length between current (Tell()) pos and end of stream + sal_Size remainingSize(); void Flush(); sal_Bool IsEof() const { return bIsEof; } // next Tell() <= nSize @@ -403,6 +405,7 @@ public: sal_Bool ReadCString( String& rStr ) { return ReadCString( rStr, GetStreamCharSet()); } sal_Bool ReadLine( ByteString& rStr ); + sal_Bool ReadLine( rtl::OString& rStr ); sal_Bool WriteLine( const ByteString& rStr ); sal_Bool WriteLines( const ByteString& rStr ); @@ -444,8 +447,6 @@ public: { return WriteUnicodeOrByteText( rStr, GetStreamCharSet() ); } /// Write a line of Unicode and append line end (endlu()) sal_Bool WriteUniStringLine( const String& rStr ); - /// Write multiple lines of Unicode (with CovertLineEnd) and append line end (endlu()) - sal_Bool WriteUniStringLines( const String& rStr ); /// Write a Unicode character if eDestCharSet==RTL_TEXTENCODING_UNICODE, /// otherwise write as Bytecode converted to eDestCharSet. @@ -515,7 +516,6 @@ public: void RefreshBuffer(); SvStream& PutBack( char aCh ); - void EatWhite(); sal_Bool IsWritable() const { return bIsWritable; } StreamMode GetStreamMode() const { return eStreamMode; } diff --git a/tools/inc/tools/string.hxx b/tools/inc/tools/string.hxx index f77d9630d962..9435d4fb9bd9 100644 --- a/tools/inc/tools/string.hxx +++ b/tools/inc/tools/string.hxx @@ -154,8 +154,6 @@ class TOOLS_DLLPUBLIC ByteString { friend class UniString; - TOOLS_DLLPRIVATE void InitStringRes( const UniString& rStr ); - private: ByteStringData* mpData; @@ -206,14 +204,8 @@ public: } static ByteString CreateFromInt32( sal_Int32 n, sal_Int16 nRadix = 10 ); - static ByteString CreateFromInt64( sal_Int64 n, sal_Int16 nRadix = 10 ); - static ByteString CreateFromFloat( float f ); - static ByteString CreateFromDouble( double d ); - static const ByteString& EmptyString(); sal_Int32 ToInt32() const; sal_Int64 ToInt64() const; - float ToFloat() const; - double ToDouble() const; ByteString& Assign( const ByteString& rStr ); ByteString& Assign( const rtl::OString& rStr ); @@ -247,8 +239,6 @@ public: xub_StrLen Len() const { return (xub_StrLen)mpData->mnLen; } ByteString& Insert( const ByteString& rStr, xub_StrLen nIndex = STRING_LEN ); - ByteString& Insert( const ByteString& rStr, xub_StrLen nPos, xub_StrLen nLen, - 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 ); @@ -262,7 +252,6 @@ public: ByteString& EraseTrailingChars( sal_Char c = ' ' ); ByteString& EraseLeadingAndTrailingChars( sal_Char c = ' ' ); ByteString& EraseAllChars( sal_Char c = ' ' ); - ByteString& Reverse(); ByteString& Convert( rtl_TextEncoding eSource, rtl_TextEncoding eTarget, @@ -297,8 +286,6 @@ public: xub_StrLen nLen = STRING_LEN ) const; StringCompare CompareTo( const sal_Char* pCharStr, xub_StrLen nLen = STRING_LEN ) const; - StringCompare CompareIgnoreCaseToAscii( const ByteString& rStr, - 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; @@ -309,22 +296,14 @@ public: xub_StrLen nIndex, xub_StrLen nLen ) const; sal_Bool Equals( const sal_Char* pCharStr, xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsIgnoreCaseAscii( const ByteString& rStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; - sal_Bool EqualsIgnoreCaseAscii( const sal_Char* pCharStr, - xub_StrLen nIndex, xub_StrLen nLen ) const; xub_StrLen Match( const ByteString& rStr ) const; - xub_StrLen Match( const sal_Char* pCharStr ) 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 SearchChar( const sal_Char* pChars, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchCharBackward( const sal_Char* pChars, xub_StrLen nIndex = STRING_LEN ) const; - xub_StrLen SearchAndReplace( sal_Char c, sal_Char cRep, xub_StrLen nIndex = 0 ); xub_StrLen SearchAndReplace( const ByteString& rStr, const ByteString& rRepStr, xub_StrLen nIndex = 0 ); xub_StrLen SearchAndReplace( const sal_Char* pCharStr, const ByteString& rRepStr, @@ -339,9 +318,6 @@ public: ByteString GetToken( xub_StrLen nToken, sal_Char cTok, xub_StrLen& rIndex ) const; ByteString GetToken( xub_StrLen nToken, sal_Char cTok = ';' ) const; - xub_StrLen GetQuotedTokenCount( const ByteString& rQuotedPairs, sal_Char cTok = ';' ) const; - ByteString GetQuotedToken( xub_StrLen nToken, const ByteString& rQuotedPairs, - sal_Char cTok, xub_StrLen& rIndex ) const; ByteString GetQuotedToken( xub_StrLen nToken, const ByteString& rQuotedPairs, sal_Char cTok = ';' ) const; @@ -399,13 +375,6 @@ inline ByteString ByteString::GetToken( xub_StrLen nToken, sal_Char cTok ) const return GetToken( nToken, cTok, nTempPos ); } -inline ByteString ByteString::GetQuotedToken( xub_StrLen nToken, const ByteString& rQuotedPairs, - sal_Char cTok ) const -{ - xub_StrLen nTempPos = 0; - return GetQuotedToken( nToken, rQuotedPairs, cTok, nTempPos ); -} - // ----------------------------------------------------------------------- // ------------------------ @@ -615,7 +584,6 @@ public: xub_StrLen SearchAscii( const sal_Char* pAsciiStr, xub_StrLen nIndex = 0 ) const; xub_StrLen SearchBackward( sal_Unicode c, xub_StrLen nIndex = STRING_LEN ) const; xub_StrLen SearchChar( const sal_Unicode* pChars, xub_StrLen nIndex = 0 ) const; - xub_StrLen SearchCharBackward( const sal_Unicode* pChars, xub_StrLen nIndex = STRING_LEN ) const; xub_StrLen SearchAndReplace( sal_Unicode c, sal_Unicode cRep, xub_StrLen nIndex = 0 ); diff --git a/tools/inc/tools/table.hxx b/tools/inc/tools/table.hxx index bfb91fbe7dc6..ec0c82cf663b 100644 --- a/tools/inc/tools/table.hxx +++ b/tools/inc/tools/table.hxx @@ -65,7 +65,6 @@ public: { return Container::GetObject( (nPos*2)+1 ); } sal_uIntPtr GetObjectKey( sal_uIntPtr nPos ) const { return (sal_uIntPtr)Container::GetObject( nPos*2 ); } - sal_uIntPtr GetUniqueKey( sal_uIntPtr nStartKey = 1 ) const; sal_uIntPtr SearchKey( sal_uIntPtr nKey, sal_uIntPtr* pPos = NULL ) const; void* Seek( sal_uIntPtr nKey ); @@ -102,7 +101,6 @@ public: \ using Table::Count; \ using Table::GetCurKey; \ using Table::GetObjectKey; \ - using Table::GetUniqueKey; \ using Table::SearchKey; \ using Table::IsKeyValid; \ \ diff --git a/tools/inc/tools/tempfile.hxx b/tools/inc/tools/tempfile.hxx index d356e7bf66fc..4ca220462898 100644 --- a/tools/inc/tools/tempfile.hxx +++ b/tools/inc/tools/tempfile.hxx @@ -65,14 +65,6 @@ public: // Only create a name for a temporary file that would be valid at that moment. static String CreateTempName( const String* pParent=NULL ); - - // The TempNameBase is a folder in the default ( system ) tempfile folder. - // This subfolder will be used if a TempFile or TempName is created without a parent name. - // The caller of the SetTempNameBase is responsible for deleting this folder and all temporary files in it. - // The argument must be a simple name, not a complete URL. - // The return value of both methods is the complete URL of the tempname base folder. - static String SetTempNameBaseDirectory( const String &rBaseName ); - static String GetTempNameBaseDirectory(); }; #endif diff --git a/tools/inc/tools/urlobj.hxx b/tools/inc/tools/urlobj.hxx index 67342db5d161..f8caeee0d11a 100644 --- a/tools/inc/tools/urlobj.hxx +++ b/tools/inc/tools/urlobj.hxx @@ -573,8 +573,6 @@ public: rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) { return setUser(rTheUser, false, eMechanism, eCharset); } - void makeAuthCanonic(); - inline bool SetPass(ByteString const & rThePassword, EncodeMechanism eMechanism = WAS_ENCODED, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); @@ -622,51 +620,6 @@ public: bool SetPort(sal_uInt32 nThePort); - void makePortCanonic(); - - /** Encode the <hostport> part of a URL. - - @ATT Obsolete, because at the moment the <hostport> part of a URL may - not contain any escape sequences anyway, and because this method does - not inform the caller whether the given <hostport> part is legal. - - @param rTheHostPort The <hostport> part of a URL (for its - interpretation, see the general discussion for set-methods). - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return The <hostport> part, encoded according to the given mechanism - and charset ('forbidden' characters replaced by escape sequences). - */ - static inline rtl::OUString encodeHostPort(ByteString const & rTheHostPort, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8); - - /** Encode the <hostport> part of a URL. - - @ATT Obsolete, because at the moment the <hostport> part of a URL may - not contain any escape sequences anyway, and because this method does - not inform the caller whether the given <hostport> part is legal. - - @param rTheHostPort The <hostport> part of a URL (for its - interpretation, see the general discussion for set-methods). - - @param eMechanism See the general discussion for set-methods. - - @param eCharset See the general discussion for set-methods. - - @return The <hostport> part, encoded according to the given mechanism - and charset ('forbidden' characters replaced by escape sequences). - */ - static inline rtl::OUString encodeHostPort(rtl::OUString const & rTheHostPort, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset - = RTL_TEXTENCODING_UTF8) - { return encodeHostPort(rTheHostPort, false, eMechanism, eCharset); } - //======================================================================== // Path: @@ -1058,8 +1011,6 @@ public: //======================================================================== // POP3 and URLs: - bool HasMsgId() const; - rtl::OUString GetMsgId(DecodeMechanism eMechanism = DECODE_TO_IURI, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8) const; @@ -1279,9 +1230,6 @@ public: = RTL_TEXTENCODING_UTF8) const { return GetLastName(eMechanism, eCharset); } - rtl::OUString CutName(DecodeMechanism eMechanism = DECODE_TO_IURI, - rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); - void SetExtension(rtl::OUString const & rTheExtension, EncodeMechanism eMechanism = WAS_ENCODED, rtl_TextEncoding eCharset = RTL_TEXTENCODING_UTF8); @@ -1428,10 +1376,6 @@ private: EncodeMechanism eMechanism, rtl_TextEncoding eCharset, bool bNetBiosName, rtl::OUStringBuffer* pCanonic); - static rtl::OUString encodeHostPort( - rtl::OUString const & rTheHostPort, bool bOctets, - EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - bool setHost( rtl::OUString const & rTheHost, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset); @@ -1482,20 +1426,10 @@ private: rtl::OUString const & rTheMark, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset); - // FTP URLs: - - enum FTPType { FTP_TYPE_NONE, FTP_TYPE_A, FTP_TYPE_I, FTP_TYPE_D }; - - TOOLS_DLLPRIVATE FTPType getFTPType() const; - // FILE URLs: TOOLS_DLLPRIVATE bool hasDosVolume(FSysStyle eStyle) const; - // IMAP URLs: - - TOOLS_DLLPRIVATE sal_uInt32 getIMAPUID() const; - // Coding: static inline rtl::OUString extend(ByteString const & rOctets) @@ -1822,15 +1756,6 @@ inline bool INetURLObject::SetUserAndPass(rtl::OUString const & rTheUser, setPassword(rThePassword, false, eMechanism, eCharset)); } -// static -inline rtl::OUString INetURLObject::encodeHostPort(ByteString const & - rTheHostPort, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - return encodeHostPort(extend(rTheHostPort), true, eMechanism, eCharset); -} - inline bool INetURLObject::insertName(rtl::OUString const & rTheName, bool bAppendFinalSlash, sal_Int32 nIndex, diff --git a/tools/prj/build.lst b/tools/prj/build.lst index eeb470c384d6..ee6803567843 100644 --- a/tools/prj/build.lst +++ b/tools/prj/build.lst @@ -1,3 +1,3 @@ -tl tools : cppu external offuh ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL +tl tools : cppu external offapi ZLIB:zlib EXPAT:expat basegfx comphelper i18npool NULL tl tools\prj nmake - all tl_prj NULL # tl tools\qa nmake - all tl_qa tl_utl NULL diff --git a/tools/source/fsys/dirent.cxx b/tools/source/fsys/dirent.cxx index a188569868e1..ea3db76c5c07 100644 --- a/tools/source/fsys/dirent.cxx +++ b/tools/source/fsys/dirent.cxx @@ -331,6 +331,7 @@ ByteString ImplCutPath( const ByteString& rStr, sal_uInt16 nMax, char cAccDel ) return aCutPath; } +#if defined(WNT) /************************************************************************* |* |* DirEntry::ImpParseOs2Name() @@ -402,9 +403,15 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty else { // liegt ein anderes Drive auf dem Stack? - if ( aStack.Count() && - COMPARE_EQUAL != aStack.Bottom()->aName.CompareIgnoreCaseToAscii(aName) ) - aStack.Clear(); + if ( aStack.Count() ) + { + rtl::OString aThis(aStack.Bottom()->aName); + aThis = aThis.toAsciiLowerCase(); + rtl::OString aOther(aName); + aOther = aOther.toAsciiLowerCase(); + if (aThis.compareTo(aOther) != 0) + aStack.Clear(); + } // liegt jetzt nichts mehr auf dem Stack? if ( !aStack.Count() ) @@ -502,6 +509,7 @@ FSysError DirEntry::ImpParseOs2Name( const ByteString& rPfad, FSysPathStyle eSty aName = rPfad; return nErr; } +#endif /************************************************************************* |* @@ -662,7 +670,6 @@ DirEntry::DirEntry( const String& rInitName, FSysPathStyle eStyle ) } #ifdef DBG_UTIL - // ASF nur bei Default eStyle, nicht z.B. aus MakeShortName() if( eStyle == FSYS_STYLE_HOST && aTmpName.Search( "://" ) != STRING_NOTFOUND ) { @@ -709,7 +716,6 @@ DirEntry::DirEntry( const ByteString& rInitName, FSysPathStyle eStyle ) } #ifdef DBG_UTIL else - // ASF nur bei Default eStyle, nicht z.B. aus MakeShortName() if( eStyle == FSYS_STYLE_HOST && rInitName.Search( "://" ) != STRING_NOTFOUND ) { @@ -1129,31 +1135,6 @@ String DirEntry::CutName( FSysPathStyle eStyle ) /************************************************************************* |* -|* DirEntry::NameCompare -|* -|* Beschreibung Vergleich nur die Namen (ohne Pfad, aber mit Gross/Klein) -|* -*************************************************************************/ - -StringCompare DirEntry::NameCompare( const DirEntry &rWith ) const -{ - ByteString aThisName; - ByteString aParameterName; - -#ifdef UNX - aThisName = aName; - aParameterName = rWith.aName; -#else - aThisName = ByteString(aName).ToLowerAscii(); - aParameterName = ByteString(rWith.aName).ToLowerAscii(); -#endif - - return aThisName.CompareTo( aParameterName ); -} - - -/************************************************************************* -|* |* DirEntry::operator==() |* *************************************************************************/ @@ -1369,31 +1350,6 @@ void DirEntry::SetExtension( const String& rExtension, char cSep ) /************************************************************************* |* -|* DirEntry::CutExtension() -|* -*************************************************************************/ - -String DirEntry::CutExtension( char cSep ) -{ - DBG_CHKTHIS( DirEntry, ImpCheckDirEntry ); - - const char *p0 = ( aName.GetBuffer() ); - const char *p1 = p0 + aName.Len() - 1; - while ( p1 >= p0 && *p1 != cSep ) - p1--; - - if ( p1 >= p0 ) - { - // es wurde ein cSep an der Position p1 gefunden - aName.Erase( static_cast< xub_StrLen >(p1-p0) ); - return String(p1 + 1, osl_getThreadTextEncoding()); - } - - return String(); -} - -/************************************************************************* -|* |* DirEntry::SetName() |* *************************************************************************/ @@ -1728,6 +1684,7 @@ const DirEntry &DirEntry::operator[]( sal_uInt16 nParentLevel ) const return *pRes; } +#if !defined(WNT) /************************************************************************* |* |* DirEntry::ImpParseUnixName() @@ -1843,200 +1800,12 @@ FSysError DirEntry::ImpParseUnixName( const ByteString& rPfad, FSysPathStyle eSt return FSYS_ERR_OK; } - -/************************************************************************* -|* -|* DirEntry::MakeShortName() -|* -*************************************************************************/ - -ErrCode CreateEntry_Impl( const DirEntry &rPath, DirEntryKind eKind ) -{ - // versuchen, anzulegen (ausser bei FSYS_KIND_ALL) - ErrCode eErr = ERRCODE_NONE; - if ( FSYS_KIND_FILE == eKind ) - { - SvFileStream aStream( rPath.GetFull(), STREAM_STD_WRITE ); - aStream.WriteLine( "" ); - eErr = aStream.GetError(); - } - else if ( FSYS_KIND_ALL != eKind ) - eErr = rPath.MakeDir() ? ERRCODE_NONE : ERRCODE_IO_UNKNOWN; - - // erfolgreich? - if ( !rPath.Exists() ) - eErr = ERRCODE_IO_UNKNOWN; // Doch was schiefgegangen ? - - // ggf. wieder l"oschen - if ( FSYS_KIND_NONE == eKind ) - rPath.Kill(); - - // Fehlercode zur?ckliefern - return eErr; -} - -sal_Bool IsValidEntry_Impl( const DirEntry &rPath, - const String &rLongName, - DirEntryKind eKind, - sal_Bool bIsShortened, - sal_Bool bUseDelim ) -{ - // Parameter-Pr"uefung - DBG_ASSERT( eKind == FSYS_KIND_NONE || eKind == FSYS_KIND_ALL || - eKind == FSYS_KIND_FILE || eKind == FSYS_KIND_DIR, - "invalid entry-kind" ); - - // Alle von MSDOS erreichbaren FSYS_STYLES muessen den - // MSDOS Filenamenanforderungen genuegen. Sonst wird probiert, - // ob sich eine Datei des gewuenschten Names anlegen laesst. - FSysPathStyle eStyle = DirEntry::GetPathStyle( rPath.GetDevice().GetName() ); - DirEntry aPath(rPath); - DirEntry aName(rLongName, eStyle); - if ( !aName.IsValid() || aName.Level() != 1 ) - return sal_False; - aPath += aName; - if ( 1 == aPath.Level() ) - return sal_False; - - // Pfad-Trenner sind nicht erlaubt (bei ungek"urzten auch nicht FSYS_SHORTNAME_DELIMITER) - char cDelim = bUseDelim == 2 ? FSYS_SHORTNAME_DELIMITER : char(0); - if ( - rLongName.Search(DirEntry::GetAccessDelimiter()) != STRING_NOTFOUND || - (!bIsShortened && rLongName.Search(cDelim) != STRING_NOTFOUND) - ) - { - return sal_False; - } - - // MI: Abfrage nach 'CON:' etc. wird jetzt in Exists() mitgemacht - if ( aPath.Exists() ) - return sal_False; - - return (ERRCODE_NONE == CreateEntry_Impl( aPath, eKind )); -} - -//------------------------------------------------------------------------- +#endif #define MAX_EXT_MAX 250 #define MAX_LEN_MAX 255 #define INVALID_CHARS_DEF "\\/\"':|^<>?*" -sal_Bool DirEntry::MakeShortName( const String& rLongName, DirEntryKind eKind, - sal_Bool bUseDelim, FSysPathStyle eStyle ) -{ - String aLongName(rLongName); - - // Alle '#' aus den Dateinamen entfernen, weil das INetURLObject - // damit Probleme hat. Siehe auch #51246# - aLongName.EraseAllChars( '#' ); - ByteString bLongName(aLongName, osl_getThreadTextEncoding()); - - // Auf Novell-Servern (wegen der rottigen Clients) nur 7bit ASCII - - // bei FSYS_KIND_ALL den alten Namen merken und abh"angen (rename) - ByteString aOldName; - if ( FSYS_KIND_ALL == eKind ) - { - aOldName = ByteString(CutName(), osl_getThreadTextEncoding()); - aOldName = CMP_LOWER(aOldName); - } - - // ist der Langname direkt verwendbar? - if ( IsValidEntry_Impl( *this, aLongName, eKind, sal_False, bUseDelim ) ) - { - operator+=( DirEntry(aLongName) ); - return sal_True; - } - - // max L"angen feststellen - sal_uInt16 nMaxExt, nMaxLen; - if ( FSYS_STYLE_DETECT == eStyle ) - eStyle = DirEntry::GetPathStyle( GetDevice().GetName() ); - ByteString aInvalidChars; - nMaxExt = MAX_EXT_MAX; - nMaxLen = MAX_LEN_MAX; - aInvalidChars = INVALID_CHARS_DEF; - - // Extension abschneiden und kuerzen - ByteString aExt; - ByteString aFName = bLongName; - DirEntry aUnparsed; - aUnparsed.aName = bLongName; - aExt = ByteString(aUnparsed.CutExtension(), osl_getThreadTextEncoding()); - aFName = aUnparsed.aName; - if ( aExt.Len() > nMaxExt ) - { - char c = aExt.GetChar( aExt.Len() - 1 ); - aExt.Erase(nMaxExt-1); - aExt += c; - } - - // ausser auf einem FAT-System geh"ort die Extension zur - // Maxl"ange. Muss also vorher mit dem Punkt abgezogen werden. - nMaxLen -= ( aExt.Len() + 1 ); - - // Name k"urzen - ByteString aSName; - for ( const char *pc = aFName.GetBuffer(); aSName.Len() < nMaxLen && *pc; ++pc ) - { - if ( STRING_NOTFOUND == aInvalidChars.Search( *pc ) && - (unsigned char) *pc >= (unsigned char) 32 && - ( !aSName.Len() || *pc != ' ' || aSName.GetChar(aSName.Len()-1) != ' ' ) ) - aSName += *pc; - } - aSName.EraseTrailingChars(); - - // HRO: #74246# Also cut leading spaces - aSName.EraseLeadingChars(); - - if ( !aSName.Len() ) - aSName = "noname"; - - // kommt dabei der alte Name raus? - ByteString aNewName = aSName; - if ( aExt.Len() ) - ( aNewName += '.' ) += aExt; - operator+=( DirEntry(String(aNewName, osl_getThreadTextEncoding())) ); - if ( FSYS_KIND_ALL == eKind && CMP_LOWER(aName) == aOldName ) - if ( FSYS_KIND_ALL == eKind && CMP_LOWER(ByteString(GetName(), osl_getThreadTextEncoding())) == aOldName ) - return sal_True; - - // kann der gek"urzte Name direkt verwendet werden? - if ( !Exists() && (ERRCODE_NONE == CreateEntry_Impl( *this, eKind )) ) - return sal_True; - - // darf '?##' verwendet werden, um eindeutigen Name zu erzeugen? - if ( bUseDelim ) - { - // eindeutigen Namen per '?##' erzeugen - aSName.Erase( nMaxLen-3 ); - if ( bUseDelim != 2 ) - aSName += FSYS_SHORTNAME_DELIMITER; - for ( int n = 1; n < 99; ++n ) - { - // Name zusammensetzen - ByteString aTmpStr( aSName ); - aTmpStr += ByteString::CreateFromInt32(n); - if ( aExt.Len() ) - ( aTmpStr += '.' ) += aExt; - - // noch nicht vorhanden? - SetName( String(aTmpStr, osl_getThreadTextEncoding()) ); - - if ( !Exists() ) - { - // Fehler setzen !!! - nError = CreateEntry_Impl( *this, eKind ); - return (ERRCODE_NONE == nError); - } - } - } - - // keine ## mehr frei / ?## soll nicht verwendet werden - nError = ERRCODE_IO_ALREADYEXISTS; - return sal_False; -} - /************************************************************************* |* |* DirEntry::CreatePath() diff --git a/tools/source/fsys/tdir.cxx b/tools/source/fsys/tdir.cxx index 6d16a5ed605a..db811f35e76b 100644 --- a/tools/source/fsys/tdir.cxx +++ b/tools/source/fsys/tdir.cxx @@ -386,27 +386,6 @@ sal_uInt16 Dir::Scan( sal_uInt16 nCount ) |* *************************************************************************/ -Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags, FSysSort nSort, ... ): - DirEntry( rDirEntry ), - pReader( 0 ) -{ - DBG_CTOR( Dir, NULL ); - - Construct( nKindFlags ); - - std::va_list pArgs; - va_start( pArgs, nSort ); - ImpSetSort( pArgs, nSort ); - - Reset(); -} - -/************************************************************************* -|* -|* Dir::Dir() -|* -*************************************************************************/ - Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ): DirEntry( rDirEntry ), pReader( 0 ) @@ -419,24 +398,6 @@ Dir::Dir( const DirEntry& rDirEntry, DirEntryKind nKindFlags ): /************************************************************************* |* -|* Dir::Dir() -|* -*************************************************************************/ - -Dir::Dir(): - pReader( 0 ) -{ - DBG_CTOR( Dir, NULL ); - - pLst = NULL; - pSortLst = NULL; - pStatLst = NULL; - eAttrMask = FSYS_KIND_ALL; - aNameMask = String("*", osl_getThreadTextEncoding()); -} - -/************************************************************************* -|* |* Dir::~Dir() |* *************************************************************************/ @@ -587,19 +548,6 @@ FSysError Dir::ImpSetSort( std::va_list pArgs, int nFirstSort ) /************************************************************************* |* -|* Dir::SetSort() -|* -*************************************************************************/ - -FSysError Dir::SetSort( FSysSort nSort, ... ) -{ - std::va_list pArgs; - va_start( pArgs, nSort ); - return ImpSetSort( pArgs, nSort ); -} - -/************************************************************************* -|* |* Dir::operator[]() |* *************************************************************************/ diff --git a/tools/source/fsys/tempfile.cxx b/tools/source/fsys/tempfile.cxx index 078e91834975..b6a4b1e2b70e 100644 --- a/tools/source/fsys/tempfile.cxx +++ b/tools/source/fsys/tempfile.cxx @@ -267,37 +267,4 @@ String TempFile::GetName() const return aTmp; } -String TempFile::SetTempNameBaseDirectory( const String &rBaseName ) -{ - String aName( rBaseName ); - - ::rtl::OUString& rTempNameBase_Impl = TempNameBase_Impl::get(); - - FileBase::RC err= Directory::create( aName ); - if ( err == FileBase::E_None || err == FileBase::E_EXIST ) - { - rTempNameBase_Impl = aName; - rTempNameBase_Impl += String( '/' ); - - TempFile aBase( NULL, sal_True ); - if ( aBase.IsValid() ) - rTempNameBase_Impl = aBase.pImp->aName; - } - - rtl::OUString aTmp; - aTmp = rTempNameBase_Impl; - return aTmp; -} - -String TempFile::GetTempNameBaseDirectory() -{ - ::rtl::OUString& rTempNameBase_Impl = TempNameBase_Impl::get(); - if ( !rTempNameBase_Impl.getLength() ) - rTempNameBase_Impl = GetSystemTempDir_Impl(); - - rtl::OUString aTmp; - aTmp = rTempNameBase_Impl; - return aTmp; -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/unx.cxx b/tools/source/fsys/unx.cxx index b04a2e64904a..0adc7ce8fa03 100644 --- a/tools/source/fsys/unx.cxx +++ b/tools/source/fsys/unx.cxx @@ -44,7 +44,7 @@ extern "C" int mntctl( int cmd, size_t size, char* buf ); #elif defined(NETBSD) #include <sys/mount.h> #elif defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ - defined(DRAGONFLY) + defined(DRAGONFLY) || defined(IOS) struct mnttab { char *mnt_dir; @@ -85,7 +85,7 @@ struct mymnttab #if defined(NETBSD) || defined(FREEBSD) || defined(MACOSX) || \ - defined(OPENBSD) || defined(DRAGONFLY) + defined(OPENBSD) || defined(DRAGONFLY) || defined(IOS) sal_Bool GetMountEntry(dev_t /* dev */, struct mymnttab * /* mytab */ ) { DBG_WARNING( "Sorry, not implemented: GetMountEntry" ); @@ -478,7 +478,7 @@ const char *TempDirImpl( char *pBuf ) |* *************************************************************************/ -FSysPathStyle DirEntry::GetPathStyle( const String & ) +FSysPathStyle DirEntry::GetPathStyle() { return FSYS_STYLE_UNX; } @@ -521,17 +521,4 @@ void FileStat::SetDateTime( const String& rFileName, } } -//========================================================================= - -ErrCode FileStat::QueryDiskSpace( const String &, BigInt &, BigInt & ) -{ - return ERRCODE_IO_NOTSUPPORTED; -} - -//========================================================================= - -void FSysEnableSysErrorBox( sal_Bool ) -{ -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 6a855d7d85c8..bf3cf2e95a4d 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -2909,29 +2909,6 @@ bool INetURLObject::parseHostOrNetBiosName( } //============================================================================ -// static -rtl::OUString INetURLObject::encodeHostPort(rtl::OUString const & rTheHostPort, - bool bOctets, - EncodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - sal_Int32 nPort = rTheHostPort.getLength(); - if (nPort != 0) - { - sal_Int32 i = nPort - 1; - while (i != 0 && INetMIME::isDigit(rTheHostPort.getStr()[i])) - --i; - if (rTheHostPort.getStr()[i] == ':') - nPort = i; - } - rtl::OUString aResult(encodeText(rTheHostPort.copy(0, nPort), bOctets, - PART_HOST_EXTRA, '%', eMechanism, eCharset, - true)); - aResult += rTheHostPort.copy(nPort); - return aResult; -} - -//============================================================================ bool INetURLObject::setHost(rtl::OUString const & rTheHost, bool bOctets, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) @@ -3706,31 +3683,6 @@ bool INetURLObject::setFragment(rtl::OUString const & rTheFragment, } //============================================================================ -INetURLObject::FTPType INetURLObject::getFTPType() const -{ - if (m_eScheme == INET_PROT_FTP - && m_aPath.getLength() >= RTL_CONSTASCII_LENGTH(";type=") + 1 - && rtl::OUString(m_aAbsURIRef).copy( - m_aPath.getEnd() - (RTL_CONSTASCII_LENGTH(";type=") + 1), - RTL_CONSTASCII_LENGTH(";type=")).equalsIgnoreAsciiCaseAscii(";type=")) - switch (m_aAbsURIRef.charAt(m_aPath.getEnd())) - { - case 'A': - case 'a': - return FTP_TYPE_A; - - case 'D': - case 'd': - return FTP_TYPE_D; - - case 'I': - case 'i': - return FTP_TYPE_I; - } - return FTP_TYPE_NONE; -} - -//============================================================================ bool INetURLObject::hasDosVolume(FSysStyle eStyle) const { sal_Unicode const * p = m_aAbsURIRef.getStr() + m_aPath.getBegin(); @@ -3743,33 +3695,6 @@ bool INetURLObject::hasDosVolume(FSysStyle eStyle) const } //============================================================================ -sal_uInt32 INetURLObject::getIMAPUID() const -{ - if (m_eScheme == INET_PROT_IMAP - && m_aPath.getLength() >= RTL_CONSTASCII_LENGTH("/;uid=") + 1) - { - sal_Unicode const * pBegin = m_aAbsURIRef.getStr() - + m_aPath.getBegin() - + RTL_CONSTASCII_LENGTH("/;uid="); - sal_Unicode const * pEnd = pBegin + m_aPath.getLength(); - sal_Unicode const * p = pEnd; - while (p > pBegin && INetMIME::isDigit(p[-1])) - --p; - if (p < pEnd && *--p != '0' - && rtl::OUString(m_aAbsURIRef).copy( - p - RTL_CONSTASCII_LENGTH("/;uid=") - m_aAbsURIRef.getStr(), - RTL_CONSTASCII_LENGTH("/;uid=")).equalsIgnoreAsciiCaseAscii("/;uid=") - ) - { - sal_uInt32 nUID; - if (INetMIME::scanUnsigned(p, pEnd, false, nUID)) - return nUID; - } - } - return 0; -} - -//============================================================================ // static rtl::OUString INetURLObject::encodeText(sal_Unicode const * pBegin, sal_Unicode const * pEnd, bool bOctets, @@ -4369,22 +4294,6 @@ bool INetURLObject::hasPassword() const } //============================================================================ -void INetURLObject::makeAuthCanonic() -{ - if (m_eScheme == INET_PROT_IMAP && m_aAuth.getLength() == 1 - && m_aAbsURIRef.charAt(m_aAuth.getBegin()) == '*') - { - lcl_Erase(m_aAbsURIRef, m_aAuth.getBegin() - - RTL_CONSTASCII_LENGTH(";AUTH="), - RTL_CONSTASCII_LENGTH(";AUTH=*")); - sal_Int32 nDelta = m_aAuth.clear() - RTL_CONSTASCII_LENGTH(";AUTH="); - m_aPath += nDelta; - m_aQuery += nDelta; - m_aFragment += nDelta; - } -} - -//============================================================================ rtl::OUString INetURLObject::GetHostPort(DecodeMechanism eMechanism, rtl_TextEncoding eCharset) { @@ -4441,33 +4350,6 @@ bool INetURLObject::SetPort(sal_uInt32 nThePort) } //============================================================================ -void INetURLObject::makePortCanonic() -{ - if (m_aPort.isPresent()) - { - sal_Unicode const * p = m_aAbsURIRef.getStr() + m_aPort.getBegin(); - sal_Unicode const * pEnd = p + m_aPort.getLength(); - sal_uInt32 nThePort; - if (INetMIME::scanUnsigned(p, pEnd, true, nThePort) && p == pEnd) - { - sal_Int32 nDelta; - if (nThePort != 0 && nThePort == getSchemeInfo().m_nDefaultPort) - { - lcl_Erase(m_aAbsURIRef, m_aPort.getBegin() - 1, - m_aPort.getLength() + 1); - nDelta = m_aPort.clear() - 1; - } - else - nDelta = m_aPort.set(m_aAbsURIRef, - rtl::OUString::valueOf(sal_Int64(nThePort))); - m_aPath += nDelta; - m_aQuery += nDelta; - m_aFragment += nDelta; - } - } -} - -//============================================================================ sal_Int32 INetURLObject::getSegmentCount(bool bIgnoreFinalSlash) const { if (!checkHierarchical()) @@ -5137,19 +5019,6 @@ rtl::OUString INetURLObject::getFSysPath(FSysStyle eStyle, } //============================================================================ -bool INetURLObject::HasMsgId() const -{ - if (m_eScheme != INET_PROT_POP3) - return false; - sal_Unicode const * p = m_aAbsURIRef.getStr() + m_aPath.getBegin(); - sal_Unicode const * pEnd = p + m_aPath.getLength(); - for (; p < pEnd; ++p) - if (*p == '<') - return true; - return false; -} - -//============================================================================ rtl::OUString INetURLObject::GetMsgId(DecodeMechanism eMechanism, rtl_TextEncoding eCharset) const { @@ -5593,14 +5462,6 @@ void INetURLObject::SetName(rtl::OUString const & rTheName, } //============================================================================ -rtl::OUString INetURLObject::CutName(DecodeMechanism eMechanism, - rtl_TextEncoding eCharset) -{ - rtl::OUString aTheName(getName(LAST_SEGMENT, true, eMechanism, eCharset)); - return removeSegment(LAST_SEGMENT, true) ? aTheName : rtl::OUString(); -} - -//============================================================================ void INetURLObject::SetExtension(rtl::OUString const & rTheExtension, EncodeMechanism eMechanism, rtl_TextEncoding eCharset) diff --git a/tools/source/fsys/wntmsc.cxx b/tools/source/fsys/wntmsc.cxx index fa18aa46fcf1..ab783b45a161 100644 --- a/tools/source/fsys/wntmsc.cxx +++ b/tools/source/fsys/wntmsc.cxx @@ -114,7 +114,7 @@ int closedir( DIR *pDir ) |* *************************************************************************/ -FSysPathStyle DirEntry::GetPathStyle( const String & ) +FSysPathStyle DirEntry::GetPathStyle() { return FSYS_STYLE_NTFS; } @@ -872,42 +872,4 @@ const char* TempDirImpl( char *pBuf ) return pBuf; } -//======================================================================= - -ErrCode FileStat::QueryDiskSpace( const String &rPath, - BigInt &rFreeBytes, BigInt &rTotalBytes ) -{ - DWORD nSectorsPerCluster; /* address of sectors per cluster */ - DWORD nBytesPerSector; /* address of bytes per sector */ - DWORD nFreeClusters; /* address of number of free clusters */ - DWORD nClusters; /* address of total number of clusters */ - - ByteString aVol( DirEntry(rPath).ImpGetTopPtr()->GetName(), osl_getThreadTextEncoding()); - bool bOK = GetDiskFreeSpace( aVol.GetBuffer(), - &nSectorsPerCluster, &nBytesPerSector, - &nFreeClusters, &nClusters ); - if ( !bOK ) - return Sys2SolarError_Impl( GetLastError() ); - - BigInt aBytesPerCluster( BigInt(nSectorsPerCluster) * - BigInt(nBytesPerSector) ); - rFreeBytes = aBytesPerCluster * BigInt(nFreeClusters); - rTotalBytes = aBytesPerCluster * BigInt(nClusters); - return 0; -} - -//========================================================================= - -void FSysEnableSysErrorBox( sal_Bool bEnable ) -{ // Preserve other Bits!! - sal_uInt32 nErrorMode = SetErrorMode( bEnable ? 0 : SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX ); - if ( bEnable ) - nErrorMode &= ~(SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - else - nErrorMode |= (SEM_FAILCRITICALERRORS|SEM_NOOPENFILEERRORBOX); - SetErrorMode( nErrorMode ); -} - - - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/tools/source/fsys/wntmsc.hxx b/tools/source/fsys/wntmsc.hxx index ba88e4eaf020..43b700fe17be 100644 --- a/tools/source/fsys/wntmsc.hxx +++ b/tools/source/fsys/wntmsc.hxx @@ -34,8 +34,8 @@ #ifndef ICC #include <io.h> #endif -#include <sys\types.h> -#include <sys\stat.h> +#include <sys/types.h> +#include <sys/stat.h> #include <direct.h> #include <windows.h> diff --git a/tools/source/generic/b3dtrans.cxx b/tools/source/generic/b3dtrans.cxx index 4af4b3edcb85..1f731e1fd387 100644 --- a/tools/source/generic/b3dtrans.cxx +++ b/tools/source/generic/b3dtrans.cxx @@ -182,16 +182,6 @@ void B3dTransformationSet::Reset() |* \************************************************************************/ -void B3dTransformationSet::SetObjectTrans(const basegfx::B3DHomMatrix& rObj) -{ - maObjectTrans = rObj; - - mbObjectToDeviceValid = sal_False; - mbInvTransObjectToEyeValid = sal_False; - - PostSetObjectTrans(); -} - void B3dTransformationSet::PostSetObjectTrans() { // Zuweisen und Inverse bestimmen @@ -217,17 +207,6 @@ void B3dTransformationSet::SetOrientation( basegfx::B3DPoint aVRP, basegfx::B3DV PostSetOrientation(); } -void B3dTransformationSet::SetOrientation(basegfx::B3DHomMatrix& mOrient) -{ - maOrientation = mOrient; - - mbInvTransObjectToEyeValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - - PostSetOrientation(); -} - void B3dTransformationSet::PostSetOrientation() { // Zuweisen und Inverse bestimmen @@ -254,13 +233,6 @@ const basegfx::B3DHomMatrix& B3dTransformationSet::GetProjection() return maProjection; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetInvProjection() -{ - if(!mbProjectionValid) - CalcViewport(); - return maInvProjection; -} - void B3dTransformationSet::PostSetProjection() { // Zuweisen und Inverse bestimmen @@ -274,22 +246,6 @@ void B3dTransformationSet::PostSetProjection() /************************************************************************* |* -|* Texturtransformation -|* -\************************************************************************/ - -void B3dTransformationSet::SetTexture(const basegfx::B2DHomMatrix& rTxt) -{ - maTexture = rTxt; - PostSetTexture(); -} - -void B3dTransformationSet::PostSetTexture() -{ -} - -/************************************************************************* -|* |* Viewport-Transformation |* \************************************************************************/ @@ -425,17 +381,6 @@ void B3dTransformationSet::SetRatio(double fNew) } } -void B3dTransformationSet::SetRatioMode(Base3DRatio eNew) -{ - if(meRatio != eNew) - { - meRatio = eNew; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - } -} - void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, double fT, sal_Bool bBroadCastChange) { @@ -456,61 +401,10 @@ void B3dTransformationSet::SetDeviceRectangle(double fL, double fR, double fB, d } } -void B3dTransformationSet::SetDeviceVolume(const basegfx::B3DRange& rVol, sal_Bool bBroadCastChange) -{ - SetDeviceRectangle(rVol.getMinX(), rVol.getMaxX(), rVol.getMinY(), rVol.getMaxY(), bBroadCastChange); - SetFrontClippingPlane(rVol.getMinZ()); - SetBackClippingPlane(rVol.getMaxZ()); -} - void B3dTransformationSet::DeviceRectangleChange() { } -void B3dTransformationSet::GetDeviceRectangle(double &fL, double &fR, double& fB, double& fT) -{ - fL = mfLeftBound; - fR = mfRightBound; - fB = mfBottomBound; - fT = mfTopBound; - - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; -} - -basegfx::B3DRange B3dTransformationSet::GetDeviceVolume() -{ - basegfx::B3DRange aRet; - - aRet.expand(basegfx::B3DTuple(mfLeftBound, mfBottomBound, mfNearBound)); - aRet.expand(basegfx::B3DTuple(mfRightBound, mfTopBound, mfFarBound)); - - return aRet; -} - -void B3dTransformationSet::SetFrontClippingPlane(double fF) -{ - if(mfNearBound != fF) - { - mfNearBound = fF; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - } -} - -void B3dTransformationSet::SetBackClippingPlane(double fB) -{ - if(mfFarBound != fB) - { - mfFarBound = fB; - mbProjectionValid = sal_False; - mbObjectToDeviceValid = sal_False; - mbWorldToViewValid = sal_False; - } -} - void B3dTransformationSet::SetPerspective(sal_Bool bNew) { if(mbPerspective != bNew) @@ -539,13 +433,6 @@ void B3dTransformationSet::PostSetViewport() { } -const Rectangle& B3dTransformationSet::GetLogicalViewportBounds() -{ - if(!mbProjectionValid) - CalcViewport(); - return maSetBound; -} - const basegfx::B3DVector& B3dTransformationSet::GetScale() { if(!mbProjectionValid) @@ -577,13 +464,6 @@ void B3dTransformationSet::CalcMatObjectToDevice() mbObjectToDeviceValid = sal_True; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetObjectToDevice() -{ - if(!mbObjectToDeviceValid) - CalcMatObjectToDevice(); - return maObjectToDevice; -} - void B3dTransformationSet::CalcMatInvTransObjectToEye() { maInvTransObjectToEye = maObjectTrans; @@ -602,25 +482,6 @@ void B3dTransformationSet::CalcMatInvTransObjectToEye() mbInvTransObjectToEyeValid = sal_True; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetInvTransObjectToEye() -{ - if(!mbInvTransObjectToEyeValid) - CalcMatInvTransObjectToEye(); - return maInvTransObjectToEye; -} - -basegfx::B3DHomMatrix B3dTransformationSet::GetMatFromObjectToView() -{ - basegfx::B3DHomMatrix aFromObjectToView = GetObjectToDevice(); - - const basegfx::B3DVector& rScale(GetScale()); - aFromObjectToView.scale(rScale.getX(), rScale.getY(), rScale.getZ()); - const basegfx::B3DVector& rTranslate(GetTranslate()); - aFromObjectToView.translate(rTranslate.getX(), rTranslate.getY(), rTranslate.getZ()); - - return aFromObjectToView; -} - void B3dTransformationSet::CalcMatFromWorldToView() { maMatFromWorldToView = maOrientation; @@ -636,20 +497,6 @@ void B3dTransformationSet::CalcMatFromWorldToView() mbWorldToViewValid = sal_True; } -const basegfx::B3DHomMatrix& B3dTransformationSet::GetMatFromWorldToView() -{ - if(!mbWorldToViewValid) - CalcMatFromWorldToView(); - return maMatFromWorldToView; -} - -const basegfx::B3DHomMatrix& B3dTransformationSet::GetInvMatFromWorldToView() -{ - if(!mbWorldToViewValid) - CalcMatFromWorldToView(); - return maInvMatFromWorldToView; -} - /************************************************************************* |* |* Direkter Zugriff auf verschiedene Transformationen @@ -670,128 +517,6 @@ const basegfx::B3DPoint B3dTransformationSet::EyeToWorldCoor(const basegfx::B3DP return aVec; } -const basegfx::B3DPoint B3dTransformationSet::EyeToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetProjection(); - aVec *= GetScale(); - aVec += GetTranslate(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToEyeCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec -= GetTranslate(); - aVec = aVec / GetScale(); - aVec *= GetInvProjection(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::WorldToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetMatFromWorldToView(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToWorldCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvMatFromWorldToView(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::DeviceToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetScale(); - aVec += GetTranslate(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToDeviceCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec -= GetTranslate(); - aVec = aVec / GetScale(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ObjectToWorldCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::WorldToObjectCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ObjectToViewCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetObjectTrans(); - aVec *= GetMatFromWorldToView(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ViewToObjectCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvMatFromWorldToView(); - aVec *= GetInvObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::ObjectToEyeCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetObjectTrans(); - aVec *= GetOrientation(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::EyeToObjectCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvOrientation(); - aVec *= GetInvObjectTrans(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::DeviceToEyeCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvProjection(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::EyeToDeviceCoor(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetProjection(); - return aVec; -} - -const basegfx::B3DPoint B3dTransformationSet::InvTransObjectToEye(const basegfx::B3DPoint& rVec) -{ - basegfx::B3DPoint aVec(rVec); - aVec *= GetInvTransObjectToEye(); - return aVec; -} - -const basegfx::B2DPoint B3dTransformationSet::TransTextureCoor(const basegfx::B2DPoint& rVec) -{ - basegfx::B2DPoint aVec(rVec); - aVec *= GetTexture(); - return aVec; -} - /************************************************************************* |* |* Konstruktor B3dViewport @@ -811,18 +536,6 @@ B3dViewport::~B3dViewport() { } -void B3dViewport::SetVRP(const basegfx::B3DPoint& rNewVRP) -{ - aVRP = rNewVRP; - CalcOrientation(); -} - -void B3dViewport::SetVPN(const basegfx::B3DVector& rNewVPN) -{ - aVPN = rNewVPN; - CalcOrientation(); -} - void B3dViewport::SetVUV(const basegfx::B3DVector& rNewVUV) { aVUV = rNewVUV; @@ -869,81 +582,6 @@ B3dCamera::~B3dCamera() { } -void B3dCamera::SetPosition(const basegfx::B3DPoint& rNewPos) -{ - if(rNewPos != aPosition) - { - // Zuweisen - aCorrectedPosition = aPosition = rNewPos; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetLookAt(const basegfx::B3DVector& rNewLookAt) -{ - if(rNewLookAt != aLookAt) - { - // Zuweisen - aLookAt = rNewLookAt; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetPositionAndLookAt(const basegfx::B3DPoint& rNewPos, const basegfx::B3DVector& rNewLookAt) -{ - if(rNewPos != aPosition || rNewLookAt != aLookAt) - { - // Zuweisen - aPosition = rNewPos; - aLookAt = rNewLookAt; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetFocalLength(double fLen) -{ - if(fLen != fFocalLength) - { - // Zuweisen - if(fLen < 5.0) - fLen = 5.0; - fFocalLength = fLen; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetBankAngle(double fAngle) -{ - if(fAngle != fBankAngle) - { - // Zuweisen - fBankAngle = fAngle; - - // Neuberechnung - CalcNewViewportValues(); - } -} - -void B3dCamera::SetUseFocalLength(sal_Bool bNew) -{ - if(bNew != (sal_Bool)bUseFocalLength) - { - // Zuweisen - bUseFocalLength = bNew; - - // Neuberechnung - CalcNewViewportValues(); - } -} - void B3dCamera::DeviceRectangleChange() { // call parent diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx index 4392e56d5e44..2312f3c5eeaf 100644 --- a/tools/source/generic/bigint.cxx +++ b/tools/source/generic/bigint.cxx @@ -855,75 +855,6 @@ BigInt& BigInt::operator/=( const BigInt& rVal ) // ----------------------------------------------------------------------- -void BigInt::DivMod( const BigInt& rVal, BigInt& rMod ) -{ - if ( !rVal.bIsBig ) - { - if ( rVal.nVal == 0 ) - { - OSL_FAIL( "BigInt::operator/ --> divide by zero" ); - return; - } - - if ( !bIsBig ) - { - // wir bewegen uns im ungefaehrlichem Bereich - rMod = BigInt( nVal % rVal.nVal ); - nVal /= rVal.nVal; - return; - } - - if ( rVal.nVal == 1 ) - { - rMod = BigInt( (long)0 ); - return; - } - - if ( rVal.nVal == -1 ) - { - rMod = BigInt( (long)0 ); - bIsNeg = !bIsNeg; - return; - } - - if ( rVal.nVal <= (long)0xFFFF && rVal.nVal >= -(long)0xFFFF ) - { - // ein BigInt durch ein sal_uInt16 teilen - sal_uInt16 nTmp; - if ( rVal.nVal < 0 ) - { - nTmp = (sal_uInt16) -rVal.nVal; - bIsNeg = !bIsNeg; - } - else - nTmp = (sal_uInt16) rVal.nVal; - - Div( nTmp, nTmp ); - rMod = BigInt( (long)nTmp ); - Normalize(); - return; - } - } - - if ( ABS_IsLess( rVal ) ) - { - rMod = *this; - *this = BigInt( (long)0 ); - return; - } - - // BigInt durch BigInt teilen - BigInt aTmp1, aTmp2; - aTmp1.MakeBigInt( *this ); - aTmp2.MakeBigInt( rVal ); - aTmp1.DivLong(aTmp2, *this); - Normalize(); - aTmp1.ModLong(aTmp2, rMod); // nicht optimal - rMod.Normalize(); -} - -// ----------------------------------------------------------------------- - BigInt& BigInt::operator%=( const BigInt& rVal ) { if ( !rVal.bIsBig ) diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index 6c533459f2a7..2075bf49e300 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -45,6 +45,7 @@ #include <tools/debug.hxx> #include <tools/config.hxx> #include <osl/security.h> +#include <rtl/strbuf.hxx> #define MAXBUFLEN 1024 // Fuer Buffer bei VOS-Funktionen @@ -1188,13 +1189,15 @@ sal_uInt16 Config::GetKeyCount() const ByteString Config::GetKeyName( sal_uInt16 nKey ) const { #ifdef DBG_UTIL - ByteString aTraceStr( "Config::GetKeyName( " ); - aTraceStr += ByteString::CreateFromInt32(nKey); - aTraceStr += " ) from "; - aTraceStr += GetGroup(); - aTraceStr += " in "; - aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("Config::GetKeyName( ")); + aTraceStr.append(static_cast<sal_Int32>(nKey)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" ) from ")); + aTraceStr.append(GetGroup()); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" in ")); + aTraceStr.append(rtl::OUStringToOString( + maFileName, RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", aTraceStr.getStr()); #endif // Key suchen und Name zurueckgeben @@ -1223,13 +1226,15 @@ ByteString Config::GetKeyName( sal_uInt16 nKey ) const ByteString Config::ReadKey( sal_uInt16 nKey ) const { #ifdef DBG_UTIL - ByteString aTraceStr( "Config::ReadKey( " ); - aTraceStr += ByteString::CreateFromInt32( nKey ); - aTraceStr += " ) from "; - aTraceStr += GetGroup(); - aTraceStr += " in "; - aTraceStr += ByteString( maFileName, RTL_TEXTENCODING_UTF8 ); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("Config::ReadKey( ")); + aTraceStr.append(static_cast<sal_Int32>(nKey)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" ) from ")); + aTraceStr.append(GetGroup()); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" in ")); + aTraceStr.append(rtl::OUStringToOString(maFileName, + RTL_TEXTENCODING_UTF8)); + OSL_TRACE("%s", aTraceStr.getStr()); #endif // Key suchen und Value zurueckgeben diff --git a/tools/source/inet/inetmime.cxx b/tools/source/inet/inetmime.cxx index 78032e7d376e..d1178f29253e 100644 --- a/tools/source/inet/inetmime.cxx +++ b/tools/source/inet/inetmime.cxx @@ -492,18 +492,6 @@ bool INetMIME::isIMAPAtomChar(sal_uInt32 nChar) //============================================================================ // static -sal_uInt32 INetMIME::getDigit(int nWeight) -{ - DBG_ASSERT(nWeight >= 0 && nWeight < 10, - "INetMIME::getDigit(): Bad weight"); - - static const sal_Char aDigits[16] - = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9' }; - return aDigits[nWeight]; -} - -//============================================================================ -// static sal_uInt32 INetMIME::getHexDigit(int nWeight) { DBG_ASSERT(nWeight >= 0 && nWeight < 16, @@ -517,40 +505,6 @@ sal_uInt32 INetMIME::getHexDigit(int nWeight) //============================================================================ // static -sal_uInt32 INetMIME::getBase64Digit(int nWeight) -{ - DBG_ASSERT(nWeight >= 0 && nWeight < 64, - "INetMIME::getBase64Digit(): Bad weight"); - - static const sal_Char aDigits[64] - = { 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', - 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', - 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', - 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', - '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/' }; - return aDigits[nWeight]; -} - -//============================================================================ -// static -bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1, - const sal_Char * pEnd1, - const sal_Char * pBegin2, - const sal_Char * pEnd2) -{ - DBG_ASSERT(pBegin1 && pBegin1 <= pEnd1 && pBegin2 && pBegin2 <= pEnd2, - "INetMIME::equalIgnoreCase(): Bad sequences"); - - if (pEnd1 - pBegin1 != pEnd2 - pBegin2) - return false; - while (pBegin1 != pEnd1) - if (toUpperCase(*pBegin1++) != toUpperCase(*pBegin2++)) - return false; - return true; -} - -//============================================================================ -// static bool INetMIME::equalIgnoreCase(const sal_Char * pBegin1, const sal_Char * pEnd1, const sal_Char * pString2) @@ -583,35 +537,6 @@ bool INetMIME::equalIgnoreCase(const sal_Unicode * pBegin1, //============================================================================ // static -const sal_Char * INetMIME::skipLinearWhiteSpace(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::skipLinearWhiteSpace(): Bad sequence"); - - while (pBegin != pEnd) - switch (*pBegin) - { - case '\t': - case ' ': - ++pBegin; - break; - - case 0x0D: // CR - if (startsWithLineFolding(pBegin, pEnd)) - pBegin += 3; - else - return pBegin; - break; - - default: - return pBegin; - } - return pBegin; -} - -//============================================================================ -// static const sal_Unicode * INetMIME::skipLinearWhiteSpace(const sal_Unicode * pBegin, const sal_Unicode * pEnd) { @@ -842,26 +767,6 @@ const sal_Unicode * INetMIME::skipQuotedString(const sal_Unicode * pBegin, //============================================================================ // static -const sal_Char * INetMIME::scanAtom(const sal_Char * pBegin, - const sal_Char * pEnd) -{ - while (pBegin != pEnd && isAtomChar(*pBegin)) - ++pBegin; - return pBegin; -} - -//============================================================================ -// static -const sal_Unicode * INetMIME::scanAtom(const sal_Unicode * pBegin, - const sal_Unicode * pEnd) -{ - while (pBegin != pEnd && isAtomChar(*pBegin)) - ++pBegin; - return pBegin; -} - -//============================================================================ -// static bool INetMIME::scanUnsigned(const sal_Char *& rBegin, const sal_Char * pEnd, bool bLeadingZeroes, sal_uInt32 & rValue) { @@ -909,127 +814,6 @@ bool INetMIME::scanUnsigned(const sal_Unicode *& rBegin, //============================================================================ // static -bool INetMIME::scanUnsignedHex(const sal_Char *& rBegin, - const sal_Char * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue) -{ - sal_uInt64 nTheValue = 0; - const sal_Char * p = rBegin; - for ( p = rBegin; p != pEnd; ++p) - { - int nWeight = getHexWeight(*p); - if (nWeight < 0) - break; - nTheValue = nTheValue << 4 | nWeight; - if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) - return false; - } - if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) - return false; - rBegin = p; - rValue = sal_uInt32(nTheValue); - return true; -} - -//============================================================================ -// static -bool INetMIME::scanUnsignedHex(const sal_Unicode *& rBegin, - const sal_Unicode * pEnd, bool bLeadingZeroes, - sal_uInt32 & rValue) -{ - sal_uInt64 nTheValue = 0; - const sal_Unicode * p = rBegin; - for ( ; p != pEnd; ++p) - { - int nWeight = getHexWeight(*p); - if (nWeight < 0) - break; - nTheValue = nTheValue << 4 | nWeight; - if (nTheValue > std::numeric_limits< sal_uInt32 >::max()) - return false; - } - if (nTheValue == 0 && (p == rBegin || (!bLeadingZeroes && p - rBegin != 1))) - return false; - rBegin = p; - rValue = sal_uInt32(nTheValue); - return true; -} - -//============================================================================ -// static -const sal_Char * INetMIME::scanQuotedBlock(const sal_Char * pBegin, - const sal_Char * pEnd, - sal_uInt32 nOpening, - sal_uInt32 nClosing, - sal_Size & rLength, - bool & rModify) -{ - DBG_ASSERT(pBegin && pBegin <= pEnd, - "INetMIME::scanQuotedBlock(): Bad sequence"); - - if (pBegin != pEnd && static_cast< unsigned char >(*pBegin) == nOpening) - { - ++rLength; - ++pBegin; - while (pBegin != pEnd) - if (static_cast< unsigned char >(*pBegin) == nClosing) - { - ++rLength; - return ++pBegin; - } - else - { - sal_uInt32 c = *pBegin++; - switch (c) - { - case 0x0D: // CR - if (pBegin != pEnd && *pBegin == 0x0A) // LF - if (pEnd - pBegin >= 2 && isWhiteSpace(pBegin[1])) - { - ++rLength; - rModify = true; - pBegin += 2; - } - else - { - rLength += 3; - rModify = true; - ++pBegin; - } - else - ++rLength; - break; - - case '\\': - ++rLength; - if (pBegin != pEnd) - { - if (startsWithLineBreak(pBegin, pEnd) - && (pEnd - pBegin < 3 - || !isWhiteSpace(pBegin[2]))) - { - rLength += 3; - rModify = true; - pBegin += 2; - } - else - ++pBegin; - } - break; - - default: - ++rLength; - if (!isUSASCII(c)) - rModify = true; - break; - } - } - } - return pBegin; -} - -//============================================================================ -// static const sal_Unicode * INetMIME::scanQuotedBlock(const sal_Unicode * pBegin, const sal_Unicode * pEnd, sal_uInt32 nOpening, @@ -1767,14 +1551,6 @@ rtl_TextEncoding INetMIME::getCharsetEncoding(sal_Char const * pBegin, //============================================================================ // static -rtl_TextEncoding INetMIME::getCharsetEncoding(sal_Unicode const * pBegin, - sal_Unicode const * pEnd) -{ - return getCharsetEncoding_Impl(pBegin, pEnd); -} - -//============================================================================ -// static INetMIMECharsetList_Impl * INetMIME::createPreferredCharsetList(rtl_TextEncoding eEncoding) { @@ -2170,80 +1946,6 @@ void INetMIME::writeUTF8(INetMIMEOutputSink & rSink, sal_uInt32 nChar) //============================================================================ // static -void INetMIME::writeUnsigned(INetMIMEOutputSink & rSink, sal_uInt32 nValue, - int nMinDigits) -{ - sal_Char aBuffer[10]; - // max unsigned 32 bit value (4294967295) has 10 places - sal_Char * p = aBuffer; - for (; nValue > 0; nValue /= 10) - *p++ = sal_Char(getDigit(nValue % 10)); - nMinDigits -= p - aBuffer; - while (nMinDigits-- > 0) - rSink << '0'; - while (p != aBuffer) - rSink << *--p; -} - -//============================================================================ -// static -void INetMIME::writeDateTime(INetMIMEOutputSink & rSink, - const DateTime & rUTC) -{ - static const sal_Char aDay[7][3] - = { { 'M', 'o', 'n' }, - { 'T', 'u', 'e' }, - { 'W', 'e', 'd' }, - { 'T', 'h', 'u' }, - { 'F', 'r', 'i' }, - { 'S', 'a', 't' }, - { 'S', 'u', 'n' } }; - const sal_Char * pTheDay = aDay[rUTC.GetDayOfWeek()]; - rSink.write(pTheDay, pTheDay + 3); - rSink << ", "; - writeUnsigned(rSink, rUTC.GetDay()); - rSink << ' '; - static const sal_Char aMonth[12][3] - = { { 'J', 'a', 'n' }, - { 'F', 'e', 'b' }, - { 'M', 'a', 'r' }, - { 'A', 'p', 'r' }, - { 'M', 'a', 'y' }, - { 'J', 'u', 'n' }, - { 'J', 'u', 'l' }, - { 'A', 'u', 'g' }, - { 'S', 'e', 'p' }, - { 'O', 'c', 't' }, - { 'N', 'o', 'v' }, - { 'D', 'e', 'c' } }; - const sal_Char * pTheMonth = aMonth[rUTC.GetMonth() - 1]; - rSink.write(pTheMonth, pTheMonth + 3); - rSink << ' '; - writeUnsigned(rSink, rUTC.GetYear()); - rSink << ' '; - writeUnsigned(rSink, rUTC.GetHour(), 2); - rSink << ':'; - writeUnsigned(rSink, rUTC.GetMin(), 2); - rSink << ':'; - writeUnsigned(rSink, rUTC.GetSec(), 2); - rSink << " +0000"; -} - -//============================================================================ -// static -void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink, - HeaderFieldType eType, - const ByteString & rBody, - rtl_TextEncoding ePreferredEncoding, - bool bInitialSpace) -{ - writeHeaderFieldBody(rSink, eType, - UniString(rBody, RTL_TEXTENCODING_UTF8), - ePreferredEncoding, bInitialSpace); -} - -//============================================================================ -// static void INetMIME::writeHeaderFieldBody(INetMIMEOutputSink & rSink, HeaderFieldType eType, const UniString & rBody, diff --git a/tools/source/inet/inetmsg.cxx b/tools/source/inet/inetmsg.cxx index 2fc9f5fcb8e3..1645e9ba7aea 100644 --- a/tools/source/inet/inetmsg.cxx +++ b/tools/source/inet/inetmsg.cxx @@ -34,6 +34,7 @@ #include <tools/inetmsg.hxx> #include <tools/inetstrm.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> #include <stdio.h> @@ -63,7 +64,6 @@ inline sal_Unicode ascii_toLowerCase( sal_Unicode ch ) * *=====================================================================*/ #define CONSTASCII_STRINGPARAM(a) (a), RTL_TEXTENCODING_ASCII_US -#define HEADERFIELD INetMessageHeader /* * ~INetMessage. @@ -79,10 +79,10 @@ INetMessage::~INetMessage (void) void INetMessage::ListCleanup_Impl (void) { // Cleanup. - sal_uIntPtr i, n = m_aHeaderList.Count(); + sal_uIntPtr i, n = m_aHeaderList.size(); for (i = 0; i < n; i++) - delete ((HEADERFIELD*)(m_aHeaderList.GetObject(i))); - m_aHeaderList.Clear(); + delete m_aHeaderList[ i ]; + m_aHeaderList.clear(); } /* @@ -99,8 +99,8 @@ void INetMessage::ListCopy (const INetMessage &rMsg) sal_uIntPtr i, n = rMsg.GetHeaderCount(); for (i = 0; i < n; i++) { - HEADERFIELD *p = (HEADERFIELD*)(rMsg.m_aHeaderList.GetObject(i)); - m_aHeaderList.Insert (new HEADERFIELD(*p), LIST_APPEND); + INetMessageHeader *p = rMsg.m_aHeaderList[ i ]; + m_aHeaderList.push_back( new INetMessageHeader(*p) ); } } } @@ -125,20 +125,6 @@ void INetMessage::SetHeaderField_Impl ( * SetHeaderField. */ sal_uIntPtr INetMessage::SetHeaderField ( - const UniString& rName, const UniString& rValue, sal_uIntPtr nIndex) -{ - sal_uIntPtr nResult = nIndex; - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - ByteString (rName, RTL_TEXTENCODING_ASCII_US), rValue, - nResult); - return nResult; -} - -/* - * SetHeaderField. - */ -sal_uIntPtr INetMessage::SetHeaderField ( const INetMessageHeader &rHeader, sal_uIntPtr nIndex) { sal_uIntPtr nResult = nIndex; @@ -155,11 +141,11 @@ SvStream& INetMessage::operator<< (SvStream& rStrm) const rStrm << static_cast<sal_uInt32>(m_nDocSize); rStrm.WriteByteString (m_aDocName, RTL_TEXTENCODING_UTF8); - sal_uIntPtr i, n = m_aHeaderList.Count(); + sal_uIntPtr i, n = m_aHeaderList.size(); rStrm << static_cast<sal_uInt32>(n); for (i = 0; i < n; i++) - rStrm << *((HEADERFIELD *)(m_aHeaderList.GetObject(i))); + rStrm << *( m_aHeaderList[ i ] ); return rStrm; } @@ -187,9 +173,9 @@ SvStream& INetMessage::operator>> (SvStream& rStrm) for (i = 0; i < n; i++) { - HEADERFIELD *p = new HEADERFIELD(); + INetMessageHeader *p = new INetMessageHeader(); rStrm >> *p; - m_aHeaderList.Insert (p, LIST_APPEND); + m_aHeaderList.push_back( p ); } // Done. @@ -198,34 +184,6 @@ SvStream& INetMessage::operator>> (SvStream& rStrm) /*======================================================================= * - * INetMessageHeaderIterator Implementation. - * - *=====================================================================*/ -INetMessageHeaderIterator::INetMessageHeaderIterator ( - const INetMessage& rMsg, const UniString& rHdrName) -{ - sal_uIntPtr i, n = rMsg.GetHeaderCount(); - for (i = 0; i < n; i++) - { - if (rHdrName.CompareIgnoreCaseToAscii (rMsg.GetHeaderName(i)) == 0) - { - UniString *pValue = new UniString (rMsg.GetHeaderValue(i)); - aValueList.Insert (pValue, LIST_APPEND); - } - } - nValueCount = aValueList.Count(); -} - -INetMessageHeaderIterator::~INetMessageHeaderIterator (void) -{ - sal_uIntPtr i, n = aValueList.Count(); - for (i = 0; i < n; i++) - delete ((UniString*)(aValueList.GetObject(i))); - aValueList.Clear(); -} - -/*======================================================================= - * * INetRFC822Message Implementation. * *=====================================================================*/ @@ -324,13 +282,8 @@ INetRFC822Message::~INetRFC822Message (void) } /* - * <Generate|Parse>DateField and local helper functions. - * - * GenerateDateField. - * Generates a String from Date and Time objects in format: - * Wkd, 00 Mon 0000 00:00:00 [GMT] (rfc822, rfc1123) + * ParseDateField and local helper functions. * - * ParseDateField. * Parses a String in (implied) GMT format into class Date and Time objects. * Four formats are accepted: * @@ -349,62 +302,6 @@ static const sal_Char *months[12] = "Jul", "Aug", "Sep", "Oct", "Nov", "Dec" }; -static const sal_Char *wkdays[7] = -{ - "Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun" -}; - -/* - * GenerateDateField. - */ -sal_Bool INetRFC822Message::GenerateDateField ( - const DateTime& rDateTime, UniString& rDateFieldW) -{ - // Check arguments. - if (!rDateTime.IsValid() || - (rDateTime.GetSec() > 59) || - (rDateTime.GetMin() > 59) || - (rDateTime.GetHour() > 23) ) return sal_False; - - // Prepare output string. - ByteString rDateField; - - // Insert Date. - rDateField += wkdays[(sal_uInt16)(rDateTime.GetDayOfWeek())]; - rDateField += ", "; - - sal_uInt16 nNum = rDateTime.GetDay(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += ' '; - - rDateField += months[(sal_uInt16)(rDateTime.GetMonth() - 1)]; - rDateField += ' '; - - rDateField += ByteString::CreateFromInt32(rDateTime.GetYear()); - rDateField += ' '; - - // Insert Time. - nNum = rDateTime.GetHour(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += ':'; - - nNum = rDateTime.GetMin(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += ':'; - - nNum = rDateTime.GetSec(); - if (nNum < 10) rDateField += '0'; - rDateField += ByteString::CreateFromInt32(nNum); - rDateField += " GMT"; - - // Done. - rDateFieldW = UniString (rDateField, RTL_TEXTENCODING_ASCII_US); - return sal_True; -} - /* * ParseDateField and local helper functions. */ @@ -761,7 +658,7 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( case INETMSG_RFC822_OK: pData = pStop; SetHeaderField_Impl ( - HEADERFIELD (HDR(nIdx), rHeader.GetValue()), + INetMessageHeader (HDR(nIdx), rHeader.GetValue()), m_nIndex[nIdx]); nNewIndex = m_nIndex[nIdx]; break; @@ -776,129 +673,6 @@ sal_uIntPtr INetRFC822Message::SetHeaderField ( } /* - * Specific Set-Methods. - */ -void INetRFC822Message::SetBCC (const UniString& rBCC) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_BCC), rBCC, - m_nIndex[INETMSG_RFC822_BCC]); -} - -void INetRFC822Message::SetCC (const UniString& rCC) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_CC), rCC, - m_nIndex[INETMSG_RFC822_CC]); -} - -void INetRFC822Message::SetComments (const UniString& rComments) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - HDR(INETMSG_RFC822_COMMENTS), rComments, - m_nIndex[INETMSG_RFC822_COMMENTS]); -} - -void INetRFC822Message::SetDate (const UniString& rDate) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_STRUCTURED, - HDR(INETMSG_RFC822_DATE), rDate, - m_nIndex[INETMSG_RFC822_DATE]); -} - -void INetRFC822Message::SetFrom (const UniString& rFrom) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_FROM), rFrom, - m_nIndex[INETMSG_RFC822_FROM]); -} - -void INetRFC822Message::SetInReplyTo (const UniString& rInReplyTo) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, // ??? MESSAGE_ID ??? - HDR(INETMSG_RFC822_IN_REPLY_TO), rInReplyTo, - m_nIndex[INETMSG_RFC822_IN_REPLY_TO]); -} - -void INetRFC822Message::SetKeywords (const UniString& rKeywords) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_PHRASE, - HDR(INETMSG_RFC822_KEYWORDS), rKeywords, - m_nIndex[INETMSG_RFC822_KEYWORDS]); -} - -void INetRFC822Message::SetMessageID (const UniString& rMessageID) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_MESSAGE_ID, - HDR(INETMSG_RFC822_MESSAGE_ID), rMessageID, - m_nIndex[INETMSG_RFC822_MESSAGE_ID]); -} - -void INetRFC822Message::SetReferences (const UniString& rReferences) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_MESSAGE_ID, - HDR(INETMSG_RFC822_REFERENCES), rReferences, - m_nIndex[INETMSG_RFC822_REFERENCES]); -} - -void INetRFC822Message::SetReplyTo (const UniString& rReplyTo) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_REPLY_TO), rReplyTo, - m_nIndex[INETMSG_RFC822_REPLY_TO]); -} - -void INetRFC822Message::SetReturnPath (const UniString& rReturnPath) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_RETURN_PATH), rReturnPath, - m_nIndex[INETMSG_RFC822_RETURN_PATH]); -} - -void INetRFC822Message::SetReturnReceiptTo (const UniString& rValue) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_RETURN_RECEIPT_TO), rValue, - m_nIndex[INETMSG_RFC822_RETURN_RECEIPT_TO]); -} - -void INetRFC822Message::SetSender (const UniString& rSender) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_SENDER), rSender, - m_nIndex[INETMSG_RFC822_SENDER]); -} - -void INetRFC822Message::SetSubject (const UniString& rSubject) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - HDR(INETMSG_RFC822_SUBJECT), rSubject, - m_nIndex[INETMSG_RFC822_SUBJECT]); -} - -void INetRFC822Message::SetTo (const UniString& rTo) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_ADDRESS, - HDR(INETMSG_RFC822_TO), rTo, - m_nIndex[INETMSG_RFC822_TO]); -} - -/* * operator<< */ SvStream& INetRFC822Message::operator<< (SvStream& rStrm) const @@ -982,7 +756,6 @@ enum _ImplINetMIMEMessageHeaderState INetMIMEMessage::INetMIMEMessage (void) : INetRFC822Message (), pParent (NULL), - nNumChildren (0), bHeaderParsed (sal_False) { for (sal_uInt16 i = 0; i < INETMSG_MIME_NUMHDR; i++) @@ -1030,9 +803,10 @@ INetMIMEMessage::~INetMIMEMessage (void) */ void INetMIMEMessage::CleanupImp (void) { - INetMIMEMessage *pChild = NULL; - while ((pChild = (INetMIMEMessage *)(aChildren.Remove())) != NULL) - if (pChild->pParent == this) delete pChild; + for( size_t i = 0, n = aChildren.size(); i < n; ++i ) { + delete aChildren[ i ]; + } + aChildren.clear(); } /* @@ -1042,24 +816,22 @@ void INetMIMEMessage::CopyImp (const INetMIMEMessage& rMsg) { bHeaderParsed = rMsg.bHeaderParsed; - sal_uInt16 i; + size_t i; for (i = 0; i < INETMSG_MIME_NUMHDR; i++) m_nIndex[i] = rMsg.m_nIndex[i]; m_aBoundary = rMsg.m_aBoundary; - nNumChildren = rMsg.nNumChildren; - for (i = 0; i < rMsg.aChildren.Count(); i++) + for (i = 0; i < rMsg.aChildren.size(); i++) { - INetMIMEMessage *pChild = - (INetMIMEMessage *)(rMsg.aChildren.GetObject (i)); + INetMIMEMessage *pChild = rMsg.aChildren[ i ]; if (pChild->pParent == &rMsg) { pChild = pChild->CreateMessage (*pChild); pChild->pParent = this; } - aChildren.Insert (pChild, LIST_APPEND); + aChildren.push_back( pChild ); } } @@ -1207,7 +979,7 @@ sal_uIntPtr INetMIMEMessage::SetHeaderField ( case INETMSG_MIME_OK: pData = pStop; SetHeaderField_Impl ( - HEADERFIELD (MIMEHDR(nIdx), rHeader.GetValue()), + INetMessageHeader (MIMEHDR(nIdx), rHeader.GetValue()), m_nIndex[nIdx]); nNewIndex = m_nIndex[nIdx]; break; @@ -1233,14 +1005,6 @@ void INetMIMEMessage::SetMIMEVersion (const UniString& rVersion) m_nIndex[INETMSG_MIME_VERSION]); } -void INetMIMEMessage::SetContentDescription (const String& rDescription) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - MIMEHDR(INETMSG_MIME_CONTENT_DESCRIPTION), rDescription, - m_nIndex[INETMSG_MIME_CONTENT_DESCRIPTION]); -} - void INetMIMEMessage::SetContentDisposition (const String& rDisposition) { SetHeaderField_Impl ( @@ -1249,14 +1013,6 @@ void INetMIMEMessage::SetContentDisposition (const String& rDisposition) m_nIndex[INETMSG_MIME_CONTENT_DISPOSITION]); } -void INetMIMEMessage::SetContentID (const String& rID) -{ - SetHeaderField_Impl ( - INetMIME::HEADER_FIELD_TEXT, - MIMEHDR(INETMSG_MIME_CONTENT_ID), rID, - m_nIndex[INETMSG_MIME_CONTENT_ID]); -} - void INetMIMEMessage::SetContentType (const String& rType) { SetHeaderField_Impl ( @@ -1388,202 +1144,8 @@ sal_Bool INetMIMEMessage::AttachChild ( if (IsContainer() /*&& rChildMsg.GetContentType().Len() */) { if (bOwner) rChildMsg.pParent = this; - aChildren.Insert (&rChildMsg, LIST_APPEND); - nNumChildren = aChildren.Count(); - - return sal_True; - } - return sal_False; -} - -/* - * DetachChild. - */ -sal_Bool INetMIMEMessage::DetachChild ( - sal_uIntPtr nIndex, INetMIMEMessage& rChildMsg) const -{ - if (IsContainer()) - { - // Check document stream. - if (GetDocumentLB() == NULL) return sal_False; - SvStream *pDocStrm = new SvStream (GetDocumentLB()); - - // Initialize message buffer. - char pMsgBuffer[1024]; - char *pMsgRead, *pMsgWrite; - pMsgRead = pMsgWrite = pMsgBuffer; - - // Initialize message parser stream. - INetMIMEMessageStream *pMsgStrm = NULL; - - // Check for "multipart/uvw" or "message/xyz". - if (IsMultipart()) - { - // Multipart message body. Initialize multipart delimiters. - ByteString aDelim ("--"); - aDelim += GetMultipartBoundary(); - ByteString aClose = aDelim; - aClose += "--"; - - // Initialize line buffer. - SvMemoryStream aLineBuf; - - // Initialize control variables. - INetMessageStreamState eState = INETMSG_EOL_SCR; - int nCurIndex = -1; - - // Go! - while (nCurIndex < (int)(nIndex + 1)) - { - if ((pMsgRead - pMsgWrite) > 0) - { - // Bytes still in buffer. - if (eState == INETMSG_EOL_FCR) - { - // Check for 2nd line break character. - if ((*pMsgWrite == '\r') || (*pMsgWrite == '\n')) - aLineBuf << *pMsgWrite++; - - // Check current index. - if (nCurIndex == (int)nIndex) - { - // Found requested part. - if (pMsgStrm == NULL) - { - // Create message parser stream. - pMsgStrm = new INetMIMEMessageStream; - pMsgStrm->SetTargetMessage (&rChildMsg); - } - - // Put message down-stream. - int status = pMsgStrm->Write ( - (const sal_Char *) aLineBuf.GetData(), aLineBuf.Tell()); - if (status != INETSTREAM_STATUS_OK) - { - // Cleanup. - delete pDocStrm; - delete pMsgStrm; - - // Finish. - return (!(status == INETSTREAM_STATUS_OK)); - } - } - - // Reset to <Begin-of-Line>. - aLineBuf.Seek (STREAM_SEEK_TO_BEGIN); - eState = INETMSG_EOL_SCR; - } - else if ((*pMsgWrite == '\r') || (*pMsgWrite == '\n')) - { - /* - * Found any line break character. - * Compare buffered line with part/close delimiter. - * Increment current part index upon match. - */ - sal_uInt16 nLen = (sal_uInt16)(aLineBuf.Tell() & 0xffff); - if (nLen == aDelim.Len()) - { - if (aDelim.CompareTo ((const sal_Char *) aLineBuf.GetData(), nLen) - == COMPARE_EQUAL) nCurIndex++; - } - else if (nLen == aClose.Len()) - { - if (aClose.CompareTo ((const sal_Char *) aLineBuf.GetData(), nLen) - == COMPARE_EQUAL) nCurIndex++; - } - aLineBuf << *pMsgWrite++; - eState = INETMSG_EOL_FCR; - } - else - { - // Insert into line buffer. - aLineBuf << *pMsgWrite; - } - } - else - { - // Buffer empty. Reset to <Begin-of-Buffer>. - pMsgRead = pMsgWrite = pMsgBuffer; - - // Read document stream. - sal_uIntPtr nRead = pDocStrm->Read ( - pMsgBuffer, sizeof (pMsgBuffer)); - if (nRead > 0) - { - // Set read pointer. - pMsgRead += nRead; - } - else - { - // Premature end. - if (pMsgStrm) - { - // Assume end of requested part. - nCurIndex++; - } - else - { - // Requested part not found. - delete pDocStrm; - return sal_False; - } - } - } - } // while (nCurIndex < (nIndex + 1)) - } - else - { - // Encapsulated message body. Create message parser stream. - pMsgStrm = new INetMIMEMessageStream; - pMsgStrm->SetTargetMessage (&rChildMsg); - - // Initialize control variables. - INetMessageStreamState eState = INETMSG_EOL_BEGIN; - - // Go. - while (eState == INETMSG_EOL_BEGIN) - { - if ((pMsgRead - pMsgWrite) > 0) - { - // Bytes still in buffer. Put message down-stream. - int status = pMsgStrm->Write ( - pMsgBuffer, (pMsgRead - pMsgWrite)); - if (status != INETSTREAM_STATUS_OK) - { - // Cleanup. - delete pDocStrm; - delete pMsgStrm; - - // Finish. - return (!(status == INETSTREAM_STATUS_ERROR)); - } - pMsgWrite = pMsgBuffer + (pMsgRead - pMsgWrite); - } - else - { - // Buffer empty. Reset to <Begin-of-Buffer>. - pMsgRead = pMsgWrite = pMsgBuffer; - - // Read document stream. - sal_uIntPtr nRead = pDocStrm->Read ( - pMsgBuffer, sizeof (pMsgBuffer)); - if (nRead > 0) - { - // Set read pointer. - pMsgRead += nRead; - } - else - { - // Mark we're done. - eState = INETMSG_EOL_DONE; - } - } - } // while (eState == INETMSG_EOL_BEGIN) - } + aChildren.push_back( &rChildMsg ); - // Done. - if (pDocStrm) delete pDocStrm; - if (pMsgStrm) delete pMsgStrm; return sal_True; } return sal_False; @@ -1604,7 +1166,7 @@ SvStream& INetMIMEMessage::operator<< (SvStream& rStrm) const #else rStrm.WriteByteString (m_aBoundary); #endif - rStrm << static_cast<sal_uInt32>(nNumChildren); + rStrm << static_cast<sal_uInt32>(aChildren.size()); return rStrm; } @@ -1629,7 +1191,6 @@ SvStream& INetMIMEMessage::operator>> (SvStream& rStrm) rStrm.ReadByteString (m_aBoundary); #endif rStrm >> nTemp; - nNumChildren = nTemp; return rStrm; } diff --git a/tools/source/inet/inetstrm.cxx b/tools/source/inet/inetstrm.cxx index 07d404b090ad..7a04ea24af20 100644 --- a/tools/source/inet/inetstrm.cxx +++ b/tools/source/inet/inetstrm.cxx @@ -173,48 +173,6 @@ int INetIStream::Read (sal_Char *pData, sal_uIntPtr nSize) return GetData (pData, nSize); } -/* - * Decode64. - */ -void INetIStream::Decode64 (SvStream& rIn, SvStream& rOut) -{ - INetMessage aMsg; - aMsg.SetDocumentLB(new SvAsyncLockBytes(&rOut, sal_False)); - - INetMessageDecode64Stream_Impl aStream (8192); - aStream.SetTargetMessage (&aMsg); - - sal_Char* pBuf = new sal_Char[8192]; - - int nRead = 0; - while ((nRead = rIn.Read (pBuf, 8192)) > 0) - aStream.Write( pBuf, nRead ); - aStream.Write ("\r\n", 2); - - delete[] pBuf; -} - -/* - * Encode64. - */ -void INetIStream::Encode64 (SvStream& rIn, SvStream& rOut) -{ - INetMessage aMsg; - aMsg.SetDocumentLB ( - new SvLockBytes (&rIn, sal_False)); - - INetMessageEncode64Stream_Impl aStream (8192); - aStream.SetSourceMessage (&aMsg); - - sal_Char* pBuf = new sal_Char[8192]; - - int nRead = 0; - while ((nRead = aStream.Read (pBuf, 8192)) > 0) - rOut.Write( pBuf, nRead ); - - delete[] pBuf; -} - /*========================================================================= * * INetOStream Implementation. @@ -1621,7 +1579,6 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) if( !pChildStrm ) { // Encapsulated message. - pMsg->SetChildCount( pMsg->GetChildCount() + 1); INetMIMEMessage* pNewMessage = new INetMIMEMessage; pNewMessage->SetDocumentLB ( new SvAsyncLockBytes(new SvCacheStream, sal_False)); @@ -1731,7 +1688,6 @@ int INetMIMEMessageStream::PutMsgLine (const sal_Char *pData, sal_uIntPtr nSize) != COMPARE_EQUAL ) { // Encapsulated message. - pMsg->SetChildCount(pMsg->GetChildCount() + 1); INetMIMEMessage* pNewMessage = new INetMIMEMessage; pNewMessage->SetDocumentLB ( diff --git a/tools/source/memtools/table.cxx b/tools/source/memtools/table.cxx index 75119ba6f142..e9c2239b1c82 100644 --- a/tools/source/memtools/table.cxx +++ b/tools/source/memtools/table.cxx @@ -257,45 +257,6 @@ sal_Bool Table::IsKeyValid( sal_uIntPtr nKey ) const // ----------------------------------------------------------------------- -sal_uIntPtr Table::GetUniqueKey( sal_uIntPtr nStartKey ) const -{ - DBG_ASSERT( (nStartKey > 1) && (nStartKey < 0xFFFFFFFF), - "Table::GetUniqueKey() - nStartKey == 0 or nStartKey >= 0xFFFFFFFF" ); - - if ( !nCount ) - return nStartKey; - - sal_uIntPtr nLastKey = (sal_uIntPtr)Container::GetObject( (nCount*2)-2 ); - if ( nLastKey < nStartKey ) - return nStartKey; - else - { - if ( nLastKey < 0xFFFFFFFE ) - return nLastKey+1; - else - { - sal_uIntPtr nPos; - sal_uIntPtr nTempPos = ImplGetIndex( nStartKey, &nPos ); - if ( nTempPos != TABLE_ENTRY_NOTFOUND ) - nPos = nTempPos; - nLastKey = (sal_uIntPtr)Container::GetObject( nPos ); - if ( nStartKey < nLastKey ) - return nStartKey; - while ( nLastKey < 0xFFFFFFFE ) - { - nPos += 2; - nLastKey++; - if ( nLastKey != (sal_uIntPtr)Container::GetObject( nPos ) ) - return nLastKey; - } - } - } - - return 0; -} - -// ----------------------------------------------------------------------- - sal_uIntPtr Table::SearchKey( sal_uIntPtr nKey, sal_uIntPtr* pPos ) const { *pPos = 0; diff --git a/tools/source/rc/isofallback.cxx b/tools/source/rc/isofallback.cxx index e2a82a865b94..2fae5cfc9eee 100644 --- a/tools/source/rc/isofallback.cxx +++ b/tools/source/rc/isofallback.cxx @@ -42,7 +42,7 @@ bool GetIsoFallback(rtl::OString& rLanguage) sal_Int32 nSepPos = rLanguage.indexOf('-'); if (nSepPos == -1) { - if (rLanguage == rtl::OString(RTL_CONSTASCII_STRINGPARAM("en"))) + if (rLanguage.equalsL(RTL_CONSTASCII_STRINGPARAM("en"))) { // en -> "" rLanguage = rtl::OString(); diff --git a/tools/source/rc/resmgr.cxx b/tools/source/rc/resmgr.cxx index d4b7225a22d4..8b53ebb81823 100644 --- a/tools/source/rc/resmgr.cxx +++ b/tools/source/rc/resmgr.cxx @@ -590,19 +590,20 @@ InternalResMgr::~InternalResMgr() { SvFileStream aStm( UniString( pLogFile, RTL_TEXTENCODING_ASCII_US ), STREAM_WRITE ); aStm.Seek( STREAM_SEEK_TO_END ); - ByteString aLine( "FileName: " ); - aLine.Append( ByteString( OUStringToOString( aFileName, RTL_TEXTENCODING_UTF8 ) ) ); - aStm.WriteLine( aLine ); + rtl::OStringBuffer aLine(RTL_CONSTASCII_STRINGPARAM("FileName: ")); + aLine.append(rtl::OUStringToOString(aFileName, + RTL_TEXTENCODING_UTF8)); + aStm.WriteLine(aLine.makeStringAndClear()); for( boost::unordered_map<sal_uInt64, int>::const_iterator it = pResUseDump->begin(); it != pResUseDump->end(); ++it ) { sal_uInt64 nKeyId = it->first; - aLine.Assign( "Type/Id: " ); - aLine.Append( ByteString::CreateFromInt32( sal::static_int_cast< sal_Int32 >((nKeyId >> 32) & 0xFFFFFFFF) ) ); - aLine.Append( '/' ); - aLine.Append( ByteString::CreateFromInt32( sal::static_int_cast< sal_Int32 >(nKeyId & 0xFFFFFFFF) ) ); - aStm.WriteLine( aLine ); + aLine.append(RTL_CONSTASCII_STRINGPARAM("Type/Id: ")); + aLine.append(sal::static_int_cast< sal_Int32 >((nKeyId >> 32) & 0xFFFFFFFF)); + aLine.append('/'); + aLine.append(sal::static_int_cast< sal_Int32 >(nKeyId & 0xFFFFFFFF)); + aStm.WriteLine(aLine.makeStringAndClear()); } } } @@ -817,31 +818,37 @@ void ResMgr::RscError_Impl( const sal_Char* pMessage, ResMgr* pResMgr, ResMgr* pNewResMgr = new ResMgr( pImp ); - ByteString aStr = OUStringToOString( pResMgr->GetFileName(), RTL_TEXTENCODING_UTF8 ); - if ( aStr.Len() ) - aStr += '\n'; + rtl::OStringBuffer aStr(rtl::OUStringToOString(pResMgr->GetFileName(), + RTL_TEXTENCODING_UTF8)); - aStr.Append( "Class: " ); - aStr.Append( ByteString( GetTypeRes_Impl( ResId( nRT, *pNewResMgr ) ), RTL_TEXTENCODING_UTF8 ) ); - aStr.Append( ", Id: " ); - aStr.Append( ByteString::CreateFromInt32( (long)nId ) ); - aStr.Append( ". " ); - aStr.Append( pMessage ); + if (aStr.getLength()) + aStr.append('\n'); - aStr.Append( "\nResource Stack\n" ); + aStr.append(RTL_CONSTASCII_STRINGPARAM("Class: ")); + aStr.append(rtl::OUStringToOString(GetTypeRes_Impl(ResId(nRT, *pNewResMgr)), + RTL_TEXTENCODING_UTF8)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", Id: ")); + aStr.append(static_cast<sal_Int32>(nId)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(". ")); + aStr.append(pMessage); + + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nResource Stack\n")); while( nDepth > 0 ) { - aStr.Append( "Class: " ); - aStr.Append( ByteString( GetTypeRes_Impl( ResId( rResStack[nDepth].pResource->GetRT(), *pNewResMgr ) ), RTL_TEXTENCODING_UTF8 ) ); - aStr.Append( ", Id: " ); - aStr.Append( ByteString::CreateFromInt32( (long)rResStack[nDepth].pResource->GetId() ) ); + aStr.append(RTL_CONSTASCII_STRINGPARAM("Class: ")); + aStr.append(rtl::OUStringToOString(GetTypeRes_Impl( + ResId(rResStack[nDepth].pResource->GetRT(), *pNewResMgr)), + RTL_TEXTENCODING_UTF8)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", Id: ")); + aStr.append(static_cast<sal_Int32>( + rResStack[nDepth].pResource->GetId())); nDepth--; } // clean up delete pNewResMgr; - OSL_FAIL( aStr.GetBuffer() ); + OSL_FAIL(aStr.getStr()); } #endif @@ -1207,15 +1214,18 @@ sal_Bool ResMgr::GetResource( const ResId& rId, const Resource* pResObj ) if( pFallbackResMgr ) { pTop->Flags |= RC_FALLBACK_DOWN; - #ifdef DBG_UTIL - ByteString aMess( "found resource " ); - aMess.Append( ByteString::CreateFromInt32( nId ) ); - aMess.Append( " in fallback " ); - aMess.Append( ByteString( OUStringToOString( pFallbackResMgr->GetFileName(), osl_getThreadTextEncoding() ) ) ); - aMess.Append( "\n" ); - RscError_Impl( aMess.GetBuffer(), - this, nRT, nId, aStack, nCurStack-1 ); - #endif +#ifdef DBG_UTIL + rtl::OStringBuffer aMess( + RTL_CONSTASCII_STRINGPARAM("found resource ")); + aMess.append(static_cast<sal_Int32>(nId)); + aMess.append(RTL_CONSTASCII_STRINGPARAM(" in fallback ")); + aMess.append(rtl::OUStringToOString( + pFallbackResMgr->GetFileName(), + osl_getThreadTextEncoding())); + aMess.append('\n'); + RscError_Impl(aMess.getStr(), + this, nRT, nId, aStack, nCurStack-1); +#endif } else { diff --git a/tools/source/ref/errinf.cxx b/tools/source/ref/errinf.cxx index 9ad9b71dcba3..9a3dece87cf9 100644 --- a/tools/source/ref/errinf.cxx +++ b/tools/source/ref/errinf.cxx @@ -34,6 +34,7 @@ #include <tools/debug.hxx> #include <tools/errinf.hxx> #include <tools/string.hxx> +#include <rtl/strbuf.hxx> class ErrorHandler; @@ -429,30 +430,33 @@ sal_Bool SimpleErrorHandler::CreateString( const ErrorInfo *pInfo, String &rStr, sal_uInt16 &) const { sal_uIntPtr nId = pInfo->GetErrorCode(); - ByteString aStr; - aStr="Id "; - aStr+=ByteString::CreateFromInt32(nId); - aStr+=" only handled by SimpleErrorHandler"; - aStr+="\nErrorCode: "; - aStr+=ByteString::CreateFromInt32(nId & ((1L << ERRCODE_CLASS_SHIFT) - 1 )); - aStr+="\nErrorClass: "; - aStr+=ByteString::CreateFromInt32((nId & ERRCODE_CLASS_MASK) >> ERRCODE_CLASS_SHIFT); - aStr+="\nErrorArea: "; - aStr+=ByteString::CreateFromInt32((nId & ERRCODE_ERROR_MASK & - ~((1 << ERRCODE_AREA_SHIFT ) -1 ) ) >> ERRCODE_AREA_SHIFT); + rtl::OStringBuffer aStr(RTL_CONSTASCII_STRINGPARAM("Id ")); + aStr.append(static_cast<sal_Int32>(nId)); + aStr.append(RTL_CONSTASCII_STRINGPARAM( + " only handled by SimpleErrorHandler")); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nErrorCode: ")); + aStr.append(static_cast<sal_Int32>( + nId & ((1L << ERRCODE_CLASS_SHIFT) - 1 ))); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nErrorClass: ")); + aStr.append(static_cast<sal_Int32>( + (nId & ERRCODE_CLASS_MASK) >> ERRCODE_CLASS_SHIFT)); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nErrorArea: ")); + aStr.append(static_cast<sal_Int32>((nId & ERRCODE_ERROR_MASK & + ~((1 << ERRCODE_AREA_SHIFT ) -1 ) ) >> ERRCODE_AREA_SHIFT)); DynamicErrorInfo *pDyn=PTR_CAST(DynamicErrorInfo,pInfo); if(pDyn) { - aStr+="\nDId "; - aStr+=ByteString::CreateFromInt32((sal_uIntPtr)*pDyn); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nDId ")); + aStr.append(static_cast<sal_Int32>(*pDyn)); } StandardErrorInfo *pStd=PTR_CAST(StandardErrorInfo,pInfo); if(pStd) { - aStr+="\nXId "; - aStr+=ByteString::CreateFromInt32(pStd->GetExtendedErrorCode()); + aStr.append(RTL_CONSTASCII_STRINGPARAM("\nXId ")); + aStr.append(static_cast<sal_Int32>(pStd->GetExtendedErrorCode())); } - rStr = String( aStr, RTL_TEXTENCODING_ASCII_US ); + rStr = rtl::OStringToOUString(aStr.makeStringAndClear(), + RTL_TEXTENCODING_ASCII_US); return sal_True; } diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 05c7709931e6..e7f30b9d50df 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -33,6 +33,8 @@ #include <stdio.h> #include <string.h> +#include <rtl/strbuf.hxx> + #include <tools/stream.hxx> #include <tools/globname.hxx> @@ -208,10 +210,10 @@ sal_Bool SvGlobalName::operator < ( const SvGlobalName & rObj ) const else if( Data2_a == Data2_b ) { sal_uInt32 Data1_a; - memcpy(&Data1_a, pImp->szData+4, sizeof(sal_uInt32)); + memcpy(&Data1_a, pImp->szData, sizeof(sal_uInt32)); sal_uInt32 Data1_b; - memcpy(&Data1_b, rObj.pImp->szData+4, sizeof(sal_uInt32)); + memcpy(&Data1_b, rObj.pImp->szData, sizeof(sal_uInt32)); return Data1_a < Data1_b; } @@ -262,8 +264,9 @@ void SvGlobalName::MakeFromMemory( void * pData ) *************************************************************************/ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) { - ByteString aStr( rIdStr, RTL_TEXTENCODING_ASCII_US ); - sal_Char * pStr = (sal_Char *)aStr.GetBuffer(); + rtl::OString aStr(rtl::OUStringToOString(rIdStr, + RTL_TEXTENCODING_ASCII_US)); + const sal_Char *pStr = aStr.getStr(); if( rIdStr.Len() == 36 && '-' == pStr[ 8 ] && '-' == pStr[ 13 ] && '-' == pStr[ 18 ] && '-' == pStr[ 23 ] ) @@ -342,29 +345,29 @@ sal_Bool SvGlobalName::MakeId( const String & rIdStr ) *************************************************************************/ String SvGlobalName::GetctorName() const { - ByteString aRet; + rtl::OStringBuffer aStrBuffer; sal_Char buf[ 20 ]; sal_uInt32 Data1; memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); sprintf( buf, "0x%8.8" SAL_PRIXUINT32, Data1 ); - aRet += buf; + aStrBuffer.append(buf); sal_uInt16 i; for( i = 4; i < 8; i += 2 ) { - aRet += ','; + aStrBuffer.append(','); sal_uInt16 Data2; memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16)); sprintf( buf, "0x%4.4X", Data2 ); - aRet += buf; + aStrBuffer.append(buf); } for( i = 8; i < 16; i++ ) { - aRet += ','; + aStrBuffer.append(','); sprintf( buf, "0x%2.2x", pImp->szData[ i ] ); - aRet += buf; + aStrBuffer.append(buf); } - return String( aRet, RTL_TEXTENCODING_ASCII_US ); + return rtl::OStringToOUString(aStrBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); } /************************************************************************* @@ -372,35 +375,35 @@ String SvGlobalName::GetctorName() const *************************************************************************/ String SvGlobalName::GetHexName() const { - ByteString aRet; + rtl::OStringBuffer aHexBuffer; sal_Char buf[ 10 ]; sal_uInt32 Data1; memcpy(&Data1, pImp->szData, sizeof(sal_uInt32)); sprintf( buf, "%8.8" SAL_PRIXUINT32, Data1 ); - aRet += buf; - aRet += '-'; + aHexBuffer.append(buf); + aHexBuffer.append('-'); sal_uInt16 i ; for( i = 4; i < 8; i += 2 ) { sal_uInt16 Data2; memcpy(&Data2, pImp->szData+i, sizeof(sal_uInt16)); sprintf( buf, "%4.4X", Data2 ); - aRet += buf; - aRet += '-'; + aHexBuffer.append(buf); + aHexBuffer.append('-'); } for( i = 8; i < 10; i++ ) { sprintf( buf, "%2.2x", pImp->szData[ i ] ); - aRet += buf; + aHexBuffer.append(buf); } - aRet += '-'; + aHexBuffer.append('-'); for( i = 10; i < 16; i++ ) { sprintf( buf, "%2.2x", pImp->szData[ i ] ); - aRet += buf; + aHexBuffer.append(buf); } - return String( aRet, RTL_TEXTENCODING_ASCII_US ); + return rtl::OStringToOUString(aHexBuffer.makeStringAndClear(), RTL_TEXTENCODING_ASCII_US); } /************** SvGlobalNameList ****************************************/ diff --git a/tools/source/ref/pstm.cxx b/tools/source/ref/pstm.cxx index 75781b427c89..51692e966848 100644 --- a/tools/source/ref/pstm.cxx +++ b/tools/source/ref/pstm.cxx @@ -31,6 +31,7 @@ #include <tools/debug.hxx> #include <tools/pstm.hxx> +#include <rtl/strbuf.hxx> #define STOR_NO_OPTIMIZE @@ -152,11 +153,12 @@ SvPersistStream& operator >> ( SvPersistStream & rStm, #ifdef DBG_UTIL if( nObjLen + nObjPos != rStm.Tell() ) { - ByteString aStr( "false list len: read = " ); - aStr += ByteString::CreateFromInt32( (long)(rStm.Tell() - nObjPos) ); - aStr += ", should = "; - aStr += ByteString::CreateFromInt64(nObjLen); - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("false list len: read = ")); + aStr.append(static_cast<sal_Int64>(rStm.Tell() - nObjPos)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", should = ")); + aStr.append(static_cast<sal_Int64>(nObjLen)); + OSL_FAIL(aStr.getStr()); } #else (void)nObjLen; @@ -760,10 +762,11 @@ sal_uInt32 SvPersistStream::ReadObj if( !pFunc ) { #ifdef DBG_UTIL - ByteString aStr( "no class with id: " ); - aStr += ByteString::CreateFromInt32( nClassId ); - aStr += " registered"; - DBG_WARNING( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("no class with id: " )); + aStr.append(static_cast<sal_Int32>(nClassId)); + aStr.append(RTL_CONSTASCII_STRINGPARAM(" registered")); + DBG_WARNING(aStr.getStr()); #else (void)nObjLen; #endif @@ -788,11 +791,12 @@ sal_uInt32 SvPersistStream::ReadObj #ifdef DBG_UTIL if( nObjLen + nObjPos != Tell() ) { - ByteString aStr( "false object len: read = " ); - aStr += ByteString::CreateFromInt32( (long)(Tell() - nObjPos) ); - aStr += ", should = "; - aStr += ByteString::CreateFromInt32( nObjLen ); - OSL_FAIL( aStr.GetBuffer() ); + rtl::OStringBuffer aStr( + RTL_CONSTASCII_STRINGPARAM("false object len: read = ")); + aStr.append(static_cast<sal_Int64>((long)(Tell() - nObjPos))); + aStr.append(RTL_CONSTASCII_STRINGPARAM(", should = ")); + aStr.append(static_cast<sal_Int32>(nObjLen)); + OSL_FAIL(aStr.getStr()); } #endif rpObj->RestoreNoDelete(); diff --git a/tools/source/stream/stream.cxx b/tools/source/stream/stream.cxx index bf0c2f49b24c..2917776e6212 100644 --- a/tools/source/stream/stream.cxx +++ b/tools/source/stream/stream.cxx @@ -43,6 +43,7 @@ #include <tools/solar.h> + #define SWAPNIBBLES(c) \ unsigned char nSwapTmp=c; \ nSwapTmp <<= 4; \ @@ -372,13 +373,6 @@ sal_Size SvStream::GetData( void* pData, sal_Size nSize ) else return 0; } -ErrCode SvStream::SetLockBytes( SvLockBytesRef& rLB ) -{ - xLockBytes = rLB; - RefreshBuffer(); - return ERRCODE_NONE; -} - //======================================================================== sal_Size SvStream::PutData( const void* pData, sal_Size nSize ) @@ -719,6 +713,15 @@ sal_Bool SvStream::ReadLine( ByteString& rStr ) return bEnd; } +sal_Bool SvStream::ReadLine( rtl::OString& rStr ) +{ + ByteString aFoo; + sal_Bool ret; + ret = ReadLine(aFoo); + rStr = aFoo; + return ret; +} + sal_Bool SvStream::ReadUniStringLine( String& rStr ) { sal_Unicode buf[256+1]; @@ -939,14 +942,6 @@ sal_Bool SvStream::WriteLines( const ByteString& rStr ) return (sal_Bool)(nError == SVSTREAM_OK); } -sal_Bool SvStream::WriteUniStringLines( const String& rStr ) -{ - String aStr( rStr ); - aStr.ConvertLineEnd( eLineDelimiter ); - WriteUniStringLine( aStr ); - return nError == SVSTREAM_OK; -} - /************************************************************************* |* |* Stream::WriteUniOrByteChar() @@ -1802,6 +1797,18 @@ sal_Size SvStream::Seek( sal_Size nFilePos ) return nBufFilePos + nBufActualPos; } +//probably not as inefficient as it looks seeing as STREAM_SEEK_TO_END in the +//Seek backends is nomally special cased feel free to make this virtual and add +//good implementations for SvFileStream etc +sal_Size SvStream::remainingSize() +{ + sal_Size nCurr = Tell(); + sal_Size nEnd = Seek(STREAM_SEEK_TO_END); + sal_Size nMaxAvailable = nEnd-nCurr; + Seek(nCurr); + return nMaxAvailable; +} + /************************************************************************* |* |* Stream::Flush() @@ -1824,91 +1831,6 @@ void SvStream::Flush() FlushData(); } - -/************************************************************************* -|* -|* Stream::PutBack() -|* -*************************************************************************/ - -/* - 4 Faelle : - - 1. Datenzeiger steht mitten im Puffer (nBufActualPos >= 1) - 2. Datenzeiger auf Position 0, Puffer ist voll - 3. Datenzeiger auf Position 0, Puffer ist teilweise gefuellt - 4. Datenzeiger auf Position 0, Puffer ist leer -> Fehler! -*/ - -SvStream& SvStream::PutBack( char aCh ) -{ - // wenn kein Buffer oder Zurueckscrollen nicht moeglich -> Fehler - if( !pRWBuf || !nBufActualLen || ( !nBufActualPos && !nBufFilePos ) ) - { - // 4. Fall - SetError( SVSTREAM_GENERALERROR ); - return *this; - } - - // Flush() (Phys. Flushen aber nicht notwendig, deshalb selbst schreiben) - if( bIsConsistent && bIsDirty ) - { - SeekPos( nBufFilePos ); - if( nCryptMask ) - CryptAndWriteBuffer( pRWBuf, nBufActualLen ); - else - PutData( pRWBuf, nBufActualLen ); - bIsDirty = sal_False; - } - bIsConsistent = sal_False; // Puffer enthaelt jetzt TRASH - if( nBufActualPos ) - { - // 1. Fall - nBufActualPos--; - pBufPos--; - *pBufPos = aCh; - nBufFree++; - } - else // Puffer muss verschoben werden - { - // Ist Puffer am Anschlag ? - if( nBufSize == nBufActualLen ) - { - // 2. Fall - memmove( pRWBuf+1, pRWBuf, nBufSize-1 ); - // nBufFree behaelt den Wert! - } - else - { - // 3. Fall -> Puffer vergroessern - memmove( pRWBuf+1, pRWBuf, (sal_uInt16)nBufActualLen ); - nBufActualLen++; - nBufFree++; - } - nBufFilePos--; - *pRWBuf = aCh; - } - eIOMode = STREAM_IO_DONTKNOW; - bIsEof = sal_False; - return *this; -} - -/************************************************************************* -|* -|* Stream::EatWhite() -|* -*************************************************************************/ - -void SvStream::EatWhite() -{ - char aCh; - Read(&aCh, sizeof(char) ); - while( !bIsEof && isspace((int)aCh) ) //( aCh == ' ' || aCh == '\t' ) ) - Read(&aCh, sizeof(char) ); - if( !bIsEof ) // konnte das letzte Char gelesen werden ? - SeekRel( -1L ); -} - /************************************************************************* |* |* Stream::RefreshBuffer() diff --git a/tools/source/stream/strmunx.cxx b/tools/source/stream/strmunx.cxx index 1e8b75c5fe37..9c84eeae54f8 100644 --- a/tools/source/stream/strmunx.cxx +++ b/tools/source/stream/strmunx.cxx @@ -48,6 +48,7 @@ // class FileBase #include <osl/file.hxx> #include <rtl/instance.hxx> +#include <rtl/strbuf.hxx> using namespace osl; @@ -226,7 +227,8 @@ static sal_uInt32 GetSvError( int nErrno ) { EBADF, SVSTREAM_INVALID_HANDLE }, #if defined(RS6000) || defined(ALPHA) || defined(NETBSD) || \ defined(FREEBSD) || defined(MACOSX) || defined(OPENBSD) || \ - defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY) + defined(__FreeBSD_kernel__) || defined (AIX) || defined(DRAGONFLY) || \ + defined(IOS) { EDEADLK, SVSTREAM_LOCKING_VIOLATION }, #else { EDEADLOCK, SVSTREAM_LOCKING_VIOLATION }, @@ -354,11 +356,13 @@ sal_uInt16 SvFileStream::IsA() const sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) { #ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStream::GetData(): " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes from "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("SvFileStream::GetData(): ")); + aTraceStr.append(static_cast<sal_Int64>(nSize)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes from ")); + aTraceStr.append(rtl::OUStringToOString(aFilename, + osl_getThreadTextEncoding())); + OSL_TRACE("%s", aTraceStr.getStr()); #endif int nRead = 0; @@ -380,11 +384,13 @@ sal_Size SvFileStream::GetData( void* pData, sal_Size nSize ) sal_Size SvFileStream::PutData( const void* pData, sal_Size nSize ) { #ifdef DBG_UTIL - ByteString aTraceStr( "SvFileStrean::PutData: " ); - aTraceStr += ByteString::CreateFromInt64(nSize); - aTraceStr += " Bytes to "; - aTraceStr += ByteString(aFilename, osl_getThreadTextEncoding()); - OSL_TRACE( "%s", aTraceStr.GetBuffer() ); + rtl::OStringBuffer aTraceStr( + RTL_CONSTASCII_STRINGPARAM("SvFileStream::PutData(): ")); + aTraceStr.append(static_cast<sal_Int64>(nSize)); + aTraceStr.append(RTL_CONSTASCII_STRINGPARAM(" Bytes to ")); + aTraceStr.append(rtl::OUStringToOString(aFilename, + osl_getThreadTextEncoding())); + OSL_TRACE("%s", aTraceStr.getStr()); #endif int nWrite = 0; diff --git a/tools/source/string/strcvt.cxx b/tools/source/string/strcvt.cxx index 54169c3c0716..c7519bdc6df5 100644 --- a/tools/source/string/strcvt.cxx +++ b/tools/source/string/strcvt.cxx @@ -169,61 +169,6 @@ struct Impl1ByteConvertTabData Impl1ByteConvertTabData* mpNext; }; -// ======================================================================= - -sal_Unicode* ImplGet1ByteUnicodeTab( rtl_TextEncoding eTextEncoding ) -{ -#ifndef BOOTSTRAP - TOOLSINDATA* pToolsData = ImplGetToolsInData(); -#else - TOOLSINDATA* pToolsData = 0x0; -#endif - Impl1ByteUnicodeTabData* pTab = pToolsData->mpFirstUniTabData; - - while ( pTab ) - { - if ( pTab->meTextEncoding == eTextEncoding ) - return pTab->maUniTab; - pTab = pTab->mpNext; - } - - // get TextEncodingInfo - rtl_TextEncodingInfo aTextEncInfo; - aTextEncInfo.StructSize = sizeof( aTextEncInfo ); - rtl_getTextEncodingInfo( eTextEncoding, &aTextEncInfo ); - - if ( aTextEncInfo.MaximumCharSize == 1 ) - { - pTab = new Impl1ByteUnicodeTabData; - pTab->meTextEncoding = eTextEncoding; - pTab->mpNext = pToolsData->mpFirstUniTabData; - - rtl_TextToUnicodeConverter hConverter; - sal_uInt32 nInfo; - sal_Size nSrcBytes; - sal_Size nDestChars; - hConverter = rtl_createTextToUnicodeConverter( eTextEncoding ); - nDestChars = rtl_convertTextToUnicode( hConverter, 0, - (const sal_Char*)aImplByteTab, 256, - pTab->maUniTab, 256, - RTL_TEXTTOUNICODE_FLAGS_UNDEFINED_MAPTOPRIVATE | - RTL_TEXTTOUNICODE_FLAGS_MBUNDEFINED_DEFAULT | - RTL_TEXTTOUNICODE_FLAGS_INVALID_DEFAULT, - &nInfo, &nSrcBytes ); - rtl_destroyTextToUnicodeConverter( hConverter ); - - if ( (nSrcBytes != 256) || (nDestChars != 256) ) - delete pTab; - else - { - pToolsData->mpFirstUniTabData = pTab; - return pTab->maUniTab; - } - } - - return NULL; -} - // ----------------------------------------------------------------------- static sal_uChar* ImplGet1ByteConvertTab( rtl_TextEncoding eSrcTextEncoding, diff --git a/tools/source/string/strimp.cxx b/tools/source/string/strimp.cxx index 21065f999958..2f79410a9c19 100644 --- a/tools/source/string/strimp.cxx +++ b/tools/source/string/strimp.cxx @@ -691,52 +691,6 @@ STRING& STRING::Insert( const STRING& rStr, xub_StrLen nIndex ) // ----------------------------------------------------------------------- -STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen, - xub_StrLen nIndex ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); - - // Stringlaenge ermitteln - if ( nPos > rStr.mpData->mnLen ) - nLen = 0; - else - { - // Laenge korrigieren, wenn noetig - sal_Int32 nMaxLen = rStr.mpData->mnLen-nPos; - if ( nLen > nMaxLen ) - nLen = static_cast< xub_StrLen >(nMaxLen); - } - - // Ueberlauf abfangen - sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen ); - - // Ist der einzufuegende String ein Leerstring - if ( !nCopyLen ) - return *this; - - // Index groesser als Laenge - if ( nIndex > mpData->mnLen ) - nIndex = static_cast< xub_StrLen >(mpData->mnLen); - - // Neue Laenge ermitteln und neuen String anlegen - STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen ); - - // String kopieren - memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) ); - memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr+nPos, nCopyLen*sizeof( STRCODE ) ); - memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex, - (mpData->mnLen-nIndex)*sizeof( STRCODE ) ); - - // Alte Daten loeschen und Neue zuweisen - STRING_RELEASE((STRING_TYPE *)mpData); - mpData = pNewData; - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::Insert( const STRCODE* pCharStr, xub_StrLen nIndex ) { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1061,30 +1015,6 @@ STRING& STRING::EraseAllChars( STRCODE c ) // ----------------------------------------------------------------------- -STRING& STRING::Reverse() -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( !mpData->mnLen ) - return *this; - - // Daten kopieren, wenn noetig - ImplCopyData(); - - // Reverse - sal_Int32 nCount = mpData->mnLen / 2; - for ( sal_Int32 i = 0; i < nCount; ++i ) - { - STRCODE cTemp = mpData->maStr[i]; - mpData->maStr[i] = mpData->maStr[mpData->mnLen-i-1]; - mpData->maStr[mpData->mnLen-i-1] = cTemp; - } - - return *this; -} - -// ----------------------------------------------------------------------- - STRING& STRING::ToLowerAscii() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1279,36 +1209,6 @@ StringCompare STRING::CompareTo( const STRCODE* pCharStr, xub_StrLen nLen ) cons // ----------------------------------------------------------------------- -StringCompare STRING::CompareIgnoreCaseToAscii( 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 = ImplStringICompareWithoutZero( 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; -} - -// ----------------------------------------------------------------------- - StringCompare STRING::CompareIgnoreCaseToAscii( const STRCODE* pCharStr, xub_StrLen nLen ) const { @@ -1419,41 +1319,6 @@ sal_Bool STRING::Equals( const STRCODE* pCharStr, xub_StrLen nIndex, xub_StrLen // ----------------------------------------------------------------------- -sal_Bool STRING::EqualsIgnoreCaseAscii( 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 (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0); -} - -// ----------------------------------------------------------------------- - -sal_Bool STRING::EqualsIgnoreCaseAscii( 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 (ImplStringICompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0); -} - -// ----------------------------------------------------------------------- - xub_StrLen STRING::Match( const STRING& rStr ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1482,32 +1347,6 @@ xub_StrLen STRING::Match( const STRING& rStr ) const // ----------------------------------------------------------------------- -xub_StrLen STRING::Match( const STRCODE* pCharStr ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - // Ist dieser String leer - if ( !mpData->mnLen ) - return STRING_MATCH; - - // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen - const STRCODE* pStr = mpData->maStr; - xub_StrLen i = 0; - while ( i < mpData->mnLen ) - { - // Stimmt das Zeichen nicht ueberein, dann abbrechen - if ( *pStr != *pCharStr ) - return i; - ++pStr, - ++pCharStr, - ++i; - } - - return STRING_MATCH; -} - -// ----------------------------------------------------------------------- - xub_StrLen STRING::Search( STRCODE c, xub_StrLen nIndex ) const { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); @@ -1642,86 +1481,6 @@ xub_StrLen STRING::SearchBackward( STRCODE c, xub_StrLen nIndex ) const // ----------------------------------------------------------------------- -xub_StrLen STRING::SearchChar( const STRCODE* pChars, xub_StrLen nIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - sal_Int32 nLen = mpData->mnLen; - const STRCODE* pStr = mpData->maStr; - pStr += nIndex; - while ( nIndex < nLen ) - { - STRCODE c = *pStr; - const STRCODE* pCompStr = pChars; - while ( *pCompStr ) - { - if ( *pCompStr == c ) - return nIndex; - ++pCompStr; - } - ++pStr, - ++nIndex; - } - - return STRING_NOTFOUND; -} - -// ----------------------------------------------------------------------- - -xub_StrLen STRING::SearchCharBackward( const STRCODE* pChars, xub_StrLen nIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - if ( nIndex > mpData->mnLen ) - nIndex = (xub_StrLen)mpData->mnLen; - - const STRCODE* pStr = mpData->maStr; - pStr += nIndex; - - while ( nIndex ) - { - nIndex--; - pStr--; - - STRCODE c =*pStr; - const STRCODE* pCompStr = pChars; - while ( *pCompStr ) - { - if ( *pCompStr == c ) - return nIndex; - ++pCompStr; - } - } - - return STRING_NOTFOUND; -} - -// ----------------------------------------------------------------------- - -xub_StrLen STRING::SearchAndReplace( STRCODE c, STRCODE cRep, xub_StrLen nIndex ) -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - - sal_Int32 nLen = mpData->mnLen; - const STRCODE* pStr = mpData->maStr; - pStr += nIndex; - while ( nIndex < nLen ) - { - if ( *pStr == c ) - { - ImplCopyData(); - mpData->maStr[nIndex] = cRep; - return nIndex; - } - ++pStr, - ++nIndex; - } - - return STRING_NOTFOUND; -} - -// ----------------------------------------------------------------------- - xub_StrLen STRING::SearchAndReplace( const STRING& rStr, const STRING& rRepStr, xub_StrLen nIndex ) { @@ -1923,141 +1682,6 @@ STRING STRING::GetToken( xub_StrLen nToken, STRCODE cTok, xub_StrLen& rIndex ) c // ----------------------------------------------------------------------- -xub_StrLen STRING::GetQuotedTokenCount( const STRING& rQuotedPairs, STRCODE cTok ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); - DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedTokenCount() - QuotedString%2 != 0" ); - DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedTokenCount() - cTok in QuotedString" ); - - // Leerer String: TokenCount per Definition 0 - if ( !mpData->mnLen ) - return 0; - - xub_StrLen nTokCount = 1; - sal_Int32 nLen = mpData->mnLen; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - STRCODE cQuotedEndChar = 0; - const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; - const STRCODE* pStr = mpData->maStr; - sal_Int32 nIndex = 0; - while ( nIndex < nLen ) - { - STRCODE c = *pStr; - if ( cQuotedEndChar ) - { - // Ende des Quotes erreicht ? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Ist das Zeichen ein Quote-Anfang-Zeichen ? - xub_StrLen nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( c == cTok ) - ++nTokCount; - } - - ++pStr, - ++nIndex; - } - - return nTokCount; -} - -// ----------------------------------------------------------------------- - -STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs, - STRCODE cTok, xub_StrLen& rIndex ) const -{ - DBG_CHKTHIS( STRING, DBGCHECKSTRING ); - DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); - DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedToken() - QuotedString%2 != 0" ); - DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedToken() - cTok in QuotedString" ); - - const STRCODE* pStr = mpData->maStr; - const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; - STRCODE cQuotedEndChar = 0; - xub_StrLen nQuotedLen = rQuotedPairs.Len(); - 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 ) - { - STRCODE c = *pStr; - if ( cQuotedEndChar ) - { - // Ende des Quotes erreicht ? - if ( c == cQuotedEndChar ) - cQuotedEndChar = 0; - } - else - { - // Ist das Zeichen ein Quote-Anfang-Zeichen ? - xub_StrLen nQuoteIndex = 0; - while ( nQuoteIndex < nQuotedLen ) - { - if ( pQuotedStr[nQuoteIndex] == c ) - { - cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; - break; - } - else - nQuoteIndex += 2; - } - - // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount - if ( c == 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(); - } -} - -// ----------------------------------------------------------------------- - STRCODE* STRING::GetBufferAccess() { DBG_CHKTHIS( STRING, DBGCHECKSTRING ); diff --git a/tools/source/string/tstring.cxx b/tools/source/string/tstring.cxx index c7a5f380fb72..b89a51ba7cdc 100644 --- a/tools/source/string/tstring.cxx +++ b/tools/source/string/tstring.cxx @@ -38,7 +38,6 @@ #include <rtl/alloc.h> #include <rtl/memory.h> #include <rtl/tencinfo.h> -#include <rtl/instance.hxx> #include <tools/string.hxx> #include <impstrg.hxx> @@ -104,45 +103,6 @@ ByteString ByteString::CreateFromInt32( sal_Int32 n, sal_Int16 nRadix ) // ----------------------------------------------------------------------- -ByteString ByteString::CreateFromInt64( sal_Int64 n, sal_Int16 nRadix ) -{ - sal_Char aBuf[RTL_STR_MAX_VALUEOFINT64]; - BOOST_STATIC_ASSERT(RTL_STR_MAX_VALUEOFINT64 <= STRING_MAXLEN); - return ByteString( - aBuf, - static_cast< xub_StrLen >(rtl_str_valueOfInt64( aBuf, n, nRadix )) ); -} - -// ----------------------------------------------------------------------- - -ByteString ByteString::CreateFromFloat( float f ) -{ - sal_Char aBuf[RTL_STR_MAX_VALUEOFFLOAT]; - BOOST_STATIC_ASSERT(RTL_STR_MAX_VALUEOFFLOAT <= STRING_MAXLEN); - return ByteString( - aBuf, static_cast< xub_StrLen >(rtl_str_valueOfFloat( aBuf, f )) ); -} - -// ----------------------------------------------------------------------- - -ByteString ByteString::CreateFromDouble( double d ) -{ - sal_Char aBuf[RTL_STR_MAX_VALUEOFDOUBLE]; - BOOST_STATIC_ASSERT(RTL_STR_MAX_VALUEOFDOUBLE <= STRING_MAXLEN); - return ByteString( - aBuf, static_cast< xub_StrLen >(rtl_str_valueOfDouble( aBuf, d )) ); -} - -// ----------------------------------------------------------------------- - -namespace { struct Empty : public rtl::Static< const ByteString, Empty> {}; } -const ByteString& ByteString::EmptyString() -{ - return Empty::get(); -} - -// ----------------------------------------------------------------------- - sal_Int32 ByteString::ToInt32() const { DBG_CHKTHIS( ByteString, DbgCheckByteString ); @@ -161,26 +121,6 @@ sal_Int64 ByteString::ToInt64() const // ----------------------------------------------------------------------- -float ByteString::ToFloat() const -{ - DBG_CHKTHIS( ByteString, DbgCheckByteString ); - - OSL_FAIL("ByteString::ToFloat unusable"); - return 0; -} - -// ----------------------------------------------------------------------- - -double ByteString::ToDouble() const -{ - DBG_CHKTHIS( ByteString, DbgCheckByteString ); - - OSL_FAIL("ByteString::ToDouble unusable"); - return 0; -} - -// ----------------------------------------------------------------------- - sal_Bool ByteString::IsLowerAscii() const { DBG_CHKTHIS( ByteString, DbgCheckByteString ); diff --git a/tools/source/string/tustring.cxx b/tools/source/string/tustring.cxx index 5edd160b5d69..9ef026f6cce8 100644 --- a/tools/source/string/tustring.cxx +++ b/tools/source/string/tustring.cxx @@ -155,4 +155,350 @@ double UniString::ToDouble() const return rtl_ustr_toDouble( mpData->maStr ); } +// ----------------------------------------------------------------------- + +xub_StrLen STRING::SearchChar( const STRCODE* pChars, xub_StrLen nIndex ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + sal_Int32 nLen = mpData->mnLen; + const STRCODE* pStr = mpData->maStr; + pStr += nIndex; + while ( nIndex < nLen ) + { + STRCODE c = *pStr; + const STRCODE* pCompStr = pChars; + while ( *pCompStr ) + { + if ( *pCompStr == c ) + return nIndex; + ++pCompStr; + } + ++pStr, + ++nIndex; + } + + return STRING_NOTFOUND; +} + +// ----------------------------------------------------------------------- + +xub_StrLen STRING::SearchAndReplace( STRCODE c, STRCODE cRep, xub_StrLen nIndex ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + sal_Int32 nLen = mpData->mnLen; + const STRCODE* pStr = mpData->maStr; + pStr += nIndex; + while ( nIndex < nLen ) + { + if ( *pStr == c ) + { + ImplCopyData(); + mpData->maStr[nIndex] = cRep; + return nIndex; + } + ++pStr, + ++nIndex; + } + + return STRING_NOTFOUND; +} + +// ----------------------------------------------------------------------- + +STRING& STRING::Reverse() +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + if ( !mpData->mnLen ) + return *this; + + // Daten kopieren, wenn noetig + ImplCopyData(); + + // Reverse + sal_Int32 nCount = mpData->mnLen / 2; + for ( sal_Int32 i = 0; i < nCount; ++i ) + { + STRCODE cTemp = mpData->maStr[i]; + mpData->maStr[i] = mpData->maStr[mpData->mnLen-i-1]; + mpData->maStr[mpData->mnLen-i-1] = cTemp; + } + + return *this; +} + +// ----------------------------------------------------------------------- + +xub_StrLen STRING::Match( const STRCODE* pCharStr ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + + // Ist dieser String leer + if ( !mpData->mnLen ) + return STRING_MATCH; + + // Suche bis Stringende nach dem ersten nicht uebereinstimmenden Zeichen + const STRCODE* pStr = mpData->maStr; + xub_StrLen i = 0; + while ( i < mpData->mnLen ) + { + // Stimmt das Zeichen nicht ueberein, dann abbrechen + if ( *pStr != *pCharStr ) + return i; + ++pStr, + ++pCharStr, + ++i; + } + + return STRING_MATCH; +} + +// ----------------------------------------------------------------------- + +STRING& STRING::Insert( const STRING& rStr, xub_StrLen nPos, xub_StrLen nLen, + xub_StrLen nIndex ) +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rStr, STRING, DBGCHECKSTRING ); + + // Stringlaenge ermitteln + if ( nPos > rStr.mpData->mnLen ) + nLen = 0; + else + { + // Laenge korrigieren, wenn noetig + sal_Int32 nMaxLen = rStr.mpData->mnLen-nPos; + if ( nLen > nMaxLen ) + nLen = static_cast< xub_StrLen >(nMaxLen); + } + + // Ueberlauf abfangen + sal_Int32 nCopyLen = ImplGetCopyLen( mpData->mnLen, nLen ); + + // Ist der einzufuegende String ein Leerstring + if ( !nCopyLen ) + return *this; + + // Index groesser als Laenge + if ( nIndex > mpData->mnLen ) + nIndex = static_cast< xub_StrLen >(mpData->mnLen); + + // Neue Laenge ermitteln und neuen String anlegen + STRINGDATA* pNewData = ImplAllocData( mpData->mnLen+nCopyLen ); + + // String kopieren + memcpy( pNewData->maStr, mpData->maStr, nIndex*sizeof( STRCODE ) ); + memcpy( pNewData->maStr+nIndex, rStr.mpData->maStr+nPos, nCopyLen*sizeof( STRCODE ) ); + memcpy( pNewData->maStr+nIndex+nCopyLen, mpData->maStr+nIndex, + (mpData->mnLen-nIndex)*sizeof( STRCODE ) ); + + // Alte Daten loeschen und Neue zuweisen + STRING_RELEASE((STRING_TYPE *)mpData); + mpData = pNewData; + + return *this; +} + +// ----------------------------------------------------------------------- + +xub_StrLen STRING::GetQuotedTokenCount( const STRING& rQuotedPairs, STRCODE cTok ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); + DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedTokenCount() - QuotedString%2 != 0" ); + DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedTokenCount() - cTok in QuotedString" ); + + // Leerer String: TokenCount per Definition 0 + if ( !mpData->mnLen ) + return 0; + + xub_StrLen nTokCount = 1; + sal_Int32 nLen = mpData->mnLen; + xub_StrLen nQuotedLen = rQuotedPairs.Len(); + STRCODE cQuotedEndChar = 0; + const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; + const STRCODE* pStr = mpData->maStr; + sal_Int32 nIndex = 0; + while ( nIndex < nLen ) + { + STRCODE c = *pStr; + if ( cQuotedEndChar ) + { + // Ende des Quotes erreicht ? + if ( c == cQuotedEndChar ) + cQuotedEndChar = 0; + } + else + { + // Ist das Zeichen ein Quote-Anfang-Zeichen ? + xub_StrLen nQuoteIndex = 0; + while ( nQuoteIndex < nQuotedLen ) + { + if ( pQuotedStr[nQuoteIndex] == c ) + { + cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; + break; + } + else + nQuoteIndex += 2; + } + + // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + if ( c == cTok ) + ++nTokCount; + } + + ++pStr, + ++nIndex; + } + + return nTokCount; +} + +// ----------------------------------------------------------------------- + +STRING STRING::GetQuotedToken( xub_StrLen nToken, const STRING& rQuotedPairs, + STRCODE cTok, xub_StrLen& rIndex ) const +{ + DBG_CHKTHIS( STRING, DBGCHECKSTRING ); + DBG_CHKOBJ( &rQuotedPairs, STRING, DBGCHECKSTRING ); + DBG_ASSERT( !(rQuotedPairs.Len()%2), "String::GetQuotedToken() - QuotedString%2 != 0" ); + DBG_ASSERT( rQuotedPairs.Search(cTok) == STRING_NOTFOUND, "String::GetQuotedToken() - cTok in QuotedString" ); + + const STRCODE* pStr = mpData->maStr; + const STRCODE* pQuotedStr = rQuotedPairs.mpData->maStr; + STRCODE cQuotedEndChar = 0; + xub_StrLen nQuotedLen = rQuotedPairs.Len(); + 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 ) + { + STRCODE c = *pStr; + if ( cQuotedEndChar ) + { + // Ende des Quotes erreicht ? + if ( c == cQuotedEndChar ) + cQuotedEndChar = 0; + } + else + { + // Ist das Zeichen ein Quote-Anfang-Zeichen ? + xub_StrLen nQuoteIndex = 0; + while ( nQuoteIndex < nQuotedLen ) + { + if ( pQuotedStr[nQuoteIndex] == c ) + { + cQuotedEndChar = pQuotedStr[nQuoteIndex+1]; + break; + } + else + nQuoteIndex += 2; + } + + // Stimmt das Tokenzeichen ueberein, dann erhoehe TokCount + if ( c == 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(); + } +} + +// ----------------------------------------------------------------------- + +sal_Bool STRING::EqualsIgnoreCaseAscii( 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 (ImplStringICompareWithoutZero( mpData->maStr+nIndex, rStr.mpData->maStr, nLen ) == 0); +} + +// ----------------------------------------------------------------------- + +sal_Bool STRING::EqualsIgnoreCaseAscii( 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 (ImplStringICompare( mpData->maStr+nIndex, pCharStr, nLen ) == 0); +} + +// ----------------------------------------------------------------------- + +StringCompare STRING::CompareIgnoreCaseToAscii( 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 = ImplStringICompareWithoutZero( 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; +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |