diff --git a/ios/Flutter/App.framework/App b/ios/Flutter/App.framework/App new file mode 100755 index 0000000..3fc3646 Binary files /dev/null and b/ios/Flutter/App.framework/App differ diff --git a/ios/Flutter/App.framework/Info.plist b/ios/Flutter/App.framework/Info.plist new file mode 100644 index 0000000..6c2de80 --- /dev/null +++ b/ios/Flutter/App.framework/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + App + CFBundleIdentifier + io.flutter.flutter.app + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + App + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UIRequiredDeviceCapabilities + + arm64 + + MinimumOSVersion + 8.0 + + diff --git a/ios/Flutter/Flutter.framework/Headers/Flutter.h b/ios/Flutter/Flutter.framework/Headers/Flutter.h new file mode 100644 index 0000000..a47e239 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/Flutter.h @@ -0,0 +1,18 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTER_H_ +#define FLUTTER_FLUTTER_H_ + +#include "FlutterAppDelegate.h" +#include "FlutterBinaryMessenger.h" +#include "FlutterChannels.h" +#include "FlutterCodecs.h" +#include "FlutterDartProject.h" +#include "FlutterMacros.h" +#include "FlutterNavigationController.h" +#include "FlutterPlugin.h" +#include "FlutterViewController.h" + +#endif // FLUTTER_FLUTTER_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h b/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h new file mode 100644 index 0000000..a2ad157 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterAppDelegate.h @@ -0,0 +1,39 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERAPPDELEGATE_H_ +#define FLUTTER_FLUTTERAPPDELEGATE_H_ + +#import + +#include "FlutterMacros.h" +#include "FlutterPlugin.h" + +/** + * UIApplicationDelegate subclass for simple apps that want default behavior. + * + * This class provides the following behaviors: + * * Status bar touches are forwarded to the key window's root view + * FlutterViewController, in order to trigger scroll to top. + * * Keeps the Flutter connection open in debug mode when the phone screen + * locks. + * + * App delegates for Flutter applications are *not* required to inherit from + * this class. Developers of custom app delegate classes should copy and paste + * code as necessary from FlutterAppDelegate.mm. + */ +FLUTTER_EXPORT +@interface FlutterAppDelegate : UIResponder + +@property(strong, nonatomic) UIWindow* window; + +// Can be overriden by subclasses to provide a custom FlutterBinaryMessenger, +// typically a FlutterViewController, for plugin interop. +// +// Defaults to window's rootViewController. +- (NSObject*)binaryMessenger; + +@end + +#endif // FLUTTER_FLUTTERDARTPROJECT_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterBinaryMessenger.h b/ios/Flutter/Flutter.framework/Headers/FlutterBinaryMessenger.h new file mode 100644 index 0000000..606c131 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterBinaryMessenger.h @@ -0,0 +1,85 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERBINARYMESSENGER_H_ +#define FLUTTER_FLUTTERBINARYMESSENGER_H_ + +#import + +#include "FlutterMacros.h" + +NS_ASSUME_NONNULL_BEGIN +/** + A message reply callback. + + Used for submitting a binary reply back to a Flutter message sender. Also used + in the dual capacity for handling a binary message reply received from Flutter. + + - Parameters: + - reply: The reply. + */ +typedef void (^FlutterBinaryReply)(NSData* _Nullable reply); + +/** + A strategy for handling incoming binary messages from Flutter and to send + asynchronous replies back to Flutter. + + - Parameters: + - message: The message. + - reply: A callback for submitting a reply to the sender. + */ +typedef void (^FlutterBinaryMessageHandler)(NSData* _Nullable message, FlutterBinaryReply reply); + +/** + A facility for communicating with the Flutter side using asynchronous message + passing with binary messages. + + - SeeAlso: + - `FlutterBasicMessageChannel`, which supports communication using structured + messages. + - `FlutterMethodChannel`, which supports communication using asynchronous + method calls. + - `FlutterEventChannel`, which supports commuication using event streams. + */ +FLUTTER_EXPORT +@protocol FlutterBinaryMessenger +/** + Sends a binary message to the Flutter side on the specified channel, expecting + no reply. + + - Parameters: + - channel: The channel name. + - message: The message. + */ +- (void)sendOnChannel:(NSString*)channel message:(NSData* _Nullable)message; + +/** + Sends a binary message to the Flutter side on the specified channel, expecting + an asynchronous reply. + + - Parameters: + - channel: The channel name. + - message: The message. + - callback: A callback for receiving a reply. + */ +- (void)sendOnChannel:(NSString*)channel + message:(NSData* _Nullable)message + binaryReply:(FlutterBinaryReply _Nullable)callback; + +/** + Registers a message handler for incoming binary messages from the Flutter side + on the specified channel. + + Replaces any existing handler. Use a `nil` handler for unregistering the + existing handler. + + - Parameters: + - channel: The channel name. + - handler: The message handler. + */ +- (void)setMessageHandlerOnChannel:(NSString*)channel + binaryMessageHandler:(FlutterBinaryMessageHandler _Nullable)handler; +@end +NS_ASSUME_NONNULL_END +#endif // FLUTTER_FLUTTERBINARYMESSENGER_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterChannels.h b/ios/Flutter/Flutter.framework/Headers/FlutterChannels.h new file mode 100644 index 0000000..6c417f4 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterChannels.h @@ -0,0 +1,380 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERCHANNELS_H_ +#define FLUTTER_FLUTTERCHANNELS_H_ + +#include "FlutterBinaryMessenger.h" +#include "FlutterCodecs.h" + +NS_ASSUME_NONNULL_BEGIN +/** + A message reply callback. + + Used for submitting a reply back to a Flutter message sender. Also used in + the dual capacity for handling a message reply received from Flutter. + + - Parameter reply: The reply. + */ +typedef void (^FlutterReply)(id _Nullable reply); + +/** + A strategy for handling incoming messages from Flutter and to send + asynchronous replies back to Flutter. + + - Parameters: + - message: The message. + - reply: A callback for submitting a reply to the sender. + */ +typedef void (^FlutterMessageHandler)(id _Nullable message, FlutterReply callback); + +/** + A channel for communicating with the Flutter side using basic, asynchronous + message passing. + */ +FLUTTER_EXPORT +@interface FlutterBasicMessageChannel : NSObject +/** + Creates a `FlutterBasicMessageChannel` with the specified name and binary + messenger. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + The channel uses `FlutterStandardMessageCodec` to encode and decode messages. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + */ ++ (instancetype)messageChannelWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger; + +/** + Creates a `FlutterBasicMessageChannel` with the specified name, binary + messenger, + and message codec. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The message codec. + */ ++ (instancetype)messageChannelWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger + codec:(NSObject*)codec; + +/** + Initializes a `FlutterBasicMessageChannel` with the specified name, binary + messenger, and message codec. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The message codec. + */ +- (instancetype)initWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger + codec:(NSObject*)codec; + +/** + Sends the specified message to the Flutter side, ignoring any reply. + + - Parameter message: The message. Must be supported by the codec of this + channel. + */ +- (void)sendMessage:(id _Nullable)message; + +/** + Sends the specified message to the Flutter side, expecting an asynchronous + reply. + + - Parameters: + - message: The message. Must be supported by the codec of this channel. + - callback: A callback to be invoked with the message reply from Flutter. + */ +- (void)sendMessage:(id _Nullable)message reply:(FlutterReply _Nullable)callback; + +/** + Registers a message handler with this channel. + + Replaces any existing handler. Use a `nil` handler for unregistering the + existing handler. + + - Parameter handler: The message handler. + */ +- (void)setMessageHandler:(FlutterMessageHandler _Nullable)handler; +@end + +/** + A method call result callback. + + Used for submitting a method call result back to a Flutter caller. Also used in + the dual capacity for handling a method call result received from Flutter. + + - Parameter result: The result. + */ +typedef void (^FlutterResult)(id _Nullable result); + +/** + A strategy for handling method calls. + + - Parameters: + - call: The incoming method call. + - result: A callback to asynchronously submit the result of the call. + Invoke the callback with a `FlutterError` to indicate that the call failed. + Invoke the callback with `FlutterMethodNotImplemented` to indicate that the + method was unknown. Any other values, including `nil`, are interpreted as + successful results. + */ +typedef void (^FlutterMethodCallHandler)(FlutterMethodCall* call, FlutterResult result); + +/** + A constant used with `FlutterMethodCallHandler` to respond to the call of an + unknown method. + */ +FLUTTER_EXPORT +extern NSObject const* FlutterMethodNotImplemented; + +/** + A channel for communicating with the Flutter side using invocation of + asynchronous methods. + */ +FLUTTER_EXPORT +@interface FlutterMethodChannel : NSObject +/** + Creates a `FlutterMethodChannel` with the specified name and binary messenger. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + The channel uses `FlutterStandardMethodCodec` to encode and decode method calls + and result envelopes. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + */ ++ (instancetype)methodChannelWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger; + +/** + Creates a `FlutterMethodChannel` with the specified name, binary messenger, and + method codec. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The method codec. + */ ++ (instancetype)methodChannelWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger + codec:(NSObject*)codec; + +/** + Initializes a `FlutterMethodChannel` with the specified name, binary messenger, + and method codec. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The method codec. + */ +- (instancetype)initWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger + codec:(NSObject*)codec; + +/** + Invokes the specified Flutter method with the specified arguments, expecting + no results. + + - Parameters: + - method: The name of the method to invoke. + - arguments: The arguments. Must be a value supported by the codec of this + channel. + */ +- (void)invokeMethod:(NSString*)method arguments:(id _Nullable)arguments; + +/** + Invokes the specified Flutter method with the specified arguments, expecting + an asynchronous result. + + - Parameters: + - method: The name of the method to invoke. + - arguments: The arguments. Must be a value supported by the codec of this + channel. + - result: A callback that will be invoked with the asynchronous result. + The result will be a `FlutterError` instance, if the method call resulted + in an error on the Flutter side. Will be `FlutterMethodNotImplemented`, if + the method called was not implemented on the Flutter side. Any other value, + including `nil`, should be interpreted as successful results. + */ +- (void)invokeMethod:(NSString*)method + arguments:(id _Nullable)arguments + result:(FlutterResult _Nullable)callback; + +/** + Registers a handler for method calls from the Flutter side. + + Replaces any existing handler. Use a `nil` handler for unregistering the + existing handler. + + - Parameter handler: The method call handler. + */ +- (void)setMethodCallHandler:(FlutterMethodCallHandler _Nullable)handler; +@end + +/** + An event sink callback. + + - Parameter event: The event. + */ +typedef void (^FlutterEventSink)(id _Nullable event); + +/** + A strategy for exposing an event stream to the Flutter side. + */ +FLUTTER_EXPORT +@protocol FlutterStreamHandler +/** + Sets up an event stream and begin emitting events. + + Invoked when the first listener is registered with the Stream associated to + this channel on the Flutter side. + + - Parameters: + - arguments: Arguments for the stream. + - events: A callback to asynchronously emit events. Invoke the + callback with a `FlutterError` to emit an error event. Invoke the + callback with `FlutterEndOfEventStream` to indicate that no more + events will be emitted. Any other value, including `nil` are emitted as + successful events. + - Returns: A FlutterError instance, if setup fails. + */ +- (FlutterError* _Nullable)onListenWithArguments:(id _Nullable)arguments + eventSink:(FlutterEventSink)events; + +/** + Tears down an event stream. + + Invoked when the last listener is deregistered from the Stream associated to + this channel on the Flutter side. + + - Parameter arguments: Arguments for the stream. + - Returns: A FlutterError instance, if teardown fails. + */ +- (FlutterError* _Nullable)onCancelWithArguments:(id _Nullable)arguments; +@end + +/** + A constant used with `FlutterEventChannel` to indicate end of stream. + */ +FLUTTER_EXPORT +extern NSObject const* FlutterEndOfEventStream; + +/** + A channel for communicating with the Flutter side using event streams. + */ +FLUTTER_EXPORT +@interface FlutterEventChannel : NSObject +/** + Creates a `FlutterEventChannel` with the specified name and binary messenger. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + The channel uses `FlutterStandardMethodCodec` to decode stream setup and + teardown requests, and to encode event envelopes. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The method codec. + */ ++ (instancetype)eventChannelWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger; + +/** + Creates a `FlutterEventChannel` with the specified name, binary messenger, + and method codec. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The method codec. + */ ++ (instancetype)eventChannelWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger + codec:(NSObject*)codec; + +/** + Initializes a `FlutterEventChannel` with the specified name, binary messenger, + and method codec. + + The channel name logically identifies the channel; identically named channels + interfere with each other's communication. + + The binary messenger is a facility for sending raw, binary messages to the + Flutter side. This protocol is implemented by `FlutterViewController`. + + - Parameters: + - name: The channel name. + - messenger: The binary messenger. + - codec: The method codec. + */ +- (instancetype)initWithName:(NSString*)name + binaryMessenger:(NSObject*)messenger + codec:(NSObject*)codec; +/** + Registers a handler for stream setup requests from the Flutter side. + + Replaces any existing handler. Use a `nil` handler for unregistering the + existing handler. + + - Parameter handler: The stream handler. + */ +- (void)setStreamHandler:(NSObject* _Nullable)handler; +@end +NS_ASSUME_NONNULL_END + +#endif // FLUTTER_FLUTTERCHANNELS_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterCodecs.h b/ios/Flutter/Flutter.framework/Headers/FlutterCodecs.h new file mode 100644 index 0000000..89b7e66 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterCodecs.h @@ -0,0 +1,369 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERCODECS_H_ +#define FLUTTER_FLUTTERCODECS_H_ + +#import +#include "FlutterMacros.h" + +NS_ASSUME_NONNULL_BEGIN + +/** + A message encoding/decoding mechanism. + */ +FLUTTER_EXPORT +@protocol FlutterMessageCodec +/** + Returns a shared instance of this `FlutterMessageCodec`. + */ ++ (instancetype)sharedInstance; + +/** + Encodes the specified message into binary. + + - Parameter message: The message. + - Returns: The binary encoding, or `nil`, if `message` was `nil`. + */ +- (NSData* _Nullable)encode:(id _Nullable)message; + +/** + Decodes the specified message from binary. + + - Parameter message: The message. + - Returns: The decoded message, or `nil`, if `message` was `nil`. + */ +- (id _Nullable)decode:(NSData* _Nullable)message; +@end + +/** + A `FlutterMessageCodec` using unencoded binary messages, represented as + `NSData` instances. + + This codec is guaranteed to be compatible with the corresponding + [BinaryCodec](https://docs.flutter.io/flutter/services/BinaryCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + On the Dart side, messages are represented using `ByteData`. + */ +FLUTTER_EXPORT +@interface FlutterBinaryCodec : NSObject +@end + +/** + A `FlutterMessageCodec` using UTF-8 encoded `NSString` messages. + + This codec is guaranteed to be compatible with the corresponding + [StringCodec](https://docs.flutter.io/flutter/services/StringCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + */ +FLUTTER_EXPORT +@interface FlutterStringCodec : NSObject +@end + +/** + A `FlutterMessageCodec` using UTF-8 encoded JSON messages. + + This codec is guaranteed to be compatible with the corresponding + [JSONMessageCodec](https://docs.flutter.io/flutter/services/JSONMessageCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + Supports values accepted by `NSJSONSerialization` plus top-level + `nil`, `NSNumber`, and `NSString`. + + On the Dart side, JSON messages are handled by the JSON facilities of the + [`dart:convert`](https://api.dartlang.org/stable/dart-convert/JSON-constant.html) + package. + */ +FLUTTER_EXPORT +@interface FlutterJSONMessageCodec : NSObject +@end + +/** + A `FlutterMessageCodec` using the Flutter standard binary encoding. + + This codec is guaranteed to be compatible with the corresponding + [StandardMessageCodec](https://docs.flutter.io/flutter/services/StandardMessageCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + Supported messages are acyclic values of these forms: + + - `nil` or `NSNull` + - `NSNumber` (including their representation of Boolean values) + - `FlutterStandardBigInteger` + - `NSString` + - `FlutterStandardTypedData` + - `NSArray` of supported values + - `NSDictionary` with supported keys and values + + On the Dart side, these values are represented as follows: + + - `nil` or `NSNull`: `null` + - `NSNumber`: `bool`, `int`, or `double`, depending on the contained value. + - `FlutterStandardBigInteger`: `int` + - `NSString`: `String` + - `FlutterStandardTypedData`: `Uint8List`, `Int32List`, `Int64List`, or `Float64List` + - `NSArray`: `List` + - `NSDictionary`: `Map` + */ +FLUTTER_EXPORT +@interface FlutterStandardMessageCodec : NSObject +@end + +/** + Command object representing a method call on a `FlutterMethodChannel`. + */ +FLUTTER_EXPORT +@interface FlutterMethodCall : NSObject +/** + Creates a method call for invoking the specified named method with the + specified arguments. + + - Parameters: + - method: the name of the method to call. + - arguments: the arguments value. + */ ++ (instancetype)methodCallWithMethodName:(NSString*)method arguments:(id _Nullable)arguments; + +/** + The method name. + */ +@property(readonly, nonatomic) NSString* method; + +/** + The arguments. + */ +@property(readonly, nonatomic, nullable) id arguments; +@end + +/** + Error object representing an unsuccessful outcome of invoking a method + on a `FlutterMethodChannel`, or an error event on a `FlutterEventChannel`. + */ +FLUTTER_EXPORT +@interface FlutterError : NSObject +/** + Creates a `FlutterError` with the specified error code, message, and details. + + - Parameters: + - code: An error code string for programmatic use. + - message: A human-readable error message. + - details: Custom error details. + */ ++ (instancetype)errorWithCode:(NSString*)code + message:(NSString* _Nullable)message + details:(id _Nullable)details; +/** + The error code. + */ +@property(readonly, nonatomic) NSString* code; + +/** + The error message. + */ +@property(readonly, nonatomic, nullable) NSString* message; + +/** + The error details. + */ +@property(readonly, nonatomic, nullable) id details; +@end + +/** + Type of numeric data items encoded in a `FlutterStandardDataType`. + + - FlutterStandardDataTypeUInt8: plain bytes + - FlutterStandardDataTypeInt32: 32-bit signed integers + - FlutterStandardDataTypeInt64: 64-bit signed integers + - FlutterStandardDataTypeFloat64: 64-bit floats + */ +typedef NS_ENUM(NSInteger, FlutterStandardDataType) { + FlutterStandardDataTypeUInt8, + FlutterStandardDataTypeInt32, + FlutterStandardDataTypeInt64, + FlutterStandardDataTypeFloat64, +}; + +/** + A byte buffer holding `UInt8`, `SInt32`, `SInt64`, or `Float64` values, used + with `FlutterStandardMessageCodec` and `FlutterStandardMethodCodec`. + + Two's complement encoding is used for signed integers. IEEE754 + double-precision representation is used for floats. The platform's native + endianness is assumed. + */ +FLUTTER_EXPORT +@interface FlutterStandardTypedData : NSObject +/** + Creates a `FlutterStandardTypedData` which interprets the specified data + as plain bytes. + + - Parameter data: the byte data. + */ ++ (instancetype)typedDataWithBytes:(NSData*)data; + +/** + Creates a `FlutterStandardTypedData` which interprets the specified data + as 32-bit signed integers. + + - Parameter data: the byte data. The length must be divisible by 4. + */ ++ (instancetype)typedDataWithInt32:(NSData*)data; + +/** + Creates a `FlutterStandardTypedData` which interprets the specified data + as 64-bit signed integers. + + - Parameter data: the byte data. The length must be divisible by 8. + */ ++ (instancetype)typedDataWithInt64:(NSData*)data; + +/** + Creates a `FlutterStandardTypedData` which interprets the specified data + as 64-bit floats. + + - Parameter data: the byte data. The length must be divisible by 8. + */ ++ (instancetype)typedDataWithFloat64:(NSData*)data; + +/** + The raw underlying data buffer. + */ +@property(readonly, nonatomic) NSData* data; + +/** + The type of the encoded values. + */ +@property(readonly, nonatomic) FlutterStandardDataType type; + +/** + The number of value items encoded. + */ +@property(readonly, nonatomic) UInt32 elementCount; + +/** + The number of bytes used by the encoding of a single value item. + */ +@property(readonly, nonatomic) UInt8 elementSize; +@end + +/** + An arbitrarily large integer value, used with `FlutterStandardMessageCodec` + and `FlutterStandardMethodCodec`. + */ +FLUTTER_EXPORT +@interface FlutterStandardBigInteger : NSObject +/** + Creates a `FlutterStandardBigInteger` from a hexadecimal representation. + + - Parameter hex: a hexadecimal string. + */ ++ (instancetype)bigIntegerWithHex:(NSString*)hex; + +/** + The hexadecimal string representation of this integer. + */ +@property(readonly, nonatomic) NSString* hex; +@end + +/** + A codec for method calls and enveloped results. + + Method calls are encoded as binary messages with enough structure that the + codec can extract a method name `NSString` and an arguments `NSObject`, + possibly `nil`. These data items are used to populate a `FlutterMethodCall`. + + Result envelopes are encoded as binary messages with enough structure that + the codec can determine whether the result was successful or an error. In + the former case, the codec can extract the result `NSObject`, possibly `nil`. + In the latter case, the codec can extract an error code `NSString`, a + human-readable `NSString` error message (possibly `nil`), and a custom + error details `NSObject`, possibly `nil`. These data items are used to + populate a `FlutterError`. + */ +FLUTTER_EXPORT +@protocol FlutterMethodCodec +/** + Provides access to a shared instance this codec. + + - Returns: The shared instance. + */ ++ (instancetype)sharedInstance; + +/** + Encodes the specified method call into binary. + + - Parameter methodCall: The method call. The arguments value + must be supported by this codec. + - Returns: The binary encoding. + */ +- (NSData*)encodeMethodCall:(FlutterMethodCall*)methodCall; + +/** + Decodes the specified method call from binary. + + - Parameter methodCall: The method call to decode. + - Returns: The decoded method call. + */ +- (FlutterMethodCall*)decodeMethodCall:(NSData*)methodCall; + +/** + Encodes the specified successful result into binary. + + - Parameter result: The result. Must be a value supported by this codec. + - Returns: The binary encoding. + */ +- (NSData*)encodeSuccessEnvelope:(id _Nullable)result; + +/** + Encodes the specified error result into binary. + + - Parameter error: The error object. The error details value must be supported + by this codec. + - Returns: The binary encoding. + */ +- (NSData*)encodeErrorEnvelope:(FlutterError*)error; + +/** + Deccodes the specified result envelope from binary. + + - Parameter error: The error object. + - Returns: The result value, if the envelope represented a successful result, + or a `FlutterError` instance, if not. + */ +- (id _Nullable)decodeEnvelope:(NSData*)envelope; +@end + +/** + A `FlutterMethodCodec` using UTF-8 encoded JSON method calls and result + envelopes. + + This codec is guaranteed to be compatible with the corresponding + [JSONMethodCodec](https://docs.flutter.io/flutter/services/JSONMethodCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + Values supported as methods arguments and result payloads are + those supported as top-level or leaf values by `FlutterJSONMessageCodec`. + */ +FLUTTER_EXPORT +@interface FlutterJSONMethodCodec : NSObject +@end + +/** + A `FlutterMethodCodec` using the Flutter standard binary encoding. + + This codec is guaranteed to be compatible with the corresponding + [StandardMethodCodec](https://docs.flutter.io/flutter/services/StandardMethodCodec-class.html) + on the Dart side. These parts of the Flutter SDK are evolved synchronously. + + Values supported as method arguments and result payloads are those supported by + `FlutterStandardMessageCodec`. + */ +FLUTTER_EXPORT +@interface FlutterStandardMethodCodec : NSObject +@end + +NS_ASSUME_NONNULL_END + +#endif // FLUTTER_FLUTTERCODECS_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h b/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h new file mode 100644 index 0000000..79c7a7a --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterDartProject.h @@ -0,0 +1,27 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERDARTPROJECT_H_ +#define FLUTTER_FLUTTERDARTPROJECT_H_ + +#import + +#include "FlutterMacros.h" + +FLUTTER_EXPORT +@interface FlutterDartProject : NSObject + +- (instancetype)initWithPrecompiledDartBundle:(NSBundle*)bundle NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithFLXArchive:(NSURL*)archiveURL + dartMain:(NSURL*)dartMainURL + packages:(NSURL*)dartPackages NS_DESIGNATED_INITIALIZER; + +- (instancetype)initWithFLXArchiveWithScriptSnapshot:(NSURL*)archiveURL NS_DESIGNATED_INITIALIZER; + +- (instancetype)initFromDefaultSourceForConfiguration; + +@end + +#endif // FLUTTER_FLUTTERDARTPROJECT_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterMacros.h b/ios/Flutter/Flutter.framework/Headers/FlutterMacros.h new file mode 100644 index 0000000..4e32b6c --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterMacros.h @@ -0,0 +1,23 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERMACROS_H_ +#define FLUTTER_FLUTTERMACROS_H_ + +#if defined(FLUTTER_FRAMEWORK) + +#define FLUTTER_EXPORT __attribute__((visibility("default"))) + +#else // defined(FLUTTER_SDK) + +#define FLUTTER_EXPORT + +#endif // defined(FLUTTER_SDK) + +#ifndef NS_ASSUME_NONNULL_BEGIN +#define NS_ASSUME_NONNULL_BEGIN _Pragma("clang assume_nonnull begin") +#define NS_ASSUME_NONNULL_END _Pragma("clang assume_nonnull end") +#endif // defined(NS_ASSUME_NONNULL_BEGIN) + +#endif // FLUTTER_FLUTTERMACROS_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterNavigationController.h b/ios/Flutter/Flutter.framework/Headers/FlutterNavigationController.h new file mode 100644 index 0000000..1ff0911 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterNavigationController.h @@ -0,0 +1,9 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#import + +@interface FlutterNavigationController : UINavigationController + +@end diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterPlugin.h b/ios/Flutter/Flutter.framework/Headers/FlutterPlugin.h new file mode 100644 index 0000000..660e14a --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterPlugin.h @@ -0,0 +1,212 @@ +// Copyright 2017 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERPLUGIN_H_ +#define FLUTTER_FLUTTERPLUGIN_H_ + +#import + +#include "FlutterBinaryMessenger.h" +#include "FlutterChannels.h" +#include "FlutterCodecs.h" + +NS_ASSUME_NONNULL_BEGIN +@protocol FlutterPluginRegistrar; + +/** + Implemented by the iOS part of a Flutter plugin. + + Defines a set of optional callback methods and a method to set up the plugin + and register it to be called by other application components. + */ +@protocol FlutterPlugin +@required +/** + Registers this plugin. + + - Parameters: + - registrar: A helper providing application context and methods for + registering callbacks + */ ++ (void)registerWithRegistrar:(NSObject*)registrar; +@optional +/** + Called if this plugin has been registered to receive `FlutterMethodCall`s. + + - Parameters: + - call: The method call command object. + - result: A callback for submitting the result of the call. + */ +- (void)handleMethodCall:(FlutterMethodCall*)call result:(FlutterResult)result; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `NO` if this plugin vetoes application launch. + */ +- (BOOL)application:(UIApplication*)application + didFinishLaunchingWithOptions:(NSDictionary*)launchOptions; +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)applicationDidBecomeActive:(UIApplication*)application; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)applicationWillResignActive:(UIApplication*)application; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)applicationDidEnterBackground:(UIApplication*)application; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)applicationWillEnterForeground:(UIApplication*)application; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)applicationWillTerminate:(UIApplication*)application; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)application:(UIApplication*)application + didRegisterUserNotificationSettings:(UIUserNotificationSettings*)notificationSettings; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + */ +- (void)application:(UIApplication*)application + didRegisterForRemoteNotificationsWithDeviceToken:(NSData*)deviceToken; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `YES` if this plugin handles the request. + */ +- (BOOL)application:(UIApplication*)application + didReceiveRemoteNotification:(NSDictionary*)userInfo + fetchCompletionHandler:(void (^)(UIBackgroundFetchResult result))completionHandler; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `YES` if this plugin handles the request. +*/ +- (BOOL)application:(UIApplication*)application + openURL:(NSURL*)url + options:(NSDictionary*)options; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `YES` if this plugin handles the request. + */ +- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)url; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `YES` if this plugin handles the request. +*/ +- (BOOL)application:(UIApplication*)application + openURL:(NSURL*)url + sourceApplication:(NSString*)sourceApplication + annotation:(id)annotation; + +/** + Called if this plugin has been registered for `UIApplicationDelegate` callbacks. + + - Returns: `YES` if this plugin handles the request. +*/ +- (BOOL)application:(UIApplication*)application + performActionForShortcutItem:(UIApplicationShortcutItem*)shortcutItem + completionHandler:(void (^)(BOOL succeeded))completionHandler; + +@end + +/** + Registration context for a single `FlutterPlugin`. + */ +@protocol FlutterPluginRegistrar +/** + Returns a `FlutterBinaryMessenger` for creating Dart/iOS communication + channels to be used by the plugin. + + - Returns: The messenger. + */ +- (NSObject*)messenger; + +/** + Publishes a value for external use of the plugin. + + Plugins may publish a single value, such as an instance of the + plugin's main class, for situations where external control or + interaction is needed. + + The published value will be available from the `FlutterPluginRegistry`. + Repeated calls overwrite any previous publication. + + - Parameter value: The value to be published. + */ +- (void)publish:(NSObject*)value; + +/** + Registers the plugin as a receiver of incoming method calls from the Dart side + on the specified `FlutterMethodChannel`. + + - Parameters: + - delegate: The receiving object, such as the plugin's main class. + - channel: The channel + */ +- (void)addMethodCallDelegate:(NSObject*)delegate + channel:(FlutterMethodChannel*)channel; + +/** + Registers the plugin as a receiver of `UIApplicationDelegate` calls. + + - Parameters delegate: The receiving object, such as the plugin's main class. + */ +- (void)addApplicationDelegate:(NSObject*)delegate; +@end + +/** + A registry of Flutter iOS plugins. + + Plugins are identified by unique string keys, typically the name of the + plugin's main class. + */ +@protocol FlutterPluginRegistry +/** + Returns a registrar for registering a plugin. + + - Parameter pluginKey: The unique key identifying the plugin. + */ +- (NSObject*)registrarForPlugin:(NSString*)pluginKey; +/** + Returns whether the specified plugin has been registered. + + - Parameter pluginKey: The unique key identifying the plugin. + - Returns: `YES` if `registrarForPlugin` has been called with `pluginKey`. + */ +- (BOOL)hasPlugin:(NSString*)pluginKey; + +/** + Returns a value published by the specified plugin. + + - Parameter pluginKey: The unique key identifying the plugin. + - Returns: An object published by the plugin, if any. Will be `NSNull` if + nothing has been published. Will be `nil` if the plugin has not been + registered. + */ +- (NSObject*)valuePublishedByPlugin:(NSString*)pluginKey; +@end + +NS_ASSUME_NONNULL_END; + +#endif // FLUTTER_FLUTTERPLUGIN_H_ diff --git a/ios/Flutter/Flutter.framework/Headers/FlutterViewController.h b/ios/Flutter/Flutter.framework/Headers/FlutterViewController.h new file mode 100644 index 0000000..18480cb --- /dev/null +++ b/ios/Flutter/Flutter.framework/Headers/FlutterViewController.h @@ -0,0 +1,33 @@ +// Copyright 2016 The Chromium Authors. All rights reserved. +// Use of this source code is governed by a BSD-style license that can be +// found in the LICENSE file. + +#ifndef FLUTTER_FLUTTERVIEWCONTROLLER_H_ +#define FLUTTER_FLUTTERVIEWCONTROLLER_H_ + +#import +#include + +#include "FlutterBinaryMessenger.h" +#include "FlutterDartProject.h" +#include "FlutterMacros.h" + +FLUTTER_EXPORT +@interface FlutterViewController : UIViewController + +- (instancetype)initWithProject:(FlutterDartProject*)project + nibName:(NSString*)nibNameOrNil + bundle:(NSBundle*)nibBundleOrNil NS_DESIGNATED_INITIALIZER; + +- (void)handleStatusBarTouches:(UIEvent*)event; + +/** + Sets the first route that the Flutter app shows. The default is "/". + + - Parameter route: The name of the first route to show. + */ +- (void)setInitialRoute:(NSString*)route; + +@end + +#endif // FLUTTER_FLUTTERVIEWCONTROLLER_H_ diff --git a/ios/Flutter/Flutter.framework/Info.plist b/ios/Flutter/Flutter.framework/Info.plist new file mode 100644 index 0000000..5aa6c12 --- /dev/null +++ b/ios/Flutter/Flutter.framework/Info.plist @@ -0,0 +1,30 @@ + + + + + CFBundleDevelopmentRegion + en + CFBundleExecutable + Flutter + CFBundleIdentifier + io.flutter.flutter + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + Flutter + CFBundlePackageType + FMWK + CFBundleShortVersionString + 1.0 + CFBundleSignature + ???? + CFBundleVersion + 1.0 + UIRequiredDeviceCapabilities + + arm64 + + MinimumOSVersion + 8.0 + + diff --git a/ios/Flutter/Flutter.framework/Modules/module.modulemap b/ios/Flutter/Flutter.framework/Modules/module.modulemap new file mode 100644 index 0000000..bf81c8a --- /dev/null +++ b/ios/Flutter/Flutter.framework/Modules/module.modulemap @@ -0,0 +1,6 @@ +framework module Flutter { + umbrella header "Flutter.h" + + export * + module * { export * } +} diff --git a/ios/Flutter/Flutter.framework/icudtl.dat b/ios/Flutter/Flutter.framework/icudtl.dat new file mode 100644 index 0000000..d6d6b01 Binary files /dev/null and b/ios/Flutter/Flutter.framework/icudtl.dat differ diff --git a/ios/Flutter/Generated.xcconfig b/ios/Flutter/Generated.xcconfig new file mode 100644 index 0000000..c19aaac --- /dev/null +++ b/ios/Flutter/Generated.xcconfig @@ -0,0 +1,9 @@ +// This is a generated file; do not edit or check into version control. +FLUTTER_ROOT=/Users/ntrlab/flutter +FLUTTER_APPLICATION_PATH=/Users/ntrlab/semyon/apps/checker +FLUTTER_TARGET=/Users/ntrlab/semyon/apps/checker/lib/main.dart +FLUTTER_BUILD_MODE=debug +FLUTTER_BUILD_DIR=build +SYMROOT=${SOURCE_ROOT}/../build/ios +FLUTTER_FRAMEWORK_DIR=/Users/ntrlab/flutter/bin/cache/artifacts/engine/ios +#include "Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig" diff --git a/ios/Flutter/app.flx b/ios/Flutter/app.flx new file mode 100644 index 0000000..53a7e0e Binary files /dev/null and b/ios/Flutter/app.flx differ diff --git a/ios/Podfile.lock b/ios/Podfile.lock index 24d2c05..162e834 100644 --- a/ios/Podfile.lock +++ b/ios/Podfile.lock @@ -1,8 +1,8 @@ PODS: - Flutter (1.0.0) - - FMDB (2.7.2): - - FMDB/standard (= 2.7.2) - - FMDB/standard (2.7.2) + - FMDB (2.6.2): + - FMDB/standard (= 2.6.2) + - FMDB/standard (2.6.2) - path_provider (0.0.1): - Flutter - sqflite (0.0.1): @@ -10,24 +10,24 @@ PODS: - FMDB DEPENDENCIES: - - Flutter (from `/Users/kifio/flutter/bin/cache/artifacts/engine/ios`) - - path_provider (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios`) - - sqflite (from `/Users/kifio/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.2/ios`) + - Flutter (from `/Users/ntrlab/flutter/bin/cache/artifacts/engine/ios`) + - path_provider (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios`) + - sqflite (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios`) EXTERNAL SOURCES: Flutter: - :path: /Users/kifio/flutter/bin/cache/artifacts/engine/ios + :path: /Users/ntrlab/flutter/bin/cache/artifacts/engine/ios path_provider: - :path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios + :path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios sqflite: - :path: /Users/kifio/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.2/ios + :path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios SPEC CHECKSUMS: Flutter: d674e78c937094a75ac71dd77e921e840bea3dbf - FMDB: 6198a90e7b6900cfc046e6bc0ef6ebb7be9236aa + FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 sqflite: 8e2d9fe1e7cdc95d4d537fc7eb2d23c8dc428e3c PODFILE CHECKSUM: 351e02e34b831289961ec3558a535cbd2c4965d2 -COCOAPODS: 1.2.0 +COCOAPODS: 1.2.1 diff --git a/ios/Pods/FMDB/LICENSE.txt b/ios/Pods/FMDB/LICENSE.txt new file mode 100644 index 0000000..addfc1a --- /dev/null +++ b/ios/Pods/FMDB/LICENSE.txt @@ -0,0 +1,28 @@ +If you are using FMDB in your project, I'd love to hear about it. Let Gus know +by sending an email to gus@flyingmeat.com. + +And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you +might consider purchasing a drink of their choosing if FMDB has been useful to +you. + +Finally, and shortly, this is the MIT License. + +Copyright (c) 2008-2014 Flying Meat Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. \ No newline at end of file diff --git a/ios/Pods/FMDB/README.markdown b/ios/Pods/FMDB/README.markdown new file mode 100644 index 0000000..f0d883d --- /dev/null +++ b/ios/Pods/FMDB/README.markdown @@ -0,0 +1,397 @@ +# FMDB v2.6.2 + +This is an Objective-C wrapper around SQLite: http://sqlite.org/ + +## The FMDB Mailing List: +http://groups.google.com/group/fmdb + +## Read the SQLite FAQ: +http://www.sqlite.org/faq.html + +Since FMDB is built on top of SQLite, you're going to want to read this page top to bottom at least once. And while you're there, make sure to bookmark the SQLite Documentation page: http://www.sqlite.org/docs.html + +## Contributing +Do you have an awesome idea that deserves to be in FMDB? You might consider pinging ccgus first to make sure he hasn't already ruled it out for some reason. Otherwise pull requests are great, and make sure you stick to the local coding conventions. However, please be patient and if you haven't heard anything from ccgus for a week or more, you might want to send a note asking what's up. + +## CocoaPods + +[![Dependency Status](https://www.versioneye.com/objective-c/fmdb/2.3/badge.svg?style=flat)](https://www.versioneye.com/objective-c/fmdb/2.3) +[![Reference Status](https://www.versioneye.com/objective-c/fmdb/reference_badge.svg?style=flat)](https://www.versioneye.com/objective-c/fmdb/references) + +FMDB can be installed using [CocoaPods](https://cocoapods.org/). + +``` +pod 'FMDB' +# pod 'FMDB/FTS' # FMDB with FTS +# pod 'FMDB/standalone' # FMDB with latest SQLite amalgamation source +# pod 'FMDB/standalone/FTS' # FMDB with latest SQLite amalgamation source and FTS +# pod 'FMDB/SQLCipher' # FMDB with SQLCipher +``` + +**If using FMDB with [SQLCipher](https://www.zetetic.net/sqlcipher/) you must use the FMDB/SQLCipher subspec. The FMDB/SQLCipher subspec declares SQLCipher as a dependency, allowing FMDB to be compiled with the `-DSQLITE_HAS_CODEC` flag.** + +## FMDB Class Reference: +http://ccgus.github.io/fmdb/html/index.html + +## Automatic Reference Counting (ARC) or Manual Memory Management? +You can use either style in your Cocoa project. FMDB will figure out which you are using at compile time and do the right thing. + +## Usage +There are three main classes in FMDB: + +1. `FMDatabase` - Represents a single SQLite database. Used for executing SQL statements. +2. `FMResultSet` - Represents the results of executing a query on an `FMDatabase`. +3. `FMDatabaseQueue` - If you're wanting to perform queries and updates on multiple threads, you'll want to use this class. It's described in the "Thread Safety" section below. + +### Database Creation +An `FMDatabase` is created with a path to a SQLite database file. This path can be one of these three: + +1. A file system path. The file does not have to exist on disk. If it does not exist, it is created for you. +2. An empty string (`@""`). An empty database is created at a temporary location. This database is deleted with the `FMDatabase` connection is closed. +3. `NULL`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed. + +(For more information on temporary and in-memory databases, read the sqlite documentation on the subject: http://www.sqlite.org/inmemorydb.html) + +```objc +FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"]; +``` + +### Opening + +Before you can interact with the database, it must be opened. Opening fails if there are insufficient resources or permissions to open and/or create the database. + +```objc +if (![db open]) { + [db release]; + return; +} +``` + +### Executing Updates + +Any sort of SQL statement which is not a `SELECT` statement qualifies as an update. This includes `CREATE`, `UPDATE`, `INSERT`, `ALTER`, `COMMIT`, `BEGIN`, `DETACH`, `DELETE`, `DROP`, `END`, `EXPLAIN`, `VACUUM`, and `REPLACE` statements (plus many more). Basically, if your SQL statement does not begin with `SELECT`, it is an update statement. + +Executing updates returns a single value, a `BOOL`. A return value of `YES` means the update was successfully executed, and a return value of `NO` means that some error was encountered. You may invoke the `-lastErrorMessage` and `-lastErrorCode` methods to retrieve more information. + +### Executing Queries + +A `SELECT` statement is a query and is executed via one of the `-executeQuery...` methods. + +Executing queries returns an `FMResultSet` object if successful, and `nil` upon failure. You should use the `-lastErrorMessage` and `-lastErrorCode` methods to determine why a query failed. + +In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" from one record to the other. With FMDB, the easiest way to do that is like this: + +```objc +FMResultSet *s = [db executeQuery:@"SELECT * FROM myTable"]; +while ([s next]) { + //retrieve values for each record +} +``` + +You must always invoke `-[FMResultSet next]` before attempting to access the values returned in a query, even if you're only expecting one: + +```objc +FMResultSet *s = [db executeQuery:@"SELECT COUNT(*) FROM myTable"]; +if ([s next]) { + int totalCount = [s intForColumnIndex:0]; +} +``` + +`FMResultSet` has many methods to retrieve data in an appropriate format: + +- `intForColumn:` +- `longForColumn:` +- `longLongIntForColumn:` +- `boolForColumn:` +- `doubleForColumn:` +- `stringForColumn:` +- `dateForColumn:` +- `dataForColumn:` +- `dataNoCopyForColumn:` +- `UTF8StringForColumnName:` +- `objectForColumnName:` + +Each of these methods also has a `{type}ForColumnIndex:` variant that is used to retrieve the data based on the position of the column in the results, as opposed to the column's name. + +Typically, there's no need to `-close` an `FMResultSet` yourself, since that happens when either the result set is deallocated, or the parent database is closed. + +### Closing + +When you have finished executing queries and updates on the database, you should `-close` the `FMDatabase` connection so that SQLite will relinquish any resources it has acquired during the course of its operation. + +```objc +[db close]; +``` + +### Transactions + +`FMDatabase` can begin and commit a transaction by invoking one of the appropriate methods or executing a begin/end transaction statement. + +### Multiple Statements and Batch Stuff + +You can use `FMDatabase`'s executeStatements:withResultBlock: to do multiple statements in a string: + +```objc +NSString *sql = @"create table bulktest1 (id integer primary key autoincrement, x text);" + "create table bulktest2 (id integer primary key autoincrement, y text);" + "create table bulktest3 (id integer primary key autoincrement, z text);" + "insert into bulktest1 (x) values ('XXX');" + "insert into bulktest2 (y) values ('YYY');" + "insert into bulktest3 (z) values ('ZZZ');"; + +success = [db executeStatements:sql]; + +sql = @"select count(*) as count from bulktest1;" + "select count(*) as count from bulktest2;" + "select count(*) as count from bulktest3;"; + +success = [self.db executeStatements:sql withResultBlock:^int(NSDictionary *dictionary) { + NSInteger count = [dictionary[@"count"] integerValue]; + XCTAssertEqual(count, 1, @"expected one record for dictionary %@", dictionary); + return 0; +}]; +``` + +### Data Sanitization + +When providing a SQL statement to FMDB, you should not attempt to "sanitize" any values before insertion. Instead, you should use the standard SQLite binding syntax: + +```sql +INSERT INTO myTable VALUES (?, ?, ?, ?) +``` + +The `?` character is recognized by SQLite as a placeholder for a value to be inserted. The execution methods all accept a variable number of arguments (or a representation of those arguments, such as an `NSArray`, `NSDictionary`, or a `va_list`), which are properly escaped for you. + +And, to use that SQL with the `?` placeholders from Objective-C: + +```objc +NSInteger identifier = 42; +NSString *name = @"Liam O'Flaherty (\"the famous Irish author\")"; +NSDate *date = [NSDate date]; +NSString *comment = nil; + +BOOL success = [db executeUpdate:@"INSERT INTO authors (identifier, name, date, comment) VALUES (?, ?, ?, ?)", @(identifier), name, date, comment ?: [NSNull null]]; +if (!success) { + NSLog(@"error = %@", [db lastErrorMessage]); +} +``` + +> **Note:** Fundamental data types, like the `NSInteger` variable `identifier`, should be as a `NSNumber` objects, achieved by using the `@` syntax, shown above. Or you can use the `[NSNumber numberWithInt:identifier]` syntax, too. +> +> Likewise, SQL `NULL` values should be inserted as `[NSNull null]`. For example, in the case of `comment` which might be `nil` (and is in this example), you can use the `comment ?: [NSNull null]` syntax, which will insert the string if `comment` is not `nil`, but will insert `[NSNull null]` if it is `nil`. + +In Swift, you would use `executeUpdate(values:)`, which not only is a concise Swift syntax, but also `throws` errors for proper Swift 2 error handling: + +```swift +do { + let identifier = 42 + let name = "Liam O'Flaherty (\"the famous Irish author\")" + let date = NSDate() + let comment: String? = nil + + try db.executeUpdate("INSERT INTO authors (identifier, name, date, comment) VALUES (?, ?, ?, ?)", values: [identifier, name, date, comment ?? NSNull()]) +} catch { + print("error = \(error)") +} +``` + +> **Note:** In Swift, you don't have to wrap fundamental numeric types like you do in Objective-C. But if you are going to insert an optional string, you would probably use the `comment ?? NSNull()` syntax (i.e., if it is `nil`, use `NSNull`, otherwise use the string). + +Alternatively, you may use named parameters syntax: + +```sql +INSERT INTO authors (identifier, name, date, comment) VALUES (:identifier, :name, :date, :comment) +``` + +The parameters *must* start with a colon. SQLite itself supports other characters, but internally the dictionary keys are prefixed with a colon, do **not** include the colon in your dictionary keys. + +```objc +NSDictionary *arguments = @{@"identifier": @(identifier), @"name": name, @"date": date, @"comment": comment ?: [NSNull null]}; +BOOL success = [db executeUpdate:@"INSERT INTO authors (identifier, name, date, comment) VALUES (:identifier, :name, :date, :comment)" withParameterDictionary:arguments]; +if (!success) { + NSLog(@"error = %@", [db lastErrorMessage]); +} +``` + +The key point is that one should not use `NSString` method `stringWithFormat` to manually insert values into the SQL statement, itself. Nor should one Swift string interpolation to insert values into the SQL. Use `?` placeholders for values to be inserted into the database (or used in `WHERE` clauses in `SELECT` statements). + +

Using FMDatabaseQueue and Thread Safety.

+ +Using a single instance of `FMDatabase` from multiple threads at once is a bad idea. It has always been OK to make a `FMDatabase` object *per thread*. Just don't share a single instance across threads, and definitely not across multiple threads at the same time. Bad things will eventually happen and you'll eventually get something to crash, or maybe get an exception, or maybe meteorites will fall out of the sky and hit your Mac Pro. *This would suck*. + +**So don't instantiate a single `FMDatabase` object and use it across multiple threads.** + +Instead, use `FMDatabaseQueue`. Instantiate a single `FMDatabaseQueue` and use it across multiple threads. The `FMDatabaseQueue` object will synchronize and coordinate access across the multiple threads. Here's how to use it: + +First, make your queue. + +```objc +FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath]; +``` + +Then use it like so: + + +```objc +[queue inDatabase:^(FMDatabase *db) { + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @1]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @2]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @3]; + + FMResultSet *rs = [db executeQuery:@"select * from foo"]; + while ([rs next]) { + … + } +}]; +``` + +An easy way to wrap things up in a transaction can be done like this: + +```objc +[queue inTransaction:^(FMDatabase *db, BOOL *rollback) { + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @1]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @2]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @3]; + + if (whoopsSomethingWrongHappened) { + *rollback = YES; + return; + } + // etc… + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", @4]; +}]; +``` + +The Swift equivalent would be: + +```swift +queue.inTransaction { db, rollback in + do { + try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [1]) + try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [2]) + try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [3]) + + if whoopsSomethingWrongHappened { + rollback.memory = true + return + } + + try db.executeUpdate("INSERT INTO myTable VALUES (?)", values: [4]) + } catch { + rollback.memory = true + print(error) + } +} +``` + +`FMDatabaseQueue` will run the blocks on a serialized queue (hence the name of the class). So if you call `FMDatabaseQueue`'s methods from multiple threads at the same time, they will be executed in the order they are received. This way queries and updates won't step on each other's toes, and every one is happy. + +**Note:** The calls to `FMDatabaseQueue`'s methods are blocking. So even though you are passing along blocks, they will **not** be run on another thread. + +## Making custom sqlite functions, based on blocks. + +You can do this! For an example, look for `-makeFunctionNamed:` in main.m + +## Swift + +You can use FMDB in Swift projects too. + +To do this, you must: + +1. Copy the relevant `.m` and `.h` files from the FMDB `src` folder into your project. + + You can copy all of them (which is easiest), or only the ones you need. Likely you will need [`FMDatabase`](http://ccgus.github.io/fmdb/html/Classes/FMDatabase.html) and [`FMResultSet`](http://ccgus.github.io/fmdb/html/Classes/FMResultSet.html) at a minimum. [`FMDatabaseAdditions`](http://ccgus.github.io/fmdb/html/Categories/FMDatabase+FMDatabaseAdditions.html) provides some very useful convenience methods, so you will likely want that, too. If you are doing multithreaded access to a database, [`FMDatabaseQueue`](http://ccgus.github.io/fmdb/html/Classes/FMDatabaseQueue.html) is quite useful, too. If you choose to not copy all of the files from the `src` directory, though, you may want to update `FMDB.h` to only reference the files that you included in your project. + + Note, if you're copying all of the files from the `src` folder into to your project (which is recommended), you may want to drag the individual files into your project, not the folder, itself, because if you drag the folder, you won't be prompted to add the bridging header (see next point). + +2. If prompted to create a "bridging header", you should do so. If not prompted and if you don't already have a bridging header, add one. + + For more information on bridging headers, see [Swift and Objective-C in the Same Project](https://developer.apple.com/library/ios/documentation/Swift/Conceptual/BuildingCocoaApps/MixandMatch.html#//apple_ref/doc/uid/TP40014216-CH10-XID_76). + +3. In your bridging header, add a line that says: + ```objc + #import "FMDB.h" + ``` + +4. Use the variations of `executeQuery` and `executeUpdate` with the `sql` and `values` parameters with `try` pattern, as shown below. These renditions of `executeQuery` and `executeUpdate` both `throw` errors in true Swift 2 fashion. + +If you do the above, you can then write Swift code that uses `FMDatabase`. For example: + +```swift +let documents = try! NSFileManager.defaultManager().URLForDirectory(.DocumentDirectory, inDomain: .UserDomainMask, appropriateForURL: nil, create: false) +let fileURL = documents.URLByAppendingPathComponent("test.sqlite") + +let database = FMDatabase(path: fileURL.path) + +if !database.open() { + print("Unable to open database") + return +} + +do { + try database.executeUpdate("create table test(x text, y text, z text)", values: nil) + try database.executeUpdate("insert into test (x, y, z) values (?, ?, ?)", values: ["a", "b", "c"]) + try database.executeUpdate("insert into test (x, y, z) values (?, ?, ?)", values: ["e", "f", "g"]) + + let rs = try database.executeQuery("select x, y, z from test", values: nil) + while rs.next() { + let x = rs.stringForColumn("x") + let y = rs.stringForColumn("y") + let z = rs.stringForColumn("z") + print("x = \(x); y = \(y); z = \(z)") + } +} catch let error as NSError { + print("failed: \(error.localizedDescription)") +} + +database.close() +``` + +## History + +The history and changes are availbe on its [GitHub page](https://github.com/ccgus/fmdb) and are summarized in the "CHANGES_AND_TODO_LIST.txt" file. + +## Contributors + +The contributors to FMDB are contained in the "Contributors.txt" file. + +## Additional projects using FMDB, which might be interesting to the discerning developer. + + * FMDBMigrationManager, A SQLite schema migration management system for FMDB: https://github.com/layerhq/FMDBMigrationManager + * FCModel, An alternative to Core Data for people who like having direct SQL access: https://github.com/marcoarment/FCModel + +## Quick notes on FMDB's coding style + +Spaces, not tabs. Square brackets, not dot notation. Look at what FMDB already does with curly brackets and such, and stick to that style. + +## Reporting bugs + +Reduce your bug down to the smallest amount of code possible. You want to make it super easy for the developers to see and reproduce your bug. If it helps, pretend that the person who can fix your bug is active on shipping 3 major products, works on a handful of open source projects, has a newborn baby, and is generally very very busy. + +And we've even added a template function to main.m (FMDBReportABugFunction) in the FMDB distribution to help you out: + +* Open up fmdb project in Xcode. +* Open up main.m and modify the FMDBReportABugFunction to reproduce your bug. + * Setup your table(s) in the code. + * Make your query or update(s). + * Add some assertions which demonstrate the bug. + +Then you can bring it up on the FMDB mailing list by showing your nice and compact FMDBReportABugFunction, or you can report the bug via the github FMDB bug reporter. + +**Optional:** + +Figure out where the bug is, fix it, and send a patch in or bring that up on the mailing list. Make sure all the other tests run after your modifications. + +## Support + +The support channels for FMDB are the mailing list (see above), filing a bug here, or maybe on Stack Overflow. So that is to say, support is provided by the community and on a voluntary basis. + +FMDB development is overseen by Gus Mueller of Flying Meat. If FMDB been helpful to you, consider purchasing an app from FM or telling all your friends about it. + +## License + +The license for FMDB is contained in the "License.txt" file. + +If you happen to come across either Gus Mueller or Rob Ryan in a bar, you might consider purchasing a drink of their choosing if FMDB has been useful to you. + +(The drink is for them of course, shame on you for trying to keep it.) diff --git a/ios/Pods/FMDB/src/fmdb/FMDB.h b/ios/Pods/FMDB/src/fmdb/FMDB.h new file mode 100644 index 0000000..1ff5465 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDB.h @@ -0,0 +1,10 @@ +#import + +FOUNDATION_EXPORT double FMDBVersionNumber; +FOUNDATION_EXPORT const unsigned char FMDBVersionString[]; + +#import "FMDatabase.h" +#import "FMResultSet.h" +#import "FMDatabaseAdditions.h" +#import "FMDatabaseQueue.h" +#import "FMDatabasePool.h" diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabase.h b/ios/Pods/FMDB/src/fmdb/FMDatabase.h new file mode 100644 index 0000000..7dd5f8c --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabase.h @@ -0,0 +1,1162 @@ +#import +#import "FMResultSet.h" +#import "FMDatabasePool.h" + + +#if ! __has_feature(objc_arc) + #define FMDBAutorelease(__v) ([__v autorelease]); + #define FMDBReturnAutoreleased FMDBAutorelease + + #define FMDBRetain(__v) ([__v retain]); + #define FMDBReturnRetained FMDBRetain + + #define FMDBRelease(__v) ([__v release]); + + #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v)); +#else + // -fobjc-arc + #define FMDBAutorelease(__v) + #define FMDBReturnAutoreleased(__v) (__v) + + #define FMDBRetain(__v) + #define FMDBReturnRetained(__v) (__v) + + #define FMDBRelease(__v) + +// If OS_OBJECT_USE_OBJC=1, then the dispatch objects will be treated like ObjC objects +// and will participate in ARC. +// See the section on "Dispatch Queues and Automatic Reference Counting" in "Grand Central Dispatch (GCD) Reference" for details. + #if OS_OBJECT_USE_OBJC + #define FMDBDispatchQueueRelease(__v) + #else + #define FMDBDispatchQueueRelease(__v) (dispatch_release(__v)); + #endif +#endif + +#if !__has_feature(objc_instancetype) + #define instancetype id +#endif + + +typedef int(^FMDBExecuteStatementsCallbackBlock)(NSDictionary *resultsDictionary); + + +/** A SQLite ([http://sqlite.org/](http://sqlite.org/)) Objective-C wrapper. + + ### Usage + The three main classes in FMDB are: + + - `FMDatabase` - Represents a single SQLite database. Used for executing SQL statements. + - `` - Represents the results of executing a query on an `FMDatabase`. + - `` - If you want to perform queries and updates on multiple threads, you'll want to use this class. + + ### See also + + - `` - A pool of `FMDatabase` objects. + - `` - A wrapper for `sqlite_stmt`. + + ### External links + + - [FMDB on GitHub](https://github.com/ccgus/fmdb) including introductory documentation + - [SQLite web site](http://sqlite.org/) + - [FMDB mailing list](http://groups.google.com/group/fmdb) + - [SQLite FAQ](http://www.sqlite.org/faq.html) + + @warning Do not instantiate a single `FMDatabase` object and use it across multiple threads. Instead, use ``. + + */ + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wobjc-interface-ivars" + + +@interface FMDatabase : NSObject { + + void* _db; + NSString* _databasePath; + BOOL _logsErrors; + BOOL _crashOnErrors; + BOOL _traceExecution; + BOOL _checkedOut; + BOOL _shouldCacheStatements; + BOOL _isExecutingStatement; + BOOL _inTransaction; + NSTimeInterval _maxBusyRetryTimeInterval; + NSTimeInterval _startBusyRetryTime; + + NSMutableDictionary *_cachedStatements; + NSMutableSet *_openResultSets; + NSMutableSet *_openFunctions; + + NSDateFormatter *_dateFormat; +} + +///----------------- +/// @name Properties +///----------------- + +/** Whether should trace execution */ + +@property (atomic, assign) BOOL traceExecution; + +/** Whether checked out or not */ + +@property (atomic, assign) BOOL checkedOut; + +/** Crash on errors */ + +@property (atomic, assign) BOOL crashOnErrors; + +/** Logs errors */ + +@property (atomic, assign) BOOL logsErrors; + +/** Dictionary of cached statements */ + +@property (atomic, retain) NSMutableDictionary *cachedStatements; + +///--------------------- +/// @name Initialization +///--------------------- + +/** Create a `FMDatabase` object. + + An `FMDatabase` is created with a path to a SQLite database file. This path can be one of these three: + + 1. A file system path. The file does not have to exist on disk. If it does not exist, it is created for you. + 2. An empty string (`@""`). An empty database is created at a temporary location. This database is deleted with the `FMDatabase` connection is closed. + 3. `nil`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed. + + For example, to create/open a database in your Mac OS X `tmp` folder: + + FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"]; + + Or, in iOS, you might open a database in the app's `Documents` directory: + + NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; + NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"]; + FMDatabase *db = [FMDatabase databaseWithPath:dbPath]; + + (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [http://www.sqlite.org/inmemorydb.html](http://www.sqlite.org/inmemorydb.html)) + + @param inPath Path of database file + + @return `FMDatabase` object if successful; `nil` if failure. + + */ + ++ (instancetype)databaseWithPath:(NSString*)inPath; + +/** Initialize a `FMDatabase` object. + + An `FMDatabase` is created with a path to a SQLite database file. This path can be one of these three: + + 1. A file system path. The file does not have to exist on disk. If it does not exist, it is created for you. + 2. An empty string (`@""`). An empty database is created at a temporary location. This database is deleted with the `FMDatabase` connection is closed. + 3. `nil`. An in-memory database is created. This database will be destroyed with the `FMDatabase` connection is closed. + + For example, to create/open a database in your Mac OS X `tmp` folder: + + FMDatabase *db = [FMDatabase databaseWithPath:@"/tmp/tmp.db"]; + + Or, in iOS, you might open a database in the app's `Documents` directory: + + NSString *docsPath = NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES)[0]; + NSString *dbPath = [docsPath stringByAppendingPathComponent:@"test.db"]; + FMDatabase *db = [FMDatabase databaseWithPath:dbPath]; + + (For more information on temporary and in-memory databases, read the sqlite documentation on the subject: [http://www.sqlite.org/inmemorydb.html](http://www.sqlite.org/inmemorydb.html)) + + @param inPath Path of database file + + @return `FMDatabase` object if successful; `nil` if failure. + + */ + +- (instancetype)initWithPath:(NSString*)inPath; + + +///----------------------------------- +/// @name Opening and closing database +///----------------------------------- + +/** Opening a new database connection + + The database is opened for reading and writing, and is created if it does not already exist. + + @return `YES` if successful, `NO` on error. + + @see [sqlite3_open()](http://sqlite.org/c3ref/open.html) + @see openWithFlags: + @see close + */ + +- (BOOL)open; + +/** Opening a new database connection with flags and an optional virtual file system (VFS) + + @param flags one of the following three values, optionally combined with the `SQLITE_OPEN_NOMUTEX`, `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, `SQLITE_OPEN_PRIVATECACHE`, and/or `SQLITE_OPEN_URI` flags: + + `SQLITE_OPEN_READONLY` + + The database is opened in read-only mode. If the database does not already exist, an error is returned. + + `SQLITE_OPEN_READWRITE` + + The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned. + + `SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE` + + The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for `open` method. + + @return `YES` if successful, `NO` on error. + + @see [sqlite3_open_v2()](http://sqlite.org/c3ref/open.html) + @see open + @see close + */ + +- (BOOL)openWithFlags:(int)flags; + +/** Opening a new database connection with flags and an optional virtual file system (VFS) + + @param flags one of the following three values, optionally combined with the `SQLITE_OPEN_NOMUTEX`, `SQLITE_OPEN_FULLMUTEX`, `SQLITE_OPEN_SHAREDCACHE`, `SQLITE_OPEN_PRIVATECACHE`, and/or `SQLITE_OPEN_URI` flags: + + `SQLITE_OPEN_READONLY` + + The database is opened in read-only mode. If the database does not already exist, an error is returned. + + `SQLITE_OPEN_READWRITE` + + The database is opened for reading and writing if possible, or reading only if the file is write protected by the operating system. In either case the database must already exist, otherwise an error is returned. + + `SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE` + + The database is opened for reading and writing, and is created if it does not already exist. This is the behavior that is always used for `open` method. + + @param vfsName If vfs is given the value is passed to the vfs parameter of sqlite3_open_v2. + + @return `YES` if successful, `NO` on error. + + @see [sqlite3_open_v2()](http://sqlite.org/c3ref/open.html) + @see open + @see close + */ + +- (BOOL)openWithFlags:(int)flags vfs:(NSString *)vfsName; + +/** Closing a database connection + + @return `YES` if success, `NO` on error. + + @see [sqlite3_close()](http://sqlite.org/c3ref/close.html) + @see open + @see openWithFlags: + */ + +- (BOOL)close; + +/** Test to see if we have a good connection to the database. + + This will confirm whether: + + - is database open + - if open, it will try a simple SELECT statement and confirm that it succeeds. + + @return `YES` if everything succeeds, `NO` on failure. + */ + +- (BOOL)goodConnection; + + +///---------------------- +/// @name Perform updates +///---------------------- + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](http://sqlite.org/c3ref/step.html) to perform the update. + + The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method. + + @param sql The SQL to be performed, with optional `?` placeholders. + + @param outErr A reference to the `NSError` pointer to be updated with an auto released `NSError` object if an error if an error occurs. If `nil`, no `NSError` object will be returned. + + @param ... Optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. `NSString`, `NSNumber`, etc.), not fundamental C data types (e.g. `int`, `char *`, etc.). + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see lastError + @see lastErrorCode + @see lastErrorMessage + @see [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) + */ + +- (BOOL)executeUpdate:(NSString*)sql withErrorAndBindings:(NSError**)outErr, ...; + +/** Execute single update statement + + @see executeUpdate:withErrorAndBindings: + + @warning **Deprecated**: Please use `` instead. + */ + +- (BOOL)update:(NSString*)sql withErrorAndBindings:(NSError**)outErr, ... __attribute__ ((deprecated)); + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html), [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) to bind values to `?` placeholders in the SQL with the optional list of parameters, and [`sqlite_step`](http://sqlite.org/c3ref/step.html) to perform the update. + + The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method. + + @param sql The SQL to be performed, with optional `?` placeholders. + + @param ... Optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. `NSString`, `NSNumber`, etc.), not fundamental C data types (e.g. `int`, `char *`, etc.). + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see lastError + @see lastErrorCode + @see lastErrorMessage + @see [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) + + @note This technique supports the use of `?` placeholders in the SQL, automatically binding any supplied value parameters to those placeholders. This approach is more robust than techniques that entail using `stringWithFormat` to manually build SQL statements, which can be problematic if the values happened to include any characters that needed to be quoted. + + @note If you want to use this from Swift, please note that you must include `FMDatabaseVariadic.swift` in your project. Without that, you cannot use this method directly, and instead have to use methods such as ``. + */ + +- (BOOL)executeUpdate:(NSString*)sql, ...; + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](http://sqlite.org/c3ref/step.html) to perform the update. Unlike the other `executeUpdate` methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL. Do not use `?` placeholders in the SQL if you use this method. + + @param format The SQL to be performed, with `printf`-style escape sequences. + + @param ... Optional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement. + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see executeUpdate: + @see lastError + @see lastErrorCode + @see lastErrorMessage + + @note This method does not technically perform a traditional printf-style replacement. What this method actually does is replace the printf-style percent sequences with a SQLite `?` placeholder, and then bind values to that placeholder. Thus the following command + + [db executeUpdateWithFormat:@"INSERT INTO test (name) VALUES (%@)", @"Gus"]; + + is actually replacing the `%@` with `?` placeholder, and then performing something equivalent to `` + + [db executeUpdate:@"INSERT INTO test (name) VALUES (?)", @"Gus"]; + + There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The `VALUES` clause was _not_ `VALUES ('%@')` (like you might have to do if you built a SQL statement using `NSString` method `stringWithFormat`), but rather simply `VALUES (%@)`. + */ + +- (BOOL)executeUpdateWithFormat:(NSString *)format, ... NS_FORMAT_FUNCTION(1,2); + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters. + + The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method. + + @param sql The SQL to be performed, with optional `?` placeholders. + + @param arguments A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement. + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see executeUpdate:values:error: + @see lastError + @see lastErrorCode + @see lastErrorMessage + */ + +- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments; + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) binding any `?` placeholders in the SQL with the optional list of parameters. + + The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method. + + This is similar to ``, except that this also accepts a pointer to a `NSError` pointer, so that errors can be returned. + + In Swift 2, this throws errors, as if it were defined as follows: + + `func executeUpdate(sql: String!, values: [AnyObject]!) throws -> Bool` + + @param sql The SQL to be performed, with optional `?` placeholders. + + @param values A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement. + + @param error A `NSError` object to receive any error object (if any). + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see lastError + @see lastErrorCode + @see lastErrorMessage + + */ + +- (BOOL)executeUpdate:(NSString*)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error; + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](http://sqlite.org/c3ref/step.html) to perform the update. Unlike the other `executeUpdate` methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL. + + The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method. + + @param sql The SQL to be performed, with optional `?` placeholders. + + @param arguments A `NSDictionary` of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement. + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see lastError + @see lastErrorCode + @see lastErrorMessage +*/ + +- (BOOL)executeUpdate:(NSString*)sql withParameterDictionary:(NSDictionary *)arguments; + + +/** Execute single update statement + + This method executes a single SQL update statement (i.e. any SQL that does not return results, such as `UPDATE`, `INSERT`, or `DELETE`. This method employs [`sqlite3_prepare_v2`](http://sqlite.org/c3ref/prepare.html) and [`sqlite_step`](http://sqlite.org/c3ref/step.html) to perform the update. Unlike the other `executeUpdate` methods, this uses printf-style formatters (e.g. `%s`, `%d`, etc.) to build the SQL. + + The optional values provided to this method should be objects (e.g. `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects), not fundamental data types (e.g. `int`, `long`, `NSInteger`, etc.). This method automatically handles the aforementioned object types, and all other object types will be interpreted as text values using the object's `description` method. + + @param sql The SQL to be performed, with optional `?` placeholders. + + @param args A `va_list` of arguments. + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see lastError + @see lastErrorCode + @see lastErrorMessage + */ + +- (BOOL)executeUpdate:(NSString*)sql withVAList: (va_list)args; + +/** Execute multiple SQL statements + + This executes a series of SQL statements that are combined in a single string (e.g. the SQL generated by the `sqlite3` command line `.dump` command). This accepts no value parameters, but rather simply expects a single string with multiple SQL statements, each terminated with a semicolon. This uses `sqlite3_exec`. + + @param sql The SQL to be performed + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see executeStatements:withResultBlock: + @see [sqlite3_exec()](http://sqlite.org/c3ref/exec.html) + + */ + +- (BOOL)executeStatements:(NSString *)sql; + +/** Execute multiple SQL statements with callback handler + + This executes a series of SQL statements that are combined in a single string (e.g. the SQL generated by the `sqlite3` command line `.dump` command). This accepts no value parameters, but rather simply expects a single string with multiple SQL statements, each terminated with a semicolon. This uses `sqlite3_exec`. + + @param sql The SQL to be performed. + @param block A block that will be called for any result sets returned by any SQL statements. + Note, if you supply this block, it must return integer value, zero upon success (this would be a good opportunity to use SQLITE_OK), + non-zero value upon failure (which will stop the bulk execution of the SQL). If a statement returns values, the block will be called with the results from the query in NSDictionary *resultsDictionary. + This may be `nil` if you don't care to receive any results. + + @return `YES` upon success; `NO` upon failure. If failed, you can call ``, + ``, or `` for diagnostic information regarding the failure. + + @see executeStatements: + @see [sqlite3_exec()](http://sqlite.org/c3ref/exec.html) + + */ + +- (BOOL)executeStatements:(NSString *)sql withResultBlock:(FMDBExecuteStatementsCallbackBlock)block; + +/** Last insert rowid + + Each entry in an SQLite table has a unique 64-bit signed integer key called the "rowid". The rowid is always available as an undeclared column named `ROWID`, `OID`, or `_ROWID_` as long as those names are not also used by explicitly declared columns. If the table has a column of type `INTEGER PRIMARY KEY` then that column is another alias for the rowid. + + This routine returns the rowid of the most recent successful `INSERT` into the database from the database connection in the first argument. As of SQLite version 3.7.7, this routines records the last insert rowid of both ordinary tables and virtual tables. If no successful `INSERT`s have ever occurred on that database connection, zero is returned. + + @return The rowid of the last inserted row. + + @see [sqlite3_last_insert_rowid()](http://sqlite.org/c3ref/last_insert_rowid.html) + + */ + +- (int64_t)lastInsertRowId; + +/** The number of rows changed by prior SQL statement. + + This function returns the number of database rows that were changed or inserted or deleted by the most recently completed SQL statement on the database connection specified by the first parameter. Only changes that are directly specified by the INSERT, UPDATE, or DELETE statement are counted. + + @return The number of rows changed by prior SQL statement. + + @see [sqlite3_changes()](http://sqlite.org/c3ref/changes.html) + + */ + +- (int)changes; + + +///------------------------- +/// @name Retrieving results +///------------------------- + +/** Execute select statement + + Executing queries returns an `` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `` and `` methods to determine why a query failed. + + In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other. + + This method employs [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) for any optional value parameters. This properly escapes any characters that need escape sequences (e.g. quotation marks), which eliminates simple SQL errors as well as protects against SQL injection attacks. This method natively handles `NSString`, `NSNumber`, `NSNull`, `NSDate`, and `NSData` objects. All other object types will be interpreted as text values using the object's `description` method. + + @param sql The SELECT statement to be performed, with optional `?` placeholders. + + @param ... Optional parameters to bind to `?` placeholders in the SQL statement. These should be Objective-C objects (e.g. `NSString`, `NSNumber`, etc.), not fundamental C data types (e.g. `int`, `char *`, etc.). + + @return A `` for the result set upon success; `nil` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see FMResultSet + @see [`FMResultSet next`](<[FMResultSet next]>) + @see [`sqlite3_bind`](http://sqlite.org/c3ref/bind_blob.html) + + @note If you want to use this from Swift, please note that you must include `FMDatabaseVariadic.swift` in your project. Without that, you cannot use this method directly, and instead have to use methods such as ``. + */ + +- (FMResultSet *)executeQuery:(NSString*)sql, ...; + +/** Execute select statement + + Executing queries returns an `` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `` and `` methods to determine why a query failed. + + In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other. + + @param format The SQL to be performed, with `printf`-style escape sequences. + + @param ... Optional parameters to bind to use in conjunction with the `printf`-style escape sequences in the SQL statement. + + @return A `` for the result set upon success; `nil` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see executeQuery: + @see FMResultSet + @see [`FMResultSet next`](<[FMResultSet next]>) + + @note This method does not technically perform a traditional printf-style replacement. What this method actually does is replace the printf-style percent sequences with a SQLite `?` placeholder, and then bind values to that placeholder. Thus the following command + + [db executeQueryWithFormat:@"SELECT * FROM test WHERE name=%@", @"Gus"]; + + is actually replacing the `%@` with `?` placeholder, and then performing something equivalent to `` + + [db executeQuery:@"SELECT * FROM test WHERE name=?", @"Gus"]; + + There are two reasons why this distinction is important. First, the printf-style escape sequences can only be used where it is permissible to use a SQLite `?` placeholder. You can use it only for values in SQL statements, but not for table names or column names or any other non-value context. This method also cannot be used in conjunction with `pragma` statements and the like. Second, note the lack of quotation marks in the SQL. The `WHERE` clause was _not_ `WHERE name='%@'` (like you might have to do if you built a SQL statement using `NSString` method `stringWithFormat`), but rather simply `WHERE name=%@`. + + */ + +- (FMResultSet *)executeQueryWithFormat:(NSString*)format, ... NS_FORMAT_FUNCTION(1,2); + +/** Execute select statement + + Executing queries returns an `` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `` and `` methods to determine why a query failed. + + In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other. + + @param sql The SELECT statement to be performed, with optional `?` placeholders. + + @param arguments A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement. + + @return A `` for the result set upon success; `nil` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see -executeQuery:values:error: + @see FMResultSet + @see [`FMResultSet next`](<[FMResultSet next]>) + */ + +- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments; + +/** Execute select statement + + Executing queries returns an `` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `` and `` methods to determine why a query failed. + + In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other. + + This is similar to ``, except that this also accepts a pointer to a `NSError` pointer, so that errors can be returned. + + In Swift 2, this throws errors, as if it were defined as follows: + + `func executeQuery(sql: String!, values: [AnyObject]!) throws -> FMResultSet!` + + @param sql The SELECT statement to be performed, with optional `?` placeholders. + + @param values A `NSArray` of objects to be used when binding values to the `?` placeholders in the SQL statement. + + @param error A `NSError` object to receive any error object (if any). + + @return A `` for the result set upon success; `nil` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see FMResultSet + @see [`FMResultSet next`](<[FMResultSet next]>) + + @note When called from Swift, only use the first two parameters, `sql` and `values`. This but throws the error. + + */ + +- (FMResultSet *)executeQuery:(NSString *)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error; + +/** Execute select statement + + Executing queries returns an `` object if successful, and `nil` upon failure. Like executing updates, there is a variant that accepts an `NSError **` parameter. Otherwise you should use the `` and `` methods to determine why a query failed. + + In order to iterate through the results of your query, you use a `while()` loop. You also need to "step" (via `<[FMResultSet next]>`) from one record to the other. + + @param sql The SELECT statement to be performed, with optional `?` placeholders. + + @param arguments A `NSDictionary` of objects keyed by column names that will be used when binding values to the `?` placeholders in the SQL statement. + + @return A `` for the result set upon success; `nil` upon failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see FMResultSet + @see [`FMResultSet next`](<[FMResultSet next]>) + */ + +- (FMResultSet *)executeQuery:(NSString *)sql withParameterDictionary:(NSDictionary *)arguments; + + +// Documentation forthcoming. +- (FMResultSet *)executeQuery:(NSString*)sql withVAList: (va_list)args; + +///------------------- +/// @name Transactions +///------------------- + +/** Begin a transaction + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see commit + @see rollback + @see beginDeferredTransaction + @see inTransaction + */ + +- (BOOL)beginTransaction; + +/** Begin a deferred transaction + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see commit + @see rollback + @see beginTransaction + @see inTransaction + */ + +- (BOOL)beginDeferredTransaction; + +/** Commit a transaction + + Commit a transaction that was initiated with either `` or with ``. + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see beginTransaction + @see beginDeferredTransaction + @see rollback + @see inTransaction + */ + +- (BOOL)commit; + +/** Rollback a transaction + + Rollback a transaction that was initiated with either `` or with ``. + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see beginTransaction + @see beginDeferredTransaction + @see commit + @see inTransaction + */ + +- (BOOL)rollback; + +/** Identify whether currently in a transaction or not + + @return `YES` if currently within transaction; `NO` if not. + + @see beginTransaction + @see beginDeferredTransaction + @see commit + @see rollback + */ + +- (BOOL)inTransaction; + + +///---------------------------------------- +/// @name Cached statements and result sets +///---------------------------------------- + +/** Clear cached statements */ + +- (void)clearCachedStatements; + +/** Close all open result sets */ + +- (void)closeOpenResultSets; + +/** Whether database has any open result sets + + @return `YES` if there are open result sets; `NO` if not. + */ + +- (BOOL)hasOpenResultSets; + +/** Return whether should cache statements or not + + @return `YES` if should cache statements; `NO` if not. + */ + +- (BOOL)shouldCacheStatements; + +/** Set whether should cache statements or not + + @param value `YES` if should cache statements; `NO` if not. + */ + +- (void)setShouldCacheStatements:(BOOL)value; + + +///------------------------- +/// @name Encryption methods +///------------------------- + +/** Set encryption key. + + @param key The key to be used. + + @return `YES` if success, `NO` on error. + + @see https://www.zetetic.net/sqlcipher/ + + @warning You need to have purchased the sqlite encryption extensions for this method to work. + */ + +- (BOOL)setKey:(NSString*)key; + +/** Reset encryption key + + @param key The key to be used. + + @return `YES` if success, `NO` on error. + + @see https://www.zetetic.net/sqlcipher/ + + @warning You need to have purchased the sqlite encryption extensions for this method to work. + */ + +- (BOOL)rekey:(NSString*)key; + +/** Set encryption key using `keyData`. + + @param keyData The `NSData` to be used. + + @return `YES` if success, `NO` on error. + + @see https://www.zetetic.net/sqlcipher/ + + @warning You need to have purchased the sqlite encryption extensions for this method to work. + */ + +- (BOOL)setKeyWithData:(NSData *)keyData; + +/** Reset encryption key using `keyData`. + + @param keyData The `NSData` to be used. + + @return `YES` if success, `NO` on error. + + @see https://www.zetetic.net/sqlcipher/ + + @warning You need to have purchased the sqlite encryption extensions for this method to work. + */ + +- (BOOL)rekeyWithData:(NSData *)keyData; + + +///------------------------------ +/// @name General inquiry methods +///------------------------------ + +/** The path of the database file + + @return path of database. + + */ + +- (NSString *)databasePath; + +/** The underlying SQLite handle + + @return The `sqlite3` pointer. + + */ + +- (void*)sqliteHandle; + + +///----------------------------- +/// @name Retrieving error codes +///----------------------------- + +/** Last error message + + Returns the English-language text that describes the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined. + + @return `NSString` of the last error message. + + @see [sqlite3_errmsg()](http://sqlite.org/c3ref/errcode.html) + @see lastErrorCode + @see lastError + + */ + +- (NSString*)lastErrorMessage; + +/** Last error code + + Returns the numeric result code or extended result code for the most recent failed SQLite API call associated with a database connection. If a prior API call failed but the most recent API call succeeded, this return value is undefined. + + @return Integer value of the last error code. + + @see [sqlite3_errcode()](http://sqlite.org/c3ref/errcode.html) + @see lastErrorMessage + @see lastError + + */ + +- (int)lastErrorCode; + +/** Had error + + @return `YES` if there was an error, `NO` if no error. + + @see lastError + @see lastErrorCode + @see lastErrorMessage + + */ + +- (BOOL)hadError; + +/** Last error + + @return `NSError` representing the last error. + + @see lastErrorCode + @see lastErrorMessage + + */ + +- (NSError*)lastError; + + +// description forthcoming +- (void)setMaxBusyRetryTimeInterval:(NSTimeInterval)timeoutInSeconds; +- (NSTimeInterval)maxBusyRetryTimeInterval; + + +///------------------ +/// @name Save points +///------------------ + +/** Start save point + + @param name Name of save point. + + @param outErr A `NSError` object to receive any error object (if any). + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see releaseSavePointWithName:error: + @see rollbackToSavePointWithName:error: + */ + +- (BOOL)startSavePointWithName:(NSString*)name error:(NSError**)outErr; + +/** Release save point + + @param name Name of save point. + + @param outErr A `NSError` object to receive any error object (if any). + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see startSavePointWithName:error: + @see rollbackToSavePointWithName:error: + + */ + +- (BOOL)releaseSavePointWithName:(NSString*)name error:(NSError**)outErr; + +/** Roll back to save point + + @param name Name of save point. + @param outErr A `NSError` object to receive any error object (if any). + + @return `YES` on success; `NO` on failure. If failed, you can call ``, ``, or `` for diagnostic information regarding the failure. + + @see startSavePointWithName:error: + @see releaseSavePointWithName:error: + + */ + +- (BOOL)rollbackToSavePointWithName:(NSString*)name error:(NSError**)outErr; + +/** Start save point + + @param block Block of code to perform from within save point. + + @return The NSError corresponding to the error, if any. If no error, returns `nil`. + + @see startSavePointWithName:error: + @see releaseSavePointWithName:error: + @see rollbackToSavePointWithName:error: + + */ + +- (NSError*)inSavePoint:(void (^)(BOOL *rollback))block; + +///---------------------------- +/// @name SQLite library status +///---------------------------- + +/** Test to see if the library is threadsafe + + @return `NO` if and only if SQLite was compiled with mutexing code omitted due to the SQLITE_THREADSAFE compile-time option being set to 0. + + @see [sqlite3_threadsafe()](http://sqlite.org/c3ref/threadsafe.html) + */ + ++ (BOOL)isSQLiteThreadSafe; + +/** Run-time library version numbers + + @return The sqlite library version string. + + @see [sqlite3_libversion()](http://sqlite.org/c3ref/libversion.html) + */ + ++ (NSString*)sqliteLibVersion; + + ++ (NSString*)FMDBUserVersion; + ++ (SInt32)FMDBVersion; + + +///------------------------ +/// @name Make SQL function +///------------------------ + +/** Adds SQL functions or aggregates or to redefine the behavior of existing SQL functions or aggregates. + + For example: + + [queue inDatabase:^(FMDatabase *adb) { + + [adb executeUpdate:@"create table ftest (foo text)"]; + [adb executeUpdate:@"insert into ftest values ('hello')"]; + [adb executeUpdate:@"insert into ftest values ('hi')"]; + [adb executeUpdate:@"insert into ftest values ('not h!')"]; + [adb executeUpdate:@"insert into ftest values ('definitely not h!')"]; + + [adb makeFunctionNamed:@"StringStartsWithH" maximumArguments:1 withBlock:^(sqlite3_context *context, int aargc, sqlite3_value **aargv) { + if (sqlite3_value_type(aargv[0]) == SQLITE_TEXT) { + @autoreleasepool { + const char *c = (const char *)sqlite3_value_text(aargv[0]); + NSString *s = [NSString stringWithUTF8String:c]; + sqlite3_result_int(context, [s hasPrefix:@"h"]); + } + } + else { + NSLog(@"Unknown formart for StringStartsWithH (%d) %s:%d", sqlite3_value_type(aargv[0]), __FUNCTION__, __LINE__); + sqlite3_result_null(context); + } + }]; + + int rowCount = 0; + FMResultSet *ars = [adb executeQuery:@"select * from ftest where StringStartsWithH(foo)"]; + while ([ars next]) { + rowCount++; + NSLog(@"Does %@ start with 'h'?", [rs stringForColumnIndex:0]); + } + FMDBQuickCheck(rowCount == 2); + }]; + + @param name Name of function + + @param count Maximum number of parameters + + @param block The block of code for the function + + @see [sqlite3_create_function()](http://sqlite.org/c3ref/create_function.html) + */ + +- (void)makeFunctionNamed:(NSString*)name maximumArguments:(int)count withBlock:(void (^)(void *context, int argc, void **argv))block; + + +///--------------------- +/// @name Date formatter +///--------------------- + +/** Generate an `NSDateFormatter` that won't be broken by permutations of timezones or locales. + + Use this method to generate values to set the dateFormat property. + + Example: + + myDB.dateFormat = [FMDatabase storeableDateFormat:@"yyyy-MM-dd HH:mm:ss"]; + + @param format A valid NSDateFormatter format string. + + @return A `NSDateFormatter` that can be used for converting dates to strings and vice versa. + + @see hasDateFormatter + @see setDateFormat: + @see dateFromString: + @see stringFromDate: + @see storeableDateFormat: + + @warning Note that `NSDateFormatter` is not thread-safe, so the formatter generated by this method should be assigned to only one FMDB instance and should not be used for other purposes. + + */ + ++ (NSDateFormatter *)storeableDateFormat:(NSString *)format; + +/** Test whether the database has a date formatter assigned. + + @return `YES` if there is a date formatter; `NO` if not. + + @see hasDateFormatter + @see setDateFormat: + @see dateFromString: + @see stringFromDate: + @see storeableDateFormat: + */ + +- (BOOL)hasDateFormatter; + +/** Set to a date formatter to use string dates with sqlite instead of the default UNIX timestamps. + + @param format Set to nil to use UNIX timestamps. Defaults to nil. Should be set using a formatter generated using FMDatabase::storeableDateFormat. + + @see hasDateFormatter + @see setDateFormat: + @see dateFromString: + @see stringFromDate: + @see storeableDateFormat: + + @warning Note there is no direct getter for the `NSDateFormatter`, and you should not use the formatter you pass to FMDB for other purposes, as `NSDateFormatter` is not thread-safe. + */ + +- (void)setDateFormat:(NSDateFormatter *)format; + +/** Convert the supplied NSString to NSDate, using the current database formatter. + + @param s `NSString` to convert to `NSDate`. + + @return The `NSDate` object; or `nil` if no formatter is set. + + @see hasDateFormatter + @see setDateFormat: + @see dateFromString: + @see stringFromDate: + @see storeableDateFormat: + */ + +- (NSDate *)dateFromString:(NSString *)s; + +/** Convert the supplied NSDate to NSString, using the current database formatter. + + @param date `NSDate` of date to convert to `NSString`. + + @return The `NSString` representation of the date; `nil` if no formatter is set. + + @see hasDateFormatter + @see setDateFormat: + @see dateFromString: + @see stringFromDate: + @see storeableDateFormat: + */ + +- (NSString *)stringFromDate:(NSDate *)date; + +@end + + +/** Objective-C wrapper for `sqlite3_stmt` + + This is a wrapper for a SQLite `sqlite3_stmt`. Generally when using FMDB you will not need to interact directly with `FMStatement`, but rather with `` and `` only. + + ### See also + + - `` + - `` + - [`sqlite3_stmt`](http://www.sqlite.org/c3ref/stmt.html) + */ + +@interface FMStatement : NSObject { + void *_statement; + NSString *_query; + long _useCount; + BOOL _inUse; +} + +///----------------- +/// @name Properties +///----------------- + +/** Usage count */ + +@property (atomic, assign) long useCount; + +/** SQL statement */ + +@property (atomic, retain) NSString *query; + +/** SQLite sqlite3_stmt + + @see [`sqlite3_stmt`](http://www.sqlite.org/c3ref/stmt.html) + */ + +@property (atomic, assign) void *statement; + +/** Indication of whether the statement is in use */ + +@property (atomic, assign) BOOL inUse; + +///---------------------------- +/// @name Closing and Resetting +///---------------------------- + +/** Close statement */ + +- (void)close; + +/** Reset statement */ + +- (void)reset; + +@end + +#pragma clang diagnostic pop + diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabase.m b/ios/Pods/FMDB/src/fmdb/FMDatabase.m new file mode 100644 index 0000000..d33c13d --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabase.m @@ -0,0 +1,1479 @@ +#import "FMDatabase.h" +#import "unistd.h" +#import + +#if FMDB_SQLITE_STANDALONE +#import +#else +#import +#endif + +@interface FMDatabase () + +- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args; +- (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args; + +@end + +@implementation FMDatabase +@synthesize cachedStatements=_cachedStatements; +@synthesize logsErrors=_logsErrors; +@synthesize crashOnErrors=_crashOnErrors; +@synthesize checkedOut=_checkedOut; +@synthesize traceExecution=_traceExecution; + +#pragma mark FMDatabase instantiation and deallocation + ++ (instancetype)databaseWithPath:(NSString*)aPath { + return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath]); +} + +- (instancetype)init { + return [self initWithPath:nil]; +} + +- (instancetype)initWithPath:(NSString*)aPath { + + assert(sqlite3_threadsafe()); // whoa there big boy- gotta make sure sqlite it happy with what we're going to do. + + self = [super init]; + + if (self) { + _databasePath = [aPath copy]; + _openResultSets = [[NSMutableSet alloc] init]; + _db = nil; + _logsErrors = YES; + _crashOnErrors = NO; + _maxBusyRetryTimeInterval = 2; + } + + return self; +} + +- (void)finalize { + [self close]; + [super finalize]; +} + +- (void)dealloc { + [self close]; + FMDBRelease(_openResultSets); + FMDBRelease(_cachedStatements); + FMDBRelease(_dateFormat); + FMDBRelease(_databasePath); + FMDBRelease(_openFunctions); + +#if ! __has_feature(objc_arc) + [super dealloc]; +#endif +} + +- (NSString *)databasePath { + return _databasePath; +} + ++ (NSString*)FMDBUserVersion { + return @"2.6.2"; +} + +// returns 0x0240 for version 2.4. This makes it super easy to do things like: +// /* need to make sure to do X with FMDB version 2.4 or later */ +// if ([FMDatabase FMDBVersion] >= 0x0240) { … } + ++ (SInt32)FMDBVersion { + + // we go through these hoops so that we only have to change the version number in a single spot. + static dispatch_once_t once; + static SInt32 FMDBVersionVal = 0; + + dispatch_once(&once, ^{ + NSString *prodVersion = [self FMDBUserVersion]; + + if ([[prodVersion componentsSeparatedByString:@"."] count] < 3) { + prodVersion = [prodVersion stringByAppendingString:@".0"]; + } + + NSString *junk = [prodVersion stringByReplacingOccurrencesOfString:@"." withString:@""]; + + char *e = nil; + FMDBVersionVal = (int) strtoul([junk UTF8String], &e, 16); + + }); + + return FMDBVersionVal; +} + +#pragma mark SQLite information + ++ (NSString*)sqliteLibVersion { + return [NSString stringWithFormat:@"%s", sqlite3_libversion()]; +} + ++ (BOOL)isSQLiteThreadSafe { + // make sure to read the sqlite headers on this guy! + return sqlite3_threadsafe() != 0; +} + +- (void*)sqliteHandle { + return _db; +} + +- (const char*)sqlitePath { + + if (!_databasePath) { + return ":memory:"; + } + + if ([_databasePath length] == 0) { + return ""; // this creates a temporary database (it's an sqlite thing). + } + + return [_databasePath fileSystemRepresentation]; + +} + +#pragma mark Open and close database + +- (BOOL)open { + if (_db) { + return YES; + } + + int err = sqlite3_open([self sqlitePath], (sqlite3**)&_db ); + if(err != SQLITE_OK) { + NSLog(@"error opening!: %d", err); + return NO; + } + + if (_maxBusyRetryTimeInterval > 0.0) { + // set the handler + [self setMaxBusyRetryTimeInterval:_maxBusyRetryTimeInterval]; + } + + + return YES; +} + +- (BOOL)openWithFlags:(int)flags { + return [self openWithFlags:flags vfs:nil]; +} +- (BOOL)openWithFlags:(int)flags vfs:(NSString *)vfsName { +#if SQLITE_VERSION_NUMBER >= 3005000 + if (_db) { + return YES; + } + + int err = sqlite3_open_v2([self sqlitePath], (sqlite3**)&_db, flags, [vfsName UTF8String]); + if(err != SQLITE_OK) { + NSLog(@"error opening!: %d", err); + return NO; + } + + if (_maxBusyRetryTimeInterval > 0.0) { + // set the handler + [self setMaxBusyRetryTimeInterval:_maxBusyRetryTimeInterval]; + } + + return YES; +#else + NSLog(@"openWithFlags requires SQLite 3.5"); + return NO; +#endif +} + + +- (BOOL)close { + + [self clearCachedStatements]; + [self closeOpenResultSets]; + + if (!_db) { + return YES; + } + + int rc; + BOOL retry; + BOOL triedFinalizingOpenStatements = NO; + + do { + retry = NO; + rc = sqlite3_close(_db); + if (SQLITE_BUSY == rc || SQLITE_LOCKED == rc) { + if (!triedFinalizingOpenStatements) { + triedFinalizingOpenStatements = YES; + sqlite3_stmt *pStmt; + while ((pStmt = sqlite3_next_stmt(_db, nil)) !=0) { + NSLog(@"Closing leaked statement"); + sqlite3_finalize(pStmt); + retry = YES; + } + } + } + else if (SQLITE_OK != rc) { + NSLog(@"error closing!: %d", rc); + } + } + while (retry); + + _db = nil; + return YES; +} + +#pragma mark Busy handler routines + +// NOTE: appledoc seems to choke on this function for some reason; +// so when generating documentation, you might want to ignore the +// .m files so that it only documents the public interfaces outlined +// in the .h files. +// +// This is a known appledoc bug that it has problems with C functions +// within a class implementation, but for some reason, only this +// C function causes problems; the rest don't. Anyway, ignoring the .m +// files with appledoc will prevent this problem from occurring. + +static int FMDBDatabaseBusyHandler(void *f, int count) { + FMDatabase *self = (__bridge FMDatabase*)f; + + if (count == 0) { + self->_startBusyRetryTime = [NSDate timeIntervalSinceReferenceDate]; + return 1; + } + + NSTimeInterval delta = [NSDate timeIntervalSinceReferenceDate] - (self->_startBusyRetryTime); + + if (delta < [self maxBusyRetryTimeInterval]) { + int requestedSleepInMillseconds = (int) arc4random_uniform(50) + 50; + int actualSleepInMilliseconds = sqlite3_sleep(requestedSleepInMillseconds); + if (actualSleepInMilliseconds != requestedSleepInMillseconds) { + NSLog(@"WARNING: Requested sleep of %i milliseconds, but SQLite returned %i. Maybe SQLite wasn't built with HAVE_USLEEP=1?", requestedSleepInMillseconds, actualSleepInMilliseconds); + } + return 1; + } + + return 0; +} + +- (void)setMaxBusyRetryTimeInterval:(NSTimeInterval)timeout { + + _maxBusyRetryTimeInterval = timeout; + + if (!_db) { + return; + } + + if (timeout > 0) { + sqlite3_busy_handler(_db, &FMDBDatabaseBusyHandler, (__bridge void *)(self)); + } + else { + // turn it off otherwise + sqlite3_busy_handler(_db, nil, nil); + } +} + +- (NSTimeInterval)maxBusyRetryTimeInterval { + return _maxBusyRetryTimeInterval; +} + + +// we no longer make busyRetryTimeout public +// but for folks who don't bother noticing that the interface to FMDatabase changed, +// we'll still implement the method so they don't get suprise crashes +- (int)busyRetryTimeout { + NSLog(@"%s:%d", __FUNCTION__, __LINE__); + NSLog(@"FMDB: busyRetryTimeout no longer works, please use maxBusyRetryTimeInterval"); + return -1; +} + +- (void)setBusyRetryTimeout:(int)i { +#pragma unused(i) + NSLog(@"%s:%d", __FUNCTION__, __LINE__); + NSLog(@"FMDB: setBusyRetryTimeout does nothing, please use setMaxBusyRetryTimeInterval:"); +} + +#pragma mark Result set functions + +- (BOOL)hasOpenResultSets { + return [_openResultSets count] > 0; +} + +- (void)closeOpenResultSets { + + //Copy the set so we don't get mutation errors + NSSet *openSetCopy = FMDBReturnAutoreleased([_openResultSets copy]); + for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) { + FMResultSet *rs = (FMResultSet *)[rsInWrappedInATastyValueMeal pointerValue]; + + [rs setParentDB:nil]; + [rs close]; + + [_openResultSets removeObject:rsInWrappedInATastyValueMeal]; + } +} + +- (void)resultSetDidClose:(FMResultSet *)resultSet { + NSValue *setValue = [NSValue valueWithNonretainedObject:resultSet]; + + [_openResultSets removeObject:setValue]; +} + +#pragma mark Cached statements + +- (void)clearCachedStatements { + + for (NSMutableSet *statements in [_cachedStatements objectEnumerator]) { + [statements makeObjectsPerformSelector:@selector(close)]; + } + + [_cachedStatements removeAllObjects]; +} + +- (FMStatement*)cachedStatementForQuery:(NSString*)query { + + NSMutableSet* statements = [_cachedStatements objectForKey:query]; + + return [[statements objectsPassingTest:^BOOL(FMStatement* statement, BOOL *stop) { + + *stop = ![statement inUse]; + return *stop; + + }] anyObject]; +} + + +- (void)setCachedStatement:(FMStatement*)statement forQuery:(NSString*)query { + + query = [query copy]; // in case we got handed in a mutable string... + [statement setQuery:query]; + + NSMutableSet* statements = [_cachedStatements objectForKey:query]; + if (!statements) { + statements = [NSMutableSet set]; + } + + [statements addObject:statement]; + + [_cachedStatements setObject:statements forKey:query]; + + FMDBRelease(query); +} + +#pragma mark Key routines + +- (BOOL)rekey:(NSString*)key { + NSData *keyData = [NSData dataWithBytes:(void *)[key UTF8String] length:(NSUInteger)strlen([key UTF8String])]; + + return [self rekeyWithData:keyData]; +} + +- (BOOL)rekeyWithData:(NSData *)keyData { +#ifdef SQLITE_HAS_CODEC + if (!keyData) { + return NO; + } + + int rc = sqlite3_rekey(_db, [keyData bytes], (int)[keyData length]); + + if (rc != SQLITE_OK) { + NSLog(@"error on rekey: %d", rc); + NSLog(@"%@", [self lastErrorMessage]); + } + + return (rc == SQLITE_OK); +#else +#pragma unused(keyData) + return NO; +#endif +} + +- (BOOL)setKey:(NSString*)key { + NSData *keyData = [NSData dataWithBytes:[key UTF8String] length:(NSUInteger)strlen([key UTF8String])]; + + return [self setKeyWithData:keyData]; +} + +- (BOOL)setKeyWithData:(NSData *)keyData { +#ifdef SQLITE_HAS_CODEC + if (!keyData) { + return NO; + } + + int rc = sqlite3_key(_db, [keyData bytes], (int)[keyData length]); + + return (rc == SQLITE_OK); +#else +#pragma unused(keyData) + return NO; +#endif +} + +#pragma mark Date routines + ++ (NSDateFormatter *)storeableDateFormat:(NSString *)format { + + NSDateFormatter *result = FMDBReturnAutoreleased([[NSDateFormatter alloc] init]); + result.dateFormat = format; + result.timeZone = [NSTimeZone timeZoneForSecondsFromGMT:0]; + result.locale = FMDBReturnAutoreleased([[NSLocale alloc] initWithLocaleIdentifier:@"en_US"]); + return result; +} + + +- (BOOL)hasDateFormatter { + return _dateFormat != nil; +} + +- (void)setDateFormat:(NSDateFormatter *)format { + FMDBAutorelease(_dateFormat); + _dateFormat = FMDBReturnRetained(format); +} + +- (NSDate *)dateFromString:(NSString *)s { + return [_dateFormat dateFromString:s]; +} + +- (NSString *)stringFromDate:(NSDate *)date { + return [_dateFormat stringFromDate:date]; +} + +#pragma mark State of database + +- (BOOL)goodConnection { + + if (!_db) { + return NO; + } + + FMResultSet *rs = [self executeQuery:@"select name from sqlite_master where type='table'"]; + + if (rs) { + [rs close]; + return YES; + } + + return NO; +} + +- (void)warnInUse { + NSLog(@"The FMDatabase %@ is currently in use.", self); + +#ifndef NS_BLOCK_ASSERTIONS + if (_crashOnErrors) { + NSAssert(false, @"The FMDatabase %@ is currently in use.", self); + abort(); + } +#endif +} + +- (BOOL)databaseExists { + + if (!_db) { + + NSLog(@"The FMDatabase %@ is not open.", self); + +#ifndef NS_BLOCK_ASSERTIONS + if (_crashOnErrors) { + NSAssert(false, @"The FMDatabase %@ is not open.", self); + abort(); + } +#endif + + return NO; + } + + return YES; +} + +#pragma mark Error routines + +- (NSString*)lastErrorMessage { + return [NSString stringWithUTF8String:sqlite3_errmsg(_db)]; +} + +- (BOOL)hadError { + int lastErrCode = [self lastErrorCode]; + + return (lastErrCode > SQLITE_OK && lastErrCode < SQLITE_ROW); +} + +- (int)lastErrorCode { + return sqlite3_errcode(_db); +} + +- (NSError*)errorWithMessage:(NSString*)message { + NSDictionary* errorMessage = [NSDictionary dictionaryWithObject:message forKey:NSLocalizedDescriptionKey]; + + return [NSError errorWithDomain:@"FMDatabase" code:sqlite3_errcode(_db) userInfo:errorMessage]; +} + +- (NSError*)lastError { + return [self errorWithMessage:[self lastErrorMessage]]; +} + +#pragma mark Update information routines + +- (sqlite_int64)lastInsertRowId { + + if (_isExecutingStatement) { + [self warnInUse]; + return NO; + } + + _isExecutingStatement = YES; + + sqlite_int64 ret = sqlite3_last_insert_rowid(_db); + + _isExecutingStatement = NO; + + return ret; +} + +- (int)changes { + if (_isExecutingStatement) { + [self warnInUse]; + return 0; + } + + _isExecutingStatement = YES; + + int ret = sqlite3_changes(_db); + + _isExecutingStatement = NO; + + return ret; +} + +#pragma mark SQL manipulation + +- (void)bindObject:(id)obj toColumn:(int)idx inStatement:(sqlite3_stmt*)pStmt { + + if ((!obj) || ((NSNull *)obj == [NSNull null])) { + sqlite3_bind_null(pStmt, idx); + } + + // FIXME - someday check the return codes on these binds. + else if ([obj isKindOfClass:[NSData class]]) { + const void *bytes = [obj bytes]; + if (!bytes) { + // it's an empty NSData object, aka [NSData data]. + // Don't pass a NULL pointer, or sqlite will bind a SQL null instead of a blob. + bytes = ""; + } + sqlite3_bind_blob(pStmt, idx, bytes, (int)[obj length], SQLITE_STATIC); + } + else if ([obj isKindOfClass:[NSDate class]]) { + if (self.hasDateFormatter) + sqlite3_bind_text(pStmt, idx, [[self stringFromDate:obj] UTF8String], -1, SQLITE_STATIC); + else + sqlite3_bind_double(pStmt, idx, [obj timeIntervalSince1970]); + } + else if ([obj isKindOfClass:[NSNumber class]]) { + + if (strcmp([obj objCType], @encode(char)) == 0) { + sqlite3_bind_int(pStmt, idx, [obj charValue]); + } + else if (strcmp([obj objCType], @encode(unsigned char)) == 0) { + sqlite3_bind_int(pStmt, idx, [obj unsignedCharValue]); + } + else if (strcmp([obj objCType], @encode(short)) == 0) { + sqlite3_bind_int(pStmt, idx, [obj shortValue]); + } + else if (strcmp([obj objCType], @encode(unsigned short)) == 0) { + sqlite3_bind_int(pStmt, idx, [obj unsignedShortValue]); + } + else if (strcmp([obj objCType], @encode(int)) == 0) { + sqlite3_bind_int(pStmt, idx, [obj intValue]); + } + else if (strcmp([obj objCType], @encode(unsigned int)) == 0) { + sqlite3_bind_int64(pStmt, idx, (long long)[obj unsignedIntValue]); + } + else if (strcmp([obj objCType], @encode(long)) == 0) { + sqlite3_bind_int64(pStmt, idx, [obj longValue]); + } + else if (strcmp([obj objCType], @encode(unsigned long)) == 0) { + sqlite3_bind_int64(pStmt, idx, (long long)[obj unsignedLongValue]); + } + else if (strcmp([obj objCType], @encode(long long)) == 0) { + sqlite3_bind_int64(pStmt, idx, [obj longLongValue]); + } + else if (strcmp([obj objCType], @encode(unsigned long long)) == 0) { + sqlite3_bind_int64(pStmt, idx, (long long)[obj unsignedLongLongValue]); + } + else if (strcmp([obj objCType], @encode(float)) == 0) { + sqlite3_bind_double(pStmt, idx, [obj floatValue]); + } + else if (strcmp([obj objCType], @encode(double)) == 0) { + sqlite3_bind_double(pStmt, idx, [obj doubleValue]); + } + else if (strcmp([obj objCType], @encode(BOOL)) == 0) { + sqlite3_bind_int(pStmt, idx, ([obj boolValue] ? 1 : 0)); + } + else { + sqlite3_bind_text(pStmt, idx, [[obj description] UTF8String], -1, SQLITE_STATIC); + } + } + else { + sqlite3_bind_text(pStmt, idx, [[obj description] UTF8String], -1, SQLITE_STATIC); + } +} + +- (void)extractSQL:(NSString *)sql argumentsList:(va_list)args intoString:(NSMutableString *)cleanedSQL arguments:(NSMutableArray *)arguments { + + NSUInteger length = [sql length]; + unichar last = '\0'; + for (NSUInteger i = 0; i < length; ++i) { + id arg = nil; + unichar current = [sql characterAtIndex:i]; + unichar add = current; + if (last == '%') { + switch (current) { + case '@': + arg = va_arg(args, id); + break; + case 'c': + // warning: second argument to 'va_arg' is of promotable type 'char'; this va_arg has undefined behavior because arguments will be promoted to 'int' + arg = [NSString stringWithFormat:@"%c", va_arg(args, int)]; + break; + case 's': + arg = [NSString stringWithUTF8String:va_arg(args, char*)]; + break; + case 'd': + case 'D': + case 'i': + arg = [NSNumber numberWithInt:va_arg(args, int)]; + break; + case 'u': + case 'U': + arg = [NSNumber numberWithUnsignedInt:va_arg(args, unsigned int)]; + break; + case 'h': + i++; + if (i < length && [sql characterAtIndex:i] == 'i') { + // warning: second argument to 'va_arg' is of promotable type 'short'; this va_arg has undefined behavior because arguments will be promoted to 'int' + arg = [NSNumber numberWithShort:(short)(va_arg(args, int))]; + } + else if (i < length && [sql characterAtIndex:i] == 'u') { + // warning: second argument to 'va_arg' is of promotable type 'unsigned short'; this va_arg has undefined behavior because arguments will be promoted to 'int' + arg = [NSNumber numberWithUnsignedShort:(unsigned short)(va_arg(args, uint))]; + } + else { + i--; + } + break; + case 'q': + i++; + if (i < length && [sql characterAtIndex:i] == 'i') { + arg = [NSNumber numberWithLongLong:va_arg(args, long long)]; + } + else if (i < length && [sql characterAtIndex:i] == 'u') { + arg = [NSNumber numberWithUnsignedLongLong:va_arg(args, unsigned long long)]; + } + else { + i--; + } + break; + case 'f': + arg = [NSNumber numberWithDouble:va_arg(args, double)]; + break; + case 'g': + // warning: second argument to 'va_arg' is of promotable type 'float'; this va_arg has undefined behavior because arguments will be promoted to 'double' + arg = [NSNumber numberWithFloat:(float)(va_arg(args, double))]; + break; + case 'l': + i++; + if (i < length) { + unichar next = [sql characterAtIndex:i]; + if (next == 'l') { + i++; + if (i < length && [sql characterAtIndex:i] == 'd') { + //%lld + arg = [NSNumber numberWithLongLong:va_arg(args, long long)]; + } + else if (i < length && [sql characterAtIndex:i] == 'u') { + //%llu + arg = [NSNumber numberWithUnsignedLongLong:va_arg(args, unsigned long long)]; + } + else { + i--; + } + } + else if (next == 'd') { + //%ld + arg = [NSNumber numberWithLong:va_arg(args, long)]; + } + else if (next == 'u') { + //%lu + arg = [NSNumber numberWithUnsignedLong:va_arg(args, unsigned long)]; + } + else { + i--; + } + } + else { + i--; + } + break; + default: + // something else that we can't interpret. just pass it on through like normal + break; + } + } + else if (current == '%') { + // percent sign; skip this character + add = '\0'; + } + + if (arg != nil) { + [cleanedSQL appendString:@"?"]; + [arguments addObject:arg]; + } + else if (add == (unichar)'@' && last == (unichar) '%') { + [cleanedSQL appendFormat:@"NULL"]; + } + else if (add != '\0') { + [cleanedSQL appendFormat:@"%C", add]; + } + last = current; + } +} + +#pragma mark Execute queries + +- (FMResultSet *)executeQuery:(NSString *)sql withParameterDictionary:(NSDictionary *)arguments { + return [self executeQuery:sql withArgumentsInArray:nil orDictionary:arguments orVAList:nil]; +} + +- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args { + + if (![self databaseExists]) { + return 0x00; + } + + if (_isExecutingStatement) { + [self warnInUse]; + return 0x00; + } + + _isExecutingStatement = YES; + + int rc = 0x00; + sqlite3_stmt *pStmt = 0x00; + FMStatement *statement = 0x00; + FMResultSet *rs = 0x00; + + if (_traceExecution && sql) { + NSLog(@"%@ executeQuery: %@", self, sql); + } + + if (_shouldCacheStatements) { + statement = [self cachedStatementForQuery:sql]; + pStmt = statement ? [statement statement] : 0x00; + [statement reset]; + } + + if (!pStmt) { + + rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0); + + if (SQLITE_OK != rc) { + if (_logsErrors) { + NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); + NSLog(@"DB Query: %@", sql); + NSLog(@"DB Path: %@", _databasePath); + } + + if (_crashOnErrors) { + NSAssert(false, @"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); + abort(); + } + + sqlite3_finalize(pStmt); + _isExecutingStatement = NO; + return nil; + } + } + + id obj; + int idx = 0; + int queryCount = sqlite3_bind_parameter_count(pStmt); // pointed out by Dominic Yu (thanks!) + + // If dictionaryArgs is passed in, that means we are using sqlite's named parameter support + if (dictionaryArgs) { + + for (NSString *dictionaryKey in [dictionaryArgs allKeys]) { + + // Prefix the key with a colon. + NSString *parameterName = [[NSString alloc] initWithFormat:@":%@", dictionaryKey]; + + if (_traceExecution) { + NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]); + } + + // Get the index for the parameter name. + int namedIdx = sqlite3_bind_parameter_index(pStmt, [parameterName UTF8String]); + + FMDBRelease(parameterName); + + if (namedIdx > 0) { + // Standard binding from here. + [self bindObject:[dictionaryArgs objectForKey:dictionaryKey] toColumn:namedIdx inStatement:pStmt]; + // increment the binding count, so our check below works out + idx++; + } + else { + NSLog(@"Could not find index for %@", dictionaryKey); + } + } + } + else { + + while (idx < queryCount) { + + if (arrayArgs && idx < (int)[arrayArgs count]) { + obj = [arrayArgs objectAtIndex:(NSUInteger)idx]; + } + else if (args) { + obj = va_arg(args, id); + } + else { + //We ran out of arguments + break; + } + + if (_traceExecution) { + if ([obj isKindOfClass:[NSData class]]) { + NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]); + } + else { + NSLog(@"obj: %@", obj); + } + } + + idx++; + + [self bindObject:obj toColumn:idx inStatement:pStmt]; + } + } + + if (idx != queryCount) { + NSLog(@"Error: the bind count is not correct for the # of variables (executeQuery)"); + sqlite3_finalize(pStmt); + _isExecutingStatement = NO; + return nil; + } + + FMDBRetain(statement); // to balance the release below + + if (!statement) { + statement = [[FMStatement alloc] init]; + [statement setStatement:pStmt]; + + if (_shouldCacheStatements && sql) { + [self setCachedStatement:statement forQuery:sql]; + } + } + + // the statement gets closed in rs's dealloc or [rs close]; + rs = [FMResultSet resultSetWithStatement:statement usingParentDatabase:self]; + [rs setQuery:sql]; + + NSValue *openResultSet = [NSValue valueWithNonretainedObject:rs]; + [_openResultSets addObject:openResultSet]; + + [statement setUseCount:[statement useCount] + 1]; + + FMDBRelease(statement); + + _isExecutingStatement = NO; + + return rs; +} + +- (FMResultSet *)executeQuery:(NSString*)sql, ... { + va_list args; + va_start(args, sql); + + id result = [self executeQuery:sql withArgumentsInArray:nil orDictionary:nil orVAList:args]; + + va_end(args); + return result; +} + +- (FMResultSet *)executeQueryWithFormat:(NSString*)format, ... { + va_list args; + va_start(args, format); + + NSMutableString *sql = [NSMutableString stringWithCapacity:[format length]]; + NSMutableArray *arguments = [NSMutableArray array]; + [self extractSQL:format argumentsList:args intoString:sql arguments:arguments]; + + va_end(args); + + return [self executeQuery:sql withArgumentsInArray:arguments]; +} + +- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray *)arguments { + return [self executeQuery:sql withArgumentsInArray:arguments orDictionary:nil orVAList:nil]; +} + +- (FMResultSet *)executeQuery:(NSString *)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error { + FMResultSet *rs = [self executeQuery:sql withArgumentsInArray:values orDictionary:nil orVAList:nil]; + if (!rs && error) { + *error = [self lastError]; + } + return rs; +} + +- (FMResultSet *)executeQuery:(NSString*)sql withVAList:(va_list)args { + return [self executeQuery:sql withArgumentsInArray:nil orDictionary:nil orVAList:args]; +} + +#pragma mark Execute updates + +- (BOOL)executeUpdate:(NSString*)sql error:(NSError**)outErr withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args { + + if (![self databaseExists]) { + return NO; + } + + if (_isExecutingStatement) { + [self warnInUse]; + return NO; + } + + _isExecutingStatement = YES; + + int rc = 0x00; + sqlite3_stmt *pStmt = 0x00; + FMStatement *cachedStmt = 0x00; + + if (_traceExecution && sql) { + NSLog(@"%@ executeUpdate: %@", self, sql); + } + + if (_shouldCacheStatements) { + cachedStmt = [self cachedStatementForQuery:sql]; + pStmt = cachedStmt ? [cachedStmt statement] : 0x00; + [cachedStmt reset]; + } + + if (!pStmt) { + rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0); + + if (SQLITE_OK != rc) { + if (_logsErrors) { + NSLog(@"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); + NSLog(@"DB Query: %@", sql); + NSLog(@"DB Path: %@", _databasePath); + } + + if (_crashOnErrors) { + NSAssert(false, @"DB Error: %d \"%@\"", [self lastErrorCode], [self lastErrorMessage]); + abort(); + } + + if (outErr) { + *outErr = [self errorWithMessage:[NSString stringWithUTF8String:sqlite3_errmsg(_db)]]; + } + + sqlite3_finalize(pStmt); + + _isExecutingStatement = NO; + return NO; + } + } + + id obj; + int idx = 0; + int queryCount = sqlite3_bind_parameter_count(pStmt); + + // If dictionaryArgs is passed in, that means we are using sqlite's named parameter support + if (dictionaryArgs) { + + for (NSString *dictionaryKey in [dictionaryArgs allKeys]) { + + // Prefix the key with a colon. + NSString *parameterName = [[NSString alloc] initWithFormat:@":%@", dictionaryKey]; + + if (_traceExecution) { + NSLog(@"%@ = %@", parameterName, [dictionaryArgs objectForKey:dictionaryKey]); + } + // Get the index for the parameter name. + int namedIdx = sqlite3_bind_parameter_index(pStmt, [parameterName UTF8String]); + + FMDBRelease(parameterName); + + if (namedIdx > 0) { + // Standard binding from here. + [self bindObject:[dictionaryArgs objectForKey:dictionaryKey] toColumn:namedIdx inStatement:pStmt]; + + // increment the binding count, so our check below works out + idx++; + } + else { + NSString *message = [NSString stringWithFormat:@"Could not find index for %@", dictionaryKey]; + + if (_logsErrors) { + NSLog(@"%@", message); + } + if (outErr) { + *outErr = [self errorWithMessage:message]; + } + } + } + } + else { + + while (idx < queryCount) { + + if (arrayArgs && idx < (int)[arrayArgs count]) { + obj = [arrayArgs objectAtIndex:(NSUInteger)idx]; + } + else if (args) { + obj = va_arg(args, id); + } + else { + //We ran out of arguments + break; + } + + if (_traceExecution) { + if ([obj isKindOfClass:[NSData class]]) { + NSLog(@"data: %ld bytes", (unsigned long)[(NSData*)obj length]); + } + else { + NSLog(@"obj: %@", obj); + } + } + + idx++; + + [self bindObject:obj toColumn:idx inStatement:pStmt]; + } + } + + + if (idx != queryCount) { + NSString *message = [NSString stringWithFormat:@"Error: the bind count (%d) is not correct for the # of variables in the query (%d) (%@) (executeUpdate)", idx, queryCount, sql]; + if (_logsErrors) { + NSLog(@"%@", message); + } + if (outErr) { + *outErr = [self errorWithMessage:message]; + } + + sqlite3_finalize(pStmt); + _isExecutingStatement = NO; + return NO; + } + + /* Call sqlite3_step() to run the virtual machine. Since the SQL being + ** executed is not a SELECT statement, we assume no data will be returned. + */ + + rc = sqlite3_step(pStmt); + + if (SQLITE_DONE == rc) { + // all is well, let's return. + } + else if (rc == SQLITE_ROW) { + NSString *message = [NSString stringWithFormat:@"A executeUpdate is being called with a query string '%@'", sql]; + if (_logsErrors) { + NSLog(@"%@", message); + NSLog(@"DB Query: %@", sql); + } + if (outErr) { + *outErr = [self errorWithMessage:message]; + } + } + else { + if (outErr) { + *outErr = [self errorWithMessage:[NSString stringWithUTF8String:sqlite3_errmsg(_db)]]; + } + + if (SQLITE_ERROR == rc) { + if (_logsErrors) { + NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_ERROR", rc, sqlite3_errmsg(_db)); + NSLog(@"DB Query: %@", sql); + } + } + else if (SQLITE_MISUSE == rc) { + // uh oh. + if (_logsErrors) { + NSLog(@"Error calling sqlite3_step (%d: %s) SQLITE_MISUSE", rc, sqlite3_errmsg(_db)); + NSLog(@"DB Query: %@", sql); + } + } + else { + // wtf? + if (_logsErrors) { + NSLog(@"Unknown error calling sqlite3_step (%d: %s) eu", rc, sqlite3_errmsg(_db)); + NSLog(@"DB Query: %@", sql); + } + } + } + + if (_shouldCacheStatements && !cachedStmt) { + cachedStmt = [[FMStatement alloc] init]; + + [cachedStmt setStatement:pStmt]; + + [self setCachedStatement:cachedStmt forQuery:sql]; + + FMDBRelease(cachedStmt); + } + + int closeErrorCode; + + if (cachedStmt) { + [cachedStmt setUseCount:[cachedStmt useCount] + 1]; + closeErrorCode = sqlite3_reset(pStmt); + } + else { + /* Finalize the virtual machine. This releases all memory and other + ** resources allocated by the sqlite3_prepare() call above. + */ + closeErrorCode = sqlite3_finalize(pStmt); + } + + if (closeErrorCode != SQLITE_OK) { + if (_logsErrors) { + NSLog(@"Unknown error finalizing or resetting statement (%d: %s)", closeErrorCode, sqlite3_errmsg(_db)); + NSLog(@"DB Query: %@", sql); + } + } + + _isExecutingStatement = NO; + return (rc == SQLITE_DONE || rc == SQLITE_OK); +} + + +- (BOOL)executeUpdate:(NSString*)sql, ... { + va_list args; + va_start(args, sql); + + BOOL result = [self executeUpdate:sql error:nil withArgumentsInArray:nil orDictionary:nil orVAList:args]; + + va_end(args); + return result; +} + +- (BOOL)executeUpdate:(NSString*)sql withArgumentsInArray:(NSArray *)arguments { + return [self executeUpdate:sql error:nil withArgumentsInArray:arguments orDictionary:nil orVAList:nil]; +} + +- (BOOL)executeUpdate:(NSString*)sql values:(NSArray *)values error:(NSError * __autoreleasing *)error { + return [self executeUpdate:sql error:error withArgumentsInArray:values orDictionary:nil orVAList:nil]; +} + +- (BOOL)executeUpdate:(NSString*)sql withParameterDictionary:(NSDictionary *)arguments { + return [self executeUpdate:sql error:nil withArgumentsInArray:nil orDictionary:arguments orVAList:nil]; +} + +- (BOOL)executeUpdate:(NSString*)sql withVAList:(va_list)args { + return [self executeUpdate:sql error:nil withArgumentsInArray:nil orDictionary:nil orVAList:args]; +} + +- (BOOL)executeUpdateWithFormat:(NSString*)format, ... { + va_list args; + va_start(args, format); + + NSMutableString *sql = [NSMutableString stringWithCapacity:[format length]]; + NSMutableArray *arguments = [NSMutableArray array]; + + [self extractSQL:format argumentsList:args intoString:sql arguments:arguments]; + + va_end(args); + + return [self executeUpdate:sql withArgumentsInArray:arguments]; +} + + +int FMDBExecuteBulkSQLCallback(void *theBlockAsVoid, int columns, char **values, char **names); // shhh clang. +int FMDBExecuteBulkSQLCallback(void *theBlockAsVoid, int columns, char **values, char **names) { + + if (!theBlockAsVoid) { + return SQLITE_OK; + } + + int (^execCallbackBlock)(NSDictionary *resultsDictionary) = (__bridge int (^)(NSDictionary *__strong))(theBlockAsVoid); + + NSMutableDictionary *dictionary = [NSMutableDictionary dictionaryWithCapacity:(NSUInteger)columns]; + + for (NSInteger i = 0; i < columns; i++) { + NSString *key = [NSString stringWithUTF8String:names[i]]; + id value = values[i] ? [NSString stringWithUTF8String:values[i]] : [NSNull null]; + [dictionary setObject:value forKey:key]; + } + + return execCallbackBlock(dictionary); +} + +- (BOOL)executeStatements:(NSString *)sql { + return [self executeStatements:sql withResultBlock:nil]; +} + +- (BOOL)executeStatements:(NSString *)sql withResultBlock:(FMDBExecuteStatementsCallbackBlock)block { + + int rc; + char *errmsg = nil; + + rc = sqlite3_exec([self sqliteHandle], [sql UTF8String], block ? FMDBExecuteBulkSQLCallback : nil, (__bridge void *)(block), &errmsg); + + if (errmsg && [self logsErrors]) { + NSLog(@"Error inserting batch: %s", errmsg); + sqlite3_free(errmsg); + } + + return (rc == SQLITE_OK); +} + +- (BOOL)executeUpdate:(NSString*)sql withErrorAndBindings:(NSError**)outErr, ... { + + va_list args; + va_start(args, outErr); + + BOOL result = [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:args]; + + va_end(args); + return result; +} + + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" +- (BOOL)update:(NSString*)sql withErrorAndBindings:(NSError**)outErr, ... { + va_list args; + va_start(args, outErr); + + BOOL result = [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:args]; + + va_end(args); + return result; +} + +#pragma clang diagnostic pop + +#pragma mark Transactions + +- (BOOL)rollback { + BOOL b = [self executeUpdate:@"rollback transaction"]; + + if (b) { + _inTransaction = NO; + } + + return b; +} + +- (BOOL)commit { + BOOL b = [self executeUpdate:@"commit transaction"]; + + if (b) { + _inTransaction = NO; + } + + return b; +} + +- (BOOL)beginDeferredTransaction { + + BOOL b = [self executeUpdate:@"begin deferred transaction"]; + if (b) { + _inTransaction = YES; + } + + return b; +} + +- (BOOL)beginTransaction { + + BOOL b = [self executeUpdate:@"begin exclusive transaction"]; + if (b) { + _inTransaction = YES; + } + + return b; +} + +- (BOOL)inTransaction { + return _inTransaction; +} + +static NSString *FMDBEscapeSavePointName(NSString *savepointName) { + return [savepointName stringByReplacingOccurrencesOfString:@"'" withString:@"''"]; +} + +- (BOOL)startSavePointWithName:(NSString*)name error:(NSError**)outErr { +#if SQLITE_VERSION_NUMBER >= 3007000 + NSParameterAssert(name); + + NSString *sql = [NSString stringWithFormat:@"savepoint '%@';", FMDBEscapeSavePointName(name)]; + + return [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:nil]; +#else + NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return NO; +#endif +} + +- (BOOL)releaseSavePointWithName:(NSString*)name error:(NSError**)outErr { +#if SQLITE_VERSION_NUMBER >= 3007000 + NSParameterAssert(name); + + NSString *sql = [NSString stringWithFormat:@"release savepoint '%@';", FMDBEscapeSavePointName(name)]; + + return [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:nil]; +#else + NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return NO; +#endif +} + +- (BOOL)rollbackToSavePointWithName:(NSString*)name error:(NSError**)outErr { +#if SQLITE_VERSION_NUMBER >= 3007000 + NSParameterAssert(name); + + NSString *sql = [NSString stringWithFormat:@"rollback transaction to savepoint '%@';", FMDBEscapeSavePointName(name)]; + + return [self executeUpdate:sql error:outErr withArgumentsInArray:nil orDictionary:nil orVAList:nil]; +#else + NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return NO; +#endif +} + +- (NSError*)inSavePoint:(void (^)(BOOL *rollback))block { +#if SQLITE_VERSION_NUMBER >= 3007000 + static unsigned long savePointIdx = 0; + + NSString *name = [NSString stringWithFormat:@"dbSavePoint%ld", savePointIdx++]; + + BOOL shouldRollback = NO; + + NSError *err = 0x00; + + if (![self startSavePointWithName:name error:&err]) { + return err; + } + + if (block) { + block(&shouldRollback); + } + + if (shouldRollback) { + // We need to rollback and release this savepoint to remove it + [self rollbackToSavePointWithName:name error:&err]; + } + [self releaseSavePointWithName:name error:&err]; + + return err; +#else + NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}]; +#endif +} + + +#pragma mark Cache statements + +- (BOOL)shouldCacheStatements { + return _shouldCacheStatements; +} + +- (void)setShouldCacheStatements:(BOOL)value { + + _shouldCacheStatements = value; + + if (_shouldCacheStatements && !_cachedStatements) { + [self setCachedStatements:[NSMutableDictionary dictionary]]; + } + + if (!_shouldCacheStatements) { + [self setCachedStatements:nil]; + } +} + +#pragma mark Callback function + +void FMDBBlockSQLiteCallBackFunction(sqlite3_context *context, int argc, sqlite3_value **argv); // -Wmissing-prototypes +void FMDBBlockSQLiteCallBackFunction(sqlite3_context *context, int argc, sqlite3_value **argv) { +#if ! __has_feature(objc_arc) + void (^block)(sqlite3_context *context, int argc, sqlite3_value **argv) = (id)sqlite3_user_data(context); +#else + void (^block)(sqlite3_context *context, int argc, sqlite3_value **argv) = (__bridge id)sqlite3_user_data(context); +#endif + if (block) { + block(context, argc, argv); + } +} + + +- (void)makeFunctionNamed:(NSString*)name maximumArguments:(int)count withBlock:(void (^)(void *context, int argc, void **argv))block { + + if (!_openFunctions) { + _openFunctions = [NSMutableSet new]; + } + + id b = FMDBReturnAutoreleased([block copy]); + + [_openFunctions addObject:b]; + + /* I tried adding custom functions to release the block when the connection is destroyed- but they seemed to never be called, so we use _openFunctions to store the values instead. */ +#if ! __has_feature(objc_arc) + sqlite3_create_function([self sqliteHandle], [name UTF8String], count, SQLITE_UTF8, (void*)b, &FMDBBlockSQLiteCallBackFunction, 0x00, 0x00); +#else + sqlite3_create_function([self sqliteHandle], [name UTF8String], count, SQLITE_UTF8, (__bridge void*)b, &FMDBBlockSQLiteCallBackFunction, 0x00, 0x00); +#endif +} + +@end + + + +@implementation FMStatement +@synthesize statement=_statement; +@synthesize query=_query; +@synthesize useCount=_useCount; +@synthesize inUse=_inUse; + +- (void)finalize { + [self close]; + [super finalize]; +} + +- (void)dealloc { + [self close]; + FMDBRelease(_query); +#if ! __has_feature(objc_arc) + [super dealloc]; +#endif +} + +- (void)close { + if (_statement) { + sqlite3_finalize(_statement); + _statement = 0x00; + } + + _inUse = NO; +} + +- (void)reset { + if (_statement) { + sqlite3_reset(_statement); + } + + _inUse = NO; +} + +- (NSString*)description { + return [NSString stringWithFormat:@"%@ %ld hit(s) for query %@", [super description], _useCount, _query]; +} + + +@end + diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabaseAdditions.h b/ios/Pods/FMDB/src/fmdb/FMDatabaseAdditions.h new file mode 100644 index 0000000..9dd0b62 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabaseAdditions.h @@ -0,0 +1,278 @@ +// +// FMDatabaseAdditions.h +// fmdb +// +// Created by August Mueller on 10/30/05. +// Copyright 2005 Flying Meat Inc.. All rights reserved. +// + +#import +#import "FMDatabase.h" + + +/** Category of additions for `` class. + + ### See also + + - `` + */ + +@interface FMDatabase (FMDatabaseAdditions) + +///---------------------------------------- +/// @name Return results of SQL to variable +///---------------------------------------- + +/** Return `int` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `int` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (int)intForQuery:(NSString*)query, ...; + +/** Return `long` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `long` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (long)longForQuery:(NSString*)query, ...; + +/** Return `BOOL` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `BOOL` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (BOOL)boolForQuery:(NSString*)query, ...; + +/** Return `double` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `double` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (double)doubleForQuery:(NSString*)query, ...; + +/** Return `NSString` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `NSString` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (NSString*)stringForQuery:(NSString*)query, ...; + +/** Return `NSData` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `NSData` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (NSData*)dataForQuery:(NSString*)query, ...; + +/** Return `NSDate` value for query + + @param query The SQL query to be performed. + @param ... A list of parameters that will be bound to the `?` placeholders in the SQL query. + + @return `NSDate` value. + + @note To use this method from Swift, you must include `FMDatabaseAdditionsVariadic.swift` in your project. + */ + +- (NSDate*)dateForQuery:(NSString*)query, ...; + + +// Notice that there's no dataNoCopyForQuery:. +// That would be a bad idea, because we close out the result set, and then what +// happens to the data that we just didn't copy? Who knows, not I. + + +///-------------------------------- +/// @name Schema related operations +///-------------------------------- + +/** Does table exist in database? + + @param tableName The name of the table being looked for. + + @return `YES` if table found; `NO` if not found. + */ + +- (BOOL)tableExists:(NSString*)tableName; + +/** The schema of the database. + + This will be the schema for the entire database. For each entity, each row of the result set will include the following fields: + + - `type` - The type of entity (e.g. table, index, view, or trigger) + - `name` - The name of the object + - `tbl_name` - The name of the table to which the object references + - `rootpage` - The page number of the root b-tree page for tables and indices + - `sql` - The SQL that created the entity + + @return `FMResultSet` of schema; `nil` on error. + + @see [SQLite File Format](http://www.sqlite.org/fileformat.html) + */ + +- (FMResultSet*)getSchema; + +/** The schema of the database. + + This will be the schema for a particular table as report by SQLite `PRAGMA`, for example: + + PRAGMA table_info('employees') + + This will report: + + - `cid` - The column ID number + - `name` - The name of the column + - `type` - The data type specified for the column + - `notnull` - whether the field is defined as NOT NULL (i.e. values required) + - `dflt_value` - The default value for the column + - `pk` - Whether the field is part of the primary key of the table + + @param tableName The name of the table for whom the schema will be returned. + + @return `FMResultSet` of schema; `nil` on error. + + @see [table_info](http://www.sqlite.org/pragma.html#pragma_table_info) + */ + +- (FMResultSet*)getTableSchema:(NSString*)tableName; + +/** Test to see if particular column exists for particular table in database + + @param columnName The name of the column. + + @param tableName The name of the table. + + @return `YES` if column exists in table in question; `NO` otherwise. + */ + +- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName; + +/** Test to see if particular column exists for particular table in database + + @param columnName The name of the column. + + @param tableName The name of the table. + + @return `YES` if column exists in table in question; `NO` otherwise. + + @see columnExists:inTableWithName: + + @warning Deprecated - use `` instead. + */ + +- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)); + + +/** Validate SQL statement + + This validates SQL statement by performing `sqlite3_prepare_v2`, but not returning the results, but instead immediately calling `sqlite3_finalize`. + + @param sql The SQL statement being validated. + + @param error This is a pointer to a `NSError` object that will receive the autoreleased `NSError` object if there was any error. If this is `nil`, no `NSError` result will be returned. + + @return `YES` if validation succeeded without incident; `NO` otherwise. + + */ + +- (BOOL)validateSQL:(NSString*)sql error:(NSError**)error; + + +///----------------------------------- +/// @name Application identifier tasks +///----------------------------------- + +/** Retrieve application ID + + @return The `uint32_t` numeric value of the application ID. + + @see setApplicationID: + */ + +- (uint32_t)applicationID; + +/** Set the application ID + + @param appID The `uint32_t` numeric value of the application ID. + + @see applicationID + */ + +- (void)setApplicationID:(uint32_t)appID; + +#if TARGET_OS_MAC && !TARGET_OS_IPHONE +/** Retrieve application ID string + + @return The `NSString` value of the application ID. + + @see setApplicationIDString: + */ + + +- (NSString*)applicationIDString; + +/** Set the application ID string + + @param string The `NSString` value of the application ID. + + @see applicationIDString + */ + +- (void)setApplicationIDString:(NSString*)string; + +#endif + +///----------------------------------- +/// @name user version identifier tasks +///----------------------------------- + +/** Retrieve user version + + @return The `uint32_t` numeric value of the user version. + + @see setUserVersion: + */ + +- (uint32_t)userVersion; + +/** Set the user-version + + @param version The `uint32_t` numeric value of the user version. + + @see userVersion + */ + +- (void)setUserVersion:(uint32_t)version; + +@end diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabaseAdditions.m b/ios/Pods/FMDB/src/fmdb/FMDatabaseAdditions.m new file mode 100644 index 0000000..61fa747 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabaseAdditions.m @@ -0,0 +1,246 @@ +// +// FMDatabaseAdditions.m +// fmdb +// +// Created by August Mueller on 10/30/05. +// Copyright 2005 Flying Meat Inc.. All rights reserved. +// + +#import "FMDatabase.h" +#import "FMDatabaseAdditions.h" +#import "TargetConditionals.h" + +#if FMDB_SQLITE_STANDALONE +#import +#else +#import +#endif + +@interface FMDatabase (PrivateStuff) +- (FMResultSet *)executeQuery:(NSString *)sql withArgumentsInArray:(NSArray*)arrayArgs orDictionary:(NSDictionary *)dictionaryArgs orVAList:(va_list)args; +@end + +@implementation FMDatabase (FMDatabaseAdditions) + +#define RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(type, sel) \ +va_list args; \ +va_start(args, query); \ +FMResultSet *resultSet = [self executeQuery:query withArgumentsInArray:0x00 orDictionary:0x00 orVAList:args]; \ +va_end(args); \ +if (![resultSet next]) { return (type)0; } \ +type ret = [resultSet sel:0]; \ +[resultSet close]; \ +[resultSet setParentDB:nil]; \ +return ret; + + +- (NSString*)stringForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSString *, stringForColumnIndex); +} + +- (int)intForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(int, intForColumnIndex); +} + +- (long)longForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(long, longForColumnIndex); +} + +- (BOOL)boolForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(BOOL, boolForColumnIndex); +} + +- (double)doubleForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(double, doubleForColumnIndex); +} + +- (NSData*)dataForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSData *, dataForColumnIndex); +} + +- (NSDate*)dateForQuery:(NSString*)query, ... { + RETURN_RESULT_FOR_QUERY_WITH_SELECTOR(NSDate *, dateForColumnIndex); +} + + +- (BOOL)tableExists:(NSString*)tableName { + + tableName = [tableName lowercaseString]; + + FMResultSet *rs = [self executeQuery:@"select [sql] from sqlite_master where [type] = 'table' and lower(name) = ?", tableName]; + + //if at least one next exists, table exists + BOOL returnBool = [rs next]; + + //close and free object + [rs close]; + + return returnBool; +} + +/* + get table with list of tables: result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING] + check if table exist in database (patch from OZLB) +*/ +- (FMResultSet*)getSchema { + + //result colums: type[STRING], name[STRING],tbl_name[STRING],rootpage[INTEGER],sql[STRING] + FMResultSet *rs = [self executeQuery:@"SELECT type, name, tbl_name, rootpage, sql FROM (SELECT * FROM sqlite_master UNION ALL SELECT * FROM sqlite_temp_master) WHERE type != 'meta' AND name NOT LIKE 'sqlite_%' ORDER BY tbl_name, type DESC, name"]; + + return rs; +} + +/* + get table schema: result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER] +*/ +- (FMResultSet*)getTableSchema:(NSString*)tableName { + + //result colums: cid[INTEGER], name,type [STRING], notnull[INTEGER], dflt_value[],pk[INTEGER] + FMResultSet *rs = [self executeQuery:[NSString stringWithFormat: @"pragma table_info('%@')", tableName]]; + + return rs; +} + +- (BOOL)columnExists:(NSString*)columnName inTableWithName:(NSString*)tableName { + + BOOL returnBool = NO; + + tableName = [tableName lowercaseString]; + columnName = [columnName lowercaseString]; + + FMResultSet *rs = [self getTableSchema:tableName]; + + //check if column is present in table schema + while ([rs next]) { + if ([[[rs stringForColumn:@"name"] lowercaseString] isEqualToString:columnName]) { + returnBool = YES; + break; + } + } + + //If this is not done FMDatabase instance stays out of pool + [rs close]; + + return returnBool; +} + + + +- (uint32_t)applicationID { +#if SQLITE_VERSION_NUMBER >= 3007017 + uint32_t r = 0; + + FMResultSet *rs = [self executeQuery:@"pragma application_id"]; + + if ([rs next]) { + r = (uint32_t)[rs longLongIntForColumnIndex:0]; + } + + [rs close]; + + return r; +#else + NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return 0; +#endif +} + +- (void)setApplicationID:(uint32_t)appID { +#if SQLITE_VERSION_NUMBER >= 3007017 + NSString *query = [NSString stringWithFormat:@"pragma application_id=%d", appID]; + FMResultSet *rs = [self executeQuery:query]; + [rs next]; + [rs close]; +#else + NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); +#endif +} + + +#if TARGET_OS_MAC && !TARGET_OS_IPHONE + +- (NSString*)applicationIDString { +#if SQLITE_VERSION_NUMBER >= 3007017 + NSString *s = NSFileTypeForHFSTypeCode([self applicationID]); + + assert([s length] == 6); + + s = [s substringWithRange:NSMakeRange(1, 4)]; + + + return s; +#else + NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return nil; +#endif +} + +- (void)setApplicationIDString:(NSString*)s { +#if SQLITE_VERSION_NUMBER >= 3007017 + if ([s length] != 4) { + NSLog(@"setApplicationIDString: string passed is not exactly 4 chars long. (was %ld)", [s length]); + } + + [self setApplicationID:NSHFSTypeCodeFromFileType([NSString stringWithFormat:@"'%@'", s])]; +#else + NSString *errorMessage = NSLocalizedString(@"Application ID functions require SQLite 3.7.17", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); +#endif +} + +#endif + +- (uint32_t)userVersion { + uint32_t r = 0; + + FMResultSet *rs = [self executeQuery:@"pragma user_version"]; + + if ([rs next]) { + r = (uint32_t)[rs longLongIntForColumnIndex:0]; + } + + [rs close]; + return r; +} + +- (void)setUserVersion:(uint32_t)version { + NSString *query = [NSString stringWithFormat:@"pragma user_version = %d", version]; + FMResultSet *rs = [self executeQuery:query]; + [rs next]; + [rs close]; +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" + +- (BOOL)columnExists:(NSString*)tableName columnName:(NSString*)columnName __attribute__ ((deprecated)) { + return [self columnExists:columnName inTableWithName:tableName]; +} + +#pragma clang diagnostic pop + + +- (BOOL)validateSQL:(NSString*)sql error:(NSError**)error { + sqlite3_stmt *pStmt = NULL; + BOOL validationSucceeded = YES; + + int rc = sqlite3_prepare_v2(_db, [sql UTF8String], -1, &pStmt, 0); + if (rc != SQLITE_OK) { + validationSucceeded = NO; + if (error) { + *error = [NSError errorWithDomain:NSCocoaErrorDomain + code:[self lastErrorCode] + userInfo:[NSDictionary dictionaryWithObject:[self lastErrorMessage] + forKey:NSLocalizedDescriptionKey]]; + } + } + + sqlite3_finalize(pStmt); + + return validationSucceeded; +} + +@end diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabasePool.h b/ios/Pods/FMDB/src/fmdb/FMDatabasePool.h new file mode 100644 index 0000000..1915858 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabasePool.h @@ -0,0 +1,200 @@ +// +// FMDatabasePool.h +// fmdb +// +// Created by August Mueller on 6/22/11. +// Copyright 2011 Flying Meat Inc. All rights reserved. +// + +#import + +@class FMDatabase; + +/** Pool of `` objects. + + ### See also + + - `` + - `` + + @warning Before using `FMDatabasePool`, please consider using `` instead. + + If you really really really know what you're doing and `FMDatabasePool` is what + you really really need (ie, you're using a read only database), OK you can use + it. But just be careful not to deadlock! + + For an example on deadlocking, search for: + `ONLY_USE_THE_POOL_IF_YOU_ARE_DOING_READS_OTHERWISE_YOULL_DEADLOCK_USE_FMDATABASEQUEUE_INSTEAD` + in the main.m file. + */ + +@interface FMDatabasePool : NSObject { + NSString *_path; + + dispatch_queue_t _lockQueue; + + NSMutableArray *_databaseInPool; + NSMutableArray *_databaseOutPool; + + __unsafe_unretained id _delegate; + + NSUInteger _maximumNumberOfDatabasesToCreate; + int _openFlags; +} + +/** Database path */ + +@property (atomic, retain) NSString *path; + +/** Delegate object */ + +@property (atomic, assign) id delegate; + +/** Maximum number of databases to create */ + +@property (atomic, assign) NSUInteger maximumNumberOfDatabasesToCreate; + +/** Open flags */ + +@property (atomic, readonly) int openFlags; + + +///--------------------- +/// @name Initialization +///--------------------- + +/** Create pool using path. + + @param aPath The file path of the database. + + @return The `FMDatabasePool` object. `nil` on error. + */ + ++ (instancetype)databasePoolWithPath:(NSString*)aPath; + +/** Create pool using path and specified flags + + @param aPath The file path of the database. + @param openFlags Flags passed to the openWithFlags method of the database + + @return The `FMDatabasePool` object. `nil` on error. + */ + ++ (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags; + +/** Create pool using path. + + @param aPath The file path of the database. + + @return The `FMDatabasePool` object. `nil` on error. + */ + +- (instancetype)initWithPath:(NSString*)aPath; + +/** Create pool using path and specified flags. + + @param aPath The file path of the database. + @param openFlags Flags passed to the openWithFlags method of the database + + @return The `FMDatabasePool` object. `nil` on error. + */ + +- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; + +///------------------------------------------------ +/// @name Keeping track of checked in/out databases +///------------------------------------------------ + +/** Number of checked-in databases in pool + + @returns Number of databases + */ + +- (NSUInteger)countOfCheckedInDatabases; + +/** Number of checked-out databases in pool + + @returns Number of databases + */ + +- (NSUInteger)countOfCheckedOutDatabases; + +/** Total number of databases in pool + + @returns Number of databases + */ + +- (NSUInteger)countOfOpenDatabases; + +/** Release all databases in pool */ + +- (void)releaseAllDatabases; + +///------------------------------------------ +/// @name Perform database operations in pool +///------------------------------------------ + +/** Synchronously perform database operations in pool. + + @param block The code to be run on the `FMDatabasePool` pool. + */ + +- (void)inDatabase:(void (^)(FMDatabase *db))block; + +/** Synchronously perform database operations in pool using transaction. + + @param block The code to be run on the `FMDatabasePool` pool. + */ + +- (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; + +/** Synchronously perform database operations in pool using deferred transaction. + + @param block The code to be run on the `FMDatabasePool` pool. + */ + +- (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; + +/** Synchronously perform database operations in pool using save point. + + @param block The code to be run on the `FMDatabasePool` pool. + + @return `NSError` object if error; `nil` if successful. + + @warning You can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. If you need to nest, use `<[FMDatabase startSavePointWithName:error:]>` instead. +*/ + +- (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; + +@end + + +/** FMDatabasePool delegate category + + This is a category that defines the protocol for the FMDatabasePool delegate + */ + +@interface NSObject (FMDatabasePoolDelegate) + +/** Asks the delegate whether database should be added to the pool. + + @param pool The `FMDatabasePool` object. + @param database The `FMDatabase` object. + + @return `YES` if it should add database to pool; `NO` if not. + + */ + +- (BOOL)databasePool:(FMDatabasePool*)pool shouldAddDatabaseToPool:(FMDatabase*)database; + +/** Tells the delegate that database was added to the pool. + + @param pool The `FMDatabasePool` object. + @param database The `FMDatabase` object. + + */ + +- (void)databasePool:(FMDatabasePool*)pool didAddDatabase:(FMDatabase*)database; + +@end + diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabasePool.m b/ios/Pods/FMDB/src/fmdb/FMDatabasePool.m new file mode 100644 index 0000000..e8e52cb --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabasePool.m @@ -0,0 +1,283 @@ +// +// FMDatabasePool.m +// fmdb +// +// Created by August Mueller on 6/22/11. +// Copyright 2011 Flying Meat Inc. All rights reserved. +// + +#if FMDB_SQLITE_STANDALONE +#import +#else +#import +#endif + +#import "FMDatabasePool.h" +#import "FMDatabase.h" + +@interface FMDatabasePool() + +- (void)pushDatabaseBackInPool:(FMDatabase*)db; +- (FMDatabase*)db; + +@end + + +@implementation FMDatabasePool +@synthesize path=_path; +@synthesize delegate=_delegate; +@synthesize maximumNumberOfDatabasesToCreate=_maximumNumberOfDatabasesToCreate; +@synthesize openFlags=_openFlags; + + ++ (instancetype)databasePoolWithPath:(NSString*)aPath { + return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath]); +} + ++ (instancetype)databasePoolWithPath:(NSString*)aPath flags:(int)openFlags { + return FMDBReturnAutoreleased([[self alloc] initWithPath:aPath flags:openFlags]); +} + +- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags { + + self = [super init]; + + if (self != nil) { + _path = [aPath copy]; + _lockQueue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL); + _databaseInPool = FMDBReturnRetained([NSMutableArray array]); + _databaseOutPool = FMDBReturnRetained([NSMutableArray array]); + _openFlags = openFlags; + } + + return self; +} + +- (instancetype)initWithPath:(NSString*)aPath +{ + // default flags for sqlite3_open + return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE]; +} + +- (instancetype)init { + return [self initWithPath:nil]; +} + + +- (void)dealloc { + + _delegate = 0x00; + FMDBRelease(_path); + FMDBRelease(_databaseInPool); + FMDBRelease(_databaseOutPool); + + if (_lockQueue) { + FMDBDispatchQueueRelease(_lockQueue); + _lockQueue = 0x00; + } +#if ! __has_feature(objc_arc) + [super dealloc]; +#endif +} + + +- (void)executeLocked:(void (^)(void))aBlock { + dispatch_sync(_lockQueue, aBlock); +} + +- (void)pushDatabaseBackInPool:(FMDatabase*)db { + + if (!db) { // db can be null if we set an upper bound on the # of databases to create. + return; + } + + [self executeLocked:^() { + + if ([self->_databaseInPool containsObject:db]) { + [[NSException exceptionWithName:@"Database already in pool" reason:@"The FMDatabase being put back into the pool is already present in the pool" userInfo:nil] raise]; + } + + [self->_databaseInPool addObject:db]; + [self->_databaseOutPool removeObject:db]; + + }]; +} + +- (FMDatabase*)db { + + __block FMDatabase *db; + + + [self executeLocked:^() { + db = [self->_databaseInPool lastObject]; + + BOOL shouldNotifyDelegate = NO; + + if (db) { + [self->_databaseOutPool addObject:db]; + [self->_databaseInPool removeLastObject]; + } + else { + + if (self->_maximumNumberOfDatabasesToCreate) { + NSUInteger currentCount = [self->_databaseOutPool count] + [self->_databaseInPool count]; + + if (currentCount >= self->_maximumNumberOfDatabasesToCreate) { + NSLog(@"Maximum number of databases (%ld) has already been reached!", (long)currentCount); + return; + } + } + + db = [FMDatabase databaseWithPath:self->_path]; + shouldNotifyDelegate = YES; + } + + //This ensures that the db is opened before returning +#if SQLITE_VERSION_NUMBER >= 3005000 + BOOL success = [db openWithFlags:self->_openFlags]; +#else + BOOL success = [db open]; +#endif + if (success) { + if ([self->_delegate respondsToSelector:@selector(databasePool:shouldAddDatabaseToPool:)] && ![self->_delegate databasePool:self shouldAddDatabaseToPool:db]) { + [db close]; + db = 0x00; + } + else { + //It should not get added in the pool twice if lastObject was found + if (![self->_databaseOutPool containsObject:db]) { + [self->_databaseOutPool addObject:db]; + + if (shouldNotifyDelegate && [self->_delegate respondsToSelector:@selector(databasePool:didAddDatabase:)]) { + [self->_delegate databasePool:self didAddDatabase:db]; + } + } + } + } + else { + NSLog(@"Could not open up the database at path %@", self->_path); + db = 0x00; + } + }]; + + return db; +} + +- (NSUInteger)countOfCheckedInDatabases { + + __block NSUInteger count; + + [self executeLocked:^() { + count = [self->_databaseInPool count]; + }]; + + return count; +} + +- (NSUInteger)countOfCheckedOutDatabases { + + __block NSUInteger count; + + [self executeLocked:^() { + count = [self->_databaseOutPool count]; + }]; + + return count; +} + +- (NSUInteger)countOfOpenDatabases { + __block NSUInteger count; + + [self executeLocked:^() { + count = [self->_databaseOutPool count] + [self->_databaseInPool count]; + }]; + + return count; +} + +- (void)releaseAllDatabases { + [self executeLocked:^() { + [self->_databaseOutPool removeAllObjects]; + [self->_databaseInPool removeAllObjects]; + }]; +} + +- (void)inDatabase:(void (^)(FMDatabase *db))block { + + FMDatabase *db = [self db]; + + block(db); + + [self pushDatabaseBackInPool:db]; +} + +- (void)beginTransaction:(BOOL)useDeferred withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block { + + BOOL shouldRollback = NO; + + FMDatabase *db = [self db]; + + if (useDeferred) { + [db beginDeferredTransaction]; + } + else { + [db beginTransaction]; + } + + + block(db, &shouldRollback); + + if (shouldRollback) { + [db rollback]; + } + else { + [db commit]; + } + + [self pushDatabaseBackInPool:db]; +} + +- (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { + [self beginTransaction:YES withBlock:block]; +} + +- (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { + [self beginTransaction:NO withBlock:block]; +} + +- (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block { +#if SQLITE_VERSION_NUMBER >= 3007000 + static unsigned long savePointIdx = 0; + + NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++]; + + BOOL shouldRollback = NO; + + FMDatabase *db = [self db]; + + NSError *err = 0x00; + + if (![db startSavePointWithName:name error:&err]) { + [self pushDatabaseBackInPool:db]; + return err; + } + + block(db, &shouldRollback); + + if (shouldRollback) { + // We need to rollback and release this savepoint to remove it + [db rollbackToSavePointWithName:name error:&err]; + } + [db releaseSavePointWithName:name error:&err]; + + [self pushDatabaseBackInPool:db]; + + return err; +#else + NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}]; +#endif +} + +@end diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.h b/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.h new file mode 100644 index 0000000..ae45b65 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.h @@ -0,0 +1,182 @@ +// +// FMDatabaseQueue.h +// fmdb +// +// Created by August Mueller on 6/22/11. +// Copyright 2011 Flying Meat Inc. All rights reserved. +// + +#import + +@class FMDatabase; + +/** To perform queries and updates on multiple threads, you'll want to use `FMDatabaseQueue`. + + Using a single instance of `` from multiple threads at once is a bad idea. It has always been OK to make a `` object *per thread*. Just don't share a single instance across threads, and definitely not across multiple threads at the same time. + + Instead, use `FMDatabaseQueue`. Here's how to use it: + + First, make your queue. + + FMDatabaseQueue *queue = [FMDatabaseQueue databaseQueueWithPath:aPath]; + + Then use it like so: + + [queue inDatabase:^(FMDatabase *db) { + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]]; + + FMResultSet *rs = [db executeQuery:@"select * from foo"]; + while ([rs next]) { + //… + } + }]; + + An easy way to wrap things up in a transaction can be done like this: + + [queue inTransaction:^(FMDatabase *db, BOOL *rollback) { + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:1]]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:2]]; + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:3]]; + + if (whoopsSomethingWrongHappened) { + *rollback = YES; + return; + } + // etc… + [db executeUpdate:@"INSERT INTO myTable VALUES (?)", [NSNumber numberWithInt:4]]; + }]; + + `FMDatabaseQueue` will run the blocks on a serialized queue (hence the name of the class). So if you call `FMDatabaseQueue`'s methods from multiple threads at the same time, they will be executed in the order they are received. This way queries and updates won't step on each other's toes, and every one is happy. + + ### See also + + - `` + + @warning Do not instantiate a single `` object and use it across multiple threads. Use `FMDatabaseQueue` instead. + + @warning The calls to `FMDatabaseQueue`'s methods are blocking. So even though you are passing along blocks, they will **not** be run on another thread. + + */ + +@interface FMDatabaseQueue : NSObject { + NSString *_path; + dispatch_queue_t _queue; + FMDatabase *_db; + int _openFlags; +} + +/** Path of database */ + +@property (atomic, retain) NSString *path; + +/** Open flags */ + +@property (atomic, readonly) int openFlags; + +///---------------------------------------------------- +/// @name Initialization, opening, and closing of queue +///---------------------------------------------------- + +/** Create queue using path. + + @param aPath The file path of the database. + + @return The `FMDatabaseQueue` object. `nil` on error. + */ + ++ (instancetype)databaseQueueWithPath:(NSString*)aPath; + +/** Create queue using path and specified flags. + + @param aPath The file path of the database. + @param openFlags Flags passed to the openWithFlags method of the database + + @return The `FMDatabaseQueue` object. `nil` on error. + */ ++ (instancetype)databaseQueueWithPath:(NSString*)aPath flags:(int)openFlags; + +/** Create queue using path. + + @param aPath The file path of the database. + + @return The `FMDatabaseQueue` object. `nil` on error. + */ + +- (instancetype)initWithPath:(NSString*)aPath; + +/** Create queue using path and specified flags. + + @param aPath The file path of the database. + @param openFlags Flags passed to the openWithFlags method of the database + + @return The `FMDatabaseQueue` object. `nil` on error. + */ + +- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags; + +/** Create queue using path and specified flags. + + @param aPath The file path of the database. + @param openFlags Flags passed to the openWithFlags method of the database + @param vfsName The name of a custom virtual file system + + @return The `FMDatabaseQueue` object. `nil` on error. + */ + +- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName; + +/** Returns the Class of 'FMDatabase' subclass, that will be used to instantiate database object. + + Subclasses can override this method to return specified Class of 'FMDatabase' subclass. + + @return The Class of 'FMDatabase' subclass, that will be used to instantiate database object. + */ + ++ (Class)databaseClass; + +/** Close database used by queue. */ + +- (void)close; + +///----------------------------------------------- +/// @name Dispatching database operations to queue +///----------------------------------------------- + +/** Synchronously perform database operations on queue. + + @param block The code to be run on the queue of `FMDatabaseQueue` + */ + +- (void)inDatabase:(void (^)(FMDatabase *db))block; + +/** Synchronously perform database operations on queue, using transactions. + + @param block The code to be run on the queue of `FMDatabaseQueue` + */ + +- (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; + +/** Synchronously perform database operations on queue, using deferred transactions. + + @param block The code to be run on the queue of `FMDatabaseQueue` + */ + +- (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block; + +///----------------------------------------------- +/// @name Dispatching database operations to queue +///----------------------------------------------- + +/** Synchronously perform database operations using save point. + + @param block The code to be run on the queue of `FMDatabaseQueue` + */ + +// NOTE: you can not nest these, since calling it will pull another database out of the pool and you'll get a deadlock. +// If you need to nest, use FMDatabase's startSavePointWithName:error: instead. +- (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block; + +@end + diff --git a/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m b/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m new file mode 100644 index 0000000..c877a34 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMDatabaseQueue.m @@ -0,0 +1,245 @@ +// +// FMDatabaseQueue.m +// fmdb +// +// Created by August Mueller on 6/22/11. +// Copyright 2011 Flying Meat Inc. All rights reserved. +// + +#import "FMDatabaseQueue.h" +#import "FMDatabase.h" + +#if FMDB_SQLITE_STANDALONE +#import +#else +#import +#endif + +/* + + Note: we call [self retain]; before using dispatch_sync, just incase + FMDatabaseQueue is released on another thread and we're in the middle of doing + something in dispatch_sync + + */ + +/* + * A key used to associate the FMDatabaseQueue object with the dispatch_queue_t it uses. + * This in turn is used for deadlock detection by seeing if inDatabase: is called on + * the queue's dispatch queue, which should not happen and causes a deadlock. + */ +static const void * const kDispatchQueueSpecificKey = &kDispatchQueueSpecificKey; + +@implementation FMDatabaseQueue + +@synthesize path = _path; +@synthesize openFlags = _openFlags; + ++ (instancetype)databaseQueueWithPath:(NSString*)aPath { + + FMDatabaseQueue *q = [[self alloc] initWithPath:aPath]; + + FMDBAutorelease(q); + + return q; +} + ++ (instancetype)databaseQueueWithPath:(NSString*)aPath flags:(int)openFlags { + + FMDatabaseQueue *q = [[self alloc] initWithPath:aPath flags:openFlags]; + + FMDBAutorelease(q); + + return q; +} + ++ (Class)databaseClass { + return [FMDatabase class]; +} + +- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags vfs:(NSString *)vfsName { + + self = [super init]; + + if (self != nil) { + + _db = [[[self class] databaseClass] databaseWithPath:aPath]; + FMDBRetain(_db); + +#if SQLITE_VERSION_NUMBER >= 3005000 + BOOL success = [_db openWithFlags:openFlags vfs:vfsName]; +#else + BOOL success = [_db open]; +#endif + if (!success) { + NSLog(@"Could not create database queue for path %@", aPath); + FMDBRelease(self); + return 0x00; + } + + _path = FMDBReturnRetained(aPath); + + _queue = dispatch_queue_create([[NSString stringWithFormat:@"fmdb.%@", self] UTF8String], NULL); + dispatch_queue_set_specific(_queue, kDispatchQueueSpecificKey, (__bridge void *)self, NULL); + _openFlags = openFlags; + } + + return self; +} + +- (instancetype)initWithPath:(NSString*)aPath flags:(int)openFlags { + return [self initWithPath:aPath flags:openFlags vfs:nil]; +} + +- (instancetype)initWithPath:(NSString*)aPath { + + // default flags for sqlite3_open + return [self initWithPath:aPath flags:SQLITE_OPEN_READWRITE | SQLITE_OPEN_CREATE vfs:nil]; +} + +- (instancetype)init { + return [self initWithPath:nil]; +} + + +- (void)dealloc { + + FMDBRelease(_db); + FMDBRelease(_path); + + if (_queue) { + FMDBDispatchQueueRelease(_queue); + _queue = 0x00; + } +#if ! __has_feature(objc_arc) + [super dealloc]; +#endif +} + +- (void)close { + FMDBRetain(self); + dispatch_sync(_queue, ^() { + [self->_db close]; + FMDBRelease(_db); + self->_db = 0x00; + }); + FMDBRelease(self); +} + +- (FMDatabase*)database { + if (!_db) { + _db = FMDBReturnRetained([FMDatabase databaseWithPath:_path]); + +#if SQLITE_VERSION_NUMBER >= 3005000 + BOOL success = [_db openWithFlags:_openFlags]; +#else + BOOL success = [_db open]; +#endif + if (!success) { + NSLog(@"FMDatabaseQueue could not reopen database for path %@", _path); + FMDBRelease(_db); + _db = 0x00; + return 0x00; + } + } + + return _db; +} + +- (void)inDatabase:(void (^)(FMDatabase *db))block { + /* Get the currently executing queue (which should probably be nil, but in theory could be another DB queue + * and then check it against self to make sure we're not about to deadlock. */ + FMDatabaseQueue *currentSyncQueue = (__bridge id)dispatch_get_specific(kDispatchQueueSpecificKey); + assert(currentSyncQueue != self && "inDatabase: was called reentrantly on the same queue, which would lead to a deadlock"); + + FMDBRetain(self); + + dispatch_sync(_queue, ^() { + + FMDatabase *db = [self database]; + block(db); + + if ([db hasOpenResultSets]) { + NSLog(@"Warning: there is at least one open result set around after performing [FMDatabaseQueue inDatabase:]"); + +#if defined(DEBUG) && DEBUG + NSSet *openSetCopy = FMDBReturnAutoreleased([[db valueForKey:@"_openResultSets"] copy]); + for (NSValue *rsInWrappedInATastyValueMeal in openSetCopy) { + FMResultSet *rs = (FMResultSet *)[rsInWrappedInATastyValueMeal pointerValue]; + NSLog(@"query: '%@'", [rs query]); + } +#endif + } + }); + + FMDBRelease(self); +} + + +- (void)beginTransaction:(BOOL)useDeferred withBlock:(void (^)(FMDatabase *db, BOOL *rollback))block { + FMDBRetain(self); + dispatch_sync(_queue, ^() { + + BOOL shouldRollback = NO; + + if (useDeferred) { + [[self database] beginDeferredTransaction]; + } + else { + [[self database] beginTransaction]; + } + + block([self database], &shouldRollback); + + if (shouldRollback) { + [[self database] rollback]; + } + else { + [[self database] commit]; + } + }); + + FMDBRelease(self); +} + +- (void)inDeferredTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { + [self beginTransaction:YES withBlock:block]; +} + +- (void)inTransaction:(void (^)(FMDatabase *db, BOOL *rollback))block { + [self beginTransaction:NO withBlock:block]; +} + +- (NSError*)inSavePoint:(void (^)(FMDatabase *db, BOOL *rollback))block { +#if SQLITE_VERSION_NUMBER >= 3007000 + static unsigned long savePointIdx = 0; + __block NSError *err = 0x00; + FMDBRetain(self); + dispatch_sync(_queue, ^() { + + NSString *name = [NSString stringWithFormat:@"savePoint%ld", savePointIdx++]; + + BOOL shouldRollback = NO; + + if ([[self database] startSavePointWithName:name error:&err]) { + + block([self database], &shouldRollback); + + if (shouldRollback) { + // We need to rollback and release this savepoint to remove it + [[self database] rollbackToSavePointWithName:name error:&err]; + } + [[self database] releaseSavePointWithName:name error:&err]; + + } + }); + FMDBRelease(self); + return err; +#else + NSString *errorMessage = NSLocalizedString(@"Save point functions require SQLite 3.7", nil); + if (self.logsErrors) NSLog(@"%@", errorMessage); + return [NSError errorWithDomain:@"FMDatabase" code:0 userInfo:@{NSLocalizedDescriptionKey : errorMessage}]; +#endif +} + +@end diff --git a/ios/Pods/FMDB/src/fmdb/FMResultSet.h b/ios/Pods/FMDB/src/fmdb/FMResultSet.h new file mode 100644 index 0000000..af0433b --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMResultSet.h @@ -0,0 +1,468 @@ +#import + +#ifndef __has_feature // Optional. +#define __has_feature(x) 0 // Compatibility with non-clang compilers. +#endif + +#ifndef NS_RETURNS_NOT_RETAINED +#if __has_feature(attribute_ns_returns_not_retained) +#define NS_RETURNS_NOT_RETAINED __attribute__((ns_returns_not_retained)) +#else +#define NS_RETURNS_NOT_RETAINED +#endif +#endif + +@class FMDatabase; +@class FMStatement; + +/** Represents the results of executing a query on an ``. + + ### See also + + - `` + */ + +@interface FMResultSet : NSObject { + FMDatabase *_parentDB; + FMStatement *_statement; + + NSString *_query; + NSMutableDictionary *_columnNameToIndexMap; +} + +///----------------- +/// @name Properties +///----------------- + +/** Executed query */ + +@property (atomic, retain) NSString *query; + +/** `NSMutableDictionary` mapping column names to numeric index */ + +@property (readonly) NSMutableDictionary *columnNameToIndexMap; + +/** `FMStatement` used by result set. */ + +@property (atomic, retain) FMStatement *statement; + +///------------------------------------ +/// @name Creating and closing database +///------------------------------------ + +/** Create result set from `` + + @param statement A `` to be performed + + @param aDB A `` to be used + + @return A `FMResultSet` on success; `nil` on failure + */ + ++ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB; + +/** Close result set */ + +- (void)close; + +- (void)setParentDB:(FMDatabase *)newDb; + +///--------------------------------------- +/// @name Iterating through the result set +///--------------------------------------- + +/** Retrieve next row for result set. + + You must always invoke `next` or `nextWithError` before attempting to access the values returned in a query, even if you're only expecting one. + + @return `YES` if row successfully retrieved; `NO` if end of result set reached + + @see hasAnotherRow + */ + +- (BOOL)next; + +/** Retrieve next row for result set. + + You must always invoke `next` or `nextWithError` before attempting to access the values returned in a query, even if you're only expecting one. + + @param outErr A 'NSError' object to receive any error object (if any). + + @return 'YES' if row successfully retrieved; 'NO' if end of result set reached + + @see hasAnotherRow + */ + +- (BOOL)nextWithError:(NSError **)outErr; + +/** Did the last call to `` succeed in retrieving another row? + + @return `YES` if the last call to `` succeeded in retrieving another record; `NO` if not. + + @see next + + @warning The `hasAnotherRow` method must follow a call to ``. If the previous database interaction was something other than a call to `next`, then this method may return `NO`, whether there is another row of data or not. + */ + +- (BOOL)hasAnotherRow; + +///--------------------------------------------- +/// @name Retrieving information from result set +///--------------------------------------------- + +/** How many columns in result set + + @return Integer value of the number of columns. + */ + +- (int)columnCount; + +/** Column index for column name + + @param columnName `NSString` value of the name of the column. + + @return Zero-based index for column. + */ + +- (int)columnIndexForName:(NSString*)columnName; + +/** Column name for column index + + @param columnIdx Zero-based index for column. + + @return columnName `NSString` value of the name of the column. + */ + +- (NSString*)columnNameForIndex:(int)columnIdx; + +/** Result set integer value for column. + + @param columnName `NSString` value of the name of the column. + + @return `int` value of the result set's column. + */ + +- (int)intForColumn:(NSString*)columnName; + +/** Result set integer value for column. + + @param columnIdx Zero-based index for column. + + @return `int` value of the result set's column. + */ + +- (int)intForColumnIndex:(int)columnIdx; + +/** Result set `long` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `long` value of the result set's column. + */ + +- (long)longForColumn:(NSString*)columnName; + +/** Result set long value for column. + + @param columnIdx Zero-based index for column. + + @return `long` value of the result set's column. + */ + +- (long)longForColumnIndex:(int)columnIdx; + +/** Result set `long long int` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `long long int` value of the result set's column. + */ + +- (long long int)longLongIntForColumn:(NSString*)columnName; + +/** Result set `long long int` value for column. + + @param columnIdx Zero-based index for column. + + @return `long long int` value of the result set's column. + */ + +- (long long int)longLongIntForColumnIndex:(int)columnIdx; + +/** Result set `unsigned long long int` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `unsigned long long int` value of the result set's column. + */ + +- (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName; + +/** Result set `unsigned long long int` value for column. + + @param columnIdx Zero-based index for column. + + @return `unsigned long long int` value of the result set's column. + */ + +- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx; + +/** Result set `BOOL` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `BOOL` value of the result set's column. + */ + +- (BOOL)boolForColumn:(NSString*)columnName; + +/** Result set `BOOL` value for column. + + @param columnIdx Zero-based index for column. + + @return `BOOL` value of the result set's column. + */ + +- (BOOL)boolForColumnIndex:(int)columnIdx; + +/** Result set `double` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `double` value of the result set's column. + + */ + +- (double)doubleForColumn:(NSString*)columnName; + +/** Result set `double` value for column. + + @param columnIdx Zero-based index for column. + + @return `double` value of the result set's column. + + */ + +- (double)doubleForColumnIndex:(int)columnIdx; + +/** Result set `NSString` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `NSString` value of the result set's column. + + */ + +- (NSString*)stringForColumn:(NSString*)columnName; + +/** Result set `NSString` value for column. + + @param columnIdx Zero-based index for column. + + @return `NSString` value of the result set's column. + */ + +- (NSString*)stringForColumnIndex:(int)columnIdx; + +/** Result set `NSDate` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `NSDate` value of the result set's column. + */ + +- (NSDate*)dateForColumn:(NSString*)columnName; + +/** Result set `NSDate` value for column. + + @param columnIdx Zero-based index for column. + + @return `NSDate` value of the result set's column. + + */ + +- (NSDate*)dateForColumnIndex:(int)columnIdx; + +/** Result set `NSData` value for column. + + This is useful when storing binary data in table (such as image or the like). + + @param columnName `NSString` value of the name of the column. + + @return `NSData` value of the result set's column. + + */ + +- (NSData*)dataForColumn:(NSString*)columnName; + +/** Result set `NSData` value for column. + + @param columnIdx Zero-based index for column. + + @return `NSData` value of the result set's column. + */ + +- (NSData*)dataForColumnIndex:(int)columnIdx; + +/** Result set `(const unsigned char *)` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `(const unsigned char *)` value of the result set's column. + */ + +- (const unsigned char *)UTF8StringForColumnName:(NSString*)columnName; + +/** Result set `(const unsigned char *)` value for column. + + @param columnIdx Zero-based index for column. + + @return `(const unsigned char *)` value of the result set's column. + */ + +- (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx; + +/** Result set object for column. + + @param columnName `NSString` value of the name of the column. + + @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. + + @see objectForKeyedSubscript: + */ + +- (id)objectForColumnName:(NSString*)columnName; + +/** Result set object for column. + + @param columnIdx Zero-based index for column. + + @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. + + @see objectAtIndexedSubscript: + */ + +- (id)objectForColumnIndex:(int)columnIdx; + +/** Result set object for column. + + This method allows the use of the "boxed" syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported: + + id result = rs[@"employee_name"]; + + This simplified syntax is equivalent to calling: + + id result = [rs objectForKeyedSubscript:@"employee_name"]; + + which is, it turns out, equivalent to calling: + + id result = [rs objectForColumnName:@"employee_name"]; + + @param columnName `NSString` value of the name of the column. + + @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. + */ + +- (id)objectForKeyedSubscript:(NSString *)columnName; + +/** Result set object for column. + + This method allows the use of the "boxed" syntax supported in Modern Objective-C. For example, by defining this method, the following syntax is now supported: + + id result = rs[0]; + + This simplified syntax is equivalent to calling: + + id result = [rs objectForKeyedSubscript:0]; + + which is, it turns out, equivalent to calling: + + id result = [rs objectForColumnName:0]; + + @param columnIdx Zero-based index for column. + + @return Either `NSNumber`, `NSString`, `NSData`, or `NSNull`. If the column was `NULL`, this returns `[NSNull null]` object. + */ + +- (id)objectAtIndexedSubscript:(int)columnIdx; + +/** Result set `NSData` value for column. + + @param columnName `NSString` value of the name of the column. + + @return `NSData` value of the result set's column. + + @warning If you are going to use this data after you iterate over the next row, or after you close the +result set, make sure to make a copy of the data first (or just use ``/``) +If you don't, you're going to be in a world of hurt when you try and use the data. + + */ + +- (NSData*)dataNoCopyForColumn:(NSString*)columnName NS_RETURNS_NOT_RETAINED; + +/** Result set `NSData` value for column. + + @param columnIdx Zero-based index for column. + + @return `NSData` value of the result set's column. + + @warning If you are going to use this data after you iterate over the next row, or after you close the + result set, make sure to make a copy of the data first (or just use ``/``) + If you don't, you're going to be in a world of hurt when you try and use the data. + + */ + +- (NSData*)dataNoCopyForColumnIndex:(int)columnIdx NS_RETURNS_NOT_RETAINED; + +/** Is the column `NULL`? + + @param columnIdx Zero-based index for column. + + @return `YES` if column is `NULL`; `NO` if not `NULL`. + */ + +- (BOOL)columnIndexIsNull:(int)columnIdx; + +/** Is the column `NULL`? + + @param columnName `NSString` value of the name of the column. + + @return `YES` if column is `NULL`; `NO` if not `NULL`. + */ + +- (BOOL)columnIsNull:(NSString*)columnName; + + +/** Returns a dictionary of the row results mapped to case sensitive keys of the column names. + + @returns `NSDictionary` of the row results. + + @warning The keys to the dictionary are case sensitive of the column names. + */ + +- (NSDictionary*)resultDictionary; + +/** Returns a dictionary of the row results + + @see resultDictionary + + @warning **Deprecated**: Please use `` instead. Also, beware that `` is case sensitive! + */ + +- (NSDictionary*)resultDict __attribute__ ((deprecated)); + +///----------------------------- +/// @name Key value coding magic +///----------------------------- + +/** Performs `setValue` to yield support for key value observing. + + @param object The object for which the values will be set. This is the key-value-coding compliant object that you might, for example, observe. + + */ + +- (void)kvcMagic:(id)object; + + +@end + diff --git a/ios/Pods/FMDB/src/fmdb/FMResultSet.m b/ios/Pods/FMDB/src/fmdb/FMResultSet.m new file mode 100644 index 0000000..cfc51e1 --- /dev/null +++ b/ios/Pods/FMDB/src/fmdb/FMResultSet.m @@ -0,0 +1,422 @@ +#import "FMResultSet.h" +#import "FMDatabase.h" +#import "unistd.h" + +#if FMDB_SQLITE_STANDALONE +#import +#else +#import +#endif + +@interface FMDatabase () +- (void)resultSetDidClose:(FMResultSet *)resultSet; +@end + + +@implementation FMResultSet +@synthesize query=_query; +@synthesize statement=_statement; + ++ (instancetype)resultSetWithStatement:(FMStatement *)statement usingParentDatabase:(FMDatabase*)aDB { + + FMResultSet *rs = [[FMResultSet alloc] init]; + + [rs setStatement:statement]; + [rs setParentDB:aDB]; + + NSParameterAssert(![statement inUse]); + [statement setInUse:YES]; // weak reference + + return FMDBReturnAutoreleased(rs); +} + +- (void)finalize { + [self close]; + [super finalize]; +} + +- (void)dealloc { + [self close]; + + FMDBRelease(_query); + _query = nil; + + FMDBRelease(_columnNameToIndexMap); + _columnNameToIndexMap = nil; + +#if ! __has_feature(objc_arc) + [super dealloc]; +#endif +} + +- (void)close { + [_statement reset]; + FMDBRelease(_statement); + _statement = nil; + + // we don't need this anymore... (i think) + //[_parentDB setInUse:NO]; + [_parentDB resultSetDidClose:self]; + _parentDB = nil; +} + +- (int)columnCount { + return sqlite3_column_count([_statement statement]); +} + +- (NSMutableDictionary *)columnNameToIndexMap { + if (!_columnNameToIndexMap) { + int columnCount = sqlite3_column_count([_statement statement]); + _columnNameToIndexMap = [[NSMutableDictionary alloc] initWithCapacity:(NSUInteger)columnCount]; + int columnIdx = 0; + for (columnIdx = 0; columnIdx < columnCount; columnIdx++) { + [_columnNameToIndexMap setObject:[NSNumber numberWithInt:columnIdx] + forKey:[[NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)] lowercaseString]]; + } + } + return _columnNameToIndexMap; +} + +- (void)kvcMagic:(id)object { + + int columnCount = sqlite3_column_count([_statement statement]); + + int columnIdx = 0; + for (columnIdx = 0; columnIdx < columnCount; columnIdx++) { + + const char *c = (const char *)sqlite3_column_text([_statement statement], columnIdx); + + // check for a null row + if (c) { + NSString *s = [NSString stringWithUTF8String:c]; + + [object setValue:s forKey:[NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)]]; + } + } +} + +#pragma clang diagnostic push +#pragma clang diagnostic ignored "-Wdeprecated-implementations" + +- (NSDictionary*)resultDict { + + NSUInteger num_cols = (NSUInteger)sqlite3_data_count([_statement statement]); + + if (num_cols > 0) { + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:num_cols]; + + NSEnumerator *columnNames = [[self columnNameToIndexMap] keyEnumerator]; + NSString *columnName = nil; + while ((columnName = [columnNames nextObject])) { + id objectValue = [self objectForColumnName:columnName]; + [dict setObject:objectValue forKey:columnName]; + } + + return FMDBReturnAutoreleased([dict copy]); + } + else { + NSLog(@"Warning: There seem to be no columns in this set."); + } + + return nil; +} + +#pragma clang diagnostic pop + +- (NSDictionary*)resultDictionary { + + NSUInteger num_cols = (NSUInteger)sqlite3_data_count([_statement statement]); + + if (num_cols > 0) { + NSMutableDictionary *dict = [NSMutableDictionary dictionaryWithCapacity:num_cols]; + + int columnCount = sqlite3_column_count([_statement statement]); + + int columnIdx = 0; + for (columnIdx = 0; columnIdx < columnCount; columnIdx++) { + + NSString *columnName = [NSString stringWithUTF8String:sqlite3_column_name([_statement statement], columnIdx)]; + id objectValue = [self objectForColumnIndex:columnIdx]; + [dict setObject:objectValue forKey:columnName]; + } + + return dict; + } + else { + NSLog(@"Warning: There seem to be no columns in this set."); + } + + return nil; +} + + + + +- (BOOL)next { + return [self nextWithError:nil]; +} + +- (BOOL)nextWithError:(NSError **)outErr { + + int rc = sqlite3_step([_statement statement]); + + if (SQLITE_BUSY == rc || SQLITE_LOCKED == rc) { + NSLog(@"%s:%d Database busy (%@)", __FUNCTION__, __LINE__, [_parentDB databasePath]); + NSLog(@"Database busy"); + if (outErr) { + *outErr = [_parentDB lastError]; + } + } + else if (SQLITE_DONE == rc || SQLITE_ROW == rc) { + // all is well, let's return. + } + else if (SQLITE_ERROR == rc) { + NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); + if (outErr) { + *outErr = [_parentDB lastError]; + } + } + else if (SQLITE_MISUSE == rc) { + // uh oh. + NSLog(@"Error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); + if (outErr) { + if (_parentDB) { + *outErr = [_parentDB lastError]; + } + else { + // If 'next' or 'nextWithError' is called after the result set is closed, + // we need to return the appropriate error. + NSDictionary* errorMessage = [NSDictionary dictionaryWithObject:@"parentDB does not exist" forKey:NSLocalizedDescriptionKey]; + *outErr = [NSError errorWithDomain:@"FMDatabase" code:SQLITE_MISUSE userInfo:errorMessage]; + } + + } + } + else { + // wtf? + NSLog(@"Unknown error calling sqlite3_step (%d: %s) rs", rc, sqlite3_errmsg([_parentDB sqliteHandle])); + if (outErr) { + *outErr = [_parentDB lastError]; + } + } + + + if (rc != SQLITE_ROW) { + [self close]; + } + + return (rc == SQLITE_ROW); +} + +- (BOOL)hasAnotherRow { + return sqlite3_errcode([_parentDB sqliteHandle]) == SQLITE_ROW; +} + +- (int)columnIndexForName:(NSString*)columnName { + columnName = [columnName lowercaseString]; + + NSNumber *n = [[self columnNameToIndexMap] objectForKey:columnName]; + + if (n) { + return [n intValue]; + } + + NSLog(@"Warning: I could not find the column named '%@'.", columnName); + + return -1; +} + + + +- (int)intForColumn:(NSString*)columnName { + return [self intForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (int)intForColumnIndex:(int)columnIdx { + return sqlite3_column_int([_statement statement], columnIdx); +} + +- (long)longForColumn:(NSString*)columnName { + return [self longForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (long)longForColumnIndex:(int)columnIdx { + return (long)sqlite3_column_int64([_statement statement], columnIdx); +} + +- (long long int)longLongIntForColumn:(NSString*)columnName { + return [self longLongIntForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (long long int)longLongIntForColumnIndex:(int)columnIdx { + return sqlite3_column_int64([_statement statement], columnIdx); +} + +- (unsigned long long int)unsignedLongLongIntForColumn:(NSString*)columnName { + return [self unsignedLongLongIntForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (unsigned long long int)unsignedLongLongIntForColumnIndex:(int)columnIdx { + return (unsigned long long int)[self longLongIntForColumnIndex:columnIdx]; +} + +- (BOOL)boolForColumn:(NSString*)columnName { + return [self boolForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (BOOL)boolForColumnIndex:(int)columnIdx { + return ([self intForColumnIndex:columnIdx] != 0); +} + +- (double)doubleForColumn:(NSString*)columnName { + return [self doubleForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (double)doubleForColumnIndex:(int)columnIdx { + return sqlite3_column_double([_statement statement], columnIdx); +} + +- (NSString*)stringForColumnIndex:(int)columnIdx { + + if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { + return nil; + } + + const char *c = (const char *)sqlite3_column_text([_statement statement], columnIdx); + + if (!c) { + // null row. + return nil; + } + + return [NSString stringWithUTF8String:c]; +} + +- (NSString*)stringForColumn:(NSString*)columnName { + return [self stringForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (NSDate*)dateForColumn:(NSString*)columnName { + return [self dateForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (NSDate*)dateForColumnIndex:(int)columnIdx { + + if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { + return nil; + } + + return [_parentDB hasDateFormatter] ? [_parentDB dateFromString:[self stringForColumnIndex:columnIdx]] : [NSDate dateWithTimeIntervalSince1970:[self doubleForColumnIndex:columnIdx]]; +} + + +- (NSData*)dataForColumn:(NSString*)columnName { + return [self dataForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (NSData*)dataForColumnIndex:(int)columnIdx { + + if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { + return nil; + } + + const char *dataBuffer = sqlite3_column_blob([_statement statement], columnIdx); + int dataSize = sqlite3_column_bytes([_statement statement], columnIdx); + + if (dataBuffer == NULL) { + return nil; + } + + return [NSData dataWithBytes:(const void *)dataBuffer length:(NSUInteger)dataSize]; +} + + +- (NSData*)dataNoCopyForColumn:(NSString*)columnName { + return [self dataNoCopyForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (NSData*)dataNoCopyForColumnIndex:(int)columnIdx { + + if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { + return nil; + } + + const char *dataBuffer = sqlite3_column_blob([_statement statement], columnIdx); + int dataSize = sqlite3_column_bytes([_statement statement], columnIdx); + + NSData *data = [NSData dataWithBytesNoCopy:(void *)dataBuffer length:(NSUInteger)dataSize freeWhenDone:NO]; + + return data; +} + + +- (BOOL)columnIndexIsNull:(int)columnIdx { + return sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL; +} + +- (BOOL)columnIsNull:(NSString*)columnName { + return [self columnIndexIsNull:[self columnIndexForName:columnName]]; +} + +- (const unsigned char *)UTF8StringForColumnIndex:(int)columnIdx { + + if (sqlite3_column_type([_statement statement], columnIdx) == SQLITE_NULL || (columnIdx < 0)) { + return nil; + } + + return sqlite3_column_text([_statement statement], columnIdx); +} + +- (const unsigned char *)UTF8StringForColumnName:(NSString*)columnName { + return [self UTF8StringForColumnIndex:[self columnIndexForName:columnName]]; +} + +- (id)objectForColumnIndex:(int)columnIdx { + int columnType = sqlite3_column_type([_statement statement], columnIdx); + + id returnValue = nil; + + if (columnType == SQLITE_INTEGER) { + returnValue = [NSNumber numberWithLongLong:[self longLongIntForColumnIndex:columnIdx]]; + } + else if (columnType == SQLITE_FLOAT) { + returnValue = [NSNumber numberWithDouble:[self doubleForColumnIndex:columnIdx]]; + } + else if (columnType == SQLITE_BLOB) { + returnValue = [self dataForColumnIndex:columnIdx]; + } + else { + //default to a string for everything else + returnValue = [self stringForColumnIndex:columnIdx]; + } + + if (returnValue == nil) { + returnValue = [NSNull null]; + } + + return returnValue; +} + +- (id)objectForColumnName:(NSString*)columnName { + return [self objectForColumnIndex:[self columnIndexForName:columnName]]; +} + +// returns autoreleased NSString containing the name of the column in the result set +- (NSString*)columnNameForIndex:(int)columnIdx { + return [NSString stringWithUTF8String: sqlite3_column_name([_statement statement], columnIdx)]; +} + +- (void)setParentDB:(FMDatabase *)newDb { + _parentDB = newDb; +} + +- (id)objectAtIndexedSubscript:(int)columnIdx { + return [self objectForColumnIndex:columnIdx]; +} + +- (id)objectForKeyedSubscript:(NSString *)columnName { + return [self objectForColumnName:columnName]; +} + + +@end diff --git a/ios/Pods/Headers/Private/FMDB/FMDB.h b/ios/Pods/Headers/Private/FMDB/FMDB.h new file mode 120000 index 0000000..bcd6e0a --- /dev/null +++ b/ios/Pods/Headers/Private/FMDB/FMDB.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDB.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/FMDB/FMDatabase.h b/ios/Pods/Headers/Private/FMDB/FMDatabase.h new file mode 120000 index 0000000..e69b333 --- /dev/null +++ b/ios/Pods/Headers/Private/FMDB/FMDatabase.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabase.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/FMDB/FMDatabaseAdditions.h b/ios/Pods/Headers/Private/FMDB/FMDatabaseAdditions.h new file mode 120000 index 0000000..b48a6a3 --- /dev/null +++ b/ios/Pods/Headers/Private/FMDB/FMDatabaseAdditions.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabaseAdditions.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/FMDB/FMDatabasePool.h b/ios/Pods/Headers/Private/FMDB/FMDatabasePool.h new file mode 120000 index 0000000..1d78001 --- /dev/null +++ b/ios/Pods/Headers/Private/FMDB/FMDatabasePool.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabasePool.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/FMDB/FMDatabaseQueue.h b/ios/Pods/Headers/Private/FMDB/FMDatabaseQueue.h new file mode 120000 index 0000000..9adde87 --- /dev/null +++ b/ios/Pods/Headers/Private/FMDB/FMDatabaseQueue.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabaseQueue.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/FMDB/FMResultSet.h b/ios/Pods/Headers/Private/FMDB/FMResultSet.h new file mode 120000 index 0000000..fd761d8 --- /dev/null +++ b/ios/Pods/Headers/Private/FMDB/FMResultSet.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMResultSet.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/path_provider/PathProviderPlugin.h b/ios/Pods/Headers/Private/path_provider/PathProviderPlugin.h new file mode 120000 index 0000000..192e213 --- /dev/null +++ b/ios/Pods/Headers/Private/path_provider/PathProviderPlugin.h @@ -0,0 +1 @@ +../../../../../../../../.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios/Classes/PathProviderPlugin.h \ No newline at end of file diff --git a/ios/Pods/Headers/Private/sqflite/SqflitePlugin.h b/ios/Pods/Headers/Private/sqflite/SqflitePlugin.h new file mode 120000 index 0000000..17c8f96 --- /dev/null +++ b/ios/Pods/Headers/Private/sqflite/SqflitePlugin.h @@ -0,0 +1 @@ +../../../../../../../../.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios/Classes/SqflitePlugin.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/FMDB/FMDB.h b/ios/Pods/Headers/Public/FMDB/FMDB.h new file mode 120000 index 0000000..bcd6e0a --- /dev/null +++ b/ios/Pods/Headers/Public/FMDB/FMDB.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDB.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/FMDB/FMDatabase.h b/ios/Pods/Headers/Public/FMDB/FMDatabase.h new file mode 120000 index 0000000..e69b333 --- /dev/null +++ b/ios/Pods/Headers/Public/FMDB/FMDatabase.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabase.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/FMDB/FMDatabaseAdditions.h b/ios/Pods/Headers/Public/FMDB/FMDatabaseAdditions.h new file mode 120000 index 0000000..b48a6a3 --- /dev/null +++ b/ios/Pods/Headers/Public/FMDB/FMDatabaseAdditions.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabaseAdditions.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/FMDB/FMDatabasePool.h b/ios/Pods/Headers/Public/FMDB/FMDatabasePool.h new file mode 120000 index 0000000..1d78001 --- /dev/null +++ b/ios/Pods/Headers/Public/FMDB/FMDatabasePool.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabasePool.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/FMDB/FMDatabaseQueue.h b/ios/Pods/Headers/Public/FMDB/FMDatabaseQueue.h new file mode 120000 index 0000000..9adde87 --- /dev/null +++ b/ios/Pods/Headers/Public/FMDB/FMDatabaseQueue.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMDatabaseQueue.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/FMDB/FMResultSet.h b/ios/Pods/Headers/Public/FMDB/FMResultSet.h new file mode 120000 index 0000000..fd761d8 --- /dev/null +++ b/ios/Pods/Headers/Public/FMDB/FMResultSet.h @@ -0,0 +1 @@ +../../../FMDB/src/fmdb/FMResultSet.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h b/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h new file mode 120000 index 0000000..35e529a --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/Flutter.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/Flutter.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h new file mode 120000 index 0000000..b819c0c --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterAppDelegate.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterAppDelegate.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterBinaryMessenger.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterBinaryMessenger.h new file mode 120000 index 0000000..5571a1f --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterBinaryMessenger.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterBinaryMessenger.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterChannels.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterChannels.h new file mode 120000 index 0000000..a3bec73 --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterChannels.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterChannels.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterCodecs.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterCodecs.h new file mode 120000 index 0000000..8c3a8a9 --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterCodecs.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterCodecs.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterDartProject.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterDartProject.h new file mode 120000 index 0000000..44496cf --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterDartProject.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterDartProject.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterMacros.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterMacros.h new file mode 120000 index 0000000..8b35b8a --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterMacros.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterMacros.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterNavigationController.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterNavigationController.h new file mode 120000 index 0000000..0a2595b --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterNavigationController.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterNavigationController.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h new file mode 120000 index 0000000..7313dd0 --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterPlugin.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterPlugin.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h new file mode 120000 index 0000000..97b81db --- /dev/null +++ b/ios/Pods/Headers/Public/Flutter/Flutter/FlutterViewController.h @@ -0,0 +1 @@ +../../../../../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework/Headers/FlutterViewController.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/path_provider/PathProviderPlugin.h b/ios/Pods/Headers/Public/path_provider/PathProviderPlugin.h new file mode 120000 index 0000000..192e213 --- /dev/null +++ b/ios/Pods/Headers/Public/path_provider/PathProviderPlugin.h @@ -0,0 +1 @@ +../../../../../../../../.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios/Classes/PathProviderPlugin.h \ No newline at end of file diff --git a/ios/Pods/Headers/Public/sqflite/SqflitePlugin.h b/ios/Pods/Headers/Public/sqflite/SqflitePlugin.h new file mode 120000 index 0000000..17c8f96 --- /dev/null +++ b/ios/Pods/Headers/Public/sqflite/SqflitePlugin.h @@ -0,0 +1 @@ +../../../../../../../../.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios/Classes/SqflitePlugin.h \ No newline at end of file diff --git a/ios/Pods/Local Podspecs/Flutter.podspec.json b/ios/Pods/Local Podspecs/Flutter.podspec.json new file mode 100644 index 0000000..6f2c0a5 --- /dev/null +++ b/ios/Pods/Local Podspecs/Flutter.podspec.json @@ -0,0 +1,22 @@ +{ + "name": "Flutter", + "version": "1.0.0", + "summary": "High-performance, high-fidelity mobile apps.", + "description": "Flutter provides an easy and productive way to build and deploy high-performance mobile apps for Android and iOS.", + "homepage": "https://flutter.io", + "license": { + "type": "MIT", + "file": "../../../../../LICENSE" + }, + "authors": { + "Flutter Dev Team": "flutter-dev@googlegroups.com" + }, + "source": { + "git": "https://github.com/flutter/engine", + "tag": "1.0.0" + }, + "platforms": { + "ios": "7.0" + }, + "vendored_frameworks": "Flutter.framework" +} diff --git a/ios/Pods/Local Podspecs/path_provider.podspec.json b/ios/Pods/Local Podspecs/path_provider.podspec.json new file mode 100644 index 0000000..f0b7122 --- /dev/null +++ b/ios/Pods/Local Podspecs/path_provider.podspec.json @@ -0,0 +1,26 @@ +{ + "name": "path_provider", + "version": "0.0.1", + "summary": "A Flutter plugin for getting commonly used locations on the filesystem.", + "description": "A Flutter plugin for getting commonly used locations on the filesystem.", + "homepage": "https://github.com/flutter/plugins/tree/master/packages/path_provider", + "license": { + "file": "../LICENSE" + }, + "authors": { + "Flutter Team": "flutter-dev@googlegroups.com" + }, + "source": { + "path": "." + }, + "source_files": "Classes/**/*", + "public_header_files": "Classes/**/*.h", + "dependencies": { + "Flutter": [ + + ] + }, + "platforms": { + "ios": "8.0" + } +} diff --git a/ios/Pods/Local Podspecs/sqflite.podspec.json b/ios/Pods/Local Podspecs/sqflite.podspec.json new file mode 100644 index 0000000..d60790d --- /dev/null +++ b/ios/Pods/Local Podspecs/sqflite.podspec.json @@ -0,0 +1,29 @@ +{ + "name": "sqflite", + "version": "0.0.1", + "summary": "A new flutter plugin project.", + "description": "A new flutter plugin project.", + "homepage": "http://example.com", + "license": { + "file": "../LICENSE" + }, + "authors": { + "Your Company": "email@example.com" + }, + "source": { + "path": "." + }, + "source_files": "Classes/**/*", + "public_header_files": "Classes/**/*.h", + "dependencies": { + "Flutter": [ + + ], + "FMDB": [ + + ] + }, + "platforms": { + "ios": "8.0" + } +} diff --git a/ios/Pods/Manifest.lock b/ios/Pods/Manifest.lock new file mode 100644 index 0000000..162e834 --- /dev/null +++ b/ios/Pods/Manifest.lock @@ -0,0 +1,33 @@ +PODS: + - Flutter (1.0.0) + - FMDB (2.6.2): + - FMDB/standard (= 2.6.2) + - FMDB/standard (2.6.2) + - path_provider (0.0.1): + - Flutter + - sqflite (0.0.1): + - Flutter + - FMDB + +DEPENDENCIES: + - Flutter (from `/Users/ntrlab/flutter/bin/cache/artifacts/engine/ios`) + - path_provider (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios`) + - sqflite (from `/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios`) + +EXTERNAL SOURCES: + Flutter: + :path: /Users/ntrlab/flutter/bin/cache/artifacts/engine/ios + path_provider: + :path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios + sqflite: + :path: /Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios + +SPEC CHECKSUMS: + Flutter: d674e78c937094a75ac71dd77e921e840bea3dbf + FMDB: 854a0341b4726e53276f2a8996f06f1b80f9259a + path_provider: f96fff6166a8867510d2c25fdcc346327cc4b259 + sqflite: 8e2d9fe1e7cdc95d4d537fc7eb2d23c8dc428e3c + +PODFILE CHECKSUM: 351e02e34b831289961ec3558a535cbd2c4965d2 + +COCOAPODS: 1.2.1 diff --git a/ios/Pods/Pods.xcodeproj/project.pbxproj b/ios/Pods/Pods.xcodeproj/project.pbxproj new file mode 100644 index 0000000..c12d3d1 --- /dev/null +++ b/ios/Pods/Pods.xcodeproj/project.pbxproj @@ -0,0 +1,1108 @@ +// !$*UTF8*$! +{ + archiveVersion = 1; + classes = { + }; + objectVersion = 46; + objects = { + +/* Begin PBXBuildFile section */ + 0275983C85B82B8AEF3C4BBEDF6F8F65 /* SqflitePlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = 7878A831C3189C53F8694D4A409DF4BB /* SqflitePlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 05A982FECA099A43B0BC98D622441FAE /* PathProviderPlugin.h in Headers */ = {isa = PBXBuildFile; fileRef = DDBE635D159A4ADB8156E4AE273C9E49 /* PathProviderPlugin.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 0A3AA45E708AEBE5491F112FF86826E6 /* FMResultSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 71B69D4A7150AC2F65A57B7D04F092D4 /* FMResultSet.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 0DDFE649E817E8E428BD87DBFA928B6A /* FMResultSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 69CC8B63F837EA7B053AB8BA07253A25 /* FMResultSet.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 1FB202F9CC5A6B1BDF544D6331CC65E9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; + 534A2178342F283B51EACFFDFFE40191 /* sqflite-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 28A4A9FB0D0A182DC4FA1A52EEE5A781 /* sqflite-dummy.m */; }; + 5E4CF03E66D6F8A4740E7E79DEB429BD /* FMDatabasePool.m in Sources */ = {isa = PBXBuildFile; fileRef = 400AFB42920EB39709666D3F1A73D6C2 /* FMDatabasePool.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 5F3656EE3D432CA623783D4CF342F0D8 /* Pods-Runner-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 1086A466F3A8C5B95BB9FFDFF3E7C0C7 /* Pods-Runner-dummy.m */; }; + 6CBBBD55FA103C4CDEB6D91AF00CD1B8 /* FMDatabasePool.h in Headers */ = {isa = PBXBuildFile; fileRef = 1AF3AEDDA16DD8E28B59FF0788FDDC03 /* FMDatabasePool.h */; settings = {ATTRIBUTES = (Public, ); }; }; + 731E8A5B80ABFB6037EE3757A840E7EE /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; + 81DC828A0B2DBF6E914B43538C678149 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; + 885FA5A8E4062F05235E1BB351829299 /* FMDatabaseAdditions.m in Sources */ = {isa = PBXBuildFile; fileRef = 3BCC0EED53ED8D7C1931178E0E4269B4 /* FMDatabaseAdditions.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + 964F7658C2F163B024D944143BA2B366 /* FMDatabase.m in Sources */ = {isa = PBXBuildFile; fileRef = DC7C30F9E55829B027C4913D1F19D68C /* FMDatabase.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + A44C9EAA45872D379216F27269E493F1 /* FMDatabaseQueue.h in Headers */ = {isa = PBXBuildFile; fileRef = 33F15B71183AD666DFC49D907F769ACF /* FMDatabaseQueue.h */; settings = {ATTRIBUTES = (Public, ); }; }; + CCCE6327D9EB4C3524863A4C9F40A534 /* path_provider-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = B4148ABD1497F8FBFADB22835D30BAEC /* path_provider-dummy.m */; }; + DBC373403E0C92A8A2C4BC2D4614A5F2 /* FMDatabaseAdditions.h in Headers */ = {isa = PBXBuildFile; fileRef = D2DD52CB174E1DC79111C38E770F6FC8 /* FMDatabaseAdditions.h */; settings = {ATTRIBUTES = (Public, ); }; }; + DC2DD5729CD216714D698D25901C2214 /* FMDatabaseQueue.m in Sources */ = {isa = PBXBuildFile; fileRef = C11A8F38580C7A7FF38ACB6A3B412884 /* FMDatabaseQueue.m */; settings = {COMPILER_FLAGS = "-DOS_OBJECT_USE_OBJC=0"; }; }; + F4B3EA658E75B0E535C3DEFE24148F0C /* FMDB.h in Headers */ = {isa = PBXBuildFile; fileRef = 91893D40185E0EFA40FC217BE44A7C0D /* FMDB.h */; settings = {ATTRIBUTES = (Public, ); }; }; + F6B5EEC2E3BC8722930840274D92FDC9 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */; }; + F703EABB9F02DB9BBD35F2898762FF82 /* FMDB-dummy.m in Sources */ = {isa = PBXBuildFile; fileRef = 6D76813CB39ACC402A9EE3DC12B4E682 /* FMDB-dummy.m */; }; + F758CC216AD6D5080A98A5C906D21B8F /* SqflitePlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 64BB5E713CC04A7119E1210E71851C9D /* SqflitePlugin.m */; }; + FE229C815FB3207DEA535129B9A252ED /* FMDatabase.h in Headers */ = {isa = PBXBuildFile; fileRef = 638E465E4B27490B0FB423614C3ADD11 /* FMDatabase.h */; settings = {ATTRIBUTES = (Public, ); }; }; + FFE88F263143BC1EEE55869071E74417 /* PathProviderPlugin.m in Sources */ = {isa = PBXBuildFile; fileRef = 70FD3C19BD756442AF61E1654A40F400 /* PathProviderPlugin.m */; }; +/* End PBXBuildFile section */ + +/* Begin PBXContainerItemProxy section */ + 252BB7AED6C04DAC85EF7E1F570DE6AC /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1749C1BD4B48236EAC7E2B8B03365028; + remoteInfo = FMDB; + }; + 390F2857FFCF75A8AEB952F17697D1B7 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 8944BF05BFD79D97D838CC043D5F737A; + remoteInfo = sqflite; + }; + 7E2FFC2CFE997942328BDACF01A8FE55 /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = 1749C1BD4B48236EAC7E2B8B03365028; + remoteInfo = FMDB; + }; + 8BDBB193AD09EBE36526DF24B4F56DBD /* PBXContainerItemProxy */ = { + isa = PBXContainerItemProxy; + containerPortal = D41D8CD98F00B204E9800998ECF8427E /* Project object */; + proxyType = 1; + remoteGlobalIDString = D597B65EAF1279E7C5637291B916DDC5; + remoteInfo = path_provider; + }; +/* End PBXContainerItemProxy section */ + +/* Begin PBXFileReference section */ + 003397356FD1052F1B7B632E25DB1274 /* libFMDB.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libFMDB.a; path = libFMDB.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 01FFC258241FD6531167B29D7C3AABCE /* libpath_provider.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libpath_provider.a; path = libpath_provider.a; sourceTree = BUILT_PRODUCTS_DIR; }; + 1086A466F3A8C5B95BB9FFDFF3E7C0C7 /* Pods-Runner-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "Pods-Runner-dummy.m"; sourceTree = ""; }; + 13A430C21CC24ABE2DEBDDED39FD29B2 /* sqflite-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "sqflite-prefix.pch"; sourceTree = ""; }; + 180AB1F194E38A2A27B5CEB66C9A1F09 /* Pods-Runner-frameworks.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Runner-frameworks.sh"; sourceTree = ""; }; + 1AF05E0413E9C6AC5B6C1DD2880EBDA4 /* path_provider.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = path_provider.xcconfig; sourceTree = ""; }; + 1AF3AEDDA16DD8E28B59FF0788FDDC03 /* FMDatabasePool.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FMDatabasePool.h; path = src/fmdb/FMDatabasePool.h; sourceTree = ""; }; + 28A4A9FB0D0A182DC4FA1A52EEE5A781 /* sqflite-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "sqflite-dummy.m"; sourceTree = ""; }; + 2B7E82CF4D43A0225B18184B7390079D /* Flutter.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Flutter.framework; sourceTree = ""; }; + 33F15B71183AD666DFC49D907F769ACF /* FMDatabaseQueue.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FMDatabaseQueue.h; path = src/fmdb/FMDatabaseQueue.h; sourceTree = ""; }; + 3BCC0EED53ED8D7C1931178E0E4269B4 /* FMDatabaseAdditions.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FMDatabaseAdditions.m; path = src/fmdb/FMDatabaseAdditions.m; sourceTree = ""; }; + 3F8DCA264D4A7E7254305B946F3D73F0 /* Pods-Runner-acknowledgements.markdown */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text; path = "Pods-Runner-acknowledgements.markdown"; sourceTree = ""; }; + 400AFB42920EB39709666D3F1A73D6C2 /* FMDatabasePool.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FMDatabasePool.m; path = src/fmdb/FMDatabasePool.m; sourceTree = ""; }; + 4532A70C1CFAB30C4266017A71B77D1F /* Pods-Runner.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Runner.release.xcconfig"; sourceTree = ""; }; + 5C8299479CF1A66A335CD3BB7C3632ED /* Pods-Runner-resources.sh */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.script.sh; path = "Pods-Runner-resources.sh"; sourceTree = ""; }; + 638E465E4B27490B0FB423614C3ADD11 /* FMDatabase.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FMDatabase.h; path = src/fmdb/FMDatabase.h; sourceTree = ""; }; + 64BB5E713CC04A7119E1210E71851C9D /* SqflitePlugin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = SqflitePlugin.m; sourceTree = ""; }; + 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS10.3.sdk/System/Library/Frameworks/Foundation.framework; sourceTree = DEVELOPER_DIR; }; + 69CC8B63F837EA7B053AB8BA07253A25 /* FMResultSet.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FMResultSet.h; path = src/fmdb/FMResultSet.h; sourceTree = ""; }; + 6D76813CB39ACC402A9EE3DC12B4E682 /* FMDB-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "FMDB-dummy.m"; sourceTree = ""; }; + 70FD3C19BD756442AF61E1654A40F400 /* PathProviderPlugin.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = PathProviderPlugin.m; sourceTree = ""; }; + 71B69D4A7150AC2F65A57B7D04F092D4 /* FMResultSet.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FMResultSet.m; path = src/fmdb/FMResultSet.m; sourceTree = ""; }; + 7878A831C3189C53F8694D4A409DF4BB /* SqflitePlugin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = SqflitePlugin.h; sourceTree = ""; }; + 859495150A1CA9A06BB797FA29E850C3 /* Pods-Runner-acknowledgements.plist */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.plist.xml; path = "Pods-Runner-acknowledgements.plist"; sourceTree = ""; }; + 91893D40185E0EFA40FC217BE44A7C0D /* FMDB.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FMDB.h; path = src/fmdb/FMDB.h; sourceTree = ""; }; + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */ = {isa = PBXFileReference; explicitFileType = text.script.ruby; includeInIndex = 1; lastKnownFileType = text; name = Podfile; path = ../Podfile; sourceTree = SOURCE_ROOT; xcLanguageSpecificationIdentifier = xcode.lang.ruby; }; + 9A5598D552F6A211F42187AC266E1656 /* sqflite.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = sqflite.xcconfig; sourceTree = ""; }; + A1448204AE8E2DC37C8C36438BED7AD8 /* FMDB-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "FMDB-prefix.pch"; sourceTree = ""; }; + A47118E0497C287385E5E40F74B45592 /* libPods-Runner.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = "libPods-Runner.a"; path = "libPods-Runner.a"; sourceTree = BUILT_PRODUCTS_DIR; }; + A52E6E664A33D0ADBF28C096726C8FAA /* libsqflite.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; name = libsqflite.a; path = libsqflite.a; sourceTree = BUILT_PRODUCTS_DIR; }; + B2AC8D08AB9E95E701EC049C53414AEB /* FMDB.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = FMDB.xcconfig; sourceTree = ""; }; + B4148ABD1497F8FBFADB22835D30BAEC /* path_provider-dummy.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; path = "path_provider-dummy.m"; sourceTree = ""; }; + C01D2261DFAB70EC8E5F1A1385D6F66E /* Pods-Runner.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Runner.debug.xcconfig"; sourceTree = ""; }; + C11A8F38580C7A7FF38ACB6A3B412884 /* FMDatabaseQueue.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FMDatabaseQueue.m; path = src/fmdb/FMDatabaseQueue.m; sourceTree = ""; }; + CAA729AA4202C0AC1EA594504353C960 /* Pods-Runner.debug-develop.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; path = "Pods-Runner.debug-develop.xcconfig"; sourceTree = ""; }; + D2DD52CB174E1DC79111C38E770F6FC8 /* FMDatabaseAdditions.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; name = FMDatabaseAdditions.h; path = src/fmdb/FMDatabaseAdditions.h; sourceTree = ""; }; + DC7C30F9E55829B027C4913D1F19D68C /* FMDatabase.m */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.objc; name = FMDatabase.m; path = src/fmdb/FMDatabase.m; sourceTree = ""; }; + DDBE635D159A4ADB8156E4AE273C9E49 /* PathProviderPlugin.h */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = PathProviderPlugin.h; sourceTree = ""; }; + ECBCF167324FE2871ECD876F3BFEE33B /* path_provider-prefix.pch */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = sourcecode.c.h; path = "path_provider-prefix.pch"; sourceTree = ""; }; +/* End PBXFileReference section */ + +/* Begin PBXFrameworksBuildPhase section */ + 2691969551FD49C82DB8BD80506FBE6D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 731E8A5B80ABFB6037EE3757A840E7EE /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 7D97D7AFDFEB2319B71726B0C7C35081 /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + F6B5EEC2E3BC8722930840274D92FDC9 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + C8ECFE49FBB48866AF20945FA64C3E9A /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 81DC828A0B2DBF6E914B43538C678149 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + E77DFBE401E6EB8D3FDB709749F7756D /* Frameworks */ = { + isa = PBXFrameworksBuildPhase; + buildActionMask = 2147483647; + files = ( + 1FB202F9CC5A6B1BDF544D6331CC65E9 /* Foundation.framework in Frameworks */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXFrameworksBuildPhase section */ + +/* Begin PBXGroup section */ + 0F75ACD176A5C14BA253876A7AA1E6A1 /* Support Files */ = { + isa = PBXGroup; + children = ( + 1AF05E0413E9C6AC5B6C1DD2880EBDA4 /* path_provider.xcconfig */, + B4148ABD1497F8FBFADB22835D30BAEC /* path_provider-dummy.m */, + ECBCF167324FE2871ECD876F3BFEE33B /* path_provider-prefix.pch */, + ); + name = "Support Files"; + path = "../../../../../semyon/apps/checker/ios/Pods/Target Support Files/path_provider"; + sourceTree = ""; + }; + 1527F55CD5CF674DE5785233431F1E88 /* sqflite */ = { + isa = PBXGroup; + children = ( + E3783720A5A4431435F84DC6CF63F5E3 /* Classes */, + 81AA7BCFF76E0AFC6AD99A5FE45D0E3B /* Support Files */, + ); + name = sqflite; + path = "/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios"; + sourceTree = ""; + }; + 1A3BC54721BAA16B749DAA153DA8F5A5 /* Targets Support Files */ = { + isa = PBXGroup; + children = ( + 1ED71CDAF10774FBCFDB21E8A5C8D130 /* Pods-Runner */, + ); + name = "Targets Support Files"; + sourceTree = ""; + }; + 1ED71CDAF10774FBCFDB21E8A5C8D130 /* Pods-Runner */ = { + isa = PBXGroup; + children = ( + 3F8DCA264D4A7E7254305B946F3D73F0 /* Pods-Runner-acknowledgements.markdown */, + 859495150A1CA9A06BB797FA29E850C3 /* Pods-Runner-acknowledgements.plist */, + 1086A466F3A8C5B95BB9FFDFF3E7C0C7 /* Pods-Runner-dummy.m */, + 180AB1F194E38A2A27B5CEB66C9A1F09 /* Pods-Runner-frameworks.sh */, + 5C8299479CF1A66A335CD3BB7C3632ED /* Pods-Runner-resources.sh */, + C01D2261DFAB70EC8E5F1A1385D6F66E /* Pods-Runner.debug.xcconfig */, + CAA729AA4202C0AC1EA594504353C960 /* Pods-Runner.debug-develop.xcconfig */, + 4532A70C1CFAB30C4266017A71B77D1F /* Pods-Runner.release.xcconfig */, + ); + name = "Pods-Runner"; + path = "Target Support Files/Pods-Runner"; + sourceTree = ""; + }; + 205E88D3BF9AE11F31224C922CE6E6FE /* Classes */ = { + isa = PBXGroup; + children = ( + DDBE635D159A4ADB8156E4AE273C9E49 /* PathProviderPlugin.h */, + 70FD3C19BD756442AF61E1654A40F400 /* PathProviderPlugin.m */, + ); + name = Classes; + path = Classes; + sourceTree = ""; + }; + 64A6B117D4CD0E751BFC131087154F68 /* Products */ = { + isa = PBXGroup; + children = ( + 003397356FD1052F1B7B632E25DB1274 /* libFMDB.a */, + 01FFC258241FD6531167B29D7C3AABCE /* libpath_provider.a */, + A47118E0497C287385E5E40F74B45592 /* libPods-Runner.a */, + A52E6E664A33D0ADBF28C096726C8FAA /* libsqflite.a */, + ); + name = Products; + sourceTree = ""; + }; + 6A65CEB166911CC900621A37BC272B1F /* Support Files */ = { + isa = PBXGroup; + children = ( + B2AC8D08AB9E95E701EC049C53414AEB /* FMDB.xcconfig */, + 6D76813CB39ACC402A9EE3DC12B4E682 /* FMDB-dummy.m */, + A1448204AE8E2DC37C8C36438BED7AD8 /* FMDB-prefix.pch */, + ); + name = "Support Files"; + path = "../Target Support Files/FMDB"; + sourceTree = ""; + }; + 7DB346D0F39D3F0E887471402A8071AB = { + isa = PBXGroup; + children = ( + 93A4A3777CF96A4AAC1D13BA6DCCEA73 /* Podfile */, + E61F637D2F764F469A104B09B992D3B6 /* Development Pods */, + BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */, + BFB8C92E749ED180124155E2270474D2 /* Pods */, + 64A6B117D4CD0E751BFC131087154F68 /* Products */, + 1A3BC54721BAA16B749DAA153DA8F5A5 /* Targets Support Files */, + ); + sourceTree = ""; + }; + 81AA7BCFF76E0AFC6AD99A5FE45D0E3B /* Support Files */ = { + isa = PBXGroup; + children = ( + 9A5598D552F6A211F42187AC266E1656 /* sqflite.xcconfig */, + 28A4A9FB0D0A182DC4FA1A52EEE5A781 /* sqflite-dummy.m */, + 13A430C21CC24ABE2DEBDDED39FD29B2 /* sqflite-prefix.pch */, + ); + name = "Support Files"; + path = "../../../../../semyon/apps/checker/ios/Pods/Target Support Files/sqflite"; + sourceTree = ""; + }; + 8D4F39B5D75336FD53220C2A6DB6F817 /* Flutter */ = { + isa = PBXGroup; + children = ( + CEA36AAEB26C47C0117B673CBF9DB8A0 /* Frameworks */, + ); + name = Flutter; + path = /Users/ntrlab/flutter/bin/cache/artifacts/engine/ios; + sourceTree = ""; + }; + A18E6292477D80E1AA5C937D7B1562C1 /* path_provider */ = { + isa = PBXGroup; + children = ( + 205E88D3BF9AE11F31224C922CE6E6FE /* Classes */, + 0F75ACD176A5C14BA253876A7AA1E6A1 /* Support Files */, + ); + name = path_provider; + path = "/Users/ntrlab/.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios"; + sourceTree = ""; + }; + BC3CA7F9E30CC8F7E2DD044DD34432FC /* Frameworks */ = { + isa = PBXGroup; + children = ( + D35AF013A5F0BAD4F32504907A52519E /* iOS */, + ); + name = Frameworks; + sourceTree = ""; + }; + BFB8C92E749ED180124155E2270474D2 /* Pods */ = { + isa = PBXGroup; + children = ( + DEA37EDFE575D4B41E183255F5C2B8C8 /* FMDB */, + ); + name = Pods; + sourceTree = ""; + }; + C89A6930D6DE6039F840782BFE7A2DFB /* standard */ = { + isa = PBXGroup; + children = ( + 638E465E4B27490B0FB423614C3ADD11 /* FMDatabase.h */, + DC7C30F9E55829B027C4913D1F19D68C /* FMDatabase.m */, + D2DD52CB174E1DC79111C38E770F6FC8 /* FMDatabaseAdditions.h */, + 3BCC0EED53ED8D7C1931178E0E4269B4 /* FMDatabaseAdditions.m */, + 1AF3AEDDA16DD8E28B59FF0788FDDC03 /* FMDatabasePool.h */, + 400AFB42920EB39709666D3F1A73D6C2 /* FMDatabasePool.m */, + 33F15B71183AD666DFC49D907F769ACF /* FMDatabaseQueue.h */, + C11A8F38580C7A7FF38ACB6A3B412884 /* FMDatabaseQueue.m */, + 91893D40185E0EFA40FC217BE44A7C0D /* FMDB.h */, + 69CC8B63F837EA7B053AB8BA07253A25 /* FMResultSet.h */, + 71B69D4A7150AC2F65A57B7D04F092D4 /* FMResultSet.m */, + ); + name = standard; + sourceTree = ""; + }; + CEA36AAEB26C47C0117B673CBF9DB8A0 /* Frameworks */ = { + isa = PBXGroup; + children = ( + 2B7E82CF4D43A0225B18184B7390079D /* Flutter.framework */, + ); + name = Frameworks; + sourceTree = ""; + }; + D35AF013A5F0BAD4F32504907A52519E /* iOS */ = { + isa = PBXGroup; + children = ( + 6604A7D69453B4569E4E4827FB9155A9 /* Foundation.framework */, + ); + name = iOS; + sourceTree = ""; + }; + DEA37EDFE575D4B41E183255F5C2B8C8 /* FMDB */ = { + isa = PBXGroup; + children = ( + C89A6930D6DE6039F840782BFE7A2DFB /* standard */, + 6A65CEB166911CC900621A37BC272B1F /* Support Files */, + ); + name = FMDB; + path = FMDB; + sourceTree = ""; + }; + E3783720A5A4431435F84DC6CF63F5E3 /* Classes */ = { + isa = PBXGroup; + children = ( + 7878A831C3189C53F8694D4A409DF4BB /* SqflitePlugin.h */, + 64BB5E713CC04A7119E1210E71851C9D /* SqflitePlugin.m */, + ); + name = Classes; + path = Classes; + sourceTree = ""; + }; + E61F637D2F764F469A104B09B992D3B6 /* Development Pods */ = { + isa = PBXGroup; + children = ( + 8D4F39B5D75336FD53220C2A6DB6F817 /* Flutter */, + A18E6292477D80E1AA5C937D7B1562C1 /* path_provider */, + 1527F55CD5CF674DE5785233431F1E88 /* sqflite */, + ); + name = "Development Pods"; + sourceTree = ""; + }; +/* End PBXGroup section */ + +/* Begin PBXHeadersBuildPhase section */ + 6D5F5A8571DEBE7AC0FE0D3455AFBA46 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 05A982FECA099A43B0BC98D622441FAE /* PathProviderPlugin.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 9E575053C725E72B7BAB34F8DAFC6ED9 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + 0275983C85B82B8AEF3C4BBEDF6F8F65 /* SqflitePlugin.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D5650189FDD09F93190F9E91CA770458 /* Headers */ = { + isa = PBXHeadersBuildPhase; + buildActionMask = 2147483647; + files = ( + FE229C815FB3207DEA535129B9A252ED /* FMDatabase.h in Headers */, + DBC373403E0C92A8A2C4BC2D4614A5F2 /* FMDatabaseAdditions.h in Headers */, + 6CBBBD55FA103C4CDEB6D91AF00CD1B8 /* FMDatabasePool.h in Headers */, + A44C9EAA45872D379216F27269E493F1 /* FMDatabaseQueue.h in Headers */, + F4B3EA658E75B0E535C3DEFE24148F0C /* FMDB.h in Headers */, + 0DDFE649E817E8E428BD87DBFA928B6A /* FMResultSet.h in Headers */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXHeadersBuildPhase section */ + +/* Begin PBXNativeTarget section */ + 1749C1BD4B48236EAC7E2B8B03365028 /* FMDB */ = { + isa = PBXNativeTarget; + buildConfigurationList = 7BB2C93DA9F2A87B6FBF78336D22F4E2 /* Build configuration list for PBXNativeTarget "FMDB" */; + buildPhases = ( + 6EF47EAA0B26CBCD573B43FA4A36E6AD /* Sources */, + 2691969551FD49C82DB8BD80506FBE6D /* Frameworks */, + D5650189FDD09F93190F9E91CA770458 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = FMDB; + productName = FMDB; + productReference = 003397356FD1052F1B7B632E25DB1274 /* libFMDB.a */; + productType = "com.apple.product-type.library.static"; + }; + 4359B870C8D9828950479A4FB3819805 /* Pods-Runner */ = { + isa = PBXNativeTarget; + buildConfigurationList = 27B85248B7D0D96FB62824F4BCC6ED8E /* Build configuration list for PBXNativeTarget "Pods-Runner" */; + buildPhases = ( + D88643062B7602B884A23652394EF04D /* Sources */, + 7D97D7AFDFEB2319B71726B0C7C35081 /* Frameworks */, + ); + buildRules = ( + ); + dependencies = ( + F7DB24951F99AD79C9A3C20642E862B8 /* PBXTargetDependency */, + 64607DA0D639AA1ADA9A7F9439DD9979 /* PBXTargetDependency */, + 37B40D53FFD1D0F7A73461F844114416 /* PBXTargetDependency */, + ); + name = "Pods-Runner"; + productName = "Pods-Runner"; + productReference = A47118E0497C287385E5E40F74B45592 /* libPods-Runner.a */; + productType = "com.apple.product-type.library.static"; + }; + 8944BF05BFD79D97D838CC043D5F737A /* sqflite */ = { + isa = PBXNativeTarget; + buildConfigurationList = D683C7800E224AA1BCE1A5D1014095AA /* Build configuration list for PBXNativeTarget "sqflite" */; + buildPhases = ( + 070684A2243BD9D4CF0E21C7015C4C49 /* Sources */, + E77DFBE401E6EB8D3FDB709749F7756D /* Frameworks */, + 9E575053C725E72B7BAB34F8DAFC6ED9 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + 12AA7F134C7776C175CA8EE34B87B4F8 /* PBXTargetDependency */, + ); + name = sqflite; + productName = sqflite; + productReference = A52E6E664A33D0ADBF28C096726C8FAA /* libsqflite.a */; + productType = "com.apple.product-type.library.static"; + }; + D597B65EAF1279E7C5637291B916DDC5 /* path_provider */ = { + isa = PBXNativeTarget; + buildConfigurationList = 20E959984CF6E2A34CFF08E1335F922A /* Build configuration list for PBXNativeTarget "path_provider" */; + buildPhases = ( + FC0496B502691C4870045CFBB8579F55 /* Sources */, + C8ECFE49FBB48866AF20945FA64C3E9A /* Frameworks */, + 6D5F5A8571DEBE7AC0FE0D3455AFBA46 /* Headers */, + ); + buildRules = ( + ); + dependencies = ( + ); + name = path_provider; + productName = path_provider; + productReference = 01FFC258241FD6531167B29D7C3AABCE /* libpath_provider.a */; + productType = "com.apple.product-type.library.static"; + }; +/* End PBXNativeTarget section */ + +/* Begin PBXProject section */ + D41D8CD98F00B204E9800998ECF8427E /* Project object */ = { + isa = PBXProject; + attributes = { + LastSwiftUpdateCheck = 0830; + LastUpgradeCheck = 0700; + }; + buildConfigurationList = 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */; + compatibilityVersion = "Xcode 3.2"; + developmentRegion = English; + hasScannedForEncodings = 0; + knownRegions = ( + en, + ); + mainGroup = 7DB346D0F39D3F0E887471402A8071AB; + productRefGroup = 64A6B117D4CD0E751BFC131087154F68 /* Products */; + projectDirPath = ""; + projectRoot = ""; + targets = ( + 1749C1BD4B48236EAC7E2B8B03365028 /* FMDB */, + D597B65EAF1279E7C5637291B916DDC5 /* path_provider */, + 4359B870C8D9828950479A4FB3819805 /* Pods-Runner */, + 8944BF05BFD79D97D838CC043D5F737A /* sqflite */, + ); + }; +/* End PBXProject section */ + +/* Begin PBXSourcesBuildPhase section */ + 070684A2243BD9D4CF0E21C7015C4C49 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 534A2178342F283B51EACFFDFFE40191 /* sqflite-dummy.m in Sources */, + F758CC216AD6D5080A98A5C906D21B8F /* SqflitePlugin.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + 6EF47EAA0B26CBCD573B43FA4A36E6AD /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 964F7658C2F163B024D944143BA2B366 /* FMDatabase.m in Sources */, + 885FA5A8E4062F05235E1BB351829299 /* FMDatabaseAdditions.m in Sources */, + 5E4CF03E66D6F8A4740E7E79DEB429BD /* FMDatabasePool.m in Sources */, + DC2DD5729CD216714D698D25901C2214 /* FMDatabaseQueue.m in Sources */, + F703EABB9F02DB9BBD35F2898762FF82 /* FMDB-dummy.m in Sources */, + 0A3AA45E708AEBE5491F112FF86826E6 /* FMResultSet.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + D88643062B7602B884A23652394EF04D /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + 5F3656EE3D432CA623783D4CF342F0D8 /* Pods-Runner-dummy.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; + FC0496B502691C4870045CFBB8579F55 /* Sources */ = { + isa = PBXSourcesBuildPhase; + buildActionMask = 2147483647; + files = ( + CCCE6327D9EB4C3524863A4C9F40A534 /* path_provider-dummy.m in Sources */, + FFE88F263143BC1EEE55869071E74417 /* PathProviderPlugin.m in Sources */, + ); + runOnlyForDeploymentPostprocessing = 0; + }; +/* End PBXSourcesBuildPhase section */ + +/* Begin PBXTargetDependency section */ + 12AA7F134C7776C175CA8EE34B87B4F8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = FMDB; + target = 1749C1BD4B48236EAC7E2B8B03365028 /* FMDB */; + targetProxy = 7E2FFC2CFE997942328BDACF01A8FE55 /* PBXContainerItemProxy */; + }; + 37B40D53FFD1D0F7A73461F844114416 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = sqflite; + target = 8944BF05BFD79D97D838CC043D5F737A /* sqflite */; + targetProxy = 390F2857FFCF75A8AEB952F17697D1B7 /* PBXContainerItemProxy */; + }; + 64607DA0D639AA1ADA9A7F9439DD9979 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = path_provider; + target = D597B65EAF1279E7C5637291B916DDC5 /* path_provider */; + targetProxy = 8BDBB193AD09EBE36526DF24B4F56DBD /* PBXContainerItemProxy */; + }; + F7DB24951F99AD79C9A3C20642E862B8 /* PBXTargetDependency */ = { + isa = PBXTargetDependency; + name = FMDB; + target = 1749C1BD4B48236EAC7E2B8B03365028 /* FMDB */; + targetProxy = 252BB7AED6C04DAC85EF7E1F570DE6AC /* PBXContainerItemProxy */; + }; +/* End PBXTargetDependency section */ + +/* Begin XCBuildConfiguration section */ + 07D867E55B5AB8B7870C1E6A33FEBBBB /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B2AC8D08AB9E95E701EC049C53414AEB /* FMDB.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/FMDB/FMDB-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 19A0575138638B2F05A2B2FD69B99D6D /* Debug-develop */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1AF05E0413E9C6AC5B6C1DD2880EBDA4 /* path_provider.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/path_provider/path_provider-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = "Debug-develop"; + }; + 34FE9531DA9AF2820790339988D5FF41 /* Release */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_RELEASE=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + VALIDATE_PRODUCT = YES; + }; + name = Release; + }; + 36C84D228145088456A73665FB1B23E0 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = C01D2261DFAB70EC8E5F1A1385D6F66E /* Pods-Runner.debug.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACH_O_TYPE = staticlib; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Debug; + }; + 370B7DE297A709920A0BB2EBD76A76E3 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1AF05E0413E9C6AC5B6C1DD2880EBDA4 /* path_provider.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/path_provider/path_provider-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + 7173E8A291934D86B87B7C8172E6600D /* Debug-develop */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B2AC8D08AB9E95E701EC049C53414AEB /* FMDB.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/FMDB/FMDB-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = "Debug-develop"; + }; + 8C006BAAA9098B2F3F3C6EF9B1943E46 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = B2AC8D08AB9E95E701EC049C53414AEB /* FMDB.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/FMDB/FMDB-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 4.3; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + A0EEA53CE53D55CAD4CF4557B09FCDD8 /* Debug-develop */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = CAA729AA4202C0AC1EA594504353C960 /* Pods-Runner.debug-develop.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACH_O_TYPE = staticlib; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = "Debug-develop"; + }; + AD714A0D211F78772AFC63199D14B09B /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 4532A70C1CFAB30C4266017A71B77D1F /* Pods-Runner.release.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MACH_O_TYPE = staticlib; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PODS_ROOT = "$(SRCROOT)"; + PRODUCT_BUNDLE_IDENTIFIER = "org.cocoapods.${PRODUCT_NAME:rfc1034identifier}"; + PRODUCT_NAME = "$(TARGET_NAME)"; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + }; + name = Release; + }; + C104F7F091290C3D1E248192F07FE689 /* Debug */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = NO; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG=1", + "DEBUG=1", + "$(inherited)", + ); + GCC_SYMBOLS_PRIVATE_EXTERN = NO; + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + ONLY_ACTIVE_ARCH = YES; + PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; + STRIP_INSTALLED_PRODUCT = NO; + SYMROOT = "${SRCROOT}/../build"; + }; + name = Debug; + }; + C1D46DF380F875E0EE98CD16DDD762FB /* Debug-develop */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9A5598D552F6A211F42187AC266E1656 /* sqflite.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/sqflite/sqflite-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = "Debug-develop"; + }; + F79D889AB2DE4197969513B633117EA2 /* Release */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9A5598D552F6A211F42187AC266E1656 /* sqflite.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/sqflite/sqflite-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = NO; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Release; + }; + F93F83D9876E7DC43B24692C6B5E2309 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 1AF05E0413E9C6AC5B6C1DD2880EBDA4 /* path_provider.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/path_provider/path_provider-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + FC09EFEE9A0D51D6A5402A3F2103CBA8 /* Debug */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9A5598D552F6A211F42187AC266E1656 /* sqflite.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm64, + arm7s, + armv7, + ); + "CODE_SIGN_IDENTITY[sdk=appletvos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = ""; + "CODE_SIGN_IDENTITY[sdk=watchos*]" = ""; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_BITCODE = NO; + ENABLE_STRICT_OBJC_MSGSEND = YES; + GCC_NO_COMMON_BLOCKS = YES; + GCC_PREFIX_HEADER = "Target Support Files/sqflite/sqflite-prefix.pch"; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + OTHER_LDFLAGS = ""; + OTHER_LIBTOOLFLAGS = ""; + PRIVATE_HEADERS_FOLDER_PATH = ""; + PRODUCT_NAME = "$(TARGET_NAME)"; + PUBLIC_HEADERS_FOLDER_PATH = ""; + SDKROOT = iphoneos; + SKIP_INSTALL = YES; + SWIFT_VERSION = 3.0; + }; + name = Debug; + }; + FE87B77707AE47DF6E63C7626B38A635 /* Debug-develop */ = { + isa = XCBuildConfiguration; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES; + CLANG_WARN_DOCUMENTATION_COMMENTS = YES; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + CODE_SIGNING_REQUIRED = NO; + COPY_PHASE_STRIP = YES; + ENABLE_NS_ASSERTIONS = NO; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_PREPROCESSOR_DEFINITIONS = ( + "POD_CONFIGURATION_DEBUG_DEVELOP=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + PROVISIONING_PROFILE_SPECIFIER = NO_SIGNING/; + STRIP_INSTALLED_PRODUCT = NO; + VALIDATE_PRODUCT = YES; + }; + name = "Debug-develop"; + }; +/* End XCBuildConfiguration section */ + +/* Begin XCConfigurationList section */ + 20E959984CF6E2A34CFF08E1335F922A /* Build configuration list for PBXNativeTarget "path_provider" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + F93F83D9876E7DC43B24692C6B5E2309 /* Debug */, + 19A0575138638B2F05A2B2FD69B99D6D /* Debug-develop */, + 370B7DE297A709920A0BB2EBD76A76E3 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 27B85248B7D0D96FB62824F4BCC6ED8E /* Build configuration list for PBXNativeTarget "Pods-Runner" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 36C84D228145088456A73665FB1B23E0 /* Debug */, + A0EEA53CE53D55CAD4CF4557B09FCDD8 /* Debug-develop */, + AD714A0D211F78772AFC63199D14B09B /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 2D8E8EC45A3A1A1D94AE762CB5028504 /* Build configuration list for PBXProject "Pods" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + C104F7F091290C3D1E248192F07FE689 /* Debug */, + FE87B77707AE47DF6E63C7626B38A635 /* Debug-develop */, + 34FE9531DA9AF2820790339988D5FF41 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + 7BB2C93DA9F2A87B6FBF78336D22F4E2 /* Build configuration list for PBXNativeTarget "FMDB" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + 8C006BAAA9098B2F3F3C6EF9B1943E46 /* Debug */, + 7173E8A291934D86B87B7C8172E6600D /* Debug-develop */, + 07D867E55B5AB8B7870C1E6A33FEBBBB /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; + D683C7800E224AA1BCE1A5D1014095AA /* Build configuration list for PBXNativeTarget "sqflite" */ = { + isa = XCConfigurationList; + buildConfigurations = ( + FC09EFEE9A0D51D6A5402A3F2103CBA8 /* Debug */, + C1D46DF380F875E0EE98CD16DDD762FB /* Debug-develop */, + F79D889AB2DE4197969513B633117EA2 /* Release */, + ); + defaultConfigurationIsVisible = 0; + defaultConfigurationName = Release; + }; +/* End XCConfigurationList section */ + }; + rootObject = D41D8CD98F00B204E9800998ECF8427E /* Project object */; +} diff --git a/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/FMDB.xcscheme b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/FMDB.xcscheme new file mode 100644 index 0000000..62095c4 --- /dev/null +++ b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/FMDB.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/Pods-Runner.xcscheme b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/Pods-Runner.xcscheme new file mode 100644 index 0000000..51a37a5 --- /dev/null +++ b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/Pods-Runner.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/path_provider.xcscheme b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/path_provider.xcscheme new file mode 100644 index 0000000..115e6c7 --- /dev/null +++ b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/path_provider.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/sqflite.xcscheme b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/sqflite.xcscheme new file mode 100644 index 0000000..f264f5e --- /dev/null +++ b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/sqflite.xcscheme @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..cb9967c --- /dev/null +++ b/ios/Pods/Pods.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,31 @@ + + + + + SchemeUserState + + FMDB.xcscheme + + isShown + + + Pods-Runner.xcscheme + + isShown + + + path_provider.xcscheme + + isShown + + + sqflite.xcscheme + + isShown + + + + SuppressBuildableAutocreation + + + diff --git a/ios/Pods/Target Support Files/FMDB/FMDB-dummy.m b/ios/Pods/Target Support Files/FMDB/FMDB-dummy.m new file mode 100644 index 0000000..20ea8f1 --- /dev/null +++ b/ios/Pods/Target Support Files/FMDB/FMDB-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_FMDB : NSObject +@end +@implementation PodsDummy_FMDB +@end diff --git a/ios/Pods/Target Support Files/FMDB/FMDB-prefix.pch b/ios/Pods/Target Support Files/FMDB/FMDB-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/ios/Pods/Target Support Files/FMDB/FMDB-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/ios/Pods/Target Support Files/FMDB/FMDB.xcconfig b/ios/Pods/Target Support Files/FMDB/FMDB.xcconfig new file mode 100644 index 0000000..0da63aa --- /dev/null +++ b/ios/Pods/Target Support Files/FMDB/FMDB.xcconfig @@ -0,0 +1,10 @@ +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/FMDB +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/FMDB" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/Flutter" "${PODS_ROOT}/Headers/Public/path_provider" "${PODS_ROOT}/Headers/Public/sqflite" +OTHER_LDFLAGS = -l"sqlite3" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/FMDB +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-acknowledgements.markdown b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-acknowledgements.markdown new file mode 100644 index 0000000..e8dcf63 --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-acknowledgements.markdown @@ -0,0 +1,125 @@ +# Acknowledgements +This application makes use of the following third party libraries: + +## FMDB + +If you are using FMDB in your project, I'd love to hear about it. Let Gus know +by sending an email to gus@flyingmeat.com. + +And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you +might consider purchasing a drink of their choosing if FMDB has been useful to +you. + +Finally, and shortly, this is the MIT License. + +Copyright (c) 2008-2014 Flying Meat Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + +## Flutter + +// Copyright 2014 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + +## path_provider + +Copyright 2017, the Flutter project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +## sqflite + +// Copyright 2017 Your Company. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Your Company nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + +Generated by CocoaPods - https://cocoapods.org diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-acknowledgements.plist b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-acknowledgements.plist new file mode 100644 index 0000000..608196e --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-acknowledgements.plist @@ -0,0 +1,171 @@ + + + + + PreferenceSpecifiers + + + FooterText + This application makes use of the following third party libraries: + Title + Acknowledgements + Type + PSGroupSpecifier + + + FooterText + If you are using FMDB in your project, I'd love to hear about it. Let Gus know +by sending an email to gus@flyingmeat.com. + +And if you happen to come across either Gus Mueller or Rob Ryan in a bar, you +might consider purchasing a drink of their choosing if FMDB has been useful to +you. + +Finally, and shortly, this is the MIT License. + +Copyright (c) 2008-2014 Flying Meat Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE. + License + MIT + Title + FMDB + Type + PSGroupSpecifier + + + FooterText + // Copyright 2014 The Chromium Authors. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Google Inc. nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + License + MIT + Title + Flutter + Type + PSGroupSpecifier + + + FooterText + Copyright 2017, the Flutter project authors. All rights reserved. +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + * Redistributions of source code must retain the above copyright + notice, this list of conditions and the following disclaimer. + * Redistributions in binary form must reproduce the above + copyright notice, this list of conditions and the following + disclaimer in the documentation and/or other materials provided + with the distribution. + * Neither the name of Google Inc. nor the names of its + contributors may be used to endorse or promote products derived + from this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + Title + path_provider + Type + PSGroupSpecifier + + + FooterText + // Copyright 2017 Your Company. All rights reserved. +// +// Redistribution and use in source and binary forms, with or without +// modification, are permitted provided that the following conditions are +// met: +// +// * Redistributions of source code must retain the above copyright +// notice, this list of conditions and the following disclaimer. +// * Redistributions in binary form must reproduce the above +// copyright notice, this list of conditions and the following disclaimer +// in the documentation and/or other materials provided with the +// distribution. +// * Neither the name of Your Company nor the names of its +// contributors may be used to endorse or promote products derived from +// this software without specific prior written permission. +// +// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS +// "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT +// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR +// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT +// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + + Title + sqflite + Type + PSGroupSpecifier + + + FooterText + Generated by CocoaPods - https://cocoapods.org + Title + + Type + PSGroupSpecifier + + + StringsTable + Acknowledgements + Title + Acknowledgements + + diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m new file mode 100644 index 0000000..0b73bc1 --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_Pods_Runner : NSObject +@end +@implementation PodsDummy_Pods_Runner +@end diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh new file mode 100755 index 0000000..e476d7a --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-frameworks.sh @@ -0,0 +1,102 @@ +#!/bin/sh +set -e + +echo "mkdir -p ${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" +mkdir -p "${CONFIGURATION_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + +SWIFT_STDLIB_PATH="${DT_TOOLCHAIN_DIR}/usr/lib/swift/${PLATFORM_NAME}" + +install_framework() +{ + if [ -r "${BUILT_PRODUCTS_DIR}/$1" ]; then + local source="${BUILT_PRODUCTS_DIR}/$1" + elif [ -r "${BUILT_PRODUCTS_DIR}/$(basename "$1")" ]; then + local source="${BUILT_PRODUCTS_DIR}/$(basename "$1")" + elif [ -r "$1" ]; then + local source="$1" + fi + + local destination="${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + + if [ -L "${source}" ]; then + echo "Symlinked..." + source="$(readlink "${source}")" + fi + + # use filter instead of exclude so missing patterns dont' throw errors + echo "rsync -av --filter \"- CVS/\" --filter \"- .svn/\" --filter \"- .git/\" --filter \"- .hg/\" --filter \"- Headers\" --filter \"- PrivateHeaders\" --filter \"- Modules\" \"${source}\" \"${destination}\"" + rsync -av --filter "- CVS/" --filter "- .svn/" --filter "- .git/" --filter "- .hg/" --filter "- Headers" --filter "- PrivateHeaders" --filter "- Modules" "${source}" "${destination}" + + local basename + basename="$(basename -s .framework "$1")" + binary="${destination}/${basename}.framework/${basename}" + if ! [ -r "$binary" ]; then + binary="${destination}/${basename}" + fi + + # Strip invalid architectures so "fat" simulator / device frameworks work on device + if [[ "$(file "$binary")" == *"dynamically linked shared library"* ]]; then + strip_invalid_archs "$binary" + fi + + # Resign the code if required by the build settings to avoid unstable apps + code_sign_if_enabled "${destination}/$(basename "$1")" + + # Embed linked Swift runtime libraries. No longer necessary as of Xcode 7. + if [ "${XCODE_VERSION_MAJOR}" -lt 7 ]; then + local swift_runtime_libs + swift_runtime_libs=$(xcrun otool -LX "$binary" | grep --color=never @rpath/libswift | sed -E s/@rpath\\/\(.+dylib\).*/\\1/g | uniq -u && exit ${PIPESTATUS[0]}) + for lib in $swift_runtime_libs; do + echo "rsync -auv \"${SWIFT_STDLIB_PATH}/${lib}\" \"${destination}\"" + rsync -auv "${SWIFT_STDLIB_PATH}/${lib}" "${destination}" + code_sign_if_enabled "${destination}/${lib}" + done + fi +} + +# Signs a framework with the provided identity +code_sign_if_enabled() { + if [ -n "${EXPANDED_CODE_SIGN_IDENTITY}" -a "${CODE_SIGNING_REQUIRED}" != "NO" -a "${CODE_SIGNING_ALLOWED}" != "NO" ]; then + # Use the current code_sign_identitiy + echo "Code Signing $1 with Identity ${EXPANDED_CODE_SIGN_IDENTITY_NAME}" + local code_sign_cmd="/usr/bin/codesign --force --sign ${EXPANDED_CODE_SIGN_IDENTITY} ${OTHER_CODE_SIGN_FLAGS} --preserve-metadata=identifier,entitlements '$1'" + + if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + code_sign_cmd="$code_sign_cmd &" + fi + echo "$code_sign_cmd" + eval "$code_sign_cmd" + fi +} + +# Strip invalid architectures +strip_invalid_archs() { + binary="$1" + # Get architectures for current file + archs="$(lipo -info "$binary" | rev | cut -d ':' -f1 | rev)" + stripped="" + for arch in $archs; do + if ! [[ "${VALID_ARCHS}" == *"$arch"* ]]; then + # Strip non-valid architectures in-place + lipo -remove "$arch" -output "$binary" "$binary" || exit 1 + stripped="$stripped $arch" + fi + done + if [[ "$stripped" ]]; then + echo "Stripped $binary of architectures:$stripped" + fi +} + + +if [[ "$CONFIGURATION" == "Debug" ]]; then + install_framework "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework" +fi +if [[ "$CONFIGURATION" == "Debug-develop" ]]; then + install_framework "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework" +fi +if [[ "$CONFIGURATION" == "Release" ]]; then + install_framework "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios/Flutter.framework" +fi +if [ "${COCOAPODS_PARALLEL_CODE_SIGN}" == "true" ]; then + wait +fi diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh new file mode 100755 index 0000000..aed060f --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner-resources.sh @@ -0,0 +1,102 @@ +#!/bin/sh +set -e + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + +RESOURCES_TO_COPY=${PODS_ROOT}/resources-to-copy-${TARGETNAME}.txt +> "$RESOURCES_TO_COPY" + +XCASSET_FILES=() + +case "${TARGETED_DEVICE_FAMILY}" in + 1,2) + TARGET_DEVICE_ARGS="--target-device ipad --target-device iphone" + ;; + 1) + TARGET_DEVICE_ARGS="--target-device iphone" + ;; + 2) + TARGET_DEVICE_ARGS="--target-device ipad" + ;; + 3) + TARGET_DEVICE_ARGS="--target-device tv" + ;; + 4) + TARGET_DEVICE_ARGS="--target-device watch" + ;; + *) + TARGET_DEVICE_ARGS="--target-device mac" + ;; +esac + +install_resource() +{ + if [[ "$1" = /* ]] ; then + RESOURCE_PATH="$1" + else + RESOURCE_PATH="${PODS_ROOT}/$1" + fi + if [[ ! -e "$RESOURCE_PATH" ]] ; then + cat << EOM +error: Resource "$RESOURCE_PATH" not found. Run 'pod install' to update the copy resources script. +EOM + exit 1 + fi + case $RESOURCE_PATH in + *.storyboard) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .storyboard`.storyboardc" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.xib) + echo "ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile ${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib $RESOURCE_PATH --sdk ${SDKROOT} ${TARGET_DEVICE_ARGS}" + ibtool --reference-external-strings-file --errors --warnings --notices --minimum-deployment-target ${!DEPLOYMENT_TARGET_SETTING_NAME} --output-format human-readable-text --compile "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename \"$RESOURCE_PATH\" .xib`.nib" "$RESOURCE_PATH" --sdk "${SDKROOT}" ${TARGET_DEVICE_ARGS} + ;; + *.framework) + echo "mkdir -p ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + mkdir -p "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + echo "rsync -av $RESOURCE_PATH ${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + rsync -av "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${FRAMEWORKS_FOLDER_PATH}" + ;; + *.xcdatamodel) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH"`.mom\"" + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodel`.mom" + ;; + *.xcdatamodeld) + echo "xcrun momc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd\"" + xcrun momc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcdatamodeld`.momd" + ;; + *.xcmappingmodel) + echo "xcrun mapc \"$RESOURCE_PATH\" \"${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm\"" + xcrun mapc "$RESOURCE_PATH" "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}/`basename "$RESOURCE_PATH" .xcmappingmodel`.cdm" + ;; + *.xcassets) + ABSOLUTE_XCASSET_FILE="$RESOURCE_PATH" + XCASSET_FILES+=("$ABSOLUTE_XCASSET_FILE") + ;; + *) + echo "$RESOURCE_PATH" + echo "$RESOURCE_PATH" >> "$RESOURCES_TO_COPY" + ;; + esac +} + +mkdir -p "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${TARGET_BUILD_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +if [[ "${ACTION}" == "install" ]] && [[ "${SKIP_INSTALL}" == "NO" ]]; then + mkdir -p "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" + rsync -avr --copy-links --no-relative --exclude '*/.svn/*' --files-from="$RESOURCES_TO_COPY" / "${INSTALL_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi +rm -f "$RESOURCES_TO_COPY" + +if [[ -n "${WRAPPER_EXTENSION}" ]] && [ "`xcrun --find actool`" ] && [ -n "$XCASSET_FILES" ] +then + # Find all other xcassets (this unfortunately includes those of path pods and other targets). + OTHER_XCASSETS=$(find "$PWD" -iname "*.xcassets" -type d) + while read line; do + if [[ $line != "${PODS_ROOT}*" ]]; then + XCASSET_FILES+=("$line") + fi + done <<<"$OTHER_XCASSETS" + + printf "%s\0" "${XCASSET_FILES[@]}" | xargs -0 xcrun actool --output-format human-readable-text --notices --warnings --platform "${PLATFORM_NAME}" --minimum-deployment-target "${!DEPLOYMENT_TARGET_SETTING_NAME}" ${TARGET_DEVICE_ARGS} --compress-pngs --compile "${BUILT_PRODUCTS_DIR}/${UNLOCALIZED_RESOURCES_FOLDER_PATH}" +fi diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-develop.xcconfig b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-develop.xcconfig new file mode 100644 index 0000000..cf9963a --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug-develop.xcconfig @@ -0,0 +1,11 @@ +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/Flutter" "${PODS_ROOT}/Headers/Public/path_provider" "${PODS_ROOT}/Headers/Public/sqflite" +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/path_provider" "$PODS_CONFIGURATION_BUILD_DIR/sqflite" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/Flutter" -isystem "${PODS_ROOT}/Headers/Public/path_provider" -isystem "${PODS_ROOT}/Headers/Public/sqflite" +OTHER_LDFLAGS = $(inherited) -ObjC -l"FMDB" -l"path_provider" -l"sqflite" -l"sqlite3" -framework "Flutter" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig new file mode 100644 index 0000000..cf9963a --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.debug.xcconfig @@ -0,0 +1,11 @@ +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/Flutter" "${PODS_ROOT}/Headers/Public/path_provider" "${PODS_ROOT}/Headers/Public/sqflite" +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/path_provider" "$PODS_CONFIGURATION_BUILD_DIR/sqflite" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/Flutter" -isystem "${PODS_ROOT}/Headers/Public/path_provider" -isystem "${PODS_ROOT}/Headers/Public/sqflite" +OTHER_LDFLAGS = $(inherited) -ObjC -l"FMDB" -l"path_provider" -l"sqflite" -l"sqlite3" -framework "Flutter" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig new file mode 100644 index 0000000..cf9963a --- /dev/null +++ b/ios/Pods/Target Support Files/Pods-Runner/Pods-Runner.release.xcconfig @@ -0,0 +1,11 @@ +FRAMEWORK_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/../../../../../flutter/bin/cache/artifacts/engine/ios" +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = $(inherited) "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/Flutter" "${PODS_ROOT}/Headers/Public/path_provider" "${PODS_ROOT}/Headers/Public/sqflite" +LD_RUNPATH_SEARCH_PATHS = $(inherited) '@executable_path/Frameworks' '@loader_path/Frameworks' +LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" "$PODS_CONFIGURATION_BUILD_DIR/path_provider" "$PODS_CONFIGURATION_BUILD_DIR/sqflite" +OTHER_CFLAGS = $(inherited) -isystem "${PODS_ROOT}/Headers/Public" -isystem "${PODS_ROOT}/Headers/Public/FMDB" -isystem "${PODS_ROOT}/Headers/Public/Flutter" -isystem "${PODS_ROOT}/Headers/Public/path_provider" -isystem "${PODS_ROOT}/Headers/Public/sqflite" +OTHER_LDFLAGS = $(inherited) -ObjC -l"FMDB" -l"path_provider" -l"sqflite" -l"sqlite3" -framework "Flutter" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_PODFILE_DIR_PATH = ${SRCROOT}/. +PODS_ROOT = ${SRCROOT}/Pods diff --git a/ios/Pods/Target Support Files/path_provider/path_provider-dummy.m b/ios/Pods/Target Support Files/path_provider/path_provider-dummy.m new file mode 100644 index 0000000..1f83b9d --- /dev/null +++ b/ios/Pods/Target Support Files/path_provider/path_provider-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_path_provider : NSObject +@end +@implementation PodsDummy_path_provider +@end diff --git a/ios/Pods/Target Support Files/path_provider/path_provider-prefix.pch b/ios/Pods/Target Support Files/path_provider/path_provider-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/ios/Pods/Target Support Files/path_provider/path_provider-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/ios/Pods/Target Support Files/path_provider/path_provider.xcconfig b/ios/Pods/Target Support Files/path_provider/path_provider.xcconfig new file mode 100644 index 0000000..b4165a5 --- /dev/null +++ b/ios/Pods/Target Support Files/path_provider/path_provider.xcconfig @@ -0,0 +1,9 @@ +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/path_provider +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/path_provider" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/Flutter" "${PODS_ROOT}/Headers/Public/path_provider" "${PODS_ROOT}/Headers/Public/sqflite" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../../../../.pub-cache/hosted/pub.dartlang.org/path_provider-0.2.1+1/ios +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/ios/Pods/Target Support Files/sqflite/sqflite-dummy.m b/ios/Pods/Target Support Files/sqflite/sqflite-dummy.m new file mode 100644 index 0000000..ddd8d3c --- /dev/null +++ b/ios/Pods/Target Support Files/sqflite/sqflite-dummy.m @@ -0,0 +1,5 @@ +#import +@interface PodsDummy_sqflite : NSObject +@end +@implementation PodsDummy_sqflite +@end diff --git a/ios/Pods/Target Support Files/sqflite/sqflite-prefix.pch b/ios/Pods/Target Support Files/sqflite/sqflite-prefix.pch new file mode 100644 index 0000000..beb2a24 --- /dev/null +++ b/ios/Pods/Target Support Files/sqflite/sqflite-prefix.pch @@ -0,0 +1,12 @@ +#ifdef __OBJC__ +#import +#else +#ifndef FOUNDATION_EXPORT +#if defined(__cplusplus) +#define FOUNDATION_EXPORT extern "C" +#else +#define FOUNDATION_EXPORT extern +#endif +#endif +#endif + diff --git a/ios/Pods/Target Support Files/sqflite/sqflite.xcconfig b/ios/Pods/Target Support Files/sqflite/sqflite.xcconfig new file mode 100644 index 0000000..7d99f15 --- /dev/null +++ b/ios/Pods/Target Support Files/sqflite/sqflite.xcconfig @@ -0,0 +1,10 @@ +CONFIGURATION_BUILD_DIR = $PODS_CONFIGURATION_BUILD_DIR/sqflite +GCC_PREPROCESSOR_DEFINITIONS = $(inherited) COCOAPODS=1 +HEADER_SEARCH_PATHS = "${PODS_ROOT}/Headers/Private" "${PODS_ROOT}/Headers/Private/sqflite" "${PODS_ROOT}/Headers/Public" "${PODS_ROOT}/Headers/Public/FMDB" "${PODS_ROOT}/Headers/Public/Flutter" "${PODS_ROOT}/Headers/Public/path_provider" "${PODS_ROOT}/Headers/Public/sqflite" +LIBRARY_SEARCH_PATHS = $(inherited) "$PODS_CONFIGURATION_BUILD_DIR/FMDB" +PODS_BUILD_DIR = $BUILD_DIR +PODS_CONFIGURATION_BUILD_DIR = $PODS_BUILD_DIR/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME) +PODS_ROOT = ${SRCROOT} +PODS_TARGET_SRCROOT = ${PODS_ROOT}/../../../../../.pub-cache/hosted/pub.dartlang.org/sqflite-0.2.3/ios +PRODUCT_BUNDLE_IDENTIFIER = org.cocoapods.${PRODUCT_NAME:rfc1034identifier} +SKIP_INSTALL = YES diff --git a/ios/Runner.xcodeproj/project.pbxproj b/ios/Runner.xcodeproj/project.pbxproj index 7129cd8..da43b4e 100644 --- a/ios/Runner.xcodeproj/project.pbxproj +++ b/ios/Runner.xcodeproj/project.pbxproj @@ -22,6 +22,7 @@ 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FA1CF9000F007C117D /* Main.storyboard */; }; 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FD1CF9000F007C117D /* Assets.xcassets */; }; 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 97C146FF1CF9000F007C117D /* LaunchScreen.storyboard */; }; + ACE103AC1F8FCC6000D17794 /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = ACE103AB1F8FCC6000D17794 /* libzbar.a */; }; BBA9BAFF1F176DD10053B6EA /* ScannerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BBA9BAFE1F176DD10053B6EA /* ScannerViewController.swift */; }; BBA9BB321F1792570053B6EA /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB311F1792570053B6EA /* AVFoundation.framework */; }; BBA9BB341F17925F0053B6EA /* CoreGraphics.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB331F17925F0053B6EA /* CoreGraphics.framework */; }; @@ -29,11 +30,6 @@ BBA9BB381F1792730053B6EA /* CoreAudio.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB371F1792730053B6EA /* CoreAudio.framework */; }; BBA9BB3A1F17927C0053B6EA /* CoreVideo.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB391F17927C0053B6EA /* CoreVideo.framework */; }; BBA9BB3C1F1792A90053B6EA /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB3B1F1792A90053B6EA /* QuartzCore.framework */; }; - BBA9BB5B1F179C320053B6EA /* libzbar.a in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB551F179C320053B6EA /* libzbar.a */; }; - BBA9BB5C1F179C320053B6EA /* zbar-back.png in Resources */ = {isa = PBXBuildFile; fileRef = BBA9BB571F179C320053B6EA /* zbar-back.png */; }; - BBA9BB5D1F179C320053B6EA /* zbar-help.html in Resources */ = {isa = PBXBuildFile; fileRef = BBA9BB581F179C320053B6EA /* zbar-help.html */; }; - BBA9BB5E1F179C320053B6EA /* zbar-helpicons.png in Resources */ = {isa = PBXBuildFile; fileRef = BBA9BB591F179C320053B6EA /* zbar-helpicons.png */; }; - BBA9BB5F1F179C320053B6EA /* zbar-samples.png in Resources */ = {isa = PBXBuildFile; fileRef = BBA9BB5A1F179C320053B6EA /* zbar-samples.png */; }; BBA9BB611F179D270053B6EA /* libiconv.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = BBA9BB601F179D270053B6EA /* libiconv.tbd */; }; /* End PBXBuildFile section */ @@ -71,6 +67,27 @@ 97C146FD1CF9000F007C117D /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 97C147001CF9000F007C117D /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 97C147021CF9000F007C117D /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; + ACE103AB1F8FCC6000D17794 /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libzbar.a; path = ZBarSDK/libzbar.a; sourceTree = ""; }; + ACE103AD1F8FCC6F00D17794 /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zbar.h; path = ZBarSDK/Headers/zbar.h; sourceTree = ""; }; + ACE103AE1F8FCC6F00D17794 /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarCaptureReader.h; path = ZBarSDK/Headers/ZBarCaptureReader.h; sourceTree = ""; }; + ACE103AF1F8FCC6F00D17794 /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarReaderViewController.h; path = ZBarSDK/Headers/ZBarReaderViewController.h; sourceTree = ""; }; + ACE103B01F8FCC6F00D17794 /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarImage.h; path = ZBarSDK/Headers/ZBarImage.h; sourceTree = ""; }; + ACE103B11F8FCC7000D17794 /* ZBarCameraSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarCameraSimulator.h; path = ZBarSDK/Headers/ZBarCameraSimulator.h; sourceTree = ""; }; + ACE103B21F8FCC7000D17794 /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarReaderView.h; path = ZBarSDK/Headers/ZBarReaderView.h; sourceTree = ""; }; + ACE103B31F8FCC7000D17794 /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarSDK.h; path = ZBarSDK/Headers/ZBarSDK.h; sourceTree = ""; }; + ACE103B41F8FCC7000D17794 /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarHelpController.h; path = ZBarSDK/Headers/ZBarHelpController.h; sourceTree = ""; }; + ACE103B51F8FCC7000D17794 /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarImageScanner.h; path = ZBarSDK/Headers/ZBarImageScanner.h; sourceTree = ""; }; + ACE103B61F8FCC7100D17794 /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarReaderController.h; path = ZBarSDK/Headers/ZBarReaderController.h; sourceTree = ""; }; + ACE103B71F8FCC7100D17794 /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ZBarSymbol.h; path = ZBarSDK/Headers/ZBarSymbol.h; sourceTree = ""; }; + ACE103BE1F8FCD1400D17794 /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Window.h; path = ZBarSDK/Headers/zbar/Window.h; sourceTree = ""; }; + ACE103BF1F8FCD1500D17794 /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Decoder.h; path = ZBarSDK/Headers/zbar/Decoder.h; sourceTree = ""; }; + ACE103C01F8FCD1500D17794 /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Processor.h; path = ZBarSDK/Headers/zbar/Processor.h; sourceTree = ""; }; + ACE103C11F8FCD1500D17794 /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Exception.h; path = ZBarSDK/Headers/zbar/Exception.h; sourceTree = ""; }; + ACE103C21F8FCD1500D17794 /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Symbol.h; path = ZBarSDK/Headers/zbar/Symbol.h; sourceTree = ""; }; + ACE103C31F8FCD1500D17794 /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Image.h; path = ZBarSDK/Headers/zbar/Image.h; sourceTree = ""; }; + ACE103C41F8FCD1500D17794 /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Video.h; path = ZBarSDK/Headers/zbar/Video.h; sourceTree = ""; }; + ACE103C51F8FCD1500D17794 /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ImageScanner.h; path = ZBarSDK/Headers/zbar/ImageScanner.h; sourceTree = ""; }; + ACE103C61F8FCD1500D17794 /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scanner.h; path = ZBarSDK/Headers/zbar/Scanner.h; sourceTree = ""; }; BBA9BAFD1F176DD10053B6EA /* Runner-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "Runner-Bridging-Header.h"; sourceTree = ""; }; BBA9BAFE1F176DD10053B6EA /* ScannerViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ScannerViewController.swift; sourceTree = ""; }; BBA9BB311F1792570053B6EA /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; @@ -79,31 +96,6 @@ BBA9BB371F1792730053B6EA /* CoreAudio.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreAudio.framework; path = System/Library/Frameworks/CoreAudio.framework; sourceTree = SDKROOT; }; BBA9BB391F17927C0053B6EA /* CoreVideo.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreVideo.framework; path = System/Library/Frameworks/CoreVideo.framework; sourceTree = SDKROOT; }; BBA9BB3B1F1792A90053B6EA /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = System/Library/Frameworks/QuartzCore.framework; sourceTree = SDKROOT; }; - BBA9BB411F179C320053B6EA /* Decoder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Decoder.h; sourceTree = ""; }; - BBA9BB421F179C320053B6EA /* Exception.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Exception.h; sourceTree = ""; }; - BBA9BB431F179C320053B6EA /* Image.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Image.h; sourceTree = ""; }; - BBA9BB441F179C320053B6EA /* ImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ImageScanner.h; sourceTree = ""; }; - BBA9BB451F179C320053B6EA /* Processor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Processor.h; sourceTree = ""; }; - BBA9BB461F179C320053B6EA /* Scanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scanner.h; sourceTree = ""; }; - BBA9BB471F179C320053B6EA /* Symbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Symbol.h; sourceTree = ""; }; - BBA9BB481F179C320053B6EA /* Video.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Video.h; sourceTree = ""; }; - BBA9BB491F179C320053B6EA /* Window.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Window.h; sourceTree = ""; }; - BBA9BB4A1F179C320053B6EA /* zbar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = zbar.h; sourceTree = ""; }; - BBA9BB4B1F179C320053B6EA /* ZBarCameraSimulator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCameraSimulator.h; sourceTree = ""; }; - BBA9BB4C1F179C320053B6EA /* ZBarCaptureReader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarCaptureReader.h; sourceTree = ""; }; - BBA9BB4D1F179C320053B6EA /* ZBarHelpController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarHelpController.h; sourceTree = ""; }; - BBA9BB4E1F179C320053B6EA /* ZBarImage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImage.h; sourceTree = ""; }; - BBA9BB4F1F179C320053B6EA /* ZBarImageScanner.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarImageScanner.h; sourceTree = ""; }; - BBA9BB501F179C320053B6EA /* ZBarReaderController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderController.h; sourceTree = ""; }; - BBA9BB511F179C320053B6EA /* ZBarReaderView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderView.h; sourceTree = ""; }; - BBA9BB521F179C320053B6EA /* ZBarReaderViewController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarReaderViewController.h; sourceTree = ""; }; - BBA9BB531F179C320053B6EA /* ZBarSDK.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSDK.h; sourceTree = ""; }; - BBA9BB541F179C320053B6EA /* ZBarSymbol.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ZBarSymbol.h; sourceTree = ""; }; - BBA9BB551F179C320053B6EA /* libzbar.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; path = libzbar.a; sourceTree = ""; }; - BBA9BB571F179C320053B6EA /* zbar-back.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-back.png"; sourceTree = ""; }; - BBA9BB581F179C320053B6EA /* zbar-help.html */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.html; path = "zbar-help.html"; sourceTree = ""; }; - BBA9BB591F179C320053B6EA /* zbar-helpicons.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-helpicons.png"; sourceTree = ""; }; - BBA9BB5A1F179C320053B6EA /* zbar-samples.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "zbar-samples.png"; sourceTree = ""; }; BBA9BB601F179D270053B6EA /* libiconv.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libiconv.tbd; path = usr/lib/libiconv.tbd; sourceTree = SDKROOT; }; /* End PBXFileReference section */ @@ -121,7 +113,7 @@ BBA9BB321F1792570053B6EA /* AVFoundation.framework in Frameworks */, 9705A1C61CF904A100538489 /* Flutter.framework in Frameworks */, 3B80C3941E831B6300D905FE /* App.framework in Frameworks */, - BBA9BB5B1F179C320053B6EA /* libzbar.a in Frameworks */, + ACE103AC1F8FCC6000D17794 /* libzbar.a in Frameworks */, 755861CA44FB15BD2EFD12F7 /* libPods-Runner.a in Frameworks */, ); runOnlyForDeploymentPostprocessing = 0; @@ -153,7 +145,7 @@ 97C146E51CF9000F007C117D = { isa = PBXGroup; children = ( - BBA9BB3D1F179C320053B6EA /* ZBarSDK */, + ACE103BB1F8FCCA500D17794 /* ZBarSDK */, 9740EEB11CF90186004384FC /* Flutter */, 97C146F01CF9000F007C117D /* Runner */, 97C146EF1CF9000F007C117D /* Products */, @@ -196,6 +188,50 @@ name = "Supporting Files"; sourceTree = ""; }; + ACE103BB1F8FCCA500D17794 /* ZBarSDK */ = { + isa = PBXGroup; + children = ( + ACE103AB1F8FCC6000D17794 /* libzbar.a */, + ACE103BC1F8FCCD000D17794 /* Headers */, + ); + name = ZBarSDK; + sourceTree = ""; + }; + ACE103BC1F8FCCD000D17794 /* Headers */ = { + isa = PBXGroup; + children = ( + ACE103BD1F8FCCF300D17794 /* zbar */, + ACE103AD1F8FCC6F00D17794 /* zbar.h */, + ACE103AE1F8FCC6F00D17794 /* ZBarCaptureReader.h */, + ACE103AF1F8FCC6F00D17794 /* ZBarReaderViewController.h */, + ACE103B31F8FCC7000D17794 /* ZBarSDK.h */, + ACE103B71F8FCC7100D17794 /* ZBarSymbol.h */, + ACE103B11F8FCC7000D17794 /* ZBarCameraSimulator.h */, + ACE103B41F8FCC7000D17794 /* ZBarHelpController.h */, + ACE103B01F8FCC6F00D17794 /* ZBarImage.h */, + ACE103B51F8FCC7000D17794 /* ZBarImageScanner.h */, + ACE103B61F8FCC7100D17794 /* ZBarReaderController.h */, + ACE103B21F8FCC7000D17794 /* ZBarReaderView.h */, + ); + name = Headers; + sourceTree = ""; + }; + ACE103BD1F8FCCF300D17794 /* zbar */ = { + isa = PBXGroup; + children = ( + ACE103BF1F8FCD1500D17794 /* Decoder.h */, + ACE103C11F8FCD1500D17794 /* Exception.h */, + ACE103C31F8FCD1500D17794 /* Image.h */, + ACE103C51F8FCD1500D17794 /* ImageScanner.h */, + ACE103C01F8FCD1500D17794 /* Processor.h */, + ACE103C61F8FCD1500D17794 /* Scanner.h */, + ACE103C21F8FCD1500D17794 /* Symbol.h */, + ACE103C41F8FCD1500D17794 /* Video.h */, + ACE103BE1F8FCD1400D17794 /* Window.h */, + ); + name = zbar; + sourceTree = ""; + }; BBA9BB001F1786510053B6EA /* Frameworks */ = { isa = PBXGroup; children = ( @@ -211,70 +247,6 @@ name = Frameworks; sourceTree = ""; }; - BBA9BB3D1F179C320053B6EA /* ZBarSDK */ = { - isa = PBXGroup; - children = ( - BBA9BB3E1F179C320053B6EA /* Headers */, - BBA9BB551F179C320053B6EA /* libzbar.a */, - BBA9BB561F179C320053B6EA /* Resources */, - ); - path = ZBarSDK; - sourceTree = ""; - }; - BBA9BB3E1F179C320053B6EA /* Headers */ = { - isa = PBXGroup; - children = ( - BBA9BB3F1F179C320053B6EA /* ZBarSDK */, - ); - path = Headers; - sourceTree = ""; - }; - BBA9BB3F1F179C320053B6EA /* ZBarSDK */ = { - isa = PBXGroup; - children = ( - BBA9BB401F179C320053B6EA /* zbar */, - BBA9BB4A1F179C320053B6EA /* zbar.h */, - BBA9BB4B1F179C320053B6EA /* ZBarCameraSimulator.h */, - BBA9BB4C1F179C320053B6EA /* ZBarCaptureReader.h */, - BBA9BB4D1F179C320053B6EA /* ZBarHelpController.h */, - BBA9BB4E1F179C320053B6EA /* ZBarImage.h */, - BBA9BB4F1F179C320053B6EA /* ZBarImageScanner.h */, - BBA9BB501F179C320053B6EA /* ZBarReaderController.h */, - BBA9BB511F179C320053B6EA /* ZBarReaderView.h */, - BBA9BB521F179C320053B6EA /* ZBarReaderViewController.h */, - BBA9BB531F179C320053B6EA /* ZBarSDK.h */, - BBA9BB541F179C320053B6EA /* ZBarSymbol.h */, - ); - path = ZBarSDK; - sourceTree = ""; - }; - BBA9BB401F179C320053B6EA /* zbar */ = { - isa = PBXGroup; - children = ( - BBA9BB411F179C320053B6EA /* Decoder.h */, - BBA9BB421F179C320053B6EA /* Exception.h */, - BBA9BB431F179C320053B6EA /* Image.h */, - BBA9BB441F179C320053B6EA /* ImageScanner.h */, - BBA9BB451F179C320053B6EA /* Processor.h */, - BBA9BB461F179C320053B6EA /* Scanner.h */, - BBA9BB471F179C320053B6EA /* Symbol.h */, - BBA9BB481F179C320053B6EA /* Video.h */, - BBA9BB491F179C320053B6EA /* Window.h */, - ); - path = zbar; - sourceTree = ""; - }; - BBA9BB561F179C320053B6EA /* Resources */ = { - isa = PBXGroup; - children = ( - BBA9BB571F179C320053B6EA /* zbar-back.png */, - BBA9BB581F179C320053B6EA /* zbar-help.html */, - BBA9BB591F179C320053B6EA /* zbar-helpicons.png */, - BBA9BB5A1F179C320053B6EA /* zbar-samples.png */, - ); - path = Resources; - sourceTree = ""; - }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ @@ -312,7 +284,7 @@ TargetAttributes = { 97C146ED1CF9000F007C117D = { CreatedOnToolsVersion = 7.3.1; - DevelopmentTeam = SU33AJBF5T; + DevelopmentTeam = DZRQLG966A; LastSwiftMigration = 0830; }; }; @@ -340,15 +312,11 @@ isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( - BBA9BB5E1F179C320053B6EA /* zbar-helpicons.png in Resources */, 9740EEBB1CF902C7004384FC /* app.flx in Resources */, 97C147011CF9000F007C117D /* LaunchScreen.storyboard in Resources */, - BBA9BB5F1F179C320053B6EA /* zbar-samples.png in Resources */, 9740EEB51CF90195004384FC /* Generated.xcconfig in Resources */, 3B3967161E833CAA004F5970 /* AppFrameworkInfo.plist in Resources */, - BBA9BB5D1F179C320053B6EA /* zbar-help.html in Resources */, 9740EEB41CF90195004384FC /* Debug.xcconfig in Resources */, - BBA9BB5C1F179C320053B6EA /* zbar-back.png in Resources */, 97C146FE1CF9000F007C117D /* Assets.xcassets in Resources */, 97C146FC1CF9000F007C117D /* Main.storyboard in Resources */, ); @@ -398,7 +366,7 @@ ); runOnlyForDeploymentPostprocessing = 0; shellPath = /bin/sh; - shellScript = "diff \"${PODS_ROOT}/../Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; + shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n"; showEnvVarsInLog = 0; }; 889CEA9B47E2F8AFF76F6433 /* [CP] Embed Pods Frameworks */ = { @@ -560,11 +528,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD)"; + ARCHS = ( + "$(ARCHS_STANDARD)", + arm7s, + armv7, + arm64, + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = SU33AJBF5T; + DEVELOPMENT_TEAM = DZRQLG966A; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -577,6 +550,7 @@ "$(PROJECT_DIR)/Flutter", "$(PROJECT_DIR)/ZBarSDK", ); + ONLY_ACTIVE_ARCH = YES; PRODUCT_BUNDLE_IDENTIFIER = com.dinnect.checker; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; @@ -589,11 +563,16 @@ isa = XCBuildConfiguration; baseConfigurationReference = 7AFA3C8E1D35360C0083082E /* Release.xcconfig */; buildSettings = { - ARCHS = "$(ARCHS_STANDARD)"; + ARCHS = ( + "$(ARCHS_STANDARD)", + arm7s, + armv7, + arm64, + ); ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; DEFINES_MODULE = YES; - DEVELOPMENT_TEAM = SU33AJBF5T; + DEVELOPMENT_TEAM = DZRQLG966A; ENABLE_BITCODE = NO; FRAMEWORK_SEARCH_PATHS = ( "$(inherited)", @@ -610,9 +589,93 @@ PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; SWIFT_VERSION = 3.0; + VALID_ARCHS = "arm64 armv7s"; }; name = Release; }; + ACB2A14B1F964D1C00030E6F /* Debug-develop */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ALWAYS_SEARCH_USER_PATHS = NO; + CLANG_ANALYZER_NONNULL = YES; + CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; + CLANG_CXX_LIBRARY = "libc++"; + CLANG_ENABLE_MODULES = YES; + CLANG_ENABLE_OBJC_ARC = YES; + CLANG_WARN_BOOL_CONVERSION = YES; + CLANG_WARN_CONSTANT_CONVERSION = YES; + CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; + CLANG_WARN_EMPTY_BODY = YES; + CLANG_WARN_ENUM_CONVERSION = YES; + CLANG_WARN_INFINITE_RECURSION = YES; + CLANG_WARN_INT_CONVERSION = YES; + CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; + CLANG_WARN_SUSPICIOUS_MOVE = YES; + CLANG_WARN_UNREACHABLE_CODE = YES; + CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; + "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; + COPY_PHASE_STRIP = NO; + DEBUG_INFORMATION_FORMAT = dwarf; + ENABLE_STRICT_OBJC_MSGSEND = YES; + ENABLE_TESTABILITY = YES; + GCC_C_LANGUAGE_STANDARD = gnu99; + GCC_DYNAMIC_NO_PIC = NO; + GCC_NO_COMMON_BLOCKS = YES; + GCC_OPTIMIZATION_LEVEL = 0; + GCC_PREPROCESSOR_DEFINITIONS = ( + "DEBUG=1", + "$(inherited)", + ); + GCC_WARN_64_TO_32_BIT_CONVERSION = YES; + GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; + GCC_WARN_UNDECLARED_SELECTOR = YES; + GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; + GCC_WARN_UNUSED_FUNCTION = YES; + GCC_WARN_UNUSED_VARIABLE = YES; + IPHONEOS_DEPLOYMENT_TARGET = 8.0; + MTL_ENABLE_DEBUG_INFO = YES; + ONLY_ACTIVE_ARCH = YES; + SDKROOT = iphoneos; + TARGETED_DEVICE_FAMILY = "1,2"; + }; + name = "Debug-develop"; + }; + ACB2A14C1F964D1C00030E6F /* Debug-develop */ = { + isa = XCBuildConfiguration; + baseConfigurationReference = 9740EEB21CF90195004384FC /* Debug.xcconfig */; + buildSettings = { + ARCHS = ( + "$(ARCHS_STANDARD)", + arm7s, + armv7, + arm64, + ); + ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; + CLANG_ENABLE_MODULES = YES; + DEFINES_MODULE = YES; + DEVELOPMENT_TEAM = DZRQLG966A; + ENABLE_BITCODE = NO; + FRAMEWORK_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + ); + INFOPLIST_FILE = Runner/Info.plist; + LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; + LIBRARY_SEARCH_PATHS = ( + "$(inherited)", + "$(PROJECT_DIR)/Flutter", + "$(PROJECT_DIR)/ZBarSDK", + ); + ONLY_ACTIVE_ARCH = YES; + PRODUCT_BUNDLE_IDENTIFIER = com.dinnect.checker; + PRODUCT_NAME = "$(TARGET_NAME)"; + SWIFT_OBJC_BRIDGING_HEADER = "Runner/Runner-Bridging-Header.h"; + SWIFT_OPTIMIZATION_LEVEL = "-Onone"; + SWIFT_VERSION = 3.0; + }; + name = "Debug-develop"; + }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ @@ -620,6 +683,7 @@ isa = XCConfigurationList; buildConfigurations = ( 97C147031CF9000F007C117D /* Debug */, + ACB2A14B1F964D1C00030E6F /* Debug-develop */, 97C147041CF9000F007C117D /* Release */, ); defaultConfigurationIsVisible = 0; @@ -629,6 +693,7 @@ isa = XCConfigurationList; buildConfigurations = ( 97C147061CF9000F007C117D /* Debug */, + ACB2A14C1F964D1C00030E6F /* Debug-develop */, 97C147071CF9000F007C117D /* Release */, ); defaultConfigurationIsVisible = 0; diff --git a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme index 1c95807..78d743b 100644 --- a/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme +++ b/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme @@ -26,6 +26,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" shouldUseLaunchSchemeArgsEnv = "YES"> @@ -45,6 +46,7 @@ buildConfiguration = "Debug" selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" + language = "" launchStyle = "0" useCustomWorkingDirectory = "NO" ignoresPersistentStateOnLaunch = "NO" @@ -61,6 +63,13 @@ ReferencedContainer = "container:Runner.xcodeproj"> + + + + diff --git a/ios/Runner.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/develop.xcscheme b/ios/Runner.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/develop.xcscheme new file mode 100644 index 0000000..2949937 --- /dev/null +++ b/ios/Runner.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/develop.xcscheme @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/xcschememanagement.plist b/ios/Runner.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/xcschememanagement.plist new file mode 100644 index 0000000..ab14286 --- /dev/null +++ b/ios/Runner.xcodeproj/xcuserdata/ntrlab.xcuserdatad/xcschemes/xcschememanagement.plist @@ -0,0 +1,19 @@ + + + + + SchemeUserState + + Runner.xcscheme_^#shared#^_ + + orderHint + 4 + + develop.xcscheme + + orderHint + 3 + + + + diff --git a/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/IDEFindNavigatorScopes.plist b/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/IDEFindNavigatorScopes.plist new file mode 100644 index 0000000..5dd5da8 --- /dev/null +++ b/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/IDEFindNavigatorScopes.plist @@ -0,0 +1,5 @@ + + + + + diff --git a/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/UserInterfaceState.xcuserstate b/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/UserInterfaceState.xcuserstate new file mode 100644 index 0000000..26c4299 Binary files /dev/null and b/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist b/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist new file mode 100644 index 0000000..68dbbe0 --- /dev/null +++ b/ios/Runner.xcworkspace/xcuserdata/ntrlab.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist @@ -0,0 +1,151 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/ios/Runner/AppDelegate.m b/ios/Runner/AppDelegate.m index ba562ac..ecbe030 100644 --- a/ios/Runner/AppDelegate.m +++ b/ios/Runner/AppDelegate.m @@ -6,24 +6,55 @@ @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { - + [GeneratedPluginRegistrant registerWithRegistry:self]; - + FlutterViewController* controller = (FlutterViewController*)self.window.rootViewController; - FlutterMethodChannel* scannerChannel = [FlutterMethodChannel - methodChannelWithName:@"com.yourcompany.checker/scanner" + FlutterMethodChannel* platformChannel = [FlutterMethodChannel + methodChannelWithName:@"com.dinect.checker/instance_id" binaryMessenger:controller]; - - [scannerChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { - ScannerViewController *modalViewController = [ScannerViewController new]; - [controller presentViewController:modalViewController animated:YES completion:nil]; }]; - + + __weak FlutterMethodChannel* weekPlatformChannel = platformChannel; + + [platformChannel setMethodCallHandler:^(FlutterMethodCall* call, FlutterResult result) { + NSLog(@"%@", call.method); + +// NSDictionary *dict = [[NSProcessInfo processInfo] environment]; +// NSLog(@"%@", dict); + + if ([@"getLocale" isEqualToString:call.method]) { + result(@"ru"); + } else if ([@"getFlavor" isEqualToString:call.method]) { + result(@"autobonus"); + } else if ([@"getCurrency" isEqualToString:call.method]) { + result(@643); + } else if ([@"startScanner" isEqualToString:call.method]) { + ScannerViewController *modalViewController = [ScannerViewController new]; + modalViewController.platformChannel = weekPlatformChannel; + [controller presentViewController:modalViewController animated:YES completion:nil]; +// [weekPlatformChannel invokeMethod:@"purchase" arguments:@[@"semyon", @"49492872388755"]]; + } else if ([@"isOnline" isEqualToString:call.method]) { + result(@YES); + } else if ([@"getSupportPhone" isEqualToString:call.method]) { + result(@"8 800 555 35 35"); + } else if ([@"getSupportUrl" isEqualToString:call.method]) { + result(@"http://yandex.ru/"); + } else if ([@"getEndpoint" isEqualToString:call.method]) { + result(@"https://pos-api-int.dinect.com/20130701/"); + } else if ([@"getAppToken" isEqualToString:call.method]) { + result(@"9fec83cdca38c357e6b65dbb17514cdd36bf2a08"); + } else if ([@"getAppTitle" isEqualToString:call.method]) { + result(@"Autobonus"); + } else if ([@"showBonus" isEqualToString:call.method]) { + result(@YES); + } else { + result(FlutterMethodNotImplemented); + } + + }]; + return [super application:application didFinishLaunchingWithOptions:launchOptions]; } -- (void) showScanner { - -} - @end diff --git a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json index d22f10b..d225b3c 100644 --- a/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -107,10 +107,15 @@ "idiom" : "ipad", "filename" : "Icon-App-83.5x83.5@2x.png", "scale" : "2x" + }, + { + "idiom" : "ios-marketing", + "size" : "1024x1024", + "scale" : "1x" } ], "info" : { "version" : 1, "author" : "xcode" } -} +} \ No newline at end of file diff --git a/ios/Runner/Base.lproj/Main.storyboard b/ios/Runner/Base.lproj/Main.storyboard index 21f08d9..2c4a6f1 100644 --- a/ios/Runner/Base.lproj/Main.storyboard +++ b/ios/Runner/Base.lproj/Main.storyboard @@ -1,11 +1,11 @@ - + - + diff --git a/ios/Runner/ScannerViewController.swift b/ios/Runner/ScannerViewController.swift index 91a18a1..df71d27 100644 --- a/ios/Runner/ScannerViewController.swift +++ b/ios/Runner/ScannerViewController.swift @@ -7,10 +7,11 @@ // import UIKit +import Flutter extension ZBarSymbolSet: Sequence { - public typealias Element = ZBarSymbol - public typealias Iterator = NSFastEnumerationIterator + //public typealias Element = ZBarSymbol + //public typealias Iterator = NSFastEnumerationIterator public func makeIterator() -> NSFastEnumerationIterator { return NSFastEnumerationIterator(self) @@ -18,7 +19,8 @@ extension ZBarSymbolSet: Sequence { } @objc class ScannerViewController: UIViewController, ZBarReaderDelegate { - + var platformChannel: FlutterMethodChannel? + override func viewDidLoad() { super.viewDidLoad() } @@ -28,20 +30,35 @@ extension ZBarSymbolSet: Sequence { let readerViewController = ZBarReaderViewController() readerViewController.readerDelegate = self readerViewController.readerView.zoom = 1.0 - readerViewController.showsZBarControls = false + readerViewController.showsZBarControls = true self.present(readerViewController, animated: true) } + + + func imagePickerController(_ picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [String : Any]) { guard let symbols = info[ZBarReaderControllerResults] as? ZBarSymbolSet else { return } for symbol in symbols { if let symbol = symbol as? ZBarSymbol, let data = symbol.data { - - let toast = UIAlertView() - toast.message = data - toast.show() + + if let platformChannel = self.platformChannel { + self.dismiss(animated: true, completion: { + self.presentingViewController?.dismiss(animated: true, completion: { + platformChannel.invokeMethod("findUserAndPurchase", arguments: [data], result: { (result: Any?) in + print("\(result ?? "")") + }) + }) + }) +// let result = platformChannel.invokeMethod("getUserByCode", arguments: [data], handleResult(result: FlutterResult)) +// print(result); + } + +// let toast = UIAlertView() +// toast.message = data +// toast.show() navigationController?.popViewController(animated: true) } diff --git a/ios/ServiceDefinitions.json b/ios/ServiceDefinitions.json new file mode 100644 index 0000000..3c470ca --- /dev/null +++ b/ios/ServiceDefinitions.json @@ -0,0 +1 @@ +{"services":[]} \ No newline at end of file diff --git a/ios/ZBarSDK/Headers/ZBarCameraSimulator.h b/ios/ZBarSDK/Headers/ZBarCameraSimulator.h new file mode 100644 index 0000000..61bb07f --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarCameraSimulator.h @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------ +// Copyright 2010-2011 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +@class ZBarReaderView; + +// hack around missing simulator support for AVCapture interfaces + +@interface ZBarCameraSimulator + : NSObject + < UINavigationControllerDelegate, + UIImagePickerControllerDelegate, + UIPopoverControllerDelegate > +{ + UIViewController *viewController; + ZBarReaderView *readerView; + UIImagePickerController *picker; + UIPopoverController *pickerPopover; +} + +- (id) initWithViewController: (UIViewController*) viewController; +- (void) takePicture; + +@property (nonatomic, assign) ZBarReaderView *readerView; + +@end diff --git a/ios/ZBarSDK/Headers/ZBarCaptureReader.h b/ios/ZBarSDK/Headers/ZBarCaptureReader.h new file mode 100644 index 0000000..e466130 --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarCaptureReader.h @@ -0,0 +1,111 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +@class AVCaptureVideoDataOutput, AVCaptureOutput; +@class ZBarCaptureReader, ZBarCVImage; + +@protocol ZBarCaptureDelegate + +// called when a new barcode is detected. the image refers to the +// video buffer and must not be retained for long +- (void) captureReader: (ZBarCaptureReader*) captureReader + didReadNewSymbolsFromImage: (ZBarImage*) image; + +@optional +// called when a potential/uncertain barcode is detected. will also +// be called *after* captureReader:didReadNewSymbolsFromImage: +// when good barcodes are detected +- (void) captureReader: (ZBarCaptureReader*) captureReader + didTrackSymbols: (ZBarSymbolSet*) symbols; + +@end + +@interface ZBarCaptureReader + : NSObject +{ +#if !TARGET_IPHONE_SIMULATOR + AVCaptureVideoDataOutput *captureOutput; + id captureDelegate; + ZBarImageScanner *scanner; + CGRect scanCrop; + CGSize size; + CGFloat framesPerSecond; + BOOL enableCache; + + dispatch_queue_t queue; + ZBarImage *image; + ZBarCVImage *result; + volatile uint32_t state; + int framecnt; + unsigned width, height; + uint64_t t_frame, t_fps, t_scan; + CGFloat dt_frame; +#endif +} + +// supply a pre-configured image scanner +- (id) initWithImageScanner: (ZBarImageScanner*) imageScanner; + +// this must be called before the session is started +- (void) willStartRunning; + +// this must be called *before* the session is stopped +- (void) willStopRunning; + +// clear the internal result cache +- (void) flushCache; + +// capture the next frame after processing. the captured image will +// follow the same delegate path as an image with decoded symbols. +- (void) captureFrame; + +// the capture output. add this to an instance of AVCaptureSession +@property (nonatomic, readonly) AVCaptureOutput *captureOutput; + +// delegate is notified of decode results and symbol tracking. +@property (nonatomic, assign) id captureDelegate; + +// access to image scanner for configuration. +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// region of image to scan in normalized coordinates. +// NB horizontal crop currently ignored... +@property (nonatomic, assign) CGRect scanCrop; + +// size of video frames. +@property (nonatomic, readonly) CGSize size; + +// (quickly) gate the reader function without interrupting the video +// stream. also flushes the cache when enabled. defaults to *NO* +@property (nonatomic) BOOL enableReader; + +// current frame rate (for debug/optimization). +// only valid when running +@property (nonatomic, readonly) CGFloat framesPerSecond; + +@property (nonatomic) BOOL enableCache; + +@end diff --git a/ios/ZBarSDK/Headers/ZBarHelpController.h b/ios/ZBarSDK/Headers/ZBarHelpController.h new file mode 100644 index 0000000..37639dd --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarHelpController.h @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import + +@class ZBarHelpController; + +@protocol ZBarHelpDelegate +@optional + +- (void) helpControllerDidFinish: (ZBarHelpController*) help; + +@end + + +// failure dialog w/a few useful tips + +@interface ZBarHelpController : UIViewController + < UIWebViewDelegate, + UIAlertViewDelegate > +{ + NSString *reason; + id delegate; + UIWebView *webView; + UIToolbar *toolbar; + UIBarButtonItem *doneBtn, *backBtn, *space; + NSURL *linkURL; + NSUInteger orientations; +} + +@property (nonatomic, assign) id delegate; + +// designated initializer +- (id) initWithReason: (NSString*) reason; + +- (BOOL) isInterfaceOrientationSupported: (UIInterfaceOrientation) orientation; +- (void) setInterfaceOrientation: (UIInterfaceOrientation) orientation + supported: (BOOL) supported; + +@end diff --git a/ios/ZBarSDK/Headers/ZBarImage.h b/ios/ZBarSDK/Headers/ZBarImage.h new file mode 100644 index 0000000..2e6ec8e --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarImage.h @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "zbar.h" +#import "ZBarSymbol.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar image + +@interface ZBarImage : NSObject +{ + zbar_image_t *zimg; + double t_convert; +} + +@property (nonatomic) unsigned long format; +@property (nonatomic) unsigned sequence; +@property (nonatomic) CGSize size; +@property (nonatomic) CGRect crop; +@property (readonly, nonatomic) const void *data; +@property (readonly, nonatomic) unsigned long dataLength; +@property (copy, nonatomic) ZBarSymbolSet *symbols; +@property (readonly, nonatomic) zbar_image_t *zbarImage; +@property (readonly, nonatomic) UIImage *UIImage; + +- (id) initWithImage: (zbar_image_t*) image; +- (id) initWithCGImage: (CGImageRef) image; +- (id) initWithCGImage: (CGImageRef) image + size: (CGSize) size; +- (id) initWithCGImage: (CGImageRef) image + crop: (CGRect) crop + size: (CGSize) size; + +- (void) setData: (const void*) data + withLength: (unsigned long) length; +- (UIImage*) UIImageWithOrientation: (UIImageOrientation) imageOrientation; +- (void) cleanup; + ++ (unsigned long) fourcc: (NSString*) format; + +#if 0 +- convertToFormat: (unsigned long) format; +#endif + +@end diff --git a/ios/ZBarSDK/Headers/ZBarImageScanner.h b/ios/ZBarSDK/Headers/ZBarImageScanner.h new file mode 100644 index 0000000..c01b047 --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarImageScanner.h @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "zbar.h" +#import "ZBarImage.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar image scanner + +@interface ZBarImageScanner : NSObject +{ + zbar_image_scanner_t *scanner; +} + +@property (nonatomic) BOOL enableCache; +@property (readonly, nonatomic) ZBarSymbolSet *results; + +// decoder configuration +- (void) parseConfig: (NSString*) configStr; +- (void) setSymbology: (zbar_symbol_type_t) symbology + config: (zbar_config_t) config + to: (int) value; + +// image scanning interface +- (NSInteger) scanImage: (ZBarImage*) image; + +@end diff --git a/ios/ZBarSDK/Headers/ZBarReaderController.h b/ios/ZBarSDK/Headers/ZBarReaderController.h new file mode 100644 index 0000000..9121971 --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarReaderController.h @@ -0,0 +1,142 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +typedef enum { + // default interface provided by UIImagePickerController - user manually + // captures an image by pressing a button + ZBarReaderControllerCameraModeDefault = 0, + + // automatically scan by taking screenshots with UIGetScreenImage(). + // resolution is limited by the screen, so this is inappropriate for + // longer codes + ZBarReaderControllerCameraModeSampling, + + // automatically scan by rapidly taking pictures with takePicture. + // tradeoff resolution with frame rate by adjusting the crop, and size + // properties of the reader along with the density configs of the image + // scanner + ZBarReaderControllerCameraModeSequence, + +} ZBarReaderControllerCameraMode; + + +@class ZBarReaderController, ZBarHelpController; + +@protocol ZBarReaderDelegate +@optional + +// called when no barcode is found in an image selected by the user. +// if retry is NO, the delegate *must* dismiss the controller +- (void) readerControllerDidFailToRead: (ZBarReaderController*) reader + withRetry: (BOOL) retry; + +@end + + +@interface ZBarReaderController + : UIImagePickerController + < UINavigationControllerDelegate, + UIImagePickerControllerDelegate > +{ + ZBarImageScanner *scanner; + ZBarHelpController *help; + UIView *overlay, *boxView; + CALayer *boxLayer; + + UIToolbar *toolbar; + UIBarButtonItem *cancelBtn, *scanBtn, *space[3]; + UIButton *infoBtn; + + id readerDelegate; + BOOL showsZBarControls, showsHelpOnFail, takesPicture, enableCache; + ZBarReaderControllerCameraMode cameraMode; + CGRect scanCrop; + NSInteger maxScanDimension; + + BOOL hasOverlay, sampling; + uint64_t t_frame; + double dt_frame; + + ZBarSymbol *symbol; +} + +// access to configure image scanner +@property (readonly, nonatomic) ZBarImageScanner *scanner; + +// barcode result recipient (NB don't use delegate) +@property (nonatomic, assign) id readerDelegate; + +// whether to use alternate control set +@property (nonatomic) BOOL showsZBarControls; + +// whether to display helpful information when decoding fails +@property (nonatomic) BOOL showsHelpOnFail; + +// how to use the camera (when sourceType == Camera) +@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; + +// whether to outline symbols with the green tracking box. +@property (nonatomic) BOOL tracksSymbols; + +// whether to automatically take a full picture when a barcode is detected +// (when cameraMode == Sampling) +@property (nonatomic) BOOL takesPicture; + +// whether to use the "cache" for realtime modes (default YES). this can be +// used to safely disable the inter-frame consistency and duplicate checks, +// speeding up recognition, iff: +// 1. the controller is dismissed when a barcode is read and +// 2. unreliable symbologies are disabled (all EAN/UPC variants and I2/5) +@property (nonatomic) BOOL enableCache; + +// crop images for scanning. the original image will be cropped to this +// rectangle before scanning. the rectangle is normalized to the image size +// and aspect ratio; useful values will place the rectangle between 0 and 1 +// on each axis, where the x-axis corresponds to the image major axis. +// defaults to the full image (0, 0, 1, 1). +@property (nonatomic) CGRect scanCrop; + +// scale image to scan. after cropping, the image will be scaled if +// necessary, such that neither of its dimensions exceed this value. +// defaults to 640. +@property (nonatomic) NSInteger maxScanDimension; + +// display the built-in help browser. for use with custom overlays if +// you don't also want to create your own help view. only send this +// message when the reader is displayed. the argument will be passed +// to the onZBarHelp() javascript function. +- (void) showHelpWithReason: (NSString*) reason; + +// direct scanner interface - scan UIImage and return something enumerable +- (id ) scanImage: (CGImageRef) image; + +@end + +extern NSString* const ZBarReaderControllerResults; diff --git a/ios/ZBarSDK/Headers/ZBarReaderView.h b/ios/ZBarSDK/Headers/ZBarReaderView.h new file mode 100644 index 0000000..dfb4dfd --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarReaderView.h @@ -0,0 +1,140 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +@class AVCaptureSession, AVCaptureDevice; +@class CALayer; +@class ZBarImageScanner, ZBarCaptureReader, ZBarReaderView; + +// delegate is notified of decode results. + +@protocol ZBarReaderViewDelegate < NSObject > + +- (void) readerView: (ZBarReaderView*) readerView + didReadSymbols: (ZBarSymbolSet*) symbols + fromImage: (UIImage*) image; + +@optional +- (void) readerViewDidStart: (ZBarReaderView*) readerView; +- (void) readerView: (ZBarReaderView*) readerView + didStopWithError: (NSError*) error; + +@end + +// read barcodes from the displayed video preview. the view maintains +// a complete video capture session feeding a ZBarCaptureReader and +// presents the associated preview with symbol tracking annotations. + +@interface ZBarReaderView + : UIView +{ + id readerDelegate; + ZBarCaptureReader *captureReader; + CGRect scanCrop, effectiveCrop; + CGAffineTransform previewTransform; + CGFloat zoom, zoom0, maxZoom; + UIColor *trackingColor; + BOOL tracksSymbols, showsFPS; + NSInteger torchMode; + UIInterfaceOrientation interfaceOrientation; + NSTimeInterval animationDuration; + + CALayer *preview, *overlay, *tracking, *cropLayer; + UIView *fpsView; + UILabel *fpsLabel; + UIPinchGestureRecognizer *pinch; + CGFloat imageScale; + CGSize imageSize; + BOOL started, running, locked; +} + +// supply a pre-configured image scanner. +- (id) initWithImageScanner: (ZBarImageScanner*) imageScanner; + +// start the video stream and barcode reader. +- (void) start; + +// stop the video stream and barcode reader. +- (void) stop; + +// clear the internal result cache +- (void) flushCache; + +// compensate for device/camera/interface orientation +- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration; + +// delegate is notified of decode results. +@property (nonatomic, assign) id readerDelegate; + +// access to image scanner for configuration. +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// whether to display the tracking annotation for uncertain barcodes +// (default YES). +@property (nonatomic) BOOL tracksSymbols; + +// color of the tracking box (default green) +@property (nonatomic, retain) UIColor *trackingColor; + +// enable pinch gesture recognition for zooming the preview/decode +// (default YES). +@property (nonatomic) BOOL allowsPinchZoom; + +// torch mode to set automatically (default Auto). +@property (nonatomic) NSInteger torchMode; + +// whether to display the frame rate for debug/configuration +// (default NO). +@property (nonatomic) BOOL showsFPS; + +// zoom scale factor applied to video preview *and* scanCrop. +// also updated by pinch-zoom gesture. clipped to range [1,maxZoom], +// defaults to 1.25 +@property (nonatomic) CGFloat zoom; +- (void) setZoom: (CGFloat) zoom + animated: (BOOL) animated; + +// maximum settable zoom factor. +@property (nonatomic) CGFloat maxZoom; + +// the region of the image that will be scanned. normalized coordinates. +@property (nonatomic) CGRect scanCrop; + +// additional transform applied to video preview. +// (NB *not* applied to scan crop) +@property (nonatomic) CGAffineTransform previewTransform; + +// specify an alternate capture device. +@property (nonatomic, retain) AVCaptureDevice *device; + +// direct access to the capture session. warranty void if opened... +@property (nonatomic, readonly) AVCaptureSession *session; +@property (nonatomic, readonly) ZBarCaptureReader *captureReader; + +// this flag still works, but its use is deprecated +@property (nonatomic) BOOL enableCache; + +@end diff --git a/ios/ZBarSDK/Headers/ZBarReaderViewController.h b/ios/ZBarSDK/Headers/ZBarReaderViewController.h new file mode 100644 index 0000000..20fb7e9 --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarReaderViewController.h @@ -0,0 +1,130 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarReaderController.h" + +// orientation set support +#define ZBarOrientationMask(orient) (1 << orient) +#define ZBarOrientationMaskAll \ + (ZBarOrientationMask(UIInterfaceOrientationPortrait) | \ + ZBarOrientationMask(UIInterfaceOrientationPortraitUpsideDown) | \ + ZBarOrientationMask(UIInterfaceOrientationLandscapeLeft) | \ + ZBarOrientationMask(UIInterfaceOrientationLandscapeRight)) + +@class ZBarReaderView, ZBarCameraSimulator; + +// drop in video scanning replacement for ZBarReaderController. +// this is a thin controller around a ZBarReaderView that adds the UI +// controls and select functionality offered by ZBarReaderController. +// Automatically falls back to a ZBarReaderController if video APIs +// are unavailable (eg for OS < 4.0) + +@interface ZBarReaderViewController + : UIViewController +{ + ZBarImageScanner *scanner; + id readerDelegate; + ZBarReaderView *readerView; + UIView *cameraOverlayView; + CGAffineTransform cameraViewTransform; + CGRect scanCrop; + NSUInteger supportedOrientationsMask; + UIImagePickerControllerCameraDevice cameraDevice; + UIImagePickerControllerCameraFlashMode cameraFlashMode; + UIImagePickerControllerQualityType videoQuality; + BOOL showsZBarControls, tracksSymbols, enableCache; + + ZBarHelpController *helpController; + UIView *controls, *shutter; + BOOL didHideStatusBar, rotating; + ZBarCameraSimulator *cameraSim; +} + +// access to configure image scanner +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// barcode result recipient +@property (nonatomic, assign) id readerDelegate; + +// whether to use alternate control set +@property (nonatomic) BOOL showsZBarControls; + +// whether to show the green tracking box. note that, even when +// enabled, the box will only be visible when scanning EAN and I2/5. +@property (nonatomic) BOOL tracksSymbols; + +// interface orientation support. bit-mask of accepted orientations. +// see eg ZBarOrientationMask() and ZBarOrientationMaskAll +@property (nonatomic) NSUInteger supportedOrientationsMask; + +// crop images for scanning. the image will be cropped to this +// rectangle before scanning. the rectangle is normalized to the +// image size and aspect ratio; useful values will place the rectangle +// between 0 and 1 on each axis, where the x-axis corresponds to the +// image major axis. defaults to the full image (0, 0, 1, 1). +@property (nonatomic) CGRect scanCrop; + +// provide a custom overlay. note that this can be used with +// showsZBarControls enabled (but not if you want backward compatibility) +@property (nonatomic, retain) UIView *cameraOverlayView; + +// transform applied to the preview image. +@property (nonatomic) CGAffineTransform cameraViewTransform; + +// display the built-in help browser. the argument will be passed to +// the onZBarHelp() javascript function. +- (void) showHelpWithReason: (NSString*) reason; + +// capture the next frame and send it over the usual delegate path. +- (void) takePicture; + +// these attempt to emulate UIImagePickerController ++ (BOOL) isCameraDeviceAvailable: (UIImagePickerControllerCameraDevice) cameraDevice; ++ (BOOL) isFlashAvailableForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice; ++ (NSArray*) availableCaptureModesForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice; +@property(nonatomic) UIImagePickerControllerCameraDevice cameraDevice; +@property(nonatomic) UIImagePickerControllerCameraFlashMode cameraFlashMode; +@property(nonatomic) UIImagePickerControllerCameraCaptureMode cameraCaptureMode; +@property(nonatomic) UIImagePickerControllerQualityType videoQuality; + +// direct access to the ZBarReaderView +@property (nonatomic, readonly) ZBarReaderView *readerView; + +// this flag still works, but its use is deprecated +@property (nonatomic) BOOL enableCache; + +// these are present only for backward compatibility. +// they will error if inappropriate/unsupported values are set +@property (nonatomic) UIImagePickerControllerSourceType sourceType; // Camera +@property (nonatomic) BOOL allowsEditing; // NO +@property (nonatomic) BOOL allowsImageEditing; // NO +@property (nonatomic) BOOL showsCameraControls; // NO +@property (nonatomic) BOOL showsHelpOnFail; // ignored +@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; // Sampling +@property (nonatomic) BOOL takesPicture; // NO +@property (nonatomic) NSInteger maxScanDimension; // ignored + ++ (BOOL) isSourceTypeAvailable: (UIImagePickerControllerSourceType) sourceType; + +@end diff --git a/ios/ZBarSDK/Headers/ZBarSDK.h b/ios/ZBarSDK/Headers/ZBarSDK.h new file mode 100644 index 0000000..b7cd52d --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarSDK.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------ + * Copyright 2010 (c) Jeff Brown + * + * This file is part of the ZBar Bar Code Reader. + * + * The ZBar Bar Code Reader is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * The ZBar Bar Code Reader is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with the ZBar Bar Code Reader; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * http://sourceforge.net/projects/zbar + *------------------------------------------------------------------------*/ + +#import "zbar.h" + +#import "ZBarSymbol.h" +#import "ZBarImage.h" +#import "ZBarImageScanner.h" +#import "ZBarReaderView.h" +#import "ZBarReaderViewController.h" +#import "ZBarReaderController.h" +#import "ZBarCaptureReader.h" +#import "ZBarHelpController.h" +#import "ZBarCameraSimulator.h" diff --git a/ios/ZBarSDK/Headers/ZBarSymbol.h b/ios/ZBarSDK/Headers/ZBarSymbol.h new file mode 100644 index 0000000..c8a8574 --- /dev/null +++ b/ios/ZBarSDK/Headers/ZBarSymbol.h @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import "zbar.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar result types + +@interface ZBarSymbolSet + : NSObject +{ + const zbar_symbol_set_t *set; + BOOL filterSymbols; +} + +@property (readonly, nonatomic) int count; +@property (readonly, nonatomic) const zbar_symbol_set_t *zbarSymbolSet; +@property (nonatomic) BOOL filterSymbols; + +- (id) initWithSymbolSet: (const zbar_symbol_set_t*) set; + +@end + + +@interface ZBarSymbol : NSObject +{ + const zbar_symbol_t *symbol; +} + +@property (readonly, nonatomic) zbar_symbol_type_t type; +@property (readonly, nonatomic) NSString *typeName; +@property (readonly, nonatomic) NSUInteger configMask; +@property (readonly, nonatomic) NSUInteger modifierMask; +@property (readonly, nonatomic) NSString *data; +@property (readonly, nonatomic) int quality; +@property (readonly, nonatomic) int count; +@property (readonly, nonatomic) zbar_orientation_t orientation; +@property (readonly, nonatomic) ZBarSymbolSet *components; +@property (readonly, nonatomic) const zbar_symbol_t *zbarSymbol; +@property (readonly, nonatomic) CGRect bounds; + +- (id) initWithSymbol: (const zbar_symbol_t*) symbol; + ++ (NSString*) nameForType: (zbar_symbol_type_t) type; + +@end diff --git a/ios/ZBarSDK/Headers/zbar.h b/ios/ZBarSDK/Headers/zbar.h new file mode 100644 index 0000000..6927113 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar.h @@ -0,0 +1,1498 @@ +/*------------------------------------------------------------------------ + * Copyright 2007-2010 (c) Jeff Brown + * + * This file is part of the ZBar Bar Code Reader. + * + * The ZBar Bar Code Reader is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * The ZBar Bar Code Reader is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with the ZBar Bar Code Reader; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * http://sourceforge.net/projects/zbar + *------------------------------------------------------------------------*/ +#ifndef _ZBAR_H_ +#define _ZBAR_H_ + +/** @file + * ZBar Barcode Reader C API definition + */ + +/** @mainpage + * + * interface to the barcode reader is available at several levels. + * most applications will want to use the high-level interfaces: + * + * @section high-level High-Level Interfaces + * + * these interfaces wrap all library functionality into an easy-to-use + * package for a specific toolkit: + * - the "GTK+ 2.x widget" may be used with GTK GUI applications. a + * Python wrapper is included for PyGtk + * - the @ref zbar::QZBar "Qt4 widget" may be used with Qt GUI + * applications + * - the Processor interface (in @ref c-processor "C" or @ref + * zbar::Processor "C++") adds a scanning window to an application + * with no GUI. + * + * @section mid-level Intermediate Interfaces + * + * building blocks used to construct high-level interfaces: + * - the ImageScanner (in @ref c-imagescanner "C" or @ref + * zbar::ImageScanner "C++") looks for barcodes in a library defined + * image object + * - the Window abstraction (in @ref c-window "C" or @ref + * zbar::Window "C++") sinks library images, displaying them on the + * platform display + * - the Video abstraction (in @ref c-video "C" or @ref zbar::Video + * "C++") sources library images from a video device + * + * @section low-level Low-Level Interfaces + * + * direct interaction with barcode scanning and decoding: + * - the Scanner (in @ref c-scanner "C" or @ref zbar::Scanner "C++") + * looks for barcodes in a linear intensity sample stream + * - the Decoder (in @ref c-decoder "C" or @ref zbar::Decoder "C++") + * extracts barcodes from a stream of bar and space widths + */ + +#ifdef __cplusplus + +/** C++ namespace for library interfaces */ +namespace zbar { + extern "C" { +#endif + + +/** @name Global library interfaces */ +/*@{*/ + +/** "color" of element: bar or space. */ +typedef enum zbar_color_e { + ZBAR_SPACE = 0, /**< light area or space between bars */ + ZBAR_BAR = 1, /**< dark area or colored bar segment */ +} zbar_color_t; + +/** decoded symbol type. */ +typedef enum zbar_symbol_type_e { + ZBAR_NONE = 0, /**< no symbol decoded */ + ZBAR_PARTIAL = 1, /**< intermediate status */ + ZBAR_EAN2 = 2, /**< GS1 2-digit add-on */ + ZBAR_EAN5 = 5, /**< GS1 5-digit add-on */ + ZBAR_EAN8 = 8, /**< EAN-8 */ + ZBAR_UPCE = 9, /**< UPC-E */ + ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). @since 0.4 */ + ZBAR_UPCA = 12, /**< UPC-A */ + ZBAR_EAN13 = 13, /**< EAN-13 */ + ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */ + ZBAR_COMPOSITE = 15, /**< EAN/UPC composite */ + ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */ + ZBAR_DATABAR = 34, /**< GS1 DataBar (RSS). @since 0.11 */ + ZBAR_DATABAR_EXP = 35, /**< GS1 DataBar Expanded. @since 0.11 */ + ZBAR_CODABAR = 38, /**< Codabar. @since 0.11 */ + ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */ + ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */ + ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */ + ZBAR_CODE93 = 93, /**< Code 93. @since 0.11 */ + ZBAR_CODE128 = 128, /**< Code 128 */ + + /** mask for base symbol type. + * @deprecated in 0.11, remove this from existing code + */ + ZBAR_SYMBOL = 0x00ff, + /** 2-digit add-on flag. + * @deprecated in 0.11, a ::ZBAR_EAN2 component is used for + * 2-digit GS1 add-ons + */ + ZBAR_ADDON2 = 0x0200, + /** 5-digit add-on flag. + * @deprecated in 0.11, a ::ZBAR_EAN5 component is used for + * 5-digit GS1 add-ons + */ + ZBAR_ADDON5 = 0x0500, + /** add-on flag mask. + * @deprecated in 0.11, GS1 add-ons are represented using composite + * symbols of type ::ZBAR_COMPOSITE; add-on components use ::ZBAR_EAN2 + * or ::ZBAR_EAN5 + */ + ZBAR_ADDON = 0x0700, +} zbar_symbol_type_t; + +/** decoded symbol coarse orientation. + * @since 0.11 + */ +typedef enum zbar_orientation_e { + ZBAR_ORIENT_UNKNOWN = -1, /**< unable to determine orientation */ + ZBAR_ORIENT_UP, /**< upright, read left to right */ + ZBAR_ORIENT_RIGHT, /**< sideways, read top to bottom */ + ZBAR_ORIENT_DOWN, /**< upside-down, read right to left */ + ZBAR_ORIENT_LEFT, /**< sideways, read bottom to top */ +} zbar_orientation_t; + +/** error codes. */ +typedef enum zbar_error_e { + ZBAR_OK = 0, /**< no error */ + ZBAR_ERR_NOMEM, /**< out of memory */ + ZBAR_ERR_INTERNAL, /**< internal library error */ + ZBAR_ERR_UNSUPPORTED, /**< unsupported request */ + ZBAR_ERR_INVALID, /**< invalid request */ + ZBAR_ERR_SYSTEM, /**< system error */ + ZBAR_ERR_LOCKING, /**< locking error */ + ZBAR_ERR_BUSY, /**< all resources busy */ + ZBAR_ERR_XDISPLAY, /**< X11 display error */ + ZBAR_ERR_XPROTO, /**< X11 protocol error */ + ZBAR_ERR_CLOSED, /**< output window is closed */ + ZBAR_ERR_WINAPI, /**< windows system error */ + ZBAR_ERR_NUM /**< number of error codes */ +} zbar_error_t; + +/** decoder configuration options. + * @since 0.4 + */ +typedef enum zbar_config_e { + ZBAR_CFG_ENABLE = 0, /**< enable symbology/feature */ + ZBAR_CFG_ADD_CHECK, /**< enable check digit when optional */ + ZBAR_CFG_EMIT_CHECK, /**< return check digit when present */ + ZBAR_CFG_ASCII, /**< enable full ASCII character set */ + ZBAR_CFG_NUM, /**< number of boolean decoder configs */ + + ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */ + ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */ + + ZBAR_CFG_UNCERTAINTY = 0x40,/**< required video consistency frames */ + + ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */ + + ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */ + ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */ +} zbar_config_t; + +/** decoder symbology modifier flags. + * @since 0.11 + */ +typedef enum zbar_modifier_e { + /** barcode tagged as GS1 (EAN.UCC) reserved + * (eg, FNC1 before first data character). + * data may be parsed as a sequence of GS1 AIs + */ + ZBAR_MOD_GS1 = 0, + + /** barcode tagged as AIM reserved + * (eg, FNC1 after first character or digit pair) + */ + ZBAR_MOD_AIM, + + /** number of modifiers */ + ZBAR_MOD_NUM, +} zbar_modifier_t; + +/** retrieve runtime library version information. + * @param major set to the running major version (unless NULL) + * @param minor set to the running minor version (unless NULL) + * @returns 0 + */ +extern int zbar_version(unsigned *major, + unsigned *minor); + +/** set global library debug level. + * @param verbosity desired debug level. higher values create more spew + */ +extern void zbar_set_verbosity(int verbosity); + +/** increase global library debug level. + * eg, for -vvvv + */ +extern void zbar_increase_verbosity(void); + +/** retrieve string name for symbol encoding. + * @param sym symbol type encoding + * @returns the static string name for the specified symbol type, + * or "UNKNOWN" if the encoding is not recognized + */ +extern const char *zbar_get_symbol_name(zbar_symbol_type_t sym); + +/** retrieve string name for addon encoding. + * @param sym symbol type encoding + * @returns static string name for any addon, or the empty string + * if no addons were decoded + * @deprecated in 0.11 + */ +extern const char *zbar_get_addon_name(zbar_symbol_type_t sym); + +/** retrieve string name for configuration setting. + * @param config setting to name + * @returns static string name for config, + * or the empty string if value is not a known config + */ +extern const char *zbar_get_config_name(zbar_config_t config); + +/** retrieve string name for modifier. + * @param modifier flag to name + * @returns static string name for modifier, + * or the empty string if the value is not a known flag + */ +extern const char *zbar_get_modifier_name(zbar_modifier_t modifier); + +/** retrieve string name for orientation. + * @param orientation orientation encoding + * @returns the static string name for the specified orientation, + * or "UNKNOWN" if the orientation is not recognized + * @since 0.11 + */ +extern const char *zbar_get_orientation_name(zbar_orientation_t orientation); + +/** parse a configuration string of the form "[symbology.]config[=value]". + * the config must match one of the recognized names. + * the symbology, if present, must match one of the recognized names. + * if symbology is unspecified, it will be set to 0. + * if value is unspecified it will be set to 1. + * @returns 0 if the config is parsed successfully, 1 otherwise + * @since 0.4 + */ +extern int zbar_parse_config(const char *config_string, + zbar_symbol_type_t *symbology, + zbar_config_t *config, + int *value); + +/** consistently compute fourcc values across architectures + * (adapted from v4l2 specification) + * @since 0.11 + */ +#define zbar_fourcc(a, b, c, d) \ + ((unsigned long)(a) | \ + ((unsigned long)(b) << 8) | \ + ((unsigned long)(c) << 16) | \ + ((unsigned long)(d) << 24)) + +/** parse a fourcc string into its encoded integer value. + * @since 0.11 + */ +static inline unsigned long zbar_fourcc_parse (const char *format) +{ + unsigned long fourcc = 0; + if(format) { + int i; + for(i = 0; i < 4 && format[i]; i++) + fourcc |= ((unsigned long)format[i]) << (i * 8); + } + return(fourcc); +} + +/** @internal type unsafe error API (don't use) */ +extern int _zbar_error_spew(const void *object, + int verbosity); +extern const char *_zbar_error_string(const void *object, + int verbosity); +extern zbar_error_t _zbar_get_error_code(const void *object); + +/*@}*/ + +struct zbar_symbol_s; +typedef struct zbar_symbol_s zbar_symbol_t; + +struct zbar_symbol_set_s; +typedef struct zbar_symbol_set_s zbar_symbol_set_t; + + +/*------------------------------------------------------------*/ +/** @name Symbol interface + * decoded barcode symbol result object. stores type, data, and image + * location of decoded symbol. all memory is owned by the library + */ +/*@{*/ + +/** @typedef zbar_symbol_t + * opaque decoded symbol object. + */ + +/** symbol reference count manipulation. + * increment the reference count when you store a new reference to the + * symbol. decrement when the reference is no longer used. do not + * refer to the symbol once the count is decremented and the + * containing image has been recycled or destroyed. + * @note the containing image holds a reference to the symbol, so you + * only need to use this if you keep a symbol after the image has been + * destroyed or reused. + * @since 0.9 + */ +extern void zbar_symbol_ref(const zbar_symbol_t *symbol, + int refs); + +/** retrieve type of decoded symbol. + * @returns the symbol type + */ +extern zbar_symbol_type_t zbar_symbol_get_type(const zbar_symbol_t *symbol); + +/** retrieve symbology boolean config settings. + * @returns a bitmask indicating which configs were set for the detected + * symbology during decoding. + * @since 0.11 + */ +extern unsigned int zbar_symbol_get_configs(const zbar_symbol_t *symbol); + +/** retrieve symbology modifier flag settings. + * @returns a bitmask indicating which characteristics were detected + * during decoding. + * @since 0.11 + */ +extern unsigned int zbar_symbol_get_modifiers(const zbar_symbol_t *symbol); + +/** retrieve data decoded from symbol. + * @returns the data string + */ +extern const char *zbar_symbol_get_data(const zbar_symbol_t *symbol); + +/** retrieve length of binary data. + * @returns the length of the decoded data + */ +extern unsigned int zbar_symbol_get_data_length(const zbar_symbol_t *symbol); + +/** retrieve a symbol confidence metric. + * @returns an unscaled, relative quantity: larger values are better + * than smaller values, where "large" and "small" are application + * dependent. + * @note expect the exact definition of this quantity to change as the + * metric is refined. currently, only the ordered relationship + * between two values is defined and will remain stable in the future + * @since 0.9 + */ +extern int zbar_symbol_get_quality(const zbar_symbol_t *symbol); + +/** retrieve current cache count. when the cache is enabled for the + * image_scanner this provides inter-frame reliability and redundancy + * information for video streams. + * @returns < 0 if symbol is still uncertain. + * @returns 0 if symbol is newly verified. + * @returns > 0 for duplicate symbols + */ +extern int zbar_symbol_get_count(const zbar_symbol_t *symbol); + +/** retrieve the number of points in the location polygon. the + * location polygon defines the image area that the symbol was + * extracted from. + * @returns the number of points in the location polygon + * @note this is currently not a polygon, but the scan locations + * where the symbol was decoded + */ +extern unsigned zbar_symbol_get_loc_size(const zbar_symbol_t *symbol); + +/** retrieve location polygon x-coordinates. + * points are specified by 0-based index. + * @returns the x-coordinate for a point in the location polygon. + * @returns -1 if index is out of range + */ +extern int zbar_symbol_get_loc_x(const zbar_symbol_t *symbol, + unsigned index); + +/** retrieve location polygon y-coordinates. + * points are specified by 0-based index. + * @returns the y-coordinate for a point in the location polygon. + * @returns -1 if index is out of range + */ +extern int zbar_symbol_get_loc_y(const zbar_symbol_t *symbol, + unsigned index); + +/** retrieve general orientation of decoded symbol. + * @returns a coarse, axis-aligned indication of symbol orientation or + * ::ZBAR_ORIENT_UNKNOWN if unknown + * @since 0.11 + */ +extern zbar_orientation_t +zbar_symbol_get_orientation(const zbar_symbol_t *symbol); + +/** iterate the set to which this symbol belongs (there can be only one). + * @returns the next symbol in the set, or + * @returns NULL when no more results are available + */ +extern const zbar_symbol_t *zbar_symbol_next(const zbar_symbol_t *symbol); + +/** retrieve components of a composite result. + * @returns the symbol set containing the components + * @returns NULL if the symbol is already a physical symbol + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_symbol_get_components(const zbar_symbol_t *symbol); + +/** iterate components of a composite result. + * @returns the first physical component symbol of a composite result + * @returns NULL if the symbol is already a physical symbol + * @since 0.10 + */ +extern const zbar_symbol_t* +zbar_symbol_first_component(const zbar_symbol_t *symbol); + +/** print XML symbol element representation to user result buffer. + * @see http://zbar.sourceforge.net/2008/barcode.xsd for the schema. + * @param symbol is the symbol to print + * @param buffer is the inout result pointer, it will be reallocated + * with a larger size if necessary. + * @param buflen is inout length of the result buffer. + * @returns the buffer pointer + * @since 0.6 + */ +extern char *zbar_symbol_xml(const zbar_symbol_t *symbol, + char **buffer, + unsigned *buflen); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Symbol Set interface + * container for decoded result symbols associated with an image + * or a composite symbol. + * @since 0.10 + */ +/*@{*/ + +/** @typedef zbar_symbol_set_t + * opaque symbol iterator object. + * @since 0.10 + */ + +/** reference count manipulation. + * increment the reference count when you store a new reference. + * decrement when the reference is no longer used. do not refer to + * the object any longer once references have been released. + * @since 0.10 + */ +extern void zbar_symbol_set_ref(const zbar_symbol_set_t *symbols, + int refs); + +/** retrieve set size. + * @returns the number of symbols in the set. + * @since 0.10 + */ +extern int zbar_symbol_set_get_size(const zbar_symbol_set_t *symbols); + +/** set iterator. + * @returns the first decoded symbol result in a set + * @returns NULL if the set is empty + * @since 0.10 + */ +extern const zbar_symbol_t* +zbar_symbol_set_first_symbol(const zbar_symbol_set_t *symbols); + +/** raw result iterator. + * @returns the first decoded symbol result in a set, *before* filtering + * @returns NULL if the set is empty + * @since 0.11 + */ +extern const zbar_symbol_t* +zbar_symbol_set_first_unfiltered(const zbar_symbol_set_t *symbols); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Image interface + * stores image data samples along with associated format and size + * metadata + */ +/*@{*/ + +struct zbar_image_s; +/** opaque image object. */ +typedef struct zbar_image_s zbar_image_t; + +/** cleanup handler callback function. + * called to free sample data when an image is destroyed. + */ +typedef void (zbar_image_cleanup_handler_t)(zbar_image_t *image); + +/** data handler callback function. + * called when decoded symbol results are available for an image + */ +typedef void (zbar_image_data_handler_t)(zbar_image_t *image, + const void *userdata); + +/** new image constructor. + * @returns a new image object with uninitialized data and format. + * this image should be destroyed (using zbar_image_destroy()) as + * soon as the application is finished with it + */ +extern zbar_image_t *zbar_image_create(void); + +/** image destructor. all images created by or returned to the + * application should be destroyed using this function. when an image + * is destroyed, the associated data cleanup handler will be invoked + * if available + * @note make no assumptions about the image or the data buffer. + * they may not be destroyed/cleaned immediately if the library + * is still using them. if necessary, use the cleanup handler hook + * to keep track of image data buffers + */ +extern void zbar_image_destroy(zbar_image_t *image); + +/** image reference count manipulation. + * increment the reference count when you store a new reference to the + * image. decrement when the reference is no longer used. do not + * refer to the image any longer once the count is decremented. + * zbar_image_ref(image, -1) is the same as zbar_image_destroy(image) + * @since 0.5 + */ +extern void zbar_image_ref(zbar_image_t *image, + int refs); + +/** image format conversion. refer to the documentation for supported + * image formats + * @returns a @em new image with the sample data from the original image + * converted to the requested format. the original image is + * unaffected. + * @note the converted image size may be rounded (up) due to format + * constraints + */ +extern zbar_image_t *zbar_image_convert(const zbar_image_t *image, + unsigned long format); + +/** image format conversion with crop/pad. + * if the requested size is larger than the image, the last row/column + * are duplicated to cover the difference. if the requested size is + * smaller than the image, the extra rows/columns are dropped from the + * right/bottom. + * @returns a @em new image with the sample data from the original + * image converted to the requested format and size. + * @note the image is @em not scaled + * @see zbar_image_convert() + * @since 0.4 + */ +extern zbar_image_t *zbar_image_convert_resize(const zbar_image_t *image, + unsigned long format, + unsigned width, + unsigned height); + +/** retrieve the image format. + * @returns the fourcc describing the format of the image sample data + */ +extern unsigned long zbar_image_get_format(const zbar_image_t *image); + +/** retrieve a "sequence" (page/frame) number associated with this image. + * @since 0.6 + */ +extern unsigned zbar_image_get_sequence(const zbar_image_t *image); + +/** retrieve the width of the image. + * @returns the width in sample columns + */ +extern unsigned zbar_image_get_width(const zbar_image_t *image); + +/** retrieve the height of the image. + * @returns the height in sample rows + */ +extern unsigned zbar_image_get_height(const zbar_image_t *image); + +/** retrieve both dimensions of the image. + * fills in the width and height in samples + */ +extern void zbar_image_get_size(const zbar_image_t *image, + unsigned *width, + unsigned *height); + +/** retrieve the crop rectangle. + * fills in the image coordinates of the upper left corner and size + * of an axis-aligned rectangular area of the image that will be scanned. + * defaults to the full image + * @since 0.11 + */ +extern void zbar_image_get_crop(const zbar_image_t *image, + unsigned *x, + unsigned *y, + unsigned *width, + unsigned *height); + +/** return the image sample data. the returned data buffer is only + * valid until zbar_image_destroy() is called + */ +extern const void *zbar_image_get_data(const zbar_image_t *image); + +/** return the size of image data. + * @since 0.6 + */ +extern unsigned long zbar_image_get_data_length(const zbar_image_t *img); + +/** retrieve the decoded results. + * @returns the (possibly empty) set of decoded symbols + * @returns NULL if the image has not been scanned + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_image_get_symbols(const zbar_image_t *image); + +/** associate the specified symbol set with the image, replacing any + * existing results. use NULL to release the current results from the + * image. + * @see zbar_image_scanner_recycle_image() + * @since 0.10 + */ +extern void zbar_image_set_symbols(zbar_image_t *image, + const zbar_symbol_set_t *symbols); + +/** image_scanner decode result iterator. + * @returns the first decoded symbol result for an image + * or NULL if no results are available + */ +extern const zbar_symbol_t* +zbar_image_first_symbol(const zbar_image_t *image); + +/** specify the fourcc image format code for image sample data. + * refer to the documentation for supported formats. + * @note this does not convert the data! + * (see zbar_image_convert() for that) + */ +extern void zbar_image_set_format(zbar_image_t *image, + unsigned long format); + +/** associate a "sequence" (page/frame) number with this image. + * @since 0.6 + */ +extern void zbar_image_set_sequence(zbar_image_t *image, + unsigned sequence_num); + +/** specify the pixel size of the image. + * @note this also resets the crop rectangle to the full image + * (0, 0, width, height) + * @note this does not affect the data! + */ +extern void zbar_image_set_size(zbar_image_t *image, + unsigned width, + unsigned height); + +/** specify a rectangular region of the image to scan. + * the rectangle will be clipped to the image boundaries. + * defaults to the full image specified by zbar_image_set_size() + */ +extern void zbar_image_set_crop(zbar_image_t *image, + unsigned x, + unsigned y, + unsigned width, + unsigned height); + +/** specify image sample data. when image data is no longer needed by + * the library the specific data cleanup handler will be called + * (unless NULL) + * @note application image data will not be modified by the library + */ +extern void zbar_image_set_data(zbar_image_t *image, + const void *data, + unsigned long data_byte_length, + zbar_image_cleanup_handler_t *cleanup_hndlr); + +/** built-in cleanup handler. + * passes the image data buffer to free() + */ +extern void zbar_image_free_data(zbar_image_t *image); + +/** associate user specified data value with an image. + * @since 0.5 + */ +extern void zbar_image_set_userdata(zbar_image_t *image, + void *userdata); + +/** return user specified data value associated with the image. + * @since 0.5 + */ +extern void *zbar_image_get_userdata(const zbar_image_t *image); + +/** dump raw image data to a file for debug. + * the data will be prefixed with a 16 byte header consisting of: + * - 4 bytes uint = 0x676d697a ("zimg") + * - 4 bytes format fourcc + * - 2 bytes width + * - 2 bytes height + * - 4 bytes size of following image data in bytes + * this header can be dumped w/eg: + * @verbatim + od -Ax -tx1z -N16 -w4 [file] +@endverbatim + * for some formats the image can be displayed/converted using + * ImageMagick, eg: + * @verbatim + display -size 640x480+16 [-depth ?] [-sampling-factor ?x?] \ + {GRAY,RGB,UYVY,YUV}:[file] +@endverbatim + * + * @param image the image object to dump + * @param filebase base filename, appended with ".XXXX.zimg" where + * XXXX is the format fourcc + * @returns 0 on success or a system error code on failure + */ +extern int zbar_image_write(const zbar_image_t *image, + const char *filebase); + +/** read back an image in the format written by zbar_image_write() + * @note TBD + */ +extern zbar_image_t *zbar_image_read(char *filename); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Processor interface + * @anchor c-processor + * high-level self-contained image processor. + * processes video and images for barcodes, optionally displaying + * images to a library owned output window + */ +/*@{*/ + +struct zbar_processor_s; +/** opaque standalone processor object. */ +typedef struct zbar_processor_s zbar_processor_t; + +/** constructor. + * if threaded is set and threading is available the processor + * will spawn threads where appropriate to avoid blocking and + * improve responsiveness + */ +extern zbar_processor_t *zbar_processor_create(int threaded); + +/** destructor. cleans up all resources associated with the processor + */ +extern void zbar_processor_destroy(zbar_processor_t *processor); + +/** (re)initialization. + * opens a video input device and/or prepares to display output + */ +extern int zbar_processor_init(zbar_processor_t *processor, + const char *video_device, + int enable_display); + +/** request a preferred size for the video image from the device. + * the request may be adjusted or completely ignored by the driver. + * @note must be called before zbar_processor_init() + * @since 0.6 + */ +extern int zbar_processor_request_size(zbar_processor_t *processor, + unsigned width, + unsigned height); + +/** request a preferred video driver interface version for + * debug/testing. + * @note must be called before zbar_processor_init() + * @since 0.6 + */ +extern int zbar_processor_request_interface(zbar_processor_t *processor, + int version); + +/** request a preferred video I/O mode for debug/testing. You will + * get errors if the driver does not support the specified mode. + * @verbatim + 0 = auto-detect + 1 = force I/O using read() + 2 = force memory mapped I/O using mmap() + 3 = force USERPTR I/O (v4l2 only) +@endverbatim + * @note must be called before zbar_processor_init() + * @since 0.7 + */ +extern int zbar_processor_request_iomode(zbar_processor_t *video, + int iomode); + +/** force specific input and output formats for debug/testing. + * @note must be called before zbar_processor_init() + */ +extern int zbar_processor_force_format(zbar_processor_t *processor, + unsigned long input_format, + unsigned long output_format); + +/** setup result handler callback. + * the specified function will be called by the processor whenever + * new results are available from the video stream or a static image. + * pass a NULL value to disable callbacks. + * @param processor the object on which to set the handler. + * @param handler the function to call when new results are available. + * @param userdata is set as with zbar_processor_set_userdata(). + * @returns the previously registered handler + */ +extern zbar_image_data_handler_t* +zbar_processor_set_data_handler(zbar_processor_t *processor, + zbar_image_data_handler_t *handler, + const void *userdata); + +/** associate user specified data value with the processor. + * @since 0.6 + */ +extern void zbar_processor_set_userdata(zbar_processor_t *processor, + void *userdata); + +/** return user specified data value associated with the processor. + * @since 0.6 + */ +extern void *zbar_processor_get_userdata(const zbar_processor_t *processor); + +/** set config for indicated symbology (0 for all) to specified value. + * @returns 0 for success, non-0 for failure (config does not apply to + * specified symbology, or value out of range) + * @see zbar_decoder_set_config() + * @since 0.4 + */ +extern int zbar_processor_set_config(zbar_processor_t *processor, + zbar_symbol_type_t symbology, + zbar_config_t config, + int value); + +/** parse configuration string using zbar_parse_config() + * and apply to processor using zbar_processor_set_config(). + * @returns 0 for success, non-0 for failure + * @see zbar_parse_config() + * @see zbar_processor_set_config() + * @since 0.4 + */ +static inline int zbar_processor_parse_config (zbar_processor_t *processor, + const char *config_string) +{ + zbar_symbol_type_t sym; + zbar_config_t cfg; + int val; + return(zbar_parse_config(config_string, &sym, &cfg, &val) || + zbar_processor_set_config(processor, sym, cfg, val)); +} + +/** retrieve the current state of the ouput window. + * @returns 1 if the output window is currently displayed, 0 if not. + * @returns -1 if an error occurs + */ +extern int zbar_processor_is_visible(zbar_processor_t *processor); + +/** show or hide the display window owned by the library. + * the size will be adjusted to the input size + */ +extern int zbar_processor_set_visible(zbar_processor_t *processor, + int visible); + +/** control the processor in free running video mode. + * only works if video input is initialized. if threading is in use, + * scanning will occur in the background, otherwise this is only + * useful wrapping calls to zbar_processor_user_wait(). if the + * library output window is visible, video display will be enabled. + */ +extern int zbar_processor_set_active(zbar_processor_t *processor, + int active); + +/** retrieve decode results for last scanned image/frame. + * @returns the symbol set result container or NULL if no results are + * available + * @note the returned symbol set has its reference count incremented; + * ensure that the count is decremented after use + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_processor_get_results(const zbar_processor_t *processor); + +/** wait for input to the display window from the user + * (via mouse or keyboard). + * @returns >0 when input is received, 0 if timeout ms expired + * with no input or -1 in case of an error + */ +extern int zbar_processor_user_wait(zbar_processor_t *processor, + int timeout); + +/** process from the video stream until a result is available, + * or the timeout (in milliseconds) expires. + * specify a timeout of -1 to scan indefinitely + * (zbar_processor_set_active() may still be used to abort the scan + * from another thread). + * if the library window is visible, video display will be enabled. + * @note that multiple results may still be returned (despite the + * name). + * @returns >0 if symbols were successfully decoded, + * 0 if no symbols were found (ie, the timeout expired) + * or -1 if an error occurs + */ +extern int zbar_process_one(zbar_processor_t *processor, + int timeout); + +/** process the provided image for barcodes. + * if the library window is visible, the image will be displayed. + * @returns >0 if symbols were successfully decoded, + * 0 if no symbols were found or -1 if an error occurs + */ +extern int zbar_process_image(zbar_processor_t *processor, + zbar_image_t *image); + +/** display detail for last processor error to stderr. + * @returns a non-zero value suitable for passing to exit() + */ +static inline int +zbar_processor_error_spew (const zbar_processor_t *processor, + int verbosity) +{ + return(_zbar_error_spew(processor, verbosity)); +} + +/** retrieve the detail string for the last processor error. */ +static inline const char* +zbar_processor_error_string (const zbar_processor_t *processor, + int verbosity) +{ + return(_zbar_error_string(processor, verbosity)); +} + +/** retrieve the type code for the last processor error. */ +static inline zbar_error_t +zbar_processor_get_error_code (const zbar_processor_t *processor) +{ + return(_zbar_get_error_code(processor)); +} + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Video interface + * @anchor c-video + * mid-level video source abstraction. + * captures images from a video device + */ +/*@{*/ + +struct zbar_video_s; +/** opaque video object. */ +typedef struct zbar_video_s zbar_video_t; + +/** constructor. */ +extern zbar_video_t *zbar_video_create(void); + +/** destructor. */ +extern void zbar_video_destroy(zbar_video_t *video); + +/** open and probe a video device. + * the device specified by platform specific unique name + * (v4l device node path in *nix eg "/dev/video", + * DirectShow DevicePath property in windows). + * @returns 0 if successful or -1 if an error occurs + */ +extern int zbar_video_open(zbar_video_t *video, + const char *device); + +/** retrieve file descriptor associated with open *nix video device + * useful for using select()/poll() to tell when new images are + * available (NB v4l2 only!!). + * @returns the file descriptor or -1 if the video device is not open + * or the driver only supports v4l1 + */ +extern int zbar_video_get_fd(const zbar_video_t *video); + +/** request a preferred size for the video image from the device. + * the request may be adjusted or completely ignored by the driver. + * @returns 0 if successful or -1 if the video device is already + * initialized + * @since 0.6 + */ +extern int zbar_video_request_size(zbar_video_t *video, + unsigned width, + unsigned height); + +/** request a preferred driver interface version for debug/testing. + * @note must be called before zbar_video_open() + * @since 0.6 + */ +extern int zbar_video_request_interface(zbar_video_t *video, + int version); + +/** request a preferred I/O mode for debug/testing. You will get + * errors if the driver does not support the specified mode. + * @verbatim + 0 = auto-detect + 1 = force I/O using read() + 2 = force memory mapped I/O using mmap() + 3 = force USERPTR I/O (v4l2 only) +@endverbatim + * @note must be called before zbar_video_open() + * @since 0.7 + */ +extern int zbar_video_request_iomode(zbar_video_t *video, + int iomode); + +/** retrieve current output image width. + * @returns the width or 0 if the video device is not open + */ +extern int zbar_video_get_width(const zbar_video_t *video); + +/** retrieve current output image height. + * @returns the height or 0 if the video device is not open + */ +extern int zbar_video_get_height(const zbar_video_t *video); + +/** initialize video using a specific format for debug. + * use zbar_negotiate_format() to automatically select and initialize + * the best available format + */ +extern int zbar_video_init(zbar_video_t *video, + unsigned long format); + +/** start/stop video capture. + * all buffered images are retired when capture is disabled. + * @returns 0 if successful or -1 if an error occurs + */ +extern int zbar_video_enable(zbar_video_t *video, + int enable); + +/** retrieve next captured image. blocks until an image is available. + * @returns NULL if video is not enabled or an error occurs + */ +extern zbar_image_t *zbar_video_next_image(zbar_video_t *video); + +/** display detail for last video error to stderr. + * @returns a non-zero value suitable for passing to exit() + */ +static inline int zbar_video_error_spew (const zbar_video_t *video, + int verbosity) +{ + return(_zbar_error_spew(video, verbosity)); +} + +/** retrieve the detail string for the last video error. */ +static inline const char *zbar_video_error_string (const zbar_video_t *video, + int verbosity) +{ + return(_zbar_error_string(video, verbosity)); +} + +/** retrieve the type code for the last video error. */ +static inline zbar_error_t +zbar_video_get_error_code (const zbar_video_t *video) +{ + return(_zbar_get_error_code(video)); +} + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Window interface + * @anchor c-window + * mid-level output window abstraction. + * displays images to user-specified platform specific output window + */ +/*@{*/ + +struct zbar_window_s; +/** opaque window object. */ +typedef struct zbar_window_s zbar_window_t; + +/** constructor. */ +extern zbar_window_t *zbar_window_create(void); + +/** destructor. */ +extern void zbar_window_destroy(zbar_window_t *window); + +/** associate reader with an existing platform window. + * This can be any "Drawable" for X Windows or a "HWND" for windows. + * input images will be scaled into the output window. + * pass NULL to detach from the resource, further input will be + * ignored + */ +extern int zbar_window_attach(zbar_window_t *window, + void *x11_display_w32_hwnd, + unsigned long x11_drawable); + +/** control content level of the reader overlay. + * the overlay displays graphical data for informational or debug + * purposes. higher values increase the level of annotation (possibly + * decreasing performance). @verbatim + 0 = disable overlay + 1 = outline decoded symbols (default) + 2 = also track and display input frame rate +@endverbatim + */ +extern void zbar_window_set_overlay(zbar_window_t *window, + int level); + +/** retrieve current content level of reader overlay. + * @see zbar_window_set_overlay() + * @since 0.10 + */ +extern int zbar_window_get_overlay(const zbar_window_t *window); + +/** draw a new image into the output window. */ +extern int zbar_window_draw(zbar_window_t *window, + zbar_image_t *image); + +/** redraw the last image (exposure handler). */ +extern int zbar_window_redraw(zbar_window_t *window); + +/** resize the image window (reconfigure handler). + * this does @em not update the contents of the window + * @since 0.3, changed in 0.4 to not redraw window + */ +extern int zbar_window_resize(zbar_window_t *window, + unsigned width, + unsigned height); + +/** display detail for last window error to stderr. + * @returns a non-zero value suitable for passing to exit() + */ +static inline int zbar_window_error_spew (const zbar_window_t *window, + int verbosity) +{ + return(_zbar_error_spew(window, verbosity)); +} + +/** retrieve the detail string for the last window error. */ +static inline const char* +zbar_window_error_string (const zbar_window_t *window, + int verbosity) +{ + return(_zbar_error_string(window, verbosity)); +} + +/** retrieve the type code for the last window error. */ +static inline zbar_error_t +zbar_window_get_error_code (const zbar_window_t *window) +{ + return(_zbar_get_error_code(window)); +} + + +/** select a compatible format between video input and output window. + * the selection algorithm attempts to use a format shared by + * video input and window output which is also most useful for + * barcode scanning. if a format conversion is necessary, it will + * heuristically attempt to minimize the cost of the conversion + */ +extern int zbar_negotiate_format(zbar_video_t *video, + zbar_window_t *window); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Image Scanner interface + * @anchor c-imagescanner + * mid-level image scanner interface. + * reads barcodes from 2-D images + */ +/*@{*/ + +struct zbar_image_scanner_s; +/** opaque image scanner object. */ +typedef struct zbar_image_scanner_s zbar_image_scanner_t; + +/** constructor. */ +extern zbar_image_scanner_t *zbar_image_scanner_create(void); + +/** destructor. */ +extern void zbar_image_scanner_destroy(zbar_image_scanner_t *scanner); + +/** setup result handler callback. + * the specified function will be called by the scanner whenever + * new results are available from a decoded image. + * pass a NULL value to disable callbacks. + * @returns the previously registered handler + */ +extern zbar_image_data_handler_t* +zbar_image_scanner_set_data_handler(zbar_image_scanner_t *scanner, + zbar_image_data_handler_t *handler, + const void *userdata); + + +/** set config for indicated symbology (0 for all) to specified value. + * @returns 0 for success, non-0 for failure (config does not apply to + * specified symbology, or value out of range) + * @see zbar_decoder_set_config() + * @since 0.4 + */ +extern int zbar_image_scanner_set_config(zbar_image_scanner_t *scanner, + zbar_symbol_type_t symbology, + zbar_config_t config, + int value); + +/** parse configuration string using zbar_parse_config() + * and apply to image scanner using zbar_image_scanner_set_config(). + * @returns 0 for success, non-0 for failure + * @see zbar_parse_config() + * @see zbar_image_scanner_set_config() + * @since 0.4 + */ +static inline int +zbar_image_scanner_parse_config (zbar_image_scanner_t *scanner, + const char *config_string) +{ + zbar_symbol_type_t sym; + zbar_config_t cfg; + int val; + return(zbar_parse_config(config_string, &sym, &cfg, &val) || + zbar_image_scanner_set_config(scanner, sym, cfg, val)); +} + +/** enable or disable the inter-image result cache (default disabled). + * mostly useful for scanning video frames, the cache filters + * duplicate results from consecutive images, while adding some + * consistency checking and hysteresis to the results. + * this interface also clears the cache + */ +extern void zbar_image_scanner_enable_cache(zbar_image_scanner_t *scanner, + int enable); + +/** remove any previously decoded results from the image scanner and the + * specified image. somewhat more efficient version of + * zbar_image_set_symbols(image, NULL) which may retain memory for + * subsequent decodes + * @since 0.10 + */ +extern void zbar_image_scanner_recycle_image(zbar_image_scanner_t *scanner, + zbar_image_t *image); + +/** retrieve decode results for last scanned image. + * @returns the symbol set result container or NULL if no results are + * available + * @note the symbol set does not have its reference count adjusted; + * ensure that the count is incremented if the results may be kept + * after the next image is scanned + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_image_scanner_get_results(const zbar_image_scanner_t *scanner); + +/** scan for symbols in provided image. The image format must be + * "Y800" or "GRAY". + * @returns >0 if symbols were successfully decoded from the image, + * 0 if no symbols were found or -1 if an error occurs + * @see zbar_image_convert() + * @since 0.9 - changed to only accept grayscale images + */ +extern int zbar_scan_image(zbar_image_scanner_t *scanner, + zbar_image_t *image); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Decoder interface + * @anchor c-decoder + * low-level bar width stream decoder interface. + * identifies symbols and extracts encoded data + */ +/*@{*/ + +struct zbar_decoder_s; +/** opaque decoder object. */ +typedef struct zbar_decoder_s zbar_decoder_t; + +/** decoder data handler callback function. + * called by decoder when new data has just been decoded + */ +typedef void (zbar_decoder_handler_t)(zbar_decoder_t *decoder); + +/** constructor. */ +extern zbar_decoder_t *zbar_decoder_create(void); + +/** destructor. */ +extern void zbar_decoder_destroy(zbar_decoder_t *decoder); + +/** set config for indicated symbology (0 for all) to specified value. + * @returns 0 for success, non-0 for failure (config does not apply to + * specified symbology, or value out of range) + * @since 0.4 + */ +extern int zbar_decoder_set_config(zbar_decoder_t *decoder, + zbar_symbol_type_t symbology, + zbar_config_t config, + int value); + +/** parse configuration string using zbar_parse_config() + * and apply to decoder using zbar_decoder_set_config(). + * @returns 0 for success, non-0 for failure + * @see zbar_parse_config() + * @see zbar_decoder_set_config() + * @since 0.4 + */ +static inline int zbar_decoder_parse_config (zbar_decoder_t *decoder, + const char *config_string) +{ + zbar_symbol_type_t sym; + zbar_config_t cfg; + int val; + return(zbar_parse_config(config_string, &sym, &cfg, &val) || + zbar_decoder_set_config(decoder, sym, cfg, val)); +} + +/** retrieve symbology boolean config settings. + * @returns a bitmask indicating which configs are currently set for the + * specified symbology. + * @since 0.11 + */ +extern unsigned int zbar_decoder_get_configs(const zbar_decoder_t *decoder, + zbar_symbol_type_t symbology); + +/** clear all decoder state. + * any partial symbols are flushed + */ +extern void zbar_decoder_reset(zbar_decoder_t *decoder); + +/** mark start of a new scan pass. + * clears any intra-symbol state and resets color to ::ZBAR_SPACE. + * any partially decoded symbol state is retained + */ +extern void zbar_decoder_new_scan(zbar_decoder_t *decoder); + +/** process next bar/space width from input stream. + * the width is in arbitrary relative units. first value of a scan + * is ::ZBAR_SPACE width, alternating from there. + * @returns appropriate symbol type if width completes + * decode of a symbol (data is available for retrieval) + * @returns ::ZBAR_PARTIAL as a hint if part of a symbol was decoded + * @returns ::ZBAR_NONE (0) if no new symbol data is available + */ +extern zbar_symbol_type_t zbar_decode_width(zbar_decoder_t *decoder, + unsigned width); + +/** retrieve color of @em next element passed to + * zbar_decode_width(). */ +extern zbar_color_t zbar_decoder_get_color(const zbar_decoder_t *decoder); + +/** retrieve last decoded data. + * @returns the data string or NULL if no new data available. + * the returned data buffer is owned by library, contents are only + * valid between non-0 return from zbar_decode_width and next library + * call + */ +extern const char *zbar_decoder_get_data(const zbar_decoder_t *decoder); + +/** retrieve length of binary data. + * @returns the length of the decoded data or 0 if no new data + * available. + */ +extern unsigned int +zbar_decoder_get_data_length(const zbar_decoder_t *decoder); + +/** retrieve last decoded symbol type. + * @returns the type or ::ZBAR_NONE if no new data available + */ +extern zbar_symbol_type_t +zbar_decoder_get_type(const zbar_decoder_t *decoder); + +/** retrieve modifier flags for the last decoded symbol. + * @returns a bitmask indicating which characteristics were detected + * during decoding. + * @since 0.11 + */ +extern unsigned int zbar_decoder_get_modifiers(const zbar_decoder_t *decoder); + +/** retrieve last decode direction. + * @returns 1 for forward and -1 for reverse + * @returns 0 if the decode direction is unknown or does not apply + * @since 0.11 + */ +extern int zbar_decoder_get_direction(const zbar_decoder_t *decoder); + +/** setup data handler callback. + * the registered function will be called by the decoder + * just before zbar_decode_width() returns a non-zero value. + * pass a NULL value to disable callbacks. + * @returns the previously registered handler + */ +extern zbar_decoder_handler_t* +zbar_decoder_set_handler(zbar_decoder_t *decoder, + zbar_decoder_handler_t *handler); + +/** associate user specified data value with the decoder. */ +extern void zbar_decoder_set_userdata(zbar_decoder_t *decoder, + void *userdata); + +/** return user specified data value associated with the decoder. */ +extern void *zbar_decoder_get_userdata(const zbar_decoder_t *decoder); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Scanner interface + * @anchor c-scanner + * low-level linear intensity sample stream scanner interface. + * identifies "bar" edges and measures width between them. + * optionally passes to bar width decoder + */ +/*@{*/ + +struct zbar_scanner_s; +/** opaque scanner object. */ +typedef struct zbar_scanner_s zbar_scanner_t; + +/** constructor. + * if decoder is non-NULL it will be attached to scanner + * and called automatically at each new edge + * current color is initialized to ::ZBAR_SPACE + * (so an initial BAR->SPACE transition may be discarded) + */ +extern zbar_scanner_t *zbar_scanner_create(zbar_decoder_t *decoder); + +/** destructor. */ +extern void zbar_scanner_destroy(zbar_scanner_t *scanner); + +/** clear all scanner state. + * also resets an associated decoder + */ +extern zbar_symbol_type_t zbar_scanner_reset(zbar_scanner_t *scanner); + +/** mark start of a new scan pass. resets color to ::ZBAR_SPACE. + * also updates an associated decoder. + * @returns any decode results flushed from the pipeline + * @note when not using callback handlers, the return value should + * be checked the same as zbar_scan_y() + * @note call zbar_scanner_flush() at least twice before calling this + * method to ensure no decode results are lost + */ +extern zbar_symbol_type_t zbar_scanner_new_scan(zbar_scanner_t *scanner); + +/** flush scanner processing pipeline. + * forces current scanner position to be a scan boundary. + * call multiple times (max 3) to completely flush decoder. + * @returns any decode/scan results flushed from the pipeline + * @note when not using callback handlers, the return value should + * be checked the same as zbar_scan_y() + * @since 0.9 + */ +extern zbar_symbol_type_t zbar_scanner_flush(zbar_scanner_t *scanner); + +/** process next sample intensity value. + * intensity (y) is in arbitrary relative units. + * @returns result of zbar_decode_width() if a decoder is attached, + * otherwise @returns (::ZBAR_PARTIAL) when new edge is detected + * or 0 (::ZBAR_NONE) if no new edge is detected + */ +extern zbar_symbol_type_t zbar_scan_y(zbar_scanner_t *scanner, + int y); + +/** process next sample from RGB (or BGR) triple. */ +static inline zbar_symbol_type_t zbar_scan_rgb24 (zbar_scanner_t *scanner, + unsigned char *rgb) +{ + return(zbar_scan_y(scanner, rgb[0] + rgb[1] + rgb[2])); +} + +/** retrieve last scanned width. */ +extern unsigned zbar_scanner_get_width(const zbar_scanner_t *scanner); + +/** retrieve sample position of last edge. + * @since 0.10 + */ +extern unsigned zbar_scanner_get_edge(const zbar_scanner_t *scn, + unsigned offset, + int prec); + +/** retrieve last scanned color. */ +extern zbar_color_t zbar_scanner_get_color(const zbar_scanner_t *scanner); + +/*@}*/ + +#ifdef __cplusplus + } +} + +# include "zbar/Exception.h" +# include "zbar/Decoder.h" +# include "zbar/Scanner.h" +# include "zbar/Symbol.h" +# include "zbar/Image.h" +# include "zbar/ImageScanner.h" +# include "zbar/Video.h" +# include "zbar/Window.h" +# include "zbar/Processor.h" +#endif + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Decoder.h b/ios/ZBarSDK/Headers/zbar/Decoder.h new file mode 100644 index 0000000..27e78d8 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Decoder.h @@ -0,0 +1,202 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_DECODER_H_ +#define _ZBAR_DECODER_H_ + +/// @file +/// Decoder C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Decoder.h" +#endif + +#include + +namespace zbar { + +/// low-level bar width stream decoder interface. +/// identifies symbols and extracts encoded data + +class Decoder { + public: + + /// Decoder result handler. + /// applications should subtype this and pass an instance to + /// set_handler() to implement result processing + class Handler { + public: + virtual ~Handler() { } + + /// invoked by the Decoder as decode results become available. + virtual void decode_callback(Decoder &decoder) = 0; + }; + + /// constructor. + Decoder () + : _handler(NULL) + { + _decoder = zbar_decoder_create(); + } + + ~Decoder () + { + zbar_decoder_destroy(_decoder); + } + + /// clear all decoder state. + /// see zbar_decoder_reset() + void reset () + { + zbar_decoder_reset(_decoder); + } + + /// mark start of a new scan pass. + /// see zbar_decoder_new_scan() + void new_scan () + { + zbar_decoder_new_scan(_decoder); + } + + /// process next bar/space width from input stream. + /// see zbar_decode_width() + zbar_symbol_type_t decode_width (unsigned width) + { + return(zbar_decode_width(_decoder, width)); + } + + /// process next bar/space width from input stream. + /// see zbar_decode_width() + Decoder& operator<< (unsigned width) + { + zbar_decode_width(_decoder, width); + return(*this); + } + + /// retrieve color of @em next element passed to Decoder. + /// see zbar_decoder_get_color() + zbar_color_t get_color () const + { + return(zbar_decoder_get_color(_decoder)); + } + + /// retrieve last decoded symbol type. + /// see zbar_decoder_get_type() + zbar_symbol_type_t get_type () const + { + return(zbar_decoder_get_type(_decoder)); + } + + /// retrieve string name of last decoded symbol type. + /// see zbar_get_symbol_name() + const char *get_symbol_name () const + { + return(zbar_get_symbol_name(zbar_decoder_get_type(_decoder))); + } + + /// retrieve string name for last decode addon. + /// see zbar_get_addon_name() + /// @deprecated in 0.11 + const char *get_addon_name () const + { + return(zbar_get_addon_name(zbar_decoder_get_type(_decoder))); + } + + /// retrieve last decoded data in ASCII format as a char array. + /// see zbar_decoder_get_data() + const char *get_data_chars() const + { + return(zbar_decoder_get_data(_decoder)); + } + + /// retrieve last decoded data as a std::string. + /// see zbar_decoder_get_data() + const std::string get_data_string() const + { + return(std::string(zbar_decoder_get_data(_decoder), + zbar_decoder_get_data_length(_decoder))); + } + + /// retrieve last decoded data as a std::string. + /// see zbar_decoder_get_data() + const std::string get_data() const + { + return(get_data_string()); + } + + /// retrieve length of decoded binary data. + /// see zbar_decoder_get_data_length() + int get_data_length() const + { + return(zbar_decoder_get_data_length(_decoder)); + } + + /// retrieve last decode direction. + /// see zbar_decoder_get_direction() + /// @since 0.11 + int get_direction() const + { + return(zbar_decoder_get_direction(_decoder)); + } + + /// setup callback to handle result data. + void set_handler (Handler &handler) + { + _handler = &handler; + zbar_decoder_set_handler(_decoder, _cb); + zbar_decoder_set_userdata(_decoder, this); + } + + /// set config for indicated symbology (0 for all) to specified value. + /// @see zbar_decoder_set_config() + /// @since 0.4 + int set_config (zbar_symbol_type_t symbology, + zbar_config_t config, + int value) + { + return(zbar_decoder_set_config(_decoder, symbology, config, value)); + } + + /// set config parsed from configuration string. + /// @see zbar_decoder_parse_config() + /// @since 0.4 + int set_config (std::string cfgstr) + { + return(zbar_decoder_parse_config(_decoder, cfgstr.c_str())); + } + + private: + friend class Scanner; + zbar_decoder_t *_decoder; + Handler *_handler; + + static void _cb (zbar_decoder_t *cdcode) + { + Decoder *dcode = (Decoder*)zbar_decoder_get_userdata(cdcode); + if(dcode && dcode->_handler) + dcode->_handler->decode_callback(*dcode); + } +}; + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Exception.h b/ios/ZBarSDK/Headers/zbar/Exception.h new file mode 100644 index 0000000..236622f --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Exception.h @@ -0,0 +1,187 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_EXCEPTION_H_ +#define _ZBAR_EXCEPTION_H_ + +/// @file +/// C++ Exception definitions + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Exception.h" +#endif + +#include +#include + +namespace zbar { + +/// base class for exceptions defined by this API. +class Exception : public std::exception { + +public: + /// create exception from C library error + Exception (const void *obj = NULL) + : std::exception(), + _obj(obj) + { } + + ~Exception () throw() { } + + /// retrieve error message + virtual const char* what () const throw() + { + if(!_obj) + return("zbar library unspecified generic error"); + return(_zbar_error_string(_obj, 0)); + } + +private: + const void *_obj; +}; + +/// internal library error. +class InternalError : public Exception { +public: + /// create exception from C library error + InternalError (const void *obj) + : Exception(obj) + { } +}; + +/// unsupported request. +class UnsupportedError : public Exception { +public: + /// create exception from C library error + UnsupportedError (const void *obj) + : Exception(obj) + { } +}; + +/// invalid request. +class InvalidError : public Exception { +public: + /// create exception from C library error + InvalidError (const void *obj) + : Exception(obj) + { } +}; + +/// failed system call. +class SystemError : public Exception { +public: + /// create exception from C library error + SystemError (const void *obj) + : Exception(obj) + { } +}; + +/// locking error. +class LockingError : public Exception { +public: + /// create exception from C library error + LockingError (const void *obj) + : Exception(obj) + { } +}; + +/// all resources busy. +class BusyError : public Exception { +public: + /// create exception from C library error + BusyError (const void *obj) + : Exception(obj) + { } +}; + +/// X11 display error. +class XDisplayError : public Exception { +public: + /// create exception from C library error + XDisplayError (const void *obj) + : Exception(obj) + { } +}; + +/// X11 protocol error. +class XProtoError : public Exception { +public: + /// create exception from C library error + XProtoError (const void *obj) + : Exception(obj) + { } +}; + +/// output window is closed. +class ClosedError : public Exception { +public: + /// create exception from C library error + ClosedError (const void *obj) + : Exception(obj) + { } +}; + +/// image format error +class FormatError : public Exception { + // FIXME needs c equivalent + + virtual const char* what () const throw() + { + // FIXME what format? + return("unsupported format"); + } +}; + +/// @internal + +/// extract error information and create exception. +static inline std::exception throw_exception (const void *obj) +{ + switch(_zbar_get_error_code(obj)) { + case ZBAR_ERR_NOMEM: + throw std::bad_alloc(); + case ZBAR_ERR_INTERNAL: + throw InternalError(obj); + case ZBAR_ERR_UNSUPPORTED: + throw UnsupportedError(obj); + case ZBAR_ERR_INVALID: + throw InvalidError(obj); + case ZBAR_ERR_SYSTEM: + throw SystemError(obj); + case ZBAR_ERR_LOCKING: + throw LockingError(obj); + case ZBAR_ERR_BUSY: + throw BusyError(obj); + case ZBAR_ERR_XDISPLAY: + throw XDisplayError(obj); + case ZBAR_ERR_XPROTO: + throw XProtoError(obj); + case ZBAR_ERR_CLOSED: + throw ClosedError(obj); + default: + throw Exception(obj); + } +} + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Image.h b/ios/ZBarSDK/Headers/zbar/Image.h new file mode 100644 index 0000000..713b1f9 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Image.h @@ -0,0 +1,329 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_IMAGE_H_ +#define _ZBAR_IMAGE_H_ + +/// @file +/// Image C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Image.h" +#endif + +#include +#include +#include "Symbol.h" +#include "Exception.h" + +namespace zbar { + +class Video; + +/// stores image data samples along with associated format and size +/// metadata + +class Image { +public: + + /// general Image result handler. + /// applications should subtype this and pass an instance to + /// eg. ImageScanner::set_handler() to implement result processing + class Handler { + public: + virtual ~Handler() { } + + /// invoked by library when Image should be processed + virtual void image_callback(Image &image) = 0; + + /// cast this handler to the C handler + operator zbar_image_data_handler_t* () const + { + return(_cb); + } + + private: + static void _cb (zbar_image_t *zimg, + const void *userdata) + { + if(userdata) { + Image *image = (Image*)zbar_image_get_userdata(zimg); + if(image) + ((Handler*)userdata)->image_callback(*image); + else { + Image tmp(zimg, 1); + ((Handler*)userdata)->image_callback(tmp); + } + } + } + }; + + class SymbolIterator : public zbar::SymbolIterator { + public: + /// default constructor. + SymbolIterator () + : zbar::SymbolIterator() + { } + + /// constructor. + SymbolIterator (const SymbolSet &syms) + : zbar::SymbolIterator(syms) + { } + + /// copy constructor. + SymbolIterator (const SymbolIterator& iter) + : zbar::SymbolIterator(iter) + { } + }; + + /// constructor. + /// create a new Image with the specified parameters + Image (unsigned width = 0, + unsigned height = 0, + const std::string& format = "", + const void *data = NULL, + unsigned long length = 0) + : _img(zbar_image_create()) + { + zbar_image_set_userdata(_img, this); + if(width && height) + set_size(width, height); + if(format.length()) + set_format(format); + if(data && length) + set_data(data, length); + } + + ~Image () + { + if(zbar_image_get_userdata(_img) == this) + zbar_image_set_userdata(_img, NULL); + zbar_image_ref(_img, -1); + } + + /// cast to C image object + operator const zbar_image_t* () const + { + return(_img); + } + + /// cast to C image object + operator zbar_image_t* () + { + return(_img); + } + + /// retrieve the image format. + /// see zbar_image_get_format() + unsigned long get_format () const + { + return(zbar_image_get_format(_img)); + } + + /// specify the fourcc image format code for image sample data. + /// see zbar_image_set_format() + void set_format (unsigned long format) + { + zbar_image_set_format(_img, format); + } + + /// specify the fourcc image format code for image sample data. + /// see zbar_image_set_format() + void set_format (const std::string& format) + { + unsigned long fourcc = zbar_fourcc_parse(format.c_str()); + zbar_image_set_format(_img, fourcc); + } + + /// retrieve a "sequence" (page/frame) number associated with this + /// image. + /// see zbar_image_get_sequence() + /// @since 0.6 + unsigned get_sequence () const + { + return(zbar_image_get_sequence(_img)); + } + + /// associate a "sequence" (page/frame) number with this image. + /// see zbar_image_set_sequence() + /// @since 0.6 + void set_sequence (unsigned sequence_num) + { + zbar_image_set_sequence(_img, sequence_num); + } + + /// retrieve the width of the image. + /// see zbar_image_get_width() + unsigned get_width () const + { + return(zbar_image_get_width(_img)); + } + + /// retrieve the height of the image. + /// see zbar_image_get_height() + unsigned get_height () const + { + return(zbar_image_get_height(_img)); + } + + /// retrieve both dimensions of the image. + /// see zbar_image_get_size() + /// @since 0.11 + void get_size (unsigned &width, + unsigned &height) const + { + zbar_image_get_size(_img, &width, &height); + } + + /// specify the pixel size of the image. + /// see zbar_image_set_size() + void set_size (unsigned width, + unsigned height) + { + zbar_image_set_size(_img, width, height); + } + + /// retrieve the scan crop rectangle. + /// see zbar_image_get_crop() + void get_crop (unsigned &x, + unsigned &y, + unsigned &width, + unsigned &height) const + { + zbar_image_get_crop(_img, &x, &y, &width, &height); + } + + /// set the scan crop rectangle. + /// see zbar_image_set_crop() + void set_crop (unsigned x, + unsigned y, + unsigned width, + unsigned height) + { + zbar_image_set_crop(_img, x, y, width, height); + } + + /// return the image sample data. + /// see zbar_image_get_data() + const void *get_data () const + { + return(zbar_image_get_data(_img)); + } + + /// return the size of the image sample data. + /// see zbar_image_get_data_length() + /// @since 0.6 + unsigned long get_data_length () const + { + return(zbar_image_get_data_length(_img)); + } + + /// specify image sample data. + /// see zbar_image_set_data() + void set_data (const void *data, + unsigned long length) + { + zbar_image_set_data(_img, data, length, _cleanup); + } + + /// image format conversion. + /// see zbar_image_convert() + Image convert (unsigned long format) const + { + zbar_image_t *img = zbar_image_convert(_img, format); + if(img) + return(Image(img)); + throw FormatError(); + } + + /// image format conversion. + /// see zbar_image_convert() + /// @since 0.11 + Image convert (std::string format) const + { + unsigned long fourcc = zbar_fourcc_parse(format.c_str()); + return(convert(fourcc)); + } + + /// image format conversion with crop/pad. + /// see zbar_image_convert_resize() + /// @since 0.4 + Image convert (unsigned long format, + unsigned width, + unsigned height) const + { + zbar_image_t *img = + zbar_image_convert_resize(_img, format, width, height); + if(img) + return(Image(img)); + throw FormatError(); + } + + const SymbolSet get_symbols () const { + return(SymbolSet(zbar_image_get_symbols(_img))); + } + + void set_symbols (const SymbolSet &syms) { + zbar_image_set_symbols(_img, syms); + } + + /// create a new SymbolIterator over decoded results. + SymbolIterator symbol_begin () const { + return(SymbolIterator(get_symbols())); + } + + /// return a SymbolIterator suitable for ending iteration. + SymbolIterator symbol_end () const { + return(SymbolIterator()); + } + +protected: + + friend class Video; + + /// constructor. + /// @internal + /// create a new Image from a zbar_image_t C object + Image (zbar_image_t *src, + int refs = 0) + : _img(src) + { + if(refs) + zbar_image_ref(_img, refs); + zbar_image_set_userdata(_img, this); + } + + /// default data cleanup (noop) + /// @internal + static void _cleanup (zbar_image_t *img) + { + // by default nothing is cleaned + assert(img); + } + +private: + zbar_image_t *_img; +}; + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/ImageScanner.h b/ios/ZBarSDK/Headers/zbar/ImageScanner.h new file mode 100644 index 0000000..bda8433 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/ImageScanner.h @@ -0,0 +1,130 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_IMAGE_SCANNER_H_ +#define _ZBAR_IMAGE_SCANNER_H_ + +/// @file +/// Image Scanner C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/ImageScanner.h" +#endif + +#include "Image.h" + +namespace zbar { + +/// mid-level image scanner interface. +/// reads barcodes from a 2-D Image + +class ImageScanner { +public: + /// constructor. + ImageScanner (zbar_image_scanner_t *scanner = NULL) + { + if(scanner) + _scanner = scanner; + else + _scanner = zbar_image_scanner_create(); + } + + ~ImageScanner () + { + zbar_image_scanner_destroy(_scanner); + } + + /// cast to C image_scanner object + operator zbar_image_scanner_t* () const + { + return(_scanner); + } + + /// setup result handler callback. + void set_handler (Image::Handler &handler) + { + zbar_image_scanner_set_data_handler(_scanner, handler, &handler); + } + + /// set config for indicated symbology (0 for all) to specified value. + /// @see zbar_image_scanner_set_config() + /// @since 0.4 + int set_config (zbar_symbol_type_t symbology, + zbar_config_t config, + int value) + { + return(zbar_image_scanner_set_config(_scanner, symbology, + config, value)); + } + + /// set config parsed from configuration string. + /// @see zbar_image_scanner_parse_config() + /// @since 0.4 + int set_config (std::string cfgstr) + { + return(zbar_image_scanner_parse_config(_scanner, cfgstr.c_str())); + } + + /// enable or disable the inter-image result cache. + /// see zbar_image_scanner_enable_cache() + void enable_cache (bool enable = true) + { + zbar_image_scanner_enable_cache(_scanner, enable); + } + + /// remove previous results from scanner and image. + /// @see zbar_image_scanner_recycle_image() + /// @since 0.10 + void recycle_image (Image &image) + { + zbar_image_scanner_recycle_image(_scanner, image); + } + + /// retrieve decode results for last scanned image. + /// @see zbar_image_scanner_get_results() + /// @since 0.10 + const SymbolSet get_results () const { + return(SymbolSet(zbar_image_scanner_get_results(_scanner))); + } + + /// scan for symbols in provided image. + /// see zbar_scan_image() + int scan (Image& image) + { + return(zbar_scan_image(_scanner, image)); + } + + /// scan for symbols in provided image. + /// see zbar_scan_image() + ImageScanner& operator<< (Image& image) + { + scan(image); + return(*this); + } + +private: + zbar_image_scanner_t *_scanner; +}; + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Processor.h b/ios/ZBarSDK/Headers/zbar/Processor.h new file mode 100644 index 0000000..2622ee8 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Processor.h @@ -0,0 +1,223 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_PROCESSOR_H_ +#define _ZBAR_PROCESSOR_H_ + +/// @file +/// Processor C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Processor.h" +#endif + +#include "Exception.h" +#include "Image.h" + +namespace zbar { + +/// high-level self-contained image processor. +/// processes video and images for barcodes, optionally displaying +/// images to a library owned output window + +class Processor { + public: + /// value to pass for no timeout. + static const int FOREVER = -1; + + /// constructor. + Processor (bool threaded = true, + const char *video_device = "", + bool enable_display = true) + { + _processor = zbar_processor_create(threaded); + if(!_processor) + throw std::bad_alloc(); + init(video_device, enable_display); + } + + ~Processor () + { + zbar_processor_destroy(_processor); + } + + /// cast to C processor object. + operator zbar_processor_t* () + { + return(_processor); + } + + /// opens a video input device and/or prepares to display output. + /// see zbar_processor_init() + void init (const char *video_device = "", + bool enable_display = true) + { + if(zbar_processor_init(_processor, video_device, enable_display)) + throw_exception(_processor); + } + + /// setup result handler callback. + /// see zbar_processor_set_data_handler() + void set_handler (Image::Handler& handler) + { + zbar_processor_set_data_handler(_processor, handler, &handler); + } + + /// set config for indicated symbology (0 for all) to specified value. + /// @see zbar_processor_set_config() + /// @since 0.4 + int set_config (zbar_symbol_type_t symbology, + zbar_config_t config, + int value) + { + return(zbar_processor_set_config(_processor, symbology, + config, value)); + } + + /// set config parsed from configuration string. + /// @see zbar_processor_parse_config() + /// @since 0.4 + int set_config (std::string cfgstr) + { + return(zbar_processor_parse_config(_processor, cfgstr.c_str())); + } + + /// retrieve the current state of the ouput window. + /// see zbar_processor_is_visible() + bool is_visible () + { + int rc = zbar_processor_is_visible(_processor); + if(rc < 0) + throw_exception(_processor); + return(rc != 0); + } + + /// show or hide the display window owned by the library. + /// see zbar_processor_set_visible() + void set_visible (bool visible = true) + { + if(zbar_processor_set_visible(_processor, visible) < 0) + throw_exception(_processor); + } + + /// control the processor in free running video mode. + /// see zbar_processor_set_active() + void set_active (bool active = true) + { + if(zbar_processor_set_active(_processor, active) < 0) + throw_exception(_processor); + } + + /// retrieve decode results for last scanned image. + /// @see zbar_processor_get_results() + /// @since 0.10 + const SymbolSet get_results () const { + return(SymbolSet(zbar_processor_get_results(_processor))); + } + + /// wait for input to the display window from the user. + /// see zbar_processor_user_wait() + int user_wait (int timeout = FOREVER) + { + int rc = zbar_processor_user_wait(_processor, timeout); + if(rc < 0) + throw_exception(_processor); + return(rc); + } + + /// process from the video stream until a result is available. + /// see zbar_process_one() + void process_one (int timeout = FOREVER) + { + if(zbar_process_one(_processor, timeout) < 0) + throw_exception(_processor); + } + + /// process the provided image for barcodes. + /// see zbar_process_image() + void process_image (Image& image) + { + if(zbar_process_image(_processor, image) < 0) + throw_exception(_processor); + } + + /// process the provided image for barcodes. + /// see zbar_process_image() + Processor& operator<< (Image& image) + { + process_image(image); + return(*this); + } + + /// force specific input and output formats for debug/testing. + /// see zbar_processor_force_format() + void force_format (unsigned long input_format, + unsigned long output_format) + { + if(zbar_processor_force_format(_processor, input_format, + output_format)) + throw_exception(_processor); + } + + /// force specific input and output formats for debug/testing. + /// see zbar_processor_force_format() + void force_format (std::string& input_format, + std::string& output_format) + { + unsigned long ifourcc = zbar_fourcc_parse(input_format.c_str()); + unsigned long ofourcc = zbar_fourcc_parse(output_format.c_str()); + if(zbar_processor_force_format(_processor, ifourcc, ofourcc)) + throw_exception(_processor); + } + + /// request a preferred size for the video image from the device. + /// see zbar_processor_request_size() + /// @since 0.6 + void request_size (int width, int height) + { + zbar_processor_request_size(_processor, width, height); + } + + /// request a preferred driver interface version for debug/testing. + /// see zbar_processor_request_interface() + /// @since 0.6 + void request_interface (int version) + { + zbar_processor_request_interface(_processor, version); + } + + /// request a preferred I/O mode for debug/testing. + /// see zbar_processor_request_iomode() + /// @since 0.7 + void request_iomode (int iomode) + { + if(zbar_processor_request_iomode(_processor, iomode)) + throw_exception(_processor); + } + + private: + zbar_processor_t *_processor; +}; + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Scanner.h b/ios/ZBarSDK/Headers/zbar/Scanner.h new file mode 100644 index 0000000..8c9a756 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Scanner.h @@ -0,0 +1,162 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_SCANNER_H_ +#define _ZBAR_SCANNER_H_ + +/// @file +/// Scanner C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Scanner.h" +#endif + +#include + +namespace zbar { + +/// low-level linear intensity sample stream scanner interface. +/// identifies "bar" edges and measures width between them. +/// optionally passes to bar width Decoder + +class Scanner { + public: + + /// constructor. + /// @param decoder reference to a Decoder instance which will + /// be passed scan results automatically + Scanner (Decoder& decoder) + { + _scanner = zbar_scanner_create(decoder._decoder); + } + + /// constructor. + /// @param decoder pointer to a Decoder instance which will + /// be passed scan results automatically + Scanner (Decoder* decoder = NULL) + { + zbar_decoder_t *zdcode = NULL; + if(decoder) + zdcode = decoder->_decoder; + _scanner = zbar_scanner_create(zdcode); + } + + ~Scanner () + { + zbar_scanner_destroy(_scanner); + } + + /// clear all scanner state. + /// see zbar_scanner_reset() + void reset () + { + zbar_scanner_reset(_scanner); + } + + /// mark start of a new scan pass. + /// see zbar_scanner_new_scan() + zbar_symbol_type_t new_scan () + { + _type = zbar_scanner_new_scan(_scanner); + return(_type); + } + + /// flush scanner pipeline. + /// see zbar_scanner_flush() + zbar_symbol_type_t flush () + { + _type = zbar_scanner_flush(_scanner); + return(_type); + } + + /// process next sample intensity value. + /// see zbar_scan_y() + zbar_symbol_type_t scan_y (int y) + { + _type = zbar_scan_y(_scanner, y); + return(_type); + } + + /// process next sample intensity value. + /// see zbar_scan_y() + Scanner& operator<< (int y) + { + _type = zbar_scan_y(_scanner, y); + return(*this); + } + + /// process next sample from RGB (or BGR) triple. + /// see zbar_scan_rgb24() + zbar_symbol_type_t scan_rgb24 (unsigned char *rgb) + { + _type = zbar_scan_rgb24(_scanner, rgb); + return(_type); + } + + /// process next sample from RGB (or BGR) triple. + /// see zbar_scan_rgb24() + Scanner& operator<< (unsigned char *rgb) + { + _type = zbar_scan_rgb24(_scanner, rgb); + return(*this); + } + + /// retrieve last scanned width. + /// see zbar_scanner_get_width() + unsigned get_width () const + { + return(zbar_scanner_get_width(_scanner)); + } + + /// retrieve last scanned color. + /// see zbar_scanner_get_color() + zbar_color_t get_color () const + { + return(zbar_scanner_get_color(_scanner)); + } + + /// retrieve last scan result. + zbar_symbol_type_t get_type () const + { + return(_type); + } + + /// cast to C scanner + operator zbar_scanner_t* () const + { + return(_scanner); + } + + /// retrieve C scanner + const zbar_scanner_t *get_c_scanner () const + { + return(_scanner); + } + + private: + zbar_scanner_t *_scanner; + zbar_symbol_type_t _type; +}; + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Symbol.h b/ios/ZBarSDK/Headers/zbar/Symbol.h new file mode 100644 index 0000000..d3061be --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Symbol.h @@ -0,0 +1,541 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_SYMBOL_H_ +#define _ZBAR_SYMBOL_H_ + +/// @file +/// Symbol C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Symbol.h" +#endif + +#include +#include +#include +#include + +namespace zbar { + +class SymbolIterator; + +/// container for decoded result symbols associated with an image +/// or a composite symbol. + +class SymbolSet { +public: + /// constructor. + SymbolSet (const zbar_symbol_set_t *syms = NULL) + : _syms(syms) + { + ref(); + } + + /// copy constructor. + SymbolSet (const SymbolSet& syms) + : _syms(syms._syms) + { + ref(); + } + + /// destructor. + ~SymbolSet () + { + ref(-1); + } + + /// assignment. + SymbolSet& operator= (const SymbolSet& syms) + { + syms.ref(); + ref(-1); + _syms = syms._syms; + return(*this); + } + + /// truth testing. + bool operator! () const + { + return(!_syms || !get_size()); + } + + /// manipulate reference count. + void ref (int delta = 1) const + { + if(_syms) + zbar_symbol_set_ref((zbar_symbol_set_t*)_syms, delta); + } + + /// cast to C symbol set. + operator const zbar_symbol_set_t* () const + { + return(_syms); + } + + int get_size () const + { + return((_syms) ? zbar_symbol_set_get_size(_syms) : 0); + } + + /// create a new SymbolIterator over decoded results. + SymbolIterator symbol_begin() const; + + /// return a SymbolIterator suitable for ending iteration. + const SymbolIterator symbol_end() const; + +private: + const zbar_symbol_set_t *_syms; +}; + +/// decoded barcode symbol result object. stores type, data, and +/// image location of decoded symbol + +class Symbol { +public: + + /// image pixel location (x, y) coordinate tuple. + class Point { + public: + int x; ///< x-coordinate. + int y; ///< y-coordinate. + + Point () { } + + Point(int x, int y) + : x(x), y(y) + { } + + /// copy constructor. + Point (const Point& pt) + : x(pt.x), + y(pt.y) + { } + + /// assignment. + Point& operator= (const Point& pt) + { + x = pt.x; + y = pt.y; + return(*this); + } + }; + + /// iteration over Point objects in a symbol location polygon. + class PointIterator + : public std::iterator { + + public: + /// constructor. + PointIterator (const Symbol *sym = NULL, + int index = 0) + : _sym(sym), + _index(index) + { + if(sym) + sym->ref(1); + if(!sym || + (unsigned)_index >= zbar_symbol_get_loc_size(*_sym)) + _index = -1; + } + + /// copy constructor. + PointIterator (const PointIterator& iter) + : _sym(iter._sym), + _index(iter._index) + { + if(_sym) + _sym->ref(); + } + + /// destructor. + ~PointIterator () + { + if(_sym) + _sym->ref(-1); + } + + /// assignment. + PointIterator& operator= (const PointIterator& iter) + { + if(iter._sym) + iter._sym->ref(); + if(_sym) + _sym->ref(-1); + _sym = iter._sym; + _index = iter._index; + return(*this); + } + + /// truth testing. + bool operator! () const + { + return(!_sym || _index < 0); + } + + /// advance iterator to next Point. + PointIterator& operator++ () + { + unsigned int i = ++_index; + if(!_sym || i >= zbar_symbol_get_loc_size(*_sym)) + _index = -1; + return(*this); + } + + /// retrieve currently referenced Point. + const Point operator* () const + { + assert(!!*this); + if(!*this) + return(Point()); + return(Point(zbar_symbol_get_loc_x(*_sym, _index), + zbar_symbol_get_loc_y(*_sym, _index))); + } + + /// test if two iterators refer to the same Point in the same + /// Symbol. + bool operator== (const PointIterator& iter) const + { + return(_index == iter._index && + ((_index < 0) || _sym == iter._sym)); + } + + /// test if two iterators refer to the same Point in the same + /// Symbol. + bool operator!= (const PointIterator& iter) const + { + return(!(*this == iter)); + } + + private: + const Symbol *_sym; + int _index; + }; + + /// constructor. + Symbol (const zbar_symbol_t *sym = NULL) + : _xmlbuf(NULL), + _xmllen(0) + { + init(sym); + ref(); + } + + /// copy constructor. + Symbol (const Symbol& sym) + : _sym(sym._sym), + _type(sym._type), + _data(sym._data), + _xmlbuf(NULL), + _xmllen(0) + { + ref(); + } + + /// destructor. + ~Symbol () { + if(_xmlbuf) + free(_xmlbuf); + ref(-1); + } + + /// assignment. + Symbol& operator= (const Symbol& sym) + { + sym.ref(1); + ref(-1); + _sym = sym._sym; + _type = sym._type; + _data = sym._data; + return(*this); + } + + Symbol& operator= (const zbar_symbol_t *sym) + { + if(sym) + zbar_symbol_ref(sym, 1); + ref(-1); + init(sym); + return(*this); + } + + /// truth testing. + bool operator! () const + { + return(!_sym); + } + + void ref (int delta = 1) const + { + if(_sym) + zbar_symbol_ref((zbar_symbol_t*)_sym, delta); + } + + /// cast to C symbol. + operator const zbar_symbol_t* () const + { + return(_sym); + } + + /// test if two Symbol objects refer to the same C symbol. + bool operator== (const Symbol& sym) const + { + return(_sym == sym._sym); + } + + /// test if two Symbol objects refer to the same C symbol. + bool operator!= (const Symbol& sym) const + { + return(!(*this == sym)); + } + + /// retrieve type of decoded symbol. + zbar_symbol_type_t get_type () const + { + return(_type); + } + + /// retrieve the string name of the symbol type. + const std::string get_type_name () const + { + return(zbar_get_symbol_name(_type)); + } + + /// retrieve the string name for any addon. + /// @deprecated in 0.11 + const std::string get_addon_name () const + { + return(zbar_get_addon_name(_type)); + } + + /// retrieve data decoded from symbol. + const std::string get_data () const + { + return(_data); + } + + /// retrieve length of binary data + unsigned get_data_length () const + { + return((_sym) ? zbar_symbol_get_data_length(_sym) : 0); + } + + /// retrieve inter-frame coherency count. + /// see zbar_symbol_get_count() + /// @since 0.5 + int get_count () const + { + return((_sym) ? zbar_symbol_get_count(_sym) : -1); + } + + /// retrieve loosely defined relative quality metric. + /// see zbar_symbol_get_quality() + /// @since 0.11 + int get_quality () const + { + return((_sym) ? zbar_symbol_get_quality(_sym) : 0); + } + + SymbolSet get_components () const + { + return(SymbolSet((_sym) ? zbar_symbol_get_components(_sym) : NULL)); + } + + /// create a new PointIterator at the start of the location + /// polygon. + PointIterator point_begin() const + { + return(PointIterator(this)); + } + + /// return a PointIterator suitable for ending iteration. + const PointIterator point_end() const + { + return(PointIterator()); + } + + /// see zbar_symbol_get_loc_size(). + int get_location_size () const + { + return((_sym) ? zbar_symbol_get_loc_size(_sym) : 0); + } + + /// see zbar_symbol_get_loc_x(). + int get_location_x (unsigned index) const + { + return((_sym) ? zbar_symbol_get_loc_x(_sym, index) : -1); + } + + /// see zbar_symbol_get_loc_y(). + int get_location_y (unsigned index) const + { + return((_sym) ? zbar_symbol_get_loc_y(_sym, index) : -1); + } + + /// see zbar_symbol_get_orientation(). + /// @since 0.11 + int get_orientation () const + { + return(zbar_symbol_get_orientation(_sym)); + } + + /// see zbar_symbol_xml(). + const std::string xml () const + { + if(!_sym) + return(""); + return(zbar_symbol_xml(_sym, (char**)&_xmlbuf, (unsigned*)&_xmllen)); + } + +protected: + /// (re)initialize Symbol from C symbol object. + void init (const zbar_symbol_t *sym = NULL) + { + _sym = sym; + if(sym) { + _type = zbar_symbol_get_type(sym); + _data = std::string(zbar_symbol_get_data(sym), + zbar_symbol_get_data_length(sym)); + } + else { + _type = ZBAR_NONE; + _data = ""; + } + } + +private: + const zbar_symbol_t *_sym; + zbar_symbol_type_t _type; + std::string _data; + char *_xmlbuf; + unsigned _xmllen; +}; + +/// iteration over Symbol result objects in a scanned Image or SymbolSet. +class SymbolIterator + : public std::iterator { + +public: + /// default constructor. + SymbolIterator () + { } + + /// constructor. + SymbolIterator (const SymbolSet &syms) + : _syms(syms) + { + const zbar_symbol_set_t *zsyms = _syms; + if(zsyms) + _sym = zbar_symbol_set_first_symbol(zsyms); + } + + /// copy constructor. + SymbolIterator (const SymbolIterator& iter) + : _syms(iter._syms) + { + const zbar_symbol_set_t *zsyms = _syms; + if(zsyms) + _sym = zbar_symbol_set_first_symbol(zsyms); + } + + ~SymbolIterator () + { + } + + /// assignment. + SymbolIterator& operator= (const SymbolIterator& iter) + { + _syms = iter._syms; + _sym = iter._sym; + return(*this); + } + + bool operator! () const + { + return(!_syms || !_sym); + } + + /// advance iterator to next Symbol. + SymbolIterator& operator++ () + { + if(!!_sym) + _sym = zbar_symbol_next(_sym); + else if(!!_syms) + _sym = zbar_symbol_set_first_symbol(_syms); + return(*this); + } + + /// retrieve currently referenced Symbol. + const Symbol operator* () const + { + return(_sym); + } + + /// access currently referenced Symbol. + const Symbol* operator-> () const + { + return(&_sym); + } + + /// test if two iterators refer to the same Symbol + bool operator== (const SymbolIterator& iter) const + { + // it is enough to test the symbols, as they belong + // to only one set (also simplifies invalid case) + return(_sym == iter._sym); + } + + /// test if two iterators refer to the same Symbol + bool operator!= (const SymbolIterator& iter) const + { + return(!(*this == iter)); + } + + const SymbolIterator end () const { + return(SymbolIterator()); + } + +private: + SymbolSet _syms; + Symbol _sym; +}; + +inline SymbolIterator SymbolSet::symbol_begin () const { + return(SymbolIterator(*this)); +} + +inline const SymbolIterator SymbolSet::symbol_end () const { + return(SymbolIterator()); +} + +/// @relates Symbol +/// stream the string representation of a Symbol. +static inline std::ostream& operator<< (std::ostream& out, + const Symbol& sym) +{ + out << sym.get_type_name() << ":" << sym.get_data(); + return(out); +} + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Video.h b/ios/ZBarSDK/Headers/zbar/Video.h new file mode 100644 index 0000000..61a49f1 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Video.h @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_VIDEO_H_ +#define _ZBAR_VIDEO_H_ + +/// @file +/// Video Input C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Video.h" +#endif + +#include "Image.h" + +namespace zbar { + +/// mid-level video source abstraction. +/// captures images from a video device + +class Video { +public: + /// constructor. + Video (zbar_video_t *video = NULL) + { + if(video) + _video = video; + else + _video = zbar_video_create(); + } + + /// constructor. + Video (std::string& device) + { + _video = zbar_video_create(); + open(device); + } + + ~Video () + { + zbar_video_destroy(_video); + } + + /// cast to C video object. + operator zbar_video_t* () const + { + return(_video); + } + + /// open and probe a video device. + void open (std::string& device) + { + if(zbar_video_open(_video, device.c_str())) + throw_exception(_video); + } + + /// close video device if open. + void close () + { + if(zbar_video_open(_video, NULL)) + throw_exception(_video); + } + + /// initialize video using a specific format for debug. + /// see zbar_video_init() + void init (unsigned long fourcc) + { + if(zbar_video_init(_video, fourcc)) + throw_exception(_video); + } + + /// initialize video using a specific format for debug. + /// see zbar_video_init() + void init (std::string& format) + { + unsigned int fourcc = zbar_fourcc_parse(format.c_str()); + if(zbar_video_init(_video, fourcc)) + throw_exception(_video); + } + + /// retrieve file descriptor associated with open *nix video device. + /// see zbar_video_get_fd() + int get_fd () + { + return(zbar_video_get_fd(_video)); + } + + /// retrieve current output image width. + /// see zbar_video_get_width() + int get_width () + { + return(zbar_video_get_width(_video)); + } + + /// retrieve current output image height. + /// see zbar_video_get_height() + int get_height () + { + return(zbar_video_get_height(_video)); + } + + /// start/stop video capture. + /// see zbar_video_enable() + void enable (bool enable = true) + { + if(zbar_video_enable(_video, enable)) + throw_exception(_video); + } + + /// retrieve next captured image. + /// see zbar_video_next_image() + Image next_image () + { + zbar_image_t *img = zbar_video_next_image(_video); + if(!img) + throw_exception(_video); + return(Image(img)); + } + + /// request a preferred size for the video image from the device. + /// see zbar_video_request_size() + /// @since 0.6 + void request_size (int width, int height) + { + zbar_video_request_size(_video, width, height); + } + + /// request a preferred driver interface version for debug/testing. + /// see zbar_video_request_interface() + /// @since 0.6 + void request_interface (int version) + { + zbar_video_request_interface(_video, version); + } + + /// request a preferred I/O mode for debug/testing. + /// see zbar_video_request_iomode() + /// @since 0.7 + void request_iomode (int iomode) + { + if(zbar_video_request_iomode(_video, iomode)) + throw_exception(_video); + } + +private: + zbar_video_t *_video; +}; + +} + +#endif diff --git a/ios/ZBarSDK/Headers/zbar/Window.h b/ios/ZBarSDK/Headers/zbar/Window.h new file mode 100644 index 0000000..c91a405 --- /dev/null +++ b/ios/ZBarSDK/Headers/zbar/Window.h @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_WINDOW_H_ +#define _ZBAR_WINDOW_H_ + +/// @file +/// Output Window C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Window.h" +#endif + +#include "Image.h" + +namespace zbar { + +/// mid-level output window abstraction. +/// displays images to user-specified platform specific output window + +class Window { +public: + /// constructor. + Window (zbar_window_t *window = NULL) + { + if(window) + _window = window; + else + _window = zbar_window_create(); + } + + /// constructor. + Window (void *x11_display_w32_hwnd, + unsigned long x11_drawable) + { + _window = zbar_window_create(); + attach(x11_display_w32_hwnd, x11_drawable); + } + + ~Window () + { + zbar_window_destroy(_window); + } + + /// cast to C window object. + operator zbar_window_t* () const + { + return(_window); + } + + /// associate reader with an existing platform window. + /// see zbar_window_attach() + void attach (void *x11_display_w32_hwnd, + unsigned long x11_drawable = 0) + { + if(zbar_window_attach(_window, + x11_display_w32_hwnd, x11_drawable) < 0) + throw_exception(_window); + } + + /// control content level of the reader overlay. + /// see zbar_window_set_overlay() + void set_overlay (int level) + { + zbar_window_set_overlay(_window, level); + } + + /// retrieve current content level of reader overlay. + /// see zbar_window_get_overlay() + + /// draw a new image into the output window. + /// see zbar_window_draw() + void draw (Image& image) + { + if(zbar_window_draw(_window, image) < 0) + throw_exception(_window); + } + + /// clear the image from the output window. + /// see zbar_window_draw() + void clear () + { + if(zbar_window_draw(_window, NULL) < 0) + throw_exception(_window); + } + + /// redraw the last image. + /// zbar_window_redraw() + void redraw () + { + if(zbar_window_redraw(_window) < 0) + throw_exception(_window); + } + + /// resize the image window. + /// zbar_window_resize() + void resize (unsigned width, unsigned height) + { + if(zbar_window_resize(_window, width, height) < 0) + throw_exception(_window); + } + +private: + zbar_window_t *_window; +}; + +/// select a compatible format between video input and output window. +/// see zbar_negotiate_format() +static inline void negotiate_format (Video& video, Window& window) +{ + if(zbar_negotiate_format(video, window) < 0) + throw_exception(video); +} + +} + +#endif diff --git a/ios/ZBarSDK/libzbar.a b/ios/ZBarSDK/libzbar.a old mode 100755 new mode 100644 index dd4e79c..422e024 Binary files a/ios/ZBarSDK/libzbar.a and b/ios/ZBarSDK/libzbar.a differ diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarCameraSimulator.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarCameraSimulator.h new file mode 100755 index 0000000..61bb07f --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarCameraSimulator.h @@ -0,0 +1,45 @@ +//------------------------------------------------------------------------ +// Copyright 2010-2011 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +@class ZBarReaderView; + +// hack around missing simulator support for AVCapture interfaces + +@interface ZBarCameraSimulator + : NSObject + < UINavigationControllerDelegate, + UIImagePickerControllerDelegate, + UIPopoverControllerDelegate > +{ + UIViewController *viewController; + ZBarReaderView *readerView; + UIImagePickerController *picker; + UIPopoverController *pickerPopover; +} + +- (id) initWithViewController: (UIViewController*) viewController; +- (void) takePicture; + +@property (nonatomic, assign) ZBarReaderView *readerView; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarCaptureReader.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarCaptureReader.h new file mode 100755 index 0000000..e466130 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarCaptureReader.h @@ -0,0 +1,111 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +@class AVCaptureVideoDataOutput, AVCaptureOutput; +@class ZBarCaptureReader, ZBarCVImage; + +@protocol ZBarCaptureDelegate + +// called when a new barcode is detected. the image refers to the +// video buffer and must not be retained for long +- (void) captureReader: (ZBarCaptureReader*) captureReader + didReadNewSymbolsFromImage: (ZBarImage*) image; + +@optional +// called when a potential/uncertain barcode is detected. will also +// be called *after* captureReader:didReadNewSymbolsFromImage: +// when good barcodes are detected +- (void) captureReader: (ZBarCaptureReader*) captureReader + didTrackSymbols: (ZBarSymbolSet*) symbols; + +@end + +@interface ZBarCaptureReader + : NSObject +{ +#if !TARGET_IPHONE_SIMULATOR + AVCaptureVideoDataOutput *captureOutput; + id captureDelegate; + ZBarImageScanner *scanner; + CGRect scanCrop; + CGSize size; + CGFloat framesPerSecond; + BOOL enableCache; + + dispatch_queue_t queue; + ZBarImage *image; + ZBarCVImage *result; + volatile uint32_t state; + int framecnt; + unsigned width, height; + uint64_t t_frame, t_fps, t_scan; + CGFloat dt_frame; +#endif +} + +// supply a pre-configured image scanner +- (id) initWithImageScanner: (ZBarImageScanner*) imageScanner; + +// this must be called before the session is started +- (void) willStartRunning; + +// this must be called *before* the session is stopped +- (void) willStopRunning; + +// clear the internal result cache +- (void) flushCache; + +// capture the next frame after processing. the captured image will +// follow the same delegate path as an image with decoded symbols. +- (void) captureFrame; + +// the capture output. add this to an instance of AVCaptureSession +@property (nonatomic, readonly) AVCaptureOutput *captureOutput; + +// delegate is notified of decode results and symbol tracking. +@property (nonatomic, assign) id captureDelegate; + +// access to image scanner for configuration. +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// region of image to scan in normalized coordinates. +// NB horizontal crop currently ignored... +@property (nonatomic, assign) CGRect scanCrop; + +// size of video frames. +@property (nonatomic, readonly) CGSize size; + +// (quickly) gate the reader function without interrupting the video +// stream. also flushes the cache when enabled. defaults to *NO* +@property (nonatomic) BOOL enableReader; + +// current frame rate (for debug/optimization). +// only valid when running +@property (nonatomic, readonly) CGFloat framesPerSecond; + +@property (nonatomic) BOOL enableCache; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarHelpController.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarHelpController.h new file mode 100755 index 0000000..37639dd --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarHelpController.h @@ -0,0 +1,60 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import + +@class ZBarHelpController; + +@protocol ZBarHelpDelegate +@optional + +- (void) helpControllerDidFinish: (ZBarHelpController*) help; + +@end + + +// failure dialog w/a few useful tips + +@interface ZBarHelpController : UIViewController + < UIWebViewDelegate, + UIAlertViewDelegate > +{ + NSString *reason; + id delegate; + UIWebView *webView; + UIToolbar *toolbar; + UIBarButtonItem *doneBtn, *backBtn, *space; + NSURL *linkURL; + NSUInteger orientations; +} + +@property (nonatomic, assign) id delegate; + +// designated initializer +- (id) initWithReason: (NSString*) reason; + +- (BOOL) isInterfaceOrientationSupported: (UIInterfaceOrientation) orientation; +- (void) setInterfaceOrientation: (UIInterfaceOrientation) orientation + supported: (BOOL) supported; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarImage.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarImage.h new file mode 100755 index 0000000..2e6ec8e --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarImage.h @@ -0,0 +1,69 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "zbar.h" +#import "ZBarSymbol.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar image + +@interface ZBarImage : NSObject +{ + zbar_image_t *zimg; + double t_convert; +} + +@property (nonatomic) unsigned long format; +@property (nonatomic) unsigned sequence; +@property (nonatomic) CGSize size; +@property (nonatomic) CGRect crop; +@property (readonly, nonatomic) const void *data; +@property (readonly, nonatomic) unsigned long dataLength; +@property (copy, nonatomic) ZBarSymbolSet *symbols; +@property (readonly, nonatomic) zbar_image_t *zbarImage; +@property (readonly, nonatomic) UIImage *UIImage; + +- (id) initWithImage: (zbar_image_t*) image; +- (id) initWithCGImage: (CGImageRef) image; +- (id) initWithCGImage: (CGImageRef) image + size: (CGSize) size; +- (id) initWithCGImage: (CGImageRef) image + crop: (CGRect) crop + size: (CGSize) size; + +- (void) setData: (const void*) data + withLength: (unsigned long) length; +- (UIImage*) UIImageWithOrientation: (UIImageOrientation) imageOrientation; +- (void) cleanup; + ++ (unsigned long) fourcc: (NSString*) format; + +#if 0 +- convertToFormat: (unsigned long) format; +#endif + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarImageScanner.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarImageScanner.h new file mode 100755 index 0000000..c01b047 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarImageScanner.h @@ -0,0 +1,51 @@ +//------------------------------------------------------------------------ +// Copyright 2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "zbar.h" +#import "ZBarImage.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar image scanner + +@interface ZBarImageScanner : NSObject +{ + zbar_image_scanner_t *scanner; +} + +@property (nonatomic) BOOL enableCache; +@property (readonly, nonatomic) ZBarSymbolSet *results; + +// decoder configuration +- (void) parseConfig: (NSString*) configStr; +- (void) setSymbology: (zbar_symbol_type_t) symbology + config: (zbar_config_t) config + to: (int) value; + +// image scanning interface +- (NSInteger) scanImage: (ZBarImage*) image; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderController.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderController.h new file mode 100755 index 0000000..9121971 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderController.h @@ -0,0 +1,142 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +typedef enum { + // default interface provided by UIImagePickerController - user manually + // captures an image by pressing a button + ZBarReaderControllerCameraModeDefault = 0, + + // automatically scan by taking screenshots with UIGetScreenImage(). + // resolution is limited by the screen, so this is inappropriate for + // longer codes + ZBarReaderControllerCameraModeSampling, + + // automatically scan by rapidly taking pictures with takePicture. + // tradeoff resolution with frame rate by adjusting the crop, and size + // properties of the reader along with the density configs of the image + // scanner + ZBarReaderControllerCameraModeSequence, + +} ZBarReaderControllerCameraMode; + + +@class ZBarReaderController, ZBarHelpController; + +@protocol ZBarReaderDelegate +@optional + +// called when no barcode is found in an image selected by the user. +// if retry is NO, the delegate *must* dismiss the controller +- (void) readerControllerDidFailToRead: (ZBarReaderController*) reader + withRetry: (BOOL) retry; + +@end + + +@interface ZBarReaderController + : UIImagePickerController + < UINavigationControllerDelegate, + UIImagePickerControllerDelegate > +{ + ZBarImageScanner *scanner; + ZBarHelpController *help; + UIView *overlay, *boxView; + CALayer *boxLayer; + + UIToolbar *toolbar; + UIBarButtonItem *cancelBtn, *scanBtn, *space[3]; + UIButton *infoBtn; + + id readerDelegate; + BOOL showsZBarControls, showsHelpOnFail, takesPicture, enableCache; + ZBarReaderControllerCameraMode cameraMode; + CGRect scanCrop; + NSInteger maxScanDimension; + + BOOL hasOverlay, sampling; + uint64_t t_frame; + double dt_frame; + + ZBarSymbol *symbol; +} + +// access to configure image scanner +@property (readonly, nonatomic) ZBarImageScanner *scanner; + +// barcode result recipient (NB don't use delegate) +@property (nonatomic, assign) id readerDelegate; + +// whether to use alternate control set +@property (nonatomic) BOOL showsZBarControls; + +// whether to display helpful information when decoding fails +@property (nonatomic) BOOL showsHelpOnFail; + +// how to use the camera (when sourceType == Camera) +@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; + +// whether to outline symbols with the green tracking box. +@property (nonatomic) BOOL tracksSymbols; + +// whether to automatically take a full picture when a barcode is detected +// (when cameraMode == Sampling) +@property (nonatomic) BOOL takesPicture; + +// whether to use the "cache" for realtime modes (default YES). this can be +// used to safely disable the inter-frame consistency and duplicate checks, +// speeding up recognition, iff: +// 1. the controller is dismissed when a barcode is read and +// 2. unreliable symbologies are disabled (all EAN/UPC variants and I2/5) +@property (nonatomic) BOOL enableCache; + +// crop images for scanning. the original image will be cropped to this +// rectangle before scanning. the rectangle is normalized to the image size +// and aspect ratio; useful values will place the rectangle between 0 and 1 +// on each axis, where the x-axis corresponds to the image major axis. +// defaults to the full image (0, 0, 1, 1). +@property (nonatomic) CGRect scanCrop; + +// scale image to scan. after cropping, the image will be scaled if +// necessary, such that neither of its dimensions exceed this value. +// defaults to 640. +@property (nonatomic) NSInteger maxScanDimension; + +// display the built-in help browser. for use with custom overlays if +// you don't also want to create your own help view. only send this +// message when the reader is displayed. the argument will be passed +// to the onZBarHelp() javascript function. +- (void) showHelpWithReason: (NSString*) reason; + +// direct scanner interface - scan UIImage and return something enumerable +- (id ) scanImage: (CGImageRef) image; + +@end + +extern NSString* const ZBarReaderControllerResults; diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderView.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderView.h new file mode 100755 index 0000000..bc75c9d --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderView.h @@ -0,0 +1,135 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarImageScanner.h" + +@class AVCaptureSession, AVCaptureDevice; +@class CALayer; +@class ZBarImageScanner, ZBarCaptureReader, ZBarReaderView; + +// delegate is notified of decode results. + +@protocol ZBarReaderViewDelegate < NSObject > + +- (void) readerView: (ZBarReaderView*) readerView + didReadSymbols: (ZBarSymbolSet*) symbols + fromImage: (UIImage*) image; + +@end + +// read barcodes from the displayed video preview. the view maintains +// a complete video capture session feeding a ZBarCaptureReader and +// presents the associated preview with symbol tracking annotations. + +@interface ZBarReaderView + : UIView +{ + id readerDelegate; + ZBarCaptureReader *captureReader; + CGRect scanCrop, effectiveCrop; + CGAffineTransform previewTransform; + CGFloat zoom, zoom0, maxZoom; + UIColor *trackingColor; + BOOL tracksSymbols, showsFPS; + NSInteger torchMode; + UIInterfaceOrientation interfaceOrientation; + NSTimeInterval animationDuration; + + CALayer *preview, *overlay, *tracking, *cropLayer; + UIView *fpsView; + UILabel *fpsLabel; + UIPinchGestureRecognizer *pinch; + CGFloat imageScale; + CGSize imageSize; + BOOL started, running; +} + +// supply a pre-configured image scanner. +- (id) initWithImageScanner: (ZBarImageScanner*) imageScanner; + +// start the video stream and barcode reader. +- (void) start; + +// stop the video stream and barcode reader. +- (void) stop; + +// clear the internal result cache +- (void) flushCache; + +// compensate for device/camera/interface orientation +- (void) willRotateToInterfaceOrientation: (UIInterfaceOrientation) orient + duration: (NSTimeInterval) duration; + +// delegate is notified of decode results. +@property (nonatomic, assign) id readerDelegate; + +// access to image scanner for configuration. +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// whether to display the tracking annotation for uncertain barcodes +// (default YES). +@property (nonatomic) BOOL tracksSymbols; + +// color of the tracking box (default green) +@property (nonatomic, retain) UIColor *trackingColor; + +// enable pinch gesture recognition for zooming the preview/decode +// (default YES). +@property (nonatomic) BOOL allowsPinchZoom; + +// torch mode to set automatically (default Auto). +@property (nonatomic) NSInteger torchMode; + +// whether to display the frame rate for debug/configuration +// (default NO). +@property (nonatomic) BOOL showsFPS; + +// zoom scale factor applied to video preview *and* scanCrop. +// also updated by pinch-zoom gesture. clipped to range [1,maxZoom], +// defaults to 1.25 +@property (nonatomic) CGFloat zoom; +- (void) setZoom: (CGFloat) zoom + animated: (BOOL) animated; + +// maximum settable zoom factor. +@property (nonatomic) CGFloat maxZoom; + +// the region of the image that will be scanned. normalized coordinates. +@property (nonatomic) CGRect scanCrop; + +// additional transform applied to video preview. +// (NB *not* applied to scan crop) +@property (nonatomic) CGAffineTransform previewTransform; + +// specify an alternate capture device. +@property (nonatomic, retain) AVCaptureDevice *device; + +// direct access to the capture session. warranty void if opened... +@property (nonatomic, readonly) AVCaptureSession *session; +@property (nonatomic, readonly) ZBarCaptureReader *captureReader; + +// this flag still works, but its use is deprecated +@property (nonatomic) BOOL enableCache; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderViewController.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderViewController.h new file mode 100755 index 0000000..be2bf21 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarReaderViewController.h @@ -0,0 +1,130 @@ +//------------------------------------------------------------------------ +// Copyright 2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import "ZBarReaderController.h" + +// orientation set support +#define ZBarOrientationMask(orient) (1 << orient) +#define ZBarOrientationMaskAll \ + (ZBarOrientationMask(UIInterfaceOrientationPortrait) | \ + ZBarOrientationMask(UIInterfaceOrientationPortraitUpsideDown) | \ + ZBarOrientationMask(UIInterfaceOrientationLandscapeLeft) | \ + ZBarOrientationMask(UIInterfaceOrientationLandscapeRight)) + +@class ZBarReaderView, ZBarCameraSimulator; + +// drop in video scanning replacement for ZBarReaderController. +// this is a thin controller around a ZBarReaderView that adds the UI +// controls and select functionality offered by ZBarReaderController. +// Automatically falls back to a ZBarReaderController if video APIs +// are unavailable (eg for OS < 4.0) + +@interface ZBarReaderViewController + : UIViewController +{ + ZBarImageScanner *scanner; + id readerDelegate; + ZBarReaderView *readerView; + UIView *cameraOverlayView; + CGAffineTransform cameraViewTransform; + CGRect scanCrop; + NSUInteger supportedOrientationsMask; + UIImagePickerControllerCameraDevice cameraDevice; + UIImagePickerControllerCameraFlashMode cameraFlashMode; + UIImagePickerControllerQualityType videoQuality; + BOOL showsZBarControls, tracksSymbols, enableCache; + + ZBarHelpController *helpController; + UIView *controls; + BOOL didHideStatusBar, rotating; + ZBarCameraSimulator *cameraSim; +} + +// access to configure image scanner +@property (nonatomic, readonly) ZBarImageScanner *scanner; + +// barcode result recipient +@property (nonatomic, assign) id readerDelegate; + +// whether to use alternate control set +@property (nonatomic) BOOL showsZBarControls; + +// whether to show the green tracking box. note that, even when +// enabled, the box will only be visible when scanning EAN and I2/5. +@property (nonatomic) BOOL tracksSymbols; + +// interface orientation support. bit-mask of accepted orientations. +// see eg ZBarOrientationMask() and ZBarOrientationMaskAll +@property (nonatomic) NSUInteger supportedOrientationsMask; + +// crop images for scanning. the image will be cropped to this +// rectangle before scanning. the rectangle is normalized to the +// image size and aspect ratio; useful values will place the rectangle +// between 0 and 1 on each axis, where the x-axis corresponds to the +// image major axis. defaults to the full image (0, 0, 1, 1). +@property (nonatomic) CGRect scanCrop; + +// provide a custom overlay. note that this can be used with +// showsZBarControls enabled (but not if you want backward compatibility) +@property (nonatomic, retain) UIView *cameraOverlayView; + +// transform applied to the preview image. +@property (nonatomic) CGAffineTransform cameraViewTransform; + +// display the built-in help browser. the argument will be passed to +// the onZBarHelp() javascript function. +- (void) showHelpWithReason: (NSString*) reason; + +// capture the next frame and send it over the usual delegate path. +- (void) takePicture; + +// these attempt to emulate UIImagePickerController ++ (BOOL) isCameraDeviceAvailable: (UIImagePickerControllerCameraDevice) cameraDevice; ++ (BOOL) isFlashAvailableForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice; ++ (NSArray*) availableCaptureModesForCameraDevice: (UIImagePickerControllerCameraDevice) cameraDevice; +@property(nonatomic) UIImagePickerControllerCameraDevice cameraDevice; +@property(nonatomic) UIImagePickerControllerCameraFlashMode cameraFlashMode; +@property(nonatomic) UIImagePickerControllerCameraCaptureMode cameraCaptureMode; +@property(nonatomic) UIImagePickerControllerQualityType videoQuality; + +// direct access to the ZBarReaderView +@property (nonatomic, readonly) ZBarReaderView *readerView; + +// this flag still works, but its use is deprecated +@property (nonatomic) BOOL enableCache; + +// these are present only for backward compatibility. +// they will error if inappropriate/unsupported values are set +@property (nonatomic) UIImagePickerControllerSourceType sourceType; // Camera +@property (nonatomic) BOOL allowsEditing; // NO +@property (nonatomic) BOOL allowsImageEditing; // NO +@property (nonatomic) BOOL showsCameraControls; // NO +@property (nonatomic) BOOL showsHelpOnFail; // ignored +@property (nonatomic) ZBarReaderControllerCameraMode cameraMode; // Sampling +@property (nonatomic) BOOL takesPicture; // NO +@property (nonatomic) NSInteger maxScanDimension; // ignored + ++ (BOOL) isSourceTypeAvailable: (UIImagePickerControllerSourceType) sourceType; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarSDK.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarSDK.h new file mode 100755 index 0000000..b7cd52d --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarSDK.h @@ -0,0 +1,34 @@ +/*------------------------------------------------------------------------ + * Copyright 2010 (c) Jeff Brown + * + * This file is part of the ZBar Bar Code Reader. + * + * The ZBar Bar Code Reader is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * The ZBar Bar Code Reader is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with the ZBar Bar Code Reader; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * http://sourceforge.net/projects/zbar + *------------------------------------------------------------------------*/ + +#import "zbar.h" + +#import "ZBarSymbol.h" +#import "ZBarImage.h" +#import "ZBarImageScanner.h" +#import "ZBarReaderView.h" +#import "ZBarReaderViewController.h" +#import "ZBarReaderController.h" +#import "ZBarCaptureReader.h" +#import "ZBarHelpController.h" +#import "ZBarCameraSimulator.h" diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarSymbol.h b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarSymbol.h new file mode 100755 index 0000000..c8a8574 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/ZBarSymbol.h @@ -0,0 +1,71 @@ +//------------------------------------------------------------------------ +// Copyright 2009-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ + +#import +#import +#import "zbar.h" + +#ifdef __cplusplus +using namespace zbar; +#endif + +// Obj-C wrapper for ZBar result types + +@interface ZBarSymbolSet + : NSObject +{ + const zbar_symbol_set_t *set; + BOOL filterSymbols; +} + +@property (readonly, nonatomic) int count; +@property (readonly, nonatomic) const zbar_symbol_set_t *zbarSymbolSet; +@property (nonatomic) BOOL filterSymbols; + +- (id) initWithSymbolSet: (const zbar_symbol_set_t*) set; + +@end + + +@interface ZBarSymbol : NSObject +{ + const zbar_symbol_t *symbol; +} + +@property (readonly, nonatomic) zbar_symbol_type_t type; +@property (readonly, nonatomic) NSString *typeName; +@property (readonly, nonatomic) NSUInteger configMask; +@property (readonly, nonatomic) NSUInteger modifierMask; +@property (readonly, nonatomic) NSString *data; +@property (readonly, nonatomic) int quality; +@property (readonly, nonatomic) int count; +@property (readonly, nonatomic) zbar_orientation_t orientation; +@property (readonly, nonatomic) ZBarSymbolSet *components; +@property (readonly, nonatomic) const zbar_symbol_t *zbarSymbol; +@property (readonly, nonatomic) CGRect bounds; + +- (id) initWithSymbol: (const zbar_symbol_t*) symbol; + ++ (NSString*) nameForType: (zbar_symbol_type_t) type; + +@end diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar.h new file mode 100755 index 0000000..49aaea6 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar.h @@ -0,0 +1,1497 @@ +/*------------------------------------------------------------------------ + * Copyright 2007-2010 (c) Jeff Brown + * + * This file is part of the ZBar Bar Code Reader. + * + * The ZBar Bar Code Reader is free software; you can redistribute it + * and/or modify it under the terms of the GNU Lesser Public License as + * published by the Free Software Foundation; either version 2.1 of + * the License, or (at your option) any later version. + * + * The ZBar Bar Code Reader is distributed in the hope that it will be + * useful, but WITHOUT ANY WARRANTY; without even the implied warranty + * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser Public License for more details. + * + * You should have received a copy of the GNU Lesser Public License + * along with the ZBar Bar Code Reader; if not, write to the Free + * Software Foundation, Inc., 51 Franklin St, Fifth Floor, + * Boston, MA 02110-1301 USA + * + * http://sourceforge.net/projects/zbar + *------------------------------------------------------------------------*/ +#ifndef _ZBAR_H_ +#define _ZBAR_H_ + +/** @file + * ZBar Barcode Reader C API definition + */ + +/** @mainpage + * + * interface to the barcode reader is available at several levels. + * most applications will want to use the high-level interfaces: + * + * @section high-level High-Level Interfaces + * + * these interfaces wrap all library functionality into an easy-to-use + * package for a specific toolkit: + * - the "GTK+ 2.x widget" may be used with GTK GUI applications. a + * Python wrapper is included for PyGtk + * - the @ref zbar::QZBar "Qt4 widget" may be used with Qt GUI + * applications + * - the Processor interface (in @ref c-processor "C" or @ref + * zbar::Processor "C++") adds a scanning window to an application + * with no GUI. + * + * @section mid-level Intermediate Interfaces + * + * building blocks used to construct high-level interfaces: + * - the ImageScanner (in @ref c-imagescanner "C" or @ref + * zbar::ImageScanner "C++") looks for barcodes in a library defined + * image object + * - the Window abstraction (in @ref c-window "C" or @ref + * zbar::Window "C++") sinks library images, displaying them on the + * platform display + * - the Video abstraction (in @ref c-video "C" or @ref zbar::Video + * "C++") sources library images from a video device + * + * @section low-level Low-Level Interfaces + * + * direct interaction with barcode scanning and decoding: + * - the Scanner (in @ref c-scanner "C" or @ref zbar::Scanner "C++") + * looks for barcodes in a linear intensity sample stream + * - the Decoder (in @ref c-decoder "C" or @ref zbar::Decoder "C++") + * extracts barcodes from a stream of bar and space widths + */ + +#ifdef __cplusplus + +/** C++ namespace for library interfaces */ +namespace zbar { + extern "C" { +#endif + + +/** @name Global library interfaces */ +/*@{*/ + +/** "color" of element: bar or space. */ +typedef enum zbar_color_e { + ZBAR_SPACE = 0, /**< light area or space between bars */ + ZBAR_BAR = 1, /**< dark area or colored bar segment */ +} zbar_color_t; + +/** decoded symbol type. */ +typedef enum zbar_symbol_type_e { + ZBAR_NONE = 0, /**< no symbol decoded */ + ZBAR_PARTIAL = 1, /**< intermediate status */ + ZBAR_EAN2 = 2, /**< GS1 2-digit add-on */ + ZBAR_EAN5 = 5, /**< GS1 5-digit add-on */ + ZBAR_EAN8 = 8, /**< EAN-8 */ + ZBAR_UPCE = 9, /**< UPC-E */ + ZBAR_ISBN10 = 10, /**< ISBN-10 (from EAN-13). @since 0.4 */ + ZBAR_UPCA = 12, /**< UPC-A */ + ZBAR_EAN13 = 13, /**< EAN-13 */ + ZBAR_ISBN13 = 14, /**< ISBN-13 (from EAN-13). @since 0.4 */ + ZBAR_COMPOSITE = 15, /**< EAN/UPC composite */ + ZBAR_I25 = 25, /**< Interleaved 2 of 5. @since 0.4 */ + ZBAR_DATABAR = 34, /**< GS1 DataBar (RSS). @since 0.11 */ + ZBAR_DATABAR_EXP = 35, /**< GS1 DataBar Expanded. @since 0.11 */ + ZBAR_CODE39 = 39, /**< Code 39. @since 0.4 */ + ZBAR_PDF417 = 57, /**< PDF417. @since 0.6 */ + ZBAR_QRCODE = 64, /**< QR Code. @since 0.10 */ + ZBAR_CODE93 = 93, /**< Code 93. @since 0.11 */ + ZBAR_CODE128 = 128, /**< Code 128 */ + + /** mask for base symbol type. + * @deprecated in 0.11, remove this from existing code + */ + ZBAR_SYMBOL = 0x00ff, + /** 2-digit add-on flag. + * @deprecated in 0.11, a ::ZBAR_EAN2 component is used for + * 2-digit GS1 add-ons + */ + ZBAR_ADDON2 = 0x0200, + /** 5-digit add-on flag. + * @deprecated in 0.11, a ::ZBAR_EAN5 component is used for + * 5-digit GS1 add-ons + */ + ZBAR_ADDON5 = 0x0500, + /** add-on flag mask. + * @deprecated in 0.11, GS1 add-ons are represented using composite + * symbols of type ::ZBAR_COMPOSITE; add-on components use ::ZBAR_EAN2 + * or ::ZBAR_EAN5 + */ + ZBAR_ADDON = 0x0700, +} zbar_symbol_type_t; + +/** decoded symbol coarse orientation. + * @since 0.11 + */ +typedef enum zbar_orientation_e { + ZBAR_ORIENT_UNKNOWN = -1, /**< unable to determine orientation */ + ZBAR_ORIENT_UP, /**< upright, read left to right */ + ZBAR_ORIENT_RIGHT, /**< sideways, read top to bottom */ + ZBAR_ORIENT_DOWN, /**< upside-down, read right to left */ + ZBAR_ORIENT_LEFT, /**< sideways, read bottom to top */ +} zbar_orientation_t; + +/** error codes. */ +typedef enum zbar_error_e { + ZBAR_OK = 0, /**< no error */ + ZBAR_ERR_NOMEM, /**< out of memory */ + ZBAR_ERR_INTERNAL, /**< internal library error */ + ZBAR_ERR_UNSUPPORTED, /**< unsupported request */ + ZBAR_ERR_INVALID, /**< invalid request */ + ZBAR_ERR_SYSTEM, /**< system error */ + ZBAR_ERR_LOCKING, /**< locking error */ + ZBAR_ERR_BUSY, /**< all resources busy */ + ZBAR_ERR_XDISPLAY, /**< X11 display error */ + ZBAR_ERR_XPROTO, /**< X11 protocol error */ + ZBAR_ERR_CLOSED, /**< output window is closed */ + ZBAR_ERR_WINAPI, /**< windows system error */ + ZBAR_ERR_NUM /**< number of error codes */ +} zbar_error_t; + +/** decoder configuration options. + * @since 0.4 + */ +typedef enum zbar_config_e { + ZBAR_CFG_ENABLE = 0, /**< enable symbology/feature */ + ZBAR_CFG_ADD_CHECK, /**< enable check digit when optional */ + ZBAR_CFG_EMIT_CHECK, /**< return check digit when present */ + ZBAR_CFG_ASCII, /**< enable full ASCII character set */ + ZBAR_CFG_NUM, /**< number of boolean decoder configs */ + + ZBAR_CFG_MIN_LEN = 0x20, /**< minimum data length for valid decode */ + ZBAR_CFG_MAX_LEN, /**< maximum data length for valid decode */ + + ZBAR_CFG_UNCERTAINTY = 0x40,/**< required video consistency frames */ + + ZBAR_CFG_POSITION = 0x80, /**< enable scanner to collect position data */ + + ZBAR_CFG_X_DENSITY = 0x100, /**< image scanner vertical scan density */ + ZBAR_CFG_Y_DENSITY, /**< image scanner horizontal scan density */ +} zbar_config_t; + +/** decoder symbology modifier flags. + * @since 0.11 + */ +typedef enum zbar_modifier_e { + /** barcode tagged as GS1 (EAN.UCC) reserved + * (eg, FNC1 before first data character). + * data may be parsed as a sequence of GS1 AIs + */ + ZBAR_MOD_GS1 = 0, + + /** barcode tagged as AIM reserved + * (eg, FNC1 after first character or digit pair) + */ + ZBAR_MOD_AIM, + + /** number of modifiers */ + ZBAR_MOD_NUM, +} zbar_modifier_t; + +/** retrieve runtime library version information. + * @param major set to the running major version (unless NULL) + * @param minor set to the running minor version (unless NULL) + * @returns 0 + */ +extern int zbar_version(unsigned *major, + unsigned *minor); + +/** set global library debug level. + * @param verbosity desired debug level. higher values create more spew + */ +extern void zbar_set_verbosity(int verbosity); + +/** increase global library debug level. + * eg, for -vvvv + */ +extern void zbar_increase_verbosity(void); + +/** retrieve string name for symbol encoding. + * @param sym symbol type encoding + * @returns the static string name for the specified symbol type, + * or "UNKNOWN" if the encoding is not recognized + */ +extern const char *zbar_get_symbol_name(zbar_symbol_type_t sym); + +/** retrieve string name for addon encoding. + * @param sym symbol type encoding + * @returns static string name for any addon, or the empty string + * if no addons were decoded + * @deprecated in 0.11 + */ +extern const char *zbar_get_addon_name(zbar_symbol_type_t sym); + +/** retrieve string name for configuration setting. + * @param config setting to name + * @returns static string name for config, + * or the empty string if value is not a known config + */ +extern const char *zbar_get_config_name(zbar_config_t config); + +/** retrieve string name for modifier. + * @param modifier flag to name + * @returns static string name for modifier, + * or the empty string if the value is not a known flag + */ +extern const char *zbar_get_modifier_name(zbar_modifier_t modifier); + +/** retrieve string name for orientation. + * @param orientation orientation encoding + * @returns the static string name for the specified orientation, + * or "UNKNOWN" if the orientation is not recognized + * @since 0.11 + */ +extern const char *zbar_get_orientation_name(zbar_orientation_t orientation); + +/** parse a configuration string of the form "[symbology.]config[=value]". + * the config must match one of the recognized names. + * the symbology, if present, must match one of the recognized names. + * if symbology is unspecified, it will be set to 0. + * if value is unspecified it will be set to 1. + * @returns 0 if the config is parsed successfully, 1 otherwise + * @since 0.4 + */ +extern int zbar_parse_config(const char *config_string, + zbar_symbol_type_t *symbology, + zbar_config_t *config, + int *value); + +/** consistently compute fourcc values across architectures + * (adapted from v4l2 specification) + * @since 0.11 + */ +#define zbar_fourcc(a, b, c, d) \ + ((unsigned long)(a) | \ + ((unsigned long)(b) << 8) | \ + ((unsigned long)(c) << 16) | \ + ((unsigned long)(d) << 24)) + +/** parse a fourcc string into its encoded integer value. + * @since 0.11 + */ +static inline unsigned long zbar_fourcc_parse (const char *format) +{ + unsigned long fourcc = 0; + if(format) { + int i; + for(i = 0; i < 4 && format[i]; i++) + fourcc |= ((unsigned long)format[i]) << (i * 8); + } + return(fourcc); +} + +/** @internal type unsafe error API (don't use) */ +extern int _zbar_error_spew(const void *object, + int verbosity); +extern const char *_zbar_error_string(const void *object, + int verbosity); +extern zbar_error_t _zbar_get_error_code(const void *object); + +/*@}*/ + +struct zbar_symbol_s; +typedef struct zbar_symbol_s zbar_symbol_t; + +struct zbar_symbol_set_s; +typedef struct zbar_symbol_set_s zbar_symbol_set_t; + + +/*------------------------------------------------------------*/ +/** @name Symbol interface + * decoded barcode symbol result object. stores type, data, and image + * location of decoded symbol. all memory is owned by the library + */ +/*@{*/ + +/** @typedef zbar_symbol_t + * opaque decoded symbol object. + */ + +/** symbol reference count manipulation. + * increment the reference count when you store a new reference to the + * symbol. decrement when the reference is no longer used. do not + * refer to the symbol once the count is decremented and the + * containing image has been recycled or destroyed. + * @note the containing image holds a reference to the symbol, so you + * only need to use this if you keep a symbol after the image has been + * destroyed or reused. + * @since 0.9 + */ +extern void zbar_symbol_ref(const zbar_symbol_t *symbol, + int refs); + +/** retrieve type of decoded symbol. + * @returns the symbol type + */ +extern zbar_symbol_type_t zbar_symbol_get_type(const zbar_symbol_t *symbol); + +/** retrieve symbology boolean config settings. + * @returns a bitmask indicating which configs were set for the detected + * symbology during decoding. + * @since 0.11 + */ +extern unsigned int zbar_symbol_get_configs(const zbar_symbol_t *symbol); + +/** retrieve symbology modifier flag settings. + * @returns a bitmask indicating which characteristics were detected + * during decoding. + * @since 0.11 + */ +extern unsigned int zbar_symbol_get_modifiers(const zbar_symbol_t *symbol); + +/** retrieve data decoded from symbol. + * @returns the data string + */ +extern const char *zbar_symbol_get_data(const zbar_symbol_t *symbol); + +/** retrieve length of binary data. + * @returns the length of the decoded data + */ +extern unsigned int zbar_symbol_get_data_length(const zbar_symbol_t *symbol); + +/** retrieve a symbol confidence metric. + * @returns an unscaled, relative quantity: larger values are better + * than smaller values, where "large" and "small" are application + * dependent. + * @note expect the exact definition of this quantity to change as the + * metric is refined. currently, only the ordered relationship + * between two values is defined and will remain stable in the future + * @since 0.9 + */ +extern int zbar_symbol_get_quality(const zbar_symbol_t *symbol); + +/** retrieve current cache count. when the cache is enabled for the + * image_scanner this provides inter-frame reliability and redundancy + * information for video streams. + * @returns < 0 if symbol is still uncertain. + * @returns 0 if symbol is newly verified. + * @returns > 0 for duplicate symbols + */ +extern int zbar_symbol_get_count(const zbar_symbol_t *symbol); + +/** retrieve the number of points in the location polygon. the + * location polygon defines the image area that the symbol was + * extracted from. + * @returns the number of points in the location polygon + * @note this is currently not a polygon, but the scan locations + * where the symbol was decoded + */ +extern unsigned zbar_symbol_get_loc_size(const zbar_symbol_t *symbol); + +/** retrieve location polygon x-coordinates. + * points are specified by 0-based index. + * @returns the x-coordinate for a point in the location polygon. + * @returns -1 if index is out of range + */ +extern int zbar_symbol_get_loc_x(const zbar_symbol_t *symbol, + unsigned index); + +/** retrieve location polygon y-coordinates. + * points are specified by 0-based index. + * @returns the y-coordinate for a point in the location polygon. + * @returns -1 if index is out of range + */ +extern int zbar_symbol_get_loc_y(const zbar_symbol_t *symbol, + unsigned index); + +/** retrieve general orientation of decoded symbol. + * @returns a coarse, axis-aligned indication of symbol orientation or + * ::ZBAR_ORIENT_UNKNOWN if unknown + * @since 0.11 + */ +extern zbar_orientation_t +zbar_symbol_get_orientation(const zbar_symbol_t *symbol); + +/** iterate the set to which this symbol belongs (there can be only one). + * @returns the next symbol in the set, or + * @returns NULL when no more results are available + */ +extern const zbar_symbol_t *zbar_symbol_next(const zbar_symbol_t *symbol); + +/** retrieve components of a composite result. + * @returns the symbol set containing the components + * @returns NULL if the symbol is already a physical symbol + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_symbol_get_components(const zbar_symbol_t *symbol); + +/** iterate components of a composite result. + * @returns the first physical component symbol of a composite result + * @returns NULL if the symbol is already a physical symbol + * @since 0.10 + */ +extern const zbar_symbol_t* +zbar_symbol_first_component(const zbar_symbol_t *symbol); + +/** print XML symbol element representation to user result buffer. + * @see http://zbar.sourceforge.net/2008/barcode.xsd for the schema. + * @param symbol is the symbol to print + * @param buffer is the inout result pointer, it will be reallocated + * with a larger size if necessary. + * @param buflen is inout length of the result buffer. + * @returns the buffer pointer + * @since 0.6 + */ +extern char *zbar_symbol_xml(const zbar_symbol_t *symbol, + char **buffer, + unsigned *buflen); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Symbol Set interface + * container for decoded result symbols associated with an image + * or a composite symbol. + * @since 0.10 + */ +/*@{*/ + +/** @typedef zbar_symbol_set_t + * opaque symbol iterator object. + * @since 0.10 + */ + +/** reference count manipulation. + * increment the reference count when you store a new reference. + * decrement when the reference is no longer used. do not refer to + * the object any longer once references have been released. + * @since 0.10 + */ +extern void zbar_symbol_set_ref(const zbar_symbol_set_t *symbols, + int refs); + +/** retrieve set size. + * @returns the number of symbols in the set. + * @since 0.10 + */ +extern int zbar_symbol_set_get_size(const zbar_symbol_set_t *symbols); + +/** set iterator. + * @returns the first decoded symbol result in a set + * @returns NULL if the set is empty + * @since 0.10 + */ +extern const zbar_symbol_t* +zbar_symbol_set_first_symbol(const zbar_symbol_set_t *symbols); + +/** raw result iterator. + * @returns the first decoded symbol result in a set, *before* filtering + * @returns NULL if the set is empty + * @since 0.11 + */ +extern const zbar_symbol_t* +zbar_symbol_set_first_unfiltered(const zbar_symbol_set_t *symbols); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Image interface + * stores image data samples along with associated format and size + * metadata + */ +/*@{*/ + +struct zbar_image_s; +/** opaque image object. */ +typedef struct zbar_image_s zbar_image_t; + +/** cleanup handler callback function. + * called to free sample data when an image is destroyed. + */ +typedef void (zbar_image_cleanup_handler_t)(zbar_image_t *image); + +/** data handler callback function. + * called when decoded symbol results are available for an image + */ +typedef void (zbar_image_data_handler_t)(zbar_image_t *image, + const void *userdata); + +/** new image constructor. + * @returns a new image object with uninitialized data and format. + * this image should be destroyed (using zbar_image_destroy()) as + * soon as the application is finished with it + */ +extern zbar_image_t *zbar_image_create(void); + +/** image destructor. all images created by or returned to the + * application should be destroyed using this function. when an image + * is destroyed, the associated data cleanup handler will be invoked + * if available + * @note make no assumptions about the image or the data buffer. + * they may not be destroyed/cleaned immediately if the library + * is still using them. if necessary, use the cleanup handler hook + * to keep track of image data buffers + */ +extern void zbar_image_destroy(zbar_image_t *image); + +/** image reference count manipulation. + * increment the reference count when you store a new reference to the + * image. decrement when the reference is no longer used. do not + * refer to the image any longer once the count is decremented. + * zbar_image_ref(image, -1) is the same as zbar_image_destroy(image) + * @since 0.5 + */ +extern void zbar_image_ref(zbar_image_t *image, + int refs); + +/** image format conversion. refer to the documentation for supported + * image formats + * @returns a @em new image with the sample data from the original image + * converted to the requested format. the original image is + * unaffected. + * @note the converted image size may be rounded (up) due to format + * constraints + */ +extern zbar_image_t *zbar_image_convert(const zbar_image_t *image, + unsigned long format); + +/** image format conversion with crop/pad. + * if the requested size is larger than the image, the last row/column + * are duplicated to cover the difference. if the requested size is + * smaller than the image, the extra rows/columns are dropped from the + * right/bottom. + * @returns a @em new image with the sample data from the original + * image converted to the requested format and size. + * @note the image is @em not scaled + * @see zbar_image_convert() + * @since 0.4 + */ +extern zbar_image_t *zbar_image_convert_resize(const zbar_image_t *image, + unsigned long format, + unsigned width, + unsigned height); + +/** retrieve the image format. + * @returns the fourcc describing the format of the image sample data + */ +extern unsigned long zbar_image_get_format(const zbar_image_t *image); + +/** retrieve a "sequence" (page/frame) number associated with this image. + * @since 0.6 + */ +extern unsigned zbar_image_get_sequence(const zbar_image_t *image); + +/** retrieve the width of the image. + * @returns the width in sample columns + */ +extern unsigned zbar_image_get_width(const zbar_image_t *image); + +/** retrieve the height of the image. + * @returns the height in sample rows + */ +extern unsigned zbar_image_get_height(const zbar_image_t *image); + +/** retrieve both dimensions of the image. + * fills in the width and height in samples + */ +extern void zbar_image_get_size(const zbar_image_t *image, + unsigned *width, + unsigned *height); + +/** retrieve the crop rectangle. + * fills in the image coordinates of the upper left corner and size + * of an axis-aligned rectangular area of the image that will be scanned. + * defaults to the full image + * @since 0.11 + */ +extern void zbar_image_get_crop(const zbar_image_t *image, + unsigned *x, + unsigned *y, + unsigned *width, + unsigned *height); + +/** return the image sample data. the returned data buffer is only + * valid until zbar_image_destroy() is called + */ +extern const void *zbar_image_get_data(const zbar_image_t *image); + +/** return the size of image data. + * @since 0.6 + */ +extern unsigned long zbar_image_get_data_length(const zbar_image_t *img); + +/** retrieve the decoded results. + * @returns the (possibly empty) set of decoded symbols + * @returns NULL if the image has not been scanned + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_image_get_symbols(const zbar_image_t *image); + +/** associate the specified symbol set with the image, replacing any + * existing results. use NULL to release the current results from the + * image. + * @see zbar_image_scanner_recycle_image() + * @since 0.10 + */ +extern void zbar_image_set_symbols(zbar_image_t *image, + const zbar_symbol_set_t *symbols); + +/** image_scanner decode result iterator. + * @returns the first decoded symbol result for an image + * or NULL if no results are available + */ +extern const zbar_symbol_t* +zbar_image_first_symbol(const zbar_image_t *image); + +/** specify the fourcc image format code for image sample data. + * refer to the documentation for supported formats. + * @note this does not convert the data! + * (see zbar_image_convert() for that) + */ +extern void zbar_image_set_format(zbar_image_t *image, + unsigned long format); + +/** associate a "sequence" (page/frame) number with this image. + * @since 0.6 + */ +extern void zbar_image_set_sequence(zbar_image_t *image, + unsigned sequence_num); + +/** specify the pixel size of the image. + * @note this also resets the crop rectangle to the full image + * (0, 0, width, height) + * @note this does not affect the data! + */ +extern void zbar_image_set_size(zbar_image_t *image, + unsigned width, + unsigned height); + +/** specify a rectangular region of the image to scan. + * the rectangle will be clipped to the image boundaries. + * defaults to the full image specified by zbar_image_set_size() + */ +extern void zbar_image_set_crop(zbar_image_t *image, + unsigned x, + unsigned y, + unsigned width, + unsigned height); + +/** specify image sample data. when image data is no longer needed by + * the library the specific data cleanup handler will be called + * (unless NULL) + * @note application image data will not be modified by the library + */ +extern void zbar_image_set_data(zbar_image_t *image, + const void *data, + unsigned long data_byte_length, + zbar_image_cleanup_handler_t *cleanup_hndlr); + +/** built-in cleanup handler. + * passes the image data buffer to free() + */ +extern void zbar_image_free_data(zbar_image_t *image); + +/** associate user specified data value with an image. + * @since 0.5 + */ +extern void zbar_image_set_userdata(zbar_image_t *image, + void *userdata); + +/** return user specified data value associated with the image. + * @since 0.5 + */ +extern void *zbar_image_get_userdata(const zbar_image_t *image); + +/** dump raw image data to a file for debug. + * the data will be prefixed with a 16 byte header consisting of: + * - 4 bytes uint = 0x676d697a ("zimg") + * - 4 bytes format fourcc + * - 2 bytes width + * - 2 bytes height + * - 4 bytes size of following image data in bytes + * this header can be dumped w/eg: + * @verbatim + od -Ax -tx1z -N16 -w4 [file] +@endverbatim + * for some formats the image can be displayed/converted using + * ImageMagick, eg: + * @verbatim + display -size 640x480+16 [-depth ?] [-sampling-factor ?x?] \ + {GRAY,RGB,UYVY,YUV}:[file] +@endverbatim + * + * @param image the image object to dump + * @param filebase base filename, appended with ".XXXX.zimg" where + * XXXX is the format fourcc + * @returns 0 on success or a system error code on failure + */ +extern int zbar_image_write(const zbar_image_t *image, + const char *filebase); + +/** read back an image in the format written by zbar_image_write() + * @note TBD + */ +extern zbar_image_t *zbar_image_read(char *filename); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Processor interface + * @anchor c-processor + * high-level self-contained image processor. + * processes video and images for barcodes, optionally displaying + * images to a library owned output window + */ +/*@{*/ + +struct zbar_processor_s; +/** opaque standalone processor object. */ +typedef struct zbar_processor_s zbar_processor_t; + +/** constructor. + * if threaded is set and threading is available the processor + * will spawn threads where appropriate to avoid blocking and + * improve responsiveness + */ +extern zbar_processor_t *zbar_processor_create(int threaded); + +/** destructor. cleans up all resources associated with the processor + */ +extern void zbar_processor_destroy(zbar_processor_t *processor); + +/** (re)initialization. + * opens a video input device and/or prepares to display output + */ +extern int zbar_processor_init(zbar_processor_t *processor, + const char *video_device, + int enable_display); + +/** request a preferred size for the video image from the device. + * the request may be adjusted or completely ignored by the driver. + * @note must be called before zbar_processor_init() + * @since 0.6 + */ +extern int zbar_processor_request_size(zbar_processor_t *processor, + unsigned width, + unsigned height); + +/** request a preferred video driver interface version for + * debug/testing. + * @note must be called before zbar_processor_init() + * @since 0.6 + */ +extern int zbar_processor_request_interface(zbar_processor_t *processor, + int version); + +/** request a preferred video I/O mode for debug/testing. You will + * get errors if the driver does not support the specified mode. + * @verbatim + 0 = auto-detect + 1 = force I/O using read() + 2 = force memory mapped I/O using mmap() + 3 = force USERPTR I/O (v4l2 only) +@endverbatim + * @note must be called before zbar_processor_init() + * @since 0.7 + */ +extern int zbar_processor_request_iomode(zbar_processor_t *video, + int iomode); + +/** force specific input and output formats for debug/testing. + * @note must be called before zbar_processor_init() + */ +extern int zbar_processor_force_format(zbar_processor_t *processor, + unsigned long input_format, + unsigned long output_format); + +/** setup result handler callback. + * the specified function will be called by the processor whenever + * new results are available from the video stream or a static image. + * pass a NULL value to disable callbacks. + * @param processor the object on which to set the handler. + * @param handler the function to call when new results are available. + * @param userdata is set as with zbar_processor_set_userdata(). + * @returns the previously registered handler + */ +extern zbar_image_data_handler_t* +zbar_processor_set_data_handler(zbar_processor_t *processor, + zbar_image_data_handler_t *handler, + const void *userdata); + +/** associate user specified data value with the processor. + * @since 0.6 + */ +extern void zbar_processor_set_userdata(zbar_processor_t *processor, + void *userdata); + +/** return user specified data value associated with the processor. + * @since 0.6 + */ +extern void *zbar_processor_get_userdata(const zbar_processor_t *processor); + +/** set config for indicated symbology (0 for all) to specified value. + * @returns 0 for success, non-0 for failure (config does not apply to + * specified symbology, or value out of range) + * @see zbar_decoder_set_config() + * @since 0.4 + */ +extern int zbar_processor_set_config(zbar_processor_t *processor, + zbar_symbol_type_t symbology, + zbar_config_t config, + int value); + +/** parse configuration string using zbar_parse_config() + * and apply to processor using zbar_processor_set_config(). + * @returns 0 for success, non-0 for failure + * @see zbar_parse_config() + * @see zbar_processor_set_config() + * @since 0.4 + */ +static inline int zbar_processor_parse_config (zbar_processor_t *processor, + const char *config_string) +{ + zbar_symbol_type_t sym; + zbar_config_t cfg; + int val; + return(zbar_parse_config(config_string, &sym, &cfg, &val) || + zbar_processor_set_config(processor, sym, cfg, val)); +} + +/** retrieve the current state of the ouput window. + * @returns 1 if the output window is currently displayed, 0 if not. + * @returns -1 if an error occurs + */ +extern int zbar_processor_is_visible(zbar_processor_t *processor); + +/** show or hide the display window owned by the library. + * the size will be adjusted to the input size + */ +extern int zbar_processor_set_visible(zbar_processor_t *processor, + int visible); + +/** control the processor in free running video mode. + * only works if video input is initialized. if threading is in use, + * scanning will occur in the background, otherwise this is only + * useful wrapping calls to zbar_processor_user_wait(). if the + * library output window is visible, video display will be enabled. + */ +extern int zbar_processor_set_active(zbar_processor_t *processor, + int active); + +/** retrieve decode results for last scanned image/frame. + * @returns the symbol set result container or NULL if no results are + * available + * @note the returned symbol set has its reference count incremented; + * ensure that the count is decremented after use + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_processor_get_results(const zbar_processor_t *processor); + +/** wait for input to the display window from the user + * (via mouse or keyboard). + * @returns >0 when input is received, 0 if timeout ms expired + * with no input or -1 in case of an error + */ +extern int zbar_processor_user_wait(zbar_processor_t *processor, + int timeout); + +/** process from the video stream until a result is available, + * or the timeout (in milliseconds) expires. + * specify a timeout of -1 to scan indefinitely + * (zbar_processor_set_active() may still be used to abort the scan + * from another thread). + * if the library window is visible, video display will be enabled. + * @note that multiple results may still be returned (despite the + * name). + * @returns >0 if symbols were successfully decoded, + * 0 if no symbols were found (ie, the timeout expired) + * or -1 if an error occurs + */ +extern int zbar_process_one(zbar_processor_t *processor, + int timeout); + +/** process the provided image for barcodes. + * if the library window is visible, the image will be displayed. + * @returns >0 if symbols were successfully decoded, + * 0 if no symbols were found or -1 if an error occurs + */ +extern int zbar_process_image(zbar_processor_t *processor, + zbar_image_t *image); + +/** display detail for last processor error to stderr. + * @returns a non-zero value suitable for passing to exit() + */ +static inline int +zbar_processor_error_spew (const zbar_processor_t *processor, + int verbosity) +{ + return(_zbar_error_spew(processor, verbosity)); +} + +/** retrieve the detail string for the last processor error. */ +static inline const char* +zbar_processor_error_string (const zbar_processor_t *processor, + int verbosity) +{ + return(_zbar_error_string(processor, verbosity)); +} + +/** retrieve the type code for the last processor error. */ +static inline zbar_error_t +zbar_processor_get_error_code (const zbar_processor_t *processor) +{ + return(_zbar_get_error_code(processor)); +} + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Video interface + * @anchor c-video + * mid-level video source abstraction. + * captures images from a video device + */ +/*@{*/ + +struct zbar_video_s; +/** opaque video object. */ +typedef struct zbar_video_s zbar_video_t; + +/** constructor. */ +extern zbar_video_t *zbar_video_create(void); + +/** destructor. */ +extern void zbar_video_destroy(zbar_video_t *video); + +/** open and probe a video device. + * the device specified by platform specific unique name + * (v4l device node path in *nix eg "/dev/video", + * DirectShow DevicePath property in windows). + * @returns 0 if successful or -1 if an error occurs + */ +extern int zbar_video_open(zbar_video_t *video, + const char *device); + +/** retrieve file descriptor associated with open *nix video device + * useful for using select()/poll() to tell when new images are + * available (NB v4l2 only!!). + * @returns the file descriptor or -1 if the video device is not open + * or the driver only supports v4l1 + */ +extern int zbar_video_get_fd(const zbar_video_t *video); + +/** request a preferred size for the video image from the device. + * the request may be adjusted or completely ignored by the driver. + * @returns 0 if successful or -1 if the video device is already + * initialized + * @since 0.6 + */ +extern int zbar_video_request_size(zbar_video_t *video, + unsigned width, + unsigned height); + +/** request a preferred driver interface version for debug/testing. + * @note must be called before zbar_video_open() + * @since 0.6 + */ +extern int zbar_video_request_interface(zbar_video_t *video, + int version); + +/** request a preferred I/O mode for debug/testing. You will get + * errors if the driver does not support the specified mode. + * @verbatim + 0 = auto-detect + 1 = force I/O using read() + 2 = force memory mapped I/O using mmap() + 3 = force USERPTR I/O (v4l2 only) +@endverbatim + * @note must be called before zbar_video_open() + * @since 0.7 + */ +extern int zbar_video_request_iomode(zbar_video_t *video, + int iomode); + +/** retrieve current output image width. + * @returns the width or 0 if the video device is not open + */ +extern int zbar_video_get_width(const zbar_video_t *video); + +/** retrieve current output image height. + * @returns the height or 0 if the video device is not open + */ +extern int zbar_video_get_height(const zbar_video_t *video); + +/** initialize video using a specific format for debug. + * use zbar_negotiate_format() to automatically select and initialize + * the best available format + */ +extern int zbar_video_init(zbar_video_t *video, + unsigned long format); + +/** start/stop video capture. + * all buffered images are retired when capture is disabled. + * @returns 0 if successful or -1 if an error occurs + */ +extern int zbar_video_enable(zbar_video_t *video, + int enable); + +/** retrieve next captured image. blocks until an image is available. + * @returns NULL if video is not enabled or an error occurs + */ +extern zbar_image_t *zbar_video_next_image(zbar_video_t *video); + +/** display detail for last video error to stderr. + * @returns a non-zero value suitable for passing to exit() + */ +static inline int zbar_video_error_spew (const zbar_video_t *video, + int verbosity) +{ + return(_zbar_error_spew(video, verbosity)); +} + +/** retrieve the detail string for the last video error. */ +static inline const char *zbar_video_error_string (const zbar_video_t *video, + int verbosity) +{ + return(_zbar_error_string(video, verbosity)); +} + +/** retrieve the type code for the last video error. */ +static inline zbar_error_t +zbar_video_get_error_code (const zbar_video_t *video) +{ + return(_zbar_get_error_code(video)); +} + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Window interface + * @anchor c-window + * mid-level output window abstraction. + * displays images to user-specified platform specific output window + */ +/*@{*/ + +struct zbar_window_s; +/** opaque window object. */ +typedef struct zbar_window_s zbar_window_t; + +/** constructor. */ +extern zbar_window_t *zbar_window_create(void); + +/** destructor. */ +extern void zbar_window_destroy(zbar_window_t *window); + +/** associate reader with an existing platform window. + * This can be any "Drawable" for X Windows or a "HWND" for windows. + * input images will be scaled into the output window. + * pass NULL to detach from the resource, further input will be + * ignored + */ +extern int zbar_window_attach(zbar_window_t *window, + void *x11_display_w32_hwnd, + unsigned long x11_drawable); + +/** control content level of the reader overlay. + * the overlay displays graphical data for informational or debug + * purposes. higher values increase the level of annotation (possibly + * decreasing performance). @verbatim + 0 = disable overlay + 1 = outline decoded symbols (default) + 2 = also track and display input frame rate +@endverbatim + */ +extern void zbar_window_set_overlay(zbar_window_t *window, + int level); + +/** retrieve current content level of reader overlay. + * @see zbar_window_set_overlay() + * @since 0.10 + */ +extern int zbar_window_get_overlay(const zbar_window_t *window); + +/** draw a new image into the output window. */ +extern int zbar_window_draw(zbar_window_t *window, + zbar_image_t *image); + +/** redraw the last image (exposure handler). */ +extern int zbar_window_redraw(zbar_window_t *window); + +/** resize the image window (reconfigure handler). + * this does @em not update the contents of the window + * @since 0.3, changed in 0.4 to not redraw window + */ +extern int zbar_window_resize(zbar_window_t *window, + unsigned width, + unsigned height); + +/** display detail for last window error to stderr. + * @returns a non-zero value suitable for passing to exit() + */ +static inline int zbar_window_error_spew (const zbar_window_t *window, + int verbosity) +{ + return(_zbar_error_spew(window, verbosity)); +} + +/** retrieve the detail string for the last window error. */ +static inline const char* +zbar_window_error_string (const zbar_window_t *window, + int verbosity) +{ + return(_zbar_error_string(window, verbosity)); +} + +/** retrieve the type code for the last window error. */ +static inline zbar_error_t +zbar_window_get_error_code (const zbar_window_t *window) +{ + return(_zbar_get_error_code(window)); +} + + +/** select a compatible format between video input and output window. + * the selection algorithm attempts to use a format shared by + * video input and window output which is also most useful for + * barcode scanning. if a format conversion is necessary, it will + * heuristically attempt to minimize the cost of the conversion + */ +extern int zbar_negotiate_format(zbar_video_t *video, + zbar_window_t *window); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Image Scanner interface + * @anchor c-imagescanner + * mid-level image scanner interface. + * reads barcodes from 2-D images + */ +/*@{*/ + +struct zbar_image_scanner_s; +/** opaque image scanner object. */ +typedef struct zbar_image_scanner_s zbar_image_scanner_t; + +/** constructor. */ +extern zbar_image_scanner_t *zbar_image_scanner_create(void); + +/** destructor. */ +extern void zbar_image_scanner_destroy(zbar_image_scanner_t *scanner); + +/** setup result handler callback. + * the specified function will be called by the scanner whenever + * new results are available from a decoded image. + * pass a NULL value to disable callbacks. + * @returns the previously registered handler + */ +extern zbar_image_data_handler_t* +zbar_image_scanner_set_data_handler(zbar_image_scanner_t *scanner, + zbar_image_data_handler_t *handler, + const void *userdata); + + +/** set config for indicated symbology (0 for all) to specified value. + * @returns 0 for success, non-0 for failure (config does not apply to + * specified symbology, or value out of range) + * @see zbar_decoder_set_config() + * @since 0.4 + */ +extern int zbar_image_scanner_set_config(zbar_image_scanner_t *scanner, + zbar_symbol_type_t symbology, + zbar_config_t config, + int value); + +/** parse configuration string using zbar_parse_config() + * and apply to image scanner using zbar_image_scanner_set_config(). + * @returns 0 for success, non-0 for failure + * @see zbar_parse_config() + * @see zbar_image_scanner_set_config() + * @since 0.4 + */ +static inline int +zbar_image_scanner_parse_config (zbar_image_scanner_t *scanner, + const char *config_string) +{ + zbar_symbol_type_t sym; + zbar_config_t cfg; + int val; + return(zbar_parse_config(config_string, &sym, &cfg, &val) || + zbar_image_scanner_set_config(scanner, sym, cfg, val)); +} + +/** enable or disable the inter-image result cache (default disabled). + * mostly useful for scanning video frames, the cache filters + * duplicate results from consecutive images, while adding some + * consistency checking and hysteresis to the results. + * this interface also clears the cache + */ +extern void zbar_image_scanner_enable_cache(zbar_image_scanner_t *scanner, + int enable); + +/** remove any previously decoded results from the image scanner and the + * specified image. somewhat more efficient version of + * zbar_image_set_symbols(image, NULL) which may retain memory for + * subsequent decodes + * @since 0.10 + */ +extern void zbar_image_scanner_recycle_image(zbar_image_scanner_t *scanner, + zbar_image_t *image); + +/** retrieve decode results for last scanned image. + * @returns the symbol set result container or NULL if no results are + * available + * @note the symbol set does not have its reference count adjusted; + * ensure that the count is incremented if the results may be kept + * after the next image is scanned + * @since 0.10 + */ +extern const zbar_symbol_set_t* +zbar_image_scanner_get_results(const zbar_image_scanner_t *scanner); + +/** scan for symbols in provided image. The image format must be + * "Y800" or "GRAY". + * @returns >0 if symbols were successfully decoded from the image, + * 0 if no symbols were found or -1 if an error occurs + * @see zbar_image_convert() + * @since 0.9 - changed to only accept grayscale images + */ +extern int zbar_scan_image(zbar_image_scanner_t *scanner, + zbar_image_t *image); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Decoder interface + * @anchor c-decoder + * low-level bar width stream decoder interface. + * identifies symbols and extracts encoded data + */ +/*@{*/ + +struct zbar_decoder_s; +/** opaque decoder object. */ +typedef struct zbar_decoder_s zbar_decoder_t; + +/** decoder data handler callback function. + * called by decoder when new data has just been decoded + */ +typedef void (zbar_decoder_handler_t)(zbar_decoder_t *decoder); + +/** constructor. */ +extern zbar_decoder_t *zbar_decoder_create(void); + +/** destructor. */ +extern void zbar_decoder_destroy(zbar_decoder_t *decoder); + +/** set config for indicated symbology (0 for all) to specified value. + * @returns 0 for success, non-0 for failure (config does not apply to + * specified symbology, or value out of range) + * @since 0.4 + */ +extern int zbar_decoder_set_config(zbar_decoder_t *decoder, + zbar_symbol_type_t symbology, + zbar_config_t config, + int value); + +/** parse configuration string using zbar_parse_config() + * and apply to decoder using zbar_decoder_set_config(). + * @returns 0 for success, non-0 for failure + * @see zbar_parse_config() + * @see zbar_decoder_set_config() + * @since 0.4 + */ +static inline int zbar_decoder_parse_config (zbar_decoder_t *decoder, + const char *config_string) +{ + zbar_symbol_type_t sym; + zbar_config_t cfg; + int val; + return(zbar_parse_config(config_string, &sym, &cfg, &val) || + zbar_decoder_set_config(decoder, sym, cfg, val)); +} + +/** retrieve symbology boolean config settings. + * @returns a bitmask indicating which configs are currently set for the + * specified symbology. + * @since 0.11 + */ +extern unsigned int zbar_decoder_get_configs(const zbar_decoder_t *decoder, + zbar_symbol_type_t symbology); + +/** clear all decoder state. + * any partial symbols are flushed + */ +extern void zbar_decoder_reset(zbar_decoder_t *decoder); + +/** mark start of a new scan pass. + * clears any intra-symbol state and resets color to ::ZBAR_SPACE. + * any partially decoded symbol state is retained + */ +extern void zbar_decoder_new_scan(zbar_decoder_t *decoder); + +/** process next bar/space width from input stream. + * the width is in arbitrary relative units. first value of a scan + * is ::ZBAR_SPACE width, alternating from there. + * @returns appropriate symbol type if width completes + * decode of a symbol (data is available for retrieval) + * @returns ::ZBAR_PARTIAL as a hint if part of a symbol was decoded + * @returns ::ZBAR_NONE (0) if no new symbol data is available + */ +extern zbar_symbol_type_t zbar_decode_width(zbar_decoder_t *decoder, + unsigned width); + +/** retrieve color of @em next element passed to + * zbar_decode_width(). */ +extern zbar_color_t zbar_decoder_get_color(const zbar_decoder_t *decoder); + +/** retrieve last decoded data. + * @returns the data string or NULL if no new data available. + * the returned data buffer is owned by library, contents are only + * valid between non-0 return from zbar_decode_width and next library + * call + */ +extern const char *zbar_decoder_get_data(const zbar_decoder_t *decoder); + +/** retrieve length of binary data. + * @returns the length of the decoded data or 0 if no new data + * available. + */ +extern unsigned int +zbar_decoder_get_data_length(const zbar_decoder_t *decoder); + +/** retrieve last decoded symbol type. + * @returns the type or ::ZBAR_NONE if no new data available + */ +extern zbar_symbol_type_t +zbar_decoder_get_type(const zbar_decoder_t *decoder); + +/** retrieve modifier flags for the last decoded symbol. + * @returns a bitmask indicating which characteristics were detected + * during decoding. + * @since 0.11 + */ +extern unsigned int zbar_decoder_get_modifiers(const zbar_decoder_t *decoder); + +/** retrieve last decode direction. + * @returns 1 for forward and -1 for reverse + * @returns 0 if the decode direction is unknown or does not apply + * @since 0.11 + */ +extern int zbar_decoder_get_direction(const zbar_decoder_t *decoder); + +/** setup data handler callback. + * the registered function will be called by the decoder + * just before zbar_decode_width() returns a non-zero value. + * pass a NULL value to disable callbacks. + * @returns the previously registered handler + */ +extern zbar_decoder_handler_t* +zbar_decoder_set_handler(zbar_decoder_t *decoder, + zbar_decoder_handler_t *handler); + +/** associate user specified data value with the decoder. */ +extern void zbar_decoder_set_userdata(zbar_decoder_t *decoder, + void *userdata); + +/** return user specified data value associated with the decoder. */ +extern void *zbar_decoder_get_userdata(const zbar_decoder_t *decoder); + +/*@}*/ + +/*------------------------------------------------------------*/ +/** @name Scanner interface + * @anchor c-scanner + * low-level linear intensity sample stream scanner interface. + * identifies "bar" edges and measures width between them. + * optionally passes to bar width decoder + */ +/*@{*/ + +struct zbar_scanner_s; +/** opaque scanner object. */ +typedef struct zbar_scanner_s zbar_scanner_t; + +/** constructor. + * if decoder is non-NULL it will be attached to scanner + * and called automatically at each new edge + * current color is initialized to ::ZBAR_SPACE + * (so an initial BAR->SPACE transition may be discarded) + */ +extern zbar_scanner_t *zbar_scanner_create(zbar_decoder_t *decoder); + +/** destructor. */ +extern void zbar_scanner_destroy(zbar_scanner_t *scanner); + +/** clear all scanner state. + * also resets an associated decoder + */ +extern zbar_symbol_type_t zbar_scanner_reset(zbar_scanner_t *scanner); + +/** mark start of a new scan pass. resets color to ::ZBAR_SPACE. + * also updates an associated decoder. + * @returns any decode results flushed from the pipeline + * @note when not using callback handlers, the return value should + * be checked the same as zbar_scan_y() + * @note call zbar_scanner_flush() at least twice before calling this + * method to ensure no decode results are lost + */ +extern zbar_symbol_type_t zbar_scanner_new_scan(zbar_scanner_t *scanner); + +/** flush scanner processing pipeline. + * forces current scanner position to be a scan boundary. + * call multiple times (max 3) to completely flush decoder. + * @returns any decode/scan results flushed from the pipeline + * @note when not using callback handlers, the return value should + * be checked the same as zbar_scan_y() + * @since 0.9 + */ +extern zbar_symbol_type_t zbar_scanner_flush(zbar_scanner_t *scanner); + +/** process next sample intensity value. + * intensity (y) is in arbitrary relative units. + * @returns result of zbar_decode_width() if a decoder is attached, + * otherwise @returns (::ZBAR_PARTIAL) when new edge is detected + * or 0 (::ZBAR_NONE) if no new edge is detected + */ +extern zbar_symbol_type_t zbar_scan_y(zbar_scanner_t *scanner, + int y); + +/** process next sample from RGB (or BGR) triple. */ +static inline zbar_symbol_type_t zbar_scan_rgb24 (zbar_scanner_t *scanner, + unsigned char *rgb) +{ + return(zbar_scan_y(scanner, rgb[0] + rgb[1] + rgb[2])); +} + +/** retrieve last scanned width. */ +extern unsigned zbar_scanner_get_width(const zbar_scanner_t *scanner); + +/** retrieve sample position of last edge. + * @since 0.10 + */ +extern unsigned zbar_scanner_get_edge(const zbar_scanner_t *scn, + unsigned offset, + int prec); + +/** retrieve last scanned color. */ +extern zbar_color_t zbar_scanner_get_color(const zbar_scanner_t *scanner); + +/*@}*/ + +#ifdef __cplusplus + } +} + +# include "zbar/Exception.h" +# include "zbar/Decoder.h" +# include "zbar/Scanner.h" +# include "zbar/Symbol.h" +# include "zbar/Image.h" +# include "zbar/ImageScanner.h" +# include "zbar/Video.h" +# include "zbar/Window.h" +# include "zbar/Processor.h" +#endif + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Decoder.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Decoder.h new file mode 100755 index 0000000..27e78d8 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Decoder.h @@ -0,0 +1,202 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_DECODER_H_ +#define _ZBAR_DECODER_H_ + +/// @file +/// Decoder C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Decoder.h" +#endif + +#include + +namespace zbar { + +/// low-level bar width stream decoder interface. +/// identifies symbols and extracts encoded data + +class Decoder { + public: + + /// Decoder result handler. + /// applications should subtype this and pass an instance to + /// set_handler() to implement result processing + class Handler { + public: + virtual ~Handler() { } + + /// invoked by the Decoder as decode results become available. + virtual void decode_callback(Decoder &decoder) = 0; + }; + + /// constructor. + Decoder () + : _handler(NULL) + { + _decoder = zbar_decoder_create(); + } + + ~Decoder () + { + zbar_decoder_destroy(_decoder); + } + + /// clear all decoder state. + /// see zbar_decoder_reset() + void reset () + { + zbar_decoder_reset(_decoder); + } + + /// mark start of a new scan pass. + /// see zbar_decoder_new_scan() + void new_scan () + { + zbar_decoder_new_scan(_decoder); + } + + /// process next bar/space width from input stream. + /// see zbar_decode_width() + zbar_symbol_type_t decode_width (unsigned width) + { + return(zbar_decode_width(_decoder, width)); + } + + /// process next bar/space width from input stream. + /// see zbar_decode_width() + Decoder& operator<< (unsigned width) + { + zbar_decode_width(_decoder, width); + return(*this); + } + + /// retrieve color of @em next element passed to Decoder. + /// see zbar_decoder_get_color() + zbar_color_t get_color () const + { + return(zbar_decoder_get_color(_decoder)); + } + + /// retrieve last decoded symbol type. + /// see zbar_decoder_get_type() + zbar_symbol_type_t get_type () const + { + return(zbar_decoder_get_type(_decoder)); + } + + /// retrieve string name of last decoded symbol type. + /// see zbar_get_symbol_name() + const char *get_symbol_name () const + { + return(zbar_get_symbol_name(zbar_decoder_get_type(_decoder))); + } + + /// retrieve string name for last decode addon. + /// see zbar_get_addon_name() + /// @deprecated in 0.11 + const char *get_addon_name () const + { + return(zbar_get_addon_name(zbar_decoder_get_type(_decoder))); + } + + /// retrieve last decoded data in ASCII format as a char array. + /// see zbar_decoder_get_data() + const char *get_data_chars() const + { + return(zbar_decoder_get_data(_decoder)); + } + + /// retrieve last decoded data as a std::string. + /// see zbar_decoder_get_data() + const std::string get_data_string() const + { + return(std::string(zbar_decoder_get_data(_decoder), + zbar_decoder_get_data_length(_decoder))); + } + + /// retrieve last decoded data as a std::string. + /// see zbar_decoder_get_data() + const std::string get_data() const + { + return(get_data_string()); + } + + /// retrieve length of decoded binary data. + /// see zbar_decoder_get_data_length() + int get_data_length() const + { + return(zbar_decoder_get_data_length(_decoder)); + } + + /// retrieve last decode direction. + /// see zbar_decoder_get_direction() + /// @since 0.11 + int get_direction() const + { + return(zbar_decoder_get_direction(_decoder)); + } + + /// setup callback to handle result data. + void set_handler (Handler &handler) + { + _handler = &handler; + zbar_decoder_set_handler(_decoder, _cb); + zbar_decoder_set_userdata(_decoder, this); + } + + /// set config for indicated symbology (0 for all) to specified value. + /// @see zbar_decoder_set_config() + /// @since 0.4 + int set_config (zbar_symbol_type_t symbology, + zbar_config_t config, + int value) + { + return(zbar_decoder_set_config(_decoder, symbology, config, value)); + } + + /// set config parsed from configuration string. + /// @see zbar_decoder_parse_config() + /// @since 0.4 + int set_config (std::string cfgstr) + { + return(zbar_decoder_parse_config(_decoder, cfgstr.c_str())); + } + + private: + friend class Scanner; + zbar_decoder_t *_decoder; + Handler *_handler; + + static void _cb (zbar_decoder_t *cdcode) + { + Decoder *dcode = (Decoder*)zbar_decoder_get_userdata(cdcode); + if(dcode && dcode->_handler) + dcode->_handler->decode_callback(*dcode); + } +}; + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Exception.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Exception.h new file mode 100755 index 0000000..236622f --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Exception.h @@ -0,0 +1,187 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_EXCEPTION_H_ +#define _ZBAR_EXCEPTION_H_ + +/// @file +/// C++ Exception definitions + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Exception.h" +#endif + +#include +#include + +namespace zbar { + +/// base class for exceptions defined by this API. +class Exception : public std::exception { + +public: + /// create exception from C library error + Exception (const void *obj = NULL) + : std::exception(), + _obj(obj) + { } + + ~Exception () throw() { } + + /// retrieve error message + virtual const char* what () const throw() + { + if(!_obj) + return("zbar library unspecified generic error"); + return(_zbar_error_string(_obj, 0)); + } + +private: + const void *_obj; +}; + +/// internal library error. +class InternalError : public Exception { +public: + /// create exception from C library error + InternalError (const void *obj) + : Exception(obj) + { } +}; + +/// unsupported request. +class UnsupportedError : public Exception { +public: + /// create exception from C library error + UnsupportedError (const void *obj) + : Exception(obj) + { } +}; + +/// invalid request. +class InvalidError : public Exception { +public: + /// create exception from C library error + InvalidError (const void *obj) + : Exception(obj) + { } +}; + +/// failed system call. +class SystemError : public Exception { +public: + /// create exception from C library error + SystemError (const void *obj) + : Exception(obj) + { } +}; + +/// locking error. +class LockingError : public Exception { +public: + /// create exception from C library error + LockingError (const void *obj) + : Exception(obj) + { } +}; + +/// all resources busy. +class BusyError : public Exception { +public: + /// create exception from C library error + BusyError (const void *obj) + : Exception(obj) + { } +}; + +/// X11 display error. +class XDisplayError : public Exception { +public: + /// create exception from C library error + XDisplayError (const void *obj) + : Exception(obj) + { } +}; + +/// X11 protocol error. +class XProtoError : public Exception { +public: + /// create exception from C library error + XProtoError (const void *obj) + : Exception(obj) + { } +}; + +/// output window is closed. +class ClosedError : public Exception { +public: + /// create exception from C library error + ClosedError (const void *obj) + : Exception(obj) + { } +}; + +/// image format error +class FormatError : public Exception { + // FIXME needs c equivalent + + virtual const char* what () const throw() + { + // FIXME what format? + return("unsupported format"); + } +}; + +/// @internal + +/// extract error information and create exception. +static inline std::exception throw_exception (const void *obj) +{ + switch(_zbar_get_error_code(obj)) { + case ZBAR_ERR_NOMEM: + throw std::bad_alloc(); + case ZBAR_ERR_INTERNAL: + throw InternalError(obj); + case ZBAR_ERR_UNSUPPORTED: + throw UnsupportedError(obj); + case ZBAR_ERR_INVALID: + throw InvalidError(obj); + case ZBAR_ERR_SYSTEM: + throw SystemError(obj); + case ZBAR_ERR_LOCKING: + throw LockingError(obj); + case ZBAR_ERR_BUSY: + throw BusyError(obj); + case ZBAR_ERR_XDISPLAY: + throw XDisplayError(obj); + case ZBAR_ERR_XPROTO: + throw XProtoError(obj); + case ZBAR_ERR_CLOSED: + throw ClosedError(obj); + default: + throw Exception(obj); + } +} + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Image.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Image.h new file mode 100755 index 0000000..1a2af46 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Image.h @@ -0,0 +1,321 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_IMAGE_H_ +#define _ZBAR_IMAGE_H_ + +/// @file +/// Image C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Image.h" +#endif + +#include +#include +#include "Symbol.h" +#include "Exception.h" + +namespace zbar { + +class Video; + +/// stores image data samples along with associated format and size +/// metadata + +class Image { +public: + + /// general Image result handler. + /// applications should subtype this and pass an instance to + /// eg. ImageScanner::set_handler() to implement result processing + class Handler { + public: + virtual ~Handler() { } + + /// invoked by library when Image should be processed + virtual void image_callback(Image &image) = 0; + + /// cast this handler to the C handler + operator zbar_image_data_handler_t* () const + { + return(_cb); + } + + private: + static void _cb (zbar_image_t *zimg, + const void *userdata) + { + if(userdata) { + Image *image = (Image*)zbar_image_get_userdata(zimg); + if(image) + ((Handler*)userdata)->image_callback(*image); + else { + Image tmp(zimg, 1); + ((Handler*)userdata)->image_callback(tmp); + } + } + } + }; + + class SymbolIterator : public zbar::SymbolIterator { + public: + /// default constructor. + SymbolIterator () + : zbar::SymbolIterator() + { } + + /// constructor. + SymbolIterator (const SymbolSet &syms) + : zbar::SymbolIterator(syms) + { } + + /// copy constructor. + SymbolIterator (const SymbolIterator& iter) + : zbar::SymbolIterator(iter) + { } + }; + + /// constructor. + /// create a new Image with the specified parameters + Image (unsigned width = 0, + unsigned height = 0, + const std::string& format = "", + const void *data = NULL, + unsigned long length = 0) + : _img(zbar_image_create()) + { + zbar_image_set_userdata(_img, this); + if(width && height) + set_size(width, height); + if(format.length()) + set_format(format); + if(data && length) + set_data(data, length); + } + + ~Image () + { + set_data(NULL, 0); + zbar_image_set_userdata(_img, NULL); + zbar_image_ref(_img, -1); + } + + /// cast to C image object + operator const zbar_image_t* () const + { + return(_img); + } + + /// cast to C image object + operator zbar_image_t* () + { + return(_img); + } + + /// retrieve the image format. + /// see zbar_image_get_format() + unsigned long get_format () const + { + return(zbar_image_get_format(_img)); + } + + /// specify the fourcc image format code for image sample data. + /// see zbar_image_set_format() + void set_format (unsigned long format) + { + zbar_image_set_format(_img, format); + } + + /// specify the fourcc image format code for image sample data. + /// see zbar_image_set_format() + void set_format (const std::string& format) + { + unsigned long fourcc = zbar_fourcc_parse(format.c_str()); + zbar_image_set_format(_img, fourcc); + } + + /// retrieve a "sequence" (page/frame) number associated with this + /// image. + /// see zbar_image_get_sequence() + /// @since 0.6 + unsigned get_sequence () const + { + return(zbar_image_get_sequence(_img)); + } + + /// associate a "sequence" (page/frame) number with this image. + /// see zbar_image_set_sequence() + /// @since 0.6 + void set_sequence (unsigned sequence_num) + { + zbar_image_set_sequence(_img, sequence_num); + } + + /// retrieve the width of the image. + /// see zbar_image_get_width() + unsigned get_width () const + { + return(zbar_image_get_width(_img)); + } + + /// retrieve the height of the image. + /// see zbar_image_get_height() + unsigned get_height () const + { + return(zbar_image_get_height(_img)); + } + + /// retrieve both dimensions of the image. + /// see zbar_image_get_size() + /// @since 0.11 + void get_size (unsigned &width, + unsigned &height) const + { + zbar_image_get_size(_img, &width, &height); + } + + /// specify the pixel size of the image. + /// see zbar_image_set_size() + void set_size (unsigned width, + unsigned height) + { + zbar_image_set_size(_img, width, height); + } + + /// retrieve the scan crop rectangle. + /// see zbar_image_get_crop() + void get_crop (unsigned &x, + unsigned &y, + unsigned &width, + unsigned &height) const + { + zbar_image_get_crop(_img, &x, &y, &width, &height); + } + + /// set the scan crop rectangle. + /// see zbar_image_set_crop() + void set_crop (unsigned x, + unsigned y, + unsigned width, + unsigned height) + { + zbar_image_set_crop(_img, x, y, width, height); + } + + /// return the image sample data. + /// see zbar_image_get_data() + const void *get_data () const + { + return(zbar_image_get_data(_img)); + } + + /// return the size of the image sample data. + /// see zbar_image_get_data_length() + /// @since 0.6 + unsigned long get_data_length () const + { + return(zbar_image_get_data_length(_img)); + } + + /// specify image sample data. + /// see zbar_image_set_data() + void set_data (const void *data, + unsigned long length) + { + zbar_image_set_data(_img, data, length, _cleanup); + } + + /// image format conversion. + /// see zbar_image_convert() + Image convert (unsigned long format) const + { + zbar_image_t *img = zbar_image_convert(_img, format); + if(img) + return(Image(img)); + throw FormatError(); + } + + /// image format conversion with crop/pad. + /// see zbar_image_convert_resize() + /// @since 0.4 + Image convert (unsigned long format, + unsigned width, + unsigned height) const + { + zbar_image_t *img = + zbar_image_convert_resize(_img, format, width, height); + if(img) + return(Image(img)); + throw FormatError(); + } + + const SymbolSet get_symbols () const { + return(SymbolSet(zbar_image_get_symbols(_img))); + } + + void set_symbols (const SymbolSet &syms) { + zbar_image_set_symbols(_img, syms); + } + + /// create a new SymbolIterator over decoded results. + SymbolIterator symbol_begin () const { + return(SymbolIterator(get_symbols())); + } + + /// return a SymbolIterator suitable for ending iteration. + SymbolIterator symbol_end () const { + return(SymbolIterator()); + } + +protected: + + friend class Video; + + /// constructor. + /// @internal + /// create a new Image from a zbar_image_t C object + Image (zbar_image_t *src, + int refs = 0) + : _img(src) + { + if(refs) + zbar_image_ref(_img, refs); + zbar_image_set_userdata(_img, this); + } + + /// default data cleanup (noop) + /// @internal + static void _cleanup (zbar_image_t *img) + { + // by default nothing is cleaned + assert(img); + assert(zbar_image_get_userdata(img)); + } + +private: + zbar_image_t *_img; +}; + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/ImageScanner.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/ImageScanner.h new file mode 100755 index 0000000..bda8433 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/ImageScanner.h @@ -0,0 +1,130 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_IMAGE_SCANNER_H_ +#define _ZBAR_IMAGE_SCANNER_H_ + +/// @file +/// Image Scanner C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/ImageScanner.h" +#endif + +#include "Image.h" + +namespace zbar { + +/// mid-level image scanner interface. +/// reads barcodes from a 2-D Image + +class ImageScanner { +public: + /// constructor. + ImageScanner (zbar_image_scanner_t *scanner = NULL) + { + if(scanner) + _scanner = scanner; + else + _scanner = zbar_image_scanner_create(); + } + + ~ImageScanner () + { + zbar_image_scanner_destroy(_scanner); + } + + /// cast to C image_scanner object + operator zbar_image_scanner_t* () const + { + return(_scanner); + } + + /// setup result handler callback. + void set_handler (Image::Handler &handler) + { + zbar_image_scanner_set_data_handler(_scanner, handler, &handler); + } + + /// set config for indicated symbology (0 for all) to specified value. + /// @see zbar_image_scanner_set_config() + /// @since 0.4 + int set_config (zbar_symbol_type_t symbology, + zbar_config_t config, + int value) + { + return(zbar_image_scanner_set_config(_scanner, symbology, + config, value)); + } + + /// set config parsed from configuration string. + /// @see zbar_image_scanner_parse_config() + /// @since 0.4 + int set_config (std::string cfgstr) + { + return(zbar_image_scanner_parse_config(_scanner, cfgstr.c_str())); + } + + /// enable or disable the inter-image result cache. + /// see zbar_image_scanner_enable_cache() + void enable_cache (bool enable = true) + { + zbar_image_scanner_enable_cache(_scanner, enable); + } + + /// remove previous results from scanner and image. + /// @see zbar_image_scanner_recycle_image() + /// @since 0.10 + void recycle_image (Image &image) + { + zbar_image_scanner_recycle_image(_scanner, image); + } + + /// retrieve decode results for last scanned image. + /// @see zbar_image_scanner_get_results() + /// @since 0.10 + const SymbolSet get_results () const { + return(SymbolSet(zbar_image_scanner_get_results(_scanner))); + } + + /// scan for symbols in provided image. + /// see zbar_scan_image() + int scan (Image& image) + { + return(zbar_scan_image(_scanner, image)); + } + + /// scan for symbols in provided image. + /// see zbar_scan_image() + ImageScanner& operator<< (Image& image) + { + scan(image); + return(*this); + } + +private: + zbar_image_scanner_t *_scanner; +}; + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Processor.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Processor.h new file mode 100755 index 0000000..2622ee8 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Processor.h @@ -0,0 +1,223 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_PROCESSOR_H_ +#define _ZBAR_PROCESSOR_H_ + +/// @file +/// Processor C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Processor.h" +#endif + +#include "Exception.h" +#include "Image.h" + +namespace zbar { + +/// high-level self-contained image processor. +/// processes video and images for barcodes, optionally displaying +/// images to a library owned output window + +class Processor { + public: + /// value to pass for no timeout. + static const int FOREVER = -1; + + /// constructor. + Processor (bool threaded = true, + const char *video_device = "", + bool enable_display = true) + { + _processor = zbar_processor_create(threaded); + if(!_processor) + throw std::bad_alloc(); + init(video_device, enable_display); + } + + ~Processor () + { + zbar_processor_destroy(_processor); + } + + /// cast to C processor object. + operator zbar_processor_t* () + { + return(_processor); + } + + /// opens a video input device and/or prepares to display output. + /// see zbar_processor_init() + void init (const char *video_device = "", + bool enable_display = true) + { + if(zbar_processor_init(_processor, video_device, enable_display)) + throw_exception(_processor); + } + + /// setup result handler callback. + /// see zbar_processor_set_data_handler() + void set_handler (Image::Handler& handler) + { + zbar_processor_set_data_handler(_processor, handler, &handler); + } + + /// set config for indicated symbology (0 for all) to specified value. + /// @see zbar_processor_set_config() + /// @since 0.4 + int set_config (zbar_symbol_type_t symbology, + zbar_config_t config, + int value) + { + return(zbar_processor_set_config(_processor, symbology, + config, value)); + } + + /// set config parsed from configuration string. + /// @see zbar_processor_parse_config() + /// @since 0.4 + int set_config (std::string cfgstr) + { + return(zbar_processor_parse_config(_processor, cfgstr.c_str())); + } + + /// retrieve the current state of the ouput window. + /// see zbar_processor_is_visible() + bool is_visible () + { + int rc = zbar_processor_is_visible(_processor); + if(rc < 0) + throw_exception(_processor); + return(rc != 0); + } + + /// show or hide the display window owned by the library. + /// see zbar_processor_set_visible() + void set_visible (bool visible = true) + { + if(zbar_processor_set_visible(_processor, visible) < 0) + throw_exception(_processor); + } + + /// control the processor in free running video mode. + /// see zbar_processor_set_active() + void set_active (bool active = true) + { + if(zbar_processor_set_active(_processor, active) < 0) + throw_exception(_processor); + } + + /// retrieve decode results for last scanned image. + /// @see zbar_processor_get_results() + /// @since 0.10 + const SymbolSet get_results () const { + return(SymbolSet(zbar_processor_get_results(_processor))); + } + + /// wait for input to the display window from the user. + /// see zbar_processor_user_wait() + int user_wait (int timeout = FOREVER) + { + int rc = zbar_processor_user_wait(_processor, timeout); + if(rc < 0) + throw_exception(_processor); + return(rc); + } + + /// process from the video stream until a result is available. + /// see zbar_process_one() + void process_one (int timeout = FOREVER) + { + if(zbar_process_one(_processor, timeout) < 0) + throw_exception(_processor); + } + + /// process the provided image for barcodes. + /// see zbar_process_image() + void process_image (Image& image) + { + if(zbar_process_image(_processor, image) < 0) + throw_exception(_processor); + } + + /// process the provided image for barcodes. + /// see zbar_process_image() + Processor& operator<< (Image& image) + { + process_image(image); + return(*this); + } + + /// force specific input and output formats for debug/testing. + /// see zbar_processor_force_format() + void force_format (unsigned long input_format, + unsigned long output_format) + { + if(zbar_processor_force_format(_processor, input_format, + output_format)) + throw_exception(_processor); + } + + /// force specific input and output formats for debug/testing. + /// see zbar_processor_force_format() + void force_format (std::string& input_format, + std::string& output_format) + { + unsigned long ifourcc = zbar_fourcc_parse(input_format.c_str()); + unsigned long ofourcc = zbar_fourcc_parse(output_format.c_str()); + if(zbar_processor_force_format(_processor, ifourcc, ofourcc)) + throw_exception(_processor); + } + + /// request a preferred size for the video image from the device. + /// see zbar_processor_request_size() + /// @since 0.6 + void request_size (int width, int height) + { + zbar_processor_request_size(_processor, width, height); + } + + /// request a preferred driver interface version for debug/testing. + /// see zbar_processor_request_interface() + /// @since 0.6 + void request_interface (int version) + { + zbar_processor_request_interface(_processor, version); + } + + /// request a preferred I/O mode for debug/testing. + /// see zbar_processor_request_iomode() + /// @since 0.7 + void request_iomode (int iomode) + { + if(zbar_processor_request_iomode(_processor, iomode)) + throw_exception(_processor); + } + + private: + zbar_processor_t *_processor; +}; + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Scanner.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Scanner.h new file mode 100755 index 0000000..8c9a756 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Scanner.h @@ -0,0 +1,162 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_SCANNER_H_ +#define _ZBAR_SCANNER_H_ + +/// @file +/// Scanner C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Scanner.h" +#endif + +#include + +namespace zbar { + +/// low-level linear intensity sample stream scanner interface. +/// identifies "bar" edges and measures width between them. +/// optionally passes to bar width Decoder + +class Scanner { + public: + + /// constructor. + /// @param decoder reference to a Decoder instance which will + /// be passed scan results automatically + Scanner (Decoder& decoder) + { + _scanner = zbar_scanner_create(decoder._decoder); + } + + /// constructor. + /// @param decoder pointer to a Decoder instance which will + /// be passed scan results automatically + Scanner (Decoder* decoder = NULL) + { + zbar_decoder_t *zdcode = NULL; + if(decoder) + zdcode = decoder->_decoder; + _scanner = zbar_scanner_create(zdcode); + } + + ~Scanner () + { + zbar_scanner_destroy(_scanner); + } + + /// clear all scanner state. + /// see zbar_scanner_reset() + void reset () + { + zbar_scanner_reset(_scanner); + } + + /// mark start of a new scan pass. + /// see zbar_scanner_new_scan() + zbar_symbol_type_t new_scan () + { + _type = zbar_scanner_new_scan(_scanner); + return(_type); + } + + /// flush scanner pipeline. + /// see zbar_scanner_flush() + zbar_symbol_type_t flush () + { + _type = zbar_scanner_flush(_scanner); + return(_type); + } + + /// process next sample intensity value. + /// see zbar_scan_y() + zbar_symbol_type_t scan_y (int y) + { + _type = zbar_scan_y(_scanner, y); + return(_type); + } + + /// process next sample intensity value. + /// see zbar_scan_y() + Scanner& operator<< (int y) + { + _type = zbar_scan_y(_scanner, y); + return(*this); + } + + /// process next sample from RGB (or BGR) triple. + /// see zbar_scan_rgb24() + zbar_symbol_type_t scan_rgb24 (unsigned char *rgb) + { + _type = zbar_scan_rgb24(_scanner, rgb); + return(_type); + } + + /// process next sample from RGB (or BGR) triple. + /// see zbar_scan_rgb24() + Scanner& operator<< (unsigned char *rgb) + { + _type = zbar_scan_rgb24(_scanner, rgb); + return(*this); + } + + /// retrieve last scanned width. + /// see zbar_scanner_get_width() + unsigned get_width () const + { + return(zbar_scanner_get_width(_scanner)); + } + + /// retrieve last scanned color. + /// see zbar_scanner_get_color() + zbar_color_t get_color () const + { + return(zbar_scanner_get_color(_scanner)); + } + + /// retrieve last scan result. + zbar_symbol_type_t get_type () const + { + return(_type); + } + + /// cast to C scanner + operator zbar_scanner_t* () const + { + return(_scanner); + } + + /// retrieve C scanner + const zbar_scanner_t *get_c_scanner () const + { + return(_scanner); + } + + private: + zbar_scanner_t *_scanner; + zbar_symbol_type_t _type; +}; + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Symbol.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Symbol.h new file mode 100755 index 0000000..a094222 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Symbol.h @@ -0,0 +1,528 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_SYMBOL_H_ +#define _ZBAR_SYMBOL_H_ + +/// @file +/// Symbol C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Symbol.h" +#endif + +#include +#include +#include +#include + +namespace zbar { + +class SymbolIterator; + +/// container for decoded result symbols associated with an image +/// or a composite symbol. + +class SymbolSet { +public: + /// constructor. + SymbolSet (const zbar_symbol_set_t *syms = NULL) + : _syms(syms) + { + ref(); + } + + /// copy constructor. + SymbolSet (const SymbolSet& syms) + : _syms(syms._syms) + { + ref(); + } + + /// destructor. + ~SymbolSet () + { + ref(-1); + } + + /// assignment. + SymbolSet& operator= (const SymbolSet& syms) + { + syms.ref(); + ref(-1); + _syms = syms._syms; + return(*this); + } + + /// truth testing. + bool operator! () const + { + return(!_syms || !get_size()); + } + + /// manipulate reference count. + void ref (int delta = 1) const + { + if(_syms) + zbar_symbol_set_ref((zbar_symbol_set_t*)_syms, delta); + } + + /// cast to C symbol set. + operator const zbar_symbol_set_t* () const + { + return(_syms); + } + + int get_size () const + { + return((_syms) ? zbar_symbol_set_get_size(_syms) : 0); + } + + /// create a new SymbolIterator over decoded results. + SymbolIterator symbol_begin() const; + + /// return a SymbolIterator suitable for ending iteration. + const SymbolIterator symbol_end() const; + +private: + const zbar_symbol_set_t *_syms; +}; + +/// decoded barcode symbol result object. stores type, data, and +/// image location of decoded symbol + +class Symbol { +public: + + /// image pixel location (x, y) coordinate tuple. + class Point { + public: + int x; ///< x-coordinate. + int y; ///< y-coordinate. + + Point () { } + + Point(int x, int y) + : x(x), y(y) + { } + + /// copy constructor. + Point (const Point& pt) + : x(pt.x), + y(pt.y) + { } + + /// assignment. + Point& operator= (const Point& pt) + { + x = pt.x; + y = pt.y; + return(*this); + } + }; + + /// iteration over Point objects in a symbol location polygon. + class PointIterator + : public std::iterator { + + public: + /// constructor. + PointIterator (const Symbol *sym = NULL, + int index = 0) + : _sym(sym), + _index(index) + { + sym->ref(1); + if(!sym || + (unsigned)_index >= zbar_symbol_get_loc_size(*_sym)) + _index = -1; + } + + /// copy constructor. + PointIterator (const PointIterator& iter) + : _sym(iter._sym), + _index(iter._index) + { + _sym->ref(); + } + + /// destructor. + ~PointIterator () + { + _sym->ref(-1); + } + + /// assignment. + PointIterator& operator= (const PointIterator& iter) + { + iter._sym->ref(); + _sym->ref(-1); + _sym = iter._sym; + _index = iter._index; + return(*this); + } + + /// truth testing. + bool operator! () const + { + return(!_sym || _index < 0); + } + + /// advance iterator to next Point. + PointIterator& operator++ () + { + unsigned int i = ++_index; + if(i >= zbar_symbol_get_loc_size(*_sym)) + _index = -1; + return(*this); + } + + /// retrieve currently referenced Point. + const Point operator* () const + { + assert(!!*this); + if(!*this) + return(Point()); + return(Point(zbar_symbol_get_loc_x(*_sym, _index), + zbar_symbol_get_loc_y(*_sym, _index))); + } + + /// test if two iterators refer to the same Point in the same + /// Symbol. + bool operator== (const PointIterator& iter) const + { + return(_index == iter._index && + ((_index < 0) || _sym == iter._sym)); + } + + /// test if two iterators refer to the same Point in the same + /// Symbol. + bool operator!= (const PointIterator& iter) const + { + return(!(*this == iter)); + } + + private: + const Symbol *_sym; + int _index; + }; + + /// constructor. + Symbol (const zbar_symbol_t *sym = NULL) + : _xmlbuf(NULL), + _xmllen(0) + { + init(sym); + ref(); + } + + /// copy constructor. + Symbol (const Symbol& sym) + : _sym(sym._sym), + _type(sym._type), + _data(sym._data), + _xmlbuf(NULL), + _xmllen(0) + { + ref(); + } + + /// destructor. + ~Symbol () { + if(_xmlbuf) + free(_xmlbuf); + ref(-1); + } + + /// assignment. + Symbol& operator= (const Symbol& sym) + { + sym.ref(1); + ref(-1); + _sym = sym._sym; + _type = sym._type; + _data = sym._data; + return(*this); + } + + Symbol& operator= (const zbar_symbol_t *sym) + { + if(sym) + zbar_symbol_ref(sym, 1); + ref(-1); + init(sym); + return(*this); + } + + /// truth testing. + bool operator! () const + { + return(!_sym); + } + + void ref (int delta = 1) const + { + if(_sym) + zbar_symbol_ref((zbar_symbol_t*)_sym, delta); + } + + /// cast to C symbol. + operator const zbar_symbol_t* () const + { + return(_sym); + } + + /// test if two Symbol objects refer to the same C symbol. + bool operator== (const Symbol& sym) const + { + return(_sym == sym._sym); + } + + /// test if two Symbol objects refer to the same C symbol. + bool operator!= (const Symbol& sym) const + { + return(!(*this == sym)); + } + + /// retrieve type of decoded symbol. + zbar_symbol_type_t get_type () const + { + return(_type); + } + + /// retrieve the string name of the symbol type. + const std::string get_type_name () const + { + return(zbar_get_symbol_name(_type)); + } + + /// retrieve the string name for any addon. + /// @deprecated in 0.11 + const std::string get_addon_name () const + { + return(zbar_get_addon_name(_type)); + } + + /// retrieve data decoded from symbol. + const std::string get_data () const + { + return(_data); + } + + /// retrieve length of binary data + unsigned get_data_length () const + { + return((_sym) ? zbar_symbol_get_data_length(_sym) : 0); + } + + /// retrieve inter-frame coherency count. + /// see zbar_symbol_get_count() + /// @since 1.5 + int get_count () const + { + return((_sym) ? zbar_symbol_get_count(_sym) : -1); + } + + SymbolSet get_components () const + { + return(SymbolSet((_sym) ? zbar_symbol_get_components(_sym) : NULL)); + } + + /// create a new PointIterator at the start of the location + /// polygon. + PointIterator point_begin() const + { + return(PointIterator(this)); + } + + /// return a PointIterator suitable for ending iteration. + const PointIterator point_end() const + { + return(PointIterator()); + } + + /// see zbar_symbol_get_loc_size(). + int get_location_size () const + { + return((_sym) ? zbar_symbol_get_loc_size(_sym) : 0); + } + + /// see zbar_symbol_get_loc_x(). + int get_location_x (unsigned index) const + { + return((_sym) ? zbar_symbol_get_loc_x(_sym, index) : -1); + } + + /// see zbar_symbol_get_loc_y(). + int get_location_y (unsigned index) const + { + return((_sym) ? zbar_symbol_get_loc_y(_sym, index) : -1); + } + + /// see zbar_symbol_get_orientation(). + /// @since 0.11 + int get_orientation () const + { + return(zbar_symbol_get_orientation(_sym)); + } + + /// see zbar_symbol_xml(). + const std::string xml () const + { + if(!_sym) + return(""); + return(zbar_symbol_xml(_sym, (char**)&_xmlbuf, (unsigned*)&_xmllen)); + } + +protected: + /// (re)initialize Symbol from C symbol object. + void init (const zbar_symbol_t *sym = NULL) + { + _sym = sym; + if(sym) { + _type = zbar_symbol_get_type(sym); + _data = std::string(zbar_symbol_get_data(sym), + zbar_symbol_get_data_length(sym)); + } + else { + _type = ZBAR_NONE; + _data = ""; + } + } + +private: + const zbar_symbol_t *_sym; + zbar_symbol_type_t _type; + std::string _data; + char *_xmlbuf; + unsigned _xmllen; +}; + +/// iteration over Symbol result objects in a scanned Image or SymbolSet. +class SymbolIterator + : public std::iterator { + +public: + /// default constructor. + SymbolIterator () + { } + + /// constructor. + SymbolIterator (const SymbolSet &syms) + : _syms(syms) + { + const zbar_symbol_set_t *zsyms = _syms; + if(zsyms) + _sym = zbar_symbol_set_first_symbol(zsyms); + } + + /// copy constructor. + SymbolIterator (const SymbolIterator& iter) + : _syms(iter._syms) + { + const zbar_symbol_set_t *zsyms = _syms; + if(zsyms) + _sym = zbar_symbol_set_first_symbol(zsyms); + } + + ~SymbolIterator () + { + } + + /// assignment. + SymbolIterator& operator= (const SymbolIterator& iter) + { + _syms = iter._syms; + _sym = iter._sym; + return(*this); + } + + bool operator! () const + { + return(!_syms || !_sym); + } + + /// advance iterator to next Symbol. + SymbolIterator& operator++ () + { + if(!!_sym) + _sym = zbar_symbol_next(_sym); + else if(!!_syms) + _sym = zbar_symbol_set_first_symbol(_syms); + return(*this); + } + + /// retrieve currently referenced Symbol. + const Symbol operator* () const + { + return(_sym); + } + + /// access currently referenced Symbol. + const Symbol* operator-> () const + { + return(&_sym); + } + + /// test if two iterators refer to the same Symbol + bool operator== (const SymbolIterator& iter) const + { + // it is enough to test the symbols, as they belong + // to only one set (also simplifies invalid case) + return(_sym == iter._sym); + } + + /// test if two iterators refer to the same Symbol + bool operator!= (const SymbolIterator& iter) const + { + return(!(*this == iter)); + } + + const SymbolIterator end () const { + return(SymbolIterator()); + } + +private: + SymbolSet _syms; + Symbol _sym; +}; + +inline SymbolIterator SymbolSet::symbol_begin () const { + return(SymbolIterator(*this)); +} + +inline const SymbolIterator SymbolSet::symbol_end () const { + return(SymbolIterator()); +} + +/// @relates Symbol +/// stream the string representation of a Symbol. +static inline std::ostream& operator<< (std::ostream& out, + const Symbol& sym) +{ + out << sym.get_type_name() << ":" << sym.get_data(); + return(out); +} + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Video.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Video.h new file mode 100755 index 0000000..61a49f1 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Video.h @@ -0,0 +1,170 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2010 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_VIDEO_H_ +#define _ZBAR_VIDEO_H_ + +/// @file +/// Video Input C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Video.h" +#endif + +#include "Image.h" + +namespace zbar { + +/// mid-level video source abstraction. +/// captures images from a video device + +class Video { +public: + /// constructor. + Video (zbar_video_t *video = NULL) + { + if(video) + _video = video; + else + _video = zbar_video_create(); + } + + /// constructor. + Video (std::string& device) + { + _video = zbar_video_create(); + open(device); + } + + ~Video () + { + zbar_video_destroy(_video); + } + + /// cast to C video object. + operator zbar_video_t* () const + { + return(_video); + } + + /// open and probe a video device. + void open (std::string& device) + { + if(zbar_video_open(_video, device.c_str())) + throw_exception(_video); + } + + /// close video device if open. + void close () + { + if(zbar_video_open(_video, NULL)) + throw_exception(_video); + } + + /// initialize video using a specific format for debug. + /// see zbar_video_init() + void init (unsigned long fourcc) + { + if(zbar_video_init(_video, fourcc)) + throw_exception(_video); + } + + /// initialize video using a specific format for debug. + /// see zbar_video_init() + void init (std::string& format) + { + unsigned int fourcc = zbar_fourcc_parse(format.c_str()); + if(zbar_video_init(_video, fourcc)) + throw_exception(_video); + } + + /// retrieve file descriptor associated with open *nix video device. + /// see zbar_video_get_fd() + int get_fd () + { + return(zbar_video_get_fd(_video)); + } + + /// retrieve current output image width. + /// see zbar_video_get_width() + int get_width () + { + return(zbar_video_get_width(_video)); + } + + /// retrieve current output image height. + /// see zbar_video_get_height() + int get_height () + { + return(zbar_video_get_height(_video)); + } + + /// start/stop video capture. + /// see zbar_video_enable() + void enable (bool enable = true) + { + if(zbar_video_enable(_video, enable)) + throw_exception(_video); + } + + /// retrieve next captured image. + /// see zbar_video_next_image() + Image next_image () + { + zbar_image_t *img = zbar_video_next_image(_video); + if(!img) + throw_exception(_video); + return(Image(img)); + } + + /// request a preferred size for the video image from the device. + /// see zbar_video_request_size() + /// @since 0.6 + void request_size (int width, int height) + { + zbar_video_request_size(_video, width, height); + } + + /// request a preferred driver interface version for debug/testing. + /// see zbar_video_request_interface() + /// @since 0.6 + void request_interface (int version) + { + zbar_video_request_interface(_video, version); + } + + /// request a preferred I/O mode for debug/testing. + /// see zbar_video_request_iomode() + /// @since 0.7 + void request_iomode (int iomode) + { + if(zbar_video_request_iomode(_video, iomode)) + throw_exception(_video); + } + +private: + zbar_video_t *_video; +}; + +} + +#endif diff --git a/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Window.h b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Window.h new file mode 100755 index 0000000..c91a405 --- /dev/null +++ b/ios/ZBarSDK_old/Headers/ZBarSDK/zbar/Window.h @@ -0,0 +1,136 @@ +//------------------------------------------------------------------------ +// Copyright 2007-2009 (c) Jeff Brown +// +// This file is part of the ZBar Bar Code Reader. +// +// The ZBar Bar Code Reader is free software; you can redistribute it +// and/or modify it under the terms of the GNU Lesser Public License as +// published by the Free Software Foundation; either version 2.1 of +// the License, or (at your option) any later version. +// +// The ZBar Bar Code Reader is distributed in the hope that it will be +// useful, but WITHOUT ANY WARRANTY; without even the implied warranty +// of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +// GNU Lesser Public License for more details. +// +// You should have received a copy of the GNU Lesser Public License +// along with the ZBar Bar Code Reader; if not, write to the Free +// Software Foundation, Inc., 51 Franklin St, Fifth Floor, +// Boston, MA 02110-1301 USA +// +// http://sourceforge.net/projects/zbar +//------------------------------------------------------------------------ +#ifndef _ZBAR_WINDOW_H_ +#define _ZBAR_WINDOW_H_ + +/// @file +/// Output Window C++ wrapper + +#ifndef _ZBAR_H_ +# error "include zbar.h in your application, **not** zbar/Window.h" +#endif + +#include "Image.h" + +namespace zbar { + +/// mid-level output window abstraction. +/// displays images to user-specified platform specific output window + +class Window { +public: + /// constructor. + Window (zbar_window_t *window = NULL) + { + if(window) + _window = window; + else + _window = zbar_window_create(); + } + + /// constructor. + Window (void *x11_display_w32_hwnd, + unsigned long x11_drawable) + { + _window = zbar_window_create(); + attach(x11_display_w32_hwnd, x11_drawable); + } + + ~Window () + { + zbar_window_destroy(_window); + } + + /// cast to C window object. + operator zbar_window_t* () const + { + return(_window); + } + + /// associate reader with an existing platform window. + /// see zbar_window_attach() + void attach (void *x11_display_w32_hwnd, + unsigned long x11_drawable = 0) + { + if(zbar_window_attach(_window, + x11_display_w32_hwnd, x11_drawable) < 0) + throw_exception(_window); + } + + /// control content level of the reader overlay. + /// see zbar_window_set_overlay() + void set_overlay (int level) + { + zbar_window_set_overlay(_window, level); + } + + /// retrieve current content level of reader overlay. + /// see zbar_window_get_overlay() + + /// draw a new image into the output window. + /// see zbar_window_draw() + void draw (Image& image) + { + if(zbar_window_draw(_window, image) < 0) + throw_exception(_window); + } + + /// clear the image from the output window. + /// see zbar_window_draw() + void clear () + { + if(zbar_window_draw(_window, NULL) < 0) + throw_exception(_window); + } + + /// redraw the last image. + /// zbar_window_redraw() + void redraw () + { + if(zbar_window_redraw(_window) < 0) + throw_exception(_window); + } + + /// resize the image window. + /// zbar_window_resize() + void resize (unsigned width, unsigned height) + { + if(zbar_window_resize(_window, width, height) < 0) + throw_exception(_window); + } + +private: + zbar_window_t *_window; +}; + +/// select a compatible format between video input and output window. +/// see zbar_negotiate_format() +static inline void negotiate_format (Video& video, Window& window) +{ + if(zbar_negotiate_format(video, window) < 0) + throw_exception(video); +} + +} + +#endif diff --git a/ios/ZBarSDK_old/Resources/zbar-back.png b/ios/ZBarSDK_old/Resources/zbar-back.png new file mode 100755 index 0000000..6a0681d Binary files /dev/null and b/ios/ZBarSDK_old/Resources/zbar-back.png differ diff --git a/ios/ZBarSDK_old/Resources/zbar-help.html b/ios/ZBarSDK_old/Resources/zbar-help.html new file mode 100755 index 0000000..72d209c --- /dev/null +++ b/ios/ZBarSDK_old/Resources/zbar-help.html @@ -0,0 +1,88 @@ + + + + + +Barcode Reader Help + + + +

Barcode Reader Help

+
+

Recognized barcodes should look like

+ +
+ +

QR Codes

+
+

Also recognized, but not shown: +Code 128, +DataBar (RSS), +Code 93, +Code 39 and +Interleaved 2 of 5

+
+

Hints for successful scanning

+
+
+

Ensure there is plenty of

+

Light

+
+
+
4"
+

Distance

+

should be about 3 to 5 inches

+
+
+
+

Shake

+

to force the camera to focus

+
+
+
+

Wait

+

for the autofocus to finish

+
+
+
+

Hold Still

+

while the barcode is scanned

+
+ + + diff --git a/ios/ZBarSDK_old/Resources/zbar-helpicons.png b/ios/ZBarSDK_old/Resources/zbar-helpicons.png new file mode 100755 index 0000000..2a07e7c Binary files /dev/null and b/ios/ZBarSDK_old/Resources/zbar-helpicons.png differ diff --git a/ios/ZBarSDK_old/Resources/zbar-samples.png b/ios/ZBarSDK_old/Resources/zbar-samples.png new file mode 100755 index 0000000..7c805e2 Binary files /dev/null and b/ios/ZBarSDK_old/Resources/zbar-samples.png differ diff --git a/ios/ZBarSDK_old/libzbar.a b/ios/ZBarSDK_old/libzbar.a new file mode 100755 index 0000000..dd4e79c Binary files /dev/null and b/ios/ZBarSDK_old/libzbar.a differ diff --git a/lib/common.dart b/lib/common.dart index a04ae94..d7c46ff 100644 --- a/lib/common.dart +++ b/lib/common.dart @@ -7,6 +7,7 @@ import 'package:flutter/services.dart'; import 'package:intl/intl.dart'; import 'db.dart'; +import 'dart:convert'; import 'network.dart'; import 'resources.dart'; import 'strings.dart'; @@ -16,23 +17,25 @@ const platform = const MethodChannel('com.dinect.checker/instance_id'); // Метод обеспечивает замену текущего объекта route новым. pushRouteReplacement(BuildContext context, Widget widget) { - var route = new MaterialPageRoute(builder: (BuildContext context) => widget); + var route = + new MaterialPageRoute(builder: (BuildContext context) => widget); Navigator.of(context).pushReplacement(route); } pushRoute(BuildContext context, Widget widget) { - var route = new MaterialPageRoute(builder: (BuildContext context) => widget); + var route = + new MaterialPageRoute(builder: (BuildContext context) => widget); Navigator.of(context).push(route); } // Добавление route, с возможностью вернуться к предыдущему экрану. -faq(SqliteHelper helper, String app, BuildContext context, bool returnToScanner) { +faq(SqliteHelper helper, String app, BuildContext context, + bool returnToScanner) { pushRoute(context, new FAQScreen(helper, app, returnToScanner)); } // В методе отправляется запрос на удаление токена кассы, очищаются SharedPreferences приложения. logout(BuildContext context, SqliteHelper helper) async { - String token = await helper.getToken(); // String locale = await helper.getLocale(); @@ -41,9 +44,10 @@ logout(BuildContext context, SqliteHelper helper) async { getDeleteTokenRequest(token).then((response) { helper.clear().then((result) { // helper.close().then((_) { - Navigator.of(context).pop(); - Navigator.of(context).pop(); - pushRouteReplacement(context, new SplashScreen()); // Запускаем регистрацию + Navigator.of(context).pop(); + Navigator.of(context).pop(); + pushRouteReplacement( + context, new SplashScreen()); // Запускаем регистрацию // }); }); }).catchError((error) { @@ -55,19 +59,20 @@ logout(BuildContext context, SqliteHelper helper) async { } }; - showYesNoDialog(context, StringsLocalization.confirmation(), StringsLocalization.askChangeStore(), positiveCallback); + showYesNoDialog(context, StringsLocalization.confirmation(), + StringsLocalization.askChangeStore(), positiveCallback); } -forceLogout(String token , BuildContext context) async { +forceLogout(String token, BuildContext context) async { getDeleteTokenRequest(token).then((response) { SqliteHelper helper = new SqliteHelper(); helper.open().then((_) { helper.clear().then((_) { // helper.close().then((_) { - while (Navigator.of(context).canPop()) { - Navigator.of(context).pop(); - } - pushRouteReplacement(context, new SplashScreen()); + while (Navigator.of(context).canPop()) { + Navigator.of(context).pop(); + } + pushRouteReplacement(context, new SplashScreen()); // }); }); }); @@ -90,25 +95,58 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async { // Могут быть вызваны либо logout либо faq, либо purchase. if (token != null) { platform.setMethodCallHandler((MethodCall call) async { + print('flutter handler'); + print(call.method); + if (call.method == 'logout') { forceLogout(token, context); + } else if (call.method == 'findUserAndPurchase') { + + var userResponse; + try { + userResponse = await getUserByCard(call.arguments[0],token); + } catch (error) { + print(error.toString()); + } + + List users; + + + try{ + users = JSON.decode(userResponse.body); + } catch (error) { + print(error); + } + + print(users.length); + + if (users.length > 0) { + String userString = '${users[0]['first_name']} ${users[0]['last_name']}'; + String card = users[0]['card']; + print(userString); + print(card); + pushRoute(context, new PurchaseScreen(helper, app, JSON.encode(users[0]), card)); +// var route = new MaterialPageRoute( +// builder: (BuildContext context) => +// new PurchaseScreen(helper, app,)); +// while (Navigator.of(context).canPop()) { +// Navigator.of(context).pop(); +// } +// Navigator.of(context).pushReplacement(route); + } + + } else if (call.method == 'faq') { faq(helper, app, context, true); - } else if(call.method == 'settings') { - if (helper == null) { - helper = new SqliteHelper(); - helper.open().then((_) { - pushRoute(context, new SettingsScreen(helper, app, true)); - }); - } else { - pushRoute(context, new SettingsScreen(helper, app, true)); - } + } else if (call.method == 'settings') { + pushRoute(context, new SettingsScreen(helper, app, true)); } else { String userString = call.arguments[0]; + print(userString); String card = call.arguments[1]; var route = new MaterialPageRoute( builder: (BuildContext context) => - new PurchaseScreen(helper, app, userString, card)); + new PurchaseScreen(helper, app, userString, card)); while (Navigator.of(context).canPop()) { Navigator.of(context).pop(); } @@ -116,56 +154,61 @@ startScanner(BuildContext context, String app, SqliteHelper helper) async { } }); -// helper.close().then((_){ -// helper = null; - platform.invokeMethod('getEndpoint').then((endpoint) { - platform.invokeMethod('getAppToken').then((appToken) async { - platform.invokeMethod('startScanner', { - 'token': token, - 'url': endpoint, - 'appToken': appToken, - 'locale': Intl.defaultLocale, - 'color': Resources.getPrimaryColor(app).value - }); - }); - }); -// }); + platform.invokeMethod('startScanner', { + 'token': await platform.invokeMethod('getAppToken'), + 'url': await platform.invokeMethod('getEndpoint'), + 'appToken': await platform.invokeMethod('getAppToken'), + 'locale': Intl.defaultLocale, + 'color': Resources.getPrimaryColor(app).value + }); } } } // Запуск диалога с двумя кнопками -showYesNoDialog(BuildContext context, String title, String content, VoidCallback positiveCallback) { - showDialog(context: context, child: new AlertDialog( - title: new Text(title), - content: new Text(content), - actions: [ - new FlatButton( - child: new Text(StringsLocalization.no()), - onPressed: () { - Navigator.of(context).pop(); - } - ), - new FlatButton( - child: new Text(StringsLocalization.yes()), - onPressed: positiveCallback)])); +showYesNoDialog(BuildContext context, String title, String content, + VoidCallback positiveCallback) { + showDialog( + context: context, + child: new AlertDialog( + title: new Text(title), + content: new Text(content), + actions: [ + new FlatButton( + child: new Text(StringsLocalization.no()), + onPressed: () { + Navigator.of(context).pop(); + }), + new FlatButton( + child: new Text(StringsLocalization.yes()), + onPressed: positiveCallback) + ])); } getCurrencyTitle(int code) { - switch(code) { - case 643: return StringsLocalization.nominativeRuble(); - case 840: return StringsLocalization.nominativeDollar(); - case 980: return StringsLocalization.nominativeHryvna(); - case 978: return StringsLocalization.nominativeEuro(); - case 398: return StringsLocalization.nominativeTenge(); + switch (code) { + case 643: + return StringsLocalization.nominativeRuble(); + case 840: + return StringsLocalization.nominativeDollar(); + case 980: + return StringsLocalization.nominativeHryvna(); + case 978: + return StringsLocalization.nominativeEuro(); + case 398: + return StringsLocalization.nominativeTenge(); } } getLocaleTitle(String code) { - switch(code) { - case 'ru': return 'Русский'; - case 'en': return 'English'; - case 'ua': return 'Український'; - case 'es': return 'Español'; + switch (code) { + case 'ru': + return 'Русский'; + case 'en': + return 'English'; + case 'ua': + return 'Український'; + case 'es': + return 'Español'; } -} \ No newline at end of file +} diff --git a/lib/main.dart b/lib/main.dart index e5ff8bb..ad18779 100644 --- a/lib/main.dart +++ b/lib/main.dart @@ -12,9 +12,9 @@ const platform = const MethodChannel('com.dinect.checker/instance_id'); /// some changes void main() { - platform.invokeMethod('getAppTitle').then((title) { - runApp(new Checker(appName: title)); - }); + //platform.invokeMethod('getAppTitle').then((title) { + runApp(new Checker(appName: 'title')); + //}); } class Checker extends StatelessWidget { @@ -28,4 +28,4 @@ class Checker extends StatelessWidget { home: new SplashScreen() ); } -} \ No newline at end of file +} diff --git a/lib/network.dart b/lib/network.dart index 7c26858..d143592 100644 --- a/lib/network.dart +++ b/lib/network.dart @@ -69,6 +69,21 @@ getCouponsRequest(String endpoint, String token) async { return httpClient.get(endpoint, headers: headers); } +getUserByCard(String card, String token) async { + + var headers = { + 'DM-Authorization': 'dmapptoken ${await getToken()}', + 'Authorization': 'dmtoken ${token}', + 'Accept-Language': Intl.defaultLocale + }; + + + var finalEndpoint = "${await getEndpoint()}users/?auto=$card"; + print(finalEndpoint); + + return httpClient.get(finalEndpoint, headers: headers); +} + getEndpoint() async { return await platform.invokeMethod('getEndpoint'); }