XCube
The foundational Core of XoopsCube Legacy
 
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.

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

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

◆ getDelegates()

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

◆ isEmpty()

isEmpty ( string $name)

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

Parameters
string$namestring - Registration name.
Returns
bool

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

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

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