Modules | Files | Inheritance Tree | Inheritance Graph | Name Index | Config
File: Synopsis/Parser/C++/occ/member.h
    1| /*
    2|   Copyright (C) 1997-2000 Shigeru Chiba, University of Tsukuba.
    3| 
    4|   Permission to use, copy, distribute and modify this software and   
    5|   its documentation for any purpose is hereby granted without fee,        
    6|   provided that the above copyright notice appear in all copies and that 
    7|   both that copyright notice and this permission notice appear in 
    8|   supporting documentation.
    9| 
   10|   Shigeru Chiba makes no representations about the suitability of this 
   11|   software for any purpose.  It is provided "as is" without express or
   12|   implied warranty.
   13| */
   14| 
   15| #ifndef _member_h
   16| #define _member_h
   17| 
   18| #include "types.h"
   19| 
   20| class Ptree;
   21| class PtreeArray;
   22| class Class;
   23| class Environment;
   24| class TypeInfo;
   25| 
   26| class OCXXMOP Member : public LightObject {
   27| public:
   28|     Member();
   29|     Member(const Member&);
   30|     Member(Class*, Ptree*);
   31|     void Set(Class*, Ptree*, int);
   32| 
   33|     void Signature(TypeInfo& t) const;
   34|     Ptree* Name();
   35|     Ptree* Comments();
   36|     int Nth();
   37|     Class* Supplier();
   38|     bool IsConstructor();
   39|     bool IsDestructor();
   40|     bool IsFunction();
   41|     bool IsPublic();
   42|     bool IsProtected();
   43|     bool IsPrivate();
   44|     bool IsStatic();
   45|     bool IsMutable();
   46|     bool IsInline();
   47|     bool IsVirtual();
   48|     bool IsPureVirtual();
   49| 
   50|     Ptree* GetUserMemberModifier();
   51|     Ptree* GetUserAccessSpecifier();
   52|     bool GetUserArgumentModifiers(PtreeArray& result);
   53| 
   54|     void Remove() { removed = TRUE; }
   55|     void SetName(Ptree*);
   56|     void SetQualifiedName(Ptree*);
   57|     Ptree* NewName() { return new_name; }
   58|     Ptree* ArgumentList();
   59|     void SetArgumentList(Ptree*);
   60|     Ptree* NewArgumentList() { return new_args; }
   61|     Ptree* MemberInitializers();
   62|     void SetMemberInitializers(Ptree*);
   63|     Ptree* NewMemberInitializers() { return new_init; }
   64|     Ptree* FunctionBody();
   65|     void SetFunctionBody(Ptree*);
   66|     Ptree* NewFunctionBody() { return new_body; }
   67| 
   68|     Ptree* Arguments();
   69| 
   70|     static void Copy(Member*, void/* ChangedMemberList::Cmem* */);
   71| 
   72| protected:
   73|     bool IsInlineFuncImpl();
   74|     void SetName(Ptree*, Ptree*);
   75|     Ptree* ArgumentList(Ptree* decl);
   76|     Ptree* Arguments(Ptree*, int);
   77|     Ptree* MemberInitializers(Ptree* decl);
   78| 
   79| private:
   80|     charName(int&);
   81|     bool Find();
   82| 
   83| protected:
   84| 
   85|     // The next function is TRUE if the member is a function
   86|     // with the implementation but it is not inlined.  And if so,
   87|     // the following variables are effective.
   88| 
   89|     bool IsFunctionImplementation() { return bool(implementation != nil); }
   90|     Ptree *implementation;
   91|     Ptree* original_decl;
   92| 
   93| private:
   94|     bool removed;
   95|     Ptree* new_name;
   96|     Ptree* new_args;
   97|     Ptree* new_init;
   98|     Ptree* new_body;
   99|     bool arg_name_filled;
  100| 
  101|     Class* metaobject;
  102|     Ptree* declarator;
  103|     int nth;
  104| 
  105| friend class ChangedMemberList;
  106| };
  107| 
  108| class OCXXMOP MemberFunction : public Member {
  109| public:
  110|     MemberFunction(Class*, Ptree*, Ptree*);
  111| };
  112| 
  113| class OCXXMOP MemberList : public LightObject {
  114| public:
  115|     struct Mem {
  116|         Class* supplying;
  117|         Ptree* definition;
  118|         Ptree* declarator;
  119|         charname;
  120|         charsignature;
  121|         bool is_constructoris_destructor;
  122|         bool is_virtualis_staticis_mutableis_inline;
  123|         int  access;
  124|         Ptree* user_access;
  125|         Ptree* user_mod;
  126|     };
  127| 
  128|     MemberList();
  129|     void Make(Class*);
  130|     MemRef(int);
  131|     int Number() { return num; }
  132|     MemLookup(char*, char*);
  133|     int Lookup(char*, intchar*);
  134|     int Lookup(Environment*, Ptree*, int);
  135|     int Lookup(Environment*, char*, int);
  136| 
  137| private:
  138|     void AppendThisClass(Class*);
  139|     void Append(Ptree*, Ptree*, int, Ptree*);
  140|     void AppendBaseClass(Environment*, Ptree*);
  141|     void CheckHeader(Ptree*, Mem*);
  142| 
  143|     Class* this_class;
  144|     int num;
  145| 
  146|     int size;
  147|     Memarray;
  148| };
  149| 
  150| class ChangedMemberList : public LightObject {
  151| public:
  152|     struct Cmem {
  153|         Ptree* declarator;
  154|         bool removed;
  155|         Ptree* name;
  156|         Ptree* args;
  157|         Ptree* init;
  158|         Ptree* body;
  159|         Ptree* def;
  160|         int    access;        // used only by Classs::appended_member_list
  161|         bool arg_name_filled;
  162|     };
  163| 
  164|     ChangedMemberList();
  165|     void Append(Member*, int access);
  166|     static void Copy(Member* src, Cmem* dest, int access);
  167|     CmemLookup(Ptree* decl);
  168|     CmemGet(int);
  169| 
  170| private:
  171|     CmemRef(int);
  172| 
  173| private:
  174|     int num;
  175|     int size;
  176|     Cmemarray;
  177| };
  178| 
  179| #endif // _member_h