cppSimpleType.h 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  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_bool,
  26. T_char,
  27. T_wchar_t, // Not strictly a builtin type, but we pretend.
  28. T_int,
  29. T_float,
  30. T_double,
  31. T_void,
  32. T_unknown,
  33. // T_parameter is a special type which is assigned to expressions
  34. // that are discovered where a formal parameter was expected.
  35. // This is a special case for handling cases like this:
  36. //
  37. // int foo(0);
  38. //
  39. // which really means the same thing as:
  40. //
  41. // int foo = 0;
  42. //
  43. // but it initially looks like a function prototype.
  44. //
  45. T_parameter,
  46. };
  47. enum Flags {
  48. F_long = 0x001,
  49. F_longlong = 0x002,
  50. F_short = 0x004,
  51. F_unsigned = 0x008,
  52. F_signed = 0x010,
  53. };
  54. CPPSimpleType(Type type, int flags = 0);
  55. Type _type;
  56. int _flags;
  57. virtual bool is_tbd() const;
  58. virtual bool is_parameter_expr() const;
  59. virtual string get_preferred_name() const;
  60. virtual void output(ostream &out, int indent_level, CPPScope *scope,
  61. bool complete) const;
  62. virtual SubType get_subtype() const;
  63. virtual CPPSimpleType *as_simple_type();
  64. protected:
  65. virtual bool is_equal(const CPPDeclaration *other) const;
  66. virtual bool is_less(const CPPDeclaration *other) const;
  67. };
  68. #endif