typeManager.h 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. // Filename: typeManager.h
  2. // Created by: drose (14Aug00)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) 2001, 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://www.panda3d.org/license.txt .
  13. //
  14. // To contact the maintainers of this program write to
  15. // [email protected] .
  16. //
  17. ////////////////////////////////////////////////////////////////////
  18. #ifndef TYPEMANAGER_H
  19. #define TYPEMANAGER_H
  20. #include <dtoolbase.h>
  21. class CPPFunctionGroup;
  22. class CPPInstance;
  23. class CPPType;
  24. class CPPSimpleType;
  25. class CPPPointerType;
  26. class CPPConstType;
  27. class CPPExtensionType;
  28. class CPPStructType;
  29. class CPPEnumType;
  30. class CPPFunctionType;
  31. class CPPScope;
  32. class CPPIdentifier;
  33. class CPPNameComponent;
  34. class CPPManifest;
  35. ////////////////////////////////////////////////////////////////////
  36. // Class : TypeManager
  37. // Description : This is just a collection of static methods that
  38. // perform useful operations on CPPTypes for
  39. // interrogate. The class is really just a namespace
  40. // that groups these functions together.
  41. ////////////////////////////////////////////////////////////////////
  42. class TypeManager {
  43. public:
  44. static CPPType *resolve_type(CPPType *type, CPPScope *scope = (CPPScope *)NULL);
  45. static bool is_assignable(CPPType *type);
  46. static bool is_reference(CPPType *type);
  47. static bool is_ref_to_anything(CPPType *type);
  48. static bool is_const_ref_to_anything(CPPType *type);
  49. static bool is_pointer(CPPType *type);
  50. static bool is_const(CPPType *type);
  51. static bool is_struct(CPPType *type);
  52. static bool is_enum(CPPType *type);
  53. static bool is_const_enum(CPPType *type);
  54. static bool is_const_ref_to_enum(CPPType *type);
  55. static bool is_simple(CPPType *type);
  56. static bool is_const_simple(CPPType *type);
  57. static bool is_const_ref_to_simple(CPPType *type);
  58. static bool is_pointable(CPPType *type);
  59. static bool is_char(CPPType *type);
  60. static bool is_char_pointer(CPPType *type);
  61. static bool is_basic_string_char(CPPType *type);
  62. static bool is_const_basic_string_char(CPPType *type);
  63. static bool is_const_ref_to_basic_string_char(CPPType *type);
  64. static bool is_bool(CPPType *type);
  65. static bool is_integer(CPPType *type);
  66. static bool is_float(CPPType *type);
  67. static bool is_void(CPPType *type);
  68. static bool is_reference_count(CPPType *type);
  69. static bool is_reference_count_pointer(CPPType *type);
  70. static bool is_pointer_to_base(CPPType *type);
  71. static bool is_const_pointer_to_base(CPPType *type);
  72. static bool is_const_ref_to_pointer_to_base(CPPType *type);
  73. static bool involves_unpublished(CPPType *type);
  74. static bool involves_protected(CPPType *type);
  75. static CPPType *unwrap_pointer(CPPType *type);
  76. static CPPType *unwrap_reference(CPPType *type);
  77. static CPPType *unwrap_const(CPPType *type);
  78. static CPPType *unwrap_const_reference(CPPType *type);
  79. static CPPType *unwrap(CPPType *type);
  80. static CPPType *get_pointer_type(CPPStructType *pt_type);
  81. static CPPType *wrap_pointer(CPPType *type);
  82. static CPPType *wrap_const_pointer(CPPType *type);
  83. static CPPType *wrap_const_reference(CPPType *type);
  84. static CPPType *get_basic_string_char_type();
  85. static CPPType *get_reference_count_type();
  86. static CPPType *get_void_type();
  87. static CPPType *get_int_type();
  88. static string get_function_signature(CPPInstance *function,
  89. int num_default_parameters = 0);
  90. static string get_function_name(CPPInstance *function);
  91. static bool has_protected_destructor(CPPType *type);
  92. };
  93. #endif