XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
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.

Definition at line 101 of file XCube_Delegate.class.php.

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 at line 154 of file XCube_Delegate.class.php.

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().

Definition at line 171 of file XCube_Delegate.class.php.

◆ 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 at line 224 of file XCube_Delegate.class.php.

◆ call()

call ( )

Calls connected functions of this object.

Definition at line 284 of file XCube_Delegate.class.php.

◆ delete()

delete ( $delcallback)

Disconnects a function from this object.

Parameters
$delcallback
Returns
void

Definition at line 254 of file XCube_Delegate.class.php.

◆ getID()

getID ( )

Definition at line 374 of file XCube_Delegate.class.php.

◆ isEmpty()

isEmpty ( )

Gets a value indicating whether this object has callback functions.

Returns
bool

Definition at line 363 of file XCube_Delegate.class.php.

◆ register()

register ( $delegateName)

Registers this object to delegate manager of root.

Parameters
string$delegateName
Returns
bool

Definition at line 191 of file XCube_Delegate.class.php.

◆ 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.

Definition at line 275 of file XCube_Delegate.class.php.

Field Documentation

◆ $_mCallbacks

$_mCallbacks = []

Complex Array - This is Array for callback type data.

Definition at line 112 of file XCube_Delegate.class.php.

◆ $_mHasCheckSignatures

$_mHasCheckSignatures = false

bool

Definition at line 118 of file XCube_Delegate.class.php.

◆ $_mIsLazyRegister

$_mIsLazyRegister = false

Definition at line 129 of file XCube_Delegate.class.php.

◆ $_mLazyRegisterName

$_mLazyRegisterName

string - the registry name for lazy registration.

Definition at line 135 of file XCube_Delegate.class.php.

◆ $_mSignatures

$_mSignatures = []

Vector Array - The list of type of parameters.

Definition at line 106 of file XCube_Delegate.class.php.

◆ $_mUniqueID

$_mUniqueID

Definition at line 140 of file XCube_Delegate.class.php.


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