cppTypedefType.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091
  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 cppTypedefType.h
  10. * @author rdb
  11. * @date 2014-08-01
  12. */
  13. #ifndef CPPTYPEDEFTYPE_H
  14. #define CPPTYPEDEFTYPE_H
  15. #include "dtoolbase.h"
  16. #include "cppType.h"
  17. class CPPIdentifier;
  18. class CPPInstanceIdentifier;
  19. /**
  20. * A type alias created by a C++ typedef or using declaration. These aren't
  21. * officially supposed to be types in themselves, but we represent them as
  22. * such so that we can preserve typedef names in the generated code.
  23. */
  24. class CPPTypedefType : public CPPType {
  25. public:
  26. CPPTypedefType(CPPType *type, const std::string &name, CPPScope *current_scope);
  27. CPPTypedefType(CPPType *type, CPPIdentifier *ident, CPPScope *current_scope,
  28. CPPAttributeList attr = CPPAttributeList());
  29. CPPTypedefType(CPPType *type, CPPInstanceIdentifier *ii,
  30. CPPScope *current_scope, const CPPFile &file);
  31. bool is_scoped() const;
  32. CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
  33. CPPPreprocessor *error_sink = nullptr) const;
  34. virtual std::string get_simple_name() const;
  35. virtual std::string get_local_name(CPPScope *scope = nullptr) const;
  36. virtual std::string get_fully_scoped_name() const;
  37. virtual bool is_incomplete() const;
  38. virtual bool is_tbd() const;
  39. virtual bool is_fundamental() const;
  40. virtual bool is_standard_layout() const;
  41. virtual bool is_trivial() const;
  42. virtual bool is_constructible(const CPPType *type) const;
  43. virtual bool is_default_constructible() const;
  44. virtual bool is_copy_constructible() const;
  45. virtual bool is_copy_assignable() const;
  46. virtual bool is_destructible() const;
  47. virtual bool is_fully_specified() const;
  48. virtual CPPDeclaration *
  49. instantiate(const CPPTemplateParameterList *actual_params,
  50. CPPScope *current_scope, CPPScope *global_scope,
  51. CPPPreprocessor *error_sink = nullptr) const;
  52. virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
  53. CPPScope *current_scope,
  54. CPPScope *global_scope);
  55. virtual CPPType *resolve_type(CPPScope *current_scope,
  56. CPPScope *global_scope);
  57. virtual bool is_convertible_to(const CPPType *other) const;
  58. virtual bool is_equivalent(const CPPType &other) const;
  59. virtual void output(std::ostream &out, int indent_level, CPPScope *scope,
  60. bool complete) const;
  61. virtual SubType get_subtype() const;
  62. virtual CPPTypedefType *as_typedef_type();
  63. CPPType *_type;
  64. CPPIdentifier *_ident;
  65. bool _using;
  66. protected:
  67. virtual bool is_equal(const CPPDeclaration *other) const;
  68. virtual bool is_less(const CPPDeclaration *other) const;
  69. bool _subst_decl_recursive_protect;
  70. typedef std::vector<CPPTypeProxy *> Proxies;
  71. Proxies _proxies;
  72. };
  73. #endif