/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

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