cppStructType.h 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293
  1. // Filename: cppStructType.h
  2. // Created by: drose (19Oct99)
  3. //
  4. ////////////////////////////////////////////////////////////////////
  5. #ifndef CPPSTRUCTTYPE_H
  6. #define CPPSTRUCTTYPE_H
  7. #include <dtoolbase.h>
  8. #include "cppExtensionType.h"
  9. #include "cppVisibility.h"
  10. #include <vector>
  11. #include <list>
  12. class CPPScope;
  13. class CPPTypeProxy;
  14. ///////////////////////////////////////////////////////////////////
  15. // Class : CPPStructType
  16. // Description :
  17. ////////////////////////////////////////////////////////////////////
  18. class CPPStructType : public CPPExtensionType {
  19. public:
  20. CPPStructType(Type type, CPPIdentifier *ident,
  21. CPPScope *current_scope,
  22. CPPScope *scope,
  23. const CPPFile &file);
  24. CPPStructType(const CPPStructType &copy);
  25. void operator = (const CPPStructType &copy);
  26. void append_derivation(CPPType *base, CPPVisibility vis, bool is_virtual);
  27. CPPScope *get_scope() const;
  28. bool is_abstract() const;
  29. void check_virtual();
  30. virtual bool is_fully_specified() const;
  31. virtual bool is_incomplete() const;
  32. CPPInstance *get_destructor() const;
  33. virtual CPPDeclaration *
  34. instantiate(const CPPTemplateParameterList *actual_params,
  35. CPPScope *current_scope, CPPScope *global_scope,
  36. CPPPreprocessor *error_sink = NULL) const;
  37. virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
  38. CPPScope *current_scope,
  39. CPPScope *global_scope);
  40. virtual void output(ostream &out, int indent_level, CPPScope *scope,
  41. bool complete) const;
  42. virtual SubType get_subtype() const;
  43. virtual CPPStructType *as_struct_type();
  44. CPPScope *_scope;
  45. bool _incomplete;
  46. class Base {
  47. public:
  48. void output(ostream &out) const;
  49. CPPType *_base;
  50. CPPVisibility _vis;
  51. bool _is_virtual;
  52. };
  53. typedef vector<Base> Derivation;
  54. Derivation _derivation;
  55. typedef list<CPPInstance *> VFunctions;
  56. void get_virtual_funcs(VFunctions &funcs) const;
  57. void get_pure_virtual_funcs(VFunctions &funcs) const;
  58. protected:
  59. virtual bool is_equal(const CPPDeclaration *other) const;
  60. virtual bool is_less(const CPPDeclaration *other) const;
  61. bool _subst_decl_recursive_protect;
  62. typedef vector<CPPTypeProxy *> Proxies;
  63. Proxies _proxies;
  64. };
  65. inline ostream &operator << (ostream &out, const CPPStructType::Base &base) {
  66. base.output(out);
  67. return out;
  68. }
  69. #endif