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

def.h

Go to the documentation of this file.
00001 
00002 //
00003 //  Borland C++ 5.5, GNU C++ 3.0
00004 //  Compiler Backend Library
00005 //  def.h
00006 //
00007 //  Copyright (c) 1999-2002 SurakWare Corp.
00008 //
00010 #ifndef sw_cbl_codetree_def_h
00011 #define sw_cbl_codetree_def_h
00012 
00013 #include <cbl/codetree/element.h>
00014 
00015 namespace cbl {
00016 namespace codetree {
00017 
00018 namespace symbols {
00019     class TSymbol;
00020     class TTypeSym;
00021     class TModuleSym;
00022 }
00023 
00024 namespace scopes {
00025     class TScope;
00026 }
00027 
00028 namespace def {
00029 
00030 class TDefVisitor;
00031 
00032 class TDef : public TElement {
00033 public:
00034     class no_def_complete { };
00035 
00036 private:
00037     symbols::TTypeSym *FOwnerType;
00038 
00039     bool FConst;
00040 
00041 protected:
00042     TDef(symbols::TModuleSym *AOwnerModule);
00043 
00044 public:
00045     TDef(const TDef&);
00046 
00047     // ownerType
00048     virtual symbols::TTypeSym *ownerType();
00049     virtual const symbols::TTypeSym *ownerType() const;
00050     virtual void ownerType(symbols::TTypeSym *);
00051 
00052     // size
00053     virtual unsigned size() const = 0;
00054 
00055     // constness
00056     virtual bool isConst() const;
00057     virtual void isConst(bool);
00058 
00059     // complete
00060     virtual bool isComplete() const;
00061     virtual void isComplete(bool);
00062 
00063     // visitor pattern
00064     virtual void accept(TDefVisitor&) = 0;
00065 
00066     // object cloning
00067     virtual TDef *clone() const = 0;
00068 };
00069 
00070 // TCompositeDef
00071 template<class T = TDef>
00072 class TCompositeDef : public TDef {
00073 public:
00074     class no_composite { };
00075 
00076 private:
00077     T *FComposite;
00078 
00079 protected:
00080     TCompositeDef(symbols::TModuleSym *AOwner, T *AComposite);
00081 
00082 public:
00083     TCompositeDef(const TCompositeDef&);
00084 
00085     // composite
00086     T *composite() const;
00087     void composite(T *);
00088 
00089     // isComplete
00090     virtual bool isComplete() const;
00091     virtual void isComplete(bool);
00092 };
00093 
00094 // TScopeDef
00095 class TScopedDef : public TDef {
00096 private:
00097     scopes::TScope *FElements;
00098 
00099 protected:
00100     TScopedDef(symbols::TModuleSym *AOwner, scopes::TScope *AParentScope);
00101 
00102 public:
00103     TScopedDef(const TScopedDef&);
00104 
00105     scopes::TScope *scope();
00106     const scopes::TScope *scope() const;
00107 
00108     scopes::TScope *elements();
00109     const scopes::TScope *elements() const;
00110 
00111     virtual void add(symbols::TSymbol *);
00112 };
00113 
00114 // TConstDef
00115 class TConstDef : public TDef {
00116 private:
00117     TDef *FRef;
00118 
00119 protected:
00120     TConstDef(symbols::TModuleSym *AOwner, TDef *ARef);
00121 
00122     friend class symbols::TModuleSym;
00123 
00124 public:
00125     TConstDef(const TConstDef&);
00126 
00127     // size
00128     virtual unsigned size() const;
00129 
00130     // ref
00131     virtual TDef *ref();
00132     virtual const TDef *ref() const;
00133 
00134     // const
00135     virtual bool isConst() const;
00136     virtual void isConst(bool);
00137 
00138     // complete
00139     virtual bool isComplete() const;
00140     virtual void isComplete(bool);
00141 
00142     // visitor pattern
00143     virtual void accept(TDefVisitor&);
00144 
00145     // object cloning
00146     virtual TConstDef *clone() const;
00147 };
00148 
00149 } // namespace def
00150 } // namespace codetree
00151 } // namespace cbl
00152 
00153 #endif

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