00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef CPPSTRUCTTYPE_H
00020 #define CPPSTRUCTTYPE_H
00021
00022 #include <dtoolbase.h>
00023
00024 #include "cppExtensionType.h"
00025 #include "cppVisibility.h"
00026
00027 #include <vector>
00028 #include <list>
00029
00030 class CPPScope;
00031 class CPPTypeProxy;
00032
00033
00034
00035
00036
00037 class CPPStructType : public CPPExtensionType {
00038 public:
00039 CPPStructType(Type type, CPPIdentifier *ident,
00040 CPPScope *current_scope,
00041 CPPScope *scope,
00042 const CPPFile &file);
00043 CPPStructType(const CPPStructType ©);
00044 void operator = (const CPPStructType ©);
00045
00046 void append_derivation(CPPType *base, CPPVisibility vis, bool is_virtual);
00047
00048 CPPScope *get_scope() const;
00049
00050 bool is_abstract() const;
00051 void check_virtual();
00052 virtual bool is_fully_specified() const;
00053 virtual bool is_incomplete() const;
00054
00055 CPPInstance *get_destructor() const;
00056
00057 virtual CPPDeclaration *
00058 instantiate(const CPPTemplateParameterList *actual_params,
00059 CPPScope *current_scope, CPPScope *global_scope,
00060 CPPPreprocessor *error_sink = NULL) const;
00061
00062 virtual CPPDeclaration *substitute_decl(SubstDecl &subst,
00063 CPPScope *current_scope,
00064 CPPScope *global_scope);
00065
00066 virtual void output(ostream &out, int indent_level, CPPScope *scope,
00067 bool complete) const;
00068 virtual SubType get_subtype() const;
00069
00070 virtual CPPStructType *as_struct_type();
00071
00072 CPPScope *_scope;
00073 bool _incomplete;
00074
00075 class Base {
00076 public:
00077 void output(ostream &out) const;
00078
00079 CPPType *_base;
00080 CPPVisibility _vis;
00081 bool _is_virtual;
00082 };
00083
00084 typedef vector<Base> Derivation;
00085 Derivation _derivation;
00086
00087 typedef list<CPPInstance *> VFunctions;
00088 void get_virtual_funcs(VFunctions &funcs) const;
00089 void get_pure_virtual_funcs(VFunctions &funcs) const;
00090
00091 protected:
00092 virtual bool is_equal(const CPPDeclaration *other) const;
00093 virtual bool is_less(const CPPDeclaration *other) const;
00094
00095 bool _subst_decl_recursive_protect;
00096 typedef vector<CPPTypeProxy *> Proxies;
00097 Proxies _proxies;
00098 };
00099
00100 inline ostream &operator << (ostream &out, const CPPStructType::Base &base) {
00101 base.output(out);
00102 return out;
00103 }
00104
00105
00106 #endif