cppTypedefType.h 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 string &name, CPPScope *current_scope);
  27. CPPTypedefType(CPPType *type, CPPIdentifier *ident, CPPScope *current_scope);
  28. CPPTypedefType(CPPType *type, CPPInstanceIdentifier *ii,
  29. CPPScope *current_scope, const CPPFile &file);
  30. bool is_scoped() const;
  31. CPPScope *get_scope(CPPScope *current_scope, CPPScope *global_scope,
  32. CPPPreprocessor *error_sink = NULL) const;
  33. virtual string get_simple_name() const;
  34. virtual string get_local_name(CPPScope *scope = NULL) const;
  35. virtual string get_fully_scoped_name() const;
  36. virtual bool is_incomplete() const;
  37. virtual bool is_tbd() const;
  38. virtual bool is_trivial() const;
  39. virtual bool is_default_constructible() const;
  40. virtual bool is_copy_constructible() const;
  41. virtual bool is_fully_specified() const;
  42. virtual CPPDeclaration *
  43. instantiate(const CPPTemplateParameterList *actual_params,
  44. CPPScope *current_scope, CPPScope *global_scope,
  45. CPPPreprocessor *error_sink = NULL) const;
  46. virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
  47. CPPScope *current_scope,
  48. CPPScope *global_scope);
  49. virtual CPPType *resolve_type(CPPScope *current_scope,
  50. CPPScope *global_scope);
  51. virtual bool is_equivalent(const CPPType &other) const;
  52. virtual void output(ostream &out, int indent_level, CPPScope *scope,
  53. bool complete) const;
  54. virtual SubType get_subtype() const;
  55. virtual CPPTypedefType *as_typedef_type();
  56. CPPType *_type;
  57. CPPIdentifier *_ident;
  58. bool _using;
  59. protected:
  60. virtual bool is_equal(const CPPDeclaration *other) const;
  61. virtual bool is_less(const CPPDeclaration *other) const;
  62. bool _subst_decl_recursive_protect;
  63. typedef vector<CPPTypeProxy *> Proxies;
  64. Proxies _proxies;
  65. };
  66. #endif