Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

CDVPluginResult.h 4.3KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. /*
  2. Licensed to the Apache Software Foundation (ASF) under one
  3. or more contributor license agreements. See the NOTICE file
  4. distributed with this work for additional information
  5. regarding copyright ownership. The ASF licenses this file
  6. to you under the Apache License, Version 2.0 (the
  7. "License"); you may not use this file except in compliance
  8. with the License. You may obtain a copy of the License at
  9. http://www.apache.org/licenses/LICENSE-2.0
  10. Unless required by applicable law or agreed to in writing,
  11. software distributed under the License is distributed on an
  12. "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  13. KIND, either express or implied. See the License for the
  14. specific language governing permissions and limitations
  15. under the License.
  16. */
  17. #import <Foundation/Foundation.h>
  18. #import "CDVAvailability.h"
  19. typedef NS_ENUM(NSUInteger, CDVCommandStatus) {
  20. CDVCommandStatus_NO_RESULT NS_SWIFT_NAME(noResult) = 0,
  21. CDVCommandStatus_OK NS_SWIFT_NAME(ok),
  22. CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION NS_SWIFT_NAME(classNotFoundException),
  23. CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION NS_SWIFT_NAME(illegalAccessException),
  24. CDVCommandStatus_INSTANTIATION_EXCEPTION NS_SWIFT_NAME(instantiationException),
  25. CDVCommandStatus_MALFORMED_URL_EXCEPTION NS_SWIFT_NAME(malformedUrlException),
  26. CDVCommandStatus_IO_EXCEPTION NS_SWIFT_NAME(ioException),
  27. CDVCommandStatus_INVALID_ACTION NS_SWIFT_NAME(invalidAction),
  28. CDVCommandStatus_JSON_EXCEPTION NS_SWIFT_NAME(jsonException),
  29. CDVCommandStatus_ERROR NS_SWIFT_NAME(error)
  30. };
  31. // This exists to preserve compatibility with early Swift plugins, who are
  32. // using CDVCommandStatus as ObjC-style constants rather than as Swift enum
  33. // values.
  34. // This declares extern'ed constants (implemented in CDVPluginResult.m)
  35. #define SWIFT_ENUM_COMPAT_HACK(enumVal) extern const CDVCommandStatus SWIFT_##enumVal NS_SWIFT_NAME(enumVal)
  36. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_NO_RESULT);
  37. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_OK);
  38. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_CLASS_NOT_FOUND_EXCEPTION);
  39. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ILLEGAL_ACCESS_EXCEPTION);
  40. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INSTANTIATION_EXCEPTION);
  41. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_MALFORMED_URL_EXCEPTION);
  42. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_IO_EXCEPTION);
  43. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_INVALID_ACTION);
  44. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_JSON_EXCEPTION);
  45. SWIFT_ENUM_COMPAT_HACK(CDVCommandStatus_ERROR);
  46. #undef SWIFT_ENUM_COMPAT_HACK
  47. @interface CDVPluginResult : NSObject {}
  48. @property (nonatomic, strong, readonly) NSNumber* status;
  49. @property (nonatomic, strong, readonly) id message;
  50. @property (nonatomic, strong) NSNumber* keepCallback;
  51. // This property can be used to scope the lifetime of another object. For example,
  52. // Use it to store the associated NSData when `message` is created using initWithBytesNoCopy.
  53. @property (nonatomic, strong) id associatedObject;
  54. - (CDVPluginResult*)init;
  55. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal;
  56. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsString:(NSString*)theMessage;
  57. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArray:(NSArray*)theMessage;
  58. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsInt:(int)theMessage;
  59. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSInteger:(NSInteger)theMessage;
  60. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsNSUInteger:(NSUInteger)theMessage;
  61. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDouble:(double)theMessage;
  62. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsBool:(BOOL)theMessage;
  63. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsDictionary:(NSDictionary*)theMessage;
  64. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsArrayBuffer:(NSData*)theMessage;
  65. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageAsMultipart:(NSArray*)theMessages;
  66. + (CDVPluginResult*)resultWithStatus:(CDVCommandStatus)statusOrdinal messageToErrorObject:(int)errorCode;
  67. + (void)setVerbose:(BOOL)verbose;
  68. + (BOOL)isVerbose;
  69. - (void)setKeepCallbackAsBool:(BOOL)bKeepCallback;
  70. - (NSString*)argumentsAsJSON;
  71. @end