cppEnumType.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * PANDA 3D SOFTWARE
  3. * Copyright (c) Carnegie Mellon University. All rights reserved.
  4. *
  5. * All use of this software is subject to the terms of the revised BSD
  6. * license. You should have received a copy of this license along
  7. * with this source code in a file named "LICENSE."
  8. *
  9. * @file cppEnumType.h
  10. * @author drose
  11. * @date 1999-10-25
  12. */
  13. #ifndef CPPENUMTYPE_H
  14. #define CPPENUMTYPE_H
  15. #include "dtoolbase.h"
  16. #include "cppBisonDefs.h"
  17. #include "cppExtensionType.h"
  18. #include <vector>
  19. class CPPExpression;
  20. class CPPInstance;
  21. class CPPScope;
  22. /**
  23. *
  24. */
  25. class CPPEnumType : public CPPExtensionType {
  26. public:
  27. CPPEnumType(Type type, CPPIdentifier *ident, CPPScope *current_scope,
  28. CPPScope *scope, const CPPFile &file,
  29. CPPAttributeList attr = CPPAttributeList());
  30. CPPEnumType(Type type, CPPIdentifier *ident, CPPType *element_type,
  31. CPPScope *current_scope, CPPScope *scope, const CPPFile &file,
  32. CPPAttributeList attr = CPPAttributeList());
  33. bool is_scoped() const;
  34. CPPType *get_underlying_type();
  35. CPPInstance *add_element(const std::string &name, CPPExpression *value,
  36. CPPPreprocessor *preprocessor, const cppyyltype &pos,
  37. CPPAttributeList attr = CPPAttributeList());
  38. virtual bool is_incomplete() const;
  39. virtual bool is_fully_specified() const;
  40. virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
  41. CPPScope *current_scope,
  42. CPPScope *global_scope);
  43. virtual void output(std::ostream &out, int indent_level, CPPScope *scope,
  44. bool complete) const;
  45. virtual SubType get_subtype() const;
  46. virtual CPPEnumType *as_enum_type();
  47. CPPScope *_parent_scope;
  48. CPPScope *_scope;
  49. CPPType *_element_type;
  50. typedef std::vector<CPPInstance *> Elements;
  51. Elements _elements;
  52. CPPExpression *_last_value;
  53. };
  54. #endif