nano-store 0.3.13 → 0.3.14

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. data/.rvmrc +1 -1
  2. data/Rakefile +1 -1
  3. data/lib/nano_store.rb +1 -1
  4. data/lib/nano_store/finder.rb +26 -9
  5. data/lib/nano_store/version.rb +1 -1
  6. data/nano-store.gemspec +2 -2
  7. data/spec/finder_spec.rb +29 -12
  8. data/vendor/Podfile.lock +8 -2
  9. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoBag.h +312 -0
  10. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoBag_Private.h +37 -0
  11. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoEngine.h +542 -0
  12. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoEngine_Private.h +69 -0
  13. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoExpression.h +125 -0
  14. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoExpression_Private.h +35 -0
  15. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoGlobals.h +323 -0
  16. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoGlobals_Private.h +99 -0
  17. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoObject.h +323 -0
  18. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoObjectProtocol.h +119 -0
  19. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoObject_Private.h +35 -0
  20. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoPredicate.h +123 -0
  21. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoPredicate_Private.h +35 -0
  22. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoResult.h +137 -0
  23. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoResult_Private.h +43 -0
  24. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoSearch.h +383 -0
  25. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoSearch_Private.h +48 -0
  26. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoSortDescriptor.h +124 -0
  27. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoStore.h +475 -0
  28. data/vendor/Pods/BuildHeaders/NanoStore/NSFNanoStore_Private.h +57 -0
  29. data/vendor/Pods/BuildHeaders/NanoStore/NanoStore.h +463 -0
  30. data/vendor/Pods/BuildHeaders/NanoStore/NanoStore_Private.h +37 -0
  31. data/vendor/Pods/Headers/NanoStore/NSFNanoObject.h +25 -0
  32. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.h +25 -0
  33. data/vendor/Pods/NanoStore/Classes/Public/NSFNanoObject.m +53 -28
  34. data/vendor/Pods/NanoStore/README.md +5 -1
  35. data/vendor/Pods/Pods.bridgesupport +635 -621
  36. data/vendor/Pods/Pods.xcconfig +4 -1
  37. metadata +36 -8
data/.rvmrc CHANGED
@@ -1 +1 @@
1
- rvm ruby-1.9.3-p194
1
+ rvm ruby-1.9.3
data/Rakefile CHANGED
@@ -10,7 +10,7 @@ Motion::Project::App.setup do |app|
10
10
  app.redgreen_style = :full
11
11
  app.files += Dir.glob(File.join(app.project_dir, 'lib/nano_store/*.rb'))
12
12
  app.pods do
13
- pod 'NanoStore', '~> 2.1.4'
13
+ pod 'NanoStore', '~> 2.1.5'
14
14
  end
15
15
  end
16
16
 
data/lib/nano_store.rb CHANGED
@@ -15,5 +15,5 @@ Motion::Project::App.setup do |app|
15
15
  app.files.unshift(File.join(File.dirname(__FILE__), 'nano_store/finder.rb'))
16
16
 
17
17
  app.pods ||= Motion::Project::CocoaPods.new(app)
18
- app.pods.pod 'NanoStore', '~> 2.1.4'
18
+ app.pods.pod 'NanoStore', '~> 2.1.5'
19
19
  end
@@ -6,7 +6,7 @@ module NanoStore
6
6
  else
7
7
  sort_options = {}
8
8
  end
9
-
9
+
10
10
  if sort_options.empty?
11
11
  self.store.objectsOfClassNamed(self.bare_class_name)
12
12
  else
@@ -51,7 +51,7 @@ module NanoStore
51
51
 
52
52
  expressions = expressions_with_options(options)
53
53
  search.expressions = expressions
54
-
54
+
55
55
  sort_descriptors = sort_descriptor_with_options(sort_options)
56
56
  search.sort = sort_descriptors
57
57
  search.filterClass = self.bare_class_name
@@ -62,7 +62,7 @@ module NanoStore
62
62
 
63
63
  searchResults
64
64
  end
65
-
65
+
66
66
  # find model keys by criteria
67
67
  #
68
68
  # Return array of keys
@@ -95,7 +95,7 @@ module NanoStore
95
95
  else
96
96
  raise "unexpected parameters #{arg}"
97
97
  end
98
-
98
+
99
99
  search = NSFNanoSearch.searchWithStore(self.store)
100
100
 
101
101
  expressions = expressions_with_options(options)
@@ -111,15 +111,32 @@ module NanoStore
111
111
 
112
112
  searchResults
113
113
  end
114
-
114
+
115
+ # find a model by key
116
+ #
117
+ # Return an object or nil (if not found)
118
+ #
119
+ # Examples:
120
+ # User.find_by_key(my_key)
121
+ def find_by_key(key)
122
+ search = NSFNanoSearch.searchWithStore(self.store)
123
+ search.key = key
124
+
125
+ error_ptr = Pointer.new(:id)
126
+ searchResult = search.searchObjectsWithReturnType(NSFReturnObjects, error:error_ptr).first
127
+ raise NanoStoreError, error_ptr[0].description if error_ptr[0]
128
+
129
+ searchResult.last if searchResult
130
+ end
131
+
115
132
  def bare_class_name
116
133
  self.to_s.split("::").last
117
134
  end
118
-
135
+
119
136
  private
120
137
  def expressions_with_options(options)
121
138
  expressions = []
122
-
139
+
123
140
  options.each do |key, val|
124
141
  attribute = NSFNanoPredicate.predicateWithColumn(NSFAttributeColumn, matching:NSFEqualTo, value:key.to_s)
125
142
  expression = NSFNanoExpression.expressionWithPredicate(attribute)
@@ -144,12 +161,12 @@ module NanoStore
144
161
  end
145
162
  return expressions
146
163
  end
147
-
164
+
148
165
  SORT_MAPPING = {
149
166
  'asc' => true,
150
167
  'desc' => false,
151
168
  }
152
-
169
+
153
170
  def sort_descriptor_with_options(options)
154
171
  sorter = options.collect do |opt_key, opt_val|
155
172
  if SORT_MAPPING.keys.include?(opt_val.to_s.downcase)
@@ -1,3 +1,3 @@
1
1
  module NanoStore
2
- VERSION = "0.3.13"
2
+ VERSION = "0.3.14"
3
3
  end
data/nano-store.gemspec CHANGED
@@ -14,7 +14,7 @@ Gem::Specification.new do |gem|
14
14
  gem.require_paths = ["lib"]
15
15
  gem.version = NanoStore::VERSION
16
16
 
17
- gem.add_dependency 'bubble-wrap', '~> 1.1.0'
18
- gem.add_dependency 'motion-cocoapods', '~> 1.1.0'
17
+ gem.add_dependency 'bubble-wrap', '~> 1.1.4'
18
+ gem.add_dependency 'motion-cocoapods', '>= 1.2.0'
19
19
  gem.add_development_dependency 'motion-redgreen'
20
20
  end
data/spec/finder_spec.rb CHANGED
@@ -17,26 +17,26 @@ describe "Finder" do
17
17
  after do
18
18
  NanoStore.shared_store = nil
19
19
  end
20
-
20
+
21
21
  before do
22
22
  NanoStore.shared_store = NanoStore.store
23
23
 
24
24
  user = stub_user("Bob", 10, Time.now)
25
25
  user.save
26
-
26
+
27
27
  user2 = stub_user("Amy", 11, Time.now)
28
28
  user2.save
29
-
29
+
30
30
  user3 = stub_user("Carl", 4, Time.now)
31
31
  user3.save
32
32
  end
33
-
33
+
34
34
  it "create object in their class" do
35
35
  NanoStore.shared_store.allObjectClasses.should == ["User"]
36
36
  Car.create(:name => "Bob")
37
37
  NanoStore.shared_store.allObjectClasses.sort.should == ["User", "Car"].sort
38
38
  end
39
-
39
+
40
40
  it "search object traditional way: supply key, operator and value" do
41
41
  users = User.find(:name, NSFEqualTo, "Bob")
42
42
  users.should.not.be.nil
@@ -69,7 +69,7 @@ describe "Finder" do
69
69
  users.collect(&:name).include?("Amy").should == true
70
70
  users.collect(&:name).include?("Bob").should == false
71
71
  end
72
-
72
+
73
73
 
74
74
  it "search object with multiple parameters" do
75
75
  stub_user("Ronald", 18, Time.now).save
@@ -84,13 +84,13 @@ describe "Finder" do
84
84
  user = users.first
85
85
  user.name.should.be == "Ronald"
86
86
  user.age.should.be == 59
87
-
87
+
88
88
  users = User.find(:name => { NSFEqualTo => "Ronald" }, :age => { NSFLessThan => 30 })
89
- users.size.should == 2
89
+ users.size.should == 2
90
90
  user = users.first
91
91
  user.name.should.be == "Ronald"
92
92
  end
93
-
93
+
94
94
  it "sort search results" do
95
95
  stub_user("Alan", 39, Time.now).save
96
96
  stub_user("Cat", 29, Time.now).save
@@ -126,13 +126,30 @@ describe "Finder" do
126
126
  user.name.should == "Bob"
127
127
  user.class.should == User
128
128
  end
129
-
129
+
130
+ it "find object by key" do
131
+ name = "Julien"
132
+ age = 32
133
+ created_at = Time.now
134
+ user = stub_user("Julien", 32, Time.now)
135
+ user.save
136
+ user2 = User.find_by_key(user.key)
137
+ user2.should.not.be.nil
138
+ user2.key.should == user.key
139
+ user2.name.should == user.name
140
+ user2.age.should == user.age
141
+ end
142
+
143
+ it "should not find object by key" do
144
+ User.find_by_key("invalid-key").should.be.nil
145
+ end
146
+
130
147
  it "find all objects" do
131
148
  User.count.should == 3
132
149
  users = User.all
133
150
  users.size.should == 3
134
151
  end
135
-
152
+
136
153
  it "find all objects, sorted" do
137
154
  stub_user("Alan", 39, Time.now).save
138
155
  stub_user("Cat", 29, Time.now).save
@@ -153,7 +170,7 @@ describe "Finder" do
153
170
  Car.all.size.should == 1
154
171
  Car.all.first.key.should == car.key
155
172
  end
156
-
173
+
157
174
  it "#find only return objects of the class" do
158
175
  car = Car.create(:name => "Honda")
159
176
  Car.find.size.should == 1
data/vendor/Podfile.lock CHANGED
@@ -1,5 +1,11 @@
1
+
1
2
  PODS:
2
- - NanoStore (2.1.4)
3
+ - NanoStore (2.1.5)
3
4
 
4
5
  DEPENDENCIES:
5
- - NanoStore (~> 2.1.4)
6
+ - NanoStore (~> 2.1.5)
7
+
8
+ SPEC CHECKSUMS:
9
+ NanoStore: 440272829dfe13db7f1c68de74fc3562475463fe
10
+
11
+ COCOAPODS: 0.15.1
@@ -0,0 +1,312 @@
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
+ * @throws NSFUnexpectedParameterException is thrown if theObjects is nil.
101
+ * @warning If theObjects is nil, an NSFUnexpectedParameterException will be thrown. Use + bag; instead.
102
+ * @see \link initBagWithNanoObjects: - (NSFNanoBag*)initBagWithNanoObjects:(NSArray *)theObjects \endlink
103
+ */
104
+
105
+ + (NSFNanoBag *)bagWithObjects:(NSArray *)theObjects;
106
+
107
+ /** * Creates and returns an empty bag with the specified name
108
+ * @param theName the name of the bag. Can be nil.
109
+ * @return An empty bag upon success, nil otherwise.
110
+ */
111
+
112
+ + bagWithName:(NSString *)theName;
113
+
114
+ /** * Creates and returns a bag with the specified name adding to it the objects contained in the given array.
115
+ * @param theName the name of the bag. Can be nil.
116
+ * @param theObjects is a required array of objects conforming to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink.
117
+ * @return A bag only containing the objects with conform to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink upon success, nil otherwise.
118
+ * @throws NSFUnexpectedParameterException is thrown if theObjects is nil.
119
+ * @warning If theObjects is nil, an NSFUnexpectedParameterException will be thrown.
120
+ * @see \link initBagWithNanoObjects: - (NSFNanoBag*)initBagWithNanoObjects:(NSArray *)theObjects \endlink
121
+ */
122
+
123
+ + bagWithName:(NSString *)theName andObjects:(NSArray *)theObjects;
124
+
125
+ /** * Initializes a newly allocated bag with the specified name adding to it the objects contained in the given array.
126
+ * @param theName the name of the bag. Can be nil.
127
+ * @param theObjects is a required array of objects conforming to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink.
128
+ * @return A bag only containing the objects with conform to the \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink upon success, nil otherwise.
129
+ * @throws NSFUnexpectedParameterException is thrown if theObjects is nil.
130
+ * @warning If theObjects is nil, an NSFUnexpectedParameterException will be thrown.
131
+ * @see \link bagWithObjects: + (NSFNanoBag*)bagWithObjects:(NSArray *)theObjects \endlink
132
+ */
133
+
134
+ - (id)initBagWithName:(NSString *)theName andObjects:(NSArray *)someObjects;
135
+
136
+ //@}
137
+
138
+ /** @name Adding and Removing Objects
139
+ */
140
+
141
+ //@{
142
+
143
+ /** * Adds an \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant object to the bag.
144
+ * @param theObject is added to the bag.
145
+ * @param outError is used if an error occurs. May be NULL.
146
+ * @return YES upon success, NO otherwise.
147
+ * @warning This value cannot be nil and it must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
148
+ * @throws NSFNonConformingNanoObjectProtocolException is thrown if the object is non-\link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink compliant.
149
+ * @see \link addObjectsFromArray:error: - (BOOL)addObjectsFromArray:(NSArray *)theObjects error:(out NSError **)outError \endlink
150
+ */
151
+
152
+ - (BOOL)addObject:(id <NSFNanoObjectProtocol>)theObject error:(out NSError **)outError;
153
+
154
+ /** * Adds a series of \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant objects to the bag.
155
+ * @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.
156
+ * @param outError is used if an error occurs. May be NULL.
157
+ * @return YES upon success, NO otherwise.
158
+ * @warning The objects of the array must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
159
+ * @throws NSFNonConformingNanoObjectProtocolException is thrown if the object is non-\link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink compliant.
160
+ * @see \link addObject:error: - (BOOL)addObject:(id <NSFNanoObjectProtocol>)theObject error:(out NSError **)outError \endlink
161
+ */
162
+
163
+ - (BOOL)addObjectsFromArray:(NSArray *)theObjects error:(out NSError **)outError;
164
+
165
+ /** * Removes the specified object from the bag.
166
+ * @param theObject the object to be removed from the bag.
167
+ * @warning The object must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
168
+ * @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
169
+ * @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
170
+ * @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
171
+ * @see \link removeAllObjects - (void)removeAllObjects \endlink
172
+ */
173
+
174
+ - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject;
175
+
176
+ /** * Empties the bag of all its elements.
177
+ * @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
178
+ * @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
179
+ * @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
180
+ * @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
181
+ */
182
+
183
+ - (void)removeAllObjects;
184
+
185
+ /** * Removes the list of objects from the bag.
186
+ * @param theObjects the list of objects to be removed from the bag.
187
+ * @warning The objects of the array must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
188
+ * @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
189
+ * @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
190
+ * @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
191
+ * @see \link removeAllObjects - (void)removeAllObjects \endlink
192
+ */
193
+
194
+ - (void)removeObjectsInArray:(NSArray *)theObjects;
195
+
196
+ /** * Removes the object with a given key from the bag.
197
+ * @param theObjectKey the key of the object to be removed from the bag.
198
+ * @warning The object referenced by theObjectKey must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
199
+ * @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
200
+ * @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
201
+ * @see \link removeObjectsWithKeysInArray: - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys \endlink
202
+ * @see \link removeAllObjects - (void)removeAllObjects \endlink
203
+ */
204
+
205
+ - (void)removeObjectWithKey:(NSString *)theObjectKey;
206
+
207
+ /** * Removes from the bag the objects specified by elements in a given array.
208
+ * @param theKeys an array of objects specifying the keys to remove from the bag
209
+ * @warning The objects referenced by theKeys must be \link NSFNanoObjectProtocol::initNanoObjectFromDictionaryRepresentation:forKey:store: NSFNanoObjectProtocol\endlink-compliant.
210
+ * @see \link removeObject: - (void)removeObject:(id <NSFNanoObjectProtocol>)theObject \endlink
211
+ * @see \link removeObjectsInArray: - (void)removeObjectsInArray:(NSArray *)theObjects \endlink
212
+ * @see \link removeObjectWithKey: - (void)removeObjectWithKey:(NSString *)theObjectKey \endlink
213
+ * @see \link removeAllObjects - (void)removeAllObjects \endlink
214
+ */
215
+
216
+ - (void)removeObjectsWithKeysInArray:(NSArray *)theKeys;
217
+
218
+ //@}
219
+
220
+ /** @name Saving, Reloading and Undoing
221
+ */
222
+
223
+ //@{
224
+
225
+ /** * Saves the bag and its contents. Also, saves all the changes made since the last save.
226
+ * @param outError is used if an error occurs. May be NULL.
227
+ * @return YES upon success, NO otherwise.
228
+ * @note Check property hasUnsavedChanges to find out whether the bag has unsaved contents.
229
+ * @see \link reloadBagWithError: - (BOOL)reloadBagWithError:(out NSError **)outError \endlink
230
+ * @see \link undoChangesWithError: - (BOOL)undoChangesWithError:(out NSError **)outError \endlink
231
+ */
232
+
233
+ - (BOOL)saveAndReturnError:(out NSError **)outError;
234
+
235
+ /** * Refreshes the bag to match the contents stored in the document store. The unsaved contents are preserved.
236
+ * @param outError is used if an error occurs. May be NULL.
237
+ * @return YES upon success, NO otherwise.
238
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
239
+ * @see \link saveAndReturnError: - (BOOL)saveAndReturnError:(out NSError **)outError \endlink
240
+ * @see \link undoChangesWithError: - (BOOL)undoChangesWithError:(out NSError **)outError \endlink
241
+ */
242
+
243
+ - (BOOL)reloadBagWithError:(out NSError **)outError;
244
+
245
+ /** * Discards the changes made in the bag.
246
+ * @param outError is used if an error occurs. May be NULL.
247
+ * @return YES upon success, NO otherwise.
248
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
249
+ * @see \link saveAndReturnError: - (BOOL)saveAndReturnError:(out NSError **)outError \endlink
250
+ * @see \link reloadBagWithError: - (BOOL)reloadBagWithError:(out NSError **)outError \endlink
251
+ */
252
+
253
+ - (BOOL)undoChangesWithError:(out NSError **)outError;
254
+
255
+ //@}
256
+
257
+ /** @name Inflating and Deflating
258
+ */
259
+
260
+ //@{
261
+
262
+ /** * Inflates the bag by reconstructing the objects flattened with - (void)deflateBag;
263
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
264
+ * @see \link deflateBag - (void)deflateBag \endlink
265
+ */
266
+
267
+ - (void)inflateBag;
268
+
269
+ /** * Releases memory by "flattening" the objects from the bag.
270
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
271
+ * @see \link inflateBag - (void)inflateBag \endlink
272
+ */
273
+
274
+ - (void)deflateBag;
275
+
276
+ //@}
277
+
278
+ /** @name Miscellaneous
279
+ */
280
+
281
+ //@{
282
+
283
+ /** * Returns the number of objects currently in the bag.
284
+ * @return The number of objects currently in the bag.
285
+ */
286
+
287
+ - (NSUInteger)count;
288
+
289
+ /** * Compares the receiving bag to another bag.
290
+ * @param otherNanoBag is a bag.
291
+ * @return YES if the contents of otherNanoBag are equal to the contents of the receiving bag, otherwise NO.
292
+ */
293
+
294
+ - (BOOL)isEqualToNanoBag:(NSFNanoBag *)otherNanoBag;
295
+
296
+ /** * Returns a dictionary that contains the information stored in the bag.
297
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
298
+ * @see \link description - (NSString *)description \endlink
299
+ */
300
+
301
+ - (NSDictionary *)dictionaryRepresentation;
302
+
303
+ /** * Returns a string representation of the bag.
304
+ * @note Check properties savedObjects, unsavedObjects and removedObjects to find out the current state of the bag.
305
+ * @see \link dictionaryRepresentation - (NSDictionary *)dictionaryRepresentation \endlink
306
+ */
307
+
308
+ - (NSString *)description;
309
+
310
+ //@}
311
+
312
+ @end