cppStructType.h 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106
  1. // Filename: cppStructType.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 CPPSTRUCTTYPE_H
  19. #define CPPSTRUCTTYPE_H
  20. #include "dtoolbase.h"
  21. #include "cppExtensionType.h"
  22. #include "cppVisibility.h"
  23. #include <vector>
  24. #include <list>
  25. class CPPScope;
  26. class CPPTypeProxy;
  27. ///////////////////////////////////////////////////////////////////
  28. // Class : CPPStructType
  29. // Description :
  30. ////////////////////////////////////////////////////////////////////
  31. class CPPStructType : public CPPExtensionType {
  32. public:
  33. CPPStructType(Type type, CPPIdentifier *ident,
  34. CPPScope *current_scope,
  35. CPPScope *scope,
  36. const CPPFile &file);
  37. CPPStructType(const CPPStructType &copy);
  38. void operator = (const CPPStructType &copy);
  39. void append_derivation(CPPType *base, CPPVisibility vis, bool is_virtual);
  40. CPPScope *get_scope() const;
  41. bool is_abstract() const;
  42. bool check_virtual();
  43. virtual bool is_fully_specified() const;
  44. virtual bool is_incomplete() const;
  45. CPPInstance *get_destructor() const;
  46. virtual CPPDeclaration *
  47. instantiate(const CPPTemplateParameterList *actual_params,
  48. CPPScope *current_scope, CPPScope *global_scope,
  49. CPPPreprocessor *error_sink = NULL) const;
  50. virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
  51. CPPScope *current_scope,
  52. CPPScope *global_scope);
  53. virtual void output(ostream &out, int indent_level, CPPScope *scope,
  54. bool complete) const;
  55. virtual SubType get_subtype() const;
  56. virtual CPPStructType *as_struct_type();
  57. CPPScope *_scope;
  58. bool _incomplete;
  59. class Base {
  60. public:
  61. void output(ostream &out) const;
  62. CPPType *_base;
  63. CPPVisibility _vis;
  64. bool _is_virtual;
  65. };
  66. typedef vector<Base> Derivation;
  67. Derivation _derivation;
  68. typedef list<CPPInstance *> VFunctions;
  69. void get_virtual_funcs(VFunctions &funcs) const;
  70. void get_pure_virtual_funcs(VFunctions &funcs) const;
  71. protected:
  72. virtual bool is_equal(const CPPDeclaration *other) const;
  73. virtual bool is_less(const CPPDeclaration *other) const;
  74. bool _subst_decl_recursive_protect;
  75. typedef vector<CPPTypeProxy *> Proxies;
  76. Proxies _proxies;
  77. };
  78. inline ostream &operator << (ostream &out, const CPPStructType::Base &base) {
  79. base.output(out);
  80. return out;
  81. }
  82. #endif