diff options
author | Noel Grandin <noel@peralex.com> | 2012-08-15 15:52:51 +0200 |
---|---|---|
committer | Michael Stahl <mstahl@redhat.com> | 2012-08-16 18:44:06 +0200 |
commit | ca166a7a42d5c9cde3cf9385e58523168c2f186c (patch) | |
tree | 93cd306a163d55c024de75867a3e3fd10d6d69cb /tools/inc | |
parent | 0331e26fc6304dc16c876cde0e9a939cfe56bd53 (diff) |
Remove the Container class
Change-Id: I296d2c90af59524280c2582670c6cfe7a10f2269
Diffstat (limited to 'tools/inc')
-rw-r--r-- | tools/inc/impcont.hxx | 106 | ||||
-rw-r--r-- | tools/inc/tools/contnr.hxx | 74 |
2 files changed, 0 insertions, 180 deletions
diff --git a/tools/inc/impcont.hxx b/tools/inc/impcont.hxx deleted file mode 100644 index 1cfb374e61c4..000000000000 --- a/tools/inc/impcont.hxx +++ /dev/null @@ -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: */ diff --git a/tools/inc/tools/contnr.hxx b/tools/inc/tools/contnr.hxx index 13e2d3421cc7..5b31f6897d77 100644 --- a/tools/inc/tools/contnr.hxx +++ b/tools/inc/tools/contnr.hxx @@ -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: */ |