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