cppSimpleType.h 2.2 KB

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