00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015 #ifndef _member_h
00016 #define _member_h
00017
00018 #include "types.h"
00019
00020 class Ptree;
00021 class PtreeArray;
00022 class Class;
00023 class Environment;
00024 class TypeInfo;
00025
00026 class OCXXMOP Member : public LightObject {
00027 public:
00028 Member();
00029 Member(const Member&);
00030 Member(Class*, Ptree*);
00031 void Set(Class*, Ptree*, int);
00032
00033 void Signature(TypeInfo& t) const;
00034 Ptree* Name();
00035 Ptree* Comments();
00036 int Nth();
00037 Class* Supplier();
00038 bool IsConstructor();
00039 bool IsDestructor();
00040 bool IsFunction();
00041 bool IsPublic();
00042 bool IsProtected();
00043 bool IsPrivate();
00044 bool IsStatic();
00045 bool IsMutable();
00046 bool IsInline();
00047 bool IsVirtual();
00048 bool IsPureVirtual();
00049
00050 Ptree* GetUserMemberModifier();
00051 Ptree* GetUserAccessSpecifier();
00052 bool GetUserArgumentModifiers(PtreeArray& result);
00053
00054 void Remove() { removed = TRUE; }
00055 void SetName(Ptree*);
00056 void SetQualifiedName(Ptree*);
00057 Ptree* NewName() { return new_name; }
00058 Ptree* ArgumentList();
00059 void SetArgumentList(Ptree*);
00060 Ptree* NewArgumentList() { return new_args; }
00061 Ptree* MemberInitializers();
00062 void SetMemberInitializers(Ptree*);
00063 Ptree* NewMemberInitializers() { return new_init; }
00064 Ptree* FunctionBody();
00065 void SetFunctionBody(Ptree*);
00066 Ptree* NewFunctionBody() { return new_body; }
00067
00068 Ptree* Arguments();
00069
00070 static void Copy(Member*, void* );
00071
00072 protected:
00073 bool IsInlineFuncImpl();
00074 void SetName(Ptree*, Ptree*);
00075 Ptree* ArgumentList(Ptree* decl);
00076 Ptree* Arguments(Ptree*, int);
00077 Ptree* MemberInitializers(Ptree* decl);
00078
00079 private:
00080 char* Name(int&);
00081 bool Find();
00082
00083 protected:
00084
00085
00086
00087
00088
00089 bool IsFunctionImplementation() { return bool(implementation != nil); }
00090 Ptree *implementation;
00091 Ptree* original_decl;
00092
00093 private:
00094 bool removed;
00095 Ptree* new_name;
00096 Ptree* new_args;
00097 Ptree* new_init;
00098 Ptree* new_body;
00099 bool arg_name_filled;
00100
00101 Class* metaobject;
00102 Ptree* declarator;
00103 int nth;
00104
00105 friend class ChangedMemberList;
00106 };
00107
00108 class OCXXMOP MemberFunction : public Member {
00109 public:
00110 MemberFunction(Class*, Ptree*, Ptree*);
00111 };
00112
00113 class OCXXMOP MemberList : public LightObject {
00114 public:
00115 struct Mem {
00116 Class* supplying;
00117 Ptree* definition;
00118 Ptree* declarator;
00119 char* name;
00120 char* signature;
00121 bool is_constructor, is_destructor;
00122 bool is_virtual, is_static, is_mutable, is_inline;
00123 int access;
00124 Ptree* user_access;
00125 Ptree* user_mod;
00126 };
00127
00128 MemberList();
00129 void Make(Class*);
00130 Mem* Ref(int);
00131 int Number() { return num; }
00132 Mem* Lookup(char*, char*);
00133 int Lookup(char*, int, char*);
00134 int Lookup(Environment*, Ptree*, int);
00135 int Lookup(Environment*, char*, int);
00136
00137 private:
00138 void AppendThisClass(Class*);
00139 void Append(Ptree*, Ptree*, int, Ptree*);
00140 void AppendBaseClass(Environment*, Ptree*);
00141 void CheckHeader(Ptree*, Mem*);
00142
00143 Class* this_class;
00144 int num;
00145
00146 int size;
00147 Mem* array;
00148 };
00149
00150 class ChangedMemberList : public LightObject {
00151 public:
00152 struct Cmem {
00153 Ptree* declarator;
00154 bool removed;
00155 Ptree* name;
00156 Ptree* args;
00157 Ptree* init;
00158 Ptree* body;
00159 Ptree* def;
00160 int access;
00161 bool arg_name_filled;
00162 };
00163
00164 ChangedMemberList();
00165 void Append(Member*, int access);
00166 static void Copy(Member* src, Cmem* dest, int access);
00167 Cmem* Lookup(Ptree* decl);
00168 Cmem* Get(int);
00169
00170 private:
00171 Cmem* Ref(int);
00172
00173 private:
00174 int num;
00175 int size;
00176 Cmem* array;
00177 };
00178
00179 #endif // _member_h