diff options
author | Thomas Arnhold <thomas@arnhold.org> | 2012-07-08 00:34:50 +0200 |
---|---|---|
committer | Thomas Arnhold <thomas@arnhold.org> | 2012-07-10 20:01:27 +0200 |
commit | 1c8a30d4f9578057d256b18bfb8477839349e9d9 (patch) | |
tree | 46d8650656445acaef6345d8bd087f05fcf9a301 | |
parent | Remove unused include statements (diff) | |
download | core-1c8a30d4f9578057d256b18bfb8477839349e9d9.tar.gz core-1c8a30d4f9578057d256b18bfb8477839349e9d9.zip |
Remove unused code
Change-Id: I00c8f078b50d913c02407653ce23415d31975f2f
-rw-r--r-- | cosv/inc/cosv/tpl/processor.hxx | 48 | ||||
-rw-r--r-- | cosv/inc/cosv/tpl/range.hxx | 185 | ||||
-rw-r--r-- | cosv/inc/cosv/tpl/tpltools.hxx | 68 |
3 files changed, 0 insertions, 301 deletions
diff --git a/cosv/inc/cosv/tpl/processor.hxx b/cosv/inc/cosv/tpl/processor.hxx index 833c4e0e8467..a685acd5bed6 100644 --- a/cosv/inc/cosv/tpl/processor.hxx +++ b/cosv/inc/cosv/tpl/processor.hxx @@ -56,25 +56,6 @@ class ConstProcessorClient ProcessorIfc & io_processor ) const = 0; }; -/** Implements an acyclic visitor pattern. This is the abstract - base for the classes to be processed (the "visitables"). -*/ -class ProcessorClient -{ - public: - virtual ~ProcessorClient() {} - - void Accept( - ProcessorIfc & io_processor ) - { do_Accept(io_processor); } - private: - virtual void do_Accept( - ProcessorIfc & io_processor ) = 0; -}; - - - - /** Typed base for "visitor" classes, leaving the visited object const. @@ -142,35 +123,6 @@ CheckedCall( ProcessorIfc & io_processor, pProcessor->Process(io_client); } -template <class C> -inline void -AssertedCall( ProcessorIfc & io_processor, - const C & i_client ) -{ - ConstProcessor<C> * - pProcessor = dynamic_cast< csv::ConstProcessor<C> * > - (&io_processor); - csv_assert( pProcessor != 0 - && "csv::AssertedCall() failed. Processed object did not match processor." ); - pProcessor->Process(i_client); -} - -template <class C> -inline void -AssertedCall( ProcessorIfc & io_processor, - C & io_client ) -{ - Processor<C> * - pProcessor = dynamic_cast< csv::Processor<C> * > - (&io_processor); - csv_assert( pProcessor != 0 - && "csv::AssertedCall() failed. Processed object did not match processor." ); - pProcessor->Process(io_client); -} - - - - } // namespace csv #endif diff --git a/cosv/inc/cosv/tpl/range.hxx b/cosv/inc/cosv/tpl/range.hxx deleted file mode 100644 index bb748b3e05b7..000000000000 --- a/cosv/inc/cosv/tpl/range.hxx +++ /dev/null @@ -1,185 +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 CSV_RANGE_HXX -#define CSV_RANGE_HXX - -#include <cstring> // for std::size_t - - - - -namespace csv -{ - - -/** Represents a range of integer or iterator values. - - @tpl T - Has to be assignable, add- and subtractable. That is: - either it is - - an integral type - - or a random access iterator. -*/ -template <class T> -class range -{ - public: - typedef T element_type; /// Provided for generic programming. - typedef range<T> self; - - // LIFECYCLE - range( - T i_inclusiveLowerBorder, - T i_exclusiveUpperBorder ); - ~range(); - // INQUIRY - T begin() const; - T end() const; - std::size_t size() const; - - bool contains( - T i_value ) const; - bool contains( - const self & i_other ) const; - bool overlaps( - const self & i_other ) const; - /// @return i_other.begin() - this->end() - long distance_to( - const self & i_other ) const; - private: - // DATA - T nBegin; - T nEnd; -}; - - -template <class T> -inline range<T> -make_range(T i1, T i2) -{ - return range<T>(i1, i2); -} - -template <class T> -inline range<typename T::const_iterator> -range_of(const T & i_container) -{ - return make_range( i_container.begin(), - i_container.end() - ); -} - -template <class T> -inline range<typename T::iterator> -range_of(T & io_container) -{ - return make_range( io_container.begin(), - io_container.end() - ); -} - - - - - -// IMPLEMENTATION - -template <class T> -range<T>::range( T i_inclusiveLowerBorder, - T i_exclusiveUpperBorder ) - : nBegin(i_inclusiveLowerBorder), - nEnd(i_exclusiveUpperBorder) -{ - csv_assert( nBegin <= nEnd - && "Invalid parameters for range<> constructor."); -} - -template <class T> -range<T>::~range() -{ -} - -template <class T> -inline T -range<T>::begin() const -{ - return nBegin; -} - -template <class T> -inline T -range<T>::end() const -{ - return nEnd; -} - -template <class T> -inline std::size_t -range<T>::size() const -{ - csv_assert( nBegin <= nEnd - && "Invalid range limits in range<>::size()."); - return static_cast<std::size_t>( end() - begin() ); -} - -template <class T> -bool -range<T>::contains(T i_value ) const -{ - return begin() <= i_value - && i_value < end(); -} - -template <class T> -bool -range<T>::contains(const self & i_other) const -{ - // This is subtle, because this would be wrong: - // begin() <= i_other.begin() - // && i_other.end() <= end(); - // An empty range that begins and starts at my end() - // must not be contained. - - return contains(i_other.begin()) - && i_other.end() <= end(); -} - -template <class T> -bool -range<T>::overlaps(const self & i_other) const -{ - return contains(i_other.begin()) - || i_other.contains(begin()); -} - -template <class T> -long -range<T>::distance_to(const self & i_other) const -{ - return i_other.begin() - end(); -} - - - - -} // namespace csv -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/cosv/inc/cosv/tpl/tpltools.hxx b/cosv/inc/cosv/tpl/tpltools.hxx index 99a74b11c29d..2d7ebfeeaf30 100644 --- a/cosv/inc/cosv/tpl/tpltools.hxx +++ b/cosv/inc/cosv/tpl/tpltools.hxx @@ -34,23 +34,11 @@ template <class COLLECTION> inline void erase_container( COLLECTION & o_rCollection ); -/// Version for std::map -template <class COLLECTION> -void erase_map_of_heap_ptrs( - COLLECTION & o_rCollection ); - /// Version for other containers than std::map, with non-pair value_type. template <class COLLECTION> void erase_container_of_heap_ptrs( COLLECTION & o_rCollection ); -template <class VECTOR_ELEM> -void adjust_vector_size( - std::vector<VECTOR_ELEM> & - io_rVector, - uintt i_nSize, - const VECTOR_ELEM & i_nFill ); - template <class KEY, class VAL> const VAL * find_in_map( /// Usable for all kinds of values @@ -82,13 +70,6 @@ bool contains( const COLLECTION & i_collection, const VALUE & i_value ); -// Object oriented for_each: -template <class COLLECTION, class CLASS, class MEMFUNC> -void call_for_each( - const COLLECTION & i_rList, - CLASS * io_pThis, - MEMFUNC i_fMethod ); - @@ -103,22 +84,6 @@ erase_container( COLLECTION & o_rCollection ) template <class COLLECTION> void -erase_map_of_heap_ptrs( COLLECTION & o_rCollection ) -{ - typename COLLECTION::iterator itEnd = o_rCollection.end(); - for ( typename COLLECTION::iterator it = o_rCollection.begin(); - it != itEnd; - ++it ) - { - delete (*it).second; - } - - o_rCollection.erase( o_rCollection.begin(), - o_rCollection.end() ); -} - -template <class COLLECTION> -void erase_container_of_heap_ptrs( COLLECTION & o_rCollection ) { typename COLLECTION::iterator itEnd = o_rCollection.end(); @@ -133,25 +98,6 @@ erase_container_of_heap_ptrs( COLLECTION & o_rCollection ) o_rCollection.end() ); } -template <class VECTOR_ELEM> -void -adjust_vector_size( std::vector<VECTOR_ELEM> & io_rVector, - uintt i_nSize, - const VECTOR_ELEM & i_nFill ) -{ - if ( io_rVector.size() > i_nSize ) - { - io_rVector.erase( io_rVector.begin() + i_nSize, io_rVector.end() ); - } - else - { - io_rVector.reserve(i_nSize); - while ( io_rVector.size() < i_nSize ) - io_rVector.push_back(i_nFill); - } -} - - template <class KEY, class VAL> const VAL * find_in_map( const std::map< KEY, VAL > & i_rMap, @@ -199,20 +145,6 @@ contains( const COLLECTION & i_collection, i_collection.end(); } -template <class COLLECTION, class CLASS, class MEMFUNC> -void -call_for_each( const COLLECTION & i_rList, - CLASS * io_pThis, - MEMFUNC i_fMethod ) -{ - typename COLLECTION::const_iterator it = i_rList.begin(); - typename COLLECTION::const_iterator itEnd = i_rList.end(); - for ( ; it != itEnd; ++it ) - { - (io_pThis->*i_fMethod)(*it); - } -} - |