FValidation.h 2.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  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/Core/Utilities/FPath.h"
  17. #import "FirebaseDatabase/Sources/Public/FIRDataEventType.h"
  18. #import "FirebaseDatabase/Sources/Utilities/FParsedUrl.h"
  19. #import "FirebaseDatabase/Sources/Utilities/FTypedefs.h"
  20. #import <Foundation/Foundation.h>
  21. @interface FValidation : NSObject
  22. + (void)validateFrom:(NSString *)fn writablePath:(FPath *)path;
  23. + (void)validateFrom:(NSString *)fn knownEventType:(FIRDataEventType)event;
  24. + (void)validateFrom:(NSString *)fn validPathString:(NSString *)pathString;
  25. + (void)validateFrom:(NSString *)fn validRootPathString:(NSString *)pathString;
  26. + (void)validateFrom:(NSString *)fn validKey:(NSString *)key;
  27. + (void)validateFrom:(NSString *)fn validURL:(FParsedUrl *)parsedUrl;
  28. + (void)validateToken:(NSString *)token;
  29. // Functions for handling passing errors back
  30. + (void)handleError:(NSError *)error
  31. withUserCallback:(fbt_void_nserror_id)userCallback;
  32. + (void)handleError:(NSError *)error
  33. withSuccessCallback:(fbt_void_nserror)userCallback;
  34. // Functions used for validating while creating snapshots in FSnapshotUtilities
  35. + (BOOL)validateFrom:(NSString *)fn
  36. isValidLeafValue:(id)value
  37. withPath:(NSArray *)path;
  38. + (void)validateFrom:(NSString *)fn
  39. validDictionaryKey:(id)keyId
  40. withPath:(NSArray *)path;
  41. + (void)validateFrom:(NSString *)fn
  42. validUpdateDictionaryKey:(id)keyId
  43. withValue:(id)value;
  44. + (void)validateFrom:(NSString *)fn
  45. isValidPriorityValue:(id)value
  46. withPath:(NSArray *)path;
  47. + (BOOL)validatePriorityValue:value;
  48. @end