cppFunctionType.h 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  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 cppFunctionType.h
  10. * @author drose
  11. * @date 1999-10-21
  12. */
  13. #ifndef CPPFUNCTIONTYPE_H
  14. #define CPPFUNCTIONTYPE_H
  15. #include "dtoolbase.h"
  16. #include "cppType.h"
  17. class CPPParameterList;
  18. class CPPIdentifier;
  19. /**
  20. *
  21. */
  22. class CPPFunctionType : public CPPType {
  23. public:
  24. enum Flags {
  25. F_const_method = 0x001,
  26. F_operator_typecast = 0x002,
  27. F_constructor = 0x004,
  28. F_destructor = 0x008,
  29. F_method_pointer = 0x010,
  30. F_unary_op = 0x020,
  31. F_operator = 0x040,
  32. F_noexcept = 0x080,
  33. F_copy_constructor = 0x200,
  34. F_move_constructor = 0x400,
  35. F_trailing_return_type = 0x800,
  36. F_final = 0x1000,
  37. F_override = 0x2000,
  38. F_volatile_method = 0x4000,
  39. F_lvalue_method = 0x8000,
  40. F_rvalue_method = 0x10000,
  41. F_copy_assignment_operator = 0x20000,
  42. F_move_assignment_operator = 0x40000,
  43. };
  44. CPPFunctionType(CPPType *return_type, CPPParameterList *parameters,
  45. int flags);
  46. CPPFunctionType(const CPPFunctionType &copy);
  47. void operator = (const CPPFunctionType &copy);
  48. bool accepts_num_parameters(int num_parameters);
  49. CPPType *_return_type;
  50. CPPParameterList *_parameters;
  51. int _flags;
  52. virtual bool is_fully_specified() const;
  53. virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
  54. CPPScope *current_scope,
  55. CPPScope *global_scope);
  56. virtual CPPType *resolve_type(CPPScope *current_scope,
  57. CPPScope *global_scope);
  58. virtual bool is_tbd() const;
  59. virtual bool is_trivial() const;
  60. virtual void output(std::ostream &out, int indent_level, CPPScope *scope,
  61. bool complete) const;
  62. void output(std::ostream &out, int indent_level, CPPScope *scope,
  63. bool complete, int num_default_parameters) const;
  64. virtual void output_instance(std::ostream &out, int indent_level,
  65. CPPScope *scope,
  66. bool complete, const std::string &prename,
  67. const std::string &name) const;
  68. void output_instance(std::ostream &out, int indent_level,
  69. CPPScope *scope,
  70. bool complete, const std::string &prename,
  71. const std::string &name,
  72. int num_default_parameters) const;
  73. int get_num_default_parameters() const;
  74. virtual SubType get_subtype() const;
  75. virtual CPPFunctionType *as_function_type();
  76. bool match_virtual_override(const CPPFunctionType &other) const;
  77. CPPIdentifier *_class_owner;
  78. protected:
  79. virtual bool is_equal(const CPPDeclaration *other) const;
  80. virtual bool is_less(const CPPDeclaration *other) const;
  81. };
  82. #endif