Couchbase Lite
Objective-C API for iOS and Mac OS
CBLDynamicObject.h
Go to the documentation of this file.
1 //
2 // CBLDynamicObject.h
3 // MYUtilities
4 //
5 // Created by Jens Alfke on 8/6/09.
6 // Copyright 2009 Jens Alfke. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 
11 
15 @interface CBLDynamicObject : NSObject
16 
18 + (NSSet*) propertyNames;
19 
23 - (id) getValueOfProperty: (NSString*)property;
24 
30 - (BOOL) setValue: (id)value ofProperty: (NSString*)property;
31 
32 
33 // FOR SUBCLASSES TO CALL:
34 
37 + (Class) classOfProperty: (NSString*)propertyName;
38 
39 + (NSString*) getterKey: (SEL)sel;
40 + (NSString*) setterKey: (SEL)sel;
41 
42 // ADVANCED STUFF FOR SUBCLASSES TO OVERRIDE:
43 
44 + (IMP) impForGetterOfProperty: (NSString*)property ofClass: (Class)propertyClass;
45 + (IMP) impForSetterOfProperty: (NSString*)property ofClass: (Class)propertyClass;
46 + (IMP) impForGetterOfProperty: (NSString*)property ofProtocol: (Protocol*)propertyProtocol;
47 + (IMP) impForSetterOfProperty: (NSString*)property ofProtocol: (Protocol*)propertyProtocol;
48 + (IMP) impForGetterOfProperty: (NSString*)property ofType: (const char*)propertyType;
49 + (IMP) impForSetterOfProperty: (NSString*)property ofType: (const char*)propertyType;
50 
51 @end
52 
59 BOOL CBLGetPropertyInfo(Class cls,
60  NSString *propertyName,
61  BOOL setter,
62  Class *declaredInClass,
63  const char* *propertyType);
64 
65 
70 Class CBLClassFromType(const char* propertyType, Class relativeToClass);
71 
73 Protocol* CBLProtocolFromType(const char* propertyType, Class relativeToClass);
Protocol * CBLProtocolFromType(const char *propertyType, Class relativeToClass)
Same as MYClassFromType, except for protocols.
BOOL CBLGetPropertyInfo(Class cls, NSString *propertyName, BOOL setter, Class *declaredInClass, const char **propertyType)
Given an Objective-C class object, a property name, and a BOOL for whether the property should be rea...
A generic class with runtime support for dynamic properties.
Definition: CBLDynamicObject.h:15
Class CBLClassFromType(const char *propertyType, Class relativeToClass)
Given an Objective-C property type string, returns the property type as a Class object, or nil if a class does not apply or no such property is present.
NSSet * propertyNames()
Returns the names of all properties defined in this class and superclasses up to CBLDynamicObject.