diff options
author | Caolán McNamara <caolanm@redhat.com> | 2012-08-22 09:23:19 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2012-08-22 09:50:25 +0100 |
commit | 727a95dafa16e5f5a5c5e61f0c740645c79ca7c5 (patch) | |
tree | bacd212feb6102718c932402607b3b66cebc1eb6 | |
parent | remove two unused methods (diff) | |
download | binfilter-727a95dafa16e5f5a5c5e61f0c740645c79ca7c5.tar.gz binfilter-727a95dafa16e5f5a5c5e61f0c740645c79ca7c5.zip |
expand macros
Change-Id: I696dcd6b3096025639474b0b10d0973453af809f
-rw-r--r-- | binfilter/bf_starmath/source/cfgitem.hxx | 33 | ||||
-rw-r--r-- | binfilter/bf_starmath/source/starmath_cfgitem.cxx | 112 | ||||
-rw-r--r-- | binfilter/bf_svx/source/inc/fmshimp.hxx | 1 | ||||
-rw-r--r-- | binfilter/inc/bf_svtools/svarray.hxx | 415 |
4 files changed, 273 insertions, 288 deletions
diff --git a/binfilter/bf_starmath/source/cfgitem.hxx b/binfilter/bf_starmath/source/cfgitem.hxx index 020847afa..bbab9934e 100644 --- a/binfilter/bf_starmath/source/cfgitem.hxx +++ b/binfilter/bf_starmath/source/cfgitem.hxx @@ -135,9 +135,40 @@ struct SmFntFmtListEntry SmFntFmtListEntry( const String &rId, const SmFontFormat &rFntFmt ); }; +typedef BOOL (*FnForEach_SmFntFmtListEntryArr)( const SmFntFmtListEntry&, void* ); +class SmFntFmtListEntryArr +{ +protected: + SmFntFmtListEntry *pData; + USHORT nFree; + USHORT nA; -SV_DECL_OBJARR( SmFntFmtListEntryArr, SmFntFmtListEntry, 8, 8 ) + void _resize(size_t n); + void _destroy(); +public: + SmFntFmtListEntryArr( USHORT= 8, BYTE= 8 ); + ~SmFntFmtListEntryArr() { _destroy(); } + + SmFntFmtListEntry& operator[](USHORT nP) const { return *(pData+nP); } + + void Insert( const SmFntFmtListEntryArr *pI, USHORT nP, + USHORT nS = 0, USHORT nE = USHRT_MAX ); + SmFntFmtListEntry& GetObject(USHORT nP) const { return (*this)[nP]; } + void Insert( const SmFntFmtListEntry &aE, USHORT nP ); + void Insert( const SmFntFmtListEntry *pE, USHORT nL, USHORT nP ); + void Remove( USHORT nP, USHORT nL = 1 ); + USHORT Count() const { return nA; } + const SmFntFmtListEntry* GetData() const { return (const SmFntFmtListEntry*)pData; } + void ForEach( FnForEach_SmFntFmtListEntryArr fnForEach, void* pArgs = 0 ); + void ForEach( USHORT nS, USHORT nE, + FnForEach_SmFntFmtListEntryArr fnForEach, void* pArgs = 0 ); + void _ForEach( USHORT nStt, USHORT nE, + FnForEach_SmFntFmtListEntryArr fnCall, void* pArgs = 0 ); +private: + SmFntFmtListEntryArr( const SmFntFmtListEntryArr& ); + SmFntFmtListEntryArr& operator=( const SmFntFmtListEntryArr& ); +}; class SmFontFormatList { diff --git a/binfilter/bf_starmath/source/starmath_cfgitem.cxx b/binfilter/bf_starmath/source/starmath_cfgitem.cxx index ffe8e3d94..3b6a72b98 100644 --- a/binfilter/bf_starmath/source/starmath_cfgitem.cxx +++ b/binfilter/bf_starmath/source/starmath_cfgitem.cxx @@ -43,7 +43,117 @@ static const char* aRootName = "Office.Math"; #define SYMBOL_LIST "SymbolList" #define FONT_FORMAT_LIST "FontFormatList" -/*N*/ SV_IMPL_OBJARR( SmFntFmtListEntryArr, SmFntFmtListEntry ); +SmFntFmtListEntryArr::SmFntFmtListEntryArr( USHORT nInit, BYTE ) + : pData (0), + nFree (nInit), + nA (0) +{ + if( nInit ) + { + pData = (SmFntFmtListEntry*)(rtl_allocateMemory(sizeof(SmFntFmtListEntry) * nInit)); + DBG_ASSERT( pData, "CTOR, allocate"); + } +} + +void SmFntFmtListEntryArr::_destroy() +{ + if(pData) + { + SmFntFmtListEntry* pTmp=pData; + for(USHORT n=0; n < nA; n++,pTmp++ ) + { + pTmp->~SmFntFmtListEntry(); + } + rtl_freeMemory(pData); + pData = 0; + } +} + +void SmFntFmtListEntryArr::_resize (size_t n) +{ + USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX); + SmFntFmtListEntry* pE = (SmFntFmtListEntry*)(rtl_reallocateMemory (pData, sizeof(SmFntFmtListEntry) * nL)); + if ((pE != 0) || (nL == 0)) + { + pData = pE; + nFree = nL - nA; + } +} + +void SmFntFmtListEntryArr::Insert( const SmFntFmtListEntryArr *pI, USHORT nP, + USHORT nS, USHORT nE ) +{ + if( USHRT_MAX == nE ) + nE = pI->nA; + if( nS < nE ) + Insert( (const SmFntFmtListEntry*)pI->pData+nS, (USHORT)nE-nS, nP ); +} + +void SmFntFmtListEntryArr::Insert( const SmFntFmtListEntry &aE, USHORT nP ) +{ + if (nFree < 1) + _resize (nA + ((nA > 1) ? nA : 1)); + if( pData && nP < nA ) + memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( SmFntFmtListEntry )); + SmFntFmtListEntry* pTmp = pData+nP; + new( (DummyType*) pTmp ) SmFntFmtListEntry( (SmFntFmtListEntry&)aE ); + ++nA; --nFree; +} + +void SmFntFmtListEntryArr::Insert( const SmFntFmtListEntry *pE, USHORT nL, USHORT nP ) +{ + if (nFree < nL) + _resize (nA + ((nA > nL) ? nA : nL)); + if( pData && nP < nA ) + memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( SmFntFmtListEntry )); + if( pE ) + { + SmFntFmtListEntry* pTmp = pData+nP; + for( USHORT n = 0; n < nL; n++, pTmp++, pE++) + { + new( (DummyType*) pTmp ) SmFntFmtListEntry( (SmFntFmtListEntry&)*pE ); + } + } + nA = nA + nL; nFree = nFree - nL; +} + +void SmFntFmtListEntryArr::Remove( USHORT nP, USHORT nL ) +{ + if( !nL ) + return; + SmFntFmtListEntry* pTmp=pData+nP; + USHORT nCtr = nP; + for(USHORT n=0; n < nL; n++,pTmp++,nCtr++) + { + if( nCtr < nA ) + pTmp->~SmFntFmtListEntry(); + } + if( pData && nP+1 < nA ) + memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( SmFntFmtListEntry )); + nA = nA - nL; nFree = nFree + nL; + if (nFree > nA) + _resize (nA); +} + +void SmFntFmtListEntryArr::ForEach( FnForEach_SmFntFmtListEntryArr fnForEach, void* pArgs ) +{ + _ForEach( 0, nA, fnForEach, pArgs ); +} + +void SmFntFmtListEntryArr::ForEach( USHORT nS, USHORT nE, + FnForEach_SmFntFmtListEntryArr fnForEach, void* pArgs ) +{ + _ForEach( nS, nE, fnForEach, pArgs ); +} + +void SmFntFmtListEntryArr::_ForEach( USHORT nStt, USHORT nE, + FnForEach_SmFntFmtListEntryArr fnCall, void* pArgs ) +{ + if( nStt >= nE || nE > nA ) + return; + for( ; nStt < nE && (*fnCall)( *(pData+nStt), pArgs ); nStt++) + ; +} ///////////////////////////////////////////////////////////////// diff --git a/binfilter/bf_svx/source/inc/fmshimp.hxx b/binfilter/bf_svx/source/inc/fmshimp.hxx index 30bea0537..4c813fb88 100644 --- a/binfilter/bf_svx/source/inc/fmshimp.hxx +++ b/binfilter/bf_svx/source/inc/fmshimp.hxx @@ -48,7 +48,6 @@ namespace binfilter { SV_DECL_PTRARR(SdrObjArray, SdrObject*, 32, 16) -// SV_DECL_OBJARR(FmFormArray, ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm>, 32, 16); DECLARE_STL_VECTOR( ::com::sun::star::uno::Reference< ::com::sun::star::form::XForm > ,FmFormArray); // catch databse exceptions if occur diff --git a/binfilter/inc/bf_svtools/svarray.hxx b/binfilter/inc/bf_svtools/svarray.hxx index a1a0167a4..8222ab91b 100644 --- a/binfilter/inc/bf_svtools/svarray.hxx +++ b/binfilter/inc/bf_svtools/svarray.hxx @@ -166,139 +166,7 @@ SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, ) #define SV_DECL_VARARR_VISIBILITY(nm, AE, IS, GS, vis ) \ SV_DECL_VARARR_GEN(nm, AE, IS, GS, AE &, vis ) -#define SV_IMPL_VARARR_GEN( nm, AE, AERef )\ -nm::nm( USHORT nInit, BYTE )\ - : pData (0),\ - nFree (nInit),\ - nA (0)\ -{\ - if( nInit )\ - {\ - pData = (AE*)(rtl_allocateMemory(sizeof(AE) * nInit));\ - DBG_ASSERT( pData, "CTOR, allocate");\ - }\ -}\ -\ -void nm::_resize (size_t n)\ -{\ - USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ - AE* pE = (AE*)(rtl_reallocateMemory (pData, sizeof(AE) * nL));\ - if ((pE != 0) || (nL == 0))\ - {\ - pData = pE;\ - nFree = nL - nA;\ - }\ -}\ -\ - #define SV_IMPL_VARARR( nm, AE ) \ -SV_IMPL_VARARR_GEN( nm, AE, AE & ) - -#define _SV_DECL_OBJARR(nm, AE, IS, GS)\ -typedef BOOL (*FnForEach_##nm)( const AE&, void* );\ -class nm\ -{\ -protected:\ - AE *pData;\ - USHORT nFree;\ - USHORT nA;\ -\ - void _resize(size_t n);\ - void _destroy();\ -\ -public:\ - nm( USHORT= IS, BYTE= GS );\ - ~nm() { _destroy(); }\ -\ - AE& operator[](USHORT nP) const { return *(pData+nP); }\ -\ - void Insert( const nm *pI, USHORT nP,\ - USHORT nS = 0, USHORT nE = USHRT_MAX )\ - {\ - if( USHRT_MAX == nE ) \ - nE = pI->nA; \ - if( nS < nE ) \ - Insert( (const AE*)pI->pData+nS, (USHORT)nE-nS, nP );\ - } \ - AE& GetObject(USHORT nP) const { return (*this)[nP]; } \ -\ - void Insert( const AE &aE, USHORT nP )\ - {\ - if (nFree < 1)\ - _resize (nA + ((nA > 1) ? nA : 1));\ - if( pData && nP < nA )\ - memmove( pData+nP+1, pData+nP, (nA-nP) * sizeof( AE ));\ - AE* pTmp = pData+nP;\ - new( (DummyType*) pTmp ) AE( (AE&)aE );\ - ++nA; --nFree;\ - }\ -\ - void Insert( const AE *pE, USHORT nL, USHORT nP )\ - {\ - if (nFree < nL)\ - _resize (nA + ((nA > nL) ? nA : nL));\ - if( pData && nP < nA )\ - memmove( pData+nP+nL, pData+nP, (nA-nP) * sizeof( AE ));\ - if( pE )\ - {\ - AE* pTmp = pData+nP;\ - for( USHORT n = 0; n < nL; n++, pTmp++, pE++)\ - {\ - new( (DummyType*) pTmp ) AE( (AE&)*pE );\ - }\ - }\ - nA = nA + nL; nFree = nFree - nL;\ - }\ -\ - void Remove( USHORT nP, USHORT nL = 1 )\ - {\ - if( !nL )\ - return;\ - AE* pTmp=pData+nP;\ - USHORT nCtr = nP;\ - for(USHORT n=0; n < nL; n++,pTmp++,nCtr++)\ - {\ - if( nCtr < nA )\ - pTmp->~AE();\ - }\ - if( pData && nP+1 < nA )\ - memmove( pData+nP, pData+nP+nL, (nA-nP-nL) * sizeof( AE ));\ - nA = nA - nL; nFree = nFree + nL;\ - if (nFree > nA) \ - _resize (nA);\ - }\ -\ - USHORT Count() const { return nA; }\ - const AE* GetData() const { return (const AE*)pData; }\ -\ - void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( 0, nA, fnForEach, pArgs );\ - }\ - void ForEach( USHORT nS, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ - {\ - _ForEach( nS, nE, fnForEach, pArgs );\ - }\ -\ - void _ForEach( USHORT nStt, USHORT nE, \ - CONCAT( FnForEach_, nm ) fnCall, void* pArgs = 0 )\ - {\ - if( nStt >= nE || nE > nA )\ - return;\ - for( ; nStt < nE && (*fnCall)( *(pData+nStt), pArgs ); nStt++)\ - ;\ - }\ -\ - -#define SV_DECL_OBJARR(nm, AE, IS, GS)\ -_SV_DECL_OBJARR(nm, AE, IS, GS)\ -private:\ -nm( const nm& );\ -nm& operator=( const nm& );\ -}; - -#define SV_IMPL_OBJARR( nm, AE )\ nm::nm( USHORT nInit, BYTE )\ : pData (0),\ nFree (nInit),\ @@ -311,20 +179,6 @@ nm::nm( USHORT nInit, BYTE )\ }\ }\ \ -void nm::_destroy()\ -{\ - if(pData)\ - {\ - AE* pTmp=pData;\ - for(USHORT n=0; n < nA; n++,pTmp++ )\ - {\ - pTmp->~AE();\ - }\ - rtl_freeMemory(pData);\ - pData = 0;\ - }\ -}\ -\ void nm::_resize (size_t n)\ {\ USHORT nL = ((n < USHRT_MAX) ? USHORT(n) : USHRT_MAX);\ @@ -335,52 +189,53 @@ void nm::_resize (size_t n)\ nFree = nL - nA;\ }\ }\ +\ -#define SV_DECL_PTRARR_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ +#define SV_DECL_PTRARR_GEN(nm, AE, IS, GS, AERef, VPRef, vis )\ typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ -class vis nm: public Base \ +class vis nm: public SvPtrarr \ {\ public:\ nm( USHORT nIni=IS, BYTE nG=GS )\ - : Base(nIni,nG) {}\ + : SvPtrarr(nIni,nG) {}\ void Insert( const nm *pI, USHORT nP, \ USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ - Base::Insert((const Base*)pI, nP, nS, nE);\ + SvPtrarr::Insert((const SvPtrarr*)pI, nP, nS, nE);\ }\ void Insert( const AERef aE, USHORT nP ) {\ - Base::Insert( (const VPRef )aE, nP );\ + SvPtrarr::Insert( (const VPRef )aE, nP );\ }\ void Insert( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Insert( (const VoidPtr*)pE, nL, nP );\ + SvPtrarr::Insert( (const VoidPtr*)pE, nL, nP );\ }\ void Replace( const AERef aE, USHORT nP ) {\ - Base::Replace( (const VPRef)aE, nP );\ + SvPtrarr::Replace( (const VPRef)aE, nP );\ }\ void Replace( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Replace( (const VoidPtr*)pE, nL, nP );\ + SvPtrarr::Replace( (const VoidPtr*)pE, nL, nP );\ }\ void Remove( USHORT nP, USHORT nL = 1) {\ - Base::Remove(nP,nL);\ + SvPtrarr::Remove(nP,nL);\ }\ const AE* GetData() const {\ - return (const AE*)Base::GetData();\ + return (const AE*)SvPtrarr::GetData();\ }\ void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ {\ - _ForEach( 0, nA, (FnForEach_##Base)fnForEach, pArgs );\ + _ForEach( 0, nA, (FnForEach_SvPtrarr)fnForEach, pArgs );\ }\ void ForEach( USHORT nS, USHORT nE, \ CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ {\ - _ForEach( nS, nE, (FnForEach_##Base)fnForEach, pArgs );\ + _ForEach( nS, nE, (FnForEach_SvPtrarr)fnForEach, pArgs );\ }\ AE operator[]( USHORT nP )const { \ - return (AE)Base::operator[](nP); }\ + return (AE)SvPtrarr::operator[](nP); }\ AE GetObject(USHORT nP) const { \ - return (AE)Base::GetObject(nP); }\ + return (AE)SvPtrarr::GetObject(nP); }\ \ USHORT GetPos( const AERef aE ) const { \ - return Base::GetPos((const VPRef)aE);\ + return SvPtrarr::GetPos((const VPRef)aE);\ }\ void DeleteAndDestroy( USHORT nP, USHORT nL=1 );\ private:\ @@ -389,57 +244,57 @@ private:\ }; #define SV_DECL_PTRARR(nm, AE, IS, GS )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) +SV_DECL_PTRARR_GEN(nm, AE, IS, GS, AE &, VoidPtr &, ) #define SV_DECL_PTRARR_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis ) +SV_DECL_PTRARR_GEN(nm, AE, IS, GS, AE &, VoidPtr &, vis ) -#define SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, Base, AERef, VPRef, vis )\ +#define SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, AERef, VPRef, vis )\ typedef BOOL (*FnForEach_##nm)( const AERef, void* );\ -class vis nm: public Base \ +class vis nm: public SvPtrarr \ {\ public:\ nm( USHORT nIni=IS, BYTE nG=GS )\ - : Base(nIni,nG) {}\ + : SvPtrarr(nIni,nG) {}\ ~nm() { DeleteAndDestroy( 0, Count() ); }\ void Insert( const nm *pI, USHORT nP, \ USHORT nS = 0, USHORT nE = USHRT_MAX ) {\ - Base::Insert((const Base*)pI, nP, nS, nE);\ + SvPtrarr::Insert((const SvPtrarr*)pI, nP, nS, nE);\ }\ void Insert( const AERef aE, USHORT nP ) {\ - Base::Insert((const VPRef)aE, nP );\ + SvPtrarr::Insert((const VPRef)aE, nP );\ }\ void Insert( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Insert( (const VoidPtr *)pE, nL, nP );\ + SvPtrarr::Insert( (const VoidPtr *)pE, nL, nP );\ }\ void Replace( const AERef aE, USHORT nP ) {\ - Base::Replace( (const VPRef)aE, nP );\ + SvPtrarr::Replace( (const VPRef)aE, nP );\ }\ void Replace( const AE *pE, USHORT nL, USHORT nP ) {\ - Base::Replace( (const VoidPtr*)pE, nL, nP );\ + SvPtrarr::Replace( (const VoidPtr*)pE, nL, nP );\ }\ void Remove( USHORT nP, USHORT nL = 1) {\ - Base::Remove(nP,nL);\ + SvPtrarr::Remove(nP,nL);\ }\ const AE* GetData() const {\ - return (const AE*)Base::GetData();\ + return (const AE*)SvPtrarr::GetData();\ }\ void ForEach( CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ {\ - _ForEach( 0, nA, (FnForEach_##Base)fnForEach, pArgs );\ + _ForEach( 0, nA, (FnForEach_SvPtrarr)fnForEach, pArgs );\ }\ void ForEach( USHORT nS, USHORT nE, \ CONCAT( FnForEach_, nm ) fnForEach, void* pArgs = 0 )\ {\ - _ForEach( nS, nE, (FnForEach_##Base)fnForEach, pArgs );\ + _ForEach( nS, nE, (FnForEach_SvPtrarr)fnForEach, pArgs );\ }\ AE operator[]( USHORT nP )const { \ - return (AE)Base::operator[](nP); }\ + return (AE)SvPtrarr::operator[](nP); }\ AE GetObject( USHORT nP )const { \ - return (AE)Base::GetObject(nP); }\ + return (AE)SvPtrarr::GetObject(nP); }\ \ USHORT GetPos( const AERef aE ) const { \ - return Base::GetPos((const VPRef)aE);\ + return SvPtrarr::GetPos((const VPRef)aE);\ } \ void DeleteAndDestroy( USHORT nP, USHORT nL=1 );\ private:\ @@ -448,25 +303,22 @@ private:\ }; #define SV_DECL_PTRARR_DEL(nm, AE, IS, GS )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, ) +SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, AE &, VoidPtr &, ) #define SV_DECL_PTRARR_DEL_VISIBILITY(nm, AE, IS, GS, vis )\ -SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, SvPtrarr, AE &, VoidPtr &, vis) +SV_DECL_PTRARR_DEL_GEN(nm, AE, IS, GS, AE &, VoidPtr &, vis) -#define SV_IMPL_PTRARR_GEN(nm, AE, Base)\ +#define SV_IMPL_PTRARR(nm, AE )\ void nm::DeleteAndDestroy( USHORT nP, USHORT nL )\ { \ if( nL ) {\ DBG_ASSERT( nP < nA && nP + nL <= nA,"Del");\ for( USHORT n=nP; n < nP + nL; n++ ) \ delete *((AE*)pData+n); \ - Base::Remove( nP, nL ); \ + SvPtrarr::Remove( nP, nL ); \ } \ } -#define SV_IMPL_PTRARR(nm, AE )\ -SV_IMPL_PTRARR_GEN(nm, AE, SvPtrarr ) - typedef void* VoidPtr; _SV_DECL_VARARR_GEN( SvPtrarr, VoidPtr, 0, 1, VoidPtr &, ) USHORT GetPos( const VoidPtr & aE ) const; @@ -543,103 +395,6 @@ public:\ \ /* Das Ende stehe im DECL-Makro !!! */ -#define _SV_SEEK_PTR(nm,AE)\ -BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ -{\ - register USHORT nO = nm##_SAR::Count(),\ - nM, \ - nU = 0;\ - if( nO > 0 )\ - {\ - nO--;\ - register long rCmp = (long)aE;\ - while( nU <= nO )\ - {\ - nM = nU + ( nO - nU ) / 2;\ - if( (long)*(pData + nM) == rCmp )\ - {\ - if( pP ) *pP = nM;\ - return TRUE;\ - }\ - else if( (long)*(pData+ nM) < (long)aE )\ - nU = nM + 1;\ - else if( nM == 0 )\ - {\ - if( pP ) *pP = nU;\ - return FALSE;\ - }\ - else\ - nO = nM - 1;\ - }\ - }\ - if( pP ) *pP = nU;\ - return FALSE;\ -} - -#define _SV_SEEK_PTR_TO_OBJECT( nm,AE )\ -BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ -{\ - register USHORT nO = nm##_SAR::Count(),\ - nM, \ - nU = 0;\ - if( nO > 0 )\ - {\ - nO--;\ - while( nU <= nO )\ - {\ - nM = nU + ( nO - nU ) / 2;\ - if( *(*((AE*)pData + nM)) == *(aE) )\ - {\ - if( pP ) *pP = nM;\ - return TRUE;\ - }\ - else if( *(*((AE*)pData + nM)) < *(aE) )\ - nU = nM + 1;\ - else if( nM == 0 )\ - {\ - if( pP ) *pP = nU;\ - return FALSE;\ - }\ - else\ - nO = nM - 1;\ - }\ - }\ - if( pP ) *pP = nU;\ - return FALSE;\ -} - -#define _SV_SEEK_OBJECT( nm,AE )\ -BOOL nm::Seek_Entry( const AE & aE, USHORT* pP ) const\ -{\ - register USHORT nO = nm##_SAR::Count(),\ - nM, \ - nU = 0;\ - if( nO > 0 )\ - {\ - nO--;\ - while( nU <= nO )\ - {\ - nM = nU + ( nO - nU ) / 2;\ - if( *(pData + nM) == aE )\ - {\ - if( pP ) *pP = nM;\ - return TRUE;\ - }\ - else if( *(pData + nM) < aE )\ - nU = nM + 1;\ - else if( nM == 0 )\ - {\ - if( pP ) *pP = nU;\ - return FALSE;\ - }\ - else\ - nO = nM - 1;\ - }\ - }\ - if( pP ) *pP = nU;\ - return FALSE;\ -} - #define _SV_IMPL_SORTAR_ALG(nm, AE) #define _SORTARR_BLC_CASTS(nm, AE )\ @@ -727,7 +482,39 @@ _SV_IMPL_SORTAR_ALG( nm,AE )\ SvPtrarr::Remove( nP, nL ); \ } \ } \ -_SV_SEEK_PTR( nm, AE ) + BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ + {\ + register USHORT nO = nm##_SAR::Count(),\ + nM, \ + nU = 0;\ + if( nO > 0 )\ + {\ + nO--;\ + register long rCmp = (long)aE;\ + while( nU <= nO )\ + {\ + nM = nU + ( nO - nU ) / 2;\ + if( (long)*(pData + nM) == rCmp )\ + {\ + if( pP ) *pP = nM;\ + return TRUE;\ + }\ + else if( (long)*(pData+ nM) < (long)aE )\ + nU = nM + 1;\ + else if( nM == 0 )\ + {\ + if( pP ) *pP = nU;\ + return FALSE;\ + }\ + else\ + nO = nM - 1;\ + }\ + }\ + if( pP ) *pP = nU;\ + return FALSE;\ + } + + #define SV_IMPL_OP_PTRARR_SORT( nm,AE )\ _SV_IMPL_SORTAR_ALG( nm,AE )\ @@ -739,12 +526,70 @@ _SV_IMPL_SORTAR_ALG( nm,AE )\ SvPtrarr::Remove( nP, nL ); \ } \ } \ -_SV_SEEK_PTR_TO_OBJECT( nm,AE ) + BOOL nm::Seek_Entry( const AE aE, USHORT* pP ) const\ + {\ + register USHORT nO = nm##_SAR::Count(),\ + nM, \ + nU = 0;\ + if( nO > 0 )\ + {\ + nO--;\ + while( nU <= nO )\ + {\ + nM = nU + ( nO - nU ) / 2;\ + if( *(*((AE*)pData + nM)) == *(aE) )\ + {\ + if( pP ) *pP = nM;\ + return TRUE;\ + }\ + else if( *(*((AE*)pData + nM)) < *(aE) )\ + nU = nM + 1;\ + else if( nM == 0 )\ + {\ + if( pP ) *pP = nU;\ + return FALSE;\ + }\ + else\ + nO = nM - 1;\ + }\ + }\ + if( pP ) *pP = nU;\ + return FALSE;\ + } #define SV_IMPL_VARARR_SORT( nm,AE )\ SV_IMPL_VARARR(nm##_SAR, AE)\ _SV_IMPL_SORTAR_ALG( nm,AE )\ -_SV_SEEK_OBJECT( nm,AE ) +BOOL nm::Seek_Entry( const AE & aE, USHORT* pP ) const\ +{\ + register USHORT nO = nm##_SAR::Count(),\ + nM, \ + nU = 0;\ + if( nO > 0 )\ + {\ + nO--;\ + while( nU <= nO )\ + {\ + nM = nU + ( nO - nU ) / 2;\ + if( *(pData + nM) == aE )\ + {\ + if( pP ) *pP = nM;\ + return TRUE;\ + }\ + else if( *(pData + nM) < aE )\ + nU = nM + 1;\ + else if( nM == 0 )\ + {\ + if( pP ) *pP = nU;\ + return FALSE;\ + }\ + else\ + nO = nM - 1;\ + }\ + }\ + if( pP ) *pP = nU;\ + return FALSE;\ +} #if defined (C40) || defined (C41) || defined (C42) || defined(C50) || defined(C52) #define C40_INSERT( c, p, n) Insert( (c const *) p, n ) |