cppTemplateScope.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file cppTemplateScope.h
  10. * @author drose
  11. * @date 1999-10-28
  12. */
  13. #ifndef CPPTEMPLATESCOPE_H
  14. #define CPPTEMPLATESCOPE_H
  15. #include "dtoolbase.h"
  16. #include "cppScope.h"
  17. #include "cppTemplateParameterList.h"
  18. class CPPDeclaration;
  19. class CPPExtensionType;
  20. class CPPInstance;
  21. class CPPNamespace;
  22. class CPPPreprocessor;
  23. class CPPTypedefType;
  24. class CPPUsing;
  25. struct cppyyltype;
  26. /**
  27. * This is an implicit scope that is created following the appearance of a
  28. * "template<class x, class y>" or some such line in a C++ file. It simply
  29. * defines the template parameters.
  30. */
  31. class CPPTemplateScope : public CPPScope {
  32. public:
  33. CPPTemplateScope(CPPScope *parent_scope);
  34. void add_template_parameter(CPPDeclaration *param);
  35. virtual void add_declaration(CPPDeclaration *decl, CPPScope *global_scope,
  36. CPPPreprocessor *preprocessor,
  37. const cppyyltype &pos);
  38. virtual void add_enum_value(CPPInstance *inst);
  39. virtual void define_typedef_type(CPPTypedefType *type,
  40. CPPPreprocessor *error_sink = nullptr);
  41. virtual void define_extension_type(CPPExtensionType *type,
  42. CPPPreprocessor *error_sink = nullptr);
  43. virtual void define_namespace(CPPNamespace *scope);
  44. virtual void add_using(CPPUsing *using_decl, CPPScope *global_scope,
  45. CPPPreprocessor *error_sink = nullptr);
  46. virtual bool is_fully_specified() const;
  47. virtual std::string get_simple_name() const;
  48. virtual std::string get_local_name(CPPScope *scope = nullptr) const;
  49. virtual std::string get_fully_scoped_name() const;
  50. virtual void output(std::ostream &out, CPPScope *scope) const;
  51. virtual CPPTemplateScope *as_template_scope();
  52. CPPTemplateParameterList _parameters;
  53. };
  54. #endif