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 #include <precomp.h>
23 #include <icprivow.hxx>
24 
25 
26 // NOT FULLY DEFINED SERVICES
27 #include <ary/cpp/c_namesp.hxx>
28 #include <ary/cpp/c_class.hxx>
29 
30 
31 
32 namespace cpp
33 {
34 
35 
36 
37 //******************          Owner_Namespace          ********************//
Owner_Namespace()38 Owner_Namespace::Owner_Namespace()
39     :   pScope(0)
40 {
41 }
42 
43 void
SetAnotherNamespace(ary::cpp::Namespace & io_rScope)44 Owner_Namespace::SetAnotherNamespace( ary::cpp::Namespace & io_rScope )
45 {
46     pScope = &io_rScope;
47 }
48 
49 bool
HasClass(const String & i_sLocalName)50 Owner_Namespace::HasClass( const String & i_sLocalName )
51 {
52     return pScope->Search_LocalClass(i_sLocalName).IsValid();
53 }
54 
55 void
do_Add_Class(const String & i_sLocalName,Cid i_nId)56 Owner_Namespace::do_Add_Class( const String  &     i_sLocalName,
57                                Cid                 i_nId )
58 {
59     csv_assert(pScope != 0);
60     pScope->Add_LocalClass(i_sLocalName, i_nId);
61 }
62 
63 void
do_Add_Enum(const String & i_sLocalName,Cid i_nId)64 Owner_Namespace::do_Add_Enum( const String  &     i_sLocalName,
65                               Cid                 i_nId )
66 {
67     csv_assert(pScope != 0);
68     pScope->Add_LocalEnum(i_sLocalName, i_nId);
69 }
70 
71 void
do_Add_Typedef(const String & i_sLocalName,Cid i_nId)72 Owner_Namespace::do_Add_Typedef( const String  &     i_sLocalName,
73                                  Cid                 i_nId )
74 {
75     csv_assert(pScope != 0);
76     pScope->Add_LocalTypedef(i_sLocalName, i_nId);
77 }
78 
79 void
do_Add_Operation(const String & i_sLocalName,Cid i_nId,bool)80 Owner_Namespace::do_Add_Operation( const String  &     i_sLocalName,
81                                    Cid                 i_nId,
82                                    bool                )
83 {
84     csv_assert(pScope != 0);
85     pScope->Add_LocalOperation(i_sLocalName, i_nId);
86 }
87 
88 void
do_Add_Variable(const String & i_sLocalName,Cid i_nId,bool i_bIsConst,bool)89 Owner_Namespace::do_Add_Variable( const String  &     i_sLocalName,
90                                   Cid                 i_nId,
91                                   bool                i_bIsConst,
92                                   bool                )
93 {
94     csv_assert(pScope != 0);
95     if (i_bIsConst)
96         pScope->Add_LocalConstant(i_sLocalName, i_nId);
97     else
98         pScope->Add_LocalVariable(i_sLocalName, i_nId);
99 }
100 
101 
102 Cid
inq_CeId() const103 Owner_Namespace::inq_CeId() const
104 {
105     csv_assert(pScope != 0);
106     return pScope->CeId();
107 }
108 
109 
110 //******************            Owner_Class          ********************//
111 
Owner_Class()112 Owner_Class::Owner_Class()
113     :   pScope(0)
114 {
115 }
116 
117 void
SetAnotherClass(ary::cpp::Class & io_rScope)118 Owner_Class::SetAnotherClass( ary::cpp::Class & io_rScope )
119 {
120     pScope = &io_rScope;
121 }
122 
123 bool
HasClass(const String &)124 Owner_Class::HasClass( const String  & )
125 {
126     return false;
127 }
128 
129 void
do_Add_Class(const String & i_sLocalName,Cid i_nId)130 Owner_Class::do_Add_Class( const String  &     i_sLocalName,
131                                Cid                 i_nId )
132 {
133     csv_assert(pScope != 0);
134     pScope->Add_LocalClass(i_sLocalName, i_nId);
135 }
136 
137 void
do_Add_Enum(const String & i_sLocalName,Cid i_nId)138 Owner_Class::do_Add_Enum( const String  &     i_sLocalName,
139                               Cid                 i_nId )
140 {
141     csv_assert(pScope != 0);
142     pScope->Add_LocalEnum(i_sLocalName, i_nId);
143 }
144 
145 void
do_Add_Typedef(const String & i_sLocalName,Cid i_nId)146 Owner_Class::do_Add_Typedef( const String  &     i_sLocalName,
147                              Cid                 i_nId )
148 {
149     csv_assert(pScope != 0);
150     pScope->Add_LocalTypedef(i_sLocalName, i_nId);
151 }
152 
153 void
do_Add_Operation(const String & i_sLocalName,Cid i_nId,bool i_bIsStatic)154 Owner_Class::do_Add_Operation( const String  &      i_sLocalName,
155                                Cid                  i_nId,
156                                bool                 i_bIsStatic )
157 {
158     csv_assert(pScope != 0);
159     if (i_bIsStatic)
160         pScope->Add_LocalStaticOperation(i_sLocalName, i_nId);
161     else
162         pScope->Add_LocalOperation(i_sLocalName, i_nId);
163 }
164 
165 void
do_Add_Variable(const String & i_sLocalName,Cid i_nId,bool,bool i_bIsStatic)166 Owner_Class::do_Add_Variable( const String  &     i_sLocalName,
167                               Cid                 i_nId,
168                               bool                ,
169                               bool                i_bIsStatic )
170 {
171     csv_assert(pScope != 0);
172     if (i_bIsStatic)
173         pScope->Add_LocalStaticData(i_sLocalName, i_nId);
174     else
175         pScope->Add_LocalData(i_sLocalName, i_nId);
176 }
177 
178 Cid
inq_CeId() const179 Owner_Class::inq_CeId() const
180 {
181     csv_assert(pScope != 0);
182     return pScope->CeId();
183 }
184 
185 
186 }   // namespace cpp
187