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