71#include "RConfigure.h"
104 static TPMERegexp *constRe =
nullptr, *wspaceRe =
nullptr;
105 if (constRe ==
nullptr) {
106 constRe =
new TPMERegexp(
"(?<=\\(|\\s|,|&|\\*)const(?=\\s|,|\\)|&|\\*)",
"go");
107 wspaceRe =
new TPMERegexp(
"\\s+(?=([^\"]*\"[^\"]*\")*[^\"]*$)",
"go");
110 wspaceRe->Substitute(res,
"");
125 if (arg[pri] ==
'*' || arg[pri] ==
'&') {
136 if (!arg.
AtEnd()) res +=
",";
147TMethod *GetMethodWithPrototype(
TClass *cl,
const char *method,
155 if (
m) nargs =
m->GetNargs();
176 TClass *sender_class,
const char *signal,
177 TClass *receiver_class,
const char *slot)
179 auto len = strlen(signal)+1;
180 char *signal_method =
new char[len];
181 if (signal_method) strlcpy(signal_method, signal, len);
186 if ((signal_proto = strchr(signal_method,
'('))) {
188 *signal_proto++ =
'\0';
190 if ((tmp = strrchr(signal_proto,
')'))) *tmp =
'\0';
193 if (!signal_proto) signal_proto = (
char*)
"";
199 ::Error(
"TQObject::CheckConnectArgs",
"for signal/slot consistency\n"
200 "checking need to specify class name as argument to "
202 delete [] signal_method;
208 TMethod *signalMethod = GetMethodWithPrototype(sender_class,
213 ::Error(
"TQObject::CheckConnectArgs",
"signal %s::%s(%s) does not exist",
214 sender_class->
GetName(), signal_method, signal_proto);
215 delete [] signal_method;
218 Int_t nsigargs = nargs;
220#if defined(CHECK_COMMENT_STRING)
221 const char *comment = 0;
222 if (signalMethod != (
TMethod *) -1)
225 if (!comment || !comment[0] || strstr(comment,
"*SIGNAL")){
226 ::Error(
"TQObject::CheckConnectArgs",
227 "signal %s::%s(%s), to declare signal use comment //*SIGNAL*",
228 sender_class->
GetName(), signal_method, signal_proto);
229 delete [] signal_method;
235 delete [] signal_method;
237 auto len2 = strlen(slot)+1;
238 char *slot_method =
new char[len2];
239 if (slot_method) strlcpy(slot_method, slot, len2);
242 char *slot_params =
nullptr;
244 if ((slot_proto = strchr(slot_method,
'('))) {
247 *slot_proto++ =
'\0';
250 if ((tmp = strrchr(slot_proto,
')'))) *tmp =
'\0';
253 if (!slot_proto) slot_proto = (
char*)
"";
254 if ((slot_params = strchr(slot_proto,
'='))) *slot_params =
' ';
257 if (!receiver_class) {
259 slotMethod =
gROOT->GetGlobalFunction(slot_method,
nullptr,
kFALSE);
261 slotMethod = !slot_params ?
262 GetMethodWithPrototype(receiver_class,
266 GetMethod(receiver_class,
267 slot_method, slot_params);
272 ::Error(
"TQObject::CheckConnectArgs",
"slot %s(%s) does not exist",
273 receiver_class ?
Form(
"%s::%s", receiver_class->
GetName(),
274 slot_method) : slot_method, slot_proto);
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_params);
280 delete [] slot_method;
284#if defined(CHECK_ARGS_NUMBER)
287 ::Error(
"TQObject::CheckConnectArgs",
288 "inconsistency in numbers of arguments");
289 delete [] slot_method;
295 delete [] slot_method;
315 Bool_t Disconnect(
void *receiver =
nullptr,
const char *slot_name =
nullptr);
317 void ls(
Option_t *option =
"")
const override;
331 if (connection->
IsEmpty())
delete connection;
353 if (!slot_name || !slot_name[0]
354 || !strcmp(
name,slot_name)) {
356 if (!receiver || (receiver == obj)) {
357 return_value =
kTRUE;
358 savlnk = lnk->
Next();
376 std::cout <<
"TQConnectionList:" <<
"\t" <<
GetName() << std::endl;
416 while ((connection = (
TQConnection*)next_connection())) {
417 TIter next_list(connection);
420 list->Remove(connection);
458 while ((base = (
TBaseClass*) next_base_class()))
575 if ((nsigargs =
CheckConnectArgs(sender, sender->
IsA(), signal_name, cl, slot_name)) == -1)
593 if (!strcmp(slot_name,connection->
GetName()) &&
602 clist->
Add(connection);
633 if ((nsigargs =
CheckConnectArgs(
nullptr, sender, signal_name, cl, slot_name)) == -1)
650 if (!strcmp(slot_name,connection->
GetName()) &&
659 clist->
Add(connection);
661 ((
TQClass*)sender)->Connected(signal_name);
707 if (rcv_cl)
return ConnectToClass(sender, signal, rcv_cl, receiver, slot);
723 if ((nsigargs =
CheckConnectArgs(sender, sender->
IsA(), signal_name,
nullptr, slot_name)) == -1)
740 if (!strcmp(slot_name,connection->
GetName()) &&
749 clist->
Add(connection);
799 if (rcv_cl)
return ConnectToClass(class_name, signal, rcv_cl, receiver,
819 if ((nsigargs =
CheckConnectArgs(
nullptr, sender, signal_name,
nullptr, slot_name)) == -1)
838 if (!strcmp(slot_name,connection->
GetName()) &&
847 clist->
Add(connection);
849 ((
TQClass*)sender)->Connected(signal_name);
866 const char *receiver_class,
896 if (!strcmp(slot_name,connection->
GetName()) &&
901 connection =
new TQConnection(receiver_class, receiver, slot_name);
905 clist->
Add(connection);
973 if (!signal || signal_name.
IsNull()) {
974 next_return = slist->
Disconnect(receiver,slot_name);
975 return_value = return_value || next_return;
981 }
else if (signal && !strcmp(signal_name,slist->
GetName())) {
982 next_return = slist->
Disconnect(receiver,slot_name);
983 return_value = return_value || next_return;
1016 return Disconnect(qcl, signal, receiver, slot);
1027 return Disconnect(
this, signal, receiver, slot);
1067 TString str =
"ProcessLine(=";
int Int_t
Signed integer 4 bytes (int).
char Char_t
Character 1 byte (char).
bool Bool_t
Boolean (0=false, 1=true) (bool).
const char Option_t
Option string (const char).
Error("WriteTObject","The current directory (%s) is not associated with a file. The object (%s) has not been written.", GetName(), objname)
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,...)
Formats a string in a circular formatting buffer.
#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 override
Return kTRUE if this class inherits from a class with name "classname".
TClass * IsA() const override
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.
const char * GetName() const override
Return name of this collection.
void Print(Option_t *option="") const override
Default print for collections, calls Print(option, 1).
virtual Bool_t IsEmpty() const
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...
void Clear(Option_t *option="") override
Remove all objects from the list.
TList(const TList &)=delete
TObject * FindObject(const char *name) const override
Find an object in this list using its name.
void Add(TObject *obj) override
TObject * Remove(TObject *obj) override
Remove object from the list.
void AddLast(TObject *obj) override
Add object at the end of the list.
virtual TObjLink * FirstLink() const
void AddFirst(TObject *obj) override
Add object at the beginning of 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.
const char * GetName() const override
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 override
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.
~TQConnectionList() override
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
TQObject(const TQObject &)=delete
static Bool_t BlockAllSignals(Bool_t b)
Block or unblock all signals. Returns the previous block status.
TList * GetListOfSignals() const
Bool_t fSignalsBlocked
! flag used for suppression of signals
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
virtual Int_t NumberOfSignals() const
Return number of signals for this object.
virtual ~TQObject()
TQObject Destructor.
virtual void Streamer(TBuffer &)
Stream an object of class TQObject.
TList * fListOfSignals
! list of signals from this object
TList * fListOfConnections
! list of connections to 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.
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.
virtual TClass * IsA() const
virtual void LowPriority(const char *signal_name, const char *slot_name=nullptr)
Bool_t Disconnect(const char *signal=nullptr, void *receiver=nullptr, const char *slot=nullptr)
Disconnects signal of this object from slot of receiver.
static Bool_t AreAllSignalsBlocked()
Returns true if all signals are blocked.
virtual void HighPriority(const char *signal_name, const char *slot_name=nullptr)
virtual void Connected(const char *)
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)