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_LOC_TRAITS_HXX 29 #define ARY_LOC_TRAITS_HXX 30 31 // USED SERVICES 32 // BASE CLASSES 33 // COMPONENTS 34 // PARAMETERS 35 #include <ary/loc/loc_types4loc.hxx> 36 37 38 namespace ary 39 { 40 namespace symtree 41 { 42 template <class> class Node; 43 } 44 } 45 46 47 48 49 namespace ary 50 { 51 namespace loc 52 { 53 54 55 56 /** Basic traits for derived ones of ->LocationEntity. 57 */ 58 struct Le_Traits 59 { 60 typedef LocationEntity entity_base_type; 61 typedef Le_id id_type; 62 63 static entity_base_type & 64 EntityOf_( 65 id_type i_id ); 66 }; 67 68 69 /** An instance of SYMBOL_TRAITS for ->::ary::symtree::Node. 70 71 @see ::ary::symtree::Node 72 */ 73 struct LeNode_Traits : public Le_Traits 74 { 75 static symtree::Node<LeNode_Traits> * 76 NodeOf_( 77 entity_base_type & i_entity ); 78 79 static entity_base_type * 80 ParentOf_( 81 const entity_base_type & 82 i_entity ); 83 template <class KEY> 84 static id_type Search_( 85 const entity_base_type & 86 i_entity, 87 const KEY & i_localKey ); 88 }; 89 90 91 92 /** An instance of COMPARE for ->::ary::SortedIds<>. 93 94 @see ::ary::SortedIds<> 95 */ 96 struct Le_Compare : public Le_Traits 97 { 98 typedef String key_type; 99 100 static const key_type & 101 KeyOf_( 102 const entity_base_type & 103 i_entity ); 104 static bool Lesser_( 105 const key_type & i_1, 106 const key_type & i_2 ); 107 }; 108 109 110 111 112 113 } // namespace loc 114 } // namespace ary 115 #endif 116