PageRenderTime 24ms CodeModel.GetById 12ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 1ms

/cpp/src/main/java/com/google/test/metric/cpp/Builder.java

http://testability-explorer.googlecode.com/
Java | 313 lines | 83 code | 58 blank | 172 comment | 0 complexity | 6825e402634d1e55d1a88a0b449bf7f0 MD5 | raw file
  1package com.google.test.metric.cpp;
  2
  3import java.util.List;
  4
  5/**
  6 * The Builder receives calls from some reverse engineering system and is able
  7 * to transform this information into model elements. It expects to receive
  8 * calls in a logic sequence:
  9 * <ol>
 10 * <li>beginClassDeclaration</li>
 11 * <li>beginMemberDeclaration</li>
 12 * <li>endMemberDeclaration</li>
 13 * <li>endClassDeclaration</li>
 14 * </ol>
 15 *
 16 * Originally, this class was called Modeler and was used in ArgoUML
 17 * modeling tool. Original author: Luis Sergio Oliveira
 18 */
 19interface Builder {
 20
 21  /**
 22   * Signals the begin of the translation unit.
 23   */
 24  void beginTranslationUnit();
 25
 26  /**
 27   * Signals the end of the translation unit.
 28   */
 29  void endTranslationUnit();
 30
 31  /**
 32   * Signals that we entered the given namespace scope.
 33   *
 34   * @param ns The namespace identifier. For unnamed namespaces it is an empty
 35   *        <code>String</code>.
 36   */
 37  void enterNamespaceScope(String ns);
 38
 39  /**
 40   * Signals the exit of the namespace scope.
 41   */
 42  void exitNamespaceScope();
 43
 44  /**
 45   * Signal a new alias for the given namespace.
 46   *
 47   * @param ns Identifier of the namespace for which an alias will be created.
 48   * @param alias Identifier of the new namespace alias.
 49   */
 50  void makeNamespaceAlias(String ns, String alias);
 51
 52  /**
 53   * Signal the begin of a new class definition
 54   *
 55   * @param oType The type of the specifier from the CPPvariables class, it is
 56   *        one of the "OT_*" values, e.g., OT_CLASS.
 57   * @param identifier The class identifier (name).
 58   */
 59  void beginClassDefinition(String oType, String identifier);
 60
 61  /**
 62   * Signals the end of a class definition.
 63   */
 64  void endClassDefinition();
 65
 66  /**
 67   * Signals that the given access specifier was found.
 68   *
 69   * @param accessSpec The access specifier, e.g., "public".
 70   */
 71  void accessSpecifier(String accessSpec);
 72
 73  /**
 74   * Signals the begin of a function declaration.
 75   */
 76  void beginFunctionDeclaration();
 77
 78  /**
 79   * Signals the end of a function declaration.
 80   */
 81  void endFunctionDeclaration();
 82
 83  /**
 84   * Reports the declaration specifiers; "inline", "virtual", "friend", etc.
 85   *
 86   * @param declSpecs The declaration specifiers for the current declaration.
 87   */
 88  void declarationSpecifiers(List<String> declSpecs);
 89
 90  /**
 91   * Reports the type simple type specifiers (buit-in, like int, char, unsigned
 92   * char, etc).
 93   *
 94   * @param sts The simple type specifiers,
 95   */
 96  void simpleTypeSpecifier(List<String> sts);
 97
 98  /**
 99   * Reports the declarator, of the entity being declared.
100   *
101   * @param id The identifier of the construct being declared.
102   */
103  void directDeclarator(String id);
104
105  /**
106   * Reports the storage class specifier.
107   *
108   * @param storageClassSpec The storage class specifier.
109   */
110  void storageClassSpecifier(String storageClassSpec);
111
112  /**
113   * Reports the type qualifier.
114   *
115   * @param typeQualifier "const" or "volatile".
116   */
117  void typeQualifier(String typeQualifier);
118
119  /**
120   * Signals the begin of a function definition.
121   * @param line
122   */
123  void beginFunctionDefinition(int line);
124
125  /**
126   * Signals the end of a function definition.
127   */
128  void endFunctionDefinition();
129
130  /**
131   * Reports the identifier of the function being declared or defined.
132   *
133   * @param identifier the function identifier.
134   */
135  void functionDirectDeclarator(String identifier);
136
137  /**
138   * Signals the begin of a parameter declaration.
139   */
140  void beginParameterDeclaration();
141
142  /**
143   * Signals the end of a parameter declaration.
144   */
145  void endParameterDeclaration();
146
147  /**
148   *
149   */
150  void beginInitializer();
151
152  /**
153   *
154   */
155  void endInitializer();
156
157  /**
158   * Signals the begin of a member declaration.
159   */
160  void beginMemberDeclaration();
161
162  /**
163   * Signals the end of a member declaration.
164   */
165  void endMemberDeclaration();
166
167  /**
168   * Signals the begin of a compound statement.
169   */
170  void beginCompoundStatement();
171
172  /**
173   * Signals the end of a compound statement.
174   */
175  void endCompoundStatement();
176
177  /**
178   * Receives a pointer symbol from the ptr_operator rule. In simple cases
179   * should be a "&" or a "*".
180   *
181   * @param ptrSymbol the pointer symbol found
182   */
183  void ptrOperator(String ptrSymbol);
184
185  /**
186   * Signals the begin of the ptr_operator rule.
187   */
188  void beginPtrOperator();
189
190  /**
191   * Signals the end of the ptr_operator rule.
192   */
193  void endPtrOperator();
194
195  /**
196   * Found a pointer to member construct. Partial results, being the rest (if
197   * existing) delivered in a typeQualifier() call.
198   *
199   * @param scopedItem The scoped item, such as A::B::C::
200   * @param star The "*" symbol, just that the call is clear. In the future may
201   *        be removed.
202   */
203  void ptrToMember(String scopedItem, String star);
204
205  /**
206   * Signals the start of a class's base specification.
207   */
208  void beginBaseSpecifier();
209
210  /**
211   * Signals the end of a class's base specification.
212   */
213  void endBaseSpecifier();
214
215  /**
216   * The base specification.
217   *
218   * @param identifier The name of the base class.
219   * @param isVirtual Is the inheritance virtual.
220   */
221  void baseSpecifier(String identifier, boolean isVirtual);
222
223  /**
224   * Signals the start of a constructor definition.
225   */
226  void beginCtorDefinition();
227
228  /**
229   * Signals the end of a constructor definition.
230   */
231  void endCtorDefinition();
232
233  /**
234   * The qualified constructor identifier.
235   *
236   * @param identifier of the ctor
237   */
238  void qualifiedCtorId(String identifier);
239
240  /**
241   * Signals the start of a destructor head statement.
242   */
243  void beginDtorHead();
244
245  /**
246   * Signals the end of a destructor head statement.
247   */
248  void endDtorHead();
249
250  /**
251   * The destructor declarator.
252   *
253   * @param identifier the destructor identifier
254   */
255  void dtorDeclarator(String identifier);
256
257  void beginIfStatement();
258  void endIfStatement();
259  void beginElseStatement();
260  void endElseStatement();
261
262  void gotoStatement();
263  void continueStatement();
264  void breakStatement();
265
266  void beginWhileStatement();
267  void endWhileStatement();
268
269  void beginDoStatement();
270  void endDoStatement();
271
272  void beginForStatement();
273  void endForStatement();
274
275  void beginSwitchStatement();
276  void endSwitchStatement();
277  void beginCaseStatement();
278  void endCaseStatement();
279  void beginDefaultStatement();
280  void endDefaultStatement();
281
282  void beginTernaryOperator();
283  void endTernaryOperator();
284
285  void beginReturnStatement(int lineNumber);
286  void endReturnStatement();
287
288  void idExpression(String text);
289
290  void beginPostfixExpression();
291  void endPostfixExpression();
292
293  void beginPrimaryExpression();
294  void endPrimaryExpression();
295
296  void beginParameterList();
297  void endParameterList();
298
299  void beginAssignmentExpression(int line);
300  void endAssignmentExpression();
301
302  void beginMemberAccess();
303  void endMemberAccess();
304
305  void beginInitDeclaratorList();
306  void endInitDeclaratorList();
307
308  void beginExpression();
309  void endExpression();
310
311  void beginExpressionStatement();
312  void endExpressionStatement();
313}