ObjFW
Loading...
Searching...
No Matches
<OFKeyValueCoding> Protocol Reference

A protocol for Key Value Coding. More...

#include <ObjFW/ObjFW.h>

Instance Methods

(nullable id) - valueForKey:
 Returns the value for the specified key.
 
(nullable id) - valueForKeyPath:
 Returns the value for the specified key path.
 
(nullable id) - valueForUndefinedKey:
 This is called by valueForKey: if the specified key does not exist.
 
(void) - setValue:forKey:
 Set the value for the specified key.
 
(void) - setValue:forKeyPath:
 Set the value for the specified key path.
 
(void) - setValue:forUndefinedKey:
 This is called by setValue:forKey: if the specified key does not exist.
 
(void) - setNilValueForKey:
 This is called by setValue:forKey: if the specified key is a scalar, but the value specified is nil.
 

Detailed Description

A protocol for Key Value Coding.

Key Value Coding makes it possible to access properties dynamically using the interface described by this protocol.

Method Documentation

◆ setNilValueForKey:

- (void) setNilValueForKey: (OFString *) key

This is called by setValue:forKey: if the specified key is a scalar, but the value specified is nil.

By default, this throws an OFInvalidArgumentException.

Parameters
keyThe key for which the value nil was specified

◆ setValue:forKey:

- (void) setValue: (nullable id) value
forKey: (OFString *) key 

Set the value for the specified key.

Parameters
valueThe value for the specified key
keyThe key of the value to set
Exceptions
OFUndefinedKeyExceptionThe specified key does not exist and setValue:forUndefinedKey: was not overridden

◆ setValue:forKeyPath:

- (void) setValue: (nullable id) value
forKeyPath: (OFString *) keyPath 

Set the value for the specified key path.

Parameters
valueThe value for the specified key path
keyPathThe key path of the value to set
Exceptions
OFUndefinedKeyExceptionThe specified key does not exist and setValue:forUndefinedKey: was not overridden

◆ setValue:forUndefinedKey:

- (void) setValue: (nullable id) value
forUndefinedKey: (OFString *) key 

This is called by setValue:forKey: if the specified key does not exist.

By default, this throws an OFUndefinedKeyException.

Parameters
valueThe value for the specified undefined key
keyThe undefined key of the value to set
Exceptions
OFUndefinedKeyExceptionThe specified key does not exist

◆ valueForKey:

- (nullable id) valueForKey: (OFString *) key

Returns the value for the specified key.

Parameters
keyThe key of the value to return
Returns
The value for the specified key
Exceptions
OFUndefinedKeyExceptionThe specified key does not exist and valueForUndefinedKey: was not overridden

◆ valueForKeyPath:

- (nullable id) valueForKeyPath: (OFString *) keyPath

Returns the value for the specified key path.

Parameters
keyPathThe key path of the value to return
Returns
The value for the specified key path
Exceptions
OFUndefinedKeyExceptionThe specified key does not exist and valueForUndefinedKey: was not overridden

◆ valueForUndefinedKey:

- (nullable id) valueForUndefinedKey: (OFString *) key

This is called by valueForKey: if the specified key does not exist.

By default, this throws an OFUndefinedKeyException.

Parameters
keyThe undefined key of the value to return
Returns
The value for the specified undefined key
Exceptions
OFUndefinedKeyExceptionThe specified key does not exist

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