Remove the Container class

Change-Id: I296d2c90af59524280c2582670c6cfe7a10f2269
This commit is contained in:
Noel Grandin 2012-08-15 15:52:51 +02:00 committed by Michael Stahl
parent 0331e26fc6
commit ca166a7a42
5 changed files with 0 additions and 1416 deletions

View File

@ -72,7 +72,6 @@ $(eval $(call gb_Library_add_exception_objects,tl,\
tools/source/inet/inetmime \
tools/source/inet/inetmsg \
tools/source/inet/inetstrm \
tools/source/memtools/contnr \
tools/source/memtools/mempool \
tools/source/memtools/multisel \
tools/source/memtools/unqidx \

View File

@ -1,106 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
* This file is part of the LibreOffice project.
*
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*
* This file incorporates work covered by the following license notice:
*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed
* with this work for additional information regarding copyright
* ownership. The ASF licenses this file to you under the Apache
* License, Version 2.0 (the "License"); you may not use this file
* except in compliance with the License. You may obtain a copy of
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#ifndef _IMPCONT_HXX
#define _IMPCONT_HXX
#include <tools/tools.h>
#include <tools/contnr.hxx>
typedef void* PVOID;
class CBlock
{
private:
CBlock* pPrev; ///< Previous block
CBlock* pNext; ///< Next block
sal_uInt16 nSize; ///< block size
sal_uInt16 nCount; ///< number of pointers
void** pNodes; ///< stores node pointers
#if defined DBG_UTIL
static char const * DbgCheckCBlock(void const *);
#endif
public:
/// used for list container
CBlock( sal_uInt16 nSize, CBlock* pPrev, CBlock* pNext );
/// used for array container
CBlock( sal_uInt16 nSize, CBlock* pPrev );
/// Copy-Ctor
CBlock( const CBlock& r, CBlock* pPrev );
~CBlock();
void Insert( void* p, sal_uInt16 nIndex, sal_uInt16 nReSize );
CBlock* Split( void* p, sal_uInt16 nIndex, sal_uInt16 nReSize );
void* Remove( sal_uInt16 nIndex, sal_uInt16 nReSize );
void* Replace( void* pNew, sal_uInt16 nIndex );
void** GetNodes() const { return pNodes; }
void** GetObjectPtr( sal_uInt16 nIndex );
void* GetObject( sal_uInt16 nIndex ) const;
sal_uInt16 GetSize() const { return nCount; }
sal_uInt16 Count() const { return nCount; }
void SetPrevBlock( CBlock* p ) { pPrev = p; }
void SetNextBlock( CBlock* p ) { pNext = p; }
CBlock* GetPrevBlock() const { return pPrev; }
CBlock* GetNextBlock() const { return pNext; }
void Reset() { nCount = 0; }
private:
CBlock( const CBlock& r );
friend class Container;
};
/// @return a node pointer given a block index
inline void* CBlock::GetObject( sal_uInt16 nIndex ) const
{
return pNodes[nIndex];
}
/** A pointer is often located in the first block, thus check this position
before calling GetObject.
*/
inline void* Container::ImpGetObject( sal_uIntPtr nIndex ) const
{
if ( pFirstBlock && (nIndex < pFirstBlock->Count()) )
// Return item within the found block
return pFirstBlock->GetObject( (sal_uInt16)nIndex );
else
return GetObject( nIndex );
}
// #i70651#: Prevent warnings on Mac OS X
#ifdef MACOSX
#pragma GCC system_header
#endif
/// If only one block exists, return its data array.
inline void** Container::ImpGetOnlyNodes() const
{
if ( (pFirstBlock == pLastBlock) && pFirstBlock )
return pFirstBlock->GetNodes();
else
return NULL;
}
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

View File

@ -24,84 +24,10 @@
#include <limits.h>
class CBlock;
#define CONTAINER_MAXBLOCKSIZE ((sal_uInt16)0x3FF0)
#define CONTAINER_APPEND ULONG_MAX
#define CONTAINER_ENTRY_NOTFOUND ULONG_MAX
#define LIST_APPEND CONTAINER_APPEND
class TOOLS_DLLPUBLIC Container
{
private:
CBlock* pFirstBlock;
CBlock* pCurBlock;
CBlock* pLastBlock;
sal_uInt16 nCurIndex;
sal_uInt16 nBlockSize;
sal_uInt16 nInitSize;
sal_uInt16 nReSize;
sal_uIntPtr nCount;
TOOLS_DLLPRIVATE void ImpCopyContainer(Container const *);
#if defined DBG_UTIL
TOOLS_DLLPRIVATE static char const * DbgCheckContainer(void const *);
#endif
protected:
#ifdef _IMPCONT_HXX
void ImpInsert( void* p, CBlock* pBlock, sal_uInt16 nIndex );
void* ImpRemove( CBlock* pBlock, sal_uInt16 nIndex );
void* ImpGetObject( sal_uIntPtr nIndex ) const;
void** ImpGetOnlyNodes() const;
#endif
public:
Container( sal_uInt16 nBlockSize,
sal_uInt16 nInitSize,
sal_uInt16 nReSize );
Container( sal_uIntPtr nSize );
Container( const Container& rContainer );
~Container();
void Insert( void* p );
void Insert( void* p, sal_uIntPtr nIndex );
void* Remove();
void* Remove( sal_uIntPtr nIndex );
void* Remove( void* p )
{ return Remove( GetPos( p ) ); }
void* Replace( void* p, sal_uIntPtr nIndex );
void* Replace( void* pNew, void* pOld )
{ return Replace( pNew, GetPos( pOld ) ); }
sal_uIntPtr GetSize() const { return nCount; }
sal_uIntPtr Count() const { return nCount; }
void Clear();
void* GetCurObject() const;
sal_uIntPtr GetCurPos() const;
void* GetObject( sal_uIntPtr nIndex ) const;
sal_uIntPtr GetPos( const void* p ) const;
void* Seek( sal_uIntPtr nIndex );
void* Seek( void* p ) { return Seek( GetPos( p ) ); }
void* First();
void* Last();
void* Next();
void* Prev();
Container& operator =( const Container& rContainer );
sal_Bool operator ==( const Container& rContainer ) const;
sal_Bool operator !=( const Container& rContainer ) const
{ return !(Container::operator==( rContainer )); }
};
#endif
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

File diff suppressed because it is too large Load Diff

View File

@ -17,7 +17,6 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
#include <impcont.hxx>
#include <tools/unqidx.hxx>