Differences From Artifact [3dd35e7786]:
- File
src/OFKeyValueCoding.h
— part of check-in
[3ad1f2b268]
at
2016-06-05 00:01:20
on branch trunk
— Add OFKeyValueCoding
No support for paths and auto-wrapping yet.
Also, no classes like OFDictionary override it yet. (user: js, size: 1920) [annotate] [blame] [check-ins using]
To Artifact [141094746d]:
- File
src/OFKeyValueCoding.h
— part of check-in
[cbacea7ca3]
at
2016-06-05 14:32:21
on branch trunk
— Implement Key Value Coding for OFDictionary
If the key starts with an @, the @ is stripped and the super method is
called. Otherwise, this is equivalent to -[objectForKey:] /
-[setValue:forKey:]. (user: js, size: 2024) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ @class OFString; /*! * @protocol OFKeyValueCoding OFKeyValueCoding.h ObjFW/OFKeyValueCoding.h * * @brief A protocol for Key Value Coding. * * Key Value Coding makes it possible to access properties dynamically using * the interface described by this protocol. */ @protocol OFKeyValueCoding /*! * @brief Return the value for the specified key * * @param key The key of the value to return * @return The value for the specified key */ | > > > > | | | | > > | 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | * * Alternatively, it may be distributed under the terms of the GNU General * Public License, either version 2 or 3, which can be found in the file * LICENSE.GPLv2 or LICENSE.GPLv3 respectively included in the packaging of this * file. */ #import "macros.h" @class OFString; OF_ASSUME_NONNULL_BEGIN /*! * @protocol OFKeyValueCoding OFKeyValueCoding.h ObjFW/OFKeyValueCoding.h * * @brief A protocol for Key Value Coding. * * Key Value Coding makes it possible to access properties dynamically using * the interface described by this protocol. */ @protocol OFKeyValueCoding /*! * @brief Return the value for the specified key * * @param key The key of the value to return * @return The value for the specified key */ - (nullable id)valueForKey: (OFString*)key; /*! * @brief This is called by @ref valueForKey: if the specified key does not * exist. * * By default, this throws an @ref OFUndefinedKeyException. * * @param key The undefined key of the value to return * @return The value for the specified undefined key */ - (nullable id)valueForUndefinedKey: (OFString*)key; /*! * @brief Set the value for the specified key * * @param value The value for the specified key * @param key The key of the value to set */ - (void)setValue: (nullable id)value forKey: (OFString*)key; /*! * @brief This is called by @ref setValue:forKey: if the specified key does not * exist. * * By default, this throws an @ref OFUndefinedKeyException. * * @param value The value for the specified undefined key * @param key The undefined key of the value to set */ - (void)setValue: (nullable id)value forUndefinedKey: (OFString*)key; @end OF_ASSUME_NONNULL_END |