1*1c78a5d6SAndrew Rist /**************************************************************
2cdf0e10cSrcweir *
3*1c78a5d6SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one
4*1c78a5d6SAndrew Rist * or more contributor license agreements. See the NOTICE file
5*1c78a5d6SAndrew Rist * distributed with this work for additional information
6*1c78a5d6SAndrew Rist * regarding copyright ownership. The ASF licenses this file
7*1c78a5d6SAndrew Rist * to you under the Apache License, Version 2.0 (the
8*1c78a5d6SAndrew Rist * "License"); you may not use this file except in compliance
9*1c78a5d6SAndrew Rist * with the License. You may obtain a copy of the License at
10*1c78a5d6SAndrew Rist *
11*1c78a5d6SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0
12*1c78a5d6SAndrew Rist *
13*1c78a5d6SAndrew Rist * Unless required by applicable law or agreed to in writing,
14*1c78a5d6SAndrew Rist * software distributed under the License is distributed on an
15*1c78a5d6SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16*1c78a5d6SAndrew Rist * KIND, either express or implied. See the License for the
17*1c78a5d6SAndrew Rist * specific language governing permissions and limitations
18*1c78a5d6SAndrew Rist * under the License.
19*1c78a5d6SAndrew Rist *
20*1c78a5d6SAndrew Rist *************************************************************/
21*1c78a5d6SAndrew Rist
22*1c78a5d6SAndrew Rist
23cdf0e10cSrcweir
24cdf0e10cSrcweir #ifndef ARY_CPP_INPCONTX_HXX
25cdf0e10cSrcweir #define ARY_CPP_INPCONTX_HXX
26cdf0e10cSrcweir
27cdf0e10cSrcweir
28cdf0e10cSrcweir
29cdf0e10cSrcweir // USED SERVICES
30cdf0e10cSrcweir // BASE CLASSES
31cdf0e10cSrcweir // OTHER
32cdf0e10cSrcweir #include <ary/cpp/c_types4cpp.hxx>
33cdf0e10cSrcweir
34cdf0e10cSrcweir
35cdf0e10cSrcweir
36cdf0e10cSrcweir namespace ary
37cdf0e10cSrcweir {
38cdf0e10cSrcweir namespace loc
39cdf0e10cSrcweir {
40cdf0e10cSrcweir class File;
41cdf0e10cSrcweir }
42cdf0e10cSrcweir namespace cpp
43cdf0e10cSrcweir {
44cdf0e10cSrcweir class Gate;
45cdf0e10cSrcweir class Namespace;
46cdf0e10cSrcweir class Class;
47cdf0e10cSrcweir class Enum;
48cdf0e10cSrcweir
49cdf0e10cSrcweir class OperationSignature;
50cdf0e10cSrcweir }
51cdf0e10cSrcweir }
52cdf0e10cSrcweir
53cdf0e10cSrcweir
54cdf0e10cSrcweir
55cdf0e10cSrcweir namespace ary
56cdf0e10cSrcweir {
57cdf0e10cSrcweir namespace cpp
58cdf0e10cSrcweir {
59cdf0e10cSrcweir
60cdf0e10cSrcweir
61cdf0e10cSrcweir /** The context of a CodeEntity, which is going to be stored in the
62cdf0e10cSrcweir repository. The information is used mainly by ->ary::cpp::CeAdmin.
63cdf0e10cSrcweir */
64cdf0e10cSrcweir class InputContext
65cdf0e10cSrcweir {
66cdf0e10cSrcweir public:
67cdf0e10cSrcweir class Owner
68cdf0e10cSrcweir {
69cdf0e10cSrcweir public:
70cdf0e10cSrcweir // LIFECYCLE
~Owner()71cdf0e10cSrcweir virtual ~Owner() {}
72cdf0e10cSrcweir
73cdf0e10cSrcweir // OPERATIONS
74cdf0e10cSrcweir /// Adds Class data to current inner scope (Namespace or Class).
75cdf0e10cSrcweir void Add_Class(
76cdf0e10cSrcweir const String & i_sLocalName,
77cdf0e10cSrcweir Cid i_nId );
78cdf0e10cSrcweir /// Adds Enum data to current inner scope (Namespace or Class).
79cdf0e10cSrcweir void Add_Enum(
80cdf0e10cSrcweir const String & i_sLocalName,
81cdf0e10cSrcweir Cid i_nId );
82cdf0e10cSrcweir /// Adds Typedef data to current inner scope (Namespace or Class).
83cdf0e10cSrcweir void Add_Typedef(
84cdf0e10cSrcweir const String & i_sLocalName,
85cdf0e10cSrcweir Cid i_nId );
86cdf0e10cSrcweir /// Adds Operation data to current inner scope (Namespace or Class).
87cdf0e10cSrcweir void Add_Operation(
88cdf0e10cSrcweir const String & i_sLocalName,
89cdf0e10cSrcweir Cid i_nId,
90cdf0e10cSrcweir bool i_bIsStaticMember ); /// True only for static class members.
91cdf0e10cSrcweir /// Adds Variable data to current inner scope (Namespace or Class).
92cdf0e10cSrcweir void Add_Variable(
93cdf0e10cSrcweir const String & i_sLocalName,
94cdf0e10cSrcweir Cid i_nId,
95cdf0e10cSrcweir bool i_bIsConst,
96cdf0e10cSrcweir bool i_bIsStaticMember ); /// True only for static class members.
97cdf0e10cSrcweir // INQUIRY
98cdf0e10cSrcweir Ce_id CeId() const;
99cdf0e10cSrcweir
100cdf0e10cSrcweir /** @attention Must only be used by ary::cpp::GatePilot!
101cdf0e10cSrcweir Will work nowhere else!
102cdf0e10cSrcweir */
103cdf0e10cSrcweir virtual bool HasClass(
104cdf0e10cSrcweir const String & i_sLocalName ) = 0;
105cdf0e10cSrcweir private:
106cdf0e10cSrcweir virtual void do_Add_Class(
107cdf0e10cSrcweir const String & i_sLocalName,
108cdf0e10cSrcweir Cid i_nId ) = 0;
109cdf0e10cSrcweir virtual void do_Add_Enum(
110cdf0e10cSrcweir const String & i_sLocalName,
111cdf0e10cSrcweir Cid i_nId ) = 0;
112cdf0e10cSrcweir virtual void do_Add_Typedef(
113cdf0e10cSrcweir const String & i_sLocalName,
114cdf0e10cSrcweir Cid i_nId ) = 0;
115cdf0e10cSrcweir virtual void do_Add_Operation(
116cdf0e10cSrcweir const String & i_sLocalName,
117cdf0e10cSrcweir Cid i_nId,
118cdf0e10cSrcweir bool i_bIsStatic ) = 0;
119cdf0e10cSrcweir virtual void do_Add_Variable(
120cdf0e10cSrcweir const String & i_sLocalName,
121cdf0e10cSrcweir Cid i_nId,
122cdf0e10cSrcweir bool i_bIsConst,
123cdf0e10cSrcweir bool i_bIsStatic ) = 0;
124cdf0e10cSrcweir virtual Ce_id inq_CeId() const = 0;
125cdf0e10cSrcweir };
126cdf0e10cSrcweir
127cdf0e10cSrcweir // LIFECYCLE
~InputContext()128cdf0e10cSrcweir virtual ~InputContext() {}
129cdf0e10cSrcweir
130cdf0e10cSrcweir // OPERATIONS
131cdf0e10cSrcweir
132cdf0e10cSrcweir // INQUIRY
133cdf0e10cSrcweir loc::File & CurFile() const;
134cdf0e10cSrcweir
135cdf0e10cSrcweir Namespace & CurNamespace() const;
136cdf0e10cSrcweir Class * CurClass() const;
137cdf0e10cSrcweir Enum * CurEnum() const;
138cdf0e10cSrcweir
139cdf0e10cSrcweir Owner & CurOwner() const;
140cdf0e10cSrcweir E_Protection CurProtection() const;
141cdf0e10cSrcweir
142cdf0e10cSrcweir private:
143cdf0e10cSrcweir virtual loc::File & inq_CurFile() const = 0;
144cdf0e10cSrcweir
145cdf0e10cSrcweir virtual Namespace & inq_CurNamespace() const = 0;
146cdf0e10cSrcweir virtual Class * inq_CurClass() const = 0;
147cdf0e10cSrcweir virtual Enum * inq_CurEnum() const = 0;
148cdf0e10cSrcweir
149cdf0e10cSrcweir virtual Owner & inq_CurOwner() const = 0;
150cdf0e10cSrcweir virtual E_Protection
151cdf0e10cSrcweir inq_CurProtection() const = 0;
152cdf0e10cSrcweir };
153cdf0e10cSrcweir
154cdf0e10cSrcweir
155cdf0e10cSrcweir
156cdf0e10cSrcweir
157cdf0e10cSrcweir // IMPLEMENTATION
158cdf0e10cSrcweir inline loc::File &
CurFile() const159cdf0e10cSrcweir InputContext::CurFile() const
160cdf0e10cSrcweir { return inq_CurFile(); }
161cdf0e10cSrcweir
162cdf0e10cSrcweir inline Namespace &
CurNamespace() const163cdf0e10cSrcweir InputContext::CurNamespace() const
164cdf0e10cSrcweir { return inq_CurNamespace(); }
165cdf0e10cSrcweir inline Class *
CurClass() const166cdf0e10cSrcweir InputContext::CurClass() const
167cdf0e10cSrcweir { return inq_CurClass(); }
168cdf0e10cSrcweir inline Enum *
CurEnum() const169cdf0e10cSrcweir InputContext::CurEnum() const
170cdf0e10cSrcweir { return inq_CurEnum(); }
171cdf0e10cSrcweir inline InputContext::Owner &
CurOwner() const172cdf0e10cSrcweir InputContext::CurOwner() const
173cdf0e10cSrcweir { return inq_CurOwner(); }
174cdf0e10cSrcweir inline E_Protection
CurProtection() const175cdf0e10cSrcweir InputContext::CurProtection() const
176cdf0e10cSrcweir { return inq_CurProtection(); }
177cdf0e10cSrcweir
178cdf0e10cSrcweir
179cdf0e10cSrcweir inline void
Add_Class(const String & i_sLocalName,Cid i_nId)180cdf0e10cSrcweir InputContext::Owner::Add_Class( const String & i_sLocalName,
181cdf0e10cSrcweir Cid i_nId )
182cdf0e10cSrcweir { do_Add_Class(i_sLocalName, i_nId); }
183cdf0e10cSrcweir inline void
Add_Enum(const String & i_sLocalName,Cid i_nId)184cdf0e10cSrcweir InputContext::Owner::Add_Enum( const String & i_sLocalName,
185cdf0e10cSrcweir Cid i_nId )
186cdf0e10cSrcweir { do_Add_Enum(i_sLocalName, i_nId); }
187cdf0e10cSrcweir inline void
Add_Typedef(const String & i_sLocalName,Cid i_nId)188cdf0e10cSrcweir InputContext::Owner::Add_Typedef( const String & i_sLocalName,
189cdf0e10cSrcweir Cid i_nId )
190cdf0e10cSrcweir { do_Add_Typedef(i_sLocalName, i_nId); }
191cdf0e10cSrcweir inline void
Add_Operation(const String & i_sLocalName,Cid i_nId,bool i_bIsStatic)192cdf0e10cSrcweir InputContext::Owner::Add_Operation( const String & i_sLocalName,
193cdf0e10cSrcweir Cid i_nId,
194cdf0e10cSrcweir bool i_bIsStatic )
195cdf0e10cSrcweir { do_Add_Operation( i_sLocalName, i_nId, i_bIsStatic ); }
196cdf0e10cSrcweir inline void
Add_Variable(const String & i_sLocalName,Cid i_nId,bool i_bIsConst,bool i_bIsStatic)197cdf0e10cSrcweir InputContext::Owner::Add_Variable( const String & i_sLocalName,
198cdf0e10cSrcweir Cid i_nId,
199cdf0e10cSrcweir bool i_bIsConst,
200cdf0e10cSrcweir bool i_bIsStatic )
201cdf0e10cSrcweir { do_Add_Variable( i_sLocalName, i_nId, i_bIsConst, i_bIsStatic ); }
202cdf0e10cSrcweir inline Ce_id
CeId() const203cdf0e10cSrcweir InputContext::Owner::CeId() const
204cdf0e10cSrcweir { return inq_CeId(); }
205cdf0e10cSrcweir
206cdf0e10cSrcweir
207cdf0e10cSrcweir
208cdf0e10cSrcweir
209cdf0e10cSrcweir
210cdf0e10cSrcweir } // namespace cpp
211cdf0e10cSrcweir } // namespace ary
212cdf0e10cSrcweir #endif
213