⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 boundclasstype_tmpl.hpp

📁 一个实现C++反射机制的类库
💻 HPP
📖 第 1 页 / 共 2 页
字号:
    /*--------------------------------------------------------------------------        Forwards                                                              */    /*--------------------------------------------------------------------------        Types and Constants                                                   */	public:    /*--------------------------------------------------------------------------        Friends                                                               */    /*--------------------------------------------------------------------------        Constructors, Initters, Assignments, and Destructors                  */    public:        BoundClassType_body_tmpl(Obj_T *o);	private:	    	    // Disallow these unless specifically allowed.	    BoundClassType_body_tmpl(const BoundClassType_body_tmpl &);	    BoundClassType_body_tmpl &operator=(const BoundClassType_body_tmpl &);    /*--------------------------------------------------------------------------        Accessors and Convertors                                              */    /*--------------------------------------------------------------------------        Operators                                                             */    /*--------------------------------------------------------------------------        Methods                                                               */    public:        // This method cannot return a more "typed" BoundDataMember object,        // because the BoundDataMember_body group of classes does not have        // one that is templated only on object type.  It's templated        // on both object type and value type.        virtual const BoundDataMember_body *getBoundDataMember(const std::string &fn) const;    /*--------------------------------------------------------------------------        Data                                                                  */    private:        Obj_T *const m_obj;        // Should be static object, so keeping a pointer to it should be        // safe.        const ClassType_body_tmpl<Obj_T> *const m_class;    /*--------------------------------------------------------------------------        Static Methods                                                        */    /*--------------------------------------------------------------------------        Static Data                                                           */    /*--------------------------------------------------------------------------        Access Specifiers                                                     */};/*------------------------------------------------------------------------------    Constructors, Initters, Assignments, and Destructors                      */template <typename Obj_T>BoundClassType_body_tmpl<Obj_T>::BoundClassType_body_tmpl(Obj_T *o) : m_obj(o), m_class(ClassType_tmpl<Obj_T>::s_class_body) {}/*------------------------------------------------------------------------------    Accessors and Convertors                                                  *//*------------------------------------------------------------------------------    Operators                                                                 *//*------------------------------------------------------------------------------    Methods                                                                   */template <typename Obj_T>const BoundDataMember_body *BoundClassType_body_tmpl<Obj_T>::getBoundDataMember(const std::string &fn) const {    const DataMember_body_tmpl1<Obj_T> *f = m_class->getDataMember(fn);    assert(f != NULL);    const BoundDataMember_body *bf = f->bind(m_obj);    assert(bf != NULL);    return bf;}/*------------------------------------------------------------------------------    Static Methods and Helper Functions                                       *//*------------------------------------------------------------------------------    Static Data Specializations                                               *//*-----------------------------------------------------------------------------\|------------------------------------------------------------------------------||                                                                              ||   BoundClassType                                                             ||                                                                              ||------------------------------------------------------------------------------|\------------------------------------------------------------------------------/    <Class comments>-                                                                             *//*------------------------------------------------------------------------------    Forwards (only needed by this class)                                      *//*------------------------------------------------------------------------------    Inline Helper Functions and Helper Classes                                */template <typename Obj_T>class BoundClassType_tmpl {    /*--------------------------------------------------------------------------        Forwards                                                              */    /*--------------------------------------------------------------------------        Types and Constants                                                   */	public:    /*--------------------------------------------------------------------------        Friends                                                               */    /*--------------------------------------------------------------------------        Constructors, Initters, Assignments, and Destructors                  */    public:                explicit BoundClassType_tmpl(Obj_T *);        // XXX - Memleak.        ~BoundClassType_tmpl() {}	private:	    	    // Disallow these unless specifically allowed.	    BoundClassType_tmpl(const BoundClassType_tmpl &);	    BoundClassType_tmpl &operator=(const BoundClassType_tmpl &);    /*--------------------------------------------------------------------------        Accessors and Convertors                                              */    /*--------------------------------------------------------------------------        Operators                                                             */    /*--------------------------------------------------------------------------        Methods                                                               */    public:        BoundDataMember getBoundDataMember(const std::string &n) const {             return BoundDataMember(m_body->getBoundDataMember(n));         }    /*--------------------------------------------------------------------------        Data                                                                  */    private:        BoundClassType_body_tmpl<Obj_T> *m_body;    /*--------------------------------------------------------------------------        Static Methods                                                        */    /*--------------------------------------------------------------------------        Static Data                                                           */    /*--------------------------------------------------------------------------        Access Specifiers                                                     */};/*------------------------------------------------------------------------------    Constructors, Initters, Assignments, and Destructors                      */template <typename Obj_T>BoundClassType_tmpl<Obj_T>::BoundClassType_tmpl(Obj_T *o) : m_body(new BoundClassType_body_tmpl<Obj_T>(o)) {}/*------------------------------------------------------------------------------    Accessors and Convertors                                                  *//*------------------------------------------------------------------------------    Operators                                                                 *//*------------------------------------------------------------------------------    Methods                                                                   *//*------------------------------------------------------------------------------    Static Methods and Helper Functions                                       *//*------------------------------------------------------------------------------    Static Data Specializations                                               *//*------------------------------------------------------------------------------    Static Assertions                                                         */// Need to have a separate namespace for each header file.  Since the static// assertions will usually be grouped by class, might as one well use a// separate namespace per class.namespace BoundClassType_sa {}// The ^ needs to be replaced with the filename extension.static const char BoundClassType_tmpl_h_id[] ="$Id: BoundClassType_tmpl.hpp,v 1.1 2007/10/25 14:05:23 tdevadit Exp $";} // namespace#ifdef MSL_INCLUDE_TEMPLATE    //#include "BoundClassType.cc"#endif#endif/* Local Variables: *//* c-basic-offset: 4 *//* End: *//* vim: set filetype=cpp tabstop=8 shiftwidth=4 softtabstop=4: */

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -