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

http://testability-explorer.googlecode.com/ · Java · 64 lines · 34 code · 11 blank · 19 comment · 0 complexity · 318aa66b960ab832409886e8a37b1328 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.Visibility;
  18. import com.google.test.metric.cpp.dom.FunctionDeclaration;
  19. import com.google.test.metric.cpp.dom.Node;
  20. import java.util.List;
  21. /*
  22. * Ignoring function declarations for now because they don't contribute to
  23. * testability score.
  24. */
  25. class FunctionDeclarationBuilder extends DefaultBuilder {
  26. private final Node parent;
  27. private final Visibility visibility;
  28. public FunctionDeclarationBuilder(Node parent) {
  29. this.parent = parent;
  30. this.visibility = Visibility.PUBLIC;
  31. }
  32. public FunctionDeclarationBuilder(Node parent, Visibility visibility) {
  33. this.parent = parent;
  34. this.visibility = visibility;
  35. }
  36. @Override
  37. public void directDeclarator(String id) {
  38. parent.addChild(new FunctionDeclaration(id, visibility));
  39. }
  40. @Override
  41. public void simpleTypeSpecifier(List<String> sts) {
  42. }
  43. @Override
  44. public void endFunctionDeclaration() {
  45. finished();
  46. }
  47. @Override
  48. public void beginInitDeclaratorList() {
  49. }
  50. @Override
  51. public void endInitDeclaratorList() {
  52. }
  53. }