diff options
author | Jan Holesovsky <kendy@suse.cz> | 2011-12-30 19:20:25 +0100 |
---|---|---|
committer | Jan Holesovsky <kendy@suse.cz> | 2011-12-30 19:21:10 +0100 |
commit | 16ea3bec808dc53de557bf1765c503b38848ab8d (patch) | |
tree | ca233cbb7328133affc157d2785f1dcbfd7f3027 /sw/qa | |
parent | 36d7f011a35c282c6c5f219681502e85dd8b768c (diff) |
Unused, as pointed by Terrence Enger.
Diffstat (limited to 'sw/qa')
-rw-r--r-- | sw/qa/core/bigpointerarray-new.cxx | 111 | ||||
-rw-r--r-- | sw/qa/core/bigpointerarray-new.hxx | 160 |
2 files changed, 0 insertions, 271 deletions
diff --git a/sw/qa/core/bigpointerarray-new.cxx b/sw/qa/core/bigpointerarray-new.cxx deleted file mode 100644 index bd3845642b9b..000000000000 --- a/sw/qa/core/bigpointerarray-new.cxx +++ /dev/null @@ -1,111 +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. - * - ************************************************************************/ - - -#include "bparr.hxx" -#include <algorithm> - -BigPtrArray::BigPtrArray() -{ - //container_.reserve(1000); -} - -sal_uLong BigPtrArray::Count() const -{ - return container_.size(); -} - -void BigPtrArray::Move(sal_uLong fromPos, sal_uLong toPos) -{ - OSL_ENSURE(fromPos < container_.size() && toPos < container_.size(), "BigPtrArray.Move precondition violation"); - Insert(container_[fromPos], toPos); - Remove(toPos < fromPos ? fromPos + 1 : fromPos, 1); -} - -void BigPtrArray::ForEach(sal_uLong fromPos, sal_uLong toPos, FnForEach fn, void* pArgs) -{ - OSL_ENSURE(fromPos < toPos && fromPos < container_.size() && toPos < container_.size(), "BigPtrArray::ForEach precondition violation"); - Container_t::const_iterator iter = container_.begin() + fromPos; - Container_t::const_iterator iter_end = container_.begin() + toPos; - for (/*no init*/; iter != iter_end; ++iter) - fn(*iter, pArgs); -} - -void BigPtrArray::ForEach(FnForEach fn, void* pArgs) -{ - Container_t::const_iterator iter = container_.begin(); - Container_t::const_iterator iter_end = container_.end(); - for ( /*no init*/; iter != iter_end; ++iter) - fn(*iter, pArgs); -} - -ElementPtr BigPtrArray::operator[](sal_uLong pos) const -{ - OSL_ENSURE(pos < container_.size(), "BigPtrArray::operator[] precondition violation"); - return container_[pos]; -} - -void BigPtrArray::Insert(const ElementPtr& rElem, sal_uLong pos) -{ - OSL_ENSURE(pos <= container_.size(), "BigPtrArray::Insert precondition violation"); - - rElem->pBigPtrArray_ = this; - rElem->pos_ = pos; - - if (pos == container_.size()) - container_.push_back(rElem); - else - { - container_.insert(container_.begin() + pos, rElem); - FixElementIndizes(container_.begin(), container_.end()); - } -} - -void BigPtrArray::Remove( sal_uLong pos, sal_uLong n ) -{ - OSL_ENSURE((pos < container_.size()) && ((container_.begin() + pos + n) < container_.end()), "BigPtrArray.Remove precondition violation") - container_.erase(container_.begin() + pos, container_.begin() + pos + n); - FixElementIndizes(container_.begin(), container_.end()); -} - -void BigPtrArray::Replace(sal_uLong pos, const ElementPtr& rElem) -{ - OSL_ENSURE(pos < container_.size(), "BigPtrArray::Replace precondition violation"); - rElem->pBigPtrArray_ = this; - rElem->pos_ = pos; - container_[pos] = rElem; -} - -void BigPtrArray::FixElementIndizes(Container_t::const_iterator begin, Container_t::const_iterator end) const -{ - Container_t::const_iterator iter = begin; - for (int i = 0; iter != end; ++iter, i++) - (*iter)->pos_ = i; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/qa/core/bigpointerarray-new.hxx b/sw/qa/core/bigpointerarray-new.hxx deleted file mode 100644 index 5d0b1968b9d1..000000000000 --- a/sw/qa/core/bigpointerarray-new.hxx +++ /dev/null @@ -1,160 +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 _BPARR_HXX -#define _BPARR_HXX - -#include <tools/solar.h> -#include <deque> - -class BigPtrArray; - -/** Base class for container entries -*/ -class BigPtrEntry -{ - friend class BigPtrArray; - BigPtrArray* pBigPtrArray_; - sal_uLong pos_; - -protected: - BigPtrEntry() : pBigPtrArray_(0), pos_(0) - {} - - virtual ~BigPtrEntry() - {} - - sal_uLong GetPos() const - { - return pos_; - } - - BigPtrArray& GetArray() const - { - return *pBigPtrArray_; - } -}; - -typedef BigPtrEntry* ElementPtr; -typedef sal_Bool (*FnForEach)(const ElementPtr&, void* pArgs); - -/** A container abstraction -*/ -class BigPtrArray -{ -public: - typedef std::deque<ElementPtr> Container_t; - -public: - /** - */ - BigPtrArray(); - - /** Return the number of entries inserted - into the array - */ - sal_uLong Count() const; - - /** Insert an Element into the array at a certain - position - - @param rElem - [in] the element - - @param pos - [in] the position where to insert the element. - - @pre (pos >= 0 && pos <= BigPtrArray.Count()) - @post (((oldCount + 1) == BigPtrArray.Count()) && BigPtrArray[pos] == rElem) - */ - void Insert(const ElementPtr& rElem, sal_uLong pos); - - /** Remove a specified number of elements starting at a certain position. - - @param pos - [in] the position where to start removing elements - - @param n - [in] the number of elements to remove - - @pre (pos < BigPtrArray.Count() && n <= BigPtrArray.Count()) - @post ((oldCount - n) == BigPtrArray.Count()) - */ - void Remove(sal_uLong pos, sal_uLong n = 1); - - /** Move an entry from a certain position to another on. - - @param from - [in] - - @param to - [in] - */ - void Move(sal_uLong fromPos, sal_uLong toPos); - - /** Replace an entry at a certain position - - @param pos - [in] the position of the entry - - @param rElem - [in] the new entry - - @pre pos < BigPtrArray.Count() - @post (oldCount == BigPtrArray.Count() && BigPtrArray[pos] == rElem) - */ - void Replace(sal_uLong pos, const ElementPtr& rElem); - - /** Get the entry at a certain index - - @param pos - [in] the position of the entry - - @pre pos < BigPtrArray.Count() - */ - ElementPtr operator[](sal_uLong pos) const; - - /** - */ - void ForEach(FnForEach fn, void* pArgs = NULL); - - /** - */ - void ForEach(sal_uLong fromPos, sal_uLong toPos, FnForEach fn, void* pArgs = NULL); - -private: - - void FixElementIndizes(Container_t::const_iterator begin, Container_t::const_iterator end) const; - -private: - Container_t container_; -}; - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |