XCL Web Application Platform 2.5.0
The XoopsCube Legacy Project
Loading...
Searching...
No Matches
XCube_DelegateManager Class Reference

Manager for delegates. More...

Public Member Functions

 __construct ()
 Constructor.
 
 register ( $name, &$delegate)
 Adds $delegate as Delegate to the list of this manager.
 
 add (string $name, $callback, $param3=null, $param4=null)
 Connects functions to the delegate that have the specified name.
 
 delete (string $name, $delcallback)
 Disconnects a function from the delegate that have the specified name.
 
 reset (string $name)
 Resets all functions off the delegate that have the specified name.
 
 isEmpty (string $name)
 Gets a value indicating whether the specified delegate has callback functions.
 
 getDelegates ()
 

Data Fields

 $_mCallbacks = []
 Complex Array.
 
 $_mCallbackParameters = []
 Complex Array.
 
 $_mDelegates = []
 Map Array - std::map<string, XCube_Delegate*>
 

Detailed Description

Manager for delegates.

This is the agent of un-registered delegate objects. Usually, connected functions can't be added to un-registered delegates. When destination delegates are not yet registered, this handler retains these functions and settings until the destination delegate is registered. In other words, this class performs lazy delegate registration.

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

Constructor & Destructor Documentation

◆ __construct()

__construct ( )

Constructor.

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

Member Function Documentation

◆ add()

add ( string $name,
$callback,
$param3 = null,
$param4 = null )

Connects functions to the delegate that have the specified name.

Parameters
string$name- Registration name.
$callback
null$param3
null$param4
Returns
void

If there are no delegates with the specified name, this handler assigns the parameters to member properties. Then, when the delegate with the specified name is registered, this handler will set these parameters to the delegate.

See also
XCube_Delegate\add()

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

◆ delete()

delete ( string $name,
$delcallback )

Disconnects a function from the delegate that have the specified name.

Parameters
string$name- Registration name
$delcallback
See also
XCube_Delegate\delete()

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

◆ getDelegates()

getDelegates ( )
Returns
array Array - std::map<string, XCube_Delegate*>

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

◆ isEmpty()

isEmpty ( string $name)

Gets a value indicating whether the specified delegate has callback functions.

Parameters
string$namestring - Registration name.
Returns
bool

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

◆ register()

register ( $name,
& $delegate )

Adds $delegate as Delegate to the list of this manager.

Parameters
string$name- Registration name.
XCube_Delegate$delegate- Delegate object which will be registered.
Returns
bool

If some functions that want to connect to $delegate, have not yet been assigned, this object calls add() of $delegate with their parameters.

Usually this member function isn't used as Cube's API by developers. In many cases, XCube_Delegate\register() calls this.

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

◆ reset()

reset ( string $name)

Resets all functions off the delegate that have the specified name.

Parameters
string$name- Registration name that will be reset.
See also
XCube_Delegate\reset()

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

Field Documentation

◆ $_mCallbackParameters

$_mCallbackParameters = []

Complex Array.

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

◆ $_mCallbacks

$_mCallbacks = []

Complex Array.

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

◆ $_mDelegates

$_mDelegates = []

Map Array - std::map<string, XCube_Delegate*>

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


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