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

http://testability-explorer.googlecode.com/ · Java · 68 lines · 40 code · 13 blank · 15 comment · 0 complexity · b03d9811f2c7314c7c428436262d42a1 MD5 · raw file

  1. /*
  2. * Copyright 2008 Google Inc.
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License"); you may not
  5. * use this file except in compliance with the License. You may obtain a copy of
  6. * the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
  12. * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
  13. * License for the specific language governing permissions and limitations under
  14. * the License.
  15. */
  16. package com.google.test.metric.cpp;
  17. import com.google.test.metric.cpp.dom.Node;
  18. import java.util.List;
  19. class GlobalScopeBuilder extends DefaultBuilder {
  20. private final Node parent;
  21. private List<String> sts;
  22. GlobalScopeBuilder(Node parent) {
  23. this.parent = parent;
  24. }
  25. @Override
  26. public void beginClassDefinition(String type, String identifier) {
  27. pushBuilder(new ClassBuilder(parent, identifier));
  28. }
  29. @Override
  30. public void enterNamespaceScope(String ns) {
  31. pushBuilder(new NamespaceBuilder(parent, ns));
  32. }
  33. @Override
  34. public void beginFunctionDefinition(int line) {
  35. pushBuilder(new FunctionDefinitionBuilder(parent, line));
  36. }
  37. @Override
  38. public void beginFunctionDeclaration() {
  39. pushBuilder(new FunctionDeclarationBuilder(parent));
  40. }
  41. @Override
  42. public void simpleTypeSpecifier(List<String> sts) {
  43. this.sts = sts;
  44. }
  45. @Override
  46. public void beginInitDeclaratorList() {
  47. pushBuilder(new VariableDeclarationBuilder(parent, sts));
  48. }
  49. @Override
  50. public void beginBaseSpecifier() {
  51. }
  52. @Override
  53. public void endBaseSpecifier() {
  54. }
  55. }