1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 #ifndef ARY_IDL_I_NAMELOOKUP_HXX
25 #define ARY_IDL_I_NAMELOOKUP_HXX
26 
27 // BASE CLASSES
28 #include <ary/idl/i_types4idl.hxx>
29 
30 // USED SERVICES
31 #include <ary/stdconstiter.hxx>
32 #include <ary/itrange.hxx>
33 #include <vector>
34 #include <map>
35 
36 
37 
38 
39 namespace ary
40 {
41 namespace idl
42 {
43 
44 
45 /** This class finds all occurrences in the current language of a
46     name in the repository.
47 */
48 class NameLookup
49 {
50   public:
51     struct NameProperties
52     {
NamePropertiesary::idl::NameLookup::NameProperties53                             NameProperties()
54                                 :   nId(0),
55                                     nClass(0),
56                                     nOwner(0) {}
NamePropertiesary::idl::NameLookup::NameProperties57                             NameProperties(
58                                 Ce_id               i_id,
59                                 ClassId             i_class,
60                                 Ce_id               i_owner )
61                                 :   nId(i_id),
62                                     nClass(i_class),
63                                     nOwner(i_owner) {}
64         Ce_id               nId;
65         ClassId             nClass;
66         Ce_id               nOwner;
67     };
68 
69     /// Map from Name to NameProperties.
70     typedef std::multimap<String, NameProperties>   Map_Names;
71 
72     // LIFECYCLE
73                         NameLookup();
74                         ~NameLookup();
75     // OPERATIONS
76     void                Add_Name(
77                             const String &      i_name,
78                             Ce_id               i_id,
79                             ClassId             i_class,
80                             Ce_id               i_owner );
81   private:
82     // DATA
83     Map_Names           aNames;
84 };
85 
86 
87 
88 
89 }   // namespace idl
90 }   // namespace ary
91 #endif
92