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

defmethod.h

Go to the documentation of this file.
00001 
00002 //
00003 //  Borland C++ 5.5, GNU C++ 3.0
00004 //  Compiler Backend Library
00005 //  defmethod.h
00006 //
00007 //  Copyright (c) 2000-2002 SurakWare Corp.
00008 //
00010 #ifndef sw_cbl_codetree_defmethod_h
00011 #define sw_cbl_codetree_defmethod_h
00012 
00013 #include 
00014 
00015 #include 
00016 #include 
00017 
00018 namespace cbl {
00019 namespace codetree {
00020 
00021 namespace symbols {
00022     class TTypeSym;
00023 }
00024 
00025 namespace expr {
00026     class TExpression;
00027 }
00028 
00029 namespace def {
00030 
00031 class TClassDef;
00032 
00033 // TMethodDef
00034 class TExternalInfo;
00035 class TParam;
00036 
00037 class TMethodDef : public TDef {
00038 public:
00039     enum TStyle {
00040         mtExternal, mtForward, mtInline, mtSimple
00041     };
00042 
00043     enum TCallStyle {
00044         csStandard, csRegister, csPascal, csCdecl, csStdCall, csSafeCall,
00045         csExport
00046     };
00047 
00048     enum TStyleEx {
00049         mtAbstract, mtDynamic, mtMessage, mtOverride, mtReintroduce, mtVirtual,
00050         mtConstructor, mtDestructor, mtCopy, mtClassMethod
00051     };
00052 
00053     typedef std::deque TRaisesList;
00054 
00055 private:
00056     typedef std::bitset<4> TStyles;
00057     typedef std::bitset<11> TStylesEx;
00058     typedef std::deque TParamList;
00059 
00060     TStyles FStyles;
00061     TDef *FReturnType;
00062     TCallStyle FCallStyle;
00063     TExternalInfo *FExternalInfo;
00064     TParamList FParams;
00065 
00066     TStylesEx FStylesEx;
00067     unsigned FMessageID;
00068     TRaisesList FRaises;
00069 
00070 protected:
00071     TMethodDef(symbols::TModuleSym *AOwner);
00072 
00073     friend class symbols::TModuleSym;   
00074 
00075 public:
00076     TMethodDef(const TMethodDef&);
00077 
00078     // size
00079     virtual unsigned size() const;
00080     
00081     // access to call style
00082     void callStyle(TCallStyle);
00083     TCallStyle callStyle() const;
00084 
00085     // external method info
00086     void externalInfo(const TExternalInfo&);
00087     const TExternalInfo& externalInfo() const;
00088 
00089     // method type handling
00090     void styles(const TStyles&);
00091     const TStyles& styles() const;
00092 
00093     void setStyle(TStyle, bool state);
00094     bool getStyle(TStyle) const;
00095 
00096     // return type
00097     void returnType(TDef *);
00098     const TDef *returnType() const;
00099 
00100     // parameter handling
00101     void addParam(TParam *);
00102     const TParamList& params() const;
00103 
00104     // stylesEx
00105     void stylesEx(const TStylesEx&);
00106     const TStylesEx& stylesEx() const;
00107 
00108     void setStyleEx(TStyleEx, bool state);
00109     bool getStyleEx(TStyleEx) const;
00110 
00111     // messageID
00112     unsigned messageID() const;
00113     void messageID(unsigned);
00114 
00115     // raises
00116     void addRaises(def::TClassDef *);
00117     void raises(const TRaisesList&);
00118     const TRaisesList& raises();
00119 
00120     // visitor pattern
00121     virtual void accept(TDefVisitor&);
00122 
00123     // object cloning
00124     virtual TMethodDef *clone() const;
00125 };
00126 
00127 TMethodDef::TStyle operator|(TMethodDef::TStyle, TMethodDef::TStyle);
00128 TMethodDef::TStyleEx operator|(TMethodDef::TStyleEx, TMethodDef::TStyleEx);
00129 
00130 // TExternalInfo
00131 class TExternalInfo : public TElement {
00132 private:
00133     std::string FLibrary;
00134     std::string FExportName;
00135     int FIndex;
00136 
00137     friend class TMethodDef;
00138 
00139 protected:
00140     // constructor
00141     TExternalInfo(symbols::TModuleSym *AOwner);
00142     
00143     friend class symbols::TModuleSym;
00144 
00145 public:
00146     // library name
00147     std::string library() const;
00148     void library(const std::string& ALibrary);
00149 
00150     // export name
00151     std::string exportName() const;
00152     void exportName(const std::string& AExportName);
00153 
00154     // export index
00155     long index() const;
00156     void index(long AIndex);
00157 };
00158 
00159 } // namespace def
00160 } // namespace codetree
00161 } // namespace cbl
00162 
00163 #endif

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