cppSimpleType.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  1. // Filename: cppSimpleType.h
  2. // Created by: drose (19Oct99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. //
  6. // PANDA 3D SOFTWARE
  7. // Copyright (c) Carnegie Mellon University. All rights reserved.
  8. //
  9. // All use of this software is subject to the terms of the revised BSD
  10. // license. You should have received a copy of this license along
  11. // with this source code in a file named "LICENSE."
  12. //
  13. ////////////////////////////////////////////////////////////////////
  14. #ifndef CPPSIMPLETYPE_H
  15. #define CPPSIMPLETYPE_H
  16. #include "dtoolbase.h"
  17. #include "cppType.h"
  18. ///////////////////////////////////////////////////////////////////
  19. // Class : CPPSimpleType
  20. // Description :
  21. ////////////////////////////////////////////////////////////////////
  22. class CPPSimpleType : public CPPType {
  23. public:
  24. enum Type {
  25. T_unknown,
  26. T_bool,
  27. T_char,
  28. T_wchar_t,
  29. T_char16_t,
  30. T_char32_t,
  31. T_int,
  32. T_float,
  33. T_double,
  34. T_void,
  35. // We need something to represent the type of nullptr so that we
  36. // can return it from decltype(nullptr). Note that this is not
  37. // the same as nullptr_t, which is a typedef of decltype(nullptr).
  38. T_nullptr,
  39. // T_parameter is a special type which is assigned to expressions
  40. // that are discovered where a formal parameter was expected.
  41. // This is a special case for handling cases like this:
  42. //
  43. // int foo(0);
  44. //
  45. // which really means the same thing as:
  46. //
  47. // int foo = 0;
  48. //
  49. // but it initially looks like a function prototype.
  50. //
  51. T_parameter,
  52. };
  53. enum Flags {
  54. F_long = 0x001,
  55. F_longlong = 0x002,
  56. F_short = 0x004,
  57. F_unsigned = 0x008,
  58. F_signed = 0x010,
  59. };
  60. CPPSimpleType(Type type, int flags = 0);
  61. Type _type;
  62. int _flags;
  63. virtual bool is_tbd() const;
  64. virtual bool is_trivial() const;
  65. virtual bool is_parameter_expr() const;
  66. virtual string get_preferred_name() const;
  67. virtual void output(ostream &out, int indent_level, CPPScope *scope,
  68. bool complete) const;
  69. virtual SubType get_subtype() const;
  70. virtual CPPSimpleType *as_simple_type();
  71. protected:
  72. virtual bool is_equal(const CPPDeclaration *other) const;
  73. virtual bool is_less(const CPPDeclaration *other) const;
  74. };
  75. #endif