merge the formfield patch from ooo-build
[ooovba.git] / autodoc / inc / ary / cpp / c_traits.hxx
blob58497ad4b76b0ef1f1a965476d37af8cb4d451ff
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: c_traits.hxx,v $
10 * $Revision: 1.3 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 #ifndef ARY_CPP_C_TRAITS_HXX
32 #define ARY_CPP_C_TRAITS_HXX
36 // USED SERVICES
37 // BASE CLASSES
38 // OTHER
39 #include <ary/cpp/c_types4cpp.hxx>
43 namespace ary
45 namespace symtree
47 template <class X> class Node;
54 namespace ary
56 namespace cpp
60 /** Basic traits for derived ones of ->CodeEntity.
62 struct Ce_Traits
64 typedef CodeEntity entity_base_type;
65 typedef Ce_id id_type;
67 static entity_base_type &
68 EntityOf_(
69 id_type i_id );
73 /** An instance of SYMBOL_TRAITS for ->::ary::SortedIds<>.
75 @see ::ary::SortedIds<>
77 struct CeNode_Traits : public Ce_Traits
79 static const symtree::Node<CeNode_Traits> *
80 NodeOf_(
81 const entity_base_type &
82 i_entity );
83 static symtree::Node<CeNode_Traits> *
84 NodeOf_(
85 entity_base_type & i_entity );
86 static entity_base_type *
87 ParentOf_(
88 const entity_base_type &
89 i_entity );
90 template <class KEY>
91 static id_type Search_(
92 const entity_base_type &
93 i_entity,
94 const KEY & i_localKey );
98 /** An instance of COMPARE for ->::ary::SortedIds<>.
100 @see ::ary::SortedIds<>
102 struct Ce_Compare : public Ce_Traits
104 typedef String key_type;
106 static const key_type &
107 KeyOf_(
108 const entity_base_type &
109 i_entity );
110 static bool Lesser_(
111 const key_type & i_1,
112 const key_type & i_2 );
115 /** An instance of COMPARE for ->::ary::SortedIds<>.
117 @see ::ary::SortedIds<>
119 struct Ce_GlobalCompare : public Ce_Traits
121 typedef entity_base_type key_type;
123 static const key_type &
124 KeyOf_(
125 const entity_base_type &
126 i_entity )
127 { return i_entity; }
128 static bool Lesser_(
129 const key_type & i_1,
130 const key_type & i_2 );
134 /** Basic traits for derivd ones of ->DefineEntity.
136 struct Def_Traits
138 typedef DefineEntity entity_base_type;
139 typedef De_id id_type;
141 static entity_base_type &
142 EntityOf_(
143 id_type i_id );
147 /** An instance of COMPARE for ->::ary::SortedIds<>.
149 @see ::ary::SortedIds<>
151 struct Def_Compare : public Def_Traits
153 typedef String key_type;
155 static const key_type &
156 KeyOf_(
157 const entity_base_type &
158 i_entity );
159 static bool Lesser_(
160 const key_type & i_1,
161 const key_type & i_2 );
164 /** Basic traits for derivd ones of ->Type.
166 struct Type_Traits
168 typedef Type entity_base_type;
169 typedef Type_id id_type;
171 static entity_base_type &
172 EntityOf_(
173 id_type i_id );
176 /** An instance of COMPARE for ->::ary::SortedIds<>.
178 @see ::ary::SortedIds<>
180 struct UsedType_Compare : public Type_Traits
182 typedef UsedType key_type;
184 static const key_type &
185 KeyOf_(
186 const entity_base_type &
187 i_entity );
188 static bool Lesser_(
189 const key_type & i_1,
190 const key_type & i_2 );
198 // IMPLEMENTATION
200 /// Implementation helper for ->CeNode_Traits::Search_ .
201 Ce_id CeNode_Search(
202 const CodeEntity & i_entity,
203 const String & i_localKey );
206 template <class KEY>
207 Ce_Traits::id_type
208 CeNode_Traits::Search_( const entity_base_type & i_entity,
209 const KEY & i_localKey )
211 return CeNode_Search(i_entity, i_localKey);
217 } // namespace cpp
218 } // namespace ary
219 #endif