Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Namespace Members   Compound Members   File Members  

defclass.h

Go to the documentation of this file.
00001 
00002 //
00003 //  Borland C++ 5.5, GNU C++ 3.0
00004 //  Compiler Backend Library
00005 //  $Id: defclass_8h-source.html,v 1.1 2002/07/18 14:58:45 cparpart Exp $
00006 //
00007 //  Copyright (c) 2000-2001 SurakWare Corp.
00008 //
00010 #ifndef sw_cbl_codetree_defclass_h
00011 #define sw_cbl_codetree_defclass_h
00012 
00013 #include 
00014 
00015 #include <swl/errormgr.h>
00016 
00017 #include 
00018 #include 
00019 #include 
00020 
00021 #include 
00022 
00023 namespace cbl {
00024 namespace codetree {
00025 
00026 namespace symbols {
00027     class TSymbol;
00028     class TTypeSym;
00029 }
00030 
00031 namespace scopes {
00032     class TScope;
00033 }
00034 
00035 namespace def {
00036 
00037 // TClassDef
00038 struct TObjectInfo {
00039     unsigned ObjectOffset;
00040 };
00041 
00042 class TClassDef : public TDef {
00043 public:
00044     // member visibility
00045     enum TAccess {
00046         acUnknown, acPublic, acProtected, acPrivate
00047     };
00048 
00049     // class style
00050     enum TStyle {
00051         csAbstract, csFinal, csVirtual, csGUID, csIndependent
00052     };
00053 
00054     typedef std::bitset<5> TStyles;
00055 
00056     // class var style
00057     enum TVarStyle {
00058         vsMutable, vsClass
00059     };
00060 
00061     typedef std::deque TSymbolList;
00062     typedef std::map TAccessList;
00063     typedef std::map TObjectOffsets;
00064     typedef std::deque TClassDefList;
00065     typedef TClassDefList TParentList;
00066 
00067 private:
00068     TStyles FStyles;
00069     TClassDefList FParents, FVirtualParents;
00070     scopes::TScope *FScope;
00071     TAccessList FAccessList;
00072     bool FComplete;
00073     unsigned FSize;
00074     TSymbolList FFriends;
00075     std::string FGUID;
00076     TObjectOffsets FObjectOffsets;
00077 
00078     void adjustParentAccess(const symbols::TSymbol *ASymbol, const TClassDef *AParent);
00079 
00080 protected:
00081     TClassDef(symbols::TModuleSym *AOwner, scopes::TScope *AParentScope);
00082     
00083     friend class symbols::TModuleSym;
00084 
00085 public:
00086     TClassDef(const TClassDef&);
00087 
00088     std::string name() const;
00089 
00090     // size
00091     virtual unsigned size() const;
00092 
00093     // complete
00094     virtual bool isComplete() const;
00095     virtual void isComplete(bool);
00096     
00097     // access to FStyles
00098     void styles(const TStyles&);
00099     const TStyles& styles() const;
00100     
00101     void setStyle(TStyle, bool state);
00102     bool getStyle(TStyle) const;
00103 
00104     // access to FParents
00105     const TClassDefList& parents() const;
00106     void addParent(TAccess AAccess, TClassDef *AParent, bool AVirtual = false);
00107     bool isParentOf(const TClassDef *) const;
00108     unsigned offsetOf(const TClassDef *) const;
00109 
00110     // member management
00111     const scopes::TScope *scope() const;
00112 
00113     void addMember(symbols::TSymbol *ASymbol, TAccess AAccess,
00114         swl::IErrorMgr&);
00115     void importMember(symbols::TSymbol *ASymbol, TAccess AAccess,
00116         swl::IErrorMgr&);
00117 
00118     // It's programming language dependend, isn't it?
00119     //bool isUnique(const symbols::TSymbol *p) const;
00120 
00121     TAccess accessOf(const symbols::TSymbol *ASymbol) const;
00122     TAccess accessOf(const TClassDef *) const;
00123     bool knows(const symbols::TSymbol *) const;
00124 
00125     // access to FFriends
00126     const TSymbolList& friends() const;
00127     void friends(const TSymbolList& AFriends);
00128     void addFriend(symbols::TSymbol *AFriend);
00129     bool isFriend(const symbols::TSymbol *ASymbol) const;
00130 
00131     // access to FGUID
00132     void guid(const std::string&);
00133     std::string guid() const;
00134 
00135     // visitor pattern
00136     virtual void accept(TDefVisitor&);
00137 
00138     // object cloning
00139     virtual TClassDef *clone() const; 
00140 };
00141 
00142 } // namespace def
00143 } // namespace codetree
00144 } // namespace cbl
00145 
00146 #endif

Generated on Sat Apr 6 19:07:25 2002 for Compiler Backend Library by doxygen1.2.14 written by , © 1997-2002