diff options
Diffstat (limited to 'autodoc/source/ary/inc')
-rw-r--r-- | autodoc/source/ary/inc/idl_internalgate.hxx | 51 | ||||
-rw-r--r-- | autodoc/source/ary/inc/idsort.hxx | 46 | ||||
-rw-r--r-- | autodoc/source/ary/inc/nametreenode.hxx | 204 | ||||
-rw-r--r-- | autodoc/source/ary/inc/reposy.hxx | 77 | ||||
-rw-r--r-- | autodoc/source/ary/inc/sci_impl.hxx | 407 | ||||
-rw-r--r-- | autodoc/source/ary/inc/store/s_base.hxx | 174 | ||||
-rw-r--r-- | autodoc/source/ary/inc/store/s_iterator.hxx | 231 | ||||
-rw-r--r-- | autodoc/source/ary/inc/store/s_storage.hxx | 288 |
8 files changed, 0 insertions, 1478 deletions
diff --git a/autodoc/source/ary/inc/idl_internalgate.hxx b/autodoc/source/ary/inc/idl_internalgate.hxx deleted file mode 100644 index 23e6dff26640..000000000000 --- a/autodoc/source/ary/inc/idl_internalgate.hxx +++ /dev/null @@ -1,51 +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 ARY_IDL_INTERNALGATE_HXX -#define ARY_IDL_INTERNALGATE_HXX - -// BASE CLASSES -#include <ary/idl/i_gate.hxx> - -namespace ary -{ -namespace idl -{ - - -/** Provides access to the ->idl::RepositoryPartition as far as is needed - by the ->RepositoryCenter. -*/ -class InternalGate : public ::ary::idl::Gate -{ - public: - virtual ~InternalGate() {} - - static DYN InternalGate & - Create_Partition_(); -}; - - - - -} // namespace idl -} // namespace ary -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/idsort.hxx b/autodoc/source/ary/inc/idsort.hxx deleted file mode 100644 index 327a52173f3f..000000000000 --- a/autodoc/source/ary/inc/idsort.hxx +++ /dev/null @@ -1,46 +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 ARY_IDSORT_HXX -#define ARY_IDSORT_HXX - - -/** A compare function that sorts ids of repository entities in the same - storage. - - @see ::ary::SortedIds -*/ -template<class COMPARE> -struct IdSorter -{ - bool operator()( - typename COMPARE::id_type - i_1, - typename COMPARE::id_type - i_2 ) const - { return COMPARE::Lesser_( - COMPARE::KeyOf_(COMPARE::EntityOf_(i_1)), - COMPARE::KeyOf_(COMPARE::EntityOf_(i_2)) ); - } -}; - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/nametreenode.hxx b/autodoc/source/ary/inc/nametreenode.hxx deleted file mode 100644 index b4d684018d76..000000000000 --- a/autodoc/source/ary/inc/nametreenode.hxx +++ /dev/null @@ -1,204 +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 ARY_NAMETREENODE_HXX -#define ARY_NAMETREENODE_HXX -// KORR_DEPRECATED_3.0 -// Replace by ::ary::symtree::Node. - -// USED SERVICES -#include <cosv/tpl/tpltools.hxx> -#include <sci_impl.hxx> -// HACK because of SunPro 5.2 compiler bug with templates: -#include <ary/idl/i_module.hxx> - - - - -namespace ary -{ - - -/** Implementation of a node in a namespace-tree. -*/ -template<class ITEM_ID> -class NameTreeNode -{ - public: - typedef NameTreeNode self; - typedef ITEM_ID item_id; - typedef StringVector::const_iterator name_iterator; - typedef std::map<String, item_id> Map_LocalNames; - - // LIFECYCLE - NameTreeNode(); - NameTreeNode( - const String & i_sName, - const self & i_rParent, - ITEM_ID i_nParentId ); - virtual ~NameTreeNode(); - - // OPERATIONS - void Add_Name( - const String & i_sName, - item_id i_nId ); - // INQUIRY - const String & Name() const { return Depth() > 0 ? aCompleteNameChain.back() : String::Null_(); } - item_id Parent() const { return nParent; } - intt Depth() const { return aCompleteNameChain.size(); } - - bool IsEquivalent( - const NameTreeNode & - i_rNode ) const; - name_iterator NameChain_Begin() const { return aCompleteNameChain.begin(); } - name_iterator NameChain_End() const { return aCompleteNameChain.end(); } - - item_id Search_Name( - const String & i_sName ) const; - void Get_Names( - Dyn_StdConstIterator<ITEM_ID> & - o_rResult ) const; - const Map_LocalNames & - LocalNames() const { return aLocalNames; } - private: - // Locals - Map_LocalNames & LocalNames() { return aLocalNames; } - - // DATA - Map_LocalNames aLocalNames; - StringVector aCompleteNameChain; - item_id nParent; -}; - - - - -// IMPLEMENTATION -template<class ITEM_ID> -NameTreeNode<ITEM_ID>::NameTreeNode() - : aLocalNames(), - aCompleteNameChain(), - nParent(0) -{ -} - -template<class ITEM_ID> -NameTreeNode<ITEM_ID>::NameTreeNode( const String & i_sName, - const self & i_rParent, - ITEM_ID i_nParentId ) - : aLocalNames(), - aCompleteNameChain(), - nParent(i_nParentId) -{ - aCompleteNameChain.reserve(i_rParent.Depth()+1); - for ( name_iterator it = i_rParent.NameChain_Begin(); - it != i_rParent.NameChain_End(); - ++it ) - { - aCompleteNameChain.push_back(*it); - } - aCompleteNameChain.push_back(i_sName); -} - -template<class ITEM_ID> -NameTreeNode<ITEM_ID>::~NameTreeNode() -{ -} - - -template<class ITEM_ID> -inline void -NameTreeNode<ITEM_ID>::Add_Name( const String & i_sName, - item_id i_nId ) -{ - LocalNames().insert( typename Map_LocalNames::value_type(i_sName, i_nId) ); -} - - -template<class ITEM_ID> -inline bool -NameTreeNode<ITEM_ID>::IsEquivalent( const NameTreeNode & i_rNode ) const -{ - return aCompleteNameChain == i_rNode.aCompleteNameChain; -} - -template<class ITEM_ID> -inline ITEM_ID -NameTreeNode<ITEM_ID>::Search_Name( const String & i_sName ) const -{ - return csv::value_from_map(LocalNames(),i_sName, ITEM_ID(0)); -} - -template<class ITEM_ID> -inline void -NameTreeNode<ITEM_ID>::Get_Names( Dyn_StdConstIterator<ITEM_ID> & o_rResult ) const -{ - o_rResult = new SCI_DataInMap<String,item_id>(LocalNames()); -} - - -// HACK because of SunPro 5.2 compiler bug with templates: -// ary::idl::Module has to be "FIND_NODE::node_type" -// must be solved later somehow. -template <class FIND_NODE> -typename FIND_NODE::id_type -Search_SubTree( const ary::idl::Module & i_rStart, - const FIND_NODE & i_rNodeFinder ) -{ - const ary::idl::Module * - ret = &i_rStart; - - for ( StringVector::const_iterator it = i_rNodeFinder.Begin(); - it != i_rNodeFinder.End() AND ret != 0; - ++it ) - { - ret = i_rNodeFinder(ret->Search_Name(*it)); - } - - typename FIND_NODE::id_type nret(0); - return ret != 0 - ? ret->Search_Name(i_rNodeFinder.Name2Search()) - : nret; -} - -template <class FIND_NODE> -typename FIND_NODE::id_type -Search_SubTree_UpTillRoot( const ary::idl::Module & i_rStart, - const FIND_NODE & i_rNodeFinder ) -{ - typename FIND_NODE::id_type - ret(0); - for ( const ary::idl::Module * start = &i_rStart; - start != 0 AND NOT ret.IsValid(); - start = i_rNodeFinder(start->Owner()) ) - { - ret = Search_SubTree( *start, - i_rNodeFinder ); - } - return ret; -} -// END Hack for SunPro 5.2 compiler bug. - - - - -} // namespace ary -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/reposy.hxx b/autodoc/source/ary/inc/reposy.hxx deleted file mode 100644 index f906cd5c255a..000000000000 --- a/autodoc/source/ary/inc/reposy.hxx +++ /dev/null @@ -1,77 +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 ARY_REPOSY_HXX -#define ARY_REPOSY_HXX - -// BASE CLASSES -#include <ary/ary.hxx> -// USED SERVICES -#include <cosv/ploc_dir.hxx> - -namespace ary -{ -namespace idl -{ - class InternalGate; -} -} // namespace ary - - - - -namespace ary -{ - - -/** Implements ::ary::Repository. - - @see Repository -*/ - -class RepositoryCenter : public ::ary::Repository -{ - public: - // LIFECYCLE - RepositoryCenter(); - virtual ~RepositoryCenter(); - - // INHERITED - // Interface Repository: - virtual const idl::Gate & Gate_Idl() const; - virtual const String & Title() const; - virtual idl::Gate & Gate_Idl(); - virtual void Set_Title(const String & i_sName ); - - private: - // DATA - String sDisplayedName; /// Name to be displayed for human users. - csv::ploc::Directory - aLocation; - Dyn<idl::InternalGate> - pIdlPartition; -}; - - - - -} // namespace ary -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/sci_impl.hxx b/autodoc/source/ary/inc/sci_impl.hxx deleted file mode 100644 index 8c766ba50ba9..000000000000 --- a/autodoc/source/ary/inc/sci_impl.hxx +++ /dev/null @@ -1,407 +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 ARY_SCI_IMPL_HXX -#define ARY_SCI_IMPL_HXX - - - -// USED SERVICES - // BASE CLASSES -#include <ary/stdconstiter.hxx> - // COMPONENTS - // PARAMETERS - - -namespace ary -{ - - -//************************* SCI_Vector **********************************// - -template <class ELEM> -class SCI_Vector : public StdConstIterator<ELEM> -{ - public: - typedef std::vector<ELEM> source; - typedef typename source::const_iterator source_iterator; - - SCI_Vector( - const source & i_rSource ); - virtual ~SCI_Vector(); - - private: - // Interface StdConstIterator<>: - virtual void do_Advance(); - virtual const ELEM * - inq_CurElement() const; - virtual bool inq_IsSorted() const; - - // DATA - source_iterator itRun; - source_iterator itEnd; -}; - - - -//************************* SCI_Map **********************************// - -template <class KEY, class VALUE> -class SCI_Map : public StdConstIterator< typename std::map<KEY,VALUE>::value_type > -{ - public: - typedef std::map<KEY,VALUE> source; - typedef typename source::const_iterator source_iterator; - - SCI_Map( - const source & i_rSource ); - virtual ~SCI_Map(); - - private: - // Interface StdConstIterator<>: - virtual void do_Advance(); - virtual const typename std::map<KEY,VALUE>::value_type * - inq_CurElement() const; - virtual bool inq_IsSorted() const; - - // DATA - source_iterator itRun; - source_iterator itEnd; -}; - - -//************************* SCI_MultiMap **********************************// - -template <class KEY, class VALUE> -class SCI_MultiMap : public StdConstIterator< typename std::multimap<KEY,VALUE>::value_type > -{ - public: - typedef std::multimap<KEY,VALUE> source; - typedef typename source::const_iterator source_iterator; - - SCI_MultiMap( - const source & i_rSource ); - SCI_MultiMap( - source_iterator i_begin, - source_iterator i_end ); - virtual ~SCI_MultiMap(); - - private: - // Interface StdConstIterator<>: - virtual void do_Advance(); - virtual const typename std::multimap<KEY,VALUE>::value_type * - inq_CurElement() const; - virtual bool inq_IsSorted() const; - - // DATA - source_iterator itRun; - source_iterator itEnd; -}; - - - -//************************* SCI_Set **********************************// - - -template <class TYPES> -class SCI_Set : public StdConstIterator<typename TYPES::element_type> -{ - public: - typedef typename TYPES::element_type element; - typedef typename TYPES::sort_type sorter; - typedef std::set<element, sorter> source; - typedef typename source::const_iterator source_iterator; - - SCI_Set( - const source & i_rSource ); - virtual ~SCI_Set(); - - private: - // Interface StdConstIterator<>: - virtual void do_Advance(); - virtual const element * - inq_CurElement() const; - virtual bool inq_IsSorted() const; - - // DATA - source_iterator itRun; - source_iterator itEnd; -}; - -//************************* SCI_DataInMap **********************************// - -template <class KEY, class VALUE> -class SCI_DataInMap : public StdConstIterator<VALUE> -{ - public: - typedef std::map<KEY,VALUE> source; - typedef typename source::const_iterator source_iterator; - - SCI_DataInMap( - const source & i_rSource ); - virtual ~SCI_DataInMap(); - - private: - // Interface StdConstIterator<>: - virtual void do_Advance(); - virtual const VALUE * - inq_CurElement() const; - virtual bool inq_IsSorted() const; - - // DATA - source_iterator itRun; - source_iterator itEnd; -}; - - - - - -//********************************************************************// - - -// IMPLEMENTATION - -template <class ELEM> -SCI_Vector<ELEM>::SCI_Vector( const source & i_rSource ) - : itRun(i_rSource.begin()), - itEnd(i_rSource.end()) -{ -} - -template <class ELEM> -SCI_Vector<ELEM>::~SCI_Vector() -{ -} - - -template <class ELEM> -void -SCI_Vector<ELEM>::do_Advance() -{ - if (itRun != itEnd) - ++itRun; -} - -template <class ELEM> -const ELEM * -SCI_Vector<ELEM>::inq_CurElement() const -{ - if (itRun != itEnd) - return &(*itRun); - return 0; -} - -template <class ELEM> -bool -SCI_Vector<ELEM>::inq_IsSorted() const -{ - return false; -} - - - - -template <class KEY, class VALUE> -SCI_Map<KEY,VALUE>::SCI_Map( const source & i_rSource ) - : itRun(i_rSource.begin()), - itEnd(i_rSource.end()) -{ -} - -template <class KEY, class VALUE> -SCI_Map<KEY,VALUE>::~SCI_Map() -{ -} - -template <class KEY, class VALUE> -void -SCI_Map<KEY,VALUE>::do_Advance() -{ - if (itRun != itEnd) - ++itRun; -} - -template <class KEY, class VALUE> -const typename std::map<KEY,VALUE>::value_type * -SCI_Map<KEY,VALUE>::inq_CurElement() const -{ - if (itRun != itEnd) - return &(*itRun); - return 0; -} - - -template <class KEY, class VALUE> -bool -SCI_Map<KEY,VALUE>::inq_IsSorted() const -{ - return true; -} - - - - - - - -template <class KEY, class VALUE> -SCI_MultiMap<KEY,VALUE>::SCI_MultiMap( const source & i_rSource ) - : itRun(i_rSource.begin()), - itEnd(i_rSource.end()) -{ -} - -template <class KEY, class VALUE> -SCI_MultiMap<KEY,VALUE>::SCI_MultiMap( source_iterator i_begin, - source_iterator i_end ) - : itRun(i_begin), - itEnd(i_end) -{ -} - -template <class KEY, class VALUE> -SCI_MultiMap<KEY,VALUE>::~SCI_MultiMap() -{ -} - -template <class KEY, class VALUE> -void -SCI_MultiMap<KEY,VALUE>::do_Advance() -{ - if (itRun != itEnd) - ++itRun; -} - -template <class KEY, class VALUE> -const typename std::multimap<KEY,VALUE>::value_type * -SCI_MultiMap<KEY,VALUE>::inq_CurElement() const -{ - if (itRun != itEnd) - return &(*itRun); - return 0; -} - - -template <class KEY, class VALUE> -bool -SCI_MultiMap<KEY,VALUE>::inq_IsSorted() const -{ - return true; -} - - - - - - - - -template <class ELEM> -SCI_Set<ELEM>::SCI_Set( const source & i_rSource ) - : itRun(i_rSource.begin()), - itEnd(i_rSource.end()) -{ -} - -template <class ELEM> -SCI_Set<ELEM>::~SCI_Set() -{ -} - - -template <class ELEM> -void -SCI_Set<ELEM>::do_Advance() -{ - if (itRun != itEnd) - ++itRun; -} - -template <class ELEM> -const typename SCI_Set<ELEM>::element * -SCI_Set<ELEM>::inq_CurElement() const -{ - if (itRun != itEnd) - return &(*itRun); - return 0; -} - -template <class ELEM> -bool -SCI_Set<ELEM>::inq_IsSorted() const -{ - return true; -} - - - - - - - -template <class KEY, class VALUE> -SCI_DataInMap<KEY,VALUE>::SCI_DataInMap( const source & i_rSource ) - : itRun(i_rSource.begin()), - itEnd(i_rSource.end()) -{ -} - -template <class KEY, class VALUE> -SCI_DataInMap<KEY,VALUE>::~SCI_DataInMap() -{ -} - -template <class KEY, class VALUE> -void -SCI_DataInMap<KEY,VALUE>::do_Advance() -{ - if (itRun != itEnd) - ++itRun; -} - -template <class KEY, class VALUE> -const VALUE * -SCI_DataInMap<KEY,VALUE>::inq_CurElement() const -{ - if (itRun != itEnd) - return &(*itRun).second; - return 0; -} - - -template <class KEY, class VALUE> -bool -SCI_DataInMap<KEY,VALUE>::inq_IsSorted() const -{ - return true; -} - - - - - - - -} // namespace ary - - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/store/s_base.hxx b/autodoc/source/ary/inc/store/s_base.hxx deleted file mode 100644 index 085db7616a34..000000000000 --- a/autodoc/source/ary/inc/store/s_base.hxx +++ /dev/null @@ -1,174 +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 ARY_STORE_S_BASE_HXX -#define ARY_STORE_S_BASE_HXX - -// USED SERVICES -#include <deque> -#include <cosv/tpl/tpltools.hxx> - - - - -namespace ary -{ -namespace stg -{ - - -/** The basic storage container of the repository. - - @collab Storage - Implements Storage. Not used elsewhere. - - @tpl ENTITY - The type of *it, where it is of type c_iter, has to be ENTITY * const. -*/ -template <class ENTITY> -class Base -{ - public: - // LIFECYCLE - typedef std::deque< ENTITY* > impl_type; - typedef typename impl_type::const_iterator c_iter; - - - /** @param i_nrOfReservedItems - The number of actual items to reserve, including the item - at index [0] that is always empty and unused. - */ - Base( - uintt i_nrOfReservedItems ); - ~Base(); - - // OPERATORS - ENTITY * operator[]( - uintt i_index ) const; - // OPERATIONS - uintt Add_Entity( /// @return the index of the new element. - DYN ENTITY & pass_newEntity ); - DYN ENTITY * Set_Entity( /// @return the previous value. - uintt i_index, - DYN ENTITY & pass_newEntity ); - // INQUIRY - uintt Size() const; /// Incl. reserved size. - uintt ReservedSize() const; /// Incl. zero for element at [0]. - - c_iter Begin() const; /// @return location of index 1, because 0 is always empty. - c_iter BeginUnreserved() const; - c_iter End() const; - - private: - // DATA - impl_type aData; - uintt nReservedSize; -}; - - - -// IMPLEMENTATION - -template <class ENTITY> -Base<ENTITY>::Base(uintt i_nrOfReservedItems) - : aData(i_nrOfReservedItems, 0), - nReservedSize(i_nrOfReservedItems) -{ -} - -template <class ENTITY> -Base<ENTITY>::~Base() -{ - csv::erase_container_of_heap_ptrs(aData); -} - - -template <class ENTITY> -ENTITY * -Base<ENTITY>::operator[](uintt i_index) const -{ - if (i_index < aData.size()) - return aData[i_index]; - return 0; -} - -template <class ENTITY> -uintt -Base<ENTITY>::Add_Entity(DYN ENTITY & pass_newEntity) -{ - aData.push_back(&pass_newEntity); - return aData.size() - 1; -} - -template <class ENTITY> -DYN ENTITY * -Base<ENTITY>::Set_Entity( uintt i_index, - DYN ENTITY & pass_newEntity ) -{ - csv_assert(i_index != 0 AND i_index < aData.size()); - - Dyn<ENTITY> - ret(aData[i_index]); - aData[i_index] = &pass_newEntity; - return ret.Release(); -} - -template <class ENTITY> -uintt -Base<ENTITY>::Size() const -{ - return aData.size(); -} - -template <class ENTITY> -uintt -Base<ENTITY>::ReservedSize() const -{ - return nReservedSize; -} - -template <class ENTITY> -typename Base<ENTITY>::c_iter -Base<ENTITY>::Begin() const -{ - return aData.begin() + 1; -} - -template <class ENTITY> -typename Base<ENTITY>::c_iter -Base<ENTITY>::BeginUnreserved() const -{ - return aData.begin() + nReservedSize; -} - -template <class ENTITY> -typename Base<ENTITY>::c_iter -Base<ENTITY>::End() const -{ - return aData.end(); -} - - - - -} // namespace stg -} // namespace ary -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/store/s_iterator.hxx b/autodoc/source/ary/inc/store/s_iterator.hxx deleted file mode 100644 index 1e5bd488449c..000000000000 --- a/autodoc/source/ary/inc/store/s_iterator.hxx +++ /dev/null @@ -1,231 +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 ARY_STORE_S_ITERATOR_HXX -#define ARY_STORE_S_ITERATOR_HXX - -// USED SERVICES -#include <ary/getncast.hxx> -#include "s_base.hxx" - - - - -namespace ary -{ -namespace stg -{ - - -template <class> class const_iterator; -template <class, class> class const_filter_iterator; - - -/** A non-const iterator that runs on a ->Storage<>. - - @collab Storage<> -*/ -template <class ENTITY> -class iterator : public std::iterator<std::forward_iterator_tag, ENTITY> -{ - public: - typedef iterator<ENTITY> self; - typedef typename Base<ENTITY>::impl_type impl_container; - typedef typename impl_container::const_iterator impl_type; - - // OPERATORS - iterator() - : itImpl() {} - explicit iterator( - impl_type i_impl) - : itImpl(i_impl) {} - ~iterator() {} - - bool operator==( - self i_other ) const - { return itImpl == i_other.itImpl; } - bool operator!=( - self i_other ) const - { return itImpl != i_other.itImpl; } - ENTITY & operator*() const { csv_assert(*itImpl != 0); - return *(*itImpl); } - self & operator++() { ++itImpl; return *this; } - self operator++(int) { return self(itImpl++); } - - private: - friend class const_iterator<ENTITY>; // For const_iterator(iterator); - impl_type ImplIterator() const { return itImpl; } - - // DATA - impl_type itImpl; -}; - - -/** A const iterator that runs on a ->Storage<>. - - @collab Storage<> -*/ -template <class ENTITY> -class const_iterator : - public std::iterator<std::forward_iterator_tag, const ENTITY> -{ - public: - typedef const_iterator<ENTITY> self; - typedef typename Base<ENTITY>::impl_type impl_container; - typedef typename impl_container::const_iterator impl_type; - - // OPERATORS - const_iterator() - : itImpl() {} - explicit const_iterator( - impl_type i_impl) - : itImpl(i_impl) {} - const_iterator( // implicit conversions allowed - ::ary::stg::iterator<ENTITY> i_it ) - : itImpl(i_it.ImplIterator()) {} - ~const_iterator() {} - - bool operator==( - self i_other ) const - { return itImpl == i_other.itImpl; } - bool operator!=( - self i_other ) const - { return itImpl != i_other.itImpl; } - const ENTITY & operator*() const { csv_assert(*itImpl != 0); - return *(*itImpl); } - self & operator++() { ++itImpl; return *this; } - self operator++(int) { return self(itImpl++); } - - private: - // DATA - impl_type itImpl; -}; - - - - - -/** A non const iterator that runs on a ->Storage<> and returns only - the elements of a specific type. - - @tpl ENTITY - The element type of the ->Storage<> - - @tpl FILTER - The actual type of the returned items. FILTER needs to be derived from - ENTITY. - - @collab Storage<> -*/ -template <class ENTITY, class FILTER> -class filter_iterator : - public std::iterator<std::forward_iterator_tag, FILTER> -{ - public: - typedef filter_iterator<ENTITY,FILTER> self; - typedef ::ary::stg::iterator<ENTITY> impl_type; - - // OPERATORS - filter_iterator() - : itCur() {} - explicit filter_iterator( - impl_type i_cur ) - : itCur(i_cur) {} - ~filter_iterator() {} - - bool operator==( - self i_other ) const - { return itCur == i_other.itCur; } - bool operator!=( - self i_other ) const - { return itCur != i_other.itCur; } - FILTER & operator*() const { csv_assert(IsValid()); - return static_cast< FILTER& >(*itCur); } - self & operator++() { ++itCur; - return *this; } - self operator++(int) { return self(itCur++); } - bool IsValid() const { return ary::is_type<FILTER>(*itCur); } - - private: - friend class const_filter_iterator<ENTITY,FILTER>; // For const_filter_iterator(filter_iterator); - impl_type ImplCur() const { return itCur; } - - // DATA - impl_type itCur; -}; - - -/** A const iterator that runs on a ->Storage<> and returns only - the elements of a specific type. - - @tpl ENTITY - The element type of the ->Storage<> - - @tpl FILTER - The actual type of the returned items. FILTER needs to be derived from - ENTITY. - - @collab Storage<> -*/ -template <class ENTITY, class FILTER> -class const_filter_iterator : - public std::iterator<std::forward_iterator_tag, const FILTER> -{ - public: - typedef const_filter_iterator<ENTITY,FILTER> self; - typedef ::ary::stg::const_iterator<ENTITY> impl_type; - - // OPERATORS - const_filter_iterator() - : itCur() {} - explicit const_filter_iterator( - impl_type i_cur ) - : itCur(i_cur) {} - explicit const_filter_iterator( // implicit conversions allowed - filter_iterator<ENTITY,FILTER> - i_it ) - : itCur(i_it.ImplCur()) {} - ~const_filter_iterator() - {} - bool operator==( - self i_other ) const - { return itCur == i_other.itCur; } - bool operator!=( - self i_other ) const - { return itCur != i_other.itCur; } - const FILTER & operator*() const { csv_assert(IsValid()); - return static_cast< const FILTER& >(*itCur); } - self & operator++() { ++itCur; - return *this; } - self operator++(int) { return self(itCur++); } - bool IsValid() const { return ary::is_type<FILTER>(*itCur); } - - private: - // DATA - impl_type itCur; -}; - - - - -} // namespace stg -} // namespace ary -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/autodoc/source/ary/inc/store/s_storage.hxx b/autodoc/source/ary/inc/store/s_storage.hxx deleted file mode 100644 index 4bb393b48f93..000000000000 --- a/autodoc/source/ary/inc/store/s_storage.hxx +++ /dev/null @@ -1,288 +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 ARY_STORE_S_STORAGE_HXX -#define ARY_STORE_S_STORAGE_HXX - -// USED SERVICES -#include <ary/types.hxx> -#include "s_iterator.hxx" - - - - -namespace ary -{ -namespace stg -{ - - -/** The storage unit of one class of commomly stored repository - entities. -*/ -template <class ENTITY> -class Storage -{ - public: - typedef Base<ENTITY> container_type; - typedef ary::TypedId<ENTITY> key_type; - typedef stg::const_iterator<ENTITY> c_iter; - typedef stg::iterator<ENTITY> iter; - - // LIFECYCLE - virtual ~Storage() {} - - // OPERATORS - const ENTITY & operator[]( - key_type i_id ) const; - ENTITY & operator[]( - key_type i_id ); - const ENTITY & operator[]( - Rid i_index ) const; - ENTITY & operator[]( - Rid i_index ); - // OPERATIONS - /// Sets the id of the new entity. - key_type Store_Entity( - DYN ENTITY & pass_newEntity ); - /// Sets the id of the new entity. - void Set_Reserved( - uintt i_index, - DYN ENTITY & pass_newEntity ); - /// Sets the id of the new entity. - void Replace_Entity( - key_type i_index, - DYN ENTITY & pass_newEntity ); - // INQUIRY - bool Exists( - key_type i_id ) const; - bool Exists( - Rid i_index ) const; - - c_iter Begin() const; - c_iter BeginUnreserved() const; - c_iter End() const; - - // ACCESS - iter Begin(); - iter BeginUnreserved(); - iter End(); - - protected: - Storage( - uintt i_nrOfReservedItems ); - private: - // DATA - container_type aData; -}; - - - - - - -// IMPLEMENTATION - -// Used later, so implemented first. -template <class ENTITY> -inline bool -Storage<ENTITY>::Exists(Rid i_index) const -{ - return 0 < i_index AND i_index < aData.Size(); -} - -template <class ENTITY> -inline bool -Storage<ENTITY>::Exists(key_type i_id) const -{ - return Exists(i_id.Value()); -} - -template <class ENTITY> -inline const ENTITY & -Storage<ENTITY>::operator[](Rid i_index) const -{ - csv_assert(Exists(i_index)); - return * aData[i_index]; -} - -template <class ENTITY> -inline ENTITY & -Storage<ENTITY>::operator[](Rid i_index) -{ - csv_assert(Exists(i_index)); - return * aData[i_index]; -} - -template <class ENTITY> -inline const ENTITY & -Storage<ENTITY>::operator[](key_type i_id) const -{ - return operator[](i_id.Value()); -} - -template <class ENTITY> -inline ENTITY & -Storage<ENTITY>::operator[](key_type i_id) -{ - return operator[](i_id.Value()); -} - -template <class ENTITY> -typename Storage<ENTITY>::key_type -Storage<ENTITY>::Store_Entity(DYN ENTITY & pass_newEntity) -{ - csv_assert( aData.Size() >= aData.ReservedSize() ); - Rid - ret( aData.Add_Entity(pass_newEntity) ); - pass_newEntity.Set_Id(ret); - return key_type(ret); -} - -template <class ENTITY> -void -Storage<ENTITY>::Set_Reserved(uintt i_index, - DYN ENTITY & pass_newEntity) -{ - // 0 must not be used. - csv_assert( i_index != 0 ); - // Make sure, i_index actually is the id of a reserved item. - csv_assert( i_index < aData.ReservedSize() ); - - // If there was a previous entity, it will be deleted by - // the destructor of pOldEntity. - Dyn<ENTITY> - pOldEntity(aData.Set_Entity(i_index, pass_newEntity)); - pass_newEntity.Set_Id(i_index); -} - -template <class ENTITY> -void -Storage<ENTITY>::Replace_Entity( key_type i_index, - DYN ENTITY & pass_newEntity ) -{ - uintt - nIndex = i_index.Value(); - // Make sure, i_index actually is the id of an existing, - // non reserved entity. - csv_assert( csv::in_range(aData.ReservedSize(), nIndex, aData.Size()) ); - - // If there was a previous entity, it will be deleted by - // the destructor of pOldEntity. - Dyn<ENTITY> - pOldEntity(aData.Set_Entity(nIndex, pass_newEntity)); - pass_newEntity.Set_Id(nIndex); -} - -template <class ENTITY> -inline -typename Storage<ENTITY>::c_iter -Storage<ENTITY>::Begin() const -{ - return c_iter(aData.Begin()); -} - -template <class ENTITY> -inline -typename Storage<ENTITY>::c_iter -Storage<ENTITY>::BeginUnreserved() const -{ - return c_iter(aData.BeginUnreserved()); -} - -template <class ENTITY> -inline -typename Storage<ENTITY>::c_iter -Storage<ENTITY>::End() const -{ - return c_iter(aData.End()); -} - -template <class ENTITY> -inline -typename Storage<ENTITY>::iter -Storage<ENTITY>::Begin() -{ - return iter(aData.Begin()); -} - -template <class ENTITY> -inline -typename Storage<ENTITY>::iter -Storage<ENTITY>::BeginUnreserved() -{ - return iter(aData.BeginUnreserved()); -} - -template <class ENTITY> -inline -typename Storage<ENTITY>::iter -Storage<ENTITY>::End() -{ - return iter(aData.End()); -} - -template <class ENTITY> -inline -Storage<ENTITY>::Storage(uintt i_nrOfReservedItems) - : aData(i_nrOfReservedItems) -{ - // Make sure Rid and uintt are the same type, because - // the interface of this uses Rid, but the interface of - // container_type uses uintt. - csv_assert( sizeof(uintt) == sizeof(Rid) ); -} - - - - -// HELPER FUNCTIONS - -/** @return 0, if data are not there. -*/ -template <class ENTITY> -inline const ENTITY * -Search( const Storage<ENTITY> & i_storage, - Rid i_id ) -{ - if (NOT i_storage.Exists(i_id)) - return 0; - return &i_storage[i_id]; -} - -/** @return 0, if data are not there. -*/ -template <class ENTITY> -inline ENTITY * -SearchAccess( const Storage<ENTITY> & i_storage, - Rid i_id ) -{ - if (NOT i_storage.Exists(i_id)) - return 0; - return &i_storage[i_id]; -} - - - - -} // namespace stg -} // namespace ary -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |