FPendingPut.m 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  1. /*
  2. * Copyright 2017 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import "FirebaseDatabase/Sources/Persistence/FPendingPut.h"
  17. @implementation FPendingPut
  18. @synthesize path;
  19. @synthesize data;
  20. - (id)initWithPath:(FPath *)aPath andData:(id)aData andPriority:(id)aPriority {
  21. self = [super init];
  22. if (self) {
  23. self.path = aPath;
  24. self.data = aData;
  25. self.priority = aPriority;
  26. }
  27. return self;
  28. }
  29. - (void)encodeWithCoder:(NSCoder *)aCoder {
  30. [aCoder encodeObject:[self.path description] forKey:@"path"];
  31. [aCoder encodeObject:self.data forKey:@"data"];
  32. [aCoder encodeObject:self.priority forKey:@"priority"];
  33. }
  34. - (id)initWithCoder:(NSCoder *)aDecoder {
  35. self = [super init];
  36. if (self) {
  37. self.path =
  38. [[FPath alloc] initWith:[aDecoder decodeObjectForKey:@"path"]];
  39. self.data = [aDecoder decodeObjectForKey:@"data"];
  40. self.priority = [aDecoder decodeObjectForKey:@"priority"];
  41. }
  42. return self;
  43. }
  44. @end
  45. @implementation FPendingPutPriority
  46. @synthesize path;
  47. @synthesize priority;
  48. - (id)initWithPath:(FPath *)aPath andPriority:(id)aPriority {
  49. self = [super init];
  50. if (self) {
  51. self.path = aPath;
  52. self.priority = aPriority;
  53. }
  54. return self;
  55. }
  56. - (void)encodeWithCoder:(NSCoder *)aCoder {
  57. [aCoder encodeObject:[self.path description] forKey:@"path"];
  58. [aCoder encodeObject:self.priority forKey:@"priority"];
  59. }
  60. - (id)initWithCoder:(NSCoder *)aDecoder {
  61. self = [super init];
  62. if (self) {
  63. self.path =
  64. [[FPath alloc] initWith:[aDecoder decodeObjectForKey:@"path"]];
  65. self.priority = [aDecoder decodeObjectForKey:@"priority"];
  66. }
  67. return self;
  68. }
  69. @end
  70. @implementation FPendingUpdate
  71. @synthesize path;
  72. @synthesize data;
  73. - (id)initWithPath:(FPath *)aPath andData:(id)aData {
  74. self = [super init];
  75. if (self) {
  76. self.path = aPath;
  77. self.data = aData;
  78. }
  79. return self;
  80. }
  81. - (void)encodeWithCoder:(NSCoder *)aCoder {
  82. [aCoder encodeObject:[self.path description] forKey:@"path"];
  83. [aCoder encodeObject:self.data forKey:@"data"];
  84. }
  85. - (id)initWithCoder:(NSCoder *)aDecoder {
  86. self = [super init];
  87. if (self) {
  88. self.path =
  89. [[FPath alloc] initWith:[aDecoder decodeObjectForKey:@"path"]];
  90. self.data = [aDecoder decodeObjectForKey:@"data"];
  91. }
  92. return self;
  93. }
  94. @end