summaryrefslogtreecommitdiff
path: root/autodoc/source/parser/cpp/pe_vafu.hxx
blob: df151a3ca18d4e56bff7d7d22e40e5bf63943362 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
/*************************************************************************
 *
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
 *
 * Copyright 2000, 2010 Oracle and/or its affiliates.
 *
 * OpenOffice.org - a multi-platform office productivity suite
 *
 * This file is part of OpenOffice.org.
 *
 * OpenOffice.org is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License version 3
 * only, as published by the Free Software Foundation.
 *
 * OpenOffice.org is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License version 3 for more details
 * (a copy is included in the LICENSE file that accompanied this code).
 *
 * You should have received a copy of the GNU Lesser General Public License
 * version 3 along with OpenOffice.org.  If not, see
 * <http://www.openoffice.org/license.html>
 * for a copy of the LGPLv3 License.
 *
 ************************************************************************/


#ifndef ADC_CPP_PE_VAFU_HXX
#define ADC_CPP_PE_VAFU_HXX

// BASE CLASSES
#include "cpp_pe.hxx"
// USED SERVICES
#include <semantic/callf.hxx>
#include <semantic/sub_peu.hxx>
#include <ary/cpp/c_types4cpp.hxx>
#include <ary/cpp/c_vfflag.hxx>



namespace cpp
{

class PE_Type;
class PE_Variable;
class PE_Function;
class PE_Ignore;




class PE_VarFunc : public Cpp_PE
{
  public:
    enum E_State
    {
        start,
        expectCtor,
        afterClassDecl,     // Also used for after enum declaration.
        expectName,
        afterName,
        afterName_inErraneousTemplate,
        finished,
        finishedIncludingFunctionImplementation,
        size_of_states
    };
    enum E_ResultType
    {
        result_unknown = 0,
        result_ignore,          /// Used for class and enum declarations and predeclarations and for extern variables and functions.
        result_variable,
        result_function
    };

    typedef ary::cpp::E_Protection              E_Protection;


                        PE_VarFunc(
                            Cpp_PE *            i_pParent );
                        ~PE_VarFunc();

    virtual void        Call_Handler(
                            const cpp::Token &  i_rTok );

    const std::vector<ary::cpp::Ce_id> &
                        Result_Ids() const;
    ary::cpp::Type_id   Result_FrontType() const;
    const StringVector &
                        Result_Names() const;
    E_ResultType        Result_CeType() const;

  private:
    typedef SubPe< PE_VarFunc, PE_Type >        SP_Type;
    typedef SubPeUse< PE_VarFunc, PE_Type >     SPU_Type;
    typedef SubPe< PE_VarFunc, PE_Variable >    SP_Variable;
    typedef SubPeUse< PE_VarFunc, PE_Variable > SPU_Variable;
    typedef SubPe< PE_VarFunc, PE_Function >    SP_Function;
    typedef SubPeUse< PE_VarFunc, PE_Function > SPU_Function;
    typedef SubPe< PE_VarFunc, PE_Ignore >      SP_Ignore;
    typedef SubPeUse< PE_VarFunc, PE_Ignore >   SPU_Ignore;

    void                Setup_StatusFunctions();
    virtual void        InitData();
    virtual void        TransferData();
    void                Hdl_UnknownToken( const char *);

    void                SpInit_FunctionStd();
    void                SpInit_FunctionCtor();
    void                SpInit_FunctionDtor();
    void                SpInit_FunctionCastOperator();
    void                SpInit_FunctionNormalOperator();
    void                SpReturn_Type();
    void                SpReturn_Variable();
    void                SpReturn_FunctionStd();
    void                SpReturn_Ignore();

    void                On_start_Identifier(const char * i_sText);
    void                On_start_operator(const char * i_sText);
    void                On_start_TypeKey(const char * i_sText);
    void                On_start_virtual(const char * i_sText);
    void                On_start_Tilde(const char * i_sText);
    void                On_start_const(const char * i_sText);
    void                On_start_volatile(const char * i_sText);
    void                On_start_extern(const char * i_sText);
    void                On_start_static(const char * i_sText);
    void                On_start_mutable(const char * i_sText);
    void                On_start_register(const char * i_sText);
    void                On_start_inline(const char * i_sText);
    void                On_start_explicit(const char * i_sText);
    void                On_start_Bracket_Right(const char * i_sText);
    void                On_start_typename(const char * i_sText);

    void                On_expectCtor_Bracket_Left(const char * i_sText);

    void                On_afterClassDecl_Semicolon(const char * i_sText);

    void                On_expectName_Identifier(const char * i_sText);
    void                On_expectName_operator(const char * i_sText);
    void                On_expectName_Bracket_Left(const char * i_sText);

    void                On_afterName_ArrayBracket_Left(const char * i_sText);
    void                On_afterName_Bracket_Left(const char * i_sText);
    void                On_afterName_DoubleColon(const char * i_sText);
    void                On_afterName_Semicolon(const char * i_sText);
    void                On_afterName_Comma(const char * i_sText);
    void                On_afterName_Assign(const char * i_sText);
    void                On_afterName_Less(const char * i_sText);

    void                On_afterName_inErraneousTemplate_Less(const char * i_sText);
    void                On_afterName_inErraneousTemplate_Greater(const char * i_sText);
    void                On_afterName_inErraneousTemplate_Default(const char * i_sText);

    void                On_finished_Semicolon(const char * i_sText);
    void                On_finished_Comma(const char * i_sText);
    void                On_finished_Default(const char * i_sText);

    void                On_finishedIncludingFunctionImplementation_Default(const char * i_sText);

    ary::cpp::FunctionFlags
                        CreateFunctionFlags();

    // DATA
    Dyn< PeStatusArray<PE_VarFunc> >
                        pStati;

    Dyn<SP_Type>        pSpType;
    Dyn<SPU_Type>       pSpuType;
    Dyn<SP_Variable>    pSpVariable;
    Dyn<SPU_Variable>   pSpuVariable;
    Dyn<SP_Function>    pSpFunction;
    Dyn<SPU_Function>   pSpuFunctionStd;
    Dyn<SPU_Function>   pSpuFunctionCtor;
    Dyn<SPU_Function>   pSpuFunctionDtor;
    Dyn<SPU_Function>   pSpuFunctionCastOperator;
    Dyn<SPU_Function>   pSpuFunctionNormalOperator;
    Dyn<SP_Ignore>      pSpIgnore;
    Dyn<SPU_Ignore>     pSpuIgnore;

    intt                nCounter_TemplateBrackets;
    bool                bInDestructor;

    std::vector<ary::cpp::Ce_id>
                        aResultIds;
    ary::cpp::Type_id   nResultFrontType;
    E_ResultType        eResultType;

    // Pre-Results
    String              sName;

    bool                bVirtual;
    bool                bStatic;
    bool                bExtern;
    bool                bExternC;
    bool                bMutable;
    bool                bInline;
    bool                bRegister;
    bool                bExplicit;
};



// IMPLEMENTATION

inline const std::vector<ary::cpp::Ce_id> &
PE_VarFunc::Result_Ids() const
    { return aResultIds; }
inline ary::cpp::Type_id
PE_VarFunc::Result_FrontType() const
    { return nResultFrontType; }
inline PE_VarFunc::E_ResultType
PE_VarFunc::Result_CeType() const
    { return eResultType; }



}   // namespace cpp




#endif


/*  // Overview of Stati

Undecided
---------

start           // vor und während storage class specifiern
    any         ->stay
    operaator   ->goto Function

->Typ

expectName
    Identifier  ->stay
    operator    ->goto Function

afterName       ->goto Variable or Function




Variable
--------

start           // vor und während storage class specifiern

->Typ

expectName      // Typ ist da  -> im Falle von '(': notyetimplemented
afterName

expectSize      // after [
expectFinish
                // vor ; oder ,
expectNextVarName  // anders als bei expectName kann hier auch * oder & kommen





Function
--------

start               // vor und während storage class specifiern

->Typ

expectName          // Typ ist da
expectBracket       // Nach Name
expectParameter     // nach ( oder ,
-> Parameter
after Parameters    // before const, volatile throw or = 0.
after throw         // expect (
expectException     // after (
after exceptions    // = 0 oder ; oder ,


expectNextVarName  // anders als bei expectName kann hier auch * oder & kommen







*/