XCube
The foundational Core of XoopsCube Legacy
 
Loading...
Searching...
No Matches
XCube_Delegate Class Reference

[Final] Used for the simple mechanism for common delegation in XCube. More...

Public Member Functions

 __construct ()
 Constructor.
 
 _setSignatures ( $args)
 Set signatures for this delegate.
 
 register ( $delegateName)
 Registers this object to delegate manager of root.
 
 add ( $callback, $param2=null, $param3=null)
 [Overload] Connects functions to this object as callback functions
 
 delete ( $delcallback)
 Disconnects a function from this object.
 
 reset ()
 Resets all delegate functions from this object.
 
 call ()
 Calls connected functions of this object.
 
 isEmpty ()
 Gets a value indicating whether this object has callback functions.
 
 getID ()
 

Data Fields

 $_mSignatures = []
 Vector Array - The list of type of parameters.
 
 $_mCallbacks = []
 Complex Array - This is Array for callback type data.
 
 $_mHasCheckSignatures = false
 bool
 
 $_mIsLazyRegister = false
 
 $_mLazyRegisterName
 string - the registry name for lazy registration.
 
 $_mUniqueID
 

Detailed Description

[Final] Used for the simple mechanism for common delegation in XCube.

A delegate can have $callback as connected function, $filepath for lazy loading and $priority as order indicated.

\per Priority

Default of this parameter is XCUBE_DELEGATE_PRIORITY_NORMAL. Usually, this parameter isn't specified. Plus, the magic number should be used to specify priority. Use XCUBE_DELEGATE_PRIORITY_FIRST or XCUBE_DELEGATE_PRIORITY_FINAL with Addition and Subtraction. (e.x. XCUBE_DELEGATE_PRIORITY_NORMAL - 1 )

Attention
This is the candidate new delegate style, which avoids any conflict with the previous version of XCube_Delegate.

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor.

The parameter of the constructor is a variable argument style to specify the signature of this delegate. If the argument is empty, signature checking doesn't work. Empty arguments are good to use in many cases. But, it is important to emphasize a delegate to make well-connected functions.

$delegate =new XCube_Delegate("string", "string");
[Final] Used for the simple mechanism for common delegation in XCube.
Definition XCube_Delegate.class.php:101

Member Function Documentation

◆ _setSignatures()

_setSignatures ( $args)

Set signatures for this delegate.

Parameters
$argsArray - std::vector<string>
Returns
void

By this method, this function will check the arguments with the following signatures to call().

◆ add()

add ( $callback,
$param2 = null,
$param3 = null )

[Overload] Connects functions to this object as callback functions

Parameters
$callback
null$param2
null$param3
Returns
void

This method is a virtual overload by signatures.

add(callback $callback, int priority = XCUBE_DELEGATE_PRIORITY_NORMAL);
add(callback $callback, string filepath = null);
add(callback $callback, int priority =... , string filepath=...);
add( $callback, $param2=null, $param3=null)
[Overload] Connects functions to this object as callback functions
Definition XCube_Delegate.class.php:224

◆ delete()

delete ( $delcallback)

Disconnects a function from this object.

Parameters
$delcallback
Returns
void

◆ isEmpty()

isEmpty ( )

Gets a value indicating whether this object has callback functions.

Returns
bool

◆ register()

register ( $delegateName)

Registers this object to delegate manager of root.

Parameters
string$delegateName
Returns
bool

◆ reset()

reset ( )

Resets all delegate functions from this object.

Returns
void
Attention
This is a special method, it is not recommended using this with XCube.

The documentation for this class was generated from the following file: