1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 #ifndef ARY_SORTED_IDSET_HXX 29 #define ARY_SORTED_IDSET_HXX 30 31 32 33 // USED SERVICES 34 // BASE CLASSES 35 // COMPONENTS 36 #include <set> 37 // PARAMETERS 38 #include "csi_impl.hxx" 39 40 41 template <class XY> class SortedIdSet; 42 43 class Interface_2s 44 { 45 public: 46 /// Checks for double occurences 47 void Add_ExportingService( 48 Ce_id i_nId ); 49 void Get_ExportingServices( 50 Dyn_StdConstIterator<Ce_id> & 51 o_rResult ) const; 52 private: 53 Dyn<SortedIdSet> pExportingServices; 54 }; 55 56 57 58 namespace ary 59 { 60 61 template <class TYPES> 62 class SortedIdSet 63 { 64 public: 65 typedef typename TYPES::element_type element; 66 typedef typename TYPES::sort_type sorter; 67 typedef typename TYPES::find_type finder; 68 69 SortedIdSet( 70 const finder & i_rFinder ) 71 : aSorter(i_rFinder), 72 aData(aSorter) {} 73 ~SortedIdSet() {} 74 75 void Get_Begin( 76 Dyn_StdConstIterator<element> & 77 o_rResult ) 78 { o_rResult = new SCI_Set<FINDER>(aData); } 79 void Add( 80 const element & i_rElement ) 81 { aData.insert(i_rElement); } 82 83 private: 84 typedef std::set<element, sorter> Set; 85 86 // DATA 87 sorter aSorter; 88 Set aData; 89 }; 90 91 92 } // namespace ary 93 94 95 96 #endif 97 98