71#include "RConfigure.h"
108 static TPMERegexp *constRe =
nullptr, *wspaceRe =
nullptr;
109 if (constRe ==
nullptr) {
110 constRe =
new TPMERegexp(
"(?<=\\(|\\s|,|&|\\*)const(?=\\s|,|\\)|&|\\*)",
"go");
111 wspaceRe =
new TPMERegexp(
"\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)",
"go");
114 wspaceRe->Substitute(res,
"");
129 if (arg[pri] ==
'*' || arg[pri] ==
'&') {
140 if (!arg.
AtEnd()) res +=
",";
151TMethod *GetMethodWithPrototype(
TClass *cl,
const char *method,
180 TClass *sender_class,
const char *signal,
181 TClass *receiver_class,
const char *slot)
183 auto len = strlen(signal)+1;
184 char *signal_method =
new char[len];
185 if (signal_method) strlcpy(signal_method, signal, len);
190 if ((signal_proto = strchr(signal_method,
'('))) {
192 *signal_proto++ =
'\0';
194 if ((tmp = strrchr(signal_proto,
')'))) *tmp =
'\0';
197 if (!signal_proto) signal_proto = (
char*)
"";
200 if (sender && sender_class == TQObjSender::Class()) {
203 ::Error(
"TQObject::CheckConnectArgs",
"for signal/slot consistency\n"
204 "checking need to specify class name as argument to "
206 delete [] signal_method;
212 TMethod *signalMethod = GetMethodWithPrototype(sender_class,
217 ::Error(
"TQObject::CheckConnectArgs",
"signal %s::%s(%s) does not exist",
218 sender_class->
GetName(), signal_method, signal_proto);
219 delete [] signal_method;
222 Int_t nsigargs = nargs;
224#if defined(CHECK_COMMENT_STRING)
225 const char *comment = 0;
226 if (signalMethod != (
TMethod *) -1)
229 if (!comment || !comment[0] || strstr(comment,
"*SIGNAL")){
230 ::Error(
"TQObject::CheckConnectArgs",
231 "signal %s::%s(%s), to declare signal use comment //*SIGNAL*",
232 sender_class->
GetName(), signal_method, signal_proto);
233 delete [] signal_method;
239 delete [] signal_method;
241 auto len2 = strlen(slot)+1;
242 char *slot_method =
new char[len2];
243 if (slot_method) strlcpy(slot_method, slot, len2);
246 char *slot_params =
nullptr;
248 if ((slot_proto = strchr(slot_method,
'('))) {
251 *slot_proto++ =
'\0';
254 if ((tmp = strrchr(slot_proto,
')'))) *tmp =
'\0';
257 if (!slot_proto) slot_proto = (
char*)
"";
258 if ((slot_params = strchr(slot_proto,
'='))) *slot_params =
' ';
261 if (!receiver_class) {
263 slotMethod =
gROOT->GetGlobalFunction(slot_method,
nullptr,
kFALSE);
265 slotMethod = !slot_params ?
266 GetMethodWithPrototype(receiver_class,
270 GetMethod(receiver_class,
271 slot_method, slot_params);
276 ::Error(
"TQObject::CheckConnectArgs",
"slot %s(%s) does not exist",
277 receiver_class ?
Form(
"%s::%s", receiver_class->
GetName(),
278 slot_method) : slot_method, slot_proto);
280 ::Error(
"TQObject::CheckConnectArgs",
"slot %s(%s) does not exist",
281 receiver_class ?
Form(
"%s::%s", receiver_class->
GetName(),
282 slot_method) : slot_method, slot_params);
284 delete [] slot_method;
288#if defined(CHECK_ARGS_NUMBER)
291 ::Error(
"TQObject::CheckConnectArgs",
292 "inconsistency in numbers of arguments");
293 delete [] slot_method;
299 delete [] slot_method;
335 if (connection->
IsEmpty())
delete connection;
357 if (!slot_name || !slot_name[0]
358 || !strcmp(
name,slot_name)) {
360 if (!receiver || (receiver == obj)) {
361 return_value =
kTRUE;
362 savlnk = lnk->
Next();
380 std::cout <<
"TQConnectionList:" <<
"\t" <<
GetName() << std::endl;
420 while ((connection = (
TQConnection*)next_connection())) {
421 TIter next_list(connection);
439 qcl =
dynamic_cast<TQClass*
>(IsA());
462 while ((base = (
TBaseClass*) next_base_class()))
570 if (!sender->IsA()->InheritsFrom(TQObject::Class()))
579 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name, cl, slot_name)) == -1)
597 if (!strcmp(slot_name,connection->
GetName()) &&
606 clist->
Add(connection);
628 if (!sender || !sender->IsA()->
InheritsFrom(TQObject::Class()))
637 if ((nsigargs =
CheckConnectArgs(
nullptr, sender, signal_name, cl, slot_name)) == -1)
654 if (!strcmp(slot_name,connection->
GetName()) &&
663 clist->
Add(connection);
665 ((
TQClass*)sender)->Connected(signal_name);
711 if (rcv_cl)
return ConnectToClass(sender, signal, rcv_cl, receiver, slot);
718 if (!sender->IsA()->InheritsFrom(TQObject::Class()))
727 if ((nsigargs =
CheckConnectArgs(sender, sender->IsA(), signal_name,
nullptr, slot_name)) == -1)
744 if (!strcmp(slot_name,connection->
GetName()) &&
753 clist->
Add(connection);
803 if (rcv_cl)
return ConnectToClass(class_name, signal, rcv_cl, receiver,
813 if (!sender || !sender->IsA()->
InheritsFrom(TQObject::Class()))
823 if ((nsigargs =
CheckConnectArgs(
nullptr, sender, signal_name,
nullptr, slot_name)) == -1)
842 if (!strcmp(slot_name,connection->
GetName()) &&
851 clist->
Add(connection);
853 ((
TQClass*)sender)->Connected(signal_name);
870 const char *receiver_class,
883 if ((nsigargs =
CheckConnectArgs(
this, IsA(), signal_name, cl, slot_name)) == -1)
900 if (!strcmp(slot_name,connection->
GetName()) &&
905 connection =
new TQConnection(receiver_class, receiver, slot_name);
909 clist->
Add(connection);
977 if (!signal || signal_name.
IsNull()) {
978 next_return = slist->
Disconnect(receiver,slot_name);
979 return_value = return_value || next_return;
985 }
else if (signal && !strcmp(signal_name,slist->
GetName())) {
986 next_return = slist->
Disconnect(receiver,slot_name);
987 return_value = return_value || next_return;
1001 return return_value;
1016 if (!sender || !sender->IsA()->
InheritsFrom(TQObject::Class()))
1020 return Disconnect(qcl, signal, receiver, slot);
1031 return Disconnect(
this, signal, receiver, slot);
1037void TQObject::Streamer(
TBuffer &R__b)
1071 TString str =
"ProcessLine(=";
void Error(const char *location, const char *msgfmt,...)
Use this function in case an error occurred.
Bool_t ConnectCINT(TQObject *sender, const char *signal, const char *slot)
Global function which simplifies making connection in interpreted ROOT session.
char * Form(const char *fmt,...)
#define R__LOCKGUARD2(mutex)
Each class (see TClass) has a linked list of its base class(es).
TClass * GetClassPointer(Bool_t load=kTRUE)
Get pointer to the base class TClass.
Buffer base class used for serializing objects.
TClass instances represent classes, structs and namespaces in the ROOT type system.
TMethod * GetMethod(const char *method, const char *params, Bool_t objectIsConst=kFALSE)
Find the best method (if there is one) matching the parameters.
TMethod * GetMethodWithPrototype(const char *method, const char *proto, Bool_t objectIsConst=kFALSE, ROOT::EFunctionMatchMode mode=ROOT::kConversionMatch)
Find the method with a given prototype.
TList * GetListOfBases()
Return list containing the TBaseClass(es) of a class.
Bool_t InheritsFrom(const char *cl) const
Return kTRUE if this class inherits from a class with name "classname".
static TClass * GetClass(const char *name, Bool_t load=kTRUE, Bool_t silent=kFALSE)
Static method returning pointer to TClass of the specified class name.
virtual const char * GetName() const
Return name of this collection.
virtual void Print(Option_t *option="") const
Default print for collections, calls Print(option, 1).
virtual Bool_t IsEmpty() const
virtual Int_t GetSize() const
Return the capacity of the collection, i.e.
Basic data type descriptor (datatype information is obtained from CINT).
const char * GetFullTypeName() const
Get full type description of typedef, e,g.: "class TDirectory*".
Global functions class (global functions are obtained from CINT).
Int_t GetNargsOpt() const
Number of function optional (default) arguments.
Int_t GetNargs() const
Number of function arguments.
THashList implements a hybrid collection class consisting of a hash table and a list to store TObject...
virtual void Add(TObject *obj)
virtual TObject * Remove(TObject *obj)
Remove object from the list.
virtual void AddFirst(TObject *obj)
Add object at the beginning of the list.
virtual TObject * FindObject(const char *name) const
Find an object in this list using its name.
virtual TObjLink * FirstLink() const
virtual void Delete(Option_t *option="")
Remove all objects from the list AND delete all heap based objects.
virtual void AddLast(TObject *obj)
Add object at the end of the list.
virtual void Clear(Option_t *option="")
Remove all objects from the list.
Each ROOT class (see TClass) has a linked list of methods.
virtual const char * GetCommentString()
Returns a comment string from the class declaration.
virtual const char * GetName() const
Returns name of object.
Wrapper around a TObject so it can be stored in a TList.
TObject * GetObject() const
Wrapper for PCRE library (Perl Compatible Regular Expressions).
Int_t Substitute(TString &s, const TString &r, Bool_t doDollarSubst=kTRUE)
Substitute matching part of s with r, dollar back-ref substitution is performed if doDollarSubst is t...
TQConnectionList is the named list of connections, see also TQConnection class.
void ls(Option_t *option="") const
List signal name and list all connections in this signal list.
TQConnectionList(const char *name, Int_t nsigargs)
Bool_t Disconnect(void *receiver=nullptr, const char *slot_name=nullptr)
Remove connection from the list.
virtual ~TQConnectionList()
Destructor.
TQConnection class is an internal class, used in the object communication mechanism.
void * GetReceiver() const
const char * GetName() const override
Returns name of connection (aka name of slot)
This is the ROOT implementation of the Qt object communication mechanism (see also http://www....
static Int_t CheckConnectArgs(TQObject *sender, TClass *sender_class, const char *signal, TClass *receiver_class, const char *slot)
Checking of consistency of sender/receiver methods/arguments.
virtual Int_t NumberOfConnections() const
Return number of connections for this object.
TQObject()
TQObject Constructor.
void CollectClassSignalLists(TList &list, TClass *cls)
Collect class signal lists from class cls and all its base-classes.
virtual const char * GetSenderClassName() const
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
TList * GetListOfSignals() const
Bool_t fSignalsBlocked
list of connections to this object
static TString CompressName(const char *method_name)
Removes "const" words and blanks from full (with prototype) method name and resolve any typedefs in t...
TList * GetListOfClassSignals() const
Returns pointer to list of signals of this class.
static Bool_t fgAllSignalsBlocked
flag used for suppression of signals
virtual Int_t NumberOfSignals() const
Return number of signals for this object.
virtual ~TQObject()
TQObject Destructor.
TList * fListOfConnections
list of signals from this object
Bool_t Connect(const char *signal, const char *receiver_class, void *receiver, const char *slot)
Non-static method is used to connect from the signal of this object to the receiver slot.
Bool_t Disconnect(const char *signal=0, void *receiver=0, const char *slot=0)
Disconnects signal of this object from slot of receiver.
virtual Bool_t HasConnection(const char *signal_name) const
Return true if there is any object connected to this signal.
static Bool_t ConnectToClass(TQObject *sender, const char *signal, TClass *receiver_class, void *receiver, const char *slot)
Create connection between sender and receiver.
static Bool_t AreAllSignalsBlocked()
Returns true if all signals are blocked.
virtual void LowPriority(const char *signal_name, const char *slot_name=0)
virtual void Connected(const char *)
virtual void HighPriority(const char *signal_name, const char *slot_name=0)
Provides iteration through tokens of a given string.
Bool_t NextToken()
Get the next token, it is stored in this TString.
const char * Data() const
TString & Remove(Ssiz_t pos)
This class implements a mutex interface.
RPY_EXPORTED TCppMethod_t GetMethod(TCppScope_t scope, TCppIndex_t imeth)