FSnapshotUtilities.h 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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/Snapshot/FNode.h"
  17. #import <Foundation/Foundation.h>
  18. @class FImmutableSortedDictionary;
  19. @class FCompoundWrite;
  20. @class FLeafNode;
  21. @protocol FNode;
  22. typedef NS_ENUM(NSInteger, FDataHashVersion) {
  23. FDataHashVersionV1,
  24. FDataHashVersionV2,
  25. };
  26. @interface FSnapshotUtilities : NSObject
  27. + (id<FNode>)nodeFrom:(id)val;
  28. + (id<FNode>)nodeFrom:(id)val priority:(id)priority;
  29. + (id<FNode>)nodeFrom:(id)val withValidationFrom:(NSString *)fn;
  30. + (id<FNode>)nodeFrom:(id)val
  31. priority:(id)priority
  32. withValidationFrom:(NSString *)fn;
  33. + (FCompoundWrite *)compoundWriteFromDictionary:(NSDictionary *)values
  34. withValidationFrom:(NSString *)fn;
  35. + (void)validatePriorityNode:(id<FNode>)priorityNode;
  36. + (void)appendHashRepresentationForLeafNode:(FLeafNode *)val
  37. toString:(NSMutableString *)string
  38. hashVersion:(FDataHashVersion)hashVersion;
  39. + (void)appendHashV2RepresentationForString:(NSString *)string
  40. toString:(NSMutableString *)mutableString;
  41. + (NSUInteger)estimateSerializedNodeSize:(id<FNode>)node;
  42. @end