nano-store 0.2.4 → 0.3.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/.gitmodules +0 -3
- data/Gemfile +1 -1
- data/Gemfile.lock +24 -0
- data/README.md +5 -0
- data/Rakefile +21 -1
- data/lib/nano_store.rb +2 -0
- data/lib/nano_store/finder.rb +76 -0
- data/lib/nano_store/model.rb +1 -32
- data/lib/nano_store/version.rb +1 -1
- data/nano-store.gemspec +1 -0
- data/spec/finder_spec.rb +67 -0
- data/spec/model_spec.rb +0 -30
- data/vendor/Podfile.lock +5 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoBag.h +306 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoBag_Private.h +37 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoEngine.h +542 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoEngine_Private.h +69 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoExpression.h +125 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoExpression_Private.h +35 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoGlobals.h +323 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoGlobals_Private.h +99 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoObject.h +298 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoObjectProtocol.h +119 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoObject_Private.h +35 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoPredicate.h +123 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoPredicate_Private.h +35 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoResult.h +137 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoResult_Private.h +43 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoSearch.h +381 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoSearch_Private.h +48 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoSortDescriptor.h +124 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoStore.h +475 -0
- data/vendor/Pods/Headers/NanoStore/NSFNanoStore_Private.h +57 -0
- data/vendor/Pods/Headers/NanoStore/NanoStore.h +463 -0
- data/vendor/Pods/Headers/NanoStore/NanoStore_Private.h +37 -0
- data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoEngine.h +542 -0
- data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoEngine.m +1781 -0
- data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoResult.h +137 -0
- data/vendor/Pods/NanoStore/Classes/Advanced/NSFNanoResult.m +265 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoBag_Private.h +37 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoEngine_Private.h +69 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoExpression_Private.h +35 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoGlobals_Private.h +99 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoObject_Private.h +35 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoPredicate_Private.h +35 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoResult_Private.h +43 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoSearch_Private.h +48 -0
- data/vendor/Pods/NanoStore/Classes/Private/NSFNanoStore_Private.h +57 -0
- data/vendor/Pods/NanoStore/Classes/Private/NanoStore_Private.h +37 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.h +306 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoBag.m +485 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.h +125 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoExpression.m +103 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoGlobals.h +323 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoGlobals.m +145 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.h +298 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.m +187 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObjectProtocol.h +119 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoPredicate.h +123 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoPredicate.m +130 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.h +381 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSearch.m +859 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSortDescriptor.h +124 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoSortDescriptor.m +79 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.h +475 -0
- data/vendor/Pods/NanoStore/Classes/Public/NSFNanoStore.m +1375 -0
- data/vendor/Pods/NanoStore/Classes/Public/NanoStore.h +463 -0
- data/vendor/Pods/NanoStore/LICENSE +25 -0
- data/vendor/Pods/NanoStore/README.md +411 -0
- data/vendor/Pods/Pods-prefix.pch +3 -0
- data/vendor/Pods/Pods-resources.sh +15 -0
- data/vendor/Pods/Pods.bridgesupport +1215 -0
- data/vendor/Pods/Pods.xcconfig +4 -0
- data/vendor/Pods/Pods.xcodeproj/project.pbxproj +974 -0
- metadata +89 -6
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoExpression_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NSFNanoExpression.h"
|
28
|
+
|
29
|
+
/** \cond */
|
30
|
+
|
31
|
+
@interface NSFNanoExpression (Private)
|
32
|
+
// Just a placeholder.
|
33
|
+
@end
|
34
|
+
|
35
|
+
/** \endcond */
|
@@ -0,0 +1,99 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoGlobals_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import <Foundation/Foundation.h>
|
28
|
+
#import "NSFNanoGlobals.h"
|
29
|
+
|
30
|
+
/** \cond */
|
31
|
+
|
32
|
+
/*
|
33
|
+
The following types are supported by Property Lists:
|
34
|
+
|
35
|
+
CFArray
|
36
|
+
CFDictionary
|
37
|
+
CFData
|
38
|
+
CFString
|
39
|
+
CFDate
|
40
|
+
CFNumber
|
41
|
+
CFBoolean
|
42
|
+
|
43
|
+
Since NanoStore associates an attribute with an atomic value (i.e. non-collection),
|
44
|
+
the following data types are recognized:
|
45
|
+
|
46
|
+
CFData
|
47
|
+
CFString
|
48
|
+
CFDate
|
49
|
+
CFNumber
|
50
|
+
|
51
|
+
Note: there isn't a dedicated data type homologous to CFBoolean in Cocoa. Therefore,
|
52
|
+
NSNumber will be used for that purpose.
|
53
|
+
|
54
|
+
*/
|
55
|
+
|
56
|
+
extern NSString * NSFStringFromMatchType (NSFMatchType aMatchType);
|
57
|
+
|
58
|
+
extern void _NSFLog (NSString *format, ...);
|
59
|
+
|
60
|
+
extern NSString * const NSFVersionKey;
|
61
|
+
extern NSString * const NSFDomainKey;
|
62
|
+
|
63
|
+
extern NSString * const NSFKeys;
|
64
|
+
extern NSString * const NSFValues;
|
65
|
+
extern NSString * const NSFKey;
|
66
|
+
extern NSString * const NSFValue;
|
67
|
+
extern NSString * const NSFDatatype;
|
68
|
+
extern NSString * const NSFCalendarDate;
|
69
|
+
extern NSString * const NSFObjectClass;
|
70
|
+
extern NSString * const NSFPlist;
|
71
|
+
extern NSString * const NSFAttribute;
|
72
|
+
|
73
|
+
#pragma mark -
|
74
|
+
|
75
|
+
extern NSString * const NSF_Private_NSFKeys_NSFKey;
|
76
|
+
extern NSString * const NSF_Private_NSFKeys_NSFPlist;
|
77
|
+
extern NSString * const NSF_Private_NSFValues_NSFKey;
|
78
|
+
extern NSString * const NSF_Private_NSFValues_NSFAttribute;
|
79
|
+
extern NSString * const NSF_Private_NSFValues_NSFValue;
|
80
|
+
extern NSString * const NSF_Private_NSFNanoBag_Name;
|
81
|
+
extern NSString * const NSF_Private_NSFNanoBag_NSFKey;
|
82
|
+
extern NSString * const NSF_Private_NSFNanoBag_NSFObjectKeys;
|
83
|
+
extern NSString * const NSF_Private_ToDeleteTableKey;
|
84
|
+
|
85
|
+
extern NSInteger const NSF_Private_InvalidParameterDataCodeKey;
|
86
|
+
extern NSInteger const NSF_Private_MacOSXErrorCodeKey;
|
87
|
+
|
88
|
+
#pragma mark -
|
89
|
+
|
90
|
+
extern NSString * const NSFP_TableIdentifier;
|
91
|
+
extern NSString * const NSFP_ColumnIdentifier;
|
92
|
+
extern NSString * const NSFP_DatatypeIdentifier;
|
93
|
+
extern NSString * const NSFP_FullDatatypeIdentifier;
|
94
|
+
|
95
|
+
extern NSString * const NSFRowIDColumnName; // SQLite's standard UID property
|
96
|
+
|
97
|
+
extern NSString * const NSFP_SchemaTable; // Private, reserved NSF table name to store datatypes
|
98
|
+
|
99
|
+
/** \endcond */
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoObject.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NSFNanoObject.h"
|
28
|
+
|
29
|
+
/** \cond */
|
30
|
+
|
31
|
+
@interface NSFNanoObject (Private)
|
32
|
+
- (void)_setOriginalClassString:(NSString *)theClassString;
|
33
|
+
@end
|
34
|
+
|
35
|
+
/** \endcond */
|
@@ -0,0 +1,35 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoSearch_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NanoStore.h"
|
28
|
+
|
29
|
+
/** \cond */
|
30
|
+
|
31
|
+
@interface NSFNanoPredicate (Private)
|
32
|
+
// Just a placeholder.
|
33
|
+
@end
|
34
|
+
|
35
|
+
/** \endcond */
|
@@ -0,0 +1,43 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoResult_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NSFNanoResult.h"
|
28
|
+
|
29
|
+
/** \cond */
|
30
|
+
|
31
|
+
@interface NSFNanoResult (Private)
|
32
|
+
+ (NSFNanoResult *)_resultWithDictionary:(NSDictionary *)results;
|
33
|
+
+ (NSFNanoResult *)_resultWithError:(NSError *)error;
|
34
|
+
|
35
|
+
- (id)_initWithDictionary:(NSDictionary *)results;
|
36
|
+
- (id)_initWithError:(NSError *)error;
|
37
|
+
|
38
|
+
- (void)_setError:(NSError *)error;
|
39
|
+
- (void)_reset;
|
40
|
+
- (void)_calculateNumberOfRows;
|
41
|
+
@end
|
42
|
+
|
43
|
+
/** \endcond */
|
@@ -0,0 +1,48 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoSearch_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NanoStore.h"
|
28
|
+
|
29
|
+
/** \cond */
|
30
|
+
|
31
|
+
@interface NSFNanoSearch (Private)
|
32
|
+
- (NSDictionary *)_retrieveDataWithError:(out NSError **)outError;
|
33
|
+
- (NSArray *)_dataWithKey:(NSString *)aKey attribute:(NSString *)anAttribute value:(NSString *)aValue matching:(NSFMatchType)match;
|
34
|
+
- (NSArray *)_dataWithKey:(NSString *)aKey attribute:(NSString *)anAttribute value:(NSString *)aValue matching:(NSFMatchType)match returning:(NSFReturnType)returnedObjectType;
|
35
|
+
- (NSDictionary *)_retrieveDataAdded:(NSFDateMatchType)aDateMatch calendarDate:(NSDate *)aDate error:(out NSError **)outError;
|
36
|
+
- (NSString *)_preparedSQL;
|
37
|
+
- (NSString *)_prepareSQLQueryStringWithKey:(NSString *)aKey attribute:(NSString *)anAttribute value:(id)aValue matching:(NSFMatchType)match;
|
38
|
+
- (NSString *)_prepareSQLQueryStringWithExpressions:(NSArray *)someExpressions;
|
39
|
+
- (NSArray *)_resultsFromSQLQuery:(NSString *)theSQLStatement;
|
40
|
+
+ (NSString *)_prepareSQLQueryStringWithKeys:(NSArray *)someKeys;
|
41
|
+
+ (NSString *)_querySegmentForColumn:(NSString *)aColumn value:(id)aValue matching:(NSFMatchType)match;
|
42
|
+
+ (NSString *)_querySegmentForAttributeColumnWithValue:(id)anAttributeValue matching:(NSFMatchType)match valueColumnWithValue:(id)aValue;
|
43
|
+
- (NSDictionary *)_dictionaryForKeyPath:(NSString *)keyPath value:(id)value;
|
44
|
+
+ (NSString *)_quoteStrings:(NSArray *)strings joiningWithDelimiter:(NSString *)delimiter;
|
45
|
+
- (id)_sortResultsIfApplicable:(NSDictionary *)results returnType:(NSFReturnType)theReturnType;
|
46
|
+
@end
|
47
|
+
|
48
|
+
/** \endcond */
|
@@ -0,0 +1,57 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoStore_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NSFNanoStore.h"
|
28
|
+
|
29
|
+
/** \cond */
|
30
|
+
|
31
|
+
@interface NSFNanoStore (Private)
|
32
|
+
+ (NSFNanoStore *)_debug;
|
33
|
+
- (NSFNanoResult *)_executeSQL:(NSString *)theSQLStatement;
|
34
|
+
- (NSString*)_nestedDescriptionWithPrefixedSpace:(NSString *)prefixedSpace;
|
35
|
+
- (BOOL)_initializePreparedStatementsWithError:(out NSError **)outError;
|
36
|
+
- (void)_releasePreparedStatements;
|
37
|
+
- (void)_setIsOurTransaction:(BOOL)value;
|
38
|
+
- (BOOL)_isOurTransaction;
|
39
|
+
- (BOOL)_setupCachingSchema;
|
40
|
+
- (BOOL)_storeDictionary:(NSDictionary *)someInfo forKey:(NSString *)aKey forClassNamed:(NSString *)classType usingSQLite3Statement:(sqlite3_stmt *)storeValuesStatement error:(out NSError **)outError;
|
41
|
+
- (BOOL)__storeDictionaries:(NSArray *)someObjects forKeys:(NSArray *)someKeys error:(out NSError **)outError;
|
42
|
+
- (BOOL)_bindValue:(id)aValue forAttribute:(NSString *)anAttribute parameterNumber:(NSInteger)aParamNumber usingSQLite3Statement:(sqlite3_stmt *)aStatement;
|
43
|
+
- (BOOL)_checkNanoStoreIsReadyAndReturnError:(out NSError **)outError;
|
44
|
+
- (NSFNanoDatatype)_NSFDatatypeOfObject:(id)value;
|
45
|
+
- (NSString *)_stringFromValue:(id)aValue;
|
46
|
+
+ (NSString *)_calendarDateToString:(NSDate *)aDate;
|
47
|
+
- (void)_flattenCollection:(NSDictionary *)info keys:(NSMutableArray **)flattenedKeys values:(NSMutableArray **)flattenedValues;
|
48
|
+
- (void)_flattenCollection:(id)someObject keyPath:(NSMutableArray **)aKeyPath keys:(NSMutableArray **)someKeys values:(NSMutableArray **)someValues;
|
49
|
+
- (BOOL)_prepareSQLite3Statement:(sqlite3_stmt **)aStatement theSQLStatement:(NSString *)aSQLQuery;
|
50
|
+
- (void)_executeSQLite3StepUsingSQLite3Statement:(sqlite3_stmt *)aStatement;
|
51
|
+
- (BOOL)_addObjectsFromArray:(NSArray *)someObjects forceSave:(BOOL)forceSave error:(out NSError **)outError;
|
52
|
+
+ (NSDictionary *)_defaultTestData;
|
53
|
+
- (BOOL)_backupFileStoreToDirectoryAtPath:(NSString *)aPath extension:(NSString *)anExtension compact:(BOOL)flag error:(out NSError **)outError;
|
54
|
+
- (BOOL)_backupMemoryStoreToDirectoryAtPath:(NSString *)aPath extension:(NSString *)anExtension compact:(BOOL)flag error:(out NSError **)outError;
|
55
|
+
@end
|
56
|
+
|
57
|
+
/** \endcond */
|
@@ -0,0 +1,37 @@
|
|
1
|
+
/*
|
2
|
+
NanoStore_Private.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
#import "NSFNanoGlobals_Private.h"
|
28
|
+
#import "NSFNanoSearch_Private.h"
|
29
|
+
#import "NSFNanoResult_Private.h"
|
30
|
+
#import "NSFNanoStore_Private.h"
|
31
|
+
#import "NSFNanoBag_Private.h"
|
32
|
+
#import "NSFNanoPredicate_Private.h"
|
33
|
+
#import "NSFNanoExpression_Private.h"
|
34
|
+
#import "NSFNanoGlobals_Private.h"
|
35
|
+
#import "NSFNanoEngine_Private.h"
|
36
|
+
#import "NSFNanoObject_Private.h"
|
37
|
+
#import "NSFNanoStore_Private.h"
|
@@ -0,0 +1,306 @@
|
|
1
|
+
/*
|
2
|
+
NSFNanoBag.h
|
3
|
+
NanoStore
|
4
|
+
|
5
|
+
Copyright (c) 2010 Webbo, L.L.C. All rights reserved.
|
6
|
+
|
7
|
+
Redistribution and use in source and binary forms, with or without modification, are permitted
|
8
|
+
provided that the following conditions are met:
|
9
|
+
|
10
|
+
* Redistributions of source code must retain the above copyright notice, this list of conditions
|
11
|
+
and the following disclaimer.
|
12
|
+
* Redistributions in binary form must reproduce the above copyright notice, this list of conditions
|
13
|
+
and the following disclaimer in the documentation and/or other materials provided with the distribution.
|
14
|
+
* Neither the name of Webbo nor the names of its contributors may be used to endorse or promote
|
15
|
+
products derived from this software without specific prior written permission.
|
16
|
+
|
17
|
+
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
|
18
|
+
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A
|
19
|
+
PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY
|
20
|
+
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
|
21
|
+
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
|
22
|
+
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
|
23
|
+
OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
|
24
|
+
SUCH DAMAGE.
|
25
|
+
*/
|
26
|
+
|
27
|
+
/*! @file NSFNanoBag.h
|
28
|
+
@brief A bag is a loose collection of objects stored in a document store.
|
29
|
+
*/
|
30
|
+
|
31
|
+
/** @class NSFNanoBag
|
32
|
+
* A bag is a loose collection of objects stored in a document store.
|
33
|
+
*
|
34
|
+
* @note
|
35
|
+
* The objects must conform to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink. For your convenience, NanoStore provides you with NSFNanoObject, which is the standard
|
36
|
+
* way of storing and retrieving objects from/to a bag.
|
37
|
+
*
|
38
|
+
* @par
|
39
|
+
* It's more efficient to make your storage objects \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant, thus eliminating the need to convert your objects to/from
|
40
|
+
* objects of type NSFNanoObject.
|
41
|
+
*
|
42
|
+
* @details <b>Example:</b>
|
43
|
+
@code
|
44
|
+
// Instantiate a NanoStore and open it
|
45
|
+
NSFNanoStore *nanoStore = [NSFNanoStore createAndOpenStoreWithType:NSFMemoryStoreType path:nil error:nil];
|
46
|
+
[nanoStore removeAllObjectsFromStoreAndReturnError:nil];
|
47
|
+
|
48
|
+
// Add some data to a bag
|
49
|
+
NSFNanoBag *bag = [NSFNanoBag bag];
|
50
|
+
NSDictionary *info = ...;
|
51
|
+
NSFNanoObject *obj1 = [NSFNanoObject nanoObjectWithDictionary:info];
|
52
|
+
NSFNanoObject *obj2 = [NSFNanoObject nanoObjectWithDictionary:info];
|
53
|
+
NSFNanoObject *obj3 = [NSFNanoObject nanoObjectWithDictionary:info];
|
54
|
+
[bag addObjectsFromArray:[NSArray arrayWithObjects:obj1, obj2, obj3, nil] error:nil];
|
55
|
+
|
56
|
+
// Add the bag and its objects to the document store
|
57
|
+
[nanoStore addObject:bag error:nil];
|
58
|
+
|
59
|
+
// Obtain the bags from the document store
|
60
|
+
NSArray *bags = [nanoStore bags];
|
61
|
+
|
62
|
+
// Close the document store
|
63
|
+
[nanoStore closeWithError:nil];
|
64
|
+
@endcode
|
65
|
+
*/
|
66
|
+
|
67
|
+
#import "NSFNanoObjectProtocol.h"
|
68
|
+
|
69
|
+
@interface NSFNanoBag : NSObject <NSFNanoObjectProtocol, NSCopying>
|
70
|
+
|
71
|
+
/** * The store where the bag is located. */
|
72
|
+
@property (nonatomic, weak, readonly) NSFNanoStore *store;
|
73
|
+
/** * The name of the bag. */
|
74
|
+
@property (nonatomic, copy, readwrite) NSString *name;
|
75
|
+
/** * The UUID of the bag. */
|
76
|
+
@property (nonatomic, copy, readonly) NSString *key;
|
77
|
+
/** * Dictionary of NSString (key) and id<NSFNanoObjectProtocol> (value). */
|
78
|
+
@property (nonatomic, readonly) NSDictionary *savedObjects;
|
79
|
+
/** * Dictionary of NSString (key) and id<NSFNanoObjectProtocol> (value). */
|
80
|
+
@property (nonatomic, readonly) NSDictionary *unsavedObjects;
|
81
|
+
/** * Dictionary of NSString (key) and id<NSFNanoObjectProtocol> (value). */
|
82
|
+
@property (nonatomic, readonly) NSDictionary *removedObjects;
|
83
|
+
/** * To determine whether the bag has uncommited changes. */
|
84
|
+
@property (nonatomic, assign, readonly) BOOL hasUnsavedChanges;
|
85
|
+
|
86
|
+
/** @name Creating and Initializing Bags
|
87
|
+
*/
|
88
|
+
|
89
|
+
//@{
|
90
|
+
|
91
|
+
/** * Creates and returns an empty bag.
|
92
|
+
* @return An empty bag upon success, nil otherwise.
|
93
|
+
*/
|
94
|
+
|
95
|
+
+ (NSFNanoBag *)bag;
|
96
|
+
|
97
|
+
/** * Creates and returns a bag adding to it the objects contained in the given array.
|
98
|
+
* @param theObjects an array of objects conforming to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink.
|
99
|
+
* @return A bag only containing the objects with conform to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink upon success, nil otherwise.
|
100
|
+
* @see \link initBagWithNanoObjects: - (NSFNanoBag*)initBagWithNanoObjects:(NSArray *)theObjects \endlink
|
101
|
+
*/
|
102
|
+
|
103
|
+
+ (NSFNanoBag *)bagWithObjects:(NSArray *)theObjects;
|
104
|
+
|
105
|
+
/** * Creates and returns an empty bag with the specified name
|
106
|
+
* @param theName the name of the bag. Can be nil.
|
107
|
+
* @return An empty bag upon success, nil otherwise.
|
108
|
+
*/
|
109
|
+
|
110
|
+
+ bagWithName:(NSString *)theName;
|
111
|
+
|
112
|
+
/** * Creates and returns a bag with the specified name adding to it the objects contained in the given array.
|
113
|
+
* @param theName the name of the bag. Can be nil.
|
114
|
+
* @param theObjects an array of objects conforming to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink.
|
115
|
+
* @return A bag only containing the objects with conform to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink upon success, nil otherwise.
|
116
|
+
* @see \link initBagWithNanoObjects: - (NSFNanoBag*)initBagWithNanoObjects:(NSArray *)theObjects \endlink
|
117
|
+
*/
|
118
|
+
|
119
|
+
+ bagWithName:(NSString *)theName andObjects:(NSArray *)theObjects;
|
120
|
+
|
121
|
+
/** * Initializes a newly allocated bag with the specified name adding to it the objects contained in the given array.
|
122
|
+
* @param theName the name of the bag. Can be nil.
|
123
|
+
* @param theObjects an array of objects conforming to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink.
|
124
|
+
* @return A bag only containing the objects with conform to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink upon success, nil otherwise.
|
125
|
+
* @see \link bagWithObjects: + (NSFNanoBag*)bagWithObjects:(NSArray *)theObjects \endlink
|
126
|
+
*/
|
127
|
+
|
128
|
+
- (id)initBagWithName:(NSString *)theName andObjects:(NSArray *)someObjects;
|
129
|
+
|
130
|
+
//@}
|
131
|
+
|
132
|
+
/** @name Adding and Removing Objects
|
133
|
+
*/
|
134
|
+
|
135
|
+
//@{
|
136
|
+
|
137
|
+
/** * Adds an \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant object to the bag.
|
138
|
+
* @param theObject is added to the bag.
|
139
|
+
* @param outError is used if an error occurs. May be NULL.
|
140
|
+
* @return YES upon success, NO otherwise.
|
141
|
+
* @warning This value cannot be nil and it must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
142
|
+
* @throws NSFNonConformingNanoObjectProtocolException is thrown if the object is non-\link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink compliant.
|
143
|
+
* @see \link addObjectsFromArray:error: - (BOOL)addObjectsFromArray:(NSArray *)theObjects error:(out NSError **)outError \endlink
|
144
|
+
*/
|
145
|
+
|
146
|
+
- (BOOL)addObject:(id <NSFNanoObjectProtocol>)theObject error:(out NSError **)outError;
|
147
|
+
|
148
|
+
/** * Adds a series of \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant objects to the bag.
|
149
|
+
* @param theObjects is an array of objects to be added to the bag. The objects must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
150
|
+
* @param outError is used if an error occurs. May be NULL.
|
151
|
+
* @return YES upon success, NO otherwise.
|
152
|
+
* @warning The objects of the array must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
153
|
+
* @throws NSFNonConformingNanoObjectProtocolException is thrown if the object is non-\link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink compliant.
|
154
|
+
* @see \link addObject:error: - (BOOL)addObject:(id <NSFNanoObjectProtocol>)theObject error:(out NSError **)outError \endlink
|
155
|
+
*/
|
156
|
+
|
157
|
+
- (BOOL)addObjectsFromArray:(NSArray *)theObjects error:(out NSError **)outError;
|
158
|
+
|
159
|
+
/** * Removes the specified object from the bag.
|
160
|
+
* @param theObject the object to be removed from the bag.
|
161
|
+
* @warning The object must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
162
|
+
* @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
|
163
|
+
* @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
|
164
|
+
* @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
|
165
|
+
* @see \link removeAllObjects - (void)removeAllObjects \endlink
|
166
|
+
*/
|
167
|
+
|
168
|
+
- (void)removeObject:(id <NSFNanoObjectProtocol>)theObject;
|
169
|
+
|
170
|
+
/** * Empties the bag of all its elements.
|
171
|
+
* @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
|
172
|
+
* @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
|
173
|
+
* @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
|
174
|
+
* @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
|
175
|
+
*/
|
176
|
+
|
177
|
+
- (void)removeAllObjects;
|
178
|
+
|
179
|
+
/** * Removes the list of objects from the bag.
|
180
|
+
* @param theObjects the list of objects to be removed from the bag.
|
181
|
+
* @warning The objects of the array must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
182
|
+
* @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
|
183
|
+
* @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
|
184
|
+
* @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
|
185
|
+
* @see \link removeAllObjects - (void)removeAllObjects \endlink
|
186
|
+
*/
|
187
|
+
|
188
|
+
- (void)removeObjectsInArray:(NSArray *)theObjects;
|
189
|
+
|
190
|
+
/** * Removes the object with a given key from the bag.
|
191
|
+
* @param theObjectKey the key of the object to be removed from the bag.
|
192
|
+
* @warning The object referenced by theObjectKey must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
193
|
+
* @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
|
194
|
+
* @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
|
195
|
+
* @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
|
196
|
+
* @see \link removeAllObjects - (void)removeAllObjects \endlink
|
197
|
+
*/
|
198
|
+
|
199
|
+
- (void)removeObjectWithKey:(NSString *)theObjectKey;
|
200
|
+
|
201
|
+
/** * Removes from the bag the objects specified by elements in a given array.
|
202
|
+
* @param theKeys an array of objects specifying the keys to remove from the bag
|
203
|
+
* @warning The objects referenced by theKeys must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
|
204
|
+
* @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
|
205
|
+
* @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
|
206
|
+
* @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
|
207
|
+
* @see \link removeAllObjects - (void)removeAllObjects \endlink
|
208
|
+
*/
|
209
|
+
|
210
|
+
- (void)removeObjectsWithKeysInArray:(NSArray *)theKeys;
|
211
|
+
|
212
|
+
//@}
|
213
|
+
|
214
|
+
/** @name Saving, Reloading and Undoing
|
215
|
+
*/
|
216
|
+
|
217
|
+
//@{
|
218
|
+
|
219
|
+
/** * Saves the bag and its contents. Also, saves all the changes made since the last save.
|
220
|
+
* @param outError is used if an error occurs. May be NULL.
|
221
|
+
* @return YES upon success, NO otherwise.
|
222
|
+
* @note Check property hasUnsavedChanges to find out whether the bag has unsaved contents.
|
223
|
+
* @see \link reloadBagWithError: - (BOOL)reloadBagWithError:(out NSError **)outError \endlink
|
224
|
+
* @see \link undoChangesWithError: - (BOOL)undoChangesWithError:(out NSError **)outError \endlink
|
225
|
+
*/
|
226
|
+
|
227
|
+
- (BOOL)saveAndReturnError:(out NSError **)outError;
|
228
|
+
|
229
|
+
/** * Refreshes the bag to match the contents stored in the document store. The unsaved contents are preserved.
|
230
|
+
* @param outError is used if an error occurs. May be NULL.
|
231
|
+
* @return YES upon success, NO otherwise.
|
232
|
+
* @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
|
233
|
+
* @see \link saveAndReturnError: - (BOOL)saveAndReturnError:(out NSError **)outError \endlink
|
234
|
+
* @see \link undoChangesWithError: - (BOOL)undoChangesWithError:(out NSError **)outError \endlink
|
235
|
+
*/
|
236
|
+
|
237
|
+
- (BOOL)reloadBagWithError:(out NSError **)outError;
|
238
|
+
|
239
|
+
/** * Discards the changes made in the bag.
|
240
|
+
* @param outError is used if an error occurs. May be NULL.
|
241
|
+
* @return YES upon success, NO otherwise.
|
242
|
+
* @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
|
243
|
+
* @see \link saveAndReturnError: - (BOOL)saveAndReturnError:(out NSError **)outError \endlink
|
244
|
+
* @see \link reloadBagWithError: - (BOOL)reloadBagWithError:(out NSError **)outError \endlink
|
245
|
+
*/
|
246
|
+
|
247
|
+
- (BOOL)undoChangesWithError:(out NSError **)outError;
|
248
|
+
|
249
|
+
//@}
|
250
|
+
|
251
|
+
/** @name Inflating and Deflating
|
252
|
+
*/
|
253
|
+
|
254
|
+
//@{
|
255
|
+
|
256
|
+
/** * Inflates the bag by reconstructing the objects flattened with - (void)deflateBag;
|
257
|
+
* @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
|
258
|
+
* @see \link deflateBag - (void)deflateBag \endlink
|
259
|
+
*/
|
260
|
+
|
261
|
+
- (void)inflateBag;
|
262
|
+
|
263
|
+
/** * Releases memory by "flattening" the objects from the bag.
|
264
|
+
* @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
|
265
|
+
* @see \link inflateBag - (void)inflateBag \endlink
|
266
|
+
*/
|
267
|
+
|
268
|
+
- (void)deflateBag;
|
269
|
+
|
270
|
+
//@}
|
271
|
+
|
272
|
+
/** @name Miscellaneous
|
273
|
+
*/
|
274
|
+
|
275
|
+
//@{
|
276
|
+
|
277
|
+
/** * Returns the number of objects currently in the bag.
|
278
|
+
* @return The number of objects currently in the bag.
|
279
|
+
*/
|
280
|
+
|
281
|
+
- (NSUInteger)count;
|
282
|
+
|
283
|
+
/** * Compares the receiving bag to another bag.
|
284
|
+
* @param otherNanoBag is a bag.
|
285
|
+
* @return YES if the contents of otherNanoBag are equal to the contents of the receiving bag, otherwise NO.
|
286
|
+
*/
|
287
|
+
|
288
|
+
- (BOOL)isEqualToNanoBag:(NSFNanoBag *)otherNanoBag;
|
289
|
+
|
290
|
+
/** * Returns a dictionary that contains the information stored in the bag.
|
291
|
+
* @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
|
292
|
+
* @see \link description - (NSString *)description \endlink
|
293
|
+
*/
|
294
|
+
|
295
|
+
- (NSDictionary *)dictionaryRepresentation;
|
296
|
+
|
297
|
+
/** * Returns a string representation of the bag.
|
298
|
+
* @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
|
299
|
+
* @see \link dictionaryRepresentation - (NSDictionary *)dictionaryRepresentation \endlink
|
300
|
+
*/
|
301
|
+
|
302
|
+
- (NSString *)description;
|
303
|
+
|
304
|
+
//@}
|
305
|
+
|
306
|
+
@end
|