📄 sigc_compatibility.h
字号:
/* Part of this file reproduces source code in sigc++/object_slot.h to which Karl Einar Nelson owns the copyright. The remainder of this file is copyright (C) Chris Vine 2004 This program is distributed under the General Public Licence, version 2. For particulars of this and relevant disclaimers see the file COPYING distributed with the source files.*/// this file enables the libsigc++-2.0 syntax used in this program to compile with// libsigc++-1.2#ifndef SIGC_COMPATIBILIY_H#define SIGC_COMPATIBILIY_H#include <sigc++/sigc++.h>namespace sigc { //sigc::connection --> SigC::Connection typedef SigC::Connection connection; // sigc::trackable --> Sigc::Object typedef SigC::Object trackable; //sigc::signal0 --> Sigc::Signal0 (with default marshaller) template <class R> class signal0 : public SigC::Signal0<R> {}; //sigc::signal1 --> Sigc::Signal1 (with default marshaller) template <class R,class P1> class signal1 : public SigC::Signal1<R, P1> {}; //sigc::signal2 --> Sigc::Signal2 (with default marshaller) template <class R,class P1,class P2> class signal2 : public SigC::Signal2<R, P1, P2> {}; // sigc::bind --> SigC::bind (for passing one argument to a slot connected // to a signal passing no arguments) template <class A1,class R,class C1> SigC::Slot0<R> bind(const SigC::Slot1<R,C1>& s, A1 a1) { return SigC::bind<A1, R, C1> (s, a1); } /* The remainder of these templated functions implement sigc::mem_fun() in terms of SigC::slot. It would be much easier to do it by uncommenting the return statements in each of these functions by calling SigC::slot directly. However gcc-2.95 chokes on this with an internal compiler error. Accordingly the relevant implementations of SigC::slot in sigc++/object_slot.h are reproduced 'in extenso' */ //sigc::memfun() --> SigC::slot (for class member function taking no arguments) template <class R,class O1,class O2> SigC::Slot0<R> mem_fun(O1& obj,R (O2::*method)()) { //return SigC::slot<R, O1, O2> (obj, method); typedef typename SigC::ObjectSlot0_<R,O2> SType; O2& obj_of_method = obj; return new SigC::ObjectSlotNode((SigC::FuncPtr)(&SType::proxy), &obj, &obj_of_method, method); } //sigc::memfun() const --> SigC::slot const (for class member function taking no arguments) template <class R,class O1,class O2> SigC::Slot0<R> mem_fun(O1& obj,R (O2::*method)() const) { //return SigC::slot<R, O1, O2> (obj, method); typedef typename SigC::ObjectSlot0_<R,O2> SType; O2& obj_of_method = obj; return new SigC::ObjectSlotNode((SigC::FuncPtr)(&SType::proxy), &obj, &obj_of_method, method); } //sigc::memfun() --> SigC::slot (for class member function taking one argument) template <class R,class P1,class O1,class O2> SigC::Slot1<R,P1> mem_fun(O1& obj,R (O2::*method)(P1)) { //return SigC::slot<R, P1, O1, O2> (obj, method); typedef typename SigC::ObjectSlot1_<R,P1,O2> SType; O2& obj_of_method = obj; return new SigC::ObjectSlotNode((SigC::FuncPtr)(&SType::proxy), &obj, &obj_of_method, method); } //sigc::memfun() const --> SigC::slot const (for class member function taking one argument) template <class R,class P1,class O1,class O2> SigC::Slot1<R,P1> mem_fun(O1& obj,R (O2::*method)(P1) const) { //return SigC::slot<R, P1, O1, O2> (obj, method); typedef typename SigC::ObjectSlot1_<R,P1,O2> SType; O2& obj_of_method = obj; return new SigC::ObjectSlotNode((SigC::FuncPtr)(&SType::proxy), &obj, &obj_of_method, method); } //sigc::memfun() --> SigC::slot (for class member function taking two arguments) template <class R,class P1,class P2,class O1,class O2> SigC::Slot2<R,P1,P2> mem_fun(O1& obj,R (O2::*method)(P1,P2)) { //return SigC::slot<R, P1, P2, O1, O2> (obj, method); typedef typename SigC::ObjectSlot2_<R,P1,P2,O2> SType; O2& obj_of_method = obj; return new SigC::ObjectSlotNode((SigC::FuncPtr)(&SType::proxy), &obj, &obj_of_method, method); } //sigc::memfun() --> SigC::slot const (for class member function taking two arguments) template <class R,class P1,class P2,class O1,class O2> SigC::Slot2<R,P1,P2> mem_fun(O1& obj,R (O2::*method)(P1,P2) const) { //return SigC::slot<R, P1, P2, O1, O2> (obj, method); typedef typename SigC::ObjectSlot2_<R,P1,P2,O2> SType; O2& obj_of_method = obj; return new SigC::ObjectSlotNode((SigC::FuncPtr)(&SType::proxy), &obj, &obj_of_method, method); } }#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -