UAActionRegistry Class Reference
Inherits from | NSObject |
Declared in | UAActionRegistry.h |
Overview
This class is responsible for runtime-persisting actions and associating them with names and predicates.
Tasks
-
registeredEntries
property -
+ defaultRegistry
-
– registerAction:name:predicate:
-
– registerAction:names:predicate:
-
– registerAction:name:
-
– registerAction:names:
-
– registryEntryWithName:
-
– addSituationOverride:forEntryWithName:action:
-
– updatePredicate:forEntryWithName:
-
– updateAction:forEntryWithName:
-
– removeName:
-
– removeEntryWithName:
-
– addName:forEntryWithName:
Instance Methods
addName:forEntryWithName:
Adds a name to a registered entry.
- (BOOL)addName:(NSString *)name forEntryWithName:(NSString *)entryName
Parameters
- name
The name to add to the registered entry.
- entryName
The name of registered entry.
Return Value
YES
if the name was added to the entry. NO
if
no entry was found for ‘entryName’, the entry is reserved, or the name
is already used for a reserved entry.
Declared In
UAActionRegistry.h
addSituationOverride:forEntryWithName:action:
Adds a situation override action to be used instead of the default registered action for a given situation. A nil action will cause the entry to be cleared.
- (BOOL)addSituationOverride:(UASituation)situation forEntryWithName:(NSString *)name action:(nullable UAAction *)action
Parameters
- situation
The situation to override
- name
Name of the registered entry
- action
Action to be performed
Return Value
YES
if the action was added to the entry for the situation override.
NO
if the entry is unable to be found with the given name, if the situation
is nil, or if the registered entry is reserved.
Declared In
UAActionRegistry.h
registerAction:name:
Registers an action.
- (BOOL)registerAction:(UAAction *)action name:(NSString *)name
Parameters
- action
Action to be performed
- name
Name of the action
Return Value
YES
if the action was registered, NO
if the action was unable to
be registered because the name conflicts with a reserved action, the name is
nil, or the action is nil.
Discussion
If another entry is registered under specified name, it will be removed from that entry and used for the new action.
Declared In
UAActionRegistry.h
registerAction:name:predicate:
Registers an action with a predicate.
- (BOOL)registerAction:(UAAction *)action name:(NSString *)name predicate:(nullable UAActionPredicate)predicate
Parameters
- action
Action to be performed
- name
Name of the action
- predicate
A predicate that is evaluated to determine if the action should be performed
Return Value
YES
if the action was registered, NO
if the action was unable to
be registered because the name conflicts with a reserved action, the name is
nil, or the action is nil
.
Discussion
If another entry is registered under specified name, it will be removed from that entry and used for the new action.
Declared In
UAActionRegistry.h
registerAction:names:
Registers an action.
- (BOOL)registerAction:(UAAction *)action names:(NSArray *)names
Parameters
- action
Action to be performed
- names
An array of names for the registry
Return Value
YES
if the action was registered, NO
if the action was unable to
be registered because one of the names conflicts with a reserved action,
no names were specified, or the action is nil
.
Discussion
If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.
Declared In
UAActionRegistry.h
registerAction:names:predicate:
Registers an action with a predicate.
- (BOOL)registerAction:(UAAction *)action names:(NSArray *)names predicate:(nullable UAActionPredicate)predicate
Parameters
- action
Action to be performed
- names
An array of names for the registry
- predicate
A predicate that is evaluated to determine if the action should be performed
Return Value
YES
if the action was registered, NO
if the action was unable to
be registered because one of the names conflicts with a reserved action,
no names were specified, or the action is nil
.
Discussion
If other entries are registered under any of the specified names, they will be removed from the entry and used for this new action.
Declared In
UAActionRegistry.h
registryEntryWithName:
Returns a registered action for a given name.
- (nullable UAActionRegistryEntry *)registryEntryWithName:(NSString *)name
Parameters
- name
The name of the action
Return Value
The UAActionRegistryEntry for the name or alias if registered, nil otherwise.
Declared In
UAActionRegistry.h
removeEntryWithName:
Removes an entry and all of its registered names.
- (BOOL)removeEntryWithName:(NSString *)name
Parameters
- name
The name of the entry to remove.
Return Value
YES
if the entry was removed from a registry. NO
if the
entry is a reserved action and is unable to be removed.
Declared In
UAActionRegistry.h
removeName:
Removes a name for a registered entry.
- (BOOL)removeName:(NSString *)name
Parameters
- name
The name to remove
Return Value
YES
if the name was removed from a registered entry. NO
if the
name is a reserved action name and is unable to be removed.
Declared In
UAActionRegistry.h
updateAction:forEntryWithName:
Updates the default action for a registered entry.
- (BOOL)updateAction:(UAAction *)action forEntryWithName:(NSString *)name
Parameters
- action
Action to update for the entry
- name
Name of the registered entry
Return Value
YES
if the action was updated for the entry. NO
if the entry
is unable to be found with the given name or if the registered entry is
reserved.
Declared In
UAActionRegistry.h
updatePredicate:forEntryWithName:
Updates the predicate for a registered entry.
- (BOOL)updatePredicate:(nullable UAActionPredicate)predicate forEntryWithName:(NSString *)name
Parameters
- predicate
Predicate to update or
nil
to clear the current predicate
- name
Name of the registered entry
Return Value
YES
if the predicate was updated for the entry. NO
if the entry
is unable to be found with the given name or if the registered entry
is reserved.
Declared In
UAActionRegistry.h