xref: /aoo42x/main/autodoc/inc/ary/cpp/inpcontx.hxx (revision 1c78a5d6)
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_CPP_INPCONTX_HXX
25 #define ARY_CPP_INPCONTX_HXX
26 
27 
28 
29 // USED SERVICES
30 	// BASE CLASSES
31 	// OTHER
32 #include <ary/cpp/c_types4cpp.hxx>
33 
34 
35 
36 namespace ary
37 {
38 namespace loc
39 {
40     class File;
41 }
42 namespace cpp
43 {
44     class Gate;
45     class Namespace;
46     class Class;
47     class Enum;
48 
49     class OperationSignature;
50 }
51 }
52 
53 
54 
55 namespace ary
56 {
57 namespace cpp
58 {
59 
60 
61 /** The context of a CodeEntity, which is going to be stored in the
62     repository. The information is used mainly by ->ary::cpp::CeAdmin.
63 */
64 class InputContext
65 {
66   public:
67     class Owner
68     {
69       public:
70         // LIFECYCLE
~Owner()71         virtual             ~Owner() {}
72 
73         // OPERATIONS
74         /// Adds Class data to current inner scope (Namespace or Class).
75         void                Add_Class(
76                                 const String  &     i_sLocalName,
77                                 Cid                 i_nId );
78         /// Adds Enum data to current inner scope (Namespace or Class).
79         void                Add_Enum(
80                                 const String  &     i_sLocalName,
81                                 Cid                 i_nId );
82         /// Adds Typedef data to current inner scope (Namespace or Class).
83         void                Add_Typedef(
84                                 const String  &     i_sLocalName,
85                                 Cid                 i_nId );
86         /// Adds Operation data to current inner scope (Namespace or Class).
87         void                Add_Operation(
88                                 const String  &     i_sLocalName,
89                                 Cid                 i_nId,
90                                 bool                i_bIsStaticMember );    /// True only for static class members.
91         /// Adds Variable data to current inner scope (Namespace or Class).
92         void                Add_Variable(
93                                 const String  &     i_sLocalName,
94                                 Cid                 i_nId,
95                                 bool                i_bIsConst,
96                                 bool                i_bIsStaticMember );    /// True only for static class members.
97         // INQUIRY
98         Ce_id               CeId() const;
99 
100         /** @attention Must only be used by ary::cpp::GatePilot!
101             Will work nowhere else!
102         */
103         virtual bool        HasClass(
104                                 const String  &     i_sLocalName ) = 0;
105       private:
106         virtual void        do_Add_Class(
107                                 const String  &     i_sLocalName,
108                                 Cid                 i_nId ) = 0;
109         virtual void        do_Add_Enum(
110                                 const String  &     i_sLocalName,
111                                 Cid                 i_nId ) = 0;
112         virtual void        do_Add_Typedef(
113                                 const String  &     i_sLocalName,
114                                 Cid                 i_nId ) = 0;
115         virtual void        do_Add_Operation(
116                                 const String  &     i_sLocalName,
117                                 Cid                 i_nId,
118                                 bool                i_bIsStatic ) = 0;
119         virtual void        do_Add_Variable(
120                                 const String  &     i_sLocalName,
121                                 Cid                 i_nId,
122                                 bool                i_bIsConst,
123                                 bool                i_bIsStatic ) = 0;
124         virtual Ce_id       inq_CeId() const = 0;
125     };
126 
127     // LIFECYCLE
~InputContext()128 	virtual				~InputContext() {}
129 
130     // OPERATIONS
131 
132     // INQUIRY
133     loc::File &         CurFile() const;
134 
135     Namespace &         CurNamespace() const;
136     Class *             CurClass() const;
137     Enum *              CurEnum() const;
138 
139     Owner &             CurOwner() const;
140     E_Protection        CurProtection() const;
141 
142   private:
143     virtual loc::File & inq_CurFile() const = 0;
144 
145     virtual Namespace & inq_CurNamespace() const = 0;
146     virtual Class *     inq_CurClass() const = 0;
147     virtual Enum *      inq_CurEnum() const = 0;
148 
149     virtual Owner &     inq_CurOwner() const = 0;
150     virtual E_Protection
151                         inq_CurProtection() const = 0;
152 };
153 
154 
155 
156 
157 // IMPLEMENTATION
158 inline loc::File &
CurFile() const159 InputContext::CurFile() const
160     { return inq_CurFile(); }
161 
162 inline Namespace &
CurNamespace() const163 InputContext::CurNamespace() const
164     { return inq_CurNamespace(); }
165 inline Class *
CurClass() const166 InputContext::CurClass() const
167     { return inq_CurClass(); }
168 inline Enum *
CurEnum() const169 InputContext::CurEnum() const
170     { return inq_CurEnum(); }
171 inline InputContext::Owner &
CurOwner() const172 InputContext::CurOwner() const
173     { return inq_CurOwner(); }
174 inline E_Protection
CurProtection() const175 InputContext::CurProtection() const
176     { return inq_CurProtection(); }
177 
178 
179 inline void
Add_Class(const String & i_sLocalName,Cid i_nId)180 InputContext::Owner::Add_Class( const String  &     i_sLocalName,
181                                 Cid                 i_nId )
182     { do_Add_Class(i_sLocalName, i_nId); }
183 inline void
Add_Enum(const String & i_sLocalName,Cid i_nId)184 InputContext::Owner::Add_Enum( const String  &     i_sLocalName,
185                                Cid                 i_nId )
186     { do_Add_Enum(i_sLocalName, i_nId); }
187 inline void
Add_Typedef(const String & i_sLocalName,Cid i_nId)188 InputContext::Owner::Add_Typedef( const String  &     i_sLocalName,
189                                   Cid                 i_nId )
190     { do_Add_Typedef(i_sLocalName, i_nId); }
191 inline void
Add_Operation(const String & i_sLocalName,Cid i_nId,bool i_bIsStatic)192 InputContext::Owner::Add_Operation( const String  &             i_sLocalName,
193                                     Cid                         i_nId,
194                                     bool                        i_bIsStatic )
195     { do_Add_Operation( i_sLocalName, i_nId, i_bIsStatic ); }
196 inline void
Add_Variable(const String & i_sLocalName,Cid i_nId,bool i_bIsConst,bool i_bIsStatic)197 InputContext::Owner::Add_Variable( const String  &     i_sLocalName,
198                                    Cid                 i_nId,
199                                    bool                i_bIsConst,
200                                    bool                i_bIsStatic )
201     { do_Add_Variable( i_sLocalName, i_nId, i_bIsConst, i_bIsStatic ); }
202 inline Ce_id
CeId() const203 InputContext::Owner::CeId() const
204     { return inq_CeId(); }
205 
206 
207 
208 
209 
210 }   // namespace cpp
211 }   // namespace ary
212 #endif
213