Couchbase Lite
Objective-C API for iOS and Mac OS
CBLProperties.h
Go to the documentation of this file.
1 //
2 // CBLProperties.h
3 // CouchbaseLite
4 //
5 // Created by Pasin Suriyentrakorn on 12/29/16.
6 // Copyright © 2016 Couchbase. All rights reserved.
7 //
8 
9 #import <Foundation/Foundation.h>
10 @class CBLSubdocument;
11 
12 NS_ASSUME_NONNULL_BEGIN
13 
16 @protocol CBLProperties <NSObject>
17 
19 @property (readwrite, nullable, nonatomic) NSDictionary* properties;
20 
21 #pragma mark - GETTERS
22 
26 - (nullable id) objectForKey: (NSString*)key;
27 
30 - (BOOL) booleanForKey: (NSString*)key;
31 
35 - (NSInteger) integerForKey: (NSString*)key;
36 
40 - (float) floatForKey: (NSString*)key;
41 
45 - (double) doubleForKey: (NSString*)key;
46 
49 - (nullable NSString*) stringForKey: (NSString*)key;
50 
57 - (nullable NSDate*) dateForKey: (NSString*)key;
58 
59 #pragma mark - SETTERS
60 
66 - (void) setObject: (nullable id)value forKey: (NSString*)key;
67 
69 - (void) setBoolean: (BOOL)value forKey: (NSString*)key;
70 
72 - (void) setInteger: (NSInteger)value forKey: (NSString*)key;
73 
75 - (void) setFloat: (float)value forKey: (NSString*)key;
76 
78 - (void) setDouble: (double)value forKey: (NSString*)key;
79 
80 #pragma mark - SUBSCRIPTS
81 
83 - (nullable id) objectForKeyedSubscript: (NSString*)key;
84 
86 - (void) setObject: (nullable id)value forKeyedSubscript: (NSString*)key;
87 
88 #pragma mark - OTHERS
89 
91 - (void) removeObjectForKey: (NSString*)key;
92 
96 - (BOOL) containsObjectForKey: (NSString*)key;
97 
98 @end
99 
100 
104 @interface CBLProperties: NSObject <CBLProperties>
105 
106 - (instancetype) init NS_UNAVAILABLE;
107 
108 @end
109 
110 NS_ASSUME_NONNULL_END
111 
112 // TODO:
113 // 1. Evaluate get/set Array of a specific type (new API)
114 // 2. Subdocument (In progress)
115 // 4. Property complex object (Can be deferred)
116 // 5. Iterable or ObjC Equivalent (Can be deferred)
CBLProperties defines a JSON-compatible object, much like an NSMutableDictionary but with type-safe a...
Definition: CBLProperties.h:16
instancetype NS_UNAVAILABLE()
NSDictionary * properties
All of the properties contained in this object.
Definition: CBLProperties.h:19
Default implementation of CBLProperties protocol, which defines a JSON-compatible object...
Definition: CBLProperties.h:104