FValidation.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  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 <Foundation/Foundation.h>
  17. #import "FPath.h"
  18. #import "FIRDataEventType.h"
  19. #import "FParsedUrl.h"
  20. #import "FTypedefs.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 withUserCallback:(fbt_void_nserror_id)userCallback;
  31. + (void) handleError:(NSError *)error withSuccessCallback:(fbt_void_nserror)userCallback;
  32. // Functions used for validating while creating snapshots in FSnapshotUtilities
  33. + (BOOL) validateFrom:(NSString*)fn isValidLeafValue:(id)value withPath:(NSArray*)path;
  34. + (void) validateFrom:(NSString*)fn validDictionaryKey:(id)keyId withPath:(NSArray*)path;
  35. + (void) validateFrom:(NSString*)fn validUpdateDictionaryKey:(id)keyId withValue:(id)value;
  36. + (void) validateFrom:(NSString*)fn isValidPriorityValue:(id)value withPath:(NSArray*)path;
  37. + (BOOL) validatePriorityValue:value;
  38. @end