]> git.lyx.org Git - lyx.git/blob - sigc++/macros/class_slot.h.m4
dont use threads, add inquiv operator for Aux_info
[lyx.git] / sigc++ / macros / class_slot.h.m4
1 dnl 
2 dnl Class Slot Templates
3 dnl 
4 dnl  Copyright (C) 1998-1999 Karl Nelson <kenelson@ece.ucdavis.edu>
5 dnl 
6 dnl  This library is free software; you can redistribute it and/or
7 dnl  modify it under the terms of the GNU Library General Public
8 dnl  License as published by the Free Software Foundation; either
9 dnl  version 2 of the License, or (at your option) any later version.
10 dnl 
11 dnl  This library is distributed in the hope that it will be useful,
12 dnl  but WITHOUT ANY WARRANTY; without even the implied warranty of
13 dnl  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14 dnl  Library General Public License for more details.
15 dnl 
16 dnl  You should have received a copy of the GNU Library General Public
17 dnl  License along with this library; if not, write to the Free
18 dnl  Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19 dnl 
20 // -*- c++ -*-
21 dnl Ignore the next line
22 /* This is a generated file, do not edit.  Generated from __file__ */
23 include(template.macros.m4)
24 #ifndef __header__
25 #define __header__
26
27 /*
28   SigC::slot_class() (class)
29   -----------------------
30   slot_class() can be applied to a class method to form a Slot with a
31   profile equivelent to the method.  At the same time an instance
32   of that class must be specified.  This is an unsafe interface.
33
34   This does NOT require that the class be derived from SigC::Object.
35   However, the object should be static with regards to the signal system.
36   (allocated within the global scope.)  If it is not and a connected
37   slot is call it will result in a seg fault.  If the object must
38   be destroyed before the connected slots, all connections must
39   be disconnected by hand.
40
41   Sample usage:
42
43     struct A
44       {
45        void foo(int,int);
46       } a;
47
48     Slot2<void,int,int> s=slot_class(a,&A::foo);
49
50 */
51
52
53 #include <sigc++/object_slot.h>
54
55 #ifdef SIGC_CXX_NAMESPACES
56 namespace SigC
57 {
58 #endif
59
60 dnl
61 dnl CLASS_SLOT
62 dnl
63 define([CLASS_SLOT],[dnl
64 /****************************************************************
65 ***** Class Slot NUM($1)
66 ****************************************************************/
67 template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
68 struct [ClassSlot]NUM($1)_:public [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>
69   {
70    typedef [ObjectSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)> Base;
71    typedef typename Base::InFunc InFunc;
72
73    static SlotData* create(Obj* obj,InFunc func)
74      {
75       if (!obj) return 0;
76       SlotData* tmp=manage(new SlotData());
77       CallData &data=reinterpret_cast<CallData&>(tmp->data_);
78       data.callback=&callback;
79       data.obj=obj;
80       data.func=(Func)func;
81       return tmp;
82      }
83   };
84
85 template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
86 __SLOT__(R,[$1])
87   slot_class(Obj &obj,R (Obj::*func)(ARG_TYPE($1)))
88   {return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(&obj,func);
89   }
90
91 template <LIST(class R,1,ARG_CLASS($1),[$1],class Obj,1)>
92 __SLOT__(R,[$1])
93   slot_class(Obj *obj,R (Obj::*func)(ARG_TYPE($1)))
94   {return [ClassSlot]NUM($1)_<LIST(R,1,ARG_TYPE($1),[$1],Obj,1)>::create(obj,func);
95   }
96
97 ])dnl
98
99 CLASS_SLOT(ARGS(P,0))
100 CLASS_SLOT(ARGS(P,1))
101 CLASS_SLOT(ARGS(P,2))
102 CLASS_SLOT(ARGS(P,3))
103
104 #ifdef SIGC_CXX_NAMESPACES
105 } // namespace
106 #endif
107
108 #endif