71 #include "RConfigure.h"
107 static TPMERegexp *constRe = 0, *wspaceRe = 0;
109 constRe =
new TPMERegexp(
"(?<=\\(|\\s|,|&|\\*)const(?=\\s|,|\\)|&|\\*)",
"go");
110 wspaceRe =
new TPMERegexp(
"\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)",
"go");
113 wspaceRe->Substitute(res,
"");
128 if (arg[pri] ==
'*' || arg[pri] ==
'&') {
139 if (!arg.
AtEnd()) res +=
",";
150 TMethod *GetMethodWithPrototype(
TClass *cl,
const char *method,
158 if (
m) nargs =
m->GetNargs();
179 TClass *sender_class,
const char *signal,
180 TClass *receiver_class,
const char *slot)
182 char *signal_method =
new char[strlen(signal)+1];
183 if (signal_method) strcpy(signal_method, signal);
188 if ((signal_proto = strchr(signal_method,
'('))) {
190 *signal_proto++ =
'\0';
192 if ((tmp = strrchr(signal_proto,
')'))) *tmp =
'\0';
195 if (!signal_proto) signal_proto = (
char*)
"";
201 ::Error(
"TQObject::CheckConnectArgs",
"for signal/slot consistency\n"
202 "checking need to specify class name as argument to "
204 delete [] signal_method;
210 TMethod *signalMethod = GetMethodWithPrototype(sender_class,
215 ::Error(
"TQObject::CheckConnectArgs",
"signal %s::%s(%s) does not exist",
216 sender_class->
GetName(), signal_method, signal_proto);
217 delete [] signal_method;
220 Int_t nsigargs = nargs;
222 #if defined(CHECK_COMMENT_STRING)
224 if (signalMethod != (
TMethod *) -1)
228 ::Error(
"TQObject::CheckConnectArgs",
229 "signal %s::%s(%s), to declare signal use comment //*SIGNAL*",
230 sender_class->
GetName(), signal_method, signal_proto);
231 delete [] signal_method;
237 delete [] signal_method;
239 char *slot_method =
new char[strlen(slot)+1];
240 if (slot_method) strcpy(slot_method, slot);
243 char *slot_params = 0;
245 if ((slot_proto = strchr(slot_method,
'('))) {
248 *slot_proto++ =
'\0';
251 if ((tmp = strrchr(slot_proto,
')'))) *tmp =
'\0';
254 if (!slot_proto) slot_proto = (
char*)
"";
255 if ((slot_params = strchr(slot_proto,
'='))) *slot_params =
' ';
258 if (!receiver_class) {
260 slotMethod =
gROOT->GetGlobalFunction(slot_method,0,
kFALSE);
262 slotMethod = !slot_params ?
263 GetMethodWithPrototype(receiver_class,
268 slot_method, slot_params);
273 ::Error(
"TQObject::CheckConnectArgs",
"slot %s(%s) does not exist",
274 receiver_class ?
Form(
"%s::%s", receiver_class->
GetName(),
275 slot_method) : slot_method, slot_proto);
277 ::Error(
"TQObject::CheckConnectArgs",
"slot %s(%s) does not exist",
278 receiver_class ?
Form(
"%s::%s", receiver_class->
GetName(),
279 slot_method) : slot_method, slot_params);
281 delete [] slot_method;
285 #if defined(CHECK_ARGS_NUMBER)
288 ::Error(
"TQObject::CheckConnectArgs",
289 "inconsistency in numbers of arguments");
290 delete [] slot_method;
296 delete [] slot_method;
306 class TQConnectionList :
public TList {
313 { fName =
name; fSignalArgs = nsigargs; }
314 virtual ~TQConnectionList();
316 Bool_t Disconnect(
void *receiver=0,
const char *slot_name=0);
317 Int_t GetNargs()
const {
return fSignalArgs; }
324 TQConnectionList::~TQConnectionList()
332 if (connection->
IsEmpty())
delete connection;
341 Bool_t TQConnectionList::Disconnect(
void *receiver,
const char *slot_name)
354 if (!slot_name || !slot_name[0]
355 || !strcmp(
name,slot_name)) {
357 if (!receiver || (receiver == obj)) {
358 return_value =
kTRUE;
359 savlnk = lnk->
Next();
375 void TQConnectionList::ls(
Option_t *option)
const
377 std::cout <<
"TQConnectionList:" <<
"\t" << GetName() << std::endl;
417 while ((connection = (
TQConnection*)next_connection())) {
418 TIter next_list(connection);
419 TQConnectionList *list;
420 while ((list = (TQConnectionList*)next_list())) {
421 list->Remove(connection);
436 qcl =
dynamic_cast<TQClass*
>(IsA());
459 while ((base = (
TBaseClass*) next_base_class()))
477 TQConnectionList *clist = (TQConnectionList*)
489 clist->AddFirst(con);
504 TQConnectionList *clist = (TQConnectionList*)
576 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, cl, slot_name)) == -1)
582 TQConnectionList *clist = (TQConnectionList*)
586 clist =
new TQConnectionList(signal_name, nsigargs);
594 if (!strcmp(slot_name,connection->
GetName()) &&
602 if (!clist->FindObject(connection)) {
603 clist->Add(connection);
634 if ((nsigargs =
CheckConnectArgs(0, sender, signal_name, cl, slot_name)) == -1)
640 TQConnectionList *clist = (TQConnectionList*) slist->
FindObject(signal_name);
643 clist =
new TQConnectionList(signal_name, nsigargs);
651 if (!strcmp(slot_name,connection->
GetName()) &&
659 if (!clist->FindObject(connection)) {
660 clist->Add(connection);
662 ((
TQClass*)sender)->Connected(signal_name);
708 if (rcv_cl)
return ConnectToClass(sender, signal, rcv_cl, receiver, slot);
724 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, 0, slot_name)) == -1)
729 TQConnectionList *clist = (TQConnectionList*)
733 clist =
new TQConnectionList(signal_name, nsigargs);
741 if (!strcmp(slot_name,connection->
GetName()) &&
749 if (!clist->FindObject(connection)) {
750 clist->Add(connection);
800 if (rcv_cl)
return ConnectToClass(class_name, signal, rcv_cl, receiver,
820 if ((nsigargs =
CheckConnectArgs(0, sender, signal_name, 0, slot_name)) == -1)
827 TQConnectionList *clist = (TQConnectionList*)
831 clist =
new TQConnectionList(signal_name, nsigargs);
839 if (!strcmp(slot_name,connection->
GetName()) &&
847 if (!clist->FindObject(connection)) {
848 clist->Add(connection);
850 ((
TQClass*)sender)->Connected(signal_name);
867 const char *receiver_class,
880 if ((nsigargs =
CheckConnectArgs(
this, IsA(), signal_name, cl, slot_name)) == -1)
885 TQConnectionList *clist = (TQConnectionList*)
889 clist =
new TQConnectionList(signal_name, nsigargs);
897 if (!strcmp(slot_name,connection->
GetName()) &&
902 connection =
new TQConnection(receiver_class, receiver, slot_name);
905 if (!clist->FindObject(connection)) {
906 clist->Add(connection);
970 TQConnectionList *slist = 0;
973 while ((slist = (TQConnectionList*)next_signal())) {
974 if (!signal || signal_name.
IsNull()) {
975 next_return = slist->Disconnect(receiver,slot_name);
976 return_value = return_value || next_return;
978 if (slist->IsEmpty()) {
982 }
else if (signal && !strcmp(signal_name,slist->GetName())) {
983 next_return = slist->Disconnect(receiver,slot_name);
984 return_value = return_value || next_return;
986 if (slist->IsEmpty()) {
1017 return Disconnect(qcl, signal, receiver, slot);
1028 return Disconnect(
this, signal, receiver, slot);
1034 void TQObject::Streamer(
TBuffer &R__b)
1068 TString str =
"ProcessLine(=";