cppFunctionType.h 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. // Filename: cppFunctionType.h
  2. // Created by: drose (21Oct99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001 - 2004, Disney Enterprises, Inc. All rights reserved
  8. //
  9. // All use of this software is subject to the terms of the Panda 3d
  10. // Software license. You should have received a copy of this license
  11. // along with this source code; you will also find a current copy of
  12. // the license at http://etc.cmu.edu/panda3d/docs/license/ .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef CPPFUNCTIONTYPE_H
  19. #define CPPFUNCTIONTYPE_H
  20. #include "dtoolbase.h"
  21. #include "cppType.h"
  22. class CPPParameterList;
  23. class CPPIdentifier;
  24. ///////////////////////////////////////////////////////////////////
  25. // Class : CPPFunctionType
  26. // Description :
  27. ////////////////////////////////////////////////////////////////////
  28. class CPPFunctionType : public CPPType {
  29. public:
  30. enum Flags {
  31. F_const_method = 0x01,
  32. F_operator_typecast = 0x02,
  33. F_constructor = 0x04,
  34. F_destructor = 0x08,
  35. F_method_pointer = 0x10,
  36. F_unary_op = 0x20,
  37. };
  38. CPPFunctionType(CPPType *return_type, CPPParameterList *parameters,
  39. int flags);
  40. CPPFunctionType(const CPPFunctionType &copy);
  41. void operator = (const CPPFunctionType &copy);
  42. CPPType *_return_type;
  43. CPPParameterList *_parameters;
  44. int _flags;
  45. virtual bool is_fully_specified() 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_tbd() const;
  52. virtual void output(ostream &out, int indent_level, CPPScope *scope,
  53. bool complete) const;
  54. void output(ostream &out, int indent_level, CPPScope *scope,
  55. bool complete, int num_default_parameters) const;
  56. virtual void output_instance(ostream &out, int indent_level,
  57. CPPScope *scope,
  58. bool complete, const string &prename,
  59. const string &name) const;
  60. void output_instance(ostream &out, int indent_level,
  61. CPPScope *scope,
  62. bool complete, const string &prename,
  63. const string &name,
  64. int num_default_parameters) const;
  65. int get_num_default_parameters() const;
  66. virtual SubType get_subtype() const;
  67. virtual CPPFunctionType *as_function_type();
  68. bool is_equivalent_function(const CPPFunctionType &other) const;
  69. CPPIdentifier *_class_owner;
  70. protected:
  71. virtual bool is_equal(const CPPDeclaration *other) const;
  72. virtual bool is_less(const CPPDeclaration *other) const;
  73. };
  74. #endif