Repository: hehe520/AsyncSocket Branch: master Commit: 5cbf92e84443 Files: 106 Total size: 3.3 MB Directory structure: gitextract_ch51wtsd/ ├── .gitignore ├── GCDAsyncSocket/ │ ├── AFNetworking/ │ │ ├── AFHTTPSessionManager.h │ │ ├── AFHTTPSessionManager.m │ │ ├── AFNetworkReachabilityManager.h │ │ ├── AFNetworkReachabilityManager.m │ │ ├── AFNetworking.h │ │ ├── AFSecurityPolicy.h │ │ ├── AFSecurityPolicy.m │ │ ├── AFURLRequestSerialization.h │ │ ├── AFURLRequestSerialization.m │ │ ├── AFURLResponseSerialization.h │ │ ├── AFURLResponseSerialization.m │ │ ├── AFURLSessionManager.h │ │ └── AFURLSessionManager.m │ ├── AppDelegate.h │ ├── AppDelegate.m │ ├── Assets.xcassets/ │ │ └── AppIcon.appiconset/ │ │ └── Contents.json │ ├── Base.lproj/ │ │ ├── LaunchScreen.storyboard │ │ └── Main.storyboard │ ├── CocoaAsyncSocket/ │ │ ├── AsyncSocket.h │ │ ├── AsyncSocket.m │ │ ├── AsyncUdpSocket.h │ │ ├── AsyncUdpSocket.m │ │ ├── GCDAsyncSocket.h │ │ ├── GCDAsyncSocket.m │ │ ├── GCDAsyncUdpSocket.h │ │ └── GCDAsyncUdpSocket.m │ ├── Info.plist │ ├── NetWorkManager.h │ ├── NetWorkManager.m │ ├── ProtobufBuffer/ │ │ ├── AbstractMessage.h │ │ ├── AbstractMessage.m │ │ ├── AbstractMessageBuilder.h │ │ ├── AbstractMessageBuilder.m │ │ ├── Bootstrap.h │ │ ├── CodedInputStream.h │ │ ├── CodedInputStream.m │ │ ├── CodedOutputStream.h │ │ ├── CodedOutputStream.m │ │ ├── ConcreteExtensionField.h │ │ ├── ConcreteExtensionField.m │ │ ├── Descriptor.pb.h │ │ ├── Descriptor.pb.m │ │ ├── ExtendableMessage.h │ │ ├── ExtendableMessage.m │ │ ├── ExtendableMessageBuilder.h │ │ ├── ExtendableMessageBuilder.m │ │ ├── ExtensionField.h │ │ ├── ExtensionRegistry.h │ │ ├── ExtensionRegistry.m │ │ ├── Field.h │ │ ├── Field.m │ │ ├── ForwardDeclarations.h │ │ ├── GeneratedMessage.h │ │ ├── GeneratedMessage.m │ │ ├── GeneratedMessageBuilder.h │ │ ├── GeneratedMessageBuilder.m │ │ ├── Message.h │ │ ├── MessageBuilder.h │ │ ├── MutableExtensionRegistry.h │ │ ├── MutableExtensionRegistry.m │ │ ├── MutableField.h │ │ ├── MutableField.m │ │ ├── ObjectivecDescriptor.pb.h │ │ ├── ObjectivecDescriptor.pb.m │ │ ├── PBArray.h │ │ ├── PBArray.m │ │ ├── ProtocolBuffers.h │ │ ├── RingBuffer.h │ │ ├── RingBuffer.m │ │ ├── TextFormat.h │ │ ├── TextFormat.m │ │ ├── UnknownFieldSet.h │ │ ├── UnknownFieldSet.m │ │ ├── UnknownFieldSetBuilder.h │ │ ├── UnknownFieldSetBuilder.m │ │ ├── Utilities.h │ │ ├── Utilities.m │ │ ├── WireFormat.h │ │ └── WireFormat.m │ ├── ServerURLModel.h │ ├── ServerURLModel.m │ ├── SocketManager.h │ ├── SocketManager.m │ ├── SpeedDectectManager.h │ ├── SpeedDectectManager.m │ ├── TCPAPI.h │ ├── TCPAPI.m │ ├── ViewController.h │ ├── ViewController.m │ ├── main.m │ └── src/ │ ├── Auth.pb.h │ ├── Auth.pb.m │ ├── Common.pb.h │ ├── Common.pb.m │ ├── Index.pb.h │ ├── Index.pb.m │ ├── Investment.pb.h │ ├── Investment.pb.m │ ├── Report.pb.h │ ├── Report.pb.m │ ├── Warning.pb.h │ └── Warning.pb.m ├── GCDAsyncSocket.xcodeproj/ │ ├── project.pbxproj │ └── project.xcworkspace/ │ └── contents.xcworkspacedata └── README.md ================================================ FILE CONTENTS ================================================ ================================================ FILE: .gitignore ================================================ # Xcode # # gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore ## Build generated build/ DerivedData/ ## Various settings *.pbxuser !default.pbxuser *.mode1v3 !default.mode1v3 *.mode2v3 !default.mode2v3 *.perspectivev3 !default.perspectivev3 xcuserdata/ ## Other *.moved-aside *.xcuserstate ## Obj-C/Swift specific *.hmap *.ipa *.dSYM.zip *.dSYM # CocoaPods # # We recommend against adding the Pods directory to your .gitignore. However # you should judge for yourself, the pros and cons are mentioned at: # https://guides.cocoapods.org/using/using-cocoapods.html#should-i-check-the-pods-directory-into-source-control # # Pods/ # Carthage # # Add this line if you want to avoid checking in source code from Carthage dependencies. # Carthage/Checkouts Carthage/Build # fastlane # # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: # https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md fastlane/report.xml fastlane/screenshots #Code Injection # # After new code Injection tools there's a generated folder /iOSInjectionProject # https://github.com/johnno1962/injectionforxcode iOSInjectionProject/ ================================================ FILE: GCDAsyncSocket/AFNetworking/AFHTTPSessionManager.h ================================================ // AFHTTPSessionManager.h // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import #if !TARGET_OS_WATCH #import #endif #import #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV #import #else #import #endif #import "AFURLSessionManager.h" /** `AFHTTPSessionManager` is a subclass of `AFURLSessionManager` with convenience methods for making HTTP requests. When a `baseURL` is provided, requests made with the `GET` / `POST` / et al. convenience methods can be made with relative paths. ## Subclassing Notes Developers targeting iOS 7 or Mac OS X 10.9 or later that deal extensively with a web service are encouraged to subclass `AFHTTPSessionManager`, providing a class method that returns a shared singleton object on which authentication and other configuration can be shared across the application. For developers targeting iOS 6 or Mac OS X 10.8 or earlier, `AFHTTPRequestOperationManager` may be used to similar effect. ## Methods to Override To change the behavior of all data task operation construction, which is also used in the `GET` / `POST` / et al. convenience methods, override `dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler:`. ## Serialization Requests created by an HTTP client will contain default headers and encode parameters according to the `requestSerializer` property, which is an object conforming to ``. Responses received from the server are automatically validated and serialized by the `responseSerializers` property, which is an object conforming to `` ## URL Construction Using Relative Paths For HTTP convenience methods, the request serializer constructs URLs from the path relative to the `-baseURL`, using `NSURL +URLWithString:relativeToURL:`, when provided. If `baseURL` is `nil`, `path` needs to resolve to a valid `NSURL` object using `NSURL +URLWithString:`. Below are a few examples of how `baseURL` and relative paths interact: NSURL *baseURL = [NSURL URLWithString:@"http://example.com/v1/"]; [NSURL URLWithString:@"foo" relativeToURL:baseURL]; // http://example.com/v1/foo [NSURL URLWithString:@"foo?bar=baz" relativeToURL:baseURL]; // http://example.com/v1/foo?bar=baz [NSURL URLWithString:@"/foo" relativeToURL:baseURL]; // http://example.com/foo [NSURL URLWithString:@"foo/" relativeToURL:baseURL]; // http://example.com/v1/foo [NSURL URLWithString:@"/foo/" relativeToURL:baseURL]; // http://example.com/foo/ [NSURL URLWithString:@"http://example2.com/" relativeToURL:baseURL]; // http://example2.com/ Also important to note is that a trailing slash will be added to any `baseURL` without one. This would otherwise cause unexpected behavior when constructing URLs using paths without a leading slash. @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance. */ NS_ASSUME_NONNULL_BEGIN @interface AFHTTPSessionManager : AFURLSessionManager /** The URL used to construct requests from relative paths in methods like `requestWithMethod:URLString:parameters:`, and the `GET` / `POST` / et al. convenience methods. */ @property (readonly, nonatomic, strong, nullable) NSURL *baseURL; /** Requests created with `requestWithMethod:URLString:parameters:` & `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:` are constructed with a set of default headers using a parameter serialization specified by this property. By default, this is set to an instance of `AFHTTPRequestSerializer`, which serializes query string parameters for `GET`, `HEAD`, and `DELETE` requests, or otherwise URL-form-encodes HTTP message bodies. @warning `requestSerializer` must not be `nil`. */ @property (nonatomic, strong) AFHTTPRequestSerializer * requestSerializer; /** Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. @warning `responseSerializer` must not be `nil`. */ @property (nonatomic, strong) AFHTTPResponseSerializer * responseSerializer; ///--------------------- /// @name Initialization ///--------------------- /** Creates and returns an `AFHTTPSessionManager` object. */ + (instancetype)manager; /** Initializes an `AFHTTPSessionManager` object with the specified base URL. @param url The base URL for the HTTP client. @return The newly-initialized HTTP client */ - (instancetype)initWithBaseURL:(nullable NSURL *)url; /** Initializes an `AFHTTPSessionManager` object with the specified base URL. This is the designated initializer. @param url The base URL for the HTTP client. @param configuration The configuration used to create the managed session. @return The newly-initialized HTTP client */ - (instancetype)initWithBaseURL:(nullable NSURL *)url sessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER; ///--------------------------- /// @name Making HTTP Requests ///--------------------------- /** Creates and runs an `NSURLSessionDataTask` with a `GET` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; /** Creates and runs an `NSURLSessionDataTask` with a `GET` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param downloadProgress A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: */ - (nullable NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(nullable id)parameters progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgress success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `HEAD` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes a single arguments: the data task. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)HEAD:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `POST` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; /** Creates and runs an `NSURLSessionDataTask` with a `POST` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: */ - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters constructingBodyWithBlock:(nullable void (^)(id formData))block success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure DEPRECATED_ATTRIBUTE; /** Creates and runs an `NSURLSessionDataTask` with a multipart `POST` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. @param uploadProgress A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:uploadProgress:downloadProgress:completionHandler: */ - (nullable NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters constructingBodyWithBlock:(nullable void (^)(id formData))block progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgress success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `PUT` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)PUT:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `PATCH` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)PATCH:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; /** Creates and runs an `NSURLSessionDataTask` with a `DELETE` request. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded according to the client request serializer. @param success A block object to be executed when the task finishes successfully. This block has no return value and takes two arguments: the data task, and the response object created by the client response serializer. @param failure A block object to be executed when the task finishes unsuccessfully, or that finishes successfully, but encountered an error while parsing the response data. This block has no return value and takes a two arguments: the data task and the error describing the network or parsing error that occurred. @see -dataTaskWithRequest:completionHandler: */ - (nullable NSURLSessionDataTask *)DELETE:(NSString *)URLString parameters:(nullable id)parameters success:(nullable void (^)(NSURLSessionDataTask *task, id _Nullable responseObject))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable task, NSError *error))failure; @end NS_ASSUME_NONNULL_END ================================================ FILE: GCDAsyncSocket/AFNetworking/AFHTTPSessionManager.m ================================================ // AFHTTPSessionManager.m // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import "AFHTTPSessionManager.h" #import "AFURLRequestSerialization.h" #import "AFURLResponseSerialization.h" #import #import #import #import #import #import #import #import #if TARGET_OS_IOS || TARGET_OS_TV #import #elif TARGET_OS_WATCH #import #endif @interface AFHTTPSessionManager () @property (readwrite, nonatomic, strong) NSURL *baseURL; @end @implementation AFHTTPSessionManager @dynamic responseSerializer; + (instancetype)manager { return [[[self class] alloc] initWithBaseURL:nil]; } - (instancetype)init { return [self initWithBaseURL:nil]; } - (instancetype)initWithBaseURL:(NSURL *)url { return [self initWithBaseURL:url sessionConfiguration:nil]; } - (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { return [self initWithBaseURL:nil sessionConfiguration:configuration]; } - (instancetype)initWithBaseURL:(NSURL *)url sessionConfiguration:(NSURLSessionConfiguration *)configuration { self = [super initWithSessionConfiguration:configuration]; if (!self) { return nil; } // Ensure terminal slash for baseURL path, so that NSURL +URLWithString:relativeToURL: works as expected if ([[url path] length] > 0 && ![[url absoluteString] hasSuffix:@"/"]) { url = [url URLByAppendingPathComponent:@""]; } self.baseURL = url; self.requestSerializer = [AFHTTPRequestSerializer serializer]; self.responseSerializer = [AFJSONResponseSerializer serializer]; return self; } #pragma mark - - (void)setRequestSerializer:(AFHTTPRequestSerializer *)requestSerializer { NSParameterAssert(requestSerializer); _requestSerializer = requestSerializer; } - (void)setResponseSerializer:(AFHTTPResponseSerializer *)responseSerializer { NSParameterAssert(responseSerializer); [super setResponseSerializer:responseSerializer]; } #pragma mark - - (NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { return [self GET:URLString parameters:parameters progress:nil success:success failure:failure]; } - (NSURLSessionDataTask *)GET:(NSString *)URLString parameters:(id)parameters progress:(void (^)(NSProgress * _Nonnull))downloadProgress success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure { NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"GET" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:downloadProgress success:success failure:failure]; [dataTask resume]; return dataTask; } - (NSURLSessionDataTask *)HEAD:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *task))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"HEAD" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:^(NSURLSessionDataTask *task, __unused id responseObject) { if (success) { success(task); } } failure:failure]; [dataTask resume]; return dataTask; } - (NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { return [self POST:URLString parameters:parameters progress:nil success:success failure:failure]; } - (NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(id)parameters progress:(void (^)(NSProgress * _Nonnull))uploadProgress success:(void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success failure:(void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure { NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"POST" URLString:URLString parameters:parameters uploadProgress:uploadProgress downloadProgress:nil success:success failure:failure]; [dataTask resume]; return dataTask; } - (NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(nullable id)parameters constructingBodyWithBlock:(nullable void (^)(id _Nonnull))block success:(nullable void (^)(NSURLSessionDataTask * _Nonnull, id _Nullable))success failure:(nullable void (^)(NSURLSessionDataTask * _Nullable, NSError * _Nonnull))failure { return [self POST:URLString parameters:parameters constructingBodyWithBlock:block progress:nil success:success failure:failure]; } - (NSURLSessionDataTask *)POST:(NSString *)URLString parameters:(id)parameters constructingBodyWithBlock:(void (^)(id formData))block progress:(nullable void (^)(NSProgress * _Nonnull))uploadProgress success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { NSError *serializationError = nil; NSMutableURLRequest *request = [self.requestSerializer multipartFormRequestWithMethod:@"POST" URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters constructingBodyWithBlock:block error:&serializationError]; if (serializationError) { if (failure) { dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ failure(nil, serializationError); }); } return nil; } __block NSURLSessionDataTask *task = [self uploadTaskWithStreamedRequest:request progress:uploadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { if (error) { if (failure) { failure(task, error); } } else { if (success) { success(task, responseObject); } } }]; [task resume]; return task; } - (NSURLSessionDataTask *)PUT:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PUT" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; [dataTask resume]; return dataTask; } - (NSURLSessionDataTask *)PATCH:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"PATCH" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; [dataTask resume]; return dataTask; } - (NSURLSessionDataTask *)DELETE:(NSString *)URLString parameters:(id)parameters success:(void (^)(NSURLSessionDataTask *task, id responseObject))success failure:(void (^)(NSURLSessionDataTask *task, NSError *error))failure { NSURLSessionDataTask *dataTask = [self dataTaskWithHTTPMethod:@"DELETE" URLString:URLString parameters:parameters uploadProgress:nil downloadProgress:nil success:success failure:failure]; [dataTask resume]; return dataTask; } - (NSURLSessionDataTask *)dataTaskWithHTTPMethod:(NSString *)method URLString:(NSString *)URLString parameters:(id)parameters uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgress downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgress success:(void (^)(NSURLSessionDataTask *, id))success failure:(void (^)(NSURLSessionDataTask *, NSError *))failure { NSError *serializationError = nil; NSMutableURLRequest *request = [self.requestSerializer requestWithMethod:method URLString:[[NSURL URLWithString:URLString relativeToURL:self.baseURL] absoluteString] parameters:parameters error:&serializationError]; if (serializationError) { if (failure) { dispatch_async(self.completionQueue ?: dispatch_get_main_queue(), ^{ failure(nil, serializationError); }); } return nil; } __block NSURLSessionDataTask *dataTask = nil; dataTask = [self dataTaskWithRequest:request uploadProgress:uploadProgress downloadProgress:downloadProgress completionHandler:^(NSURLResponse * __unused response, id responseObject, NSError *error) { if (error) { if (failure) { failure(dataTask, error); } } else { if (success) { success(dataTask, responseObject); } } }]; return dataTask; } #pragma mark - NSObject - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p, baseURL: %@, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, [self.baseURL absoluteString], self.session, self.operationQueue]; } #pragma mark - NSSecureCoding + (BOOL)supportsSecureCoding { return YES; } - (instancetype)initWithCoder:(NSCoder *)decoder { NSURL *baseURL = [decoder decodeObjectOfClass:[NSURL class] forKey:NSStringFromSelector(@selector(baseURL))]; NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"]; if (!configuration) { NSString *configurationIdentifier = [decoder decodeObjectOfClass:[NSString class] forKey:@"identifier"]; if (configurationIdentifier) { #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 80000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 1100) configuration = [NSURLSessionConfiguration backgroundSessionConfigurationWithIdentifier:configurationIdentifier]; #else configuration = [NSURLSessionConfiguration backgroundSessionConfiguration:configurationIdentifier]; #endif } } self = [self initWithBaseURL:baseURL sessionConfiguration:configuration]; if (!self) { return nil; } self.requestSerializer = [decoder decodeObjectOfClass:[AFHTTPRequestSerializer class] forKey:NSStringFromSelector(@selector(requestSerializer))]; self.responseSerializer = [decoder decodeObjectOfClass:[AFHTTPResponseSerializer class] forKey:NSStringFromSelector(@selector(responseSerializer))]; AFSecurityPolicy *decodedPolicy = [decoder decodeObjectOfClass:[AFSecurityPolicy class] forKey:NSStringFromSelector(@selector(securityPolicy))]; if (decodedPolicy) { self.securityPolicy = decodedPolicy; } return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:self.baseURL forKey:NSStringFromSelector(@selector(baseURL))]; if ([self.session.configuration conformsToProtocol:@protocol(NSCoding)]) { [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"]; } else { [coder encodeObject:self.session.configuration.identifier forKey:@"identifier"]; } [coder encodeObject:self.requestSerializer forKey:NSStringFromSelector(@selector(requestSerializer))]; [coder encodeObject:self.responseSerializer forKey:NSStringFromSelector(@selector(responseSerializer))]; [coder encodeObject:self.securityPolicy forKey:NSStringFromSelector(@selector(securityPolicy))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFHTTPSessionManager *HTTPClient = [[[self class] allocWithZone:zone] initWithBaseURL:self.baseURL sessionConfiguration:self.session.configuration]; HTTPClient.requestSerializer = [self.requestSerializer copyWithZone:zone]; HTTPClient.responseSerializer = [self.responseSerializer copyWithZone:zone]; HTTPClient.securityPolicy = [self.securityPolicy copyWithZone:zone]; return HTTPClient; } @end ================================================ FILE: GCDAsyncSocket/AFNetworking/AFNetworkReachabilityManager.h ================================================ // AFNetworkReachabilityManager.h // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import #if !TARGET_OS_WATCH #import typedef NS_ENUM(NSInteger, AFNetworkReachabilityStatus) { AFNetworkReachabilityStatusUnknown = -1, AFNetworkReachabilityStatusNotReachable = 0, AFNetworkReachabilityStatusReachableViaWWAN = 1, AFNetworkReachabilityStatusReachableViaWiFi = 2, }; NS_ASSUME_NONNULL_BEGIN /** `AFNetworkReachabilityManager` monitors the reachability of domains, and addresses for both WWAN and WiFi network interfaces. Reachability can be used to determine background information about why a network operation failed, or to trigger a network operation retrying when a connection is established. It should not be used to prevent a user from initiating a network request, as it's possible that an initial request may be required to establish reachability. See Apple's Reachability Sample Code ( https://developer.apple.com/library/ios/samplecode/reachability/ ) @warning Instances of `AFNetworkReachabilityManager` must be started with `-startMonitoring` before reachability status can be determined. */ @interface AFNetworkReachabilityManager : NSObject /** The current network reachability status. */ @property (readonly, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; /** Whether or not the network is currently reachable. */ @property (readonly, nonatomic, assign, getter = isReachable) BOOL reachable; /** Whether or not the network is currently reachable via WWAN. */ @property (readonly, nonatomic, assign, getter = isReachableViaWWAN) BOOL reachableViaWWAN; /** Whether or not the network is currently reachable via WiFi. */ @property (readonly, nonatomic, assign, getter = isReachableViaWiFi) BOOL reachableViaWiFi; ///--------------------- /// @name Initialization ///--------------------- /** Returns the shared network reachability manager. */ + (instancetype)sharedManager; /** Creates and returns a network reachability manager with the default socket address. @return An initialized network reachability manager, actively monitoring the default socket address. */ + (instancetype)manager; /** Creates and returns a network reachability manager for the specified domain. @param domain The domain used to evaluate network reachability. @return An initialized network reachability manager, actively monitoring the specified domain. */ + (instancetype)managerForDomain:(NSString *)domain; /** Creates and returns a network reachability manager for the socket address. @param address The socket address (`sockaddr_in6`) used to evaluate network reachability. @return An initialized network reachability manager, actively monitoring the specified socket address. */ + (instancetype)managerForAddress:(const void *)address; /** Initializes an instance of a network reachability manager from the specified reachability object. @param reachability The reachability object to monitor. @return An initialized network reachability manager, actively monitoring the specified reachability. */ - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability NS_DESIGNATED_INITIALIZER; ///-------------------------------------------------- /// @name Starting & Stopping Reachability Monitoring ///-------------------------------------------------- /** Starts monitoring for changes in network reachability status. */ - (void)startMonitoring; /** Stops monitoring for changes in network reachability status. */ - (void)stopMonitoring; ///------------------------------------------------- /// @name Getting Localized Reachability Description ///------------------------------------------------- /** Returns a localized string representation of the current network reachability status. */ - (NSString *)localizedNetworkReachabilityStatusString; ///--------------------------------------------------- /// @name Setting Network Reachability Change Callback ///--------------------------------------------------- /** Sets a callback to be executed when the network availability of the `baseURL` host changes. @param block A block object to be executed when the network availability of the `baseURL` host changes.. This block has no return value and takes a single argument which represents the various reachability states from the device to the `baseURL`. */ - (void)setReachabilityStatusChangeBlock:(nullable void (^)(AFNetworkReachabilityStatus status))block; @end ///---------------- /// @name Constants ///---------------- /** ## Network Reachability The following constants are provided by `AFNetworkReachabilityManager` as possible network reachability statuses. enum { AFNetworkReachabilityStatusUnknown, AFNetworkReachabilityStatusNotReachable, AFNetworkReachabilityStatusReachableViaWWAN, AFNetworkReachabilityStatusReachableViaWiFi, } `AFNetworkReachabilityStatusUnknown` The `baseURL` host reachability is not known. `AFNetworkReachabilityStatusNotReachable` The `baseURL` host cannot be reached. `AFNetworkReachabilityStatusReachableViaWWAN` The `baseURL` host can be reached via a cellular connection, such as EDGE or GPRS. `AFNetworkReachabilityStatusReachableViaWiFi` The `baseURL` host can be reached via a Wi-Fi connection. ### Keys for Notification UserInfo Dictionary Strings that are used as keys in a `userInfo` dictionary in a network reachability status change notification. `AFNetworkingReachabilityNotificationStatusItem` A key in the userInfo dictionary in a `AFNetworkingReachabilityDidChangeNotification` notification. The corresponding value is an `NSNumber` object representing the `AFNetworkReachabilityStatus` value for the current reachability status. */ ///-------------------- /// @name Notifications ///-------------------- /** Posted when network reachability changes. This notification assigns no notification object. The `userInfo` dictionary contains an `NSNumber` object under the `AFNetworkingReachabilityNotificationStatusItem` key, representing the `AFNetworkReachabilityStatus` value for the current network reachability. @warning In order for network reachability to be monitored, include the `SystemConfiguration` framework in the active target's "Link Binary With Library" build phase, and add `#import ` to the header prefix of the project (`Prefix.pch`). */ FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityDidChangeNotification; FOUNDATION_EXPORT NSString * const AFNetworkingReachabilityNotificationStatusItem; ///-------------------- /// @name Functions ///-------------------- /** Returns a localized string representation of an `AFNetworkReachabilityStatus` value. */ FOUNDATION_EXPORT NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status); NS_ASSUME_NONNULL_END #endif ================================================ FILE: GCDAsyncSocket/AFNetworking/AFNetworkReachabilityManager.m ================================================ // AFNetworkReachabilityManager.m // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import "AFNetworkReachabilityManager.h" #if !TARGET_OS_WATCH #import #import #import #import #import NSString * const AFNetworkingReachabilityDidChangeNotification = @"com.alamofire.networking.reachability.change"; NSString * const AFNetworkingReachabilityNotificationStatusItem = @"AFNetworkingReachabilityNotificationStatusItem"; typedef void (^AFNetworkReachabilityStatusBlock)(AFNetworkReachabilityStatus status); NSString * AFStringFromNetworkReachabilityStatus(AFNetworkReachabilityStatus status) { switch (status) { case AFNetworkReachabilityStatusNotReachable: return NSLocalizedStringFromTable(@"Not Reachable", @"AFNetworking", nil); case AFNetworkReachabilityStatusReachableViaWWAN: return NSLocalizedStringFromTable(@"Reachable via WWAN", @"AFNetworking", nil); case AFNetworkReachabilityStatusReachableViaWiFi: return NSLocalizedStringFromTable(@"Reachable via WiFi", @"AFNetworking", nil); case AFNetworkReachabilityStatusUnknown: default: return NSLocalizedStringFromTable(@"Unknown", @"AFNetworking", nil); } } static AFNetworkReachabilityStatus AFNetworkReachabilityStatusForFlags(SCNetworkReachabilityFlags flags) { BOOL isReachable = ((flags & kSCNetworkReachabilityFlagsReachable) != 0); BOOL needsConnection = ((flags & kSCNetworkReachabilityFlagsConnectionRequired) != 0); BOOL canConnectionAutomatically = (((flags & kSCNetworkReachabilityFlagsConnectionOnDemand ) != 0) || ((flags & kSCNetworkReachabilityFlagsConnectionOnTraffic) != 0)); BOOL canConnectWithoutUserInteraction = (canConnectionAutomatically && (flags & kSCNetworkReachabilityFlagsInterventionRequired) == 0); BOOL isNetworkReachable = (isReachable && (!needsConnection || canConnectWithoutUserInteraction)); AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusUnknown; if (isNetworkReachable == NO) { status = AFNetworkReachabilityStatusNotReachable; } #if TARGET_OS_IPHONE else if ((flags & kSCNetworkReachabilityFlagsIsWWAN) != 0) { status = AFNetworkReachabilityStatusReachableViaWWAN; } #endif else { status = AFNetworkReachabilityStatusReachableViaWiFi; } return status; } /** * Queue a status change notification for the main thread. * * This is done to ensure that the notifications are received in the same order * as they are sent. If notifications are sent directly, it is possible that * a queued notification (for an earlier status condition) is processed after * the later update, resulting in the listener being left in the wrong state. */ static void AFPostReachabilityStatusChange(SCNetworkReachabilityFlags flags, AFNetworkReachabilityStatusBlock block) { AFNetworkReachabilityStatus status = AFNetworkReachabilityStatusForFlags(flags); dispatch_async(dispatch_get_main_queue(), ^{ if (block) { block(status); } NSNotificationCenter *notificationCenter = [NSNotificationCenter defaultCenter]; NSDictionary *userInfo = @{ AFNetworkingReachabilityNotificationStatusItem: @(status) }; [notificationCenter postNotificationName:AFNetworkingReachabilityDidChangeNotification object:nil userInfo:userInfo]; }); } static void AFNetworkReachabilityCallback(SCNetworkReachabilityRef __unused target, SCNetworkReachabilityFlags flags, void *info) { AFPostReachabilityStatusChange(flags, (__bridge AFNetworkReachabilityStatusBlock)info); } static const void * AFNetworkReachabilityRetainCallback(const void *info) { return Block_copy(info); } static void AFNetworkReachabilityReleaseCallback(const void *info) { if (info) { Block_release(info); } } @interface AFNetworkReachabilityManager () @property (readonly, nonatomic, assign) SCNetworkReachabilityRef networkReachability; @property (readwrite, nonatomic, assign) AFNetworkReachabilityStatus networkReachabilityStatus; @property (readwrite, nonatomic, copy) AFNetworkReachabilityStatusBlock networkReachabilityStatusBlock; @end @implementation AFNetworkReachabilityManager + (instancetype)sharedManager { static AFNetworkReachabilityManager *_sharedManager = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _sharedManager = [self manager]; }); return _sharedManager; } + (instancetype)managerForDomain:(NSString *)domain { SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithName(kCFAllocatorDefault, [domain UTF8String]); AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; CFRelease(reachability); return manager; } + (instancetype)managerForAddress:(const void *)address { SCNetworkReachabilityRef reachability = SCNetworkReachabilityCreateWithAddress(kCFAllocatorDefault, (const struct sockaddr *)address); AFNetworkReachabilityManager *manager = [[self alloc] initWithReachability:reachability]; CFRelease(reachability); return manager; } + (instancetype)manager { #if (defined(__IPHONE_OS_VERSION_MIN_REQUIRED) && __IPHONE_OS_VERSION_MIN_REQUIRED >= 90000) || (defined(__MAC_OS_X_VERSION_MIN_REQUIRED) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101100) struct sockaddr_in6 address; bzero(&address, sizeof(address)); address.sin6_len = sizeof(address); address.sin6_family = AF_INET6; #else struct sockaddr_in address; bzero(&address, sizeof(address)); address.sin_len = sizeof(address); address.sin_family = AF_INET; #endif return [self managerForAddress:&address]; } - (instancetype)initWithReachability:(SCNetworkReachabilityRef)reachability { self = [super init]; if (!self) { return nil; } _networkReachability = CFRetain(reachability); self.networkReachabilityStatus = AFNetworkReachabilityStatusUnknown; return self; } - (instancetype)init NS_UNAVAILABLE { return nil; } - (void)dealloc { [self stopMonitoring]; if (_networkReachability != NULL) { CFRelease(_networkReachability); } } #pragma mark - - (BOOL)isReachable { return [self isReachableViaWWAN] || [self isReachableViaWiFi]; } - (BOOL)isReachableViaWWAN { return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWWAN; } - (BOOL)isReachableViaWiFi { return self.networkReachabilityStatus == AFNetworkReachabilityStatusReachableViaWiFi; } #pragma mark - - (void)startMonitoring { [self stopMonitoring]; if (!self.networkReachability) { return; } __weak __typeof(self)weakSelf = self; AFNetworkReachabilityStatusBlock callback = ^(AFNetworkReachabilityStatus status) { __strong __typeof(weakSelf)strongSelf = weakSelf; strongSelf.networkReachabilityStatus = status; if (strongSelf.networkReachabilityStatusBlock) { strongSelf.networkReachabilityStatusBlock(status); } }; SCNetworkReachabilityContext context = {0, (__bridge void *)callback, AFNetworkReachabilityRetainCallback, AFNetworkReachabilityReleaseCallback, NULL}; SCNetworkReachabilitySetCallback(self.networkReachability, AFNetworkReachabilityCallback, &context); SCNetworkReachabilityScheduleWithRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_BACKGROUND, 0),^{ SCNetworkReachabilityFlags flags; if (SCNetworkReachabilityGetFlags(self.networkReachability, &flags)) { AFPostReachabilityStatusChange(flags, callback); } }); } - (void)stopMonitoring { if (!self.networkReachability) { return; } SCNetworkReachabilityUnscheduleFromRunLoop(self.networkReachability, CFRunLoopGetMain(), kCFRunLoopCommonModes); } #pragma mark - - (NSString *)localizedNetworkReachabilityStatusString { return AFStringFromNetworkReachabilityStatus(self.networkReachabilityStatus); } #pragma mark - - (void)setReachabilityStatusChangeBlock:(void (^)(AFNetworkReachabilityStatus status))block { self.networkReachabilityStatusBlock = block; } #pragma mark - NSKeyValueObserving + (NSSet *)keyPathsForValuesAffectingValueForKey:(NSString *)key { if ([key isEqualToString:@"reachable"] || [key isEqualToString:@"reachableViaWWAN"] || [key isEqualToString:@"reachableViaWiFi"]) { return [NSSet setWithObject:@"networkReachabilityStatus"]; } return [super keyPathsForValuesAffectingValueForKey:key]; } @end #endif ================================================ FILE: GCDAsyncSocket/AFNetworking/AFNetworking.h ================================================ // AFNetworking.h // // Copyright (c) 2013 AFNetworking (http://afnetworking.com/) // // 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. #import #import #import #ifndef _AFNETWORKING_ #define _AFNETWORKING_ #import "AFURLRequestSerialization.h" #import "AFURLResponseSerialization.h" #import "AFSecurityPolicy.h" #if !TARGET_OS_WATCH #import "AFNetworkReachabilityManager.h" #endif #import "AFURLSessionManager.h" #import "AFHTTPSessionManager.h" #endif /* _AFNETWORKING_ */ ================================================ FILE: GCDAsyncSocket/AFNetworking/AFSecurityPolicy.h ================================================ // AFSecurityPolicy.h // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import #import typedef NS_ENUM(NSUInteger, AFSSLPinningMode) { AFSSLPinningModeNone, AFSSLPinningModePublicKey, AFSSLPinningModeCertificate, }; /** `AFSecurityPolicy` evaluates server trust against pinned X.509 certificates and public keys over secure connections. Adding pinned SSL certificates to your app helps prevent man-in-the-middle attacks and other vulnerabilities. Applications dealing with sensitive customer data or financial information are strongly encouraged to route all communication over an HTTPS connection with SSL pinning configured and enabled. */ NS_ASSUME_NONNULL_BEGIN @interface AFSecurityPolicy : NSObject /** The criteria by which server trust should be evaluated against the pinned SSL certificates. Defaults to `AFSSLPinningModeNone`. */ @property (readonly, nonatomic, assign) AFSSLPinningMode SSLPinningMode; /** The certificates used to evaluate server trust according to the SSL pinning mode. By default, this property is set to any (`.cer`) certificates included in the target compiling AFNetworking. Note that if you are using AFNetworking as embedded framework, no certificates will be pinned by default. Use `certificatesInBundle` to load certificates from your target, and then create a new policy by calling `policyWithPinningMode:withPinnedCertificates`. Note that if pinning is enabled, `evaluateServerTrust:forDomain:` will return true if any pinned certificate matches. */ @property (nonatomic, strong, nullable) NSSet *pinnedCertificates; /** Whether or not to trust servers with an invalid or expired SSL certificates. Defaults to `NO`. */ @property (nonatomic, assign) BOOL allowInvalidCertificates; /** Whether or not to validate the domain name in the certificate's CN field. Defaults to `YES`. */ @property (nonatomic, assign) BOOL validatesDomainName; ///----------------------------------------- /// @name Getting Certificates from the Bundle ///----------------------------------------- /** Returns any certificates included in the bundle. If you are using AFNetworking as an embedded framework, you must use this method to find the certificates you have included in your app bundle, and use them when creating your security policy by calling `policyWithPinningMode:withPinnedCertificates`. @return The certificates included in the given bundle. */ + (NSSet *)certificatesInBundle:(NSBundle *)bundle; ///----------------------------------------- /// @name Getting Specific Security Policies ///----------------------------------------- /** Returns the shared default security policy, which does not allow invalid certificates, validates domain name, and does not validate against pinned certificates or public keys. @return The default security policy. */ + (instancetype)defaultPolicy; ///--------------------- /// @name Initialization ///--------------------- /** Creates and returns a security policy with the specified pinning mode. @param pinningMode The SSL pinning mode. @return A new security policy. */ + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode; /** Creates and returns a security policy with the specified pinning mode. @param pinningMode The SSL pinning mode. @param pinnedCertificates The certificates to pin against. @return A new security policy. */ + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates; ///------------------------------ /// @name Evaluating Server Trust ///------------------------------ /** Whether or not the specified server trust should be accepted, based on the security policy. This method should be used when responding to an authentication challenge from a server. @param serverTrust The X.509 certificate trust of the server. @param domain The domain of serverTrust. If `nil`, the domain will not be validated. @return Whether or not to trust the server. */ - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(nullable NSString *)domain; @end NS_ASSUME_NONNULL_END ///---------------- /// @name Constants ///---------------- /** ## SSL Pinning Modes The following constants are provided by `AFSSLPinningMode` as possible SSL pinning modes. enum { AFSSLPinningModeNone, AFSSLPinningModePublicKey, AFSSLPinningModeCertificate, } `AFSSLPinningModeNone` Do not used pinned certificates to validate servers. `AFSSLPinningModePublicKey` Validate host certificates against public keys of pinned certificates. `AFSSLPinningModeCertificate` Validate host certificates against pinned certificates. */ ================================================ FILE: GCDAsyncSocket/AFNetworking/AFSecurityPolicy.m ================================================ // AFSecurityPolicy.m // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import "AFSecurityPolicy.h" #import #if !TARGET_OS_IOS && !TARGET_OS_WATCH && !TARGET_OS_TV static NSData * AFSecKeyGetData(SecKeyRef key) { CFDataRef data = NULL; __Require_noErr_Quiet(SecItemExport(key, kSecFormatUnknown, kSecItemPemArmour, NULL, &data), _out); return (__bridge_transfer NSData *)data; _out: if (data) { CFRelease(data); } return nil; } #endif static BOOL AFSecKeyIsEqualToKey(SecKeyRef key1, SecKeyRef key2) { #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV return [(__bridge id)key1 isEqual:(__bridge id)key2]; #else return [AFSecKeyGetData(key1) isEqual:AFSecKeyGetData(key2)]; #endif } static id AFPublicKeyForCertificate(NSData *certificate) { id allowedPublicKey = nil; SecCertificateRef allowedCertificate; SecCertificateRef allowedCertificates[1]; CFArrayRef tempCertificates = nil; SecPolicyRef policy = nil; SecTrustRef allowedTrust = nil; SecTrustResultType result; allowedCertificate = SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificate); __Require_Quiet(allowedCertificate != NULL, _out); allowedCertificates[0] = allowedCertificate; tempCertificates = CFArrayCreate(NULL, (const void **)allowedCertificates, 1, NULL); policy = SecPolicyCreateBasicX509(); __Require_noErr_Quiet(SecTrustCreateWithCertificates(tempCertificates, policy, &allowedTrust), _out); __Require_noErr_Quiet(SecTrustEvaluate(allowedTrust, &result), _out); allowedPublicKey = (__bridge_transfer id)SecTrustCopyPublicKey(allowedTrust); _out: if (allowedTrust) { CFRelease(allowedTrust); } if (policy) { CFRelease(policy); } if (tempCertificates) { CFRelease(tempCertificates); } if (allowedCertificate) { CFRelease(allowedCertificate); } return allowedPublicKey; } static BOOL AFServerTrustIsValid(SecTrustRef serverTrust) { BOOL isValid = NO; SecTrustResultType result; __Require_noErr_Quiet(SecTrustEvaluate(serverTrust, &result), _out); isValid = (result == kSecTrustResultUnspecified || result == kSecTrustResultProceed); _out: return isValid; } static NSArray * AFCertificateTrustChainForServerTrust(SecTrustRef serverTrust) { CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; for (CFIndex i = 0; i < certificateCount; i++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); [trustChain addObject:(__bridge_transfer NSData *)SecCertificateCopyData(certificate)]; } return [NSArray arrayWithArray:trustChain]; } static NSArray * AFPublicKeyTrustChainForServerTrust(SecTrustRef serverTrust) { SecPolicyRef policy = SecPolicyCreateBasicX509(); CFIndex certificateCount = SecTrustGetCertificateCount(serverTrust); NSMutableArray *trustChain = [NSMutableArray arrayWithCapacity:(NSUInteger)certificateCount]; for (CFIndex i = 0; i < certificateCount; i++) { SecCertificateRef certificate = SecTrustGetCertificateAtIndex(serverTrust, i); SecCertificateRef someCertificates[] = {certificate}; CFArrayRef certificates = CFArrayCreate(NULL, (const void **)someCertificates, 1, NULL); SecTrustRef trust; __Require_noErr_Quiet(SecTrustCreateWithCertificates(certificates, policy, &trust), _out); SecTrustResultType result; __Require_noErr_Quiet(SecTrustEvaluate(trust, &result), _out); [trustChain addObject:(__bridge_transfer id)SecTrustCopyPublicKey(trust)]; _out: if (trust) { CFRelease(trust); } if (certificates) { CFRelease(certificates); } continue; } CFRelease(policy); return [NSArray arrayWithArray:trustChain]; } #pragma mark - @interface AFSecurityPolicy() @property (readwrite, nonatomic, assign) AFSSLPinningMode SSLPinningMode; @property (readwrite, nonatomic, strong) NSSet *pinnedPublicKeys; @end @implementation AFSecurityPolicy + (NSSet *)certificatesInBundle:(NSBundle *)bundle { NSArray *paths = [bundle pathsForResourcesOfType:@"cer" inDirectory:@"."]; NSMutableSet *certificates = [NSMutableSet setWithCapacity:[paths count]]; for (NSString *path in paths) { NSData *certificateData = [NSData dataWithContentsOfFile:path]; [certificates addObject:certificateData]; } return [NSSet setWithSet:certificates]; } + (NSSet *)defaultPinnedCertificates { static NSSet *_defaultPinnedCertificates = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ NSBundle *bundle = [NSBundle bundleForClass:[self class]]; _defaultPinnedCertificates = [self certificatesInBundle:bundle]; }); return _defaultPinnedCertificates; } + (instancetype)defaultPolicy { AFSecurityPolicy *securityPolicy = [[self alloc] init]; securityPolicy.SSLPinningMode = AFSSLPinningModeNone; return securityPolicy; } + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode { return [self policyWithPinningMode:pinningMode withPinnedCertificates:[self defaultPinnedCertificates]]; } + (instancetype)policyWithPinningMode:(AFSSLPinningMode)pinningMode withPinnedCertificates:(NSSet *)pinnedCertificates { AFSecurityPolicy *securityPolicy = [[self alloc] init]; securityPolicy.SSLPinningMode = pinningMode; [securityPolicy setPinnedCertificates:pinnedCertificates]; return securityPolicy; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.validatesDomainName = YES; return self; } - (void)setPinnedCertificates:(NSSet *)pinnedCertificates { _pinnedCertificates = pinnedCertificates; if (self.pinnedCertificates) { NSMutableSet *mutablePinnedPublicKeys = [NSMutableSet setWithCapacity:[self.pinnedCertificates count]]; for (NSData *certificate in self.pinnedCertificates) { id publicKey = AFPublicKeyForCertificate(certificate); if (!publicKey) { continue; } [mutablePinnedPublicKeys addObject:publicKey]; } self.pinnedPublicKeys = [NSSet setWithSet:mutablePinnedPublicKeys]; } else { self.pinnedPublicKeys = nil; } } #pragma mark - - (BOOL)evaluateServerTrust:(SecTrustRef)serverTrust forDomain:(NSString *)domain { if (domain && self.allowInvalidCertificates && self.validatesDomainName && (self.SSLPinningMode == AFSSLPinningModeNone || [self.pinnedCertificates count] == 0)) { // https://developer.apple.com/library/mac/documentation/NetworkingInternet/Conceptual/NetworkingTopics/Articles/OverridingSSLChainValidationCorrectly.html // According to the docs, you should only trust your provided certs for evaluation. // Pinned certificates are added to the trust. Without pinned certificates, // there is nothing to evaluate against. // // From Apple Docs: // "Do not implicitly trust self-signed certificates as anchors (kSecTrustOptionImplicitAnchors). // Instead, add your own (self-signed) CA certificate to the list of trusted anchors." NSLog(@"In order to validate a domain name for self signed certificates, you MUST use pinning."); return NO; } NSMutableArray *policies = [NSMutableArray array]; if (self.validatesDomainName) { [policies addObject:(__bridge_transfer id)SecPolicyCreateSSL(true, (__bridge CFStringRef)domain)]; } else { [policies addObject:(__bridge_transfer id)SecPolicyCreateBasicX509()]; } SecTrustSetPolicies(serverTrust, (__bridge CFArrayRef)policies); if (self.SSLPinningMode == AFSSLPinningModeNone) { return self.allowInvalidCertificates || AFServerTrustIsValid(serverTrust); } else if (!AFServerTrustIsValid(serverTrust) && !self.allowInvalidCertificates) { return NO; } switch (self.SSLPinningMode) { case AFSSLPinningModeNone: default: return NO; case AFSSLPinningModeCertificate: { NSMutableArray *pinnedCertificates = [NSMutableArray array]; for (NSData *certificateData in self.pinnedCertificates) { [pinnedCertificates addObject:(__bridge_transfer id)SecCertificateCreateWithData(NULL, (__bridge CFDataRef)certificateData)]; } SecTrustSetAnchorCertificates(serverTrust, (__bridge CFArrayRef)pinnedCertificates); if (!AFServerTrustIsValid(serverTrust)) { return NO; } // obtain the chain after being validated, which *should* contain the pinned certificate in the last position (if it's the Root CA) NSArray *serverCertificates = AFCertificateTrustChainForServerTrust(serverTrust); for (NSData *trustChainCertificate in [serverCertificates reverseObjectEnumerator]) { if ([self.pinnedCertificates containsObject:trustChainCertificate]) { return YES; } } return NO; } case AFSSLPinningModePublicKey: { NSUInteger trustedPublicKeyCount = 0; NSArray *publicKeys = AFPublicKeyTrustChainForServerTrust(serverTrust); for (id trustChainPublicKey in publicKeys) { for (id pinnedPublicKey in self.pinnedPublicKeys) { if (AFSecKeyIsEqualToKey((__bridge SecKeyRef)trustChainPublicKey, (__bridge SecKeyRef)pinnedPublicKey)) { trustedPublicKeyCount += 1; } } } return trustedPublicKeyCount > 0; } } return NO; } #pragma mark - NSKeyValueObserving + (NSSet *)keyPathsForValuesAffectingPinnedPublicKeys { return [NSSet setWithObject:@"pinnedCertificates"]; } #pragma mark - NSSecureCoding + (BOOL)supportsSecureCoding { return YES; } - (instancetype)initWithCoder:(NSCoder *)decoder { self = [self init]; if (!self) { return nil; } self.SSLPinningMode = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(SSLPinningMode))] unsignedIntegerValue]; self.allowInvalidCertificates = [decoder decodeBoolForKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; self.validatesDomainName = [decoder decodeBoolForKey:NSStringFromSelector(@selector(validatesDomainName))]; self.pinnedCertificates = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(pinnedCertificates))]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:[NSNumber numberWithUnsignedInteger:self.SSLPinningMode] forKey:NSStringFromSelector(@selector(SSLPinningMode))]; [coder encodeBool:self.allowInvalidCertificates forKey:NSStringFromSelector(@selector(allowInvalidCertificates))]; [coder encodeBool:self.validatesDomainName forKey:NSStringFromSelector(@selector(validatesDomainName))]; [coder encodeObject:self.pinnedCertificates forKey:NSStringFromSelector(@selector(pinnedCertificates))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFSecurityPolicy *securityPolicy = [[[self class] allocWithZone:zone] init]; securityPolicy.SSLPinningMode = self.SSLPinningMode; securityPolicy.allowInvalidCertificates = self.allowInvalidCertificates; securityPolicy.validatesDomainName = self.validatesDomainName; securityPolicy.pinnedCertificates = [self.pinnedCertificates copyWithZone:zone]; return securityPolicy; } @end ================================================ FILE: GCDAsyncSocket/AFNetworking/AFURLRequestSerialization.h ================================================ // AFURLRequestSerialization.h // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import #import #if TARGET_OS_IOS || TARGET_OS_TV #import #elif TARGET_OS_WATCH #import #endif NS_ASSUME_NONNULL_BEGIN /** Returns a percent-escaped string following RFC 3986 for a query string key or value. RFC 3986 states that the following characters are "reserved" characters. - General Delimiters: ":", "#", "[", "]", "@", "?", "/" - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" should be percent-escaped in the query string. @param string The string to be percent-escaped. @return The percent-escaped string. */ FOUNDATION_EXPORT NSString * AFPercentEscapedStringFromString(NSString *string); /** A helper method to generate encoded url query parameters for appending to the end of a URL. @param parameters A dictionary of key/values to be encoded. @return A url encoded query string */ FOUNDATION_EXPORT NSString * AFQueryStringFromParameters(NSDictionary *parameters); /** The `AFURLRequestSerialization` protocol is adopted by an object that encodes parameters for a specified HTTP requests. Request serializers may encode parameters as query strings, HTTP bodies, setting the appropriate HTTP header fields as necessary. For example, a JSON request serializer may set the HTTP body of the request to a JSON representation, and set the `Content-Type` HTTP header field value to `application/json`. */ @protocol AFURLRequestSerialization /** Returns a request with the specified parameters encoded into a copy of the original request. @param request The original request. @param parameters The parameters to be encoded. @param error The error that occurred while attempting to encode the request parameters. @return A serialized request. */ - (nullable NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request withParameters:(nullable id)parameters error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; @end #pragma mark - /** */ typedef NS_ENUM(NSUInteger, AFHTTPRequestQueryStringSerializationStyle) { AFHTTPRequestQueryStringDefaultStyle = 0, }; @protocol AFMultipartFormData; /** `AFHTTPRequestSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPRequestSerializer` in order to ensure consistent default behavior. */ @interface AFHTTPRequestSerializer : NSObject /** The string encoding used to serialize parameters. `NSUTF8StringEncoding` by default. */ @property (nonatomic, assign) NSStringEncoding stringEncoding; /** Whether created requests can use the device’s cellular radio (if present). `YES` by default. @see NSMutableURLRequest -setAllowsCellularAccess: */ @property (nonatomic, assign) BOOL allowsCellularAccess; /** The cache policy of created requests. `NSURLRequestUseProtocolCachePolicy` by default. @see NSMutableURLRequest -setCachePolicy: */ @property (nonatomic, assign) NSURLRequestCachePolicy cachePolicy; /** Whether created requests should use the default cookie handling. `YES` by default. @see NSMutableURLRequest -setHTTPShouldHandleCookies: */ @property (nonatomic, assign) BOOL HTTPShouldHandleCookies; /** Whether created requests can continue transmitting data before receiving a response from an earlier transmission. `NO` by default @see NSMutableURLRequest -setHTTPShouldUsePipelining: */ @property (nonatomic, assign) BOOL HTTPShouldUsePipelining; /** The network service type for created requests. `NSURLNetworkServiceTypeDefault` by default. @see NSMutableURLRequest -setNetworkServiceType: */ @property (nonatomic, assign) NSURLRequestNetworkServiceType networkServiceType; /** The timeout interval, in seconds, for created requests. The default timeout interval is 60 seconds. @see NSMutableURLRequest -setTimeoutInterval: */ @property (nonatomic, assign) NSTimeInterval timeoutInterval; ///--------------------------------------- /// @name Configuring HTTP Request Headers ///--------------------------------------- /** Default HTTP header field values to be applied to serialized requests. By default, these include the following: - `Accept-Language` with the contents of `NSLocale +preferredLanguages` - `User-Agent` with the contents of various bundle identifiers and OS designations @discussion To add or remove default request headers, use `setValue:forHTTPHeaderField:`. */ @property (readonly, nonatomic, strong) NSDictionary *HTTPRequestHeaders; /** Creates and returns a serializer with default configuration. */ + (instancetype)serializer; /** Sets the value for the HTTP headers set in request objects made by the HTTP client. If `nil`, removes the existing value for that header. @param field The HTTP header to set a default value for @param value The value set as default for the specified header, or `nil` */ - (void)setValue:(nullable NSString *)value forHTTPHeaderField:(NSString *)field; /** Returns the value for the HTTP headers set in the request serializer. @param field The HTTP header to retrieve the default value for @return The value set as default for the specified header, or `nil` */ - (nullable NSString *)valueForHTTPHeaderField:(NSString *)field; /** Sets the "Authorization" HTTP header set in request objects made by the HTTP client to a basic authentication value with Base64-encoded username and password. This overwrites any existing value for this header. @param username The HTTP basic auth username @param password The HTTP basic auth password */ - (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username password:(NSString *)password; /** Clears any existing value for the "Authorization" HTTP header. */ - (void)clearAuthorizationHeader; ///------------------------------------------------------- /// @name Configuring Query String Parameter Serialization ///------------------------------------------------------- /** HTTP methods for which serialized requests will encode parameters as a query string. `GET`, `HEAD`, and `DELETE` by default. */ @property (nonatomic, strong) NSSet *HTTPMethodsEncodingParametersInURI; /** Set the method of query string serialization according to one of the pre-defined styles. @param style The serialization style. @see AFHTTPRequestQueryStringSerializationStyle */ - (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style; /** Set the a custom method of query string serialization according to the specified block. @param block A block that defines a process of encoding parameters into a query string. This block returns the query string and takes three arguments: the request, the parameters to encode, and the error that occurred when attempting to encode parameters for the given request. */ - (void)setQueryStringSerializationWithBlock:(nullable NSString * (^)(NSURLRequest *request, id parameters, NSError * __autoreleasing *error))block; ///------------------------------- /// @name Creating Request Objects ///------------------------------- /** Creates an `NSMutableURLRequest` object with the specified HTTP method and URL string. If the HTTP method is `GET`, `HEAD`, or `DELETE`, the parameters will be used to construct a url-encoded query string that is appended to the request's URL. Otherwise, the parameters will be encoded according to the value of the `parameterEncoding` property, and set as the request body. @param method The HTTP method for the request, such as `GET`, `POST`, `PUT`, or `DELETE`. This parameter must not be `nil`. @param URLString The URL string used to create the request URL. @param parameters The parameters to be either set as a query string for `GET` requests, or the request HTTP body. @param error The error that occurred while constructing the request. @return An `NSMutableURLRequest` object. */ - (NSMutableURLRequest *)requestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(nullable id)parameters error:(NSError * _Nullable __autoreleasing *)error; /** Creates an `NSMutableURLRequest` object with the specified HTTP method and URLString, and constructs a `multipart/form-data` HTTP body, using the specified parameters and multipart form data block. See http://www.w3.org/TR/html4/interact/forms.html#h-17.13.4.2 Multipart form requests are automatically streamed, reading files directly from disk along with in-memory data in a single HTTP body. The resulting `NSMutableURLRequest` object has an `HTTPBodyStream` property, so refrain from setting `HTTPBodyStream` or `HTTPBody` on this request object, as it will clear out the multipart form body stream. @param method The HTTP method for the request. This parameter must not be `GET` or `HEAD`, or `nil`. @param URLString The URL string used to create the request URL. @param parameters The parameters to be encoded and set in the request HTTP body. @param block A block that takes a single argument and appends data to the HTTP body. The block argument is an object adopting the `AFMultipartFormData` protocol. @param error The error that occurred while constructing the request. @return An `NSMutableURLRequest` object */ - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(nullable NSDictionary *)parameters constructingBodyWithBlock:(nullable void (^)(id formData))block error:(NSError * _Nullable __autoreleasing *)error; /** Creates an `NSMutableURLRequest` by removing the `HTTPBodyStream` from a request, and asynchronously writing its contents into the specified file, invoking the completion handler when finished. @param request The multipart form request. The `HTTPBodyStream` property of `request` must not be `nil`. @param fileURL The file URL to write multipart form contents to. @param handler A handler block to execute. @discussion There is a bug in `NSURLSessionTask` that causes requests to not send a `Content-Length` header when streaming contents from an HTTP body, which is notably problematic when interacting with the Amazon S3 webservice. As a workaround, this method takes a request constructed with `multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:error:`, or any other request with an `HTTPBodyStream`, writes the contents to the specified file and returns a copy of the original request with the `HTTPBodyStream` property set to `nil`. From here, the file can either be passed to `AFURLSessionManager -uploadTaskWithRequest:fromFile:progress:completionHandler:`, or have its contents read into an `NSData` that's assigned to the `HTTPBody` property of the request. @see https://github.com/AFNetworking/AFNetworking/issues/1398 */ - (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request writingStreamContentsToFile:(NSURL *)fileURL completionHandler:(nullable void (^)(NSError * _Nullable error))handler; @end #pragma mark - /** The `AFMultipartFormData` protocol defines the methods supported by the parameter in the block argument of `AFHTTPRequestSerializer -multipartFormRequestWithMethod:URLString:parameters:constructingBodyWithBlock:`. */ @protocol AFMultipartFormData /** Appends the HTTP header `Content-Disposition: file; filename=#{generated filename}; name=#{name}"` and `Content-Type: #{generated mimeType}`, followed by the encoded file data and the multipart form boundary. The filename and MIME type for this data in the form will be automatically generated, using the last path component of the `fileURL` and system associated MIME type for the `fileURL` extension, respectively. @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. @param name The name to be associated with the specified data. This parameter must not be `nil`. @param error If an error occurs, upon return contains an `NSError` object that describes the problem. @return `YES` if the file data was successfully appended, otherwise `NO`. */ - (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name error:(NSError * _Nullable __autoreleasing *)error; /** Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. @param fileURL The URL corresponding to the file whose content will be appended to the form. This parameter must not be `nil`. @param name The name to be associated with the specified data. This parameter must not be `nil`. @param fileName The file name to be used in the `Content-Disposition` header. This parameter must not be `nil`. @param mimeType The declared MIME type of the file data. This parameter must not be `nil`. @param error If an error occurs, upon return contains an `NSError` object that describes the problem. @return `YES` if the file data was successfully appended otherwise `NO`. */ - (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType error:(NSError * _Nullable __autoreleasing *)error; /** Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the data from the input stream and the multipart form boundary. @param inputStream The input stream to be appended to the form data @param name The name to be associated with the specified input stream. This parameter must not be `nil`. @param fileName The filename to be associated with the specified input stream. This parameter must not be `nil`. @param length The length of the specified input stream in bytes. @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. */ - (void)appendPartWithInputStream:(nullable NSInputStream *)inputStream name:(NSString *)name fileName:(NSString *)fileName length:(int64_t)length mimeType:(NSString *)mimeType; /** Appends the HTTP header `Content-Disposition: file; filename=#{filename}; name=#{name}"` and `Content-Type: #{mimeType}`, followed by the encoded file data and the multipart form boundary. @param data The data to be encoded and appended to the form data. @param name The name to be associated with the specified data. This parameter must not be `nil`. @param fileName The filename to be associated with the specified data. This parameter must not be `nil`. @param mimeType The MIME type of the specified data. (For example, the MIME type for a JPEG image is image/jpeg.) For a list of valid MIME types, see http://www.iana.org/assignments/media-types/. This parameter must not be `nil`. */ - (void)appendPartWithFileData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType; /** Appends the HTTP headers `Content-Disposition: form-data; name=#{name}"`, followed by the encoded data and the multipart form boundary. @param data The data to be encoded and appended to the form data. @param name The name to be associated with the specified data. This parameter must not be `nil`. */ - (void)appendPartWithFormData:(NSData *)data name:(NSString *)name; /** Appends HTTP headers, followed by the encoded data and the multipart form boundary. @param headers The HTTP headers to be appended to the form data. @param body The data to be encoded and appended to the form data. This parameter must not be `nil`. */ - (void)appendPartWithHeaders:(nullable NSDictionary *)headers body:(NSData *)body; /** Throttles request bandwidth by limiting the packet size and adding a delay for each chunk read from the upload stream. When uploading over a 3G or EDGE connection, requests may fail with "request body stream exhausted". Setting a maximum packet size and delay according to the recommended values (`kAFUploadStream3GSuggestedPacketSize` and `kAFUploadStream3GSuggestedDelay`) lowers the risk of the input stream exceeding its allocated bandwidth. Unfortunately, there is no definite way to distinguish between a 3G, EDGE, or LTE connection over `NSURLConnection`. As such, it is not recommended that you throttle bandwidth based solely on network reachability. Instead, you should consider checking for the "request body stream exhausted" in a failure block, and then retrying the request with throttled bandwidth. @param numberOfBytes Maximum packet size, in number of bytes. The default packet size for an input stream is 16kb. @param delay Duration of delay each time a packet is read. By default, no delay is set. */ - (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes delay:(NSTimeInterval)delay; @end #pragma mark - /** `AFJSONRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSJSONSerialization`, setting the `Content-Type` of the encoded request to `application/json`. */ @interface AFJSONRequestSerializer : AFHTTPRequestSerializer /** Options for writing the request JSON data from Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONWritingOptions". `0` by default. */ @property (nonatomic, assign) NSJSONWritingOptions writingOptions; /** Creates and returns a JSON serializer with specified reading and writing options. @param writingOptions The specified JSON writing options. */ + (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions; @end #pragma mark - /** `AFPropertyListRequestSerializer` is a subclass of `AFHTTPRequestSerializer` that encodes parameters as JSON using `NSPropertyListSerializer`, setting the `Content-Type` of the encoded request to `application/x-plist`. */ @interface AFPropertyListRequestSerializer : AFHTTPRequestSerializer /** The property list format. Possible values are described in "NSPropertyListFormat". */ @property (nonatomic, assign) NSPropertyListFormat format; /** @warning The `writeOptions` property is currently unused. */ @property (nonatomic, assign) NSPropertyListWriteOptions writeOptions; /** Creates and returns a property list serializer with a specified format, read options, and write options. @param format The property list format. @param writeOptions The property list write options. @warning The `writeOptions` property is currently unused. */ + (instancetype)serializerWithFormat:(NSPropertyListFormat)format writeOptions:(NSPropertyListWriteOptions)writeOptions; @end #pragma mark - ///---------------- /// @name Constants ///---------------- /** ## Error Domains The following error domain is predefined. - `NSString * const AFURLRequestSerializationErrorDomain` ### Constants `AFURLRequestSerializationErrorDomain` AFURLRequestSerializer errors. Error codes for `AFURLRequestSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`. */ FOUNDATION_EXPORT NSString * const AFURLRequestSerializationErrorDomain; /** ## User info dictionary keys These keys may exist in the user info dictionary, in addition to those defined for NSError. - `NSString * const AFNetworkingOperationFailingURLRequestErrorKey` ### Constants `AFNetworkingOperationFailingURLRequestErrorKey` The corresponding value is an `NSURLRequest` containing the request of the operation associated with an error. This key is only present in the `AFURLRequestSerializationErrorDomain`. */ FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLRequestErrorKey; /** ## Throttling Bandwidth for HTTP Request Input Streams @see -throttleBandwidthWithPacketSize:delay: ### Constants `kAFUploadStream3GSuggestedPacketSize` Maximum packet size, in number of bytes. Equal to 16kb. `kAFUploadStream3GSuggestedDelay` Duration of delay each time a packet is read. Equal to 0.2 seconds. */ FOUNDATION_EXPORT NSUInteger const kAFUploadStream3GSuggestedPacketSize; FOUNDATION_EXPORT NSTimeInterval const kAFUploadStream3GSuggestedDelay; NS_ASSUME_NONNULL_END ================================================ FILE: GCDAsyncSocket/AFNetworking/AFURLRequestSerialization.m ================================================ // AFURLRequestSerialization.m // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import "AFURLRequestSerialization.h" #if TARGET_OS_IOS || TARGET_OS_WATCH || TARGET_OS_TV #import #else #import #endif NSString * const AFURLRequestSerializationErrorDomain = @"com.alamofire.error.serialization.request"; NSString * const AFNetworkingOperationFailingURLRequestErrorKey = @"com.alamofire.serialization.request.error.response"; typedef NSString * (^AFQueryStringSerializationBlock)(NSURLRequest *request, id parameters, NSError *__autoreleasing *error); /** Returns a percent-escaped string following RFC 3986 for a query string key or value. RFC 3986 states that the following characters are "reserved" characters. - General Delimiters: ":", "#", "[", "]", "@", "?", "/" - Sub-Delimiters: "!", "$", "&", "'", "(", ")", "*", "+", ",", ";", "=" In RFC 3986 - Section 3.4, it states that the "?" and "/" characters should not be escaped to allow query strings to include a URL. Therefore, all "reserved" characters with the exception of "?" and "/" should be percent-escaped in the query string. - parameter string: The string to be percent-escaped. - returns: The percent-escaped string. */ NSString * AFPercentEscapedStringFromString(NSString *string) { static NSString * const kAFCharactersGeneralDelimitersToEncode = @":#[]@"; // does not include "?" or "/" due to RFC 3986 - Section 3.4 static NSString * const kAFCharactersSubDelimitersToEncode = @"!$&'()*+,;="; NSMutableCharacterSet * allowedCharacterSet = [[NSCharacterSet URLQueryAllowedCharacterSet] mutableCopy]; [allowedCharacterSet removeCharactersInString:[kAFCharactersGeneralDelimitersToEncode stringByAppendingString:kAFCharactersSubDelimitersToEncode]]; // FIXME: https://github.com/AFNetworking/AFNetworking/pull/3028 // return [string stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; static NSUInteger const batchSize = 50; NSUInteger index = 0; NSMutableString *escaped = @"".mutableCopy; while (index < string.length) { NSUInteger length = MIN(string.length - index, batchSize); NSRange range = NSMakeRange(index, length); // To avoid breaking up character sequences such as 👴🏻👮🏽 range = [string rangeOfComposedCharacterSequencesForRange:range]; NSString *substring = [string substringWithRange:range]; NSString *encoded = [substring stringByAddingPercentEncodingWithAllowedCharacters:allowedCharacterSet]; [escaped appendString:encoded]; index += range.length; } return escaped; } #pragma mark - @interface AFQueryStringPair : NSObject @property (readwrite, nonatomic, strong) id field; @property (readwrite, nonatomic, strong) id value; - (instancetype)initWithField:(id)field value:(id)value; - (NSString *)URLEncodedStringValue; @end @implementation AFQueryStringPair - (instancetype)initWithField:(id)field value:(id)value { self = [super init]; if (!self) { return nil; } self.field = field; self.value = value; return self; } - (NSString *)URLEncodedStringValue { if (!self.value || [self.value isEqual:[NSNull null]]) { return AFPercentEscapedStringFromString([self.field description]); } else { return [NSString stringWithFormat:@"%@=%@", AFPercentEscapedStringFromString([self.field description]), AFPercentEscapedStringFromString([self.value description])]; } } @end #pragma mark - FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary); FOUNDATION_EXPORT NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value); NSString * AFQueryStringFromParameters(NSDictionary *parameters) { NSMutableArray *mutablePairs = [NSMutableArray array]; for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { [mutablePairs addObject:[pair URLEncodedStringValue]]; } return [mutablePairs componentsJoinedByString:@"&"]; } NSArray * AFQueryStringPairsFromDictionary(NSDictionary *dictionary) { return AFQueryStringPairsFromKeyAndValue(nil, dictionary); } NSArray * AFQueryStringPairsFromKeyAndValue(NSString *key, id value) { NSMutableArray *mutableQueryStringComponents = [NSMutableArray array]; NSSortDescriptor *sortDescriptor = [NSSortDescriptor sortDescriptorWithKey:@"description" ascending:YES selector:@selector(compare:)]; if ([value isKindOfClass:[NSDictionary class]]) { NSDictionary *dictionary = value; // Sort dictionary keys to ensure consistent ordering in query string, which is important when deserializing potentially ambiguous sequences, such as an array of dictionaries for (id nestedKey in [dictionary.allKeys sortedArrayUsingDescriptors:@[ sortDescriptor ]]) { id nestedValue = dictionary[nestedKey]; if (nestedValue) { [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue((key ? [NSString stringWithFormat:@"%@[%@]", key, nestedKey] : nestedKey), nestedValue)]; } } } else if ([value isKindOfClass:[NSArray class]]) { NSArray *array = value; for (id nestedValue in array) { [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue([NSString stringWithFormat:@"%@[]", key], nestedValue)]; } } else if ([value isKindOfClass:[NSSet class]]) { NSSet *set = value; for (id obj in [set sortedArrayUsingDescriptors:@[ sortDescriptor ]]) { [mutableQueryStringComponents addObjectsFromArray:AFQueryStringPairsFromKeyAndValue(key, obj)]; } } else { [mutableQueryStringComponents addObject:[[AFQueryStringPair alloc] initWithField:key value:value]]; } return mutableQueryStringComponents; } #pragma mark - @interface AFStreamingMultipartFormData : NSObject - (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest stringEncoding:(NSStringEncoding)encoding; - (NSMutableURLRequest *)requestByFinalizingMultipartFormData; @end #pragma mark - static NSArray * AFHTTPRequestSerializerObservedKeyPaths() { static NSArray *_AFHTTPRequestSerializerObservedKeyPaths = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ _AFHTTPRequestSerializerObservedKeyPaths = @[NSStringFromSelector(@selector(allowsCellularAccess)), NSStringFromSelector(@selector(cachePolicy)), NSStringFromSelector(@selector(HTTPShouldHandleCookies)), NSStringFromSelector(@selector(HTTPShouldUsePipelining)), NSStringFromSelector(@selector(networkServiceType)), NSStringFromSelector(@selector(timeoutInterval))]; }); return _AFHTTPRequestSerializerObservedKeyPaths; } static void *AFHTTPRequestSerializerObserverContext = &AFHTTPRequestSerializerObserverContext; @interface AFHTTPRequestSerializer () @property (readwrite, nonatomic, strong) NSMutableSet *mutableObservedChangedKeyPaths; @property (readwrite, nonatomic, strong) NSMutableDictionary *mutableHTTPRequestHeaders; @property (readwrite, nonatomic, strong) dispatch_queue_t requestHeaderModificationQueue; @property (readwrite, nonatomic, assign) AFHTTPRequestQueryStringSerializationStyle queryStringSerializationStyle; @property (readwrite, nonatomic, copy) AFQueryStringSerializationBlock queryStringSerialization; @end @implementation AFHTTPRequestSerializer + (instancetype)serializer { return [[self alloc] init]; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.stringEncoding = NSUTF8StringEncoding; self.mutableHTTPRequestHeaders = [NSMutableDictionary dictionary]; self.requestHeaderModificationQueue = dispatch_queue_create("requestHeaderModificationQueue", DISPATCH_QUEUE_CONCURRENT); // Accept-Language HTTP Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.4 NSMutableArray *acceptLanguagesComponents = [NSMutableArray array]; [[NSLocale preferredLanguages] enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { float q = 1.0f - (idx * 0.1f); [acceptLanguagesComponents addObject:[NSString stringWithFormat:@"%@;q=%0.1g", obj, q]]; *stop = q <= 0.5f; }]; [self setValue:[acceptLanguagesComponents componentsJoinedByString:@", "] forHTTPHeaderField:@"Accept-Language"]; NSString *userAgent = nil; #if TARGET_OS_IOS // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 userAgent = [NSString stringWithFormat:@"%@/%@ (%@; iOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[UIDevice currentDevice] model], [[UIDevice currentDevice] systemVersion], [[UIScreen mainScreen] scale]]; #elif TARGET_OS_WATCH // User-Agent Header; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.43 userAgent = [NSString stringWithFormat:@"%@/%@ (%@; watchOS %@; Scale/%0.2f)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[WKInterfaceDevice currentDevice] model], [[WKInterfaceDevice currentDevice] systemVersion], [[WKInterfaceDevice currentDevice] screenScale]]; #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) userAgent = [NSString stringWithFormat:@"%@/%@ (Mac OS X %@)", [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleExecutableKey] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleIdentifierKey], [[NSBundle mainBundle] infoDictionary][@"CFBundleShortVersionString"] ?: [[NSBundle mainBundle] infoDictionary][(__bridge NSString *)kCFBundleVersionKey], [[NSProcessInfo processInfo] operatingSystemVersionString]]; #endif if (userAgent) { if (![userAgent canBeConvertedToEncoding:NSASCIIStringEncoding]) { NSMutableString *mutableUserAgent = [userAgent mutableCopy]; if (CFStringTransform((__bridge CFMutableStringRef)(mutableUserAgent), NULL, (__bridge CFStringRef)@"Any-Latin; Latin-ASCII; [:^ASCII:] Remove", false)) { userAgent = mutableUserAgent; } } [self setValue:userAgent forHTTPHeaderField:@"User-Agent"]; } // HTTP Method Definitions; see http://www.w3.org/Protocols/rfc2616/rfc2616-sec9.html self.HTTPMethodsEncodingParametersInURI = [NSSet setWithObjects:@"GET", @"HEAD", @"DELETE", nil]; self.mutableObservedChangedKeyPaths = [NSMutableSet set]; for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { if ([self respondsToSelector:NSSelectorFromString(keyPath)]) { [self addObserver:self forKeyPath:keyPath options:NSKeyValueObservingOptionNew context:AFHTTPRequestSerializerObserverContext]; } } return self; } - (void)dealloc { for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { if ([self respondsToSelector:NSSelectorFromString(keyPath)]) { [self removeObserver:self forKeyPath:keyPath context:AFHTTPRequestSerializerObserverContext]; } } } #pragma mark - // Workarounds for crashing behavior using Key-Value Observing with XCTest // See https://github.com/AFNetworking/AFNetworking/issues/2523 - (void)setAllowsCellularAccess:(BOOL)allowsCellularAccess { [self willChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))]; _allowsCellularAccess = allowsCellularAccess; [self didChangeValueForKey:NSStringFromSelector(@selector(allowsCellularAccess))]; } - (void)setCachePolicy:(NSURLRequestCachePolicy)cachePolicy { [self willChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))]; _cachePolicy = cachePolicy; [self didChangeValueForKey:NSStringFromSelector(@selector(cachePolicy))]; } - (void)setHTTPShouldHandleCookies:(BOOL)HTTPShouldHandleCookies { [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))]; _HTTPShouldHandleCookies = HTTPShouldHandleCookies; [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldHandleCookies))]; } - (void)setHTTPShouldUsePipelining:(BOOL)HTTPShouldUsePipelining { [self willChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))]; _HTTPShouldUsePipelining = HTTPShouldUsePipelining; [self didChangeValueForKey:NSStringFromSelector(@selector(HTTPShouldUsePipelining))]; } - (void)setNetworkServiceType:(NSURLRequestNetworkServiceType)networkServiceType { [self willChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))]; _networkServiceType = networkServiceType; [self didChangeValueForKey:NSStringFromSelector(@selector(networkServiceType))]; } - (void)setTimeoutInterval:(NSTimeInterval)timeoutInterval { [self willChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))]; _timeoutInterval = timeoutInterval; [self didChangeValueForKey:NSStringFromSelector(@selector(timeoutInterval))]; } #pragma mark - - (NSDictionary *)HTTPRequestHeaders { NSDictionary __block *value; dispatch_sync(self.requestHeaderModificationQueue, ^{ value = [NSDictionary dictionaryWithDictionary:self.mutableHTTPRequestHeaders]; }); return value; } - (void)setValue:(NSString *)value forHTTPHeaderField:(NSString *)field { dispatch_barrier_async(self.requestHeaderModificationQueue, ^{ [self.mutableHTTPRequestHeaders setValue:value forKey:field]; }); } - (NSString *)valueForHTTPHeaderField:(NSString *)field { NSString __block *value; dispatch_sync(self.requestHeaderModificationQueue, ^{ value = [self.mutableHTTPRequestHeaders valueForKey:field]; }); return value; } - (void)setAuthorizationHeaderFieldWithUsername:(NSString *)username password:(NSString *)password { NSData *basicAuthCredentials = [[NSString stringWithFormat:@"%@:%@", username, password] dataUsingEncoding:NSUTF8StringEncoding]; NSString *base64AuthCredentials = [basicAuthCredentials base64EncodedStringWithOptions:(NSDataBase64EncodingOptions)0]; [self setValue:[NSString stringWithFormat:@"Basic %@", base64AuthCredentials] forHTTPHeaderField:@"Authorization"]; } - (void)clearAuthorizationHeader { dispatch_barrier_async(self.requestHeaderModificationQueue, ^{ [self.mutableHTTPRequestHeaders removeObjectForKey:@"Authorization"]; }); } #pragma mark - - (void)setQueryStringSerializationWithStyle:(AFHTTPRequestQueryStringSerializationStyle)style { self.queryStringSerializationStyle = style; self.queryStringSerialization = nil; } - (void)setQueryStringSerializationWithBlock:(NSString *(^)(NSURLRequest *, id, NSError *__autoreleasing *))block { self.queryStringSerialization = block; } #pragma mark - - (NSMutableURLRequest *)requestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(id)parameters error:(NSError *__autoreleasing *)error { NSParameterAssert(method); NSParameterAssert(URLString); NSURL *url = [NSURL URLWithString:URLString]; NSParameterAssert(url); NSMutableURLRequest *mutableRequest = [[NSMutableURLRequest alloc] initWithURL:url]; mutableRequest.HTTPMethod = method; for (NSString *keyPath in AFHTTPRequestSerializerObservedKeyPaths()) { if ([self.mutableObservedChangedKeyPaths containsObject:keyPath]) { [mutableRequest setValue:[self valueForKeyPath:keyPath] forKey:keyPath]; } } mutableRequest = [[self requestBySerializingRequest:mutableRequest withParameters:parameters error:error] mutableCopy]; return mutableRequest; } - (NSMutableURLRequest *)multipartFormRequestWithMethod:(NSString *)method URLString:(NSString *)URLString parameters:(NSDictionary *)parameters constructingBodyWithBlock:(void (^)(id formData))block error:(NSError *__autoreleasing *)error { NSParameterAssert(method); NSParameterAssert(![method isEqualToString:@"GET"] && ![method isEqualToString:@"HEAD"]); NSMutableURLRequest *mutableRequest = [self requestWithMethod:method URLString:URLString parameters:nil error:error]; __block AFStreamingMultipartFormData *formData = [[AFStreamingMultipartFormData alloc] initWithURLRequest:mutableRequest stringEncoding:NSUTF8StringEncoding]; if (parameters) { for (AFQueryStringPair *pair in AFQueryStringPairsFromDictionary(parameters)) { NSData *data = nil; if ([pair.value isKindOfClass:[NSData class]]) { data = pair.value; } else if ([pair.value isEqual:[NSNull null]]) { data = [NSData data]; } else { data = [[pair.value description] dataUsingEncoding:self.stringEncoding]; } if (data) { [formData appendPartWithFormData:data name:[pair.field description]]; } } } if (block) { block(formData); } return [formData requestByFinalizingMultipartFormData]; } - (NSMutableURLRequest *)requestWithMultipartFormRequest:(NSURLRequest *)request writingStreamContentsToFile:(NSURL *)fileURL completionHandler:(void (^)(NSError *error))handler { NSParameterAssert(request.HTTPBodyStream); NSParameterAssert([fileURL isFileURL]); NSInputStream *inputStream = request.HTTPBodyStream; NSOutputStream *outputStream = [[NSOutputStream alloc] initWithURL:fileURL append:NO]; __block NSError *error = nil; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [outputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSDefaultRunLoopMode]; [inputStream open]; [outputStream open]; while ([inputStream hasBytesAvailable] && [outputStream hasSpaceAvailable]) { uint8_t buffer[1024]; NSInteger bytesRead = [inputStream read:buffer maxLength:1024]; if (inputStream.streamError || bytesRead < 0) { error = inputStream.streamError; break; } NSInteger bytesWritten = [outputStream write:buffer maxLength:(NSUInteger)bytesRead]; if (outputStream.streamError || bytesWritten < 0) { error = outputStream.streamError; break; } if (bytesRead == 0 && bytesWritten == 0) { break; } } [outputStream close]; [inputStream close]; if (handler) { dispatch_async(dispatch_get_main_queue(), ^{ handler(error); }); } }); NSMutableURLRequest *mutableRequest = [request mutableCopy]; mutableRequest.HTTPBodyStream = nil; return mutableRequest; } #pragma mark - AFURLRequestSerialization - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request withParameters:(id)parameters error:(NSError *__autoreleasing *)error { NSParameterAssert(request); NSMutableURLRequest *mutableRequest = [request mutableCopy]; [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { if (![request valueForHTTPHeaderField:field]) { [mutableRequest setValue:value forHTTPHeaderField:field]; } }]; NSString *query = nil; if (parameters) { if (self.queryStringSerialization) { NSError *serializationError; query = self.queryStringSerialization(request, parameters, &serializationError); if (serializationError) { if (error) { *error = serializationError; } return nil; } } else { switch (self.queryStringSerializationStyle) { case AFHTTPRequestQueryStringDefaultStyle: query = AFQueryStringFromParameters(parameters); break; } } } if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { if (query && query.length > 0) { mutableRequest.URL = [NSURL URLWithString:[[mutableRequest.URL absoluteString] stringByAppendingFormat:mutableRequest.URL.query ? @"&%@" : @"?%@", query]]; } } else { // #2864: an empty string is a valid x-www-form-urlencoded payload if (!query) { query = @""; } if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) { [mutableRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"]; } [mutableRequest setHTTPBody:[query dataUsingEncoding:self.stringEncoding]]; } return mutableRequest; } #pragma mark - NSKeyValueObserving + (BOOL)automaticallyNotifiesObserversForKey:(NSString *)key { if ([AFHTTPRequestSerializerObservedKeyPaths() containsObject:key]) { return NO; } return [super automaticallyNotifiesObserversForKey:key]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(__unused id)object change:(NSDictionary *)change context:(void *)context { if (context == AFHTTPRequestSerializerObserverContext) { if ([change[NSKeyValueChangeNewKey] isEqual:[NSNull null]]) { [self.mutableObservedChangedKeyPaths removeObject:keyPath]; } else { [self.mutableObservedChangedKeyPaths addObject:keyPath]; } } } #pragma mark - NSSecureCoding + (BOOL)supportsSecureCoding { return YES; } - (instancetype)initWithCoder:(NSCoder *)decoder { self = [self init]; if (!self) { return nil; } self.mutableHTTPRequestHeaders = [[decoder decodeObjectOfClass:[NSDictionary class] forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))] mutableCopy]; self.queryStringSerializationStyle = (AFHTTPRequestQueryStringSerializationStyle)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))] unsignedIntegerValue]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { dispatch_sync(self.requestHeaderModificationQueue, ^{ [coder encodeObject:self.mutableHTTPRequestHeaders forKey:NSStringFromSelector(@selector(mutableHTTPRequestHeaders))]; }); [coder encodeInteger:self.queryStringSerializationStyle forKey:NSStringFromSelector(@selector(queryStringSerializationStyle))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFHTTPRequestSerializer *serializer = [[[self class] allocWithZone:zone] init]; dispatch_sync(self.requestHeaderModificationQueue, ^{ serializer.mutableHTTPRequestHeaders = [self.mutableHTTPRequestHeaders mutableCopyWithZone:zone]; }); serializer.queryStringSerializationStyle = self.queryStringSerializationStyle; serializer.queryStringSerialization = self.queryStringSerialization; return serializer; } @end #pragma mark - static NSString * AFCreateMultipartFormBoundary() { return [NSString stringWithFormat:@"Boundary+%08X%08X", arc4random(), arc4random()]; } static NSString * const kAFMultipartFormCRLF = @"\r\n"; static inline NSString * AFMultipartFormInitialBoundary(NSString *boundary) { return [NSString stringWithFormat:@"--%@%@", boundary, kAFMultipartFormCRLF]; } static inline NSString * AFMultipartFormEncapsulationBoundary(NSString *boundary) { return [NSString stringWithFormat:@"%@--%@%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF]; } static inline NSString * AFMultipartFormFinalBoundary(NSString *boundary) { return [NSString stringWithFormat:@"%@--%@--%@", kAFMultipartFormCRLF, boundary, kAFMultipartFormCRLF]; } static inline NSString * AFContentTypeForPathExtension(NSString *extension) { NSString *UTI = (__bridge_transfer NSString *)UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, (__bridge CFStringRef)extension, NULL); NSString *contentType = (__bridge_transfer NSString *)UTTypeCopyPreferredTagWithClass((__bridge CFStringRef)UTI, kUTTagClassMIMEType); if (!contentType) { return @"application/octet-stream"; } else { return contentType; } } NSUInteger const kAFUploadStream3GSuggestedPacketSize = 1024 * 16; NSTimeInterval const kAFUploadStream3GSuggestedDelay = 0.2; @interface AFHTTPBodyPart : NSObject @property (nonatomic, assign) NSStringEncoding stringEncoding; @property (nonatomic, strong) NSDictionary *headers; @property (nonatomic, copy) NSString *boundary; @property (nonatomic, strong) id body; @property (nonatomic, assign) unsigned long long bodyContentLength; @property (nonatomic, strong) NSInputStream *inputStream; @property (nonatomic, assign) BOOL hasInitialBoundary; @property (nonatomic, assign) BOOL hasFinalBoundary; @property (readonly, nonatomic, assign, getter = hasBytesAvailable) BOOL bytesAvailable; @property (readonly, nonatomic, assign) unsigned long long contentLength; - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)length; @end @interface AFMultipartBodyStream : NSInputStream @property (nonatomic, assign) NSUInteger numberOfBytesInPacket; @property (nonatomic, assign) NSTimeInterval delay; @property (nonatomic, strong) NSInputStream *inputStream; @property (readonly, nonatomic, assign) unsigned long long contentLength; @property (readonly, nonatomic, assign, getter = isEmpty) BOOL empty; - (instancetype)initWithStringEncoding:(NSStringEncoding)encoding; - (void)setInitialAndFinalBoundaries; - (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart; @end #pragma mark - @interface AFStreamingMultipartFormData () @property (readwrite, nonatomic, copy) NSMutableURLRequest *request; @property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; @property (readwrite, nonatomic, copy) NSString *boundary; @property (readwrite, nonatomic, strong) AFMultipartBodyStream *bodyStream; @end @implementation AFStreamingMultipartFormData - (instancetype)initWithURLRequest:(NSMutableURLRequest *)urlRequest stringEncoding:(NSStringEncoding)encoding { self = [super init]; if (!self) { return nil; } self.request = urlRequest; self.stringEncoding = encoding; self.boundary = AFCreateMultipartFormBoundary(); self.bodyStream = [[AFMultipartBodyStream alloc] initWithStringEncoding:encoding]; return self; } - (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name error:(NSError * __autoreleasing *)error { NSParameterAssert(fileURL); NSParameterAssert(name); NSString *fileName = [fileURL lastPathComponent]; NSString *mimeType = AFContentTypeForPathExtension([fileURL pathExtension]); return [self appendPartWithFileURL:fileURL name:name fileName:fileName mimeType:mimeType error:error]; } - (BOOL)appendPartWithFileURL:(NSURL *)fileURL name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType error:(NSError * __autoreleasing *)error { NSParameterAssert(fileURL); NSParameterAssert(name); NSParameterAssert(fileName); NSParameterAssert(mimeType); if (![fileURL isFileURL]) { NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"Expected URL to be a file URL", @"AFNetworking", nil)}; if (error) { *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; } return NO; } else if ([fileURL checkResourceIsReachableAndReturnError:error] == NO) { NSDictionary *userInfo = @{NSLocalizedFailureReasonErrorKey: NSLocalizedStringFromTable(@"File URL not reachable.", @"AFNetworking", nil)}; if (error) { *error = [[NSError alloc] initWithDomain:AFURLRequestSerializationErrorDomain code:NSURLErrorBadURL userInfo:userInfo]; } return NO; } NSDictionary *fileAttributes = [[NSFileManager defaultManager] attributesOfItemAtPath:[fileURL path] error:error]; if (!fileAttributes) { return NO; } NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; bodyPart.stringEncoding = self.stringEncoding; bodyPart.headers = mutableHeaders; bodyPart.boundary = self.boundary; bodyPart.body = fileURL; bodyPart.bodyContentLength = [fileAttributes[NSFileSize] unsignedLongLongValue]; [self.bodyStream appendHTTPBodyPart:bodyPart]; return YES; } - (void)appendPartWithInputStream:(NSInputStream *)inputStream name:(NSString *)name fileName:(NSString *)fileName length:(int64_t)length mimeType:(NSString *)mimeType { NSParameterAssert(name); NSParameterAssert(fileName); NSParameterAssert(mimeType); NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; bodyPart.stringEncoding = self.stringEncoding; bodyPart.headers = mutableHeaders; bodyPart.boundary = self.boundary; bodyPart.body = inputStream; bodyPart.bodyContentLength = (unsigned long long)length; [self.bodyStream appendHTTPBodyPart:bodyPart]; } - (void)appendPartWithFileData:(NSData *)data name:(NSString *)name fileName:(NSString *)fileName mimeType:(NSString *)mimeType { NSParameterAssert(name); NSParameterAssert(fileName); NSParameterAssert(mimeType); NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"; filename=\"%@\"", name, fileName] forKey:@"Content-Disposition"]; [mutableHeaders setValue:mimeType forKey:@"Content-Type"]; [self appendPartWithHeaders:mutableHeaders body:data]; } - (void)appendPartWithFormData:(NSData *)data name:(NSString *)name { NSParameterAssert(name); NSMutableDictionary *mutableHeaders = [NSMutableDictionary dictionary]; [mutableHeaders setValue:[NSString stringWithFormat:@"form-data; name=\"%@\"", name] forKey:@"Content-Disposition"]; [self appendPartWithHeaders:mutableHeaders body:data]; } - (void)appendPartWithHeaders:(NSDictionary *)headers body:(NSData *)body { NSParameterAssert(body); AFHTTPBodyPart *bodyPart = [[AFHTTPBodyPart alloc] init]; bodyPart.stringEncoding = self.stringEncoding; bodyPart.headers = headers; bodyPart.boundary = self.boundary; bodyPart.bodyContentLength = [body length]; bodyPart.body = body; [self.bodyStream appendHTTPBodyPart:bodyPart]; } - (void)throttleBandwidthWithPacketSize:(NSUInteger)numberOfBytes delay:(NSTimeInterval)delay { self.bodyStream.numberOfBytesInPacket = numberOfBytes; self.bodyStream.delay = delay; } - (NSMutableURLRequest *)requestByFinalizingMultipartFormData { if ([self.bodyStream isEmpty]) { return self.request; } // Reset the initial and final boundaries to ensure correct Content-Length [self.bodyStream setInitialAndFinalBoundaries]; [self.request setHTTPBodyStream:self.bodyStream]; [self.request setValue:[NSString stringWithFormat:@"multipart/form-data; boundary=%@", self.boundary] forHTTPHeaderField:@"Content-Type"]; [self.request setValue:[NSString stringWithFormat:@"%llu", [self.bodyStream contentLength]] forHTTPHeaderField:@"Content-Length"]; return self.request; } @end #pragma mark - @interface NSStream () @property (readwrite) NSStreamStatus streamStatus; @property (readwrite, copy) NSError *streamError; @end @interface AFMultipartBodyStream () @property (readwrite, nonatomic, assign) NSStringEncoding stringEncoding; @property (readwrite, nonatomic, strong) NSMutableArray *HTTPBodyParts; @property (readwrite, nonatomic, strong) NSEnumerator *HTTPBodyPartEnumerator; @property (readwrite, nonatomic, strong) AFHTTPBodyPart *currentHTTPBodyPart; @property (readwrite, nonatomic, strong) NSOutputStream *outputStream; @property (readwrite, nonatomic, strong) NSMutableData *buffer; @end @implementation AFMultipartBodyStream #if (defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && __IPHONE_OS_VERSION_MAX_ALLOWED >= 80000) || (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1100) @synthesize delegate; #endif @synthesize streamStatus; @synthesize streamError; - (instancetype)initWithStringEncoding:(NSStringEncoding)encoding { self = [super init]; if (!self) { return nil; } self.stringEncoding = encoding; self.HTTPBodyParts = [NSMutableArray array]; self.numberOfBytesInPacket = NSIntegerMax; return self; } - (void)setInitialAndFinalBoundaries { if ([self.HTTPBodyParts count] > 0) { for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { bodyPart.hasInitialBoundary = NO; bodyPart.hasFinalBoundary = NO; } [[self.HTTPBodyParts firstObject] setHasInitialBoundary:YES]; [[self.HTTPBodyParts lastObject] setHasFinalBoundary:YES]; } } - (void)appendHTTPBodyPart:(AFHTTPBodyPart *)bodyPart { [self.HTTPBodyParts addObject:bodyPart]; } - (BOOL)isEmpty { return [self.HTTPBodyParts count] == 0; } #pragma mark - NSInputStream - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)length { if ([self streamStatus] == NSStreamStatusClosed) { return 0; } NSInteger totalNumberOfBytesRead = 0; while ((NSUInteger)totalNumberOfBytesRead < MIN(length, self.numberOfBytesInPacket)) { if (!self.currentHTTPBodyPart || ![self.currentHTTPBodyPart hasBytesAvailable]) { if (!(self.currentHTTPBodyPart = [self.HTTPBodyPartEnumerator nextObject])) { break; } } else { NSUInteger maxLength = MIN(length, self.numberOfBytesInPacket) - (NSUInteger)totalNumberOfBytesRead; NSInteger numberOfBytesRead = [self.currentHTTPBodyPart read:&buffer[totalNumberOfBytesRead] maxLength:maxLength]; if (numberOfBytesRead == -1) { self.streamError = self.currentHTTPBodyPart.inputStream.streamError; break; } else { totalNumberOfBytesRead += numberOfBytesRead; if (self.delay > 0.0f) { [NSThread sleepForTimeInterval:self.delay]; } } } } return totalNumberOfBytesRead; } - (BOOL)getBuffer:(__unused uint8_t **)buffer length:(__unused NSUInteger *)len { return NO; } - (BOOL)hasBytesAvailable { return [self streamStatus] == NSStreamStatusOpen; } #pragma mark - NSStream - (void)open { if (self.streamStatus == NSStreamStatusOpen) { return; } self.streamStatus = NSStreamStatusOpen; [self setInitialAndFinalBoundaries]; self.HTTPBodyPartEnumerator = [self.HTTPBodyParts objectEnumerator]; } - (void)close { self.streamStatus = NSStreamStatusClosed; } - (id)propertyForKey:(__unused NSString *)key { return nil; } - (BOOL)setProperty:(__unused id)property forKey:(__unused NSString *)key { return NO; } - (void)scheduleInRunLoop:(__unused NSRunLoop *)aRunLoop forMode:(__unused NSString *)mode {} - (void)removeFromRunLoop:(__unused NSRunLoop *)aRunLoop forMode:(__unused NSString *)mode {} - (unsigned long long)contentLength { unsigned long long length = 0; for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { length += [bodyPart contentLength]; } return length; } #pragma mark - Undocumented CFReadStream Bridged Methods - (void)_scheduleInCFRunLoop:(__unused CFRunLoopRef)aRunLoop forMode:(__unused CFStringRef)aMode {} - (void)_unscheduleFromCFRunLoop:(__unused CFRunLoopRef)aRunLoop forMode:(__unused CFStringRef)aMode {} - (BOOL)_setCFClientFlags:(__unused CFOptionFlags)inFlags callback:(__unused CFReadStreamClientCallBack)inCallback context:(__unused CFStreamClientContext *)inContext { return NO; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFMultipartBodyStream *bodyStreamCopy = [[[self class] allocWithZone:zone] initWithStringEncoding:self.stringEncoding]; for (AFHTTPBodyPart *bodyPart in self.HTTPBodyParts) { [bodyStreamCopy appendHTTPBodyPart:[bodyPart copy]]; } [bodyStreamCopy setInitialAndFinalBoundaries]; return bodyStreamCopy; } @end #pragma mark - typedef enum { AFEncapsulationBoundaryPhase = 1, AFHeaderPhase = 2, AFBodyPhase = 3, AFFinalBoundaryPhase = 4, } AFHTTPBodyPartReadPhase; @interface AFHTTPBodyPart () { AFHTTPBodyPartReadPhase _phase; NSInputStream *_inputStream; unsigned long long _phaseReadOffset; } - (BOOL)transitionToNextPhase; - (NSInteger)readData:(NSData *)data intoBuffer:(uint8_t *)buffer maxLength:(NSUInteger)length; @end @implementation AFHTTPBodyPart - (instancetype)init { self = [super init]; if (!self) { return nil; } [self transitionToNextPhase]; return self; } - (void)dealloc { if (_inputStream) { [_inputStream close]; _inputStream = nil; } } - (NSInputStream *)inputStream { if (!_inputStream) { if ([self.body isKindOfClass:[NSData class]]) { _inputStream = [NSInputStream inputStreamWithData:self.body]; } else if ([self.body isKindOfClass:[NSURL class]]) { _inputStream = [NSInputStream inputStreamWithURL:self.body]; } else if ([self.body isKindOfClass:[NSInputStream class]]) { _inputStream = self.body; } else { _inputStream = [NSInputStream inputStreamWithData:[NSData data]]; } } return _inputStream; } - (NSString *)stringForHeaders { NSMutableString *headerString = [NSMutableString string]; for (NSString *field in [self.headers allKeys]) { [headerString appendString:[NSString stringWithFormat:@"%@: %@%@", field, [self.headers valueForKey:field], kAFMultipartFormCRLF]]; } [headerString appendString:kAFMultipartFormCRLF]; return [NSString stringWithString:headerString]; } - (unsigned long long)contentLength { unsigned long long length = 0; NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding]; length += [encapsulationBoundaryData length]; NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; length += [headersData length]; length += _bodyContentLength; NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]); length += [closingBoundaryData length]; return length; } - (BOOL)hasBytesAvailable { // Allows `read:maxLength:` to be called again if `AFMultipartFormFinalBoundary` doesn't fit into the available buffer if (_phase == AFFinalBoundaryPhase) { return YES; } switch (self.inputStream.streamStatus) { case NSStreamStatusNotOpen: case NSStreamStatusOpening: case NSStreamStatusOpen: case NSStreamStatusReading: case NSStreamStatusWriting: return YES; case NSStreamStatusAtEnd: case NSStreamStatusClosed: case NSStreamStatusError: default: return NO; } } - (NSInteger)read:(uint8_t *)buffer maxLength:(NSUInteger)length { NSInteger totalNumberOfBytesRead = 0; if (_phase == AFEncapsulationBoundaryPhase) { NSData *encapsulationBoundaryData = [([self hasInitialBoundary] ? AFMultipartFormInitialBoundary(self.boundary) : AFMultipartFormEncapsulationBoundary(self.boundary)) dataUsingEncoding:self.stringEncoding]; totalNumberOfBytesRead += [self readData:encapsulationBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; } if (_phase == AFHeaderPhase) { NSData *headersData = [[self stringForHeaders] dataUsingEncoding:self.stringEncoding]; totalNumberOfBytesRead += [self readData:headersData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; } if (_phase == AFBodyPhase) { NSInteger numberOfBytesRead = 0; numberOfBytesRead = [self.inputStream read:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; if (numberOfBytesRead == -1) { return -1; } else { totalNumberOfBytesRead += numberOfBytesRead; if ([self.inputStream streamStatus] >= NSStreamStatusAtEnd) { [self transitionToNextPhase]; } } } if (_phase == AFFinalBoundaryPhase) { NSData *closingBoundaryData = ([self hasFinalBoundary] ? [AFMultipartFormFinalBoundary(self.boundary) dataUsingEncoding:self.stringEncoding] : [NSData data]); totalNumberOfBytesRead += [self readData:closingBoundaryData intoBuffer:&buffer[totalNumberOfBytesRead] maxLength:(length - (NSUInteger)totalNumberOfBytesRead)]; } return totalNumberOfBytesRead; } - (NSInteger)readData:(NSData *)data intoBuffer:(uint8_t *)buffer maxLength:(NSUInteger)length { NSRange range = NSMakeRange((NSUInteger)_phaseReadOffset, MIN([data length] - ((NSUInteger)_phaseReadOffset), length)); [data getBytes:buffer range:range]; _phaseReadOffset += range.length; if (((NSUInteger)_phaseReadOffset) >= [data length]) { [self transitionToNextPhase]; } return (NSInteger)range.length; } - (BOOL)transitionToNextPhase { if (![[NSThread currentThread] isMainThread]) { dispatch_sync(dispatch_get_main_queue(), ^{ [self transitionToNextPhase]; }); return YES; } switch (_phase) { case AFEncapsulationBoundaryPhase: _phase = AFHeaderPhase; break; case AFHeaderPhase: [self.inputStream scheduleInRunLoop:[NSRunLoop currentRunLoop] forMode:NSRunLoopCommonModes]; [self.inputStream open]; _phase = AFBodyPhase; break; case AFBodyPhase: [self.inputStream close]; _phase = AFFinalBoundaryPhase; break; case AFFinalBoundaryPhase: default: _phase = AFEncapsulationBoundaryPhase; break; } _phaseReadOffset = 0; return YES; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFHTTPBodyPart *bodyPart = [[[self class] allocWithZone:zone] init]; bodyPart.stringEncoding = self.stringEncoding; bodyPart.headers = self.headers; bodyPart.bodyContentLength = self.bodyContentLength; bodyPart.body = self.body; bodyPart.boundary = self.boundary; return bodyPart; } @end #pragma mark - @implementation AFJSONRequestSerializer + (instancetype)serializer { return [self serializerWithWritingOptions:(NSJSONWritingOptions)0]; } + (instancetype)serializerWithWritingOptions:(NSJSONWritingOptions)writingOptions { AFJSONRequestSerializer *serializer = [[self alloc] init]; serializer.writingOptions = writingOptions; return serializer; } #pragma mark - AFURLRequestSerialization - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request withParameters:(id)parameters error:(NSError *__autoreleasing *)error { NSParameterAssert(request); if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { return [super requestBySerializingRequest:request withParameters:parameters error:error]; } NSMutableURLRequest *mutableRequest = [request mutableCopy]; [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { if (![request valueForHTTPHeaderField:field]) { [mutableRequest setValue:value forHTTPHeaderField:field]; } }]; if (parameters) { if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) { [mutableRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"]; } [mutableRequest setHTTPBody:[NSJSONSerialization dataWithJSONObject:parameters options:self.writingOptions error:error]]; } return mutableRequest; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } self.writingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writingOptions))] unsignedIntegerValue]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeInteger:self.writingOptions forKey:NSStringFromSelector(@selector(writingOptions))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFJSONRequestSerializer *serializer = [super copyWithZone:zone]; serializer.writingOptions = self.writingOptions; return serializer; } @end #pragma mark - @implementation AFPropertyListRequestSerializer + (instancetype)serializer { return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 writeOptions:0]; } + (instancetype)serializerWithFormat:(NSPropertyListFormat)format writeOptions:(NSPropertyListWriteOptions)writeOptions { AFPropertyListRequestSerializer *serializer = [[self alloc] init]; serializer.format = format; serializer.writeOptions = writeOptions; return serializer; } #pragma mark - AFURLRequestSerializer - (NSURLRequest *)requestBySerializingRequest:(NSURLRequest *)request withParameters:(id)parameters error:(NSError *__autoreleasing *)error { NSParameterAssert(request); if ([self.HTTPMethodsEncodingParametersInURI containsObject:[[request HTTPMethod] uppercaseString]]) { return [super requestBySerializingRequest:request withParameters:parameters error:error]; } NSMutableURLRequest *mutableRequest = [request mutableCopy]; [self.HTTPRequestHeaders enumerateKeysAndObjectsUsingBlock:^(id field, id value, BOOL * __unused stop) { if (![request valueForHTTPHeaderField:field]) { [mutableRequest setValue:value forHTTPHeaderField:field]; } }]; if (parameters) { if (![mutableRequest valueForHTTPHeaderField:@"Content-Type"]) { [mutableRequest setValue:@"application/x-plist" forHTTPHeaderField:@"Content-Type"]; } [mutableRequest setHTTPBody:[NSPropertyListSerialization dataWithPropertyList:parameters format:self.format options:self.writeOptions error:error]]; } return mutableRequest; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue]; self.writeOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(writeOptions))] unsignedIntegerValue]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeInteger:self.format forKey:NSStringFromSelector(@selector(format))]; [coder encodeObject:@(self.writeOptions) forKey:NSStringFromSelector(@selector(writeOptions))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFPropertyListRequestSerializer *serializer = [super copyWithZone:zone]; serializer.format = self.format; serializer.writeOptions = self.writeOptions; return serializer; } @end ================================================ FILE: GCDAsyncSocket/AFNetworking/AFURLResponseSerialization.h ================================================ // AFURLResponseSerialization.h // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import #import NS_ASSUME_NONNULL_BEGIN /** The `AFURLResponseSerialization` protocol is adopted by an object that decodes data into a more useful object representation, according to details in the server response. Response serializers may additionally perform validation on the incoming response and data. For example, a JSON response serializer may check for an acceptable status code (`2XX` range) and content type (`application/json`), decoding a valid JSON response into an object. */ @protocol AFURLResponseSerialization /** The response object decoded from the data associated with a specified response. @param response The response to be processed. @param data The response data to be decoded. @param error The error that occurred while attempting to decode the response data. @return The object decoded from the specified response data. */ - (nullable id)responseObjectForResponse:(nullable NSURLResponse *)response data:(nullable NSData *)data error:(NSError * _Nullable __autoreleasing *)error NS_SWIFT_NOTHROW; @end #pragma mark - /** `AFHTTPResponseSerializer` conforms to the `AFURLRequestSerialization` & `AFURLResponseSerialization` protocols, offering a concrete base implementation of query string / URL form-encoded parameter serialization and default request headers, as well as response status code and content type validation. Any request or response serializer dealing with HTTP is encouraged to subclass `AFHTTPResponseSerializer` in order to ensure consistent default behavior. */ @interface AFHTTPResponseSerializer : NSObject - (instancetype)init; /** The string encoding used to serialize data received from the server, when no string encoding is specified by the response. `NSUTF8StringEncoding` by default. */ @property (nonatomic, assign) NSStringEncoding stringEncoding; /** Creates and returns a serializer with default configuration. */ + (instancetype)serializer; ///----------------------------------------- /// @name Configuring Response Serialization ///----------------------------------------- /** The acceptable HTTP status codes for responses. When non-`nil`, responses with status codes not contained by the set will result in an error during validation. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html */ @property (nonatomic, copy, nullable) NSIndexSet *acceptableStatusCodes; /** The acceptable MIME types for responses. When non-`nil`, responses with a `Content-Type` with MIME types that do not intersect with the set will result in an error during validation. */ @property (nonatomic, copy, nullable) NSSet *acceptableContentTypes; /** Validates the specified response and data. In its base implementation, this method checks for an acceptable status code and content type. Subclasses may wish to add other domain-specific checks. @param response The response to be validated. @param data The data associated with the response. @param error The error that occurred while attempting to validate the response. @return `YES` if the response is valid, otherwise `NO`. */ - (BOOL)validateResponse:(nullable NSHTTPURLResponse *)response data:(nullable NSData *)data error:(NSError * _Nullable __autoreleasing *)error; @end #pragma mark - /** `AFJSONResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes JSON responses. By default, `AFJSONResponseSerializer` accepts the following MIME types, which includes the official standard, `application/json`, as well as other commonly-used types: - `application/json` - `text/json` - `text/javascript` */ @interface AFJSONResponseSerializer : AFHTTPResponseSerializer - (instancetype)init; /** Options for reading the response JSON data and creating the Foundation objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. */ @property (nonatomic, assign) NSJSONReadingOptions readingOptions; /** Whether to remove keys with `NSNull` values from response JSON. Defaults to `NO`. */ @property (nonatomic, assign) BOOL removesKeysWithNullValues; /** Creates and returns a JSON serializer with specified reading and writing options. @param readingOptions The specified JSON reading options. */ + (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions; @end #pragma mark - /** `AFXMLParserResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLParser` objects. By default, `AFXMLParserResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: - `application/xml` - `text/xml` */ @interface AFXMLParserResponseSerializer : AFHTTPResponseSerializer @end #pragma mark - #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED /** `AFXMLDocumentResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. By default, `AFXMLDocumentResponseSerializer` accepts the following MIME types, which includes the official standard, `application/xml`, as well as other commonly-used types: - `application/xml` - `text/xml` */ @interface AFXMLDocumentResponseSerializer : AFHTTPResponseSerializer - (instancetype)init; /** Input and output options specifically intended for `NSXMLDocument` objects. For possible values, see the `NSJSONSerialization` documentation section "NSJSONReadingOptions". `0` by default. */ @property (nonatomic, assign) NSUInteger options; /** Creates and returns an XML document serializer with the specified options. @param mask The XML document options. */ + (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask; @end #endif #pragma mark - /** `AFPropertyListResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes XML responses as an `NSXMLDocument` objects. By default, `AFPropertyListResponseSerializer` accepts the following MIME types: - `application/x-plist` */ @interface AFPropertyListResponseSerializer : AFHTTPResponseSerializer - (instancetype)init; /** The property list format. Possible values are described in "NSPropertyListFormat". */ @property (nonatomic, assign) NSPropertyListFormat format; /** The property list reading options. Possible values are described in "NSPropertyListMutabilityOptions." */ @property (nonatomic, assign) NSPropertyListReadOptions readOptions; /** Creates and returns a property list serializer with a specified format, read options, and write options. @param format The property list format. @param readOptions The property list reading options. */ + (instancetype)serializerWithFormat:(NSPropertyListFormat)format readOptions:(NSPropertyListReadOptions)readOptions; @end #pragma mark - /** `AFImageResponseSerializer` is a subclass of `AFHTTPResponseSerializer` that validates and decodes image responses. By default, `AFImageResponseSerializer` accepts the following MIME types, which correspond to the image formats supported by UIImage or NSImage: - `image/tiff` - `image/jpeg` - `image/gif` - `image/png` - `image/ico` - `image/x-icon` - `image/bmp` - `image/x-bmp` - `image/x-xbitmap` - `image/x-win-bitmap` */ @interface AFImageResponseSerializer : AFHTTPResponseSerializer #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH /** The scale factor used when interpreting the image data to construct `responseImage`. Specifying a scale factor of 1.0 results in an image whose size matches the pixel-based dimensions of the image. Applying a different scale factor changes the size of the image as reported by the size property. This is set to the value of scale of the main screen by default, which automatically scales images for retina displays, for instance. */ @property (nonatomic, assign) CGFloat imageScale; /** Whether to automatically inflate response image data for compressed formats (such as PNG or JPEG). Enabling this can significantly improve drawing performance on iOS when used with `setCompletionBlockWithSuccess:failure:`, as it allows a bitmap representation to be constructed in the background rather than on the main thread. `YES` by default. */ @property (nonatomic, assign) BOOL automaticallyInflatesResponseImage; #endif @end #pragma mark - /** `AFCompoundSerializer` is a subclass of `AFHTTPResponseSerializer` that delegates the response serialization to the first `AFHTTPResponseSerializer` object that returns an object for `responseObjectForResponse:data:error:`, falling back on the default behavior of `AFHTTPResponseSerializer`. This is useful for supporting multiple potential types and structures of server responses with a single serializer. */ @interface AFCompoundResponseSerializer : AFHTTPResponseSerializer /** The component response serializers. */ @property (readonly, nonatomic, copy) NSArray > *responseSerializers; /** Creates and returns a compound serializer comprised of the specified response serializers. @warning Each response serializer specified must be a subclass of `AFHTTPResponseSerializer`, and response to `-validateResponse:data:error:`. */ + (instancetype)compoundSerializerWithResponseSerializers:(NSArray > *)responseSerializers; @end ///---------------- /// @name Constants ///---------------- /** ## Error Domains The following error domain is predefined. - `NSString * const AFURLResponseSerializationErrorDomain` ### Constants `AFURLResponseSerializationErrorDomain` AFURLResponseSerializer errors. Error codes for `AFURLResponseSerializationErrorDomain` correspond to codes in `NSURLErrorDomain`. */ FOUNDATION_EXPORT NSString * const AFURLResponseSerializationErrorDomain; /** ## User info dictionary keys These keys may exist in the user info dictionary, in addition to those defined for NSError. - `NSString * const AFNetworkingOperationFailingURLResponseErrorKey` - `NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey` ### Constants `AFNetworkingOperationFailingURLResponseErrorKey` The corresponding value is an `NSURLResponse` containing the response of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`. `AFNetworkingOperationFailingURLResponseDataErrorKey` The corresponding value is an `NSData` containing the original data of the operation associated with an error. This key is only present in the `AFURLResponseSerializationErrorDomain`. */ FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseErrorKey; FOUNDATION_EXPORT NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey; NS_ASSUME_NONNULL_END ================================================ FILE: GCDAsyncSocket/AFNetworking/AFURLResponseSerialization.m ================================================ // AFURLResponseSerialization.m // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import "AFURLResponseSerialization.h" #import #if TARGET_OS_IOS #import #elif TARGET_OS_WATCH #import #elif defined(__MAC_OS_X_VERSION_MIN_REQUIRED) #import #endif NSString * const AFURLResponseSerializationErrorDomain = @"com.alamofire.error.serialization.response"; NSString * const AFNetworkingOperationFailingURLResponseErrorKey = @"com.alamofire.serialization.response.error.response"; NSString * const AFNetworkingOperationFailingURLResponseDataErrorKey = @"com.alamofire.serialization.response.error.data"; static NSError * AFErrorWithUnderlyingError(NSError *error, NSError *underlyingError) { if (!error) { return underlyingError; } if (!underlyingError || error.userInfo[NSUnderlyingErrorKey]) { return error; } NSMutableDictionary *mutableUserInfo = [error.userInfo mutableCopy]; mutableUserInfo[NSUnderlyingErrorKey] = underlyingError; return [[NSError alloc] initWithDomain:error.domain code:error.code userInfo:mutableUserInfo]; } static BOOL AFErrorOrUnderlyingErrorHasCodeInDomain(NSError *error, NSInteger code, NSString *domain) { if ([error.domain isEqualToString:domain] && error.code == code) { return YES; } else if (error.userInfo[NSUnderlyingErrorKey]) { return AFErrorOrUnderlyingErrorHasCodeInDomain(error.userInfo[NSUnderlyingErrorKey], code, domain); } return NO; } static id AFJSONObjectByRemovingKeysWithNullValues(id JSONObject, NSJSONReadingOptions readingOptions) { if ([JSONObject isKindOfClass:[NSArray class]]) { NSMutableArray *mutableArray = [NSMutableArray arrayWithCapacity:[(NSArray *)JSONObject count]]; for (id value in (NSArray *)JSONObject) { [mutableArray addObject:AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions)]; } return (readingOptions & NSJSONReadingMutableContainers) ? mutableArray : [NSArray arrayWithArray:mutableArray]; } else if ([JSONObject isKindOfClass:[NSDictionary class]]) { NSMutableDictionary *mutableDictionary = [NSMutableDictionary dictionaryWithDictionary:JSONObject]; for (id key in [(NSDictionary *)JSONObject allKeys]) { id value = (NSDictionary *)JSONObject[key]; if (!value || [value isEqual:[NSNull null]]) { [mutableDictionary removeObjectForKey:key]; } else if ([value isKindOfClass:[NSArray class]] || [value isKindOfClass:[NSDictionary class]]) { mutableDictionary[key] = AFJSONObjectByRemovingKeysWithNullValues(value, readingOptions); } } return (readingOptions & NSJSONReadingMutableContainers) ? mutableDictionary : [NSDictionary dictionaryWithDictionary:mutableDictionary]; } return JSONObject; } @implementation AFHTTPResponseSerializer + (instancetype)serializer { return [[self alloc] init]; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.stringEncoding = NSUTF8StringEncoding; self.acceptableStatusCodes = [NSIndexSet indexSetWithIndexesInRange:NSMakeRange(200, 100)]; self.acceptableContentTypes = nil; return self; } #pragma mark - - (BOOL)validateResponse:(NSHTTPURLResponse *)response data:(NSData *)data error:(NSError * __autoreleasing *)error { BOOL responseIsValid = YES; NSError *validationError = nil; if (response && [response isKindOfClass:[NSHTTPURLResponse class]]) { if (self.acceptableContentTypes && ![self.acceptableContentTypes containsObject:[response MIMEType]] && !([response MIMEType] == nil && [data length] == 0)) { if ([data length] > 0 && [response URL]) { NSMutableDictionary *mutableUserInfo = [@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: unacceptable content-type: %@", @"AFNetworking", nil), [response MIMEType]], NSURLErrorFailingURLErrorKey:[response URL], AFNetworkingOperationFailingURLResponseErrorKey: response, } mutableCopy]; if (data) { mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data; } validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorCannotDecodeContentData userInfo:mutableUserInfo], validationError); } responseIsValid = NO; } if (self.acceptableStatusCodes && ![self.acceptableStatusCodes containsIndex:(NSUInteger)response.statusCode] && [response URL]) { NSMutableDictionary *mutableUserInfo = [@{ NSLocalizedDescriptionKey: [NSString stringWithFormat:NSLocalizedStringFromTable(@"Request failed: %@ (%ld)", @"AFNetworking", nil), [NSHTTPURLResponse localizedStringForStatusCode:response.statusCode], (long)response.statusCode], NSURLErrorFailingURLErrorKey:[response URL], AFNetworkingOperationFailingURLResponseErrorKey: response, } mutableCopy]; if (data) { mutableUserInfo[AFNetworkingOperationFailingURLResponseDataErrorKey] = data; } validationError = AFErrorWithUnderlyingError([NSError errorWithDomain:AFURLResponseSerializationErrorDomain code:NSURLErrorBadServerResponse userInfo:mutableUserInfo], validationError); responseIsValid = NO; } } if (error && !responseIsValid) { *error = validationError; } return responseIsValid; } #pragma mark - AFURLResponseSerialization - (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { [self validateResponse:(NSHTTPURLResponse *)response data:data error:error]; return data; } #pragma mark - NSSecureCoding + (BOOL)supportsSecureCoding { return YES; } - (instancetype)initWithCoder:(NSCoder *)decoder { self = [self init]; if (!self) { return nil; } self.acceptableStatusCodes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableStatusCodes))]; self.acceptableContentTypes = [decoder decodeObjectOfClass:[NSIndexSet class] forKey:NSStringFromSelector(@selector(acceptableContentTypes))]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:self.acceptableStatusCodes forKey:NSStringFromSelector(@selector(acceptableStatusCodes))]; [coder encodeObject:self.acceptableContentTypes forKey:NSStringFromSelector(@selector(acceptableContentTypes))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFHTTPResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; serializer.acceptableStatusCodes = [self.acceptableStatusCodes copyWithZone:zone]; serializer.acceptableContentTypes = [self.acceptableContentTypes copyWithZone:zone]; return serializer; } @end #pragma mark - @implementation AFJSONResponseSerializer + (instancetype)serializer { return [self serializerWithReadingOptions:(NSJSONReadingOptions)0]; } + (instancetype)serializerWithReadingOptions:(NSJSONReadingOptions)readingOptions { AFJSONResponseSerializer *serializer = [[self alloc] init]; serializer.readingOptions = readingOptions; return serializer; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.acceptableContentTypes = [NSSet setWithObjects:@"application/json", @"text/json", @"text/javascript", nil]; return self; } #pragma mark - AFURLResponseSerialization - (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { return nil; } } id responseObject = nil; NSError *serializationError = nil; // Workaround for behavior of Rails to return a single space for `head :ok` (a workaround for a bug in Safari), which is not interpreted as valid input by NSJSONSerialization. // See https://github.com/rails/rails/issues/1742 BOOL isSpace = [data isEqualToData:[NSData dataWithBytes:" " length:1]]; if (data.length > 0 && !isSpace) { responseObject = [NSJSONSerialization JSONObjectWithData:data options:self.readingOptions error:&serializationError]; } else { return nil; } if (self.removesKeysWithNullValues && responseObject) { responseObject = AFJSONObjectByRemovingKeysWithNullValues(responseObject, self.readingOptions); } if (error) { *error = AFErrorWithUnderlyingError(serializationError, *error); } return responseObject; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } self.readingOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readingOptions))] unsignedIntegerValue]; self.removesKeysWithNullValues = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))] boolValue]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:@(self.readingOptions) forKey:NSStringFromSelector(@selector(readingOptions))]; [coder encodeObject:@(self.removesKeysWithNullValues) forKey:NSStringFromSelector(@selector(removesKeysWithNullValues))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFJSONResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; serializer.readingOptions = self.readingOptions; serializer.removesKeysWithNullValues = self.removesKeysWithNullValues; return serializer; } @end #pragma mark - @implementation AFXMLParserResponseSerializer + (instancetype)serializer { AFXMLParserResponseSerializer *serializer = [[self alloc] init]; return serializer; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil]; return self; } #pragma mark - AFURLResponseSerialization - (id)responseObjectForResponse:(NSHTTPURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { return nil; } } return [[NSXMLParser alloc] initWithData:data]; } @end #pragma mark - #ifdef __MAC_OS_X_VERSION_MIN_REQUIRED @implementation AFXMLDocumentResponseSerializer + (instancetype)serializer { return [self serializerWithXMLDocumentOptions:0]; } + (instancetype)serializerWithXMLDocumentOptions:(NSUInteger)mask { AFXMLDocumentResponseSerializer *serializer = [[self alloc] init]; serializer.options = mask; return serializer; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/xml", @"text/xml", nil]; return self; } #pragma mark - AFURLResponseSerialization - (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { return nil; } } NSError *serializationError = nil; NSXMLDocument *document = [[NSXMLDocument alloc] initWithData:data options:self.options error:&serializationError]; if (error) { *error = AFErrorWithUnderlyingError(serializationError, *error); } return document; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } self.options = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(options))] unsignedIntegerValue]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:@(self.options) forKey:NSStringFromSelector(@selector(options))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFXMLDocumentResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; serializer.options = self.options; return serializer; } @end #endif #pragma mark - @implementation AFPropertyListResponseSerializer + (instancetype)serializer { return [self serializerWithFormat:NSPropertyListXMLFormat_v1_0 readOptions:0]; } + (instancetype)serializerWithFormat:(NSPropertyListFormat)format readOptions:(NSPropertyListReadOptions)readOptions { AFPropertyListResponseSerializer *serializer = [[self alloc] init]; serializer.format = format; serializer.readOptions = readOptions; return serializer; } - (instancetype)init { self = [super init]; if (!self) { return nil; } self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"application/x-plist", nil]; return self; } #pragma mark - AFURLResponseSerialization - (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { return nil; } } id responseObject; NSError *serializationError = nil; if (data) { responseObject = [NSPropertyListSerialization propertyListWithData:data options:self.readOptions format:NULL error:&serializationError]; } if (error) { *error = AFErrorWithUnderlyingError(serializationError, *error); } return responseObject; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } self.format = (NSPropertyListFormat)[[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(format))] unsignedIntegerValue]; self.readOptions = [[decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(readOptions))] unsignedIntegerValue]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:@(self.format) forKey:NSStringFromSelector(@selector(format))]; [coder encodeObject:@(self.readOptions) forKey:NSStringFromSelector(@selector(readOptions))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFPropertyListResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; serializer.format = self.format; serializer.readOptions = self.readOptions; return serializer; } @end #pragma mark - #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH #import #import @interface UIImage (AFNetworkingSafeImageLoading) + (UIImage *)af_safeImageWithData:(NSData *)data; @end static NSLock* imageLock = nil; @implementation UIImage (AFNetworkingSafeImageLoading) + (UIImage *)af_safeImageWithData:(NSData *)data { UIImage* image = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ imageLock = [[NSLock alloc] init]; }); [imageLock lock]; image = [UIImage imageWithData:data]; [imageLock unlock]; return image; } @end static UIImage * AFImageWithDataAtScale(NSData *data, CGFloat scale) { UIImage *image = [UIImage af_safeImageWithData:data]; if (image.images) { return image; } return [[UIImage alloc] initWithCGImage:[image CGImage] scale:scale orientation:image.imageOrientation]; } static UIImage * AFInflatedImageFromResponseWithDataAtScale(NSHTTPURLResponse *response, NSData *data, CGFloat scale) { if (!data || [data length] == 0) { return nil; } CGImageRef imageRef = NULL; CGDataProviderRef dataProvider = CGDataProviderCreateWithCFData((__bridge CFDataRef)data); if ([response.MIMEType isEqualToString:@"image/png"]) { imageRef = CGImageCreateWithPNGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault); } else if ([response.MIMEType isEqualToString:@"image/jpeg"]) { imageRef = CGImageCreateWithJPEGDataProvider(dataProvider, NULL, true, kCGRenderingIntentDefault); if (imageRef) { CGColorSpaceRef imageColorSpace = CGImageGetColorSpace(imageRef); CGColorSpaceModel imageColorSpaceModel = CGColorSpaceGetModel(imageColorSpace); // CGImageCreateWithJPEGDataProvider does not properly handle CMKY, so fall back to AFImageWithDataAtScale if (imageColorSpaceModel == kCGColorSpaceModelCMYK) { CGImageRelease(imageRef); imageRef = NULL; } } } CGDataProviderRelease(dataProvider); UIImage *image = AFImageWithDataAtScale(data, scale); if (!imageRef) { if (image.images || !image) { return image; } imageRef = CGImageCreateCopy([image CGImage]); if (!imageRef) { return nil; } } size_t width = CGImageGetWidth(imageRef); size_t height = CGImageGetHeight(imageRef); size_t bitsPerComponent = CGImageGetBitsPerComponent(imageRef); if (width * height > 1024 * 1024 || bitsPerComponent > 8) { CGImageRelease(imageRef); return image; } // CGImageGetBytesPerRow() calculates incorrectly in iOS 5.0, so defer to CGBitmapContextCreate size_t bytesPerRow = 0; CGColorSpaceRef colorSpace = CGColorSpaceCreateDeviceRGB(); CGColorSpaceModel colorSpaceModel = CGColorSpaceGetModel(colorSpace); CGBitmapInfo bitmapInfo = CGImageGetBitmapInfo(imageRef); if (colorSpaceModel == kCGColorSpaceModelRGB) { uint32_t alpha = (bitmapInfo & kCGBitmapAlphaInfoMask); #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wassign-enum" if (alpha == kCGImageAlphaNone) { bitmapInfo &= ~kCGBitmapAlphaInfoMask; bitmapInfo |= kCGImageAlphaNoneSkipFirst; } else if (!(alpha == kCGImageAlphaNoneSkipFirst || alpha == kCGImageAlphaNoneSkipLast)) { bitmapInfo &= ~kCGBitmapAlphaInfoMask; bitmapInfo |= kCGImageAlphaPremultipliedFirst; } #pragma clang diagnostic pop } CGContextRef context = CGBitmapContextCreate(NULL, width, height, bitsPerComponent, bytesPerRow, colorSpace, bitmapInfo); CGColorSpaceRelease(colorSpace); if (!context) { CGImageRelease(imageRef); return image; } CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), imageRef); CGImageRef inflatedImageRef = CGBitmapContextCreateImage(context); CGContextRelease(context); UIImage *inflatedImage = [[UIImage alloc] initWithCGImage:inflatedImageRef scale:scale orientation:image.imageOrientation]; CGImageRelease(inflatedImageRef); CGImageRelease(imageRef); return inflatedImage; } #endif @implementation AFImageResponseSerializer - (instancetype)init { self = [super init]; if (!self) { return nil; } self.acceptableContentTypes = [[NSSet alloc] initWithObjects:@"image/tiff", @"image/jpeg", @"image/gif", @"image/png", @"image/ico", @"image/x-icon", @"image/bmp", @"image/x-bmp", @"image/x-xbitmap", @"image/x-win-bitmap", nil]; #if TARGET_OS_IOS || TARGET_OS_TV self.imageScale = [[UIScreen mainScreen] scale]; self.automaticallyInflatesResponseImage = YES; #elif TARGET_OS_WATCH self.imageScale = [[WKInterfaceDevice currentDevice] screenScale]; self.automaticallyInflatesResponseImage = YES; #endif return self; } #pragma mark - AFURLResponseSerializer - (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { if (![self validateResponse:(NSHTTPURLResponse *)response data:data error:error]) { if (!error || AFErrorOrUnderlyingErrorHasCodeInDomain(*error, NSURLErrorCannotDecodeContentData, AFURLResponseSerializationErrorDomain)) { return nil; } } #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH if (self.automaticallyInflatesResponseImage) { return AFInflatedImageFromResponseWithDataAtScale((NSHTTPURLResponse *)response, data, self.imageScale); } else { return AFImageWithDataAtScale(data, self.imageScale); } #else // Ensure that the image is set to it's correct pixel width and height NSBitmapImageRep *bitimage = [[NSBitmapImageRep alloc] initWithData:data]; NSImage *image = [[NSImage alloc] initWithSize:NSMakeSize([bitimage pixelsWide], [bitimage pixelsHigh])]; [image addRepresentation:bitimage]; return image; #endif return nil; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH NSNumber *imageScale = [decoder decodeObjectOfClass:[NSNumber class] forKey:NSStringFromSelector(@selector(imageScale))]; #if CGFLOAT_IS_DOUBLE self.imageScale = [imageScale doubleValue]; #else self.imageScale = [imageScale floatValue]; #endif self.automaticallyInflatesResponseImage = [decoder decodeBoolForKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))]; #endif return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH [coder encodeObject:@(self.imageScale) forKey:NSStringFromSelector(@selector(imageScale))]; [coder encodeBool:self.automaticallyInflatesResponseImage forKey:NSStringFromSelector(@selector(automaticallyInflatesResponseImage))]; #endif } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFImageResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; #if TARGET_OS_IOS || TARGET_OS_TV || TARGET_OS_WATCH serializer.imageScale = self.imageScale; serializer.automaticallyInflatesResponseImage = self.automaticallyInflatesResponseImage; #endif return serializer; } @end #pragma mark - @interface AFCompoundResponseSerializer () @property (readwrite, nonatomic, copy) NSArray *responseSerializers; @end @implementation AFCompoundResponseSerializer + (instancetype)compoundSerializerWithResponseSerializers:(NSArray *)responseSerializers { AFCompoundResponseSerializer *serializer = [[self alloc] init]; serializer.responseSerializers = responseSerializers; return serializer; } #pragma mark - AFURLResponseSerialization - (id)responseObjectForResponse:(NSURLResponse *)response data:(NSData *)data error:(NSError *__autoreleasing *)error { for (id serializer in self.responseSerializers) { if (![serializer isKindOfClass:[AFHTTPResponseSerializer class]]) { continue; } NSError *serializerError = nil; id responseObject = [serializer responseObjectForResponse:response data:data error:&serializerError]; if (responseObject) { if (error) { *error = AFErrorWithUnderlyingError(serializerError, *error); } return responseObject; } } return [super responseObjectForResponse:response data:data error:error]; } #pragma mark - NSSecureCoding - (instancetype)initWithCoder:(NSCoder *)decoder { self = [super initWithCoder:decoder]; if (!self) { return nil; } self.responseSerializers = [decoder decodeObjectOfClass:[NSArray class] forKey:NSStringFromSelector(@selector(responseSerializers))]; return self; } - (void)encodeWithCoder:(NSCoder *)coder { [super encodeWithCoder:coder]; [coder encodeObject:self.responseSerializers forKey:NSStringFromSelector(@selector(responseSerializers))]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { AFCompoundResponseSerializer *serializer = [[[self class] allocWithZone:zone] init]; serializer.responseSerializers = self.responseSerializers; return serializer; } @end ================================================ FILE: GCDAsyncSocket/AFNetworking/AFURLSessionManager.h ================================================ // AFURLSessionManager.h // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import #import "AFURLResponseSerialization.h" #import "AFURLRequestSerialization.h" #import "AFSecurityPolicy.h" #if !TARGET_OS_WATCH #import "AFNetworkReachabilityManager.h" #endif /** `AFURLSessionManager` creates and manages an `NSURLSession` object based on a specified `NSURLSessionConfiguration` object, which conforms to ``, ``, ``, and ``. ## Subclassing Notes This is the base class for `AFHTTPSessionManager`, which adds functionality specific to making HTTP requests. If you are looking to extend `AFURLSessionManager` specifically for HTTP, consider subclassing `AFHTTPSessionManager` instead. ## NSURLSession & NSURLSessionTask Delegate Methods `AFURLSessionManager` implements the following delegate methods: ### `NSURLSessionDelegate` - `URLSession:didBecomeInvalidWithError:` - `URLSession:didReceiveChallenge:completionHandler:` - `URLSessionDidFinishEventsForBackgroundURLSession:` ### `NSURLSessionTaskDelegate` - `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:` - `URLSession:task:didReceiveChallenge:completionHandler:` - `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:` - `URLSession:task:needNewBodyStream:` - `URLSession:task:didCompleteWithError:` ### `NSURLSessionDataDelegate` - `URLSession:dataTask:didReceiveResponse:completionHandler:` - `URLSession:dataTask:didBecomeDownloadTask:` - `URLSession:dataTask:didReceiveData:` - `URLSession:dataTask:willCacheResponse:completionHandler:` ### `NSURLSessionDownloadDelegate` - `URLSession:downloadTask:didFinishDownloadingToURL:` - `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:` - `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:` If any of these methods are overridden in a subclass, they _must_ call the `super` implementation first. ## Network Reachability Monitoring Network reachability status and change monitoring is available through the `reachabilityManager` property. Applications may choose to monitor network reachability conditions in order to prevent or suspend any outbound requests. See `AFNetworkReachabilityManager` for more details. ## NSCoding Caveats - Encoded managers do not include any block properties. Be sure to set delegate callback blocks when using `-initWithCoder:` or `NSKeyedUnarchiver`. ## NSCopying Caveats - `-copy` and `-copyWithZone:` return a new manager with a new `NSURLSession` created from the configuration of the original. - Operation copies do not include any delegate callback blocks, as they often strongly captures a reference to `self`, which would otherwise have the unintuitive side-effect of pointing to the _original_ session manager when copied. @warning Managers for background sessions must be owned for the duration of their use. This can be accomplished by creating an application-wide or shared singleton instance. */ NS_ASSUME_NONNULL_BEGIN @interface AFURLSessionManager : NSObject /** The managed session. */ @property (readonly, nonatomic, strong) NSURLSession *session; /** The operation queue on which delegate callbacks are run. */ @property (readonly, nonatomic, strong) NSOperationQueue *operationQueue; /** Responses sent from the server in data tasks created with `dataTaskWithRequest:success:failure:` and run using the `GET` / `POST` / et al. convenience methods are automatically validated and serialized by the response serializer. By default, this property is set to an instance of `AFJSONResponseSerializer`. @warning `responseSerializer` must not be `nil`. */ @property (nonatomic, strong) id responseSerializer; ///------------------------------- /// @name Managing Security Policy ///------------------------------- /** The security policy used by created session to evaluate server trust for secure connections. `AFURLSessionManager` uses the `defaultPolicy` unless otherwise specified. */ @property (nonatomic, strong) AFSecurityPolicy *securityPolicy; #if !TARGET_OS_WATCH ///-------------------------------------- /// @name Monitoring Network Reachability ///-------------------------------------- /** The network reachability manager. `AFURLSessionManager` uses the `sharedManager` by default. */ @property (readwrite, nonatomic, strong) AFNetworkReachabilityManager *reachabilityManager; #endif ///---------------------------- /// @name Getting Session Tasks ///---------------------------- /** The data, upload, and download tasks currently run by the managed session. */ @property (readonly, nonatomic, strong) NSArray *tasks; /** The data tasks currently run by the managed session. */ @property (readonly, nonatomic, strong) NSArray *dataTasks; /** The upload tasks currently run by the managed session. */ @property (readonly, nonatomic, strong) NSArray *uploadTasks; /** The download tasks currently run by the managed session. */ @property (readonly, nonatomic, strong) NSArray *downloadTasks; ///------------------------------- /// @name Managing Callback Queues ///------------------------------- /** The dispatch queue for `completionBlock`. If `NULL` (default), the main queue is used. */ @property (nonatomic, strong, nullable) dispatch_queue_t completionQueue; /** The dispatch group for `completionBlock`. If `NULL` (default), a private dispatch group is used. */ @property (nonatomic, strong, nullable) dispatch_group_t completionGroup; ///--------------------------------- /// @name Working Around System Bugs ///--------------------------------- /** Whether to attempt to retry creation of upload tasks for background sessions when initial call returns `nil`. `NO` by default. @bug As of iOS 7.0, there is a bug where upload tasks created for background tasks are sometimes `nil`. As a workaround, if this property is `YES`, AFNetworking will follow Apple's recommendation to try creating the task again. @see https://github.com/AFNetworking/AFNetworking/issues/1675 */ @property (nonatomic, assign) BOOL attemptsToRecreateUploadTasksForBackgroundSessions; ///--------------------- /// @name Initialization ///--------------------- /** Creates and returns a manager for a session created with the specified configuration. This is the designated initializer. @param configuration The configuration used to create the managed session. @return A manager for a newly-created session. */ - (instancetype)initWithSessionConfiguration:(nullable NSURLSessionConfiguration *)configuration NS_DESIGNATED_INITIALIZER; /** Invalidates the managed session, optionally canceling pending tasks. @param cancelPendingTasks Whether or not to cancel pending tasks. */ - (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks; ///------------------------- /// @name Running Data Tasks ///------------------------- /** Creates an `NSURLSessionDataTask` with the specified request. @param request The HTTP request for the request. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler DEPRECATED_ATTRIBUTE; /** Creates an `NSURLSessionDataTask` with the specified request. @param request The HTTP request for the request. @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request uploadProgress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock downloadProgress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; ///--------------------------- /// @name Running Upload Tasks ///--------------------------- /** Creates an `NSURLSessionUploadTask` with the specified request for a local file. @param request The HTTP request for the request. @param fileURL A URL to the local file to be uploaded. @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. @see `attemptsToRecreateUploadTasksForBackgroundSessions` */ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; /** Creates an `NSURLSessionUploadTask` with the specified request for an HTTP body. @param request The HTTP request for the request. @param bodyData A data object containing the HTTP body to be uploaded. @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromData:(nullable NSData *)bodyData progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; /** Creates an `NSURLSessionUploadTask` with the specified streaming request. @param request The HTTP request for the request. @param uploadProgressBlock A block object to be executed when the upload progress is updated. Note this block is called on the session queue, not the main queue. @param completionHandler A block object to be executed when the task finishes. This block has no return value and takes three arguments: the server response, the response object created by that serializer, and the error that occurred, if any. */ - (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request progress:(nullable void (^)(NSProgress *uploadProgress))uploadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler; ///----------------------------- /// @name Running Download Tasks ///----------------------------- /** Creates an `NSURLSessionDownloadTask` with the specified request. @param request The HTTP request for the request. @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. @warning If using a background `NSURLSessionConfiguration` on iOS, these blocks will be lost when the app is terminated. Background sessions may prefer to use `-setDownloadTaskDidFinishDownloadingBlock:` to specify the URL for saving the downloaded file, rather than the destination block of this method. */ - (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; /** Creates an `NSURLSessionDownloadTask` with the specified resume data. @param resumeData The data used to resume downloading. @param downloadProgressBlock A block object to be executed when the download progress is updated. Note this block is called on the session queue, not the main queue. @param destination A block object to be executed in order to determine the destination of the downloaded file. This block takes two arguments, the target path & the server response, and returns the desired file URL of the resulting download. The temporary file used during the download will be automatically deleted after being moved to the returned URL. @param completionHandler A block to be executed when a task finishes. This block has no return value and takes three arguments: the server response, the path of the downloaded file, and the error describing the network or parsing error that occurred, if any. */ - (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData progress:(nullable void (^)(NSProgress *downloadProgress))downloadProgressBlock destination:(nullable NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(nullable void (^)(NSURLResponse *response, NSURL * _Nullable filePath, NSError * _Nullable error))completionHandler; ///--------------------------------- /// @name Getting Progress for Tasks ///--------------------------------- /** Returns the upload progress of the specified task. @param task The session task. Must not be `nil`. @return An `NSProgress` object reporting the upload progress of a task, or `nil` if the progress is unavailable. */ - (nullable NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task; /** Returns the download progress of the specified task. @param task The session task. Must not be `nil`. @return An `NSProgress` object reporting the download progress of a task, or `nil` if the progress is unavailable. */ - (nullable NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task; ///----------------------------------------- /// @name Setting Session Delegate Callbacks ///----------------------------------------- /** Sets a block to be executed when the managed session becomes invalid, as handled by the `NSURLSessionDelegate` method `URLSession:didBecomeInvalidWithError:`. @param block A block object to be executed when the managed session becomes invalid. The block has no return value, and takes two arguments: the session, and the error related to the cause of invalidation. */ - (void)setSessionDidBecomeInvalidBlock:(nullable void (^)(NSURLSession *session, NSError *error))block; /** Sets a block to be executed when a connection level authentication challenge has occurred, as handled by the `NSURLSessionDelegate` method `URLSession:didReceiveChallenge:completionHandler:`. @param block A block object to be executed when a connection level authentication challenge has occurred. The block returns the disposition of the authentication challenge, and takes three arguments: the session, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. */ - (void)setSessionDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; ///-------------------------------------- /// @name Setting Task Delegate Callbacks ///-------------------------------------- /** Sets a block to be executed when a task requires a new request body stream to send to the remote server, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:needNewBodyStream:`. @param block A block object to be executed when a task requires a new request body stream. */ - (void)setTaskNeedNewBodyStreamBlock:(nullable NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block; /** Sets a block to be executed when an HTTP request is attempting to perform a redirection to a different URL, as handled by the `NSURLSessionTaskDelegate` method `URLSession:willPerformHTTPRedirection:newRequest:completionHandler:`. @param block A block object to be executed when an HTTP request is attempting to perform a redirection to a different URL. The block returns the request to be made for the redirection, and takes four arguments: the session, the task, the redirection response, and the request corresponding to the redirection response. */ - (void)setTaskWillPerformHTTPRedirectionBlock:(nullable NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block; /** Sets a block to be executed when a session task has received a request specific authentication challenge, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didReceiveChallenge:completionHandler:`. @param block A block object to be executed when a session task has received a request specific authentication challenge. The block returns the disposition of the authentication challenge, and takes four arguments: the session, the task, the authentication challenge, and a pointer to the credential that should be used to resolve the challenge. */ - (void)setTaskDidReceiveAuthenticationChallengeBlock:(nullable NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * _Nullable __autoreleasing * _Nullable credential))block; /** Sets a block to be executed periodically to track upload progress, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didSendBodyData:totalBytesSent:totalBytesExpectedToSend:`. @param block A block object to be called when an undetermined number of bytes have been uploaded to the server. This block has no return value and takes five arguments: the session, the task, the number of bytes written since the last time the upload progress block was called, the total bytes written, and the total bytes expected to be written during the request, as initially determined by the length of the HTTP body. This block may be called multiple times, and will execute on the main thread. */ - (void)setTaskDidSendBodyDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block; /** Sets a block to be executed as the last message related to a specific task, as handled by the `NSURLSessionTaskDelegate` method `URLSession:task:didCompleteWithError:`. @param block A block object to be executed when a session task is completed. The block has no return value, and takes three arguments: the session, the task, and any error that occurred in the process of executing the task. */ - (void)setTaskDidCompleteBlock:(nullable void (^)(NSURLSession *session, NSURLSessionTask *task, NSError * _Nullable error))block; ///------------------------------------------- /// @name Setting Data Task Delegate Callbacks ///------------------------------------------- /** Sets a block to be executed when a data task has received a response, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveResponse:completionHandler:`. @param block A block object to be executed when a data task has received a response. The block returns the disposition of the session response, and takes three arguments: the session, the data task, and the received response. */ - (void)setDataTaskDidReceiveResponseBlock:(nullable NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block; /** Sets a block to be executed when a data task has become a download task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didBecomeDownloadTask:`. @param block A block object to be executed when a data task has become a download task. The block has no return value, and takes three arguments: the session, the data task, and the download task it has become. */ - (void)setDataTaskDidBecomeDownloadTaskBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block; /** Sets a block to be executed when a data task receives data, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:didReceiveData:`. @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes three arguments: the session, the data task, and the data received. This block may be called multiple times, and will execute on the session manager operation queue. */ - (void)setDataTaskDidReceiveDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block; /** Sets a block to be executed to determine the caching behavior of a data task, as handled by the `NSURLSessionDataDelegate` method `URLSession:dataTask:willCacheResponse:completionHandler:`. @param block A block object to be executed to determine the caching behavior of a data task. The block returns the response to cache, and takes three arguments: the session, the data task, and the proposed cached URL response. */ - (void)setDataTaskWillCacheResponseBlock:(nullable NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block; /** Sets a block to be executed once all messages enqueued for a session have been delivered, as handled by the `NSURLSessionDataDelegate` method `URLSessionDidFinishEventsForBackgroundURLSession:`. @param block A block object to be executed once all messages enqueued for a session have been delivered. The block has no return value and takes a single argument: the session. */ - (void)setDidFinishEventsForBackgroundURLSessionBlock:(nullable void (^)(NSURLSession *session))block; ///----------------------------------------------- /// @name Setting Download Task Delegate Callbacks ///----------------------------------------------- /** Sets a block to be executed when a download task has completed a download, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didFinishDownloadingToURL:`. @param block A block object to be executed when a download task has completed. The block returns the URL the download should be moved to, and takes three arguments: the session, the download task, and the temporary location of the downloaded file. If the file manager encounters an error while attempting to move the temporary file to the destination, an `AFURLSessionDownloadTaskDidFailToMoveFileNotification` will be posted, with the download task as its object, and the user info of the error. */ - (void)setDownloadTaskDidFinishDownloadingBlock:(nullable NSURL * _Nullable (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block; /** Sets a block to be executed periodically to track download progress, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didWriteData:totalBytesWritten:totalBytesWritten:totalBytesExpectedToWrite:`. @param block A block object to be called when an undetermined number of bytes have been downloaded from the server. This block has no return value and takes five arguments: the session, the download task, the number of bytes read since the last time the download progress block was called, the total bytes read, and the total bytes expected to be read during the request, as initially determined by the expected content size of the `NSHTTPURLResponse` object. This block may be called multiple times, and will execute on the session manager operation queue. */ - (void)setDownloadTaskDidWriteDataBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block; /** Sets a block to be executed when a download task has been resumed, as handled by the `NSURLSessionDownloadDelegate` method `URLSession:downloadTask:didResumeAtOffset:expectedTotalBytes:`. @param block A block object to be executed when a download task has been resumed. The block has no return value and takes four arguments: the session, the download task, the file offset of the resumed download, and the total number of bytes expected to be downloaded. */ - (void)setDownloadTaskDidResumeBlock:(nullable void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block; @end ///-------------------- /// @name Notifications ///-------------------- /** Posted when a task resumes. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidResumeNotification; /** Posted when a task finishes executing. Includes a userInfo dictionary with additional information about the task. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteNotification; /** Posted when a task suspends its execution. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidSuspendNotification; /** Posted when a session is invalidated. */ FOUNDATION_EXPORT NSString * const AFURLSessionDidInvalidateNotification; /** Posted when a session download task encountered an error when moving the temporary download file to a specified destination. */ FOUNDATION_EXPORT NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification; /** The raw response data of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if response data exists for the task. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseDataKey; /** The serialized response object of the task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the response was serialized. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey; /** The response serializer used to serialize the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if the task has an associated response serializer. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey; /** The file path associated with the download task. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an the response data has been stored directly to disk. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteAssetPathKey; /** Any error associated with the task, or the serialization of the response. Included in the userInfo dictionary of the `AFNetworkingTaskDidCompleteNotification` if an error exists. */ FOUNDATION_EXPORT NSString * const AFNetworkingTaskDidCompleteErrorKey; NS_ASSUME_NONNULL_END ================================================ FILE: GCDAsyncSocket/AFNetworking/AFURLSessionManager.m ================================================ // AFURLSessionManager.m // Copyright (c) 2011–2016 Alamofire Software Foundation ( http://alamofire.org/ ) // // 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. #import "AFURLSessionManager.h" #import #ifndef NSFoundationVersionNumber_iOS_8_0 #define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug 1140.11 #else #define NSFoundationVersionNumber_With_Fixed_5871104061079552_bug NSFoundationVersionNumber_iOS_8_0 #endif static dispatch_queue_t url_session_manager_creation_queue() { static dispatch_queue_t af_url_session_manager_creation_queue; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ af_url_session_manager_creation_queue = dispatch_queue_create("com.alamofire.networking.session.manager.creation", DISPATCH_QUEUE_SERIAL); }); return af_url_session_manager_creation_queue; } static void url_session_manager_create_task_safely(dispatch_block_t block) { if (NSFoundationVersionNumber < NSFoundationVersionNumber_With_Fixed_5871104061079552_bug) { // Fix of bug // Open Radar:http://openradar.appspot.com/radar?id=5871104061079552 (status: Fixed in iOS8) // Issue about:https://github.com/AFNetworking/AFNetworking/issues/2093 dispatch_sync(url_session_manager_creation_queue(), block); } else { block(); } } static dispatch_queue_t url_session_manager_processing_queue() { static dispatch_queue_t af_url_session_manager_processing_queue; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ af_url_session_manager_processing_queue = dispatch_queue_create("com.alamofire.networking.session.manager.processing", DISPATCH_QUEUE_CONCURRENT); }); return af_url_session_manager_processing_queue; } static dispatch_group_t url_session_manager_completion_group() { static dispatch_group_t af_url_session_manager_completion_group; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ af_url_session_manager_completion_group = dispatch_group_create(); }); return af_url_session_manager_completion_group; } NSString * const AFNetworkingTaskDidResumeNotification = @"com.alamofire.networking.task.resume"; NSString * const AFNetworkingTaskDidCompleteNotification = @"com.alamofire.networking.task.complete"; NSString * const AFNetworkingTaskDidSuspendNotification = @"com.alamofire.networking.task.suspend"; NSString * const AFURLSessionDidInvalidateNotification = @"com.alamofire.networking.session.invalidate"; NSString * const AFURLSessionDownloadTaskDidFailToMoveFileNotification = @"com.alamofire.networking.session.download.file-manager-error"; NSString * const AFNetworkingTaskDidCompleteSerializedResponseKey = @"com.alamofire.networking.task.complete.serializedresponse"; NSString * const AFNetworkingTaskDidCompleteResponseSerializerKey = @"com.alamofire.networking.task.complete.responseserializer"; NSString * const AFNetworkingTaskDidCompleteResponseDataKey = @"com.alamofire.networking.complete.finish.responsedata"; NSString * const AFNetworkingTaskDidCompleteErrorKey = @"com.alamofire.networking.task.complete.error"; NSString * const AFNetworkingTaskDidCompleteAssetPathKey = @"com.alamofire.networking.task.complete.assetpath"; static NSString * const AFURLSessionManagerLockName = @"com.alamofire.networking.session.manager.lock"; static NSUInteger const AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask = 3; typedef void (^AFURLSessionDidBecomeInvalidBlock)(NSURLSession *session, NSError *error); typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); typedef NSURLRequest * (^AFURLSessionTaskWillPerformHTTPRedirectionBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request); typedef NSURLSessionAuthChallengeDisposition (^AFURLSessionTaskDidReceiveAuthenticationChallengeBlock)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential); typedef void (^AFURLSessionDidFinishEventsForBackgroundURLSessionBlock)(NSURLSession *session); typedef NSInputStream * (^AFURLSessionTaskNeedNewBodyStreamBlock)(NSURLSession *session, NSURLSessionTask *task); typedef void (^AFURLSessionTaskDidSendBodyDataBlock)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend); typedef void (^AFURLSessionTaskDidCompleteBlock)(NSURLSession *session, NSURLSessionTask *task, NSError *error); typedef NSURLSessionResponseDisposition (^AFURLSessionDataTaskDidReceiveResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response); typedef void (^AFURLSessionDataTaskDidBecomeDownloadTaskBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask); typedef void (^AFURLSessionDataTaskDidReceiveDataBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data); typedef NSCachedURLResponse * (^AFURLSessionDataTaskWillCacheResponseBlock)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse); typedef NSURL * (^AFURLSessionDownloadTaskDidFinishDownloadingBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location); typedef void (^AFURLSessionDownloadTaskDidWriteDataBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite); typedef void (^AFURLSessionDownloadTaskDidResumeBlock)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes); typedef void (^AFURLSessionTaskProgressBlock)(NSProgress *); typedef void (^AFURLSessionTaskCompletionHandler)(NSURLResponse *response, id responseObject, NSError *error); #pragma mark - @interface AFURLSessionManagerTaskDelegate : NSObject @property (nonatomic, weak) AFURLSessionManager *manager; @property (nonatomic, strong) NSMutableData *mutableData; @property (nonatomic, strong) NSProgress *uploadProgress; @property (nonatomic, strong) NSProgress *downloadProgress; @property (nonatomic, copy) NSURL *downloadFileURL; @property (nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; @property (nonatomic, copy) AFURLSessionTaskProgressBlock uploadProgressBlock; @property (nonatomic, copy) AFURLSessionTaskProgressBlock downloadProgressBlock; @property (nonatomic, copy) AFURLSessionTaskCompletionHandler completionHandler; @end @implementation AFURLSessionManagerTaskDelegate - (instancetype)init { self = [super init]; if (!self) { return nil; } self.mutableData = [NSMutableData data]; self.uploadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; self.uploadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown; self.downloadProgress = [[NSProgress alloc] initWithParent:nil userInfo:nil]; self.downloadProgress.totalUnitCount = NSURLSessionTransferSizeUnknown; return self; } #pragma mark - NSProgress Tracking - (void)setupProgressForTask:(NSURLSessionTask *)task { __weak __typeof__(task) weakTask = task; self.uploadProgress.totalUnitCount = task.countOfBytesExpectedToSend; self.downloadProgress.totalUnitCount = task.countOfBytesExpectedToReceive; [self.uploadProgress setCancellable:YES]; [self.uploadProgress setCancellationHandler:^{ __typeof__(weakTask) strongTask = weakTask; [strongTask cancel]; }]; [self.uploadProgress setPausable:YES]; [self.uploadProgress setPausingHandler:^{ __typeof__(weakTask) strongTask = weakTask; [strongTask suspend]; }]; if ([self.uploadProgress respondsToSelector:@selector(setResumingHandler:)]) { [self.uploadProgress setResumingHandler:^{ __typeof__(weakTask) strongTask = weakTask; [strongTask resume]; }]; } [self.downloadProgress setCancellable:YES]; [self.downloadProgress setCancellationHandler:^{ __typeof__(weakTask) strongTask = weakTask; [strongTask cancel]; }]; [self.downloadProgress setPausable:YES]; [self.downloadProgress setPausingHandler:^{ __typeof__(weakTask) strongTask = weakTask; [strongTask suspend]; }]; if ([self.downloadProgress respondsToSelector:@selector(setResumingHandler:)]) { [self.downloadProgress setResumingHandler:^{ __typeof__(weakTask) strongTask = weakTask; [strongTask resume]; }]; } [task addObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived)) options:NSKeyValueObservingOptionNew context:NULL]; [task addObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive)) options:NSKeyValueObservingOptionNew context:NULL]; [task addObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent)) options:NSKeyValueObservingOptionNew context:NULL]; [task addObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend)) options:NSKeyValueObservingOptionNew context:NULL]; [self.downloadProgress addObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted)) options:NSKeyValueObservingOptionNew context:NULL]; [self.uploadProgress addObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted)) options:NSKeyValueObservingOptionNew context:NULL]; } - (void)cleanUpProgressForTask:(NSURLSessionTask *)task { [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesReceived))]; [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]; [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesSent))]; [task removeObserver:self forKeyPath:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]; [self.downloadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))]; [self.uploadProgress removeObserver:self forKeyPath:NSStringFromSelector(@selector(fractionCompleted))]; } - (void)observeValueForKeyPath:(NSString *)keyPath ofObject:(id)object change:(NSDictionary *)change context:(void *)context { if ([object isKindOfClass:[NSURLSessionTask class]] || [object isKindOfClass:[NSURLSessionDownloadTask class]]) { if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesReceived))]) { self.downloadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToReceive))]) { self.downloadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesSent))]) { self.uploadProgress.completedUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(countOfBytesExpectedToSend))]) { self.uploadProgress.totalUnitCount = [change[NSKeyValueChangeNewKey] longLongValue]; } } else if ([object isEqual:self.downloadProgress]) { if (self.downloadProgressBlock) { self.downloadProgressBlock(object); } } else if ([object isEqual:self.uploadProgress]) { if (self.uploadProgressBlock) { self.uploadProgressBlock(object); } } } #pragma mark - NSURLSessionTaskDelegate - (void)URLSession:(__unused NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { __strong AFURLSessionManager *manager = self.manager; __block id responseObject = nil; __block NSMutableDictionary *userInfo = [NSMutableDictionary dictionary]; userInfo[AFNetworkingTaskDidCompleteResponseSerializerKey] = manager.responseSerializer; //Performance Improvement from #2672 NSData *data = nil; if (self.mutableData) { data = [self.mutableData copy]; //We no longer need the reference, so nil it out to gain back some memory. self.mutableData = nil; } if (self.downloadFileURL) { userInfo[AFNetworkingTaskDidCompleteAssetPathKey] = self.downloadFileURL; } else if (data) { userInfo[AFNetworkingTaskDidCompleteResponseDataKey] = data; } if (error) { userInfo[AFNetworkingTaskDidCompleteErrorKey] = error; dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{ if (self.completionHandler) { self.completionHandler(task.response, responseObject, error); } dispatch_async(dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo]; }); }); } else { dispatch_async(url_session_manager_processing_queue(), ^{ NSError *serializationError = nil; responseObject = [manager.responseSerializer responseObjectForResponse:task.response data:data error:&serializationError]; if (self.downloadFileURL) { responseObject = self.downloadFileURL; } if (responseObject) { userInfo[AFNetworkingTaskDidCompleteSerializedResponseKey] = responseObject; } if (serializationError) { userInfo[AFNetworkingTaskDidCompleteErrorKey] = serializationError; } dispatch_group_async(manager.completionGroup ?: url_session_manager_completion_group(), manager.completionQueue ?: dispatch_get_main_queue(), ^{ if (self.completionHandler) { self.completionHandler(task.response, responseObject, serializationError); } dispatch_async(dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidCompleteNotification object:task userInfo:userInfo]; }); }); }); } } #pragma mark - NSURLSessionDataTaskDelegate - (void)URLSession:(__unused NSURLSession *)session dataTask:(__unused NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { [self.mutableData appendData:data]; } #pragma mark - NSURLSessionDownloadTaskDelegate - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location { NSError *fileManagerError = nil; self.downloadFileURL = nil; if (self.downloadTaskDidFinishDownloading) { self.downloadFileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); if (self.downloadFileURL) { [[NSFileManager defaultManager] moveItemAtURL:location toURL:self.downloadFileURL error:&fileManagerError]; if (fileManagerError) { [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:fileManagerError.userInfo]; } } } } @end #pragma mark - /** * A workaround for issues related to key-value observing the `state` of an `NSURLSessionTask`. * * See: * - https://github.com/AFNetworking/AFNetworking/issues/1477 * - https://github.com/AFNetworking/AFNetworking/issues/2638 * - https://github.com/AFNetworking/AFNetworking/pull/2702 */ static inline void af_swizzleSelector(Class theClass, SEL originalSelector, SEL swizzledSelector) { Method originalMethod = class_getInstanceMethod(theClass, originalSelector); Method swizzledMethod = class_getInstanceMethod(theClass, swizzledSelector); method_exchangeImplementations(originalMethod, swizzledMethod); } static inline BOOL af_addMethod(Class theClass, SEL selector, Method method) { return class_addMethod(theClass, selector, method_getImplementation(method), method_getTypeEncoding(method)); } static NSString * const AFNSURLSessionTaskDidResumeNotification = @"com.alamofire.networking.nsurlsessiontask.resume"; static NSString * const AFNSURLSessionTaskDidSuspendNotification = @"com.alamofire.networking.nsurlsessiontask.suspend"; @interface _AFURLSessionTaskSwizzling : NSObject @end @implementation _AFURLSessionTaskSwizzling + (void)load { /** WARNING: Trouble Ahead https://github.com/AFNetworking/AFNetworking/pull/2702 */ if (NSClassFromString(@"NSURLSessionTask")) { /** iOS 7 and iOS 8 differ in NSURLSessionTask implementation, which makes the next bit of code a bit tricky. Many Unit Tests have been built to validate as much of this behavior has possible. Here is what we know: - NSURLSessionTasks are implemented with class clusters, meaning the class you request from the API isn't actually the type of class you will get back. - Simply referencing `[NSURLSessionTask class]` will not work. You need to ask an `NSURLSession` to actually create an object, and grab the class from there. - On iOS 7, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `__NSCFURLSessionTask`. - On iOS 8, `localDataTask` is a `__NSCFLocalDataTask`, which inherits from `__NSCFLocalSessionTask`, which inherits from `NSURLSessionTask`. - On iOS 7, `__NSCFLocalSessionTask` and `__NSCFURLSessionTask` are the only two classes that have their own implementations of `resume` and `suspend`, and `__NSCFLocalSessionTask` DOES NOT CALL SUPER. This means both classes need to be swizzled. - On iOS 8, `NSURLSessionTask` is the only class that implements `resume` and `suspend`. This means this is the only class that needs to be swizzled. - Because `NSURLSessionTask` is not involved in the class hierarchy for every version of iOS, its easier to add the swizzled methods to a dummy class and manage them there. Some Assumptions: - No implementations of `resume` or `suspend` call super. If this were to change in a future version of iOS, we'd need to handle it. - No background task classes override `resume` or `suspend` The current solution: 1) Grab an instance of `__NSCFLocalDataTask` by asking an instance of `NSURLSession` for a data task. 2) Grab a pointer to the original implementation of `af_resume` 3) Check to see if the current class has an implementation of resume. If so, continue to step 4. 4) Grab the super class of the current class. 5) Grab a pointer for the current class to the current implementation of `resume`. 6) Grab a pointer for the super class to the current implementation of `resume`. 7) If the current class implementation of `resume` is not equal to the super class implementation of `resume` AND the current implementation of `resume` is not equal to the original implementation of `af_resume`, THEN swizzle the methods 8) Set the current class to the super class, and repeat steps 3-8 */ NSURLSessionConfiguration *configuration = [NSURLSessionConfiguration ephemeralSessionConfiguration]; NSURLSession * session = [NSURLSession sessionWithConfiguration:configuration]; #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wnonnull" NSURLSessionDataTask *localDataTask = [session dataTaskWithURL:nil]; #pragma clang diagnostic pop IMP originalAFResumeIMP = method_getImplementation(class_getInstanceMethod([self class], @selector(af_resume))); Class currentClass = [localDataTask class]; while (class_getInstanceMethod(currentClass, @selector(resume))) { Class superClass = [currentClass superclass]; IMP classResumeIMP = method_getImplementation(class_getInstanceMethod(currentClass, @selector(resume))); IMP superclassResumeIMP = method_getImplementation(class_getInstanceMethod(superClass, @selector(resume))); if (classResumeIMP != superclassResumeIMP && originalAFResumeIMP != classResumeIMP) { [self swizzleResumeAndSuspendMethodForClass:currentClass]; } currentClass = [currentClass superclass]; } [localDataTask cancel]; [session finishTasksAndInvalidate]; } } + (void)swizzleResumeAndSuspendMethodForClass:(Class)theClass { Method afResumeMethod = class_getInstanceMethod(self, @selector(af_resume)); Method afSuspendMethod = class_getInstanceMethod(self, @selector(af_suspend)); if (af_addMethod(theClass, @selector(af_resume), afResumeMethod)) { af_swizzleSelector(theClass, @selector(resume), @selector(af_resume)); } if (af_addMethod(theClass, @selector(af_suspend), afSuspendMethod)) { af_swizzleSelector(theClass, @selector(suspend), @selector(af_suspend)); } } - (NSURLSessionTaskState)state { NSAssert(NO, @"State method should never be called in the actual dummy class"); return NSURLSessionTaskStateCanceling; } - (void)af_resume { NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state"); NSURLSessionTaskState state = [self state]; [self af_resume]; if (state != NSURLSessionTaskStateRunning) { [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidResumeNotification object:self]; } } - (void)af_suspend { NSAssert([self respondsToSelector:@selector(state)], @"Does not respond to state"); NSURLSessionTaskState state = [self state]; [self af_suspend]; if (state != NSURLSessionTaskStateSuspended) { [[NSNotificationCenter defaultCenter] postNotificationName:AFNSURLSessionTaskDidSuspendNotification object:self]; } } @end #pragma mark - @interface AFURLSessionManager () @property (readwrite, nonatomic, strong) NSURLSessionConfiguration *sessionConfiguration; @property (readwrite, nonatomic, strong) NSOperationQueue *operationQueue; @property (readwrite, nonatomic, strong) NSURLSession *session; @property (readwrite, nonatomic, strong) NSMutableDictionary *mutableTaskDelegatesKeyedByTaskIdentifier; @property (readonly, nonatomic, copy) NSString *taskDescriptionForSessionTasks; @property (readwrite, nonatomic, strong) NSLock *lock; @property (readwrite, nonatomic, copy) AFURLSessionDidBecomeInvalidBlock sessionDidBecomeInvalid; @property (readwrite, nonatomic, copy) AFURLSessionDidReceiveAuthenticationChallengeBlock sessionDidReceiveAuthenticationChallenge; @property (readwrite, nonatomic, copy) AFURLSessionDidFinishEventsForBackgroundURLSessionBlock didFinishEventsForBackgroundURLSession; @property (readwrite, nonatomic, copy) AFURLSessionTaskWillPerformHTTPRedirectionBlock taskWillPerformHTTPRedirection; @property (readwrite, nonatomic, copy) AFURLSessionTaskDidReceiveAuthenticationChallengeBlock taskDidReceiveAuthenticationChallenge; @property (readwrite, nonatomic, copy) AFURLSessionTaskNeedNewBodyStreamBlock taskNeedNewBodyStream; @property (readwrite, nonatomic, copy) AFURLSessionTaskDidSendBodyDataBlock taskDidSendBodyData; @property (readwrite, nonatomic, copy) AFURLSessionTaskDidCompleteBlock taskDidComplete; @property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveResponseBlock dataTaskDidReceiveResponse; @property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidBecomeDownloadTaskBlock dataTaskDidBecomeDownloadTask; @property (readwrite, nonatomic, copy) AFURLSessionDataTaskDidReceiveDataBlock dataTaskDidReceiveData; @property (readwrite, nonatomic, copy) AFURLSessionDataTaskWillCacheResponseBlock dataTaskWillCacheResponse; @property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidFinishDownloadingBlock downloadTaskDidFinishDownloading; @property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidWriteDataBlock downloadTaskDidWriteData; @property (readwrite, nonatomic, copy) AFURLSessionDownloadTaskDidResumeBlock downloadTaskDidResume; @end @implementation AFURLSessionManager - (instancetype)init { return [self initWithSessionConfiguration:nil]; } - (instancetype)initWithSessionConfiguration:(NSURLSessionConfiguration *)configuration { self = [super init]; if (!self) { return nil; } if (!configuration) { configuration = [NSURLSessionConfiguration defaultSessionConfiguration]; } self.sessionConfiguration = configuration; self.operationQueue = [[NSOperationQueue alloc] init]; self.operationQueue.maxConcurrentOperationCount = 1; self.session = [NSURLSession sessionWithConfiguration:self.sessionConfiguration delegate:self delegateQueue:self.operationQueue]; self.responseSerializer = [AFJSONResponseSerializer serializer]; self.securityPolicy = [AFSecurityPolicy defaultPolicy]; #if !TARGET_OS_WATCH self.reachabilityManager = [AFNetworkReachabilityManager sharedManager]; #endif self.mutableTaskDelegatesKeyedByTaskIdentifier = [[NSMutableDictionary alloc] init]; self.lock = [[NSLock alloc] init]; self.lock.name = AFURLSessionManagerLockName; [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { for (NSURLSessionDataTask *task in dataTasks) { [self addDelegateForDataTask:task uploadProgress:nil downloadProgress:nil completionHandler:nil]; } for (NSURLSessionUploadTask *uploadTask in uploadTasks) { [self addDelegateForUploadTask:uploadTask progress:nil completionHandler:nil]; } for (NSURLSessionDownloadTask *downloadTask in downloadTasks) { [self addDelegateForDownloadTask:downloadTask progress:nil destination:nil completionHandler:nil]; } }]; return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; } #pragma mark - - (NSString *)taskDescriptionForSessionTasks { return [NSString stringWithFormat:@"%p", self]; } - (void)taskDidResume:(NSNotification *)notification { NSURLSessionTask *task = notification.object; if ([task respondsToSelector:@selector(taskDescription)]) { if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) { dispatch_async(dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidResumeNotification object:task]; }); } } } - (void)taskDidSuspend:(NSNotification *)notification { NSURLSessionTask *task = notification.object; if ([task respondsToSelector:@selector(taskDescription)]) { if ([task.taskDescription isEqualToString:self.taskDescriptionForSessionTasks]) { dispatch_async(dispatch_get_main_queue(), ^{ [[NSNotificationCenter defaultCenter] postNotificationName:AFNetworkingTaskDidSuspendNotification object:task]; }); } } } #pragma mark - - (AFURLSessionManagerTaskDelegate *)delegateForTask:(NSURLSessionTask *)task { NSParameterAssert(task); AFURLSessionManagerTaskDelegate *delegate = nil; [self.lock lock]; delegate = self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)]; [self.lock unlock]; return delegate; } - (void)setDelegate:(AFURLSessionManagerTaskDelegate *)delegate forTask:(NSURLSessionTask *)task { NSParameterAssert(task); NSParameterAssert(delegate); [self.lock lock]; self.mutableTaskDelegatesKeyedByTaskIdentifier[@(task.taskIdentifier)] = delegate; [delegate setupProgressForTask:task]; [self addNotificationObserverForTask:task]; [self.lock unlock]; } - (void)addDelegateForDataTask:(NSURLSessionDataTask *)dataTask uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; delegate.manager = self; delegate.completionHandler = completionHandler; dataTask.taskDescription = self.taskDescriptionForSessionTasks; [self setDelegate:delegate forTask:dataTask]; delegate.uploadProgressBlock = uploadProgressBlock; delegate.downloadProgressBlock = downloadProgressBlock; } - (void)addDelegateForUploadTask:(NSURLSessionUploadTask *)uploadTask progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; delegate.manager = self; delegate.completionHandler = completionHandler; uploadTask.taskDescription = self.taskDescriptionForSessionTasks; [self setDelegate:delegate forTask:uploadTask]; delegate.uploadProgressBlock = uploadProgressBlock; } - (void)addDelegateForDownloadTask:(NSURLSessionDownloadTask *)downloadTask progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler { AFURLSessionManagerTaskDelegate *delegate = [[AFURLSessionManagerTaskDelegate alloc] init]; delegate.manager = self; delegate.completionHandler = completionHandler; if (destination) { delegate.downloadTaskDidFinishDownloading = ^NSURL * (NSURLSession * __unused session, NSURLSessionDownloadTask *task, NSURL *location) { return destination(location, task.response); }; } downloadTask.taskDescription = self.taskDescriptionForSessionTasks; [self setDelegate:delegate forTask:downloadTask]; delegate.downloadProgressBlock = downloadProgressBlock; } - (void)removeDelegateForTask:(NSURLSessionTask *)task { NSParameterAssert(task); AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; [self.lock lock]; [delegate cleanUpProgressForTask:task]; [self removeNotificationObserverForTask:task]; [self.mutableTaskDelegatesKeyedByTaskIdentifier removeObjectForKey:@(task.taskIdentifier)]; [self.lock unlock]; } #pragma mark - - (NSArray *)tasksForKeyPath:(NSString *)keyPath { __block NSArray *tasks = nil; dispatch_semaphore_t semaphore = dispatch_semaphore_create(0); [self.session getTasksWithCompletionHandler:^(NSArray *dataTasks, NSArray *uploadTasks, NSArray *downloadTasks) { if ([keyPath isEqualToString:NSStringFromSelector(@selector(dataTasks))]) { tasks = dataTasks; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(uploadTasks))]) { tasks = uploadTasks; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(downloadTasks))]) { tasks = downloadTasks; } else if ([keyPath isEqualToString:NSStringFromSelector(@selector(tasks))]) { tasks = [@[dataTasks, uploadTasks, downloadTasks] valueForKeyPath:@"@unionOfArrays.self"]; } dispatch_semaphore_signal(semaphore); }]; dispatch_semaphore_wait(semaphore, DISPATCH_TIME_FOREVER); return tasks; } - (NSArray *)tasks { return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; } - (NSArray *)dataTasks { return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; } - (NSArray *)uploadTasks { return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; } - (NSArray *)downloadTasks { return [self tasksForKeyPath:NSStringFromSelector(_cmd)]; } #pragma mark - - (void)invalidateSessionCancelingTasks:(BOOL)cancelPendingTasks { dispatch_async(dispatch_get_main_queue(), ^{ if (cancelPendingTasks) { [self.session invalidateAndCancel]; } else { [self.session finishTasksAndInvalidate]; } }); } #pragma mark - - (void)setResponseSerializer:(id )responseSerializer { NSParameterAssert(responseSerializer); _responseSerializer = responseSerializer; } #pragma mark - - (void)addNotificationObserverForTask:(NSURLSessionTask *)task { [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidResume:) name:AFNSURLSessionTaskDidResumeNotification object:task]; [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(taskDidSuspend:) name:AFNSURLSessionTaskDidSuspendNotification object:task]; } - (void)removeNotificationObserverForTask:(NSURLSessionTask *)task { [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidSuspendNotification object:task]; [[NSNotificationCenter defaultCenter] removeObserver:self name:AFNSURLSessionTaskDidResumeNotification object:task]; } #pragma mark - - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { return [self dataTaskWithRequest:request uploadProgress:nil downloadProgress:nil completionHandler:completionHandler]; } - (NSURLSessionDataTask *)dataTaskWithRequest:(NSURLRequest *)request uploadProgress:(nullable void (^)(NSProgress *uploadProgress)) uploadProgressBlock downloadProgress:(nullable void (^)(NSProgress *downloadProgress)) downloadProgressBlock completionHandler:(nullable void (^)(NSURLResponse *response, id _Nullable responseObject, NSError * _Nullable error))completionHandler { __block NSURLSessionDataTask *dataTask = nil; url_session_manager_create_task_safely(^{ dataTask = [self.session dataTaskWithRequest:request]; }); [self addDelegateForDataTask:dataTask uploadProgress:uploadProgressBlock downloadProgress:downloadProgressBlock completionHandler:completionHandler]; return dataTask; } #pragma mark - - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromFile:(NSURL *)fileURL progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { __block NSURLSessionUploadTask *uploadTask = nil; url_session_manager_create_task_safely(^{ uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; }); // uploadTask may be nil on iOS7 because uploadTaskWithRequest:fromFile: may return nil despite being documented as nonnull (https://devforums.apple.com/message/926113#926113) if (!uploadTask && self.attemptsToRecreateUploadTasksForBackgroundSessions && self.session.configuration.identifier) { for (NSUInteger attempts = 0; !uploadTask && attempts < AFMaximumNumberOfAttemptsToRecreateBackgroundSessionUploadTask; attempts++) { uploadTask = [self.session uploadTaskWithRequest:request fromFile:fileURL]; } } [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; return uploadTask; } - (NSURLSessionUploadTask *)uploadTaskWithRequest:(NSURLRequest *)request fromData:(NSData *)bodyData progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { __block NSURLSessionUploadTask *uploadTask = nil; url_session_manager_create_task_safely(^{ uploadTask = [self.session uploadTaskWithRequest:request fromData:bodyData]; }); [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; return uploadTask; } - (NSURLSessionUploadTask *)uploadTaskWithStreamedRequest:(NSURLRequest *)request progress:(void (^)(NSProgress *uploadProgress)) uploadProgressBlock completionHandler:(void (^)(NSURLResponse *response, id responseObject, NSError *error))completionHandler { __block NSURLSessionUploadTask *uploadTask = nil; url_session_manager_create_task_safely(^{ uploadTask = [self.session uploadTaskWithStreamedRequest:request]; }); [self addDelegateForUploadTask:uploadTask progress:uploadProgressBlock completionHandler:completionHandler]; return uploadTask; } #pragma mark - - (NSURLSessionDownloadTask *)downloadTaskWithRequest:(NSURLRequest *)request progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler { __block NSURLSessionDownloadTask *downloadTask = nil; url_session_manager_create_task_safely(^{ downloadTask = [self.session downloadTaskWithRequest:request]; }); [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler]; return downloadTask; } - (NSURLSessionDownloadTask *)downloadTaskWithResumeData:(NSData *)resumeData progress:(void (^)(NSProgress *downloadProgress)) downloadProgressBlock destination:(NSURL * (^)(NSURL *targetPath, NSURLResponse *response))destination completionHandler:(void (^)(NSURLResponse *response, NSURL *filePath, NSError *error))completionHandler { __block NSURLSessionDownloadTask *downloadTask = nil; url_session_manager_create_task_safely(^{ downloadTask = [self.session downloadTaskWithResumeData:resumeData]; }); [self addDelegateForDownloadTask:downloadTask progress:downloadProgressBlock destination:destination completionHandler:completionHandler]; return downloadTask; } #pragma mark - - (NSProgress *)uploadProgressForTask:(NSURLSessionTask *)task { return [[self delegateForTask:task] uploadProgress]; } - (NSProgress *)downloadProgressForTask:(NSURLSessionTask *)task { return [[self delegateForTask:task] downloadProgress]; } #pragma mark - - (void)setSessionDidBecomeInvalidBlock:(void (^)(NSURLSession *session, NSError *error))block { self.sessionDidBecomeInvalid = block; } - (void)setSessionDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { self.sessionDidReceiveAuthenticationChallenge = block; } - (void)setDidFinishEventsForBackgroundURLSessionBlock:(void (^)(NSURLSession *session))block { self.didFinishEventsForBackgroundURLSession = block; } #pragma mark - - (void)setTaskNeedNewBodyStreamBlock:(NSInputStream * (^)(NSURLSession *session, NSURLSessionTask *task))block { self.taskNeedNewBodyStream = block; } - (void)setTaskWillPerformHTTPRedirectionBlock:(NSURLRequest * (^)(NSURLSession *session, NSURLSessionTask *task, NSURLResponse *response, NSURLRequest *request))block { self.taskWillPerformHTTPRedirection = block; } - (void)setTaskDidReceiveAuthenticationChallengeBlock:(NSURLSessionAuthChallengeDisposition (^)(NSURLSession *session, NSURLSessionTask *task, NSURLAuthenticationChallenge *challenge, NSURLCredential * __autoreleasing *credential))block { self.taskDidReceiveAuthenticationChallenge = block; } - (void)setTaskDidSendBodyDataBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, int64_t bytesSent, int64_t totalBytesSent, int64_t totalBytesExpectedToSend))block { self.taskDidSendBodyData = block; } - (void)setTaskDidCompleteBlock:(void (^)(NSURLSession *session, NSURLSessionTask *task, NSError *error))block { self.taskDidComplete = block; } #pragma mark - - (void)setDataTaskDidReceiveResponseBlock:(NSURLSessionResponseDisposition (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLResponse *response))block { self.dataTaskDidReceiveResponse = block; } - (void)setDataTaskDidBecomeDownloadTaskBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSURLSessionDownloadTask *downloadTask))block { self.dataTaskDidBecomeDownloadTask = block; } - (void)setDataTaskDidReceiveDataBlock:(void (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSData *data))block { self.dataTaskDidReceiveData = block; } - (void)setDataTaskWillCacheResponseBlock:(NSCachedURLResponse * (^)(NSURLSession *session, NSURLSessionDataTask *dataTask, NSCachedURLResponse *proposedResponse))block { self.dataTaskWillCacheResponse = block; } #pragma mark - - (void)setDownloadTaskDidFinishDownloadingBlock:(NSURL * (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, NSURL *location))block { self.downloadTaskDidFinishDownloading = block; } - (void)setDownloadTaskDidWriteDataBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t bytesWritten, int64_t totalBytesWritten, int64_t totalBytesExpectedToWrite))block { self.downloadTaskDidWriteData = block; } - (void)setDownloadTaskDidResumeBlock:(void (^)(NSURLSession *session, NSURLSessionDownloadTask *downloadTask, int64_t fileOffset, int64_t expectedTotalBytes))block { self.downloadTaskDidResume = block; } #pragma mark - NSObject - (NSString *)description { return [NSString stringWithFormat:@"<%@: %p, session: %@, operationQueue: %@>", NSStringFromClass([self class]), self, self.session, self.operationQueue]; } - (BOOL)respondsToSelector:(SEL)selector { if (selector == @selector(URLSession:task:willPerformHTTPRedirection:newRequest:completionHandler:)) { return self.taskWillPerformHTTPRedirection != nil; } else if (selector == @selector(URLSession:dataTask:didReceiveResponse:completionHandler:)) { return self.dataTaskDidReceiveResponse != nil; } else if (selector == @selector(URLSession:dataTask:willCacheResponse:completionHandler:)) { return self.dataTaskWillCacheResponse != nil; } else if (selector == @selector(URLSessionDidFinishEventsForBackgroundURLSession:)) { return self.didFinishEventsForBackgroundURLSession != nil; } return [[self class] instancesRespondToSelector:selector]; } #pragma mark - NSURLSessionDelegate - (void)URLSession:(NSURLSession *)session didBecomeInvalidWithError:(NSError *)error { if (self.sessionDidBecomeInvalid) { self.sessionDidBecomeInvalid(session, error); } [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDidInvalidateNotification object:session]; } - (void)URLSession:(NSURLSession *)session didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential *credential = nil; if (self.sessionDidReceiveAuthenticationChallenge) { disposition = self.sessionDidReceiveAuthenticationChallenge(session, challenge, &credential); } else { if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; if (credential) { disposition = NSURLSessionAuthChallengeUseCredential; } else { disposition = NSURLSessionAuthChallengePerformDefaultHandling; } } else { disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; } } else { disposition = NSURLSessionAuthChallengePerformDefaultHandling; } } if (completionHandler) { completionHandler(disposition, credential); } } #pragma mark - NSURLSessionTaskDelegate - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task willPerformHTTPRedirection:(NSHTTPURLResponse *)response newRequest:(NSURLRequest *)request completionHandler:(void (^)(NSURLRequest *))completionHandler { NSURLRequest *redirectRequest = request; if (self.taskWillPerformHTTPRedirection) { redirectRequest = self.taskWillPerformHTTPRedirection(session, task, response, request); } if (completionHandler) { completionHandler(redirectRequest); } } - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didReceiveChallenge:(NSURLAuthenticationChallenge *)challenge completionHandler:(void (^)(NSURLSessionAuthChallengeDisposition disposition, NSURLCredential *credential))completionHandler { NSURLSessionAuthChallengeDisposition disposition = NSURLSessionAuthChallengePerformDefaultHandling; __block NSURLCredential *credential = nil; if (self.taskDidReceiveAuthenticationChallenge) { disposition = self.taskDidReceiveAuthenticationChallenge(session, task, challenge, &credential); } else { if ([challenge.protectionSpace.authenticationMethod isEqualToString:NSURLAuthenticationMethodServerTrust]) { if ([self.securityPolicy evaluateServerTrust:challenge.protectionSpace.serverTrust forDomain:challenge.protectionSpace.host]) { disposition = NSURLSessionAuthChallengeUseCredential; credential = [NSURLCredential credentialForTrust:challenge.protectionSpace.serverTrust]; } else { disposition = NSURLSessionAuthChallengeCancelAuthenticationChallenge; } } else { disposition = NSURLSessionAuthChallengePerformDefaultHandling; } } if (completionHandler) { completionHandler(disposition, credential); } } - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task needNewBodyStream:(void (^)(NSInputStream *bodyStream))completionHandler { NSInputStream *inputStream = nil; if (self.taskNeedNewBodyStream) { inputStream = self.taskNeedNewBodyStream(session, task); } else if (task.originalRequest.HTTPBodyStream && [task.originalRequest.HTTPBodyStream conformsToProtocol:@protocol(NSCopying)]) { inputStream = [task.originalRequest.HTTPBodyStream copy]; } if (completionHandler) { completionHandler(inputStream); } } - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didSendBodyData:(int64_t)bytesSent totalBytesSent:(int64_t)totalBytesSent totalBytesExpectedToSend:(int64_t)totalBytesExpectedToSend { int64_t totalUnitCount = totalBytesExpectedToSend; if(totalUnitCount == NSURLSessionTransferSizeUnknown) { NSString *contentLength = [task.originalRequest valueForHTTPHeaderField:@"Content-Length"]; if(contentLength) { totalUnitCount = (int64_t) [contentLength longLongValue]; } } if (self.taskDidSendBodyData) { self.taskDidSendBodyData(session, task, bytesSent, totalBytesSent, totalUnitCount); } } - (void)URLSession:(NSURLSession *)session task:(NSURLSessionTask *)task didCompleteWithError:(NSError *)error { AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:task]; // delegate may be nil when completing a task in the background if (delegate) { [delegate URLSession:session task:task didCompleteWithError:error]; [self removeDelegateForTask:task]; } if (self.taskDidComplete) { self.taskDidComplete(session, task, error); } } #pragma mark - NSURLSessionDataDelegate - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveResponse:(NSURLResponse *)response completionHandler:(void (^)(NSURLSessionResponseDisposition disposition))completionHandler { NSURLSessionResponseDisposition disposition = NSURLSessionResponseAllow; if (self.dataTaskDidReceiveResponse) { disposition = self.dataTaskDidReceiveResponse(session, dataTask, response); } if (completionHandler) { completionHandler(disposition); } } - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didBecomeDownloadTask:(NSURLSessionDownloadTask *)downloadTask { AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask]; if (delegate) { [self removeDelegateForTask:dataTask]; [self setDelegate:delegate forTask:downloadTask]; } if (self.dataTaskDidBecomeDownloadTask) { self.dataTaskDidBecomeDownloadTask(session, dataTask, downloadTask); } } - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask didReceiveData:(NSData *)data { AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:dataTask]; [delegate URLSession:session dataTask:dataTask didReceiveData:data]; if (self.dataTaskDidReceiveData) { self.dataTaskDidReceiveData(session, dataTask, data); } } - (void)URLSession:(NSURLSession *)session dataTask:(NSURLSessionDataTask *)dataTask willCacheResponse:(NSCachedURLResponse *)proposedResponse completionHandler:(void (^)(NSCachedURLResponse *cachedResponse))completionHandler { NSCachedURLResponse *cachedResponse = proposedResponse; if (self.dataTaskWillCacheResponse) { cachedResponse = self.dataTaskWillCacheResponse(session, dataTask, proposedResponse); } if (completionHandler) { completionHandler(cachedResponse); } } - (void)URLSessionDidFinishEventsForBackgroundURLSession:(NSURLSession *)session { if (self.didFinishEventsForBackgroundURLSession) { dispatch_async(dispatch_get_main_queue(), ^{ self.didFinishEventsForBackgroundURLSession(session); }); } } #pragma mark - NSURLSessionDownloadDelegate - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didFinishDownloadingToURL:(NSURL *)location { AFURLSessionManagerTaskDelegate *delegate = [self delegateForTask:downloadTask]; if (self.downloadTaskDidFinishDownloading) { NSURL *fileURL = self.downloadTaskDidFinishDownloading(session, downloadTask, location); if (fileURL) { delegate.downloadFileURL = fileURL; NSError *error = nil; [[NSFileManager defaultManager] moveItemAtURL:location toURL:fileURL error:&error]; if (error) { [[NSNotificationCenter defaultCenter] postNotificationName:AFURLSessionDownloadTaskDidFailToMoveFileNotification object:downloadTask userInfo:error.userInfo]; } return; } } if (delegate) { [delegate URLSession:session downloadTask:downloadTask didFinishDownloadingToURL:location]; } } - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didWriteData:(int64_t)bytesWritten totalBytesWritten:(int64_t)totalBytesWritten totalBytesExpectedToWrite:(int64_t)totalBytesExpectedToWrite { if (self.downloadTaskDidWriteData) { self.downloadTaskDidWriteData(session, downloadTask, bytesWritten, totalBytesWritten, totalBytesExpectedToWrite); } } - (void)URLSession:(NSURLSession *)session downloadTask:(NSURLSessionDownloadTask *)downloadTask didResumeAtOffset:(int64_t)fileOffset expectedTotalBytes:(int64_t)expectedTotalBytes { if (self.downloadTaskDidResume) { self.downloadTaskDidResume(session, downloadTask, fileOffset, expectedTotalBytes); } } #pragma mark - NSSecureCoding + (BOOL)supportsSecureCoding { return YES; } - (instancetype)initWithCoder:(NSCoder *)decoder { NSURLSessionConfiguration *configuration = [decoder decodeObjectOfClass:[NSURLSessionConfiguration class] forKey:@"sessionConfiguration"]; self = [self initWithSessionConfiguration:configuration]; if (!self) { return nil; } return self; } - (void)encodeWithCoder:(NSCoder *)coder { [coder encodeObject:self.session.configuration forKey:@"sessionConfiguration"]; } #pragma mark - NSCopying - (instancetype)copyWithZone:(NSZone *)zone { return [[[self class] allocWithZone:zone] initWithSessionConfiguration:self.session.configuration]; } @end ================================================ FILE: GCDAsyncSocket/AppDelegate.h ================================================ // // AppDelegate.h // GCDAsyncSocket // // Created by caokun on 16/7/5. // Copyright © 2016年 caokun. All rights reserved. // #import @interface AppDelegate : UIResponder @property (strong, nonatomic) UIWindow *window; @end ================================================ FILE: GCDAsyncSocket/AppDelegate.m ================================================ // // AppDelegate.m // GCDAsyncSocket // // Created by caokun on 16/7/5. // Copyright © 2016年 caokun. All rights reserved. // #import "AppDelegate.h" @interface AppDelegate () @end @implementation AppDelegate - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { // Override point for customization after application launch. return YES; } - (void)applicationWillResignActive:(UIApplication *)application { // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state. // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game. } - (void)applicationDidEnterBackground:(UIApplication *)application { // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits. } - (void)applicationWillEnterForeground:(UIApplication *)application { // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background. } - (void)applicationDidBecomeActive:(UIApplication *)application { // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface. } - (void)applicationWillTerminate:(UIApplication *)application { // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:. } @end ================================================ FILE: GCDAsyncSocket/Assets.xcassets/AppIcon.appiconset/Contents.json ================================================ { "images" : [ { "idiom" : "iphone", "size" : "29x29", "scale" : "2x" }, { "idiom" : "iphone", "size" : "29x29", "scale" : "3x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "2x" }, { "idiom" : "iphone", "size" : "40x40", "scale" : "3x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "2x" }, { "idiom" : "iphone", "size" : "60x60", "scale" : "3x" } ], "info" : { "version" : 1, "author" : "xcode" } } ================================================ FILE: GCDAsyncSocket/Base.lproj/LaunchScreen.storyboard ================================================ ================================================ FILE: GCDAsyncSocket/Base.lproj/Main.storyboard ================================================ ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/AsyncSocket.h ================================================ // // AsyncSocket.h // // This class is in the public domain. // Originally created by Dustin Voss on Wed Jan 29 2003. // Updated and maintained by Deusty Designs and the Mac development community. // // http://code.google.com/p/cocoaasyncsocket/ // #import @class AsyncSocket; @class AsyncReadPacket; @class AsyncWritePacket; extern NSString *const AsyncSocketException; extern NSString *const AsyncSocketErrorDomain; typedef NS_ENUM(NSInteger, AsyncSocketError) { AsyncSocketCFSocketError = kCFSocketError, // From CFSocketError enum. AsyncSocketNoError = 0, // Never used. AsyncSocketCanceledError, // onSocketWillConnect: returned NO. AsyncSocketConnectTimeoutError, AsyncSocketReadMaxedOutError, // Reached set maxLength without completing AsyncSocketReadTimeoutError, AsyncSocketWriteTimeoutError }; @protocol AsyncSocketDelegate @optional /** * In the event of an error, the socket is closed. * You may call "unreadData" during this call-back to get the last bit of data off the socket. * When connecting, this delegate method may be called * before"onSocket:didAcceptNewSocket:" or "onSocket:didConnectToHost:". **/ - (void)onSocket:(AsyncSocket *)sock willDisconnectWithError:(NSError *)err; /** * Called when a socket disconnects with or without error. If you want to release a socket after it disconnects, * do so here. It is not safe to do that during "onSocket:willDisconnectWithError:". * * If you call the disconnect method, and the socket wasn't already disconnected, * this delegate method will be called before the disconnect method returns. **/ - (void)onSocketDidDisconnect:(AsyncSocket *)sock; /** * Called when a socket accepts a connection. Another socket is spawned to handle it. The new socket will have * the same delegate and will call "onSocket:didConnectToHost:port:". **/ - (void)onSocket:(AsyncSocket *)sock didAcceptNewSocket:(AsyncSocket *)newSocket; /** * Called when a new socket is spawned to handle a connection. This method should return the run-loop of the * thread on which the new socket and its delegate should operate. If omitted, [NSRunLoop currentRunLoop] is used. **/ - (NSRunLoop *)onSocket:(AsyncSocket *)sock wantsRunLoopForNewSocket:(AsyncSocket *)newSocket; /** * Called when a socket is about to connect. This method should return YES to continue, or NO to abort. * If aborted, will result in AsyncSocketCanceledError. * * If the connectToHost:onPort:error: method was called, the delegate will be able to access and configure the * CFReadStream and CFWriteStream as desired prior to connection. * * If the connectToAddress:error: method was called, the delegate will be able to access and configure the * CFSocket and CFSocketNativeHandle (BSD socket) as desired prior to connection. You will be able to access and * configure the CFReadStream and CFWriteStream in the onSocket:didConnectToHost:port: method. **/ - (BOOL)onSocketWillConnect:(AsyncSocket *)sock; /** * Called when a socket connects and is ready for reading and writing. * The host parameter will be an IP address, not a DNS name. **/ - (void)onSocket:(AsyncSocket *)sock didConnectToHost:(NSString *)host port:(UInt16)port; /** * Called when a socket has completed reading the requested data into memory. * Not called if there is an error. **/ - (void)onSocket:(AsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag; /** * Called when a socket has read in data, but has not yet completed the read. * This would occur if using readToData: or readToLength: methods. * It may be used to for things such as updating progress bars. **/ - (void)onSocket:(AsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; /** * Called when a socket has completed writing the requested data. Not called if there is an error. **/ - (void)onSocket:(AsyncSocket *)sock didWriteDataWithTag:(long)tag; /** * Called when a socket has written some data, but has not yet completed the entire write. * It may be used to for things such as updating progress bars. **/ - (void)onSocket:(AsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; /** * Called if a read operation has reached its timeout without completing. * This method allows you to optionally extend the timeout. * If you return a positive time interval (> 0) the read's timeout will be extended by the given amount. * If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual. * * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. * The length parameter is the number of bytes that have been read so far for the read operation. * * Note that this method may be called multiple times for a single read if you return positive numbers. **/ - (NSTimeInterval)onSocket:(AsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag elapsed:(NSTimeInterval)elapsed bytesDone:(NSUInteger)length; /** * Called if a write operation has reached its timeout without completing. * This method allows you to optionally extend the timeout. * If you return a positive time interval (> 0) the write's timeout will be extended by the given amount. * If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual. * * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. * The length parameter is the number of bytes that have been written so far for the write operation. * * Note that this method may be called multiple times for a single write if you return positive numbers. **/ - (NSTimeInterval)onSocket:(AsyncSocket *)sock shouldTimeoutWriteWithTag:(long)tag elapsed:(NSTimeInterval)elapsed bytesDone:(NSUInteger)length; /** * Called after the socket has successfully completed SSL/TLS negotiation. * This method is not called unless you use the provided startTLS method. * * If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close, * and the onSocket:willDisconnectWithError: delegate method will be called with the specific SSL error code. **/ - (void)onSocketDidSecure:(AsyncSocket *)sock; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @interface AsyncSocket : NSObject { CFSocketNativeHandle theNativeSocket4; CFSocketNativeHandle theNativeSocket6; CFSocketRef theSocket4; // IPv4 accept or connect socket CFSocketRef theSocket6; // IPv6 accept or connect socket CFReadStreamRef theReadStream; CFWriteStreamRef theWriteStream; CFRunLoopSourceRef theSource4; // For theSocket4 CFRunLoopSourceRef theSource6; // For theSocket6 CFRunLoopRef theRunLoop; CFSocketContext theContext; NSArray *theRunLoopModes; NSTimer *theConnectTimer; NSMutableArray *theReadQueue; AsyncReadPacket *theCurrentRead; NSTimer *theReadTimer; NSMutableData *partialReadBuffer; NSMutableArray *theWriteQueue; AsyncWritePacket *theCurrentWrite; NSTimer *theWriteTimer; id theDelegate; UInt16 theFlags; long theUserData; } - (id)init; - (id)initWithDelegate:(id)delegate; - (id)initWithDelegate:(id)delegate userData:(long)userData; /* String representation is long but has no "\n". */ - (NSString *)description; /** * Use "canSafelySetDelegate" to see if there is any pending business (reads and writes) with the current delegate * before changing it. It is, of course, safe to change the delegate before connecting or accepting connections. **/ - (id)delegate; - (BOOL)canSafelySetDelegate; - (void)setDelegate:(id)delegate; /* User data can be a long, or an id or void * cast to a long. */ - (long)userData; - (void)setUserData:(long)userData; /* Don't use these to read or write. And don't close them either! */ - (CFSocketRef)getCFSocket; - (CFReadStreamRef)getCFReadStream; - (CFWriteStreamRef)getCFWriteStream; // Once one of the accept or connect methods are called, the AsyncSocket instance is locked in // and the other accept/connect methods can't be called without disconnecting the socket first. // If the attempt fails or times out, these methods either return NO or // call "onSocket:willDisconnectWithError:" and "onSockedDidDisconnect:". // When an incoming connection is accepted, AsyncSocket invokes several delegate methods. // These methods are (in chronological order): // 1. onSocket:didAcceptNewSocket: // 2. onSocket:wantsRunLoopForNewSocket: // 3. onSocketWillConnect: // // Your server code will need to retain the accepted socket (if you want to accept it). // The best place to do this is probably in the onSocket:didAcceptNewSocket: method. // // After the read and write streams have been setup for the newly accepted socket, // the onSocket:didConnectToHost:port: method will be called on the proper run loop. // // Multithreading Note: If you're going to be moving the newly accepted socket to another run // loop by implementing onSocket:wantsRunLoopForNewSocket:, then you should wait until the // onSocket:didConnectToHost:port: method before calling read, write, or startTLS methods. // Otherwise read/write events are scheduled on the incorrect runloop, and chaos may ensue. /** * Tells the socket to begin listening and accepting connections on the given port. * When a connection comes in, the AsyncSocket instance will call the various delegate methods (see above). * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) **/ - (BOOL)acceptOnPort:(UInt16)port error:(NSError **)errPtr; /** * This method is the same as acceptOnPort:error: with the additional option * of specifying which interface to listen on. So, for example, if you were writing code for a server that * has multiple IP addresses, you could specify which address you wanted to listen on. Or you could use it * to specify that the socket should only accept connections over ethernet, and not other interfaces such as wifi. * You may also use the special strings "localhost" or "loopback" to specify that * the socket only accept connections from the local machine. * * To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method. **/ - (BOOL)acceptOnInterface:(NSString *)interface port:(UInt16)port error:(NSError **)errPtr; /** * Connects to the given host and port. * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2") **/ - (BOOL)connectToHost:(NSString *)hostname onPort:(UInt16)port error:(NSError **)errPtr; /** * This method is the same as connectToHost:onPort:error: with an additional timeout option. * To not time out use a negative time interval, or simply use the connectToHost:onPort:error: method. **/ - (BOOL)connectToHost:(NSString *)hostname onPort:(UInt16)port withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; /** * Connects to the given address, specified as a sockaddr structure wrapped in a NSData object. * For example, a NSData object returned from NSNetService's addresses method. * * If you have an existing struct sockaddr you can convert it to a NSData object like so: * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; **/ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; /** * This method is the same as connectToAddress:error: with an additional timeout option. * To not time out use a negative time interval, or simply use the connectToAddress:error: method. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; - (BOOL)connectToAddress:(NSData *)remoteAddr viaInterfaceAddress:(NSData *)interfaceAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; /** * Disconnects immediately. Any pending reads or writes are dropped. * If the socket is not already disconnected, the onSocketDidDisconnect delegate method * will be called immediately, before this method returns. * * Please note the recommended way of releasing an AsyncSocket instance (e.g. in a dealloc method) * [asyncSocket setDelegate:nil]; * [asyncSocket disconnect]; * [asyncSocket release]; **/ - (void)disconnect; /** * Disconnects after all pending reads have completed. * After calling this, the read and write methods will do nothing. * The socket will disconnect even if there are still pending writes. **/ - (void)disconnectAfterReading; /** * Disconnects after all pending writes have completed. * After calling this, the read and write methods will do nothing. * The socket will disconnect even if there are still pending reads. **/ - (void)disconnectAfterWriting; /** * Disconnects after all pending reads and writes have completed. * After calling this, the read and write methods will do nothing. **/ - (void)disconnectAfterReadingAndWriting; /* Returns YES if the socket and streams are open, connected, and ready for reading and writing. */ - (BOOL)isConnected; /** * Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected. * The host will be an IP address. **/ - (NSString *)connectedHost; - (UInt16)connectedPort; - (NSString *)localHost; - (UInt16)localPort; /** * Returns the local or remote address to which this socket is connected, * specified as a sockaddr structure wrapped in a NSData object. * * See also the connectedHost, connectedPort, localHost and localPort methods. **/ - (NSData *)connectedAddress; - (NSData *)localAddress; /** * Returns whether the socket is IPv4 or IPv6. * An accepting socket may be both. **/ - (BOOL)isIPv4; - (BOOL)isIPv6; // The readData and writeData methods won't block (they are asynchronous). // // When a read is complete the onSocket:didReadData:withTag: delegate method is called. // When a write is complete the onSocket:didWriteDataWithTag: delegate method is called. // // You may optionally set a timeout for any read/write operation. (To not timeout, use a negative time interval.) // If a read/write opertion times out, the corresponding "onSocket:shouldTimeout..." delegate method // is called to optionally allow you to extend the timeout. // Upon a timeout, the "onSocket:willDisconnectWithError:" method is called, followed by "onSocketDidDisconnect". // // The tag is for your convenience. // You can use it as an array index, step number, state id, pointer, etc. /** * Reads the first available bytes that become available on the socket. * * If the timeout value is negative, the read operation will not use a timeout. **/ - (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads the first available bytes that become available on the socket. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, the socket will create a buffer for you. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. * After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer. **/ - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag; /** * Reads the first available bytes that become available on the socket. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * A maximum of length bytes will be read. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * If maxLength is zero, no length restriction is enforced. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. * After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer. **/ - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag; /** * Reads the given number of bytes. * * If the timeout value is negative, the read operation will not use a timeout. * * If the length is 0, this method does nothing and the delegate is not called. **/ - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads the given number of bytes. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * * If the length is 0, this method does nothing and the delegate is not called. * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. * After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer. **/ - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * * If the timeout value is negative, the read operation will not use a timeout. * * If you pass nil or zero-length data as the "data" parameter, * the method will do nothing, and the delegate will not be called. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for * a character, the read will prematurely end. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. * After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for * a character, the read will prematurely end. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * * If the timeout value is negative, the read operation will not use a timeout. * * If maxLength is zero, no length restriction is enforced. * Otherwise if maxLength bytes are read without completing the read, * it is treated similarly to a timeout - the socket is closed with a AsyncSocketReadMaxedOutError. * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. * * If you pass nil or zero-length data as the "data" parameter, * the method will do nothing, and the delegate will not be called. * If you pass a maxLength parameter that is less than the length of the data parameter, * the method will do nothing, and the delegate will not be called. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for * a character, the read will prematurely end. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * A maximum of length bytes will be read. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * * If maxLength is zero, no length restriction is enforced. * Otherwise if maxLength bytes are read without completing the read, * it is treated similarly to a timeout - the socket is closed with a AsyncSocketReadMaxedOutError. * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. * * If you pass a maxLength parameter that is less than the length of the data parameter, * the method will do nothing, and the delegate will not be called. * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. * After completion, the data returned in onSocket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * Note that this method is not character-set aware, so if a separator can occur naturally as part of the encoding for * a character, the read will prematurely end. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag; /** * Writes data to the socket, and calls the delegate when finished. * * If you pass in nil or zero-length data, this method does nothing and the delegate will not be called. * If the timeout value is negative, the write operation will not use a timeout. **/ - (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Returns progress of current read or write, from 0.0 to 1.0, or NaN if no read/write (use isnan() to check). * "tag", "done" and "total" will be filled in if they aren't NULL. **/ - (float)progressOfReadReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total; - (float)progressOfWriteReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total; /** * Secures the connection using SSL/TLS. * * This method may be called at any time, and the TLS handshake will occur after all pending reads and writes * are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing * the upgrade to TLS at the same time, without having to wait for the write to finish. * Any reads or writes scheduled after this method is called will occur over the secured connection. * * The possible keys and values for the TLS settings are well documented. * Some possible keys are: * - kCFStreamSSLLevel * - kCFStreamSSLAllowsExpiredCertificates * - kCFStreamSSLAllowsExpiredRoots * - kCFStreamSSLAllowsAnyRoot * - kCFStreamSSLValidatesCertificateChain * - kCFStreamSSLPeerName * - kCFStreamSSLCertificates * - kCFStreamSSLIsServer * * Please refer to Apple's documentation for associated values, as well as other possible keys. * * If you pass in nil or an empty dictionary, the default settings will be used. * * The default settings will check to make sure the remote party's certificate is signed by a * trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired. * However it will not verify the name on the certificate unless you * give it a name to verify against via the kCFStreamSSLPeerName key. * The security implications of this are important to understand. * Imagine you are attempting to create a secure connection to MySecureServer.com, * but your socket gets directed to MaliciousServer.com because of a hacked DNS server. * If you simply use the default settings, and MaliciousServer.com has a valid certificate, * the default settings will not detect any problems since the certificate is valid. * To properly secure your connection in this particular scenario you * should set the kCFStreamSSLPeerName property to "MySecureServer.com". * If you do not know the peer name of the remote host in advance (for example, you're not sure * if it will be "domain.com" or "www.domain.com"), then you can use the default settings to validate the * certificate, and then use the X509Certificate class to verify the issuer after the socket has been secured. * The X509Certificate class is part of the CocoaAsyncSocket open source project. **/ - (void)startTLS:(NSDictionary *)tlsSettings; /** * For handling readDataToData requests, data is necessarily read from the socket in small increments. * The performance can be much improved by allowing AsyncSocket to read larger chunks at a time and * store any overflow in a small internal buffer. * This is termed pre-buffering, as some data may be read for you before you ask for it. * If you use readDataToData a lot, enabling pre-buffering will result in better performance, especially on the iPhone. * * The default pre-buffering state is controlled by the DEFAULT_PREBUFFERING definition. * It is highly recommended one leave this set to YES. * * This method exists in case pre-buffering needs to be disabled by default for some unforeseen reason. * In that case, this method exists to allow one to easily enable pre-buffering when ready. **/ - (void)enablePreBuffering; /** * When you create an AsyncSocket, it is added to the runloop of the current thread. * So for manually created sockets, it is easiest to simply create the socket on the thread you intend to use it. * * If a new socket is accepted, the delegate method onSocket:wantsRunLoopForNewSocket: is called to * allow you to place the socket on a separate thread. This works best in conjunction with a thread pool design. * * If, however, you need to move the socket to a separate thread at a later time, this * method may be used to accomplish the task. * * This method must be called from the thread/runloop the socket is currently running on. * * Note: After calling this method, all further method calls to this object should be done from the given runloop. * Also, all delegate calls will be sent on the given runloop. **/ - (BOOL)moveToRunLoop:(NSRunLoop *)runLoop; /** * Allows you to configure which run loop modes the socket uses. * The default set of run loop modes is NSDefaultRunLoopMode. * * If you'd like your socket to continue operation during other modes, you may want to add modes such as * NSModalPanelRunLoopMode or NSEventTrackingRunLoopMode. Or you may simply want to use NSRunLoopCommonModes. * * Accepted sockets will automatically inherit the same run loop modes as the listening socket. * * Note: NSRunLoopCommonModes is defined in 10.5. For previous versions one can use kCFRunLoopCommonModes. **/ - (BOOL)setRunLoopModes:(NSArray *)runLoopModes; - (BOOL)addRunLoopMode:(NSString *)runLoopMode; - (BOOL)removeRunLoopMode:(NSString *)runLoopMode; /** * Returns the current run loop modes the AsyncSocket instance is operating in. * The default set of run loop modes is NSDefaultRunLoopMode. **/ - (NSArray *)runLoopModes; /** * In the event of an error, this method may be called during onSocket:willDisconnectWithError: to read * any data that's left on the socket. **/ - (NSData *)unreadData; /* A few common line separators, for use with the readDataToData:... methods. */ + (NSData *)CRLFData; // 0x0D0A + (NSData *)CRData; // 0x0D + (NSData *)LFData; // 0x0A + (NSData *)ZeroData; // 0x00 @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/AsyncSocket.m ================================================ // // AsyncSocket.m // // This class is in the public domain. // Originally created by Dustin Voss on Wed Jan 29 2003. // Updated and maintained by Deusty Designs and the Mac development community. // // http://code.google.com/p/cocoaasyncsocket/ // #if ! __has_feature(objc_arc) #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif #import "AsyncSocket.h" #import #import #import #import #import #if TARGET_OS_IPHONE // Note: You may need to add the CFNetwork Framework to your project #import #endif #pragma mark Declarations #define DEFAULT_PREBUFFERING YES // Whether pre-buffering is enabled by default #define READQUEUE_CAPACITY 5 // Initial capacity #define WRITEQUEUE_CAPACITY 5 // Initial capacity #define READALL_CHUNKSIZE 256 // Incremental increase in buffer size #define WRITE_CHUNKSIZE (1024 * 4) // Limit on size of each write pass // AsyncSocket is RunLoop based, and is thus not thread-safe. // You must always access your AsyncSocket instance from the thread/runloop in which the instance is running. // You can use methods such as performSelectorOnThread to accomplish this. // Failure to comply with these thread-safety rules may result in errors. // You can enable this option to help diagnose where you are incorrectly accessing your socket. #if DEBUG #define DEBUG_THREAD_SAFETY 1 #else #define DEBUG_THREAD_SAFETY 0 #endif // // If you constantly need to access your socket from multiple threads // then you may consider using GCDAsyncSocket instead, which is thread-safe. NSString *const AsyncSocketException = @"AsyncSocketException"; NSString *const AsyncSocketErrorDomain = @"AsyncSocketErrorDomain"; enum AsyncSocketFlags { kEnablePreBuffering = 1 << 0, // If set, pre-buffering is enabled kDidStartDelegate = 1 << 1, // If set, disconnection results in delegate call kDidCompleteOpenForRead = 1 << 2, // If set, open callback has been called for read stream kDidCompleteOpenForWrite = 1 << 3, // If set, open callback has been called for write stream kStartingReadTLS = 1 << 4, // If set, we're waiting for TLS negotiation to complete kStartingWriteTLS = 1 << 5, // If set, we're waiting for TLS negotiation to complete kForbidReadsWrites = 1 << 6, // If set, no new reads or writes are allowed kDisconnectAfterReads = 1 << 7, // If set, disconnect after no more reads are queued kDisconnectAfterWrites = 1 << 8, // If set, disconnect after no more writes are queued kClosingWithError = 1 << 9, // If set, the socket is being closed due to an error kDequeueReadScheduled = 1 << 10, // If set, a maybeDequeueRead operation is already scheduled kDequeueWriteScheduled = 1 << 11, // If set, a maybeDequeueWrite operation is already scheduled kSocketCanAcceptBytes = 1 << 12, // If set, we know socket can accept bytes. If unset, it's unknown. kSocketHasBytesAvailable = 1 << 13, // If set, we know socket has bytes available. If unset, it's unknown. }; @interface AsyncSocket (Private) // Connecting - (void)startConnectTimeout:(NSTimeInterval)timeout; - (void)endConnectTimeout; - (void)doConnectTimeout:(NSTimer *)timer; // Socket Implementation - (CFSocketRef)newAcceptSocketForAddress:(NSData *)addr error:(NSError **)errPtr; - (BOOL)createSocketForAddress:(NSData *)remoteAddr error:(NSError **)errPtr; - (BOOL)bindSocketToAddress:(NSData *)interfaceAddr error:(NSError **)errPtr; - (BOOL)attachSocketsToRunLoop:(NSRunLoop *)runLoop error:(NSError **)errPtr; - (BOOL)configureSocketAndReturnError:(NSError **)errPtr; - (BOOL)connectSocketToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; - (void)doAcceptWithSocket:(CFSocketNativeHandle)newSocket; - (void)doSocketOpen:(CFSocketRef)sock withCFSocketError:(CFSocketError)err; // Stream Implementation - (BOOL)createStreamsFromNative:(CFSocketNativeHandle)native error:(NSError **)errPtr; - (BOOL)createStreamsToHost:(NSString *)hostname onPort:(UInt16)port error:(NSError **)errPtr; - (BOOL)attachStreamsToRunLoop:(NSRunLoop *)runLoop error:(NSError **)errPtr; - (BOOL)configureStreamsAndReturnError:(NSError **)errPtr; - (BOOL)openStreamsAndReturnError:(NSError **)errPtr; - (void)doStreamOpen; - (BOOL)setSocketFromStreamsAndReturnError:(NSError **)errPtr; // Disconnect Implementation - (void)closeWithError:(NSError *)err; - (void)recoverUnreadData; - (void)emptyQueues; - (void)close; // Errors - (NSError *)getErrnoError; - (NSError *)getAbortError; - (NSError *)getStreamError; - (NSError *)getSocketError; - (NSError *)getConnectTimeoutError; - (NSError *)getReadMaxedOutError; - (NSError *)getReadTimeoutError; - (NSError *)getWriteTimeoutError; - (NSError *)errorFromCFStreamError:(CFStreamError)err; // Diagnostics - (BOOL)isDisconnected; - (BOOL)areStreamsConnected; - (NSString *)connectedHostFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket; - (NSString *)connectedHostFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket; - (NSString *)connectedHostFromCFSocket4:(CFSocketRef)socket; - (NSString *)connectedHostFromCFSocket6:(CFSocketRef)socket; - (UInt16)connectedPortFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket; - (UInt16)connectedPortFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket; - (UInt16)connectedPortFromCFSocket4:(CFSocketRef)socket; - (UInt16)connectedPortFromCFSocket6:(CFSocketRef)socket; - (NSString *)localHostFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket; - (NSString *)localHostFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket; - (NSString *)localHostFromCFSocket4:(CFSocketRef)socket; - (NSString *)localHostFromCFSocket6:(CFSocketRef)socket; - (UInt16)localPortFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket; - (UInt16)localPortFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket; - (UInt16)localPortFromCFSocket4:(CFSocketRef)socket; - (UInt16)localPortFromCFSocket6:(CFSocketRef)socket; - (NSString *)hostFromAddress4:(struct sockaddr_in *)pSockaddr4; - (NSString *)hostFromAddress6:(struct sockaddr_in6 *)pSockaddr6; - (UInt16)portFromAddress4:(struct sockaddr_in *)pSockaddr4; - (UInt16)portFromAddress6:(struct sockaddr_in6 *)pSockaddr6; // Reading - (void)doBytesAvailable; - (void)completeCurrentRead; - (void)endCurrentRead; - (void)scheduleDequeueRead; - (void)maybeDequeueRead; - (void)doReadTimeout:(NSTimer *)timer; // Writing - (void)doSendBytes; - (void)completeCurrentWrite; - (void)endCurrentWrite; - (void)scheduleDequeueWrite; - (void)maybeDequeueWrite; - (void)maybeScheduleDisconnect; - (void)doWriteTimeout:(NSTimer *)timer; // Run Loop - (void)runLoopAddSource:(CFRunLoopSourceRef)source; - (void)runLoopRemoveSource:(CFRunLoopSourceRef)source; - (void)runLoopAddTimer:(NSTimer *)timer; - (void)runLoopRemoveTimer:(NSTimer *)timer; - (void)runLoopUnscheduleReadStream; - (void)runLoopUnscheduleWriteStream; // Security - (void)maybeStartTLS; - (void)onTLSHandshakeSuccessful; // Callbacks - (void)doCFCallback:(CFSocketCallBackType)type forSocket:(CFSocketRef)sock withAddress:(NSData *)address withData:(const void *)pData; - (void)doCFReadStreamCallback:(CFStreamEventType)type forStream:(CFReadStreamRef)stream; - (void)doCFWriteStreamCallback:(CFStreamEventType)type forStream:(CFWriteStreamRef)stream; @end static void MyCFSocketCallback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *); static void MyCFReadStreamCallback(CFReadStreamRef stream, CFStreamEventType type, void *pInfo); static void MyCFWriteStreamCallback(CFWriteStreamRef stream, CFStreamEventType type, void *pInfo); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The AsyncReadPacket encompasses the instructions for any given read. * The content of a read packet allows the code to determine if we're: * - reading to a certain length * - reading to a certain separator * - or simply reading the first chunk of available data **/ @interface AsyncReadPacket : NSObject { @public NSMutableData *buffer; NSUInteger startOffset; NSUInteger bytesDone; NSUInteger maxLength; NSTimeInterval timeout; NSUInteger readLength; NSData *term; BOOL bufferOwner; NSUInteger originalBufferLength; long tag; } - (id)initWithData:(NSMutableData *)d startOffset:(NSUInteger)s maxLength:(NSUInteger)m timeout:(NSTimeInterval)t readLength:(NSUInteger)l terminator:(NSData *)e tag:(long)i; - (NSUInteger)readLengthForNonTerm; - (NSUInteger)readLengthForTerm; - (NSUInteger)readLengthForTermWithPreBuffer:(NSData *)preBuffer found:(BOOL *)foundPtr; - (NSUInteger)prebufferReadLengthForTerm; - (NSInteger)searchForTermAfterPreBuffering:(NSUInteger)numBytes; @end @implementation AsyncReadPacket - (id)initWithData:(NSMutableData *)d startOffset:(NSUInteger)s maxLength:(NSUInteger)m timeout:(NSTimeInterval)t readLength:(NSUInteger)l terminator:(NSData *)e tag:(long)i { if((self = [super init])) { if (d) { buffer = d; startOffset = s; bufferOwner = NO; originalBufferLength = [d length]; } else { if (readLength > 0) buffer = [[NSMutableData alloc] initWithLength:readLength]; else buffer = [[NSMutableData alloc] initWithLength:0]; startOffset = 0; bufferOwner = YES; originalBufferLength = 0; } bytesDone = 0; maxLength = m; timeout = t; readLength = l; term = [e copy]; tag = i; } return self; } /** * For read packets without a set terminator, returns the safe length of data that can be read * without exceeding the maxLength, or forcing a resize of the buffer if at all possible. **/ - (NSUInteger)readLengthForNonTerm { NSAssert(term == nil, @"This method does not apply to term reads"); if (readLength > 0) { // Read a specific length of data return readLength - bytesDone; // No need to avoid resizing the buffer. // It should be resized if the buffer space is less than the requested read length. } else { // Read all available data NSUInteger result = READALL_CHUNKSIZE; if (maxLength > 0) { result = MIN(result, (maxLength - bytesDone)); } if (!bufferOwner) { // We did NOT create the buffer. // It is owned by the caller. // Avoid resizing the buffer if at all possible. if ([buffer length] == originalBufferLength) { NSUInteger buffSize = [buffer length]; NSUInteger buffSpace = buffSize - startOffset - bytesDone; if (buffSpace > 0) { result = MIN(result, buffSpace); } } } return result; } } /** * For read packets with a set terminator, returns the safe length of data that can be read * without going over a terminator, or the maxLength, or forcing a resize of the buffer if at all possible. * * It is assumed the terminator has not already been read. **/ - (NSUInteger)readLengthForTerm { NSAssert(term != nil, @"This method does not apply to non-term reads"); // What we're going to do is look for a partial sequence of the terminator at the end of the buffer. // If a partial sequence occurs, then we must assume the next bytes to arrive will be the rest of the term, // and we can only read that amount. // Otherwise, we're safe to read the entire length of the term. NSUInteger termLength = [term length]; // Shortcuts if (bytesDone == 0) return termLength; if (termLength == 1) return termLength; // i = index within buffer at which to check data // j = length of term to check against NSUInteger i, j; if (bytesDone >= termLength) { i = bytesDone - termLength + 1; j = termLength - 1; } else { i = 0; j = bytesDone; } NSUInteger result = termLength; void *buf = [buffer mutableBytes]; const void *termBuf = [term bytes]; while (i < bytesDone) { void *subbuf = buf + startOffset + i; if (memcmp(subbuf, termBuf, j) == 0) { result = termLength - j; break; } i++; j--; } if (maxLength > 0) { result = MIN(result, (maxLength - bytesDone)); } if (!bufferOwner) { // We did NOT create the buffer. // It is owned by the caller. // Avoid resizing the buffer if at all possible. if ([buffer length] == originalBufferLength) { NSUInteger buffSize = [buffer length]; NSUInteger buffSpace = buffSize - startOffset - bytesDone; if (buffSpace > 0) { result = MIN(result, buffSpace); } } } return result; } /** * For read packets with a set terminator, * returns the safe length of data that can be read from the given preBuffer, * without going over a terminator or the maxLength. * * It is assumed the terminator has not already been read. **/ - (NSUInteger)readLengthForTermWithPreBuffer:(NSData *)preBuffer found:(BOOL *)foundPtr { NSAssert(term != nil, @"This method does not apply to non-term reads"); NSAssert([preBuffer length] > 0, @"Invoked with empty pre buffer!"); // We know that the terminator, as a whole, doesn't exist in our own buffer. // But it is possible that a portion of it exists in our buffer. // So we're going to look for the terminator starting with a portion of our own buffer. // // Example: // // term length = 3 bytes // bytesDone = 5 bytes // preBuffer length = 5 bytes // // If we append the preBuffer to our buffer, // it would look like this: // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // --------------------- // // So we start our search here: // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // -------^-^-^--------- // // And move forwards... // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // ---------^-^-^------- // // Until we find the terminator or reach the end. // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // ---------------^-^-^- BOOL found = NO; NSUInteger termLength = [term length]; NSUInteger preBufferLength = [preBuffer length]; if ((bytesDone + preBufferLength) < termLength) { // Not enough data for a full term sequence yet return preBufferLength; } NSUInteger maxPreBufferLength; if (maxLength > 0) { maxPreBufferLength = MIN(preBufferLength, (maxLength - bytesDone)); // Note: maxLength >= termLength } else { maxPreBufferLength = preBufferLength; } Byte seq[termLength]; const void *termBuf = [term bytes]; NSUInteger bufLen = MIN(bytesDone, (termLength - 1)); void *buf = [buffer mutableBytes] + startOffset + bytesDone - bufLen; NSUInteger preLen = termLength - bufLen; void *pre = (void *)[preBuffer bytes]; NSUInteger loopCount = bufLen + maxPreBufferLength - termLength + 1; // Plus one. See example above. NSUInteger result = preBufferLength; NSUInteger i; for (i = 0; i < loopCount; i++) { if (bufLen > 0) { // Combining bytes from buffer and preBuffer memcpy(seq, buf, bufLen); memcpy(seq + bufLen, pre, preLen); if (memcmp(seq, termBuf, termLength) == 0) { result = preLen; found = YES; break; } buf++; bufLen--; preLen++; } else { // Comparing directly from preBuffer if (memcmp(pre, termBuf, termLength) == 0) { NSUInteger preOffset = pre - [preBuffer bytes]; // pointer arithmetic result = preOffset + termLength; found = YES; break; } pre++; } } // There is no need to avoid resizing the buffer in this particular situation. if (foundPtr) *foundPtr = found; return result; } /** * Assuming pre-buffering is enabled, returns the amount of data that can be read * without going over the maxLength. **/ - (NSUInteger)prebufferReadLengthForTerm { NSAssert(term != nil, @"This method does not apply to non-term reads"); NSUInteger result = READALL_CHUNKSIZE; if (maxLength > 0) { result = MIN(result, (maxLength - bytesDone)); } if (!bufferOwner) { // We did NOT create the buffer. // It is owned by the caller. // Avoid resizing the buffer if at all possible. if ([buffer length] == originalBufferLength) { NSUInteger buffSize = [buffer length]; NSUInteger buffSpace = buffSize - startOffset - bytesDone; if (buffSpace > 0) { result = MIN(result, buffSpace); } } } return result; } /** * For read packets with a set terminator, scans the packet buffer for the term. * It is assumed the terminator had not been fully read prior to the new bytes. * * If the term is found, the number of excess bytes after the term are returned. * If the term is not found, this method will return -1. * * Note: A return value of zero means the term was found at the very end. **/ - (NSInteger)searchForTermAfterPreBuffering:(NSUInteger)numBytes { NSAssert(term != nil, @"This method does not apply to non-term reads"); NSAssert(bytesDone >= numBytes, @"Invoked with invalid numBytes!"); // We try to start the search such that the first new byte read matches up with the last byte of the term. // We continue searching forward after this until the term no longer fits into the buffer. NSUInteger termLength = [term length]; const void *termBuffer = [term bytes]; // Remember: This method is called after the bytesDone variable has been updated. NSUInteger prevBytesDone = bytesDone - numBytes; NSUInteger i; if (prevBytesDone >= termLength) i = prevBytesDone - termLength + 1; else i = 0; while ((i + termLength) <= bytesDone) { void *subBuffer = [buffer mutableBytes] + startOffset + i; if(memcmp(subBuffer, termBuffer, termLength) == 0) { return bytesDone - (i + termLength); } i++; } return -1; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The AsyncWritePacket encompasses the instructions for any given write. **/ @interface AsyncWritePacket : NSObject { @public NSData *buffer; NSUInteger bytesDone; long tag; NSTimeInterval timeout; } - (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i; @end @implementation AsyncWritePacket - (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i { if((self = [super init])) { buffer = d; timeout = t; tag = i; bytesDone = 0; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The AsyncSpecialPacket encompasses special instructions for interruptions in the read/write queues. * This class my be altered to support more than just TLS in the future. **/ @interface AsyncSpecialPacket : NSObject { @public NSDictionary *tlsSettings; } - (id)initWithTLSSettings:(NSDictionary *)settings; @end @implementation AsyncSpecialPacket - (id)initWithTLSSettings:(NSDictionary *)settings { if((self = [super init])) { tlsSettings = [settings copy]; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @implementation AsyncSocket - (id)init { return [self initWithDelegate:nil userData:0]; } - (id)initWithDelegate:(id)delegate { return [self initWithDelegate:delegate userData:0]; } // Designated initializer. - (id)initWithDelegate:(id)delegate userData:(long)userData { if((self = [super init])) { theFlags = DEFAULT_PREBUFFERING ? kEnablePreBuffering : 0; theDelegate = delegate; theUserData = userData; theNativeSocket4 = 0; theNativeSocket6 = 0; theSocket4 = NULL; theSource4 = NULL; theSocket6 = NULL; theSource6 = NULL; theRunLoop = NULL; theReadStream = NULL; theWriteStream = NULL; theConnectTimer = nil; theReadQueue = [[NSMutableArray alloc] initWithCapacity:READQUEUE_CAPACITY]; theCurrentRead = nil; theReadTimer = nil; partialReadBuffer = [[NSMutableData alloc] initWithCapacity:READALL_CHUNKSIZE]; theWriteQueue = [[NSMutableArray alloc] initWithCapacity:WRITEQUEUE_CAPACITY]; theCurrentWrite = nil; theWriteTimer = nil; // Socket context NSAssert(sizeof(CFSocketContext) == sizeof(CFStreamClientContext), @"CFSocketContext != CFStreamClientContext"); theContext.version = 0; theContext.info = (__bridge void *)(self); theContext.retain = nil; theContext.release = nil; theContext.copyDescription = nil; // Default run loop modes theRunLoopModes = [NSArray arrayWithObject:NSDefaultRunLoopMode]; } return self; } // The socket may been initialized in a connected state and auto-released, so this should close it down cleanly. - (void)dealloc { [self close]; [NSObject cancelPreviousPerformRequestsWithTarget:self]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Thread-Safety //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)checkForThreadSafety { if (theRunLoop && (theRunLoop != CFRunLoopGetCurrent())) { // AsyncSocket is RunLoop based. // It is designed to be run and accessed from a particular thread/runloop. // As such, it is faster as it does not have the overhead of locks/synchronization. // // However, this places a minimal requirement on the developer to maintain thread-safety. // If you are seeing errors or crashes in AsyncSocket, // it is very likely that thread-safety has been broken. // This method may be enabled via the DEBUG_THREAD_SAFETY macro, // and will allow you to discover the place in your code where thread-safety is being broken. // // Note: // // If you find you constantly need to access your socket from various threads, // you may prefer to use GCDAsyncSocket which is thread-safe. [NSException raise:AsyncSocketException format:@"Attempting to access AsyncSocket instance from incorrect thread."]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Accessors //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (long)userData { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return theUserData; } - (void)setUserData:(long)userData { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif theUserData = userData; } - (id)delegate { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return theDelegate; } - (void)setDelegate:(id)delegate { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif theDelegate = delegate; } - (BOOL)canSafelySetDelegate { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return ([theReadQueue count] == 0 && [theWriteQueue count] == 0 && theCurrentRead == nil && theCurrentWrite == nil); } - (CFSocketRef)getCFSocket { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if(theSocket4) return theSocket4; else return theSocket6; } - (CFReadStreamRef)getCFReadStream { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return theReadStream; } - (CFWriteStreamRef)getCFWriteStream { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return theWriteStream; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Progress //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (float)progressOfReadReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif // Check to make sure we're actually reading something right now, // and that the read packet isn't an AsyncSpecialPacket (upgrade to TLS). if (!theCurrentRead || ![theCurrentRead isKindOfClass:[AsyncReadPacket class]]) { if (tag != NULL) *tag = 0; if (done != NULL) *done = 0; if (total != NULL) *total = 0; return NAN; } // It's only possible to know the progress of our read if we're reading to a certain length. // If we're reading to data, we of course have no idea when the data will arrive. // If we're reading to timeout, then we have no idea when the next chunk of data will arrive. NSUInteger d = theCurrentRead->bytesDone; NSUInteger t = theCurrentRead->readLength; if (tag != NULL) *tag = theCurrentRead->tag; if (done != NULL) *done = d; if (total != NULL) *total = t; if (t > 0.0) return (float)d / (float)t; else return 1.0F; } - (float)progressOfWriteReturningTag:(long *)tag bytesDone:(NSUInteger *)done total:(NSUInteger *)total { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif // Check to make sure we're actually writing something right now, // and that the write packet isn't an AsyncSpecialPacket (upgrade to TLS). if (!theCurrentWrite || ![theCurrentWrite isKindOfClass:[AsyncWritePacket class]]) { if (tag != NULL) *tag = 0; if (done != NULL) *done = 0; if (total != NULL) *total = 0; return NAN; } NSUInteger d = theCurrentWrite->bytesDone; NSUInteger t = [theCurrentWrite->buffer length]; if (tag != NULL) *tag = theCurrentWrite->tag; if (done != NULL) *done = d; if (total != NULL) *total = t; return (float)d / (float)t; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Run Loop //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)runLoopAddSource:(CFRunLoopSourceRef)source { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopAddSource(theRunLoop, source, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopRemoveSource:(CFRunLoopSourceRef)source { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopRemoveSource(theRunLoop, source, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopAddSource:(CFRunLoopSourceRef)source mode:(NSString *)runLoopMode { CFRunLoopAddSource(theRunLoop, source, (__bridge CFStringRef)runLoopMode); } - (void)runLoopRemoveSource:(CFRunLoopSourceRef)source mode:(NSString *)runLoopMode { CFRunLoopRemoveSource(theRunLoop, source, (__bridge CFStringRef)runLoopMode); } - (void)runLoopAddTimer:(NSTimer *)timer { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopAddTimer(theRunLoop, (__bridge CFRunLoopTimerRef)timer, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopRemoveTimer:(NSTimer *)timer { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopRemoveTimer(theRunLoop, (__bridge CFRunLoopTimerRef)timer, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopAddTimer:(NSTimer *)timer mode:(NSString *)runLoopMode { CFRunLoopAddTimer(theRunLoop, (__bridge CFRunLoopTimerRef)timer, (__bridge CFStringRef)runLoopMode); } - (void)runLoopRemoveTimer:(NSTimer *)timer mode:(NSString *)runLoopMode { CFRunLoopRemoveTimer(theRunLoop, (__bridge CFRunLoopTimerRef)timer, (__bridge CFStringRef)runLoopMode); } - (void)runLoopUnscheduleReadStream { for (NSString *runLoopMode in theRunLoopModes) { CFReadStreamUnscheduleFromRunLoop(theReadStream, theRunLoop, (__bridge CFStringRef)runLoopMode); } CFReadStreamSetClient(theReadStream, kCFStreamEventNone, NULL, NULL); } - (void)runLoopUnscheduleWriteStream { for (NSString *runLoopMode in theRunLoopModes) { CFWriteStreamUnscheduleFromRunLoop(theWriteStream, theRunLoop, (__bridge CFStringRef)runLoopMode); } CFWriteStreamSetClient(theWriteStream, kCFStreamEventNone, NULL, NULL); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Configuration //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * See the header file for a full explanation of pre-buffering. **/ - (void)enablePreBuffering { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif theFlags |= kEnablePreBuffering; } /** * See the header file for a full explanation of this method. **/ - (BOOL)moveToRunLoop:(NSRunLoop *)runLoop { NSAssert((theRunLoop == NULL) || (theRunLoop == CFRunLoopGetCurrent()), @"moveToRunLoop must be called from within the current RunLoop!"); if(runLoop == nil) { return NO; } if(theRunLoop == [runLoop getCFRunLoop]) { return YES; } [NSObject cancelPreviousPerformRequestsWithTarget:self]; theFlags &= ~kDequeueReadScheduled; theFlags &= ~kDequeueWriteScheduled; if(theReadStream && theWriteStream) { [self runLoopUnscheduleReadStream]; [self runLoopUnscheduleWriteStream]; } if(theSource4) [self runLoopRemoveSource:theSource4]; if(theSource6) [self runLoopRemoveSource:theSource6]; if(theReadTimer) [self runLoopRemoveTimer:theReadTimer]; if(theWriteTimer) [self runLoopRemoveTimer:theWriteTimer]; theRunLoop = [runLoop getCFRunLoop]; if(theReadTimer) [self runLoopAddTimer:theReadTimer]; if(theWriteTimer) [self runLoopAddTimer:theWriteTimer]; if(theSource4) [self runLoopAddSource:theSource4]; if(theSource6) [self runLoopAddSource:theSource6]; if(theReadStream && theWriteStream) { if(![self attachStreamsToRunLoop:runLoop error:nil]) { return NO; } } [runLoop performSelector:@selector(maybeDequeueRead) target:self argument:nil order:0 modes:theRunLoopModes]; [runLoop performSelector:@selector(maybeDequeueWrite) target:self argument:nil order:0 modes:theRunLoopModes]; [runLoop performSelector:@selector(maybeScheduleDisconnect) target:self argument:nil order:0 modes:theRunLoopModes]; return YES; } /** * See the header file for a full explanation of this method. **/ - (BOOL)setRunLoopModes:(NSArray *)runLoopModes { NSAssert((theRunLoop == NULL) || (theRunLoop == CFRunLoopGetCurrent()), @"setRunLoopModes must be called from within the current RunLoop!"); if([runLoopModes count] == 0) { return NO; } if([theRunLoopModes isEqualToArray:runLoopModes]) { return YES; } [NSObject cancelPreviousPerformRequestsWithTarget:self]; theFlags &= ~kDequeueReadScheduled; theFlags &= ~kDequeueWriteScheduled; if(theReadStream && theWriteStream) { [self runLoopUnscheduleReadStream]; [self runLoopUnscheduleWriteStream]; } if(theSource4) [self runLoopRemoveSource:theSource4]; if(theSource6) [self runLoopRemoveSource:theSource6]; if(theReadTimer) [self runLoopRemoveTimer:theReadTimer]; if(theWriteTimer) [self runLoopRemoveTimer:theWriteTimer]; theRunLoopModes = [runLoopModes copy]; if(theReadTimer) [self runLoopAddTimer:theReadTimer]; if(theWriteTimer) [self runLoopAddTimer:theWriteTimer]; if(theSource4) [self runLoopAddSource:theSource4]; if(theSource6) [self runLoopAddSource:theSource6]; if(theReadStream && theWriteStream) { // Note: theRunLoop variable is a CFRunLoop, and NSRunLoop is NOT toll-free bridged with CFRunLoop. // So we cannot pass theRunLoop to the method below, which is expecting a NSRunLoop parameter. // Instead we pass nil, which will result in the method properly using the current run loop. if(![self attachStreamsToRunLoop:nil error:nil]) { return NO; } } [self performSelector:@selector(maybeDequeueRead) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeDequeueWrite) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeScheduleDisconnect) withObject:nil afterDelay:0 inModes:theRunLoopModes]; return YES; } - (BOOL)addRunLoopMode:(NSString *)runLoopMode { NSAssert((theRunLoop == NULL) || (theRunLoop == CFRunLoopGetCurrent()), @"addRunLoopMode must be called from within the current RunLoop!"); if(runLoopMode == nil) { return NO; } if([theRunLoopModes containsObject:runLoopMode]) { return YES; } [NSObject cancelPreviousPerformRequestsWithTarget:self]; theFlags &= ~kDequeueReadScheduled; theFlags &= ~kDequeueWriteScheduled; NSArray *newRunLoopModes = [theRunLoopModes arrayByAddingObject:runLoopMode]; theRunLoopModes = newRunLoopModes; if(theReadTimer) [self runLoopAddTimer:theReadTimer mode:runLoopMode]; if(theWriteTimer) [self runLoopAddTimer:theWriteTimer mode:runLoopMode]; if(theSource4) [self runLoopAddSource:theSource4 mode:runLoopMode]; if(theSource6) [self runLoopAddSource:theSource6 mode:runLoopMode]; if(theReadStream && theWriteStream) { CFReadStreamScheduleWithRunLoop(theReadStream, CFRunLoopGetCurrent(), (__bridge CFStringRef)runLoopMode); CFWriteStreamScheduleWithRunLoop(theWriteStream, CFRunLoopGetCurrent(), (__bridge CFStringRef)runLoopMode); } [self performSelector:@selector(maybeDequeueRead) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeDequeueWrite) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeScheduleDisconnect) withObject:nil afterDelay:0 inModes:theRunLoopModes]; return YES; } - (BOOL)removeRunLoopMode:(NSString *)runLoopMode { NSAssert((theRunLoop == NULL) || (theRunLoop == CFRunLoopGetCurrent()), @"addRunLoopMode must be called from within the current RunLoop!"); if(runLoopMode == nil) { return NO; } if(![theRunLoopModes containsObject:runLoopMode]) { return YES; } NSMutableArray *newRunLoopModes = [theRunLoopModes mutableCopy]; [newRunLoopModes removeObject:runLoopMode]; if([newRunLoopModes count] == 0) { return NO; } [NSObject cancelPreviousPerformRequestsWithTarget:self]; theFlags &= ~kDequeueReadScheduled; theFlags &= ~kDequeueWriteScheduled; theRunLoopModes = [newRunLoopModes copy]; if(theReadTimer) [self runLoopRemoveTimer:theReadTimer mode:runLoopMode]; if(theWriteTimer) [self runLoopRemoveTimer:theWriteTimer mode:runLoopMode]; if(theSource4) [self runLoopRemoveSource:theSource4 mode:runLoopMode]; if(theSource6) [self runLoopRemoveSource:theSource6 mode:runLoopMode]; if(theReadStream && theWriteStream) { CFReadStreamScheduleWithRunLoop(theReadStream, CFRunLoopGetCurrent(), (__bridge CFStringRef)runLoopMode); CFWriteStreamScheduleWithRunLoop(theWriteStream, CFRunLoopGetCurrent(), (__bridge CFStringRef)runLoopMode); } [self performSelector:@selector(maybeDequeueRead) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeDequeueWrite) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeScheduleDisconnect) withObject:nil afterDelay:0 inModes:theRunLoopModes]; return YES; } - (NSArray *)runLoopModes { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return theRunLoopModes; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Accepting //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)acceptOnPort:(UInt16)port error:(NSError **)errPtr { return [self acceptOnInterface:nil port:port error:errPtr]; } /** * To accept on a certain interface, pass the address to accept on. * To accept on any interface, pass nil or an empty string. * To accept only connections from localhost pass "localhost" or "loopback". **/ - (BOOL)acceptOnInterface:(NSString *)interface port:(UInt16)port error:(NSError **)errPtr { if (theDelegate == NULL) { [NSException raise:AsyncSocketException format:@"Attempting to accept without a delegate. Set a delegate first."]; } if (![self isDisconnected]) { [NSException raise:AsyncSocketException format:@"Attempting to accept while connected or accepting connections. Disconnect first."]; } // Clear queues (spurious read/write requests post disconnect) [self emptyQueues]; // Set up the listen sockaddr structs if needed. NSData *address4 = nil, *address6 = nil; if(interface == nil || ([interface length] == 0)) { // Accept on ANY address struct sockaddr_in nativeAddr4; nativeAddr4.sin_len = sizeof(struct sockaddr_in); nativeAddr4.sin_family = AF_INET; nativeAddr4.sin_port = htons(port); nativeAddr4.sin_addr.s_addr = htonl(INADDR_ANY); memset(&(nativeAddr4.sin_zero), 0, sizeof(nativeAddr4.sin_zero)); struct sockaddr_in6 nativeAddr6; nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); nativeAddr6.sin6_family = AF_INET6; nativeAddr6.sin6_port = htons(port); nativeAddr6.sin6_flowinfo = 0; nativeAddr6.sin6_addr = in6addr_any; nativeAddr6.sin6_scope_id = 0; // Wrap the native address structures for CFSocketSetAddress. address4 = [NSData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; } else if([interface isEqualToString:@"localhost"] || [interface isEqualToString:@"loopback"]) { // Accept only on LOOPBACK address struct sockaddr_in nativeAddr4; nativeAddr4.sin_len = sizeof(struct sockaddr_in); nativeAddr4.sin_family = AF_INET; nativeAddr4.sin_port = htons(port); nativeAddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); memset(&(nativeAddr4.sin_zero), 0, sizeof(nativeAddr4.sin_zero)); struct sockaddr_in6 nativeAddr6; nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); nativeAddr6.sin6_family = AF_INET6; nativeAddr6.sin6_port = htons(port); nativeAddr6.sin6_flowinfo = 0; nativeAddr6.sin6_addr = in6addr_loopback; nativeAddr6.sin6_scope_id = 0; // Wrap the native address structures for CFSocketSetAddress. address4 = [NSData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; } else { NSString *portStr = [NSString stringWithFormat:@"%hu", port]; struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP; hints.ai_flags = AI_PASSIVE; int error = getaddrinfo([interface UTF8String], [portStr UTF8String], &hints, &res0); if (error) { if (errPtr) { NSString *errMsg = [NSString stringWithCString:gai_strerror(error) encoding:NSASCIIStringEncoding]; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:error userInfo:info]; } } else { for (res = res0; res; res = res->ai_next) { if (!address4 && (res->ai_family == AF_INET)) { // Found IPv4 address // Wrap the native address structures for CFSocketSetAddress. address4 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } else if (!address6 && (res->ai_family == AF_INET6)) { // Found IPv6 address // Wrap the native address structures for CFSocketSetAddress. address6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } } freeaddrinfo(res0); } if(!address4 && !address6) return NO; } // Create the sockets. if (address4) { theSocket4 = [self newAcceptSocketForAddress:address4 error:errPtr]; if (theSocket4 == NULL) goto Failed; } if (address6) { theSocket6 = [self newAcceptSocketForAddress:address6 error:errPtr]; // Note: The iPhone doesn't currently support IPv6 #if !TARGET_OS_IPHONE if (theSocket6 == NULL) goto Failed; #endif } // Attach the sockets to the run loop so that callback methods work [self attachSocketsToRunLoop:nil error:nil]; // Set the SO_REUSEADDR flags. int reuseOn = 1; if (theSocket4) setsockopt(CFSocketGetNative(theSocket4), SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); if (theSocket6) setsockopt(CFSocketGetNative(theSocket6), SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); // Set the local bindings which causes the sockets to start listening. CFSocketError err; if (theSocket4) { err = CFSocketSetAddress(theSocket4, (__bridge CFDataRef)address4); if (err != kCFSocketSuccess) goto Failed; //NSLog(@"theSocket4: %hu", [self localPortFromCFSocket4:theSocket4]); } if(port == 0 && theSocket4 && theSocket6) { // The user has passed in port 0, which means he wants to allow the kernel to choose the port for them // However, the kernel will choose a different port for both theSocket4 and theSocket6 // So we grab the port the kernel choose for theSocket4, and set it as the port for theSocket6 UInt16 chosenPort = [self localPortFromCFSocket4:theSocket4]; struct sockaddr_in6 *pSockAddr6 = (struct sockaddr_in6 *)[address6 bytes]; if (pSockAddr6) // If statement to quiet the static analyzer { pSockAddr6->sin6_port = htons(chosenPort); } } if (theSocket6) { err = CFSocketSetAddress(theSocket6, (__bridge CFDataRef)address6); if (err != kCFSocketSuccess) goto Failed; //NSLog(@"theSocket6: %hu", [self localPortFromCFSocket6:theSocket6]); } theFlags |= kDidStartDelegate; return YES; Failed: if(errPtr) *errPtr = [self getSocketError]; if(theSocket4 != NULL) { CFSocketInvalidate(theSocket4); CFRelease(theSocket4); theSocket4 = NULL; } if(theSocket6 != NULL) { CFSocketInvalidate(theSocket6); CFRelease(theSocket6); theSocket6 = NULL; } return NO; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Connecting //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)connectToHost:(NSString*)hostname onPort:(UInt16)port error:(NSError **)errPtr { return [self connectToHost:hostname onPort:port withTimeout:-1 error:errPtr]; } /** * This method creates an initial CFReadStream and CFWriteStream to the given host on the given port. * The connection is then opened, and the corresponding CFSocket will be extracted after the connection succeeds. * * Thus the delegate will have access to the CFReadStream and CFWriteStream prior to connection, * specifically in the onSocketWillConnect: method. **/ - (BOOL)connectToHost:(NSString *)hostname onPort:(UInt16)port withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { if (theDelegate == NULL) { [NSException raise:AsyncSocketException format:@"Attempting to connect without a delegate. Set a delegate first."]; } if (![self isDisconnected]) { [NSException raise:AsyncSocketException format:@"Attempting to connect while connected or accepting connections. Disconnect first."]; } // Clear queues (spurious read/write requests post disconnect) [self emptyQueues]; if(![self createStreamsToHost:hostname onPort:port error:errPtr]) goto Failed; if(![self attachStreamsToRunLoop:nil error:errPtr]) goto Failed; if(![self configureStreamsAndReturnError:errPtr]) goto Failed; if(![self openStreamsAndReturnError:errPtr]) goto Failed; [self startConnectTimeout:timeout]; theFlags |= kDidStartDelegate; return YES; Failed: [self close]; return NO; } - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr { return [self connectToAddress:remoteAddr viaInterfaceAddress:nil withTimeout:-1 error:errPtr]; } /** * This method creates an initial CFSocket to the given address. * The connection is then opened, and the corresponding CFReadStream and CFWriteStream will be * created from the low-level sockets after the connection succeeds. * * Thus the delegate will have access to the CFSocket and CFSocketNativeHandle (BSD socket) prior to connection, * specifically in the onSocketWillConnect: method. * * Note: The NSData parameter is expected to be a sockaddr structure. For example, an NSData object returned from * NSNetService addresses method. * If you have an existing struct sockaddr you can convert it to an NSData object like so: * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; **/ - (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { return [self connectToAddress:remoteAddr viaInterfaceAddress:nil withTimeout:timeout error:errPtr]; } /** * This method is similar to the one above, but allows you to specify which socket interface * the connection should run over. E.g. ethernet, wifi, bluetooth, etc. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr viaInterfaceAddress:(NSData *)interfaceAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { if (theDelegate == NULL) { [NSException raise:AsyncSocketException format:@"Attempting to connect without a delegate. Set a delegate first."]; } if (![self isDisconnected]) { [NSException raise:AsyncSocketException format:@"Attempting to connect while connected or accepting connections. Disconnect first."]; } // Clear queues (spurious read/write requests post disconnect) [self emptyQueues]; if(![self createSocketForAddress:remoteAddr error:errPtr]) goto Failed; if(![self bindSocketToAddress:interfaceAddr error:errPtr]) goto Failed; if(![self attachSocketsToRunLoop:nil error:errPtr]) goto Failed; if(![self configureSocketAndReturnError:errPtr]) goto Failed; if(![self connectSocketToAddress:remoteAddr error:errPtr]) goto Failed; [self startConnectTimeout:timeout]; theFlags |= kDidStartDelegate; return YES; Failed: [self close]; return NO; } - (void)startConnectTimeout:(NSTimeInterval)timeout { if(timeout >= 0.0) { theConnectTimer = [NSTimer timerWithTimeInterval:timeout target:self selector:@selector(doConnectTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theConnectTimer]; } } - (void)endConnectTimeout { [theConnectTimer invalidate]; theConnectTimer = nil; } - (void)doConnectTimeout:(NSTimer *)timer { #pragma unused(timer) [self endConnectTimeout]; [self closeWithError:[self getConnectTimeoutError]]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Socket Implementation //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Creates the accept sockets. * Returns true if either IPv4 or IPv6 is created. * If either is missing, an error is returned (even though the method may return true). **/ - (CFSocketRef)newAcceptSocketForAddress:(NSData *)addr error:(NSError **)errPtr { struct sockaddr *pSockAddr = (struct sockaddr *)[addr bytes]; int addressFamily = pSockAddr->sa_family; CFSocketRef theSocket = CFSocketCreate(kCFAllocatorDefault, addressFamily, SOCK_STREAM, 0, kCFSocketAcceptCallBack, // Callback flags (CFSocketCallBack)&MyCFSocketCallback, // Callback method &theContext); if(theSocket == NULL) { if(errPtr) *errPtr = [self getSocketError]; } return theSocket; } - (BOOL)createSocketForAddress:(NSData *)remoteAddr error:(NSError **)errPtr { struct sockaddr *pSockAddr = (struct sockaddr *)[remoteAddr bytes]; if(pSockAddr->sa_family == AF_INET) { theSocket4 = CFSocketCreate(NULL, // Default allocator PF_INET, // Protocol Family SOCK_STREAM, // Socket Type IPPROTO_TCP, // Protocol kCFSocketConnectCallBack, // Callback flags (CFSocketCallBack)&MyCFSocketCallback, // Callback method &theContext); // Socket Context if(theSocket4 == NULL) { if (errPtr) *errPtr = [self getSocketError]; return NO; } } else if(pSockAddr->sa_family == AF_INET6) { theSocket6 = CFSocketCreate(NULL, // Default allocator PF_INET6, // Protocol Family SOCK_STREAM, // Socket Type IPPROTO_TCP, // Protocol kCFSocketConnectCallBack, // Callback flags (CFSocketCallBack)&MyCFSocketCallback, // Callback method &theContext); // Socket Context if(theSocket6 == NULL) { if (errPtr) *errPtr = [self getSocketError]; return NO; } } else { if (errPtr) { NSString *errMsg = @"Remote address is not IPv4 or IPv6"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketCFSocketError userInfo:info]; } return NO; } return YES; } - (BOOL)bindSocketToAddress:(NSData *)interfaceAddr error:(NSError **)errPtr { if (interfaceAddr == nil) return YES; struct sockaddr *pSockAddr = (struct sockaddr *)[interfaceAddr bytes]; CFSocketRef theSocket = (theSocket4 != NULL) ? theSocket4 : theSocket6; NSAssert((theSocket != NULL), @"bindSocketToAddress called without valid socket"); CFSocketNativeHandle nativeSocket = CFSocketGetNative(theSocket); if (pSockAddr->sa_family == AF_INET || pSockAddr->sa_family == AF_INET6) { int result = bind(nativeSocket, pSockAddr, (socklen_t)[interfaceAddr length]); if (result != 0) { if (errPtr) *errPtr = [self getErrnoError]; return NO; } } else { if (errPtr) { NSString *errMsg = @"Interface address is not IPv4 or IPv6"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketCFSocketError userInfo:info]; } return NO; } return YES; } /** * Adds the CFSocket's to the run-loop so that callbacks will work properly. **/ - (BOOL)attachSocketsToRunLoop:(NSRunLoop *)runLoop error:(NSError **)errPtr { #pragma unused(errPtr) // Get the CFRunLoop to which the socket should be attached. theRunLoop = (runLoop == nil) ? CFRunLoopGetCurrent() : [runLoop getCFRunLoop]; if(theSocket4) { theSource4 = CFSocketCreateRunLoopSource (kCFAllocatorDefault, theSocket4, 0); [self runLoopAddSource:theSource4]; } if(theSocket6) { theSource6 = CFSocketCreateRunLoopSource (kCFAllocatorDefault, theSocket6, 0); [self runLoopAddSource:theSource6]; } return YES; } /** * Allows the delegate method to configure the CFSocket or CFNativeSocket as desired before we connect. * Note that the CFReadStream and CFWriteStream will not be available until after the connection is opened. **/ - (BOOL)configureSocketAndReturnError:(NSError **)errPtr { // Call the delegate method for further configuration. if([theDelegate respondsToSelector:@selector(onSocketWillConnect:)]) { if([theDelegate onSocketWillConnect:self] == NO) { if (errPtr) *errPtr = [self getAbortError]; return NO; } } return YES; } - (BOOL)connectSocketToAddress:(NSData *)remoteAddr error:(NSError **)errPtr { // Start connecting to the given address in the background // The MyCFSocketCallback method will be called when the connection succeeds or fails if(theSocket4) { CFSocketError err = CFSocketConnectToAddress(theSocket4, (__bridge CFDataRef)remoteAddr, -1); if(err != kCFSocketSuccess) { if (errPtr) *errPtr = [self getSocketError]; return NO; } } else if(theSocket6) { CFSocketError err = CFSocketConnectToAddress(theSocket6, (__bridge CFDataRef)remoteAddr, -1); if(err != kCFSocketSuccess) { if (errPtr) *errPtr = [self getSocketError]; return NO; } } return YES; } /** * Attempt to make the new socket. * If an error occurs, ignore this event. **/ - (void)doAcceptFromSocket:(CFSocketRef)parentSocket withNewNativeSocket:(CFSocketNativeHandle)newNativeSocket { if(newNativeSocket) { // New socket inherits same delegate and run loop modes. // Note: We use [self class] to support subclassing AsyncSocket. AsyncSocket *newSocket = [[[self class] alloc] initWithDelegate:theDelegate]; [newSocket setRunLoopModes:theRunLoopModes]; if (![newSocket createStreamsFromNative:newNativeSocket error:nil]) { [newSocket close]; return; } if (parentSocket == theSocket4) newSocket->theNativeSocket4 = newNativeSocket; else newSocket->theNativeSocket6 = newNativeSocket; if ([theDelegate respondsToSelector:@selector(onSocket:didAcceptNewSocket:)]) [theDelegate onSocket:self didAcceptNewSocket:newSocket]; newSocket->theFlags |= kDidStartDelegate; NSRunLoop *runLoop = nil; if ([theDelegate respondsToSelector:@selector(onSocket:wantsRunLoopForNewSocket:)]) { runLoop = [theDelegate onSocket:self wantsRunLoopForNewSocket:newSocket]; } if(![newSocket attachStreamsToRunLoop:runLoop error:nil]) goto Failed; if(![newSocket configureStreamsAndReturnError:nil]) goto Failed; if(![newSocket openStreamsAndReturnError:nil]) goto Failed; return; Failed: [newSocket close]; } } /** * This method is called as a result of connectToAddress:withTimeout:error:. * At this point we have an open CFSocket from which we need to create our read and write stream. **/ - (void)doSocketOpen:(CFSocketRef)sock withCFSocketError:(CFSocketError)socketError { NSParameterAssert ((sock == theSocket4) || (sock == theSocket6)); if(socketError == kCFSocketTimeout || socketError == kCFSocketError) { [self closeWithError:[self getSocketError]]; return; } // Get the underlying native (BSD) socket CFSocketNativeHandle nativeSocket = CFSocketGetNative(sock); // Store a reference to it if (sock == theSocket4) theNativeSocket4 = nativeSocket; else theNativeSocket6 = nativeSocket; // Setup the CFSocket so that invalidating it will not close the underlying native socket CFSocketSetSocketFlags(sock, 0); // Invalidate and release the CFSocket - All we need from here on out is the nativeSocket. // Note: If we don't invalidate the CFSocket (leaving the native socket open) // then theReadStream and theWriteStream won't function properly. // Specifically, their callbacks won't work, with the exception of kCFStreamEventOpenCompleted. // // This is likely due to the mixture of the CFSocketCreateWithNative method, // along with the CFStreamCreatePairWithSocket method. // The documentation for CFSocketCreateWithNative states: // // If a CFSocket object already exists for sock, // the function returns the pre-existing object instead of creating a new object; // the context, callout, and callBackTypes parameters are ignored in this case. // // So the CFStreamCreateWithNative method invokes the CFSocketCreateWithNative method, // thinking that is creating a new underlying CFSocket for it's own purposes. // When it does this, it uses the context/callout/callbackTypes parameters to setup everything appropriately. // However, if a CFSocket already exists for the native socket, // then it is returned (as per the documentation), which in turn screws up the CFStreams. CFSocketInvalidate(sock); CFRelease(sock); theSocket4 = NULL; theSocket6 = NULL; NSError *err; BOOL pass = YES; if(pass && ![self createStreamsFromNative:nativeSocket error:&err]) pass = NO; if(pass && ![self attachStreamsToRunLoop:nil error:&err]) pass = NO; if(pass && ![self openStreamsAndReturnError:&err]) pass = NO; if(!pass) { [self closeWithError:err]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Stream Implementation //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Creates the CFReadStream and CFWriteStream from the given native socket. * The CFSocket may be extracted from either stream after the streams have been opened. * * Note: The given native socket must already be connected! **/ - (BOOL)createStreamsFromNative:(CFSocketNativeHandle)native error:(NSError **)errPtr { // Create the socket & streams. CFStreamCreatePairWithSocket(kCFAllocatorDefault, native, &theReadStream, &theWriteStream); if (theReadStream == NULL || theWriteStream == NULL) { NSError *err = [self getStreamError]; NSLog(@"AsyncSocket %p couldn't create streams from accepted socket: %@", self, err); if (errPtr) *errPtr = err; return NO; } // Ensure the CF & BSD socket is closed when the streams are closed. CFReadStreamSetProperty(theReadStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); CFWriteStreamSetProperty(theWriteStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); return YES; } /** * Creates the CFReadStream and CFWriteStream from the given hostname and port number. * The CFSocket may be extracted from either stream after the streams have been opened. **/ - (BOOL)createStreamsToHost:(NSString *)hostname onPort:(UInt16)port error:(NSError **)errPtr { // Create the socket & streams. CFStreamCreatePairWithSocketToHost(NULL, (__bridge CFStringRef)hostname, port, &theReadStream, &theWriteStream); if (theReadStream == NULL || theWriteStream == NULL) { if (errPtr) *errPtr = [self getStreamError]; return NO; } // Ensure the CF & BSD socket is closed when the streams are closed. CFReadStreamSetProperty(theReadStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); CFWriteStreamSetProperty(theWriteStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanTrue); return YES; } - (BOOL)attachStreamsToRunLoop:(NSRunLoop *)runLoop error:(NSError **)errPtr { // Get the CFRunLoop to which the socket should be attached. theRunLoop = (runLoop == nil) ? CFRunLoopGetCurrent() : [runLoop getCFRunLoop]; // Setup read stream callbacks CFOptionFlags readStreamEvents = kCFStreamEventHasBytesAvailable | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered | kCFStreamEventOpenCompleted; if (!CFReadStreamSetClient(theReadStream, readStreamEvents, (CFReadStreamClientCallBack)&MyCFReadStreamCallback, (CFStreamClientContext *)(&theContext))) { NSError *err = [self getStreamError]; NSLog (@"AsyncSocket %p couldn't attach read stream to run-loop,", self); NSLog (@"Error: %@", err); if (errPtr) *errPtr = err; return NO; } // Setup write stream callbacks CFOptionFlags writeStreamEvents = kCFStreamEventCanAcceptBytes | kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered | kCFStreamEventOpenCompleted; if (!CFWriteStreamSetClient (theWriteStream, writeStreamEvents, (CFWriteStreamClientCallBack)&MyCFWriteStreamCallback, (CFStreamClientContext *)(&theContext))) { NSError *err = [self getStreamError]; NSLog (@"AsyncSocket %p couldn't attach write stream to run-loop,", self); NSLog (@"Error: %@", err); if (errPtr) *errPtr = err; return NO; } // Add read and write streams to run loop for (NSString *runLoopMode in theRunLoopModes) { CFReadStreamScheduleWithRunLoop(theReadStream, theRunLoop, (__bridge CFStringRef)runLoopMode); CFWriteStreamScheduleWithRunLoop(theWriteStream, theRunLoop, (__bridge CFStringRef)runLoopMode); } return YES; } /** * Allows the delegate method to configure the CFReadStream and/or CFWriteStream as desired before we connect. * * If being called from a connect method, * the CFSocket and CFNativeSocket will not be available until after the connection is opened. **/ - (BOOL)configureStreamsAndReturnError:(NSError **)errPtr { // Call the delegate method for further configuration. if([theDelegate respondsToSelector:@selector(onSocketWillConnect:)]) { if([theDelegate onSocketWillConnect:self] == NO) { if (errPtr) *errPtr = [self getAbortError]; return NO; } } return YES; } - (BOOL)openStreamsAndReturnError:(NSError **)errPtr { BOOL pass = YES; if(pass && !CFReadStreamOpen(theReadStream)) { NSLog (@"AsyncSocket %p couldn't open read stream,", self); pass = NO; } if(pass && !CFWriteStreamOpen(theWriteStream)) { NSLog (@"AsyncSocket %p couldn't open write stream,", self); pass = NO; } if(!pass) { if (errPtr) *errPtr = [self getStreamError]; } return pass; } /** * Called when read or write streams open. * When the socket is connected and both streams are open, consider the AsyncSocket instance to be ready. **/ - (void)doStreamOpen { if ((theFlags & kDidCompleteOpenForRead) && (theFlags & kDidCompleteOpenForWrite)) { NSError *err = nil; // Get the socket if (![self setSocketFromStreamsAndReturnError: &err]) { NSLog (@"AsyncSocket %p couldn't get socket from streams, %@. Disconnecting.", self, err); [self closeWithError:err]; return; } // Stop the connection attempt timeout timer [self endConnectTimeout]; if ([theDelegate respondsToSelector:@selector(onSocket:didConnectToHost:port:)]) { [theDelegate onSocket:self didConnectToHost:[self connectedHost] port:[self connectedPort]]; } // Immediately deal with any already-queued requests. [self maybeDequeueRead]; [self maybeDequeueWrite]; } } - (BOOL)setSocketFromStreamsAndReturnError:(NSError **)errPtr { // Get the CFSocketNativeHandle from theReadStream CFSocketNativeHandle native; CFDataRef nativeProp = CFReadStreamCopyProperty(theReadStream, kCFStreamPropertySocketNativeHandle); if(nativeProp == NULL) { if (errPtr) *errPtr = [self getStreamError]; return NO; } CFIndex nativePropLen = CFDataGetLength(nativeProp); CFIndex nativeLen = (CFIndex)sizeof(native); CFIndex len = MIN(nativePropLen, nativeLen); CFDataGetBytes(nativeProp, CFRangeMake(0, len), (UInt8 *)&native); CFRelease(nativeProp); CFSocketRef theSocket = CFSocketCreateWithNative(kCFAllocatorDefault, native, 0, NULL, NULL); if(theSocket == NULL) { if (errPtr) *errPtr = [self getSocketError]; return NO; } // Determine whether the connection was IPv4 or IPv6. // We may already know if this was an accepted socket, // or if the connectToAddress method was used. // In either of the above two cases, the native socket variable would already be set. if (theNativeSocket4 > 0) { theSocket4 = theSocket; return YES; } if (theNativeSocket6 > 0) { theSocket6 = theSocket; return YES; } CFDataRef peeraddr = CFSocketCopyPeerAddress(theSocket); if(peeraddr == NULL) { NSLog(@"AsyncSocket couldn't determine IP version of socket"); CFRelease(theSocket); if (errPtr) *errPtr = [self getSocketError]; return NO; } struct sockaddr *sa = (struct sockaddr *)CFDataGetBytePtr(peeraddr); if(sa->sa_family == AF_INET) { theSocket4 = theSocket; theNativeSocket4 = native; } else { theSocket6 = theSocket; theNativeSocket6 = native; } CFRelease(peeraddr); return YES; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Disconnect Implementation //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Sends error message and disconnects - (void)closeWithError:(NSError *)err { theFlags |= kClosingWithError; if (theFlags & kDidStartDelegate) { // Try to salvage what data we can. [self recoverUnreadData]; // Let the delegate know, so it can try to recover if it likes. if ([theDelegate respondsToSelector:@selector(onSocket:willDisconnectWithError:)]) { [theDelegate onSocket:self willDisconnectWithError:err]; } } [self close]; } // Prepare partially read data for recovery. - (void)recoverUnreadData { if(theCurrentRead != nil) { // We never finished the current read. // Check to see if it's a normal read packet (not AsyncSpecialPacket) and if it had read anything yet. if(([theCurrentRead isKindOfClass:[AsyncReadPacket class]]) && (theCurrentRead->bytesDone > 0)) { // We need to move its data into the front of the partial read buffer. void *buffer = [theCurrentRead->buffer mutableBytes] + theCurrentRead->startOffset; [partialReadBuffer replaceBytesInRange:NSMakeRange(0, 0) withBytes:buffer length:theCurrentRead->bytesDone]; } } [self emptyQueues]; } - (void)emptyQueues { if (theCurrentRead != nil) [self endCurrentRead]; if (theCurrentWrite != nil) [self endCurrentWrite]; [theReadQueue removeAllObjects]; [theWriteQueue removeAllObjects]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(maybeDequeueRead) object:nil]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(maybeDequeueWrite) object:nil]; theFlags &= ~kDequeueReadScheduled; theFlags &= ~kDequeueWriteScheduled; } /** * Disconnects. This is called for both error and clean disconnections. **/ - (void)close { // Empty queues [self emptyQueues]; // Clear partialReadBuffer (pre-buffer and also unreadData buffer in case of error) [partialReadBuffer replaceBytesInRange:NSMakeRange(0, [partialReadBuffer length]) withBytes:NULL length:0]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(disconnect) object:nil]; // Stop the connection attempt timeout timer if (theConnectTimer != nil) { [self endConnectTimeout]; } // Close streams. if (theReadStream != NULL) { [self runLoopUnscheduleReadStream]; CFReadStreamClose(theReadStream); CFRelease(theReadStream); theReadStream = NULL; } if (theWriteStream != NULL) { [self runLoopUnscheduleWriteStream]; CFWriteStreamClose(theWriteStream); CFRelease(theWriteStream); theWriteStream = NULL; } // Close sockets. if (theSocket4 != NULL) { CFSocketInvalidate (theSocket4); CFRelease (theSocket4); theSocket4 = NULL; } if (theSocket6 != NULL) { CFSocketInvalidate (theSocket6); CFRelease (theSocket6); theSocket6 = NULL; } // Closing the streams or sockets resulted in closing the underlying native socket theNativeSocket4 = 0; theNativeSocket6 = 0; // Remove run loop sources if (theSource4 != NULL) { [self runLoopRemoveSource:theSource4]; CFRelease (theSource4); theSource4 = NULL; } if (theSource6 != NULL) { [self runLoopRemoveSource:theSource6]; CFRelease (theSource6); theSource6 = NULL; } theRunLoop = NULL; // If the client has passed the connect/accept method, then the connection has at least begun. // Notify delegate that it is now ending. BOOL shouldCallDelegate = (theFlags & kDidStartDelegate); // Clear all flags (except the pre-buffering flag, which should remain as is) theFlags &= kEnablePreBuffering; if (shouldCallDelegate) { if ([theDelegate respondsToSelector: @selector(onSocketDidDisconnect:)]) { [theDelegate onSocketDidDisconnect:self]; } } // Do not access any instance variables after calling onSocketDidDisconnect. // This gives the delegate freedom to release us without returning here and crashing. } /** * Disconnects immediately. Any pending reads or writes are dropped. **/ - (void)disconnect { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif [self close]; } /** * Diconnects after all pending reads have completed. **/ - (void)disconnectAfterReading { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif theFlags |= (kForbidReadsWrites | kDisconnectAfterReads); [self maybeScheduleDisconnect]; } /** * Disconnects after all pending writes have completed. **/ - (void)disconnectAfterWriting { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif theFlags |= (kForbidReadsWrites | kDisconnectAfterWrites); [self maybeScheduleDisconnect]; } /** * Disconnects after all pending reads and writes have completed. **/ - (void)disconnectAfterReadingAndWriting { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif theFlags |= (kForbidReadsWrites | kDisconnectAfterReads | kDisconnectAfterWrites); [self maybeScheduleDisconnect]; } /** * Schedules a call to disconnect if possible. * That is, if all writes have completed, and we're set to disconnect after writing, * or if all reads have completed, and we're set to disconnect after reading. **/ - (void)maybeScheduleDisconnect { BOOL shouldDisconnect = NO; if(theFlags & kDisconnectAfterReads) { if(([theReadQueue count] == 0) && (theCurrentRead == nil)) { if(theFlags & kDisconnectAfterWrites) { if(([theWriteQueue count] == 0) && (theCurrentWrite == nil)) { shouldDisconnect = YES; } } else { shouldDisconnect = YES; } } } else if(theFlags & kDisconnectAfterWrites) { if(([theWriteQueue count] == 0) && (theCurrentWrite == nil)) { shouldDisconnect = YES; } } if(shouldDisconnect) { [self performSelector:@selector(disconnect) withObject:nil afterDelay:0 inModes:theRunLoopModes]; } } /** * In the event of an error, this method may be called during onSocket:willDisconnectWithError: to read * any data that's left on the socket. **/ - (NSData *)unreadData { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif // Ensure this method will only return data in the event of an error if (!(theFlags & kClosingWithError)) return nil; if (theReadStream == NULL) return nil; NSUInteger totalBytesRead = [partialReadBuffer length]; BOOL error = NO; while (!error && CFReadStreamHasBytesAvailable(theReadStream)) { if (totalBytesRead == [partialReadBuffer length]) { [partialReadBuffer increaseLengthBy:READALL_CHUNKSIZE]; } // Number of bytes to read is space left in packet buffer. NSUInteger bytesToRead = [partialReadBuffer length] - totalBytesRead; // Read data into packet buffer UInt8 *packetbuf = (UInt8 *)( [partialReadBuffer mutableBytes] + totalBytesRead ); CFIndex result = CFReadStreamRead(theReadStream, packetbuf, bytesToRead); // Check results if (result < 0) { error = YES; } else { CFIndex bytesRead = result; totalBytesRead += bytesRead; } } [partialReadBuffer setLength:totalBytesRead]; return partialReadBuffer; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Errors //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Returns a standard error object for the current errno value. * Errno is used for low-level BSD socket errors. **/ - (NSError *)getErrnoError { NSString *errorMsg = [NSString stringWithUTF8String:strerror(errno)]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errorMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } /** * Returns a standard error message for a CFSocket error. * Unfortunately, CFSocket offers no feedback on its errors. **/ - (NSError *)getSocketError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"AsyncSocketCFSocketError", @"AsyncSocket", [NSBundle mainBundle], @"General CFSocket error", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketCFSocketError userInfo:info]; } - (NSError *)getStreamError { CFStreamError err; if (theReadStream != NULL) { err = CFReadStreamGetError (theReadStream); if (err.error != 0) return [self errorFromCFStreamError: err]; } if (theWriteStream != NULL) { err = CFWriteStreamGetError (theWriteStream); if (err.error != 0) return [self errorFromCFStreamError: err]; } return nil; } /** * Returns a standard AsyncSocket abort error. **/ - (NSError *)getAbortError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"AsyncSocketCanceledError", @"AsyncSocket", [NSBundle mainBundle], @"Connection canceled", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketCanceledError userInfo:info]; } /** * Returns a standard AsyncSocket connect timeout error. **/ - (NSError *)getConnectTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"AsyncSocketConnectTimeoutError", @"AsyncSocket", [NSBundle mainBundle], @"Attempt to connect to host timed out", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketConnectTimeoutError userInfo:info]; } /** * Returns a standard AsyncSocket maxed out error. **/ - (NSError *)getReadMaxedOutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"AsyncSocketReadMaxedOutError", @"AsyncSocket", [NSBundle mainBundle], @"Read operation reached set maximum length", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketReadMaxedOutError userInfo:info]; } /** * Returns a standard AsyncSocket read timeout error. **/ - (NSError *)getReadTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"AsyncSocketReadTimeoutError", @"AsyncSocket", [NSBundle mainBundle], @"Read operation timed out", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketReadTimeoutError userInfo:info]; } /** * Returns a standard AsyncSocket write timeout error. **/ - (NSError *)getWriteTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"AsyncSocketWriteTimeoutError", @"AsyncSocket", [NSBundle mainBundle], @"Write operation timed out", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncSocketErrorDomain code:AsyncSocketWriteTimeoutError userInfo:info]; } - (NSError *)errorFromCFStreamError:(CFStreamError)err { if (err.domain == 0 && err.error == 0) return nil; // Can't use switch; these constants aren't int literals. NSString *domain = @"CFStreamError (unlisted domain)"; NSString *message = nil; if(err.domain == kCFStreamErrorDomainPOSIX) { domain = NSPOSIXErrorDomain; } else if(err.domain == kCFStreamErrorDomainMacOSStatus) { domain = NSOSStatusErrorDomain; } else if(err.domain == kCFStreamErrorDomainMach) { domain = NSMachErrorDomain; } else if(err.domain == kCFStreamErrorDomainNetDB) { domain = @"kCFStreamErrorDomainNetDB"; message = [NSString stringWithCString:gai_strerror(err.error) encoding:NSASCIIStringEncoding]; } else if(err.domain == kCFStreamErrorDomainNetServices) { domain = @"kCFStreamErrorDomainNetServices"; } else if(err.domain == kCFStreamErrorDomainSOCKS) { domain = @"kCFStreamErrorDomainSOCKS"; } else if(err.domain == kCFStreamErrorDomainSystemConfiguration) { domain = @"kCFStreamErrorDomainSystemConfiguration"; } else if(err.domain == kCFStreamErrorDomainSSL) { domain = @"kCFStreamErrorDomainSSL"; } NSDictionary *info = nil; if(message != nil) { info = [NSDictionary dictionaryWithObject:message forKey:NSLocalizedDescriptionKey]; } return [NSError errorWithDomain:domain code:err.error userInfo:info]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Diagnostics //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)isDisconnected { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if (theNativeSocket4 > 0) return NO; if (theNativeSocket6 > 0) return NO; if (theSocket4) return NO; if (theSocket6) return NO; if (theReadStream) return NO; if (theWriteStream) return NO; return YES; } - (BOOL)isConnected { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return [self areStreamsConnected]; } - (NSString *)connectedHost { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if(theSocket4) return [self connectedHostFromCFSocket4:theSocket4]; if(theSocket6) return [self connectedHostFromCFSocket6:theSocket6]; if(theNativeSocket4 > 0) return [self connectedHostFromNativeSocket4:theNativeSocket4]; if(theNativeSocket6 > 0) return [self connectedHostFromNativeSocket6:theNativeSocket6]; return nil; } - (UInt16)connectedPort { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if(theSocket4) return [self connectedPortFromCFSocket4:theSocket4]; if(theSocket6) return [self connectedPortFromCFSocket6:theSocket6]; if(theNativeSocket4 > 0) return [self connectedPortFromNativeSocket4:theNativeSocket4]; if(theNativeSocket6 > 0) return [self connectedPortFromNativeSocket6:theNativeSocket6]; return 0; } - (NSString *)localHost { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if(theSocket4) return [self localHostFromCFSocket4:theSocket4]; if(theSocket6) return [self localHostFromCFSocket6:theSocket6]; if(theNativeSocket4 > 0) return [self localHostFromNativeSocket4:theNativeSocket4]; if(theNativeSocket6 > 0) return [self localHostFromNativeSocket6:theNativeSocket6]; return nil; } - (UInt16)localPort { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if(theSocket4) return [self localPortFromCFSocket4:theSocket4]; if(theSocket6) return [self localPortFromCFSocket6:theSocket6]; if(theNativeSocket4 > 0) return [self localPortFromNativeSocket4:theNativeSocket4]; if(theNativeSocket6 > 0) return [self localPortFromNativeSocket6:theNativeSocket6]; return 0; } - (NSString *)connectedHost4 { if(theSocket4) return [self connectedHostFromCFSocket4:theSocket4]; if(theNativeSocket4 > 0) return [self connectedHostFromNativeSocket4:theNativeSocket4]; return nil; } - (NSString *)connectedHost6 { if(theSocket6) return [self connectedHostFromCFSocket6:theSocket6]; if(theNativeSocket6 > 0) return [self connectedHostFromNativeSocket6:theNativeSocket6]; return nil; } - (UInt16)connectedPort4 { if(theSocket4) return [self connectedPortFromCFSocket4:theSocket4]; if(theNativeSocket4 > 0) return [self connectedPortFromNativeSocket4:theNativeSocket4]; return 0; } - (UInt16)connectedPort6 { if(theSocket6) return [self connectedPortFromCFSocket6:theSocket6]; if(theNativeSocket6 > 0) return [self connectedPortFromNativeSocket6:theNativeSocket6]; return 0; } - (NSString *)localHost4 { if(theSocket4) return [self localHostFromCFSocket4:theSocket4]; if(theNativeSocket4 > 0) return [self localHostFromNativeSocket4:theNativeSocket4]; return nil; } - (NSString *)localHost6 { if(theSocket6) return [self localHostFromCFSocket6:theSocket6]; if(theNativeSocket6 > 0) return [self localHostFromNativeSocket6:theNativeSocket6]; return nil; } - (UInt16)localPort4 { if(theSocket4) return [self localPortFromCFSocket4:theSocket4]; if(theNativeSocket4 > 0) return [self localPortFromNativeSocket4:theNativeSocket4]; return 0; } - (UInt16)localPort6 { if(theSocket6) return [self localPortFromCFSocket6:theSocket6]; if(theNativeSocket6 > 0) return [self localPortFromNativeSocket6:theNativeSocket6]; return 0; } - (NSString *)connectedHostFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if(getpeername(theNativeSocket, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return nil; } return [self hostFromAddress4:&sockaddr4]; } - (NSString *)connectedHostFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if(getpeername(theNativeSocket, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return nil; } return [self hostFromAddress6:&sockaddr6]; } - (NSString *)connectedHostFromCFSocket4:(CFSocketRef)theSocket { CFDataRef peeraddr; NSString *peerstr = nil; if((peeraddr = CFSocketCopyPeerAddress(theSocket))) { struct sockaddr_in *pSockAddr = (struct sockaddr_in *)CFDataGetBytePtr(peeraddr); peerstr = [self hostFromAddress4:pSockAddr]; CFRelease (peeraddr); } return peerstr; } - (NSString *)connectedHostFromCFSocket6:(CFSocketRef)theSocket { CFDataRef peeraddr; NSString *peerstr = nil; if((peeraddr = CFSocketCopyPeerAddress(theSocket))) { struct sockaddr_in6 *pSockAddr = (struct sockaddr_in6 *)CFDataGetBytePtr(peeraddr); peerstr = [self hostFromAddress6:pSockAddr]; CFRelease (peeraddr); } return peerstr; } - (UInt16)connectedPortFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if(getpeername(theNativeSocket, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return 0; } return [self portFromAddress4:&sockaddr4]; } - (UInt16)connectedPortFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if(getpeername(theNativeSocket, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return 0; } return [self portFromAddress6:&sockaddr6]; } - (UInt16)connectedPortFromCFSocket4:(CFSocketRef)theSocket { CFDataRef peeraddr; UInt16 peerport = 0; if((peeraddr = CFSocketCopyPeerAddress(theSocket))) { struct sockaddr_in *pSockAddr = (struct sockaddr_in *)CFDataGetBytePtr(peeraddr); peerport = [self portFromAddress4:pSockAddr]; CFRelease (peeraddr); } return peerport; } - (UInt16)connectedPortFromCFSocket6:(CFSocketRef)theSocket { CFDataRef peeraddr; UInt16 peerport = 0; if((peeraddr = CFSocketCopyPeerAddress(theSocket))) { struct sockaddr_in6 *pSockAddr = (struct sockaddr_in6 *)CFDataGetBytePtr(peeraddr); peerport = [self portFromAddress6:pSockAddr]; CFRelease (peeraddr); } return peerport; } - (NSString *)localHostFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if(getsockname(theNativeSocket, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return nil; } return [self hostFromAddress4:&sockaddr4]; } - (NSString *)localHostFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if(getsockname(theNativeSocket, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return nil; } return [self hostFromAddress6:&sockaddr6]; } - (NSString *)localHostFromCFSocket4:(CFSocketRef)theSocket { CFDataRef selfaddr; NSString *selfstr = nil; if((selfaddr = CFSocketCopyAddress(theSocket))) { struct sockaddr_in *pSockAddr = (struct sockaddr_in *)CFDataGetBytePtr(selfaddr); selfstr = [self hostFromAddress4:pSockAddr]; CFRelease (selfaddr); } return selfstr; } - (NSString *)localHostFromCFSocket6:(CFSocketRef)theSocket { CFDataRef selfaddr; NSString *selfstr = nil; if((selfaddr = CFSocketCopyAddress(theSocket))) { struct sockaddr_in6 *pSockAddr = (struct sockaddr_in6 *)CFDataGetBytePtr(selfaddr); selfstr = [self hostFromAddress6:pSockAddr]; CFRelease (selfaddr); } return selfstr; } - (UInt16)localPortFromNativeSocket4:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if(getsockname(theNativeSocket, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return 0; } return [self portFromAddress4:&sockaddr4]; } - (UInt16)localPortFromNativeSocket6:(CFSocketNativeHandle)theNativeSocket { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if(getsockname(theNativeSocket, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return 0; } return [self portFromAddress6:&sockaddr6]; } - (UInt16)localPortFromCFSocket4:(CFSocketRef)theSocket { CFDataRef selfaddr; UInt16 selfport = 0; if ((selfaddr = CFSocketCopyAddress(theSocket))) { struct sockaddr_in *pSockAddr = (struct sockaddr_in *)CFDataGetBytePtr(selfaddr); selfport = [self portFromAddress4:pSockAddr]; CFRelease (selfaddr); } return selfport; } - (UInt16)localPortFromCFSocket6:(CFSocketRef)theSocket { CFDataRef selfaddr; UInt16 selfport = 0; if ((selfaddr = CFSocketCopyAddress(theSocket))) { struct sockaddr_in6 *pSockAddr = (struct sockaddr_in6 *)CFDataGetBytePtr(selfaddr); selfport = [self portFromAddress6:pSockAddr]; CFRelease (selfaddr); } return selfport; } - (NSString *)hostFromAddress4:(struct sockaddr_in *)pSockaddr4 { char addrBuf[INET_ADDRSTRLEN]; if(inet_ntop(AF_INET, &pSockaddr4->sin_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) { [NSException raise:NSInternalInconsistencyException format:@"Cannot convert IPv4 address to string."]; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } - (NSString *)hostFromAddress6:(struct sockaddr_in6 *)pSockaddr6 { char addrBuf[INET6_ADDRSTRLEN]; if(inet_ntop(AF_INET6, &pSockaddr6->sin6_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) { [NSException raise:NSInternalInconsistencyException format:@"Cannot convert IPv6 address to string."]; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } - (UInt16)portFromAddress4:(struct sockaddr_in *)pSockaddr4 { return ntohs(pSockaddr4->sin_port); } - (UInt16)portFromAddress6:(struct sockaddr_in6 *)pSockaddr6 { return ntohs(pSockaddr6->sin6_port); } - (NSData *)connectedAddress { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif // Extract address from CFSocket CFSocketRef theSocket; if (theSocket4) theSocket = theSocket4; else theSocket = theSocket6; if (theSocket) { CFDataRef peeraddr = CFSocketCopyPeerAddress(theSocket); if (peeraddr == NULL) return nil; NSData *result = (__bridge_transfer NSData *)peeraddr; return result; } // Extract address from CFSocketNativeHandle socklen_t sockaddrlen; CFSocketNativeHandle theNativeSocket = 0; if (theNativeSocket4 > 0) { theNativeSocket = theNativeSocket4; sockaddrlen = sizeof(struct sockaddr_in); } else { theNativeSocket = theNativeSocket6; sockaddrlen = sizeof(struct sockaddr_in6); } NSData *result = nil; void *sockaddr = malloc(sockaddrlen); if(getpeername(theNativeSocket, (struct sockaddr *)sockaddr, &sockaddrlen) >= 0) { result = [NSData dataWithBytesNoCopy:sockaddr length:sockaddrlen freeWhenDone:YES]; } else { free(sockaddr); } return result; } - (NSData *)localAddress { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif // Extract address from CFSocket CFSocketRef theSocket; if (theSocket4) theSocket = theSocket4; else theSocket = theSocket6; if (theSocket) { CFDataRef selfaddr = CFSocketCopyAddress(theSocket); if (selfaddr == NULL) return nil; NSData *result = (__bridge_transfer NSData *)selfaddr; return result; } // Extract address from CFSocketNativeHandle socklen_t sockaddrlen; CFSocketNativeHandle theNativeSocket = 0; if (theNativeSocket4 > 0) { theNativeSocket = theNativeSocket4; sockaddrlen = sizeof(struct sockaddr_in); } else { theNativeSocket = theNativeSocket6; sockaddrlen = sizeof(struct sockaddr_in6); } NSData *result = nil; void *sockaddr = malloc(sockaddrlen); if(getsockname(theNativeSocket, (struct sockaddr *)sockaddr, &sockaddrlen) >= 0) { result = [NSData dataWithBytesNoCopy:sockaddr length:sockaddrlen freeWhenDone:YES]; } else { free(sockaddr); } return result; } - (BOOL)isIPv4 { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return (theNativeSocket4 > 0 || theSocket4 != NULL); } - (BOOL)isIPv6 { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif return (theNativeSocket6 > 0 || theSocket6 != NULL); } - (BOOL)areStreamsConnected { CFStreamStatus s; if (theReadStream != NULL) { s = CFReadStreamGetStatus(theReadStream); if ( !(s == kCFStreamStatusOpen || s == kCFStreamStatusReading || s == kCFStreamStatusError) ) return NO; } else return NO; if (theWriteStream != NULL) { s = CFWriteStreamGetStatus(theWriteStream); if ( !(s == kCFStreamStatusOpen || s == kCFStreamStatusWriting || s == kCFStreamStatusError) ) return NO; } else return NO; return YES; } - (NSString *)description { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif static const char *statstr[] = {"not open","opening","open","reading","writing","at end","closed","has error"}; CFStreamStatus rs = (theReadStream != NULL) ? CFReadStreamGetStatus(theReadStream) : 0; CFStreamStatus ws = (theWriteStream != NULL) ? CFWriteStreamGetStatus(theWriteStream) : 0; NSString *peerstr, *selfstr; BOOL is4 = [self isIPv4]; BOOL is6 = [self isIPv6]; if (is4 || is6) { if (is4 && is6) { peerstr = [NSString stringWithFormat: @"%@/%@ %u", [self connectedHost4], [self connectedHost6], [self connectedPort]]; } else if (is4) { peerstr = [NSString stringWithFormat: @"%@ %u", [self connectedHost4], [self connectedPort4]]; } else { peerstr = [NSString stringWithFormat: @"%@ %u", [self connectedHost6], [self connectedPort6]]; } } else peerstr = @"nowhere"; if (is4 || is6) { if (is4 && is6) { selfstr = [NSString stringWithFormat: @"%@/%@ %u", [self localHost4], [self localHost6], [self localPort]]; } else if (is4) { selfstr = [NSString stringWithFormat: @"%@ %u", [self localHost4], [self localPort4]]; } else { selfstr = [NSString stringWithFormat: @"%@ %u", [self localHost6], [self localPort6]]; } } else selfstr = @"nowhere"; NSMutableString *ms = [[NSMutableString alloc] initWithCapacity:150]; [ms appendString:[NSString stringWithFormat:@"readLength > 0) percentDone = (float)theCurrentRead->bytesDone / (float)theCurrentRead->readLength * 100.0F; else percentDone = 100.0F; [ms appendString: [NSString stringWithFormat:@"currently read %u bytes (%d%% done), ", (unsigned int)[theCurrentRead->buffer length], theCurrentRead->bytesDone ? percentDone : 0]]; } if (theCurrentWrite == nil || [theCurrentWrite isKindOfClass:[AsyncSpecialPacket class]]) [ms appendString: @"no current write, "]; else { int percentDone = (float)theCurrentWrite->bytesDone / (float)[theCurrentWrite->buffer length] * 100.0F; [ms appendString: [NSString stringWithFormat:@"currently written %u (%d%%), ", (unsigned int)[theCurrentWrite->buffer length], theCurrentWrite->bytesDone ? percentDone : 0]]; } [ms appendString:[NSString stringWithFormat:@"read stream %p %s, ", theReadStream, statstr[rs]]]; [ms appendString:[NSString stringWithFormat:@"write stream %p %s", theWriteStream, statstr[ws]]]; if(theFlags & kDisconnectAfterReads) { if(theFlags & kDisconnectAfterWrites) [ms appendString: @", will disconnect after reads & writes"]; else [ms appendString: @", will disconnect after reads"]; } else if(theFlags & kDisconnectAfterWrites) { [ms appendString: @", will disconnect after writes"]; } if (![self isConnected]) [ms appendString: @", not connected"]; [ms appendString:@">"]; return ms; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Reading //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag { [self readDataWithTimeout:timeout buffer:nil bufferOffset:0 maxLength:0 tag:tag]; } - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag { [self readDataWithTimeout:timeout buffer:buffer bufferOffset:offset maxLength:0 tag:tag]; } - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if (offset > [buffer length]) return; if (theFlags & kForbidReadsWrites) return; AsyncReadPacket *packet = [[AsyncReadPacket alloc] initWithData:buffer startOffset:offset maxLength:length timeout:timeout readLength:0 terminator:nil tag:tag]; [theReadQueue addObject:packet]; [self scheduleDequeueRead]; } - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag { [self readDataToLength:length withTimeout:timeout buffer:nil bufferOffset:0 tag:tag]; } - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if (length == 0) return; if (offset > [buffer length]) return; if (theFlags & kForbidReadsWrites) return; AsyncReadPacket *packet = [[AsyncReadPacket alloc] initWithData:buffer startOffset:offset maxLength:0 timeout:timeout readLength:length terminator:nil tag:tag]; [theReadQueue addObject:packet]; [self scheduleDequeueRead]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag { [self readDataToData:data withTimeout:timeout buffer:nil bufferOffset:0 maxLength:0 tag:tag]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag { [self readDataToData:data withTimeout:timeout buffer:buffer bufferOffset:offset maxLength:0 tag:tag]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag { [self readDataToData:data withTimeout:timeout buffer:nil bufferOffset:0 maxLength:length tag:tag]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if (data == nil || [data length] == 0) return; if (offset > [buffer length]) return; if (length > 0 && length < [data length]) return; if (theFlags & kForbidReadsWrites) return; AsyncReadPacket *packet = [[AsyncReadPacket alloc] initWithData:buffer startOffset:offset maxLength:length timeout:timeout readLength:0 terminator:data tag:tag]; [theReadQueue addObject:packet]; [self scheduleDequeueRead]; } /** * Puts a maybeDequeueRead on the run loop. * An assumption here is that selectors will be performed consecutively within their priority. **/ - (void)scheduleDequeueRead { if((theFlags & kDequeueReadScheduled) == 0) { theFlags |= kDequeueReadScheduled; [self performSelector:@selector(maybeDequeueRead) withObject:nil afterDelay:0 inModes:theRunLoopModes]; } } /** * This method starts a new read, if needed. * It is called when a user requests a read, * or when a stream opens that may have requested reads sitting in the queue, etc. **/ - (void)maybeDequeueRead { // Unset the flag indicating a call to this method is scheduled theFlags &= ~kDequeueReadScheduled; // If we're not currently processing a read AND we have an available read stream if((theCurrentRead == nil) && (theReadStream != NULL)) { if([theReadQueue count] > 0) { // Dequeue the next object in the write queue theCurrentRead = [theReadQueue objectAtIndex:0]; [theReadQueue removeObjectAtIndex:0]; if([theCurrentRead isKindOfClass:[AsyncSpecialPacket class]]) { // Attempt to start TLS theFlags |= kStartingReadTLS; // This method won't do anything unless both kStartingReadTLS and kStartingWriteTLS are set [self maybeStartTLS]; } else { // Start time-out timer if(theCurrentRead->timeout >= 0.0) { theReadTimer = [NSTimer timerWithTimeInterval:theCurrentRead->timeout target:self selector:@selector(doReadTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theReadTimer]; } // Immediately read, if possible [self doBytesAvailable]; } } else if(theFlags & kDisconnectAfterReads) { if(theFlags & kDisconnectAfterWrites) { if(([theWriteQueue count] == 0) && (theCurrentWrite == nil)) { [self disconnect]; } } else { [self disconnect]; } } } } /** * Call this method in doBytesAvailable instead of CFReadStreamHasBytesAvailable(). * This method supports pre-buffering properly as well as the kSocketHasBytesAvailable flag. **/ - (BOOL)hasBytesAvailable { if ((theFlags & kSocketHasBytesAvailable) || ([partialReadBuffer length] > 0)) { return YES; } else { return CFReadStreamHasBytesAvailable(theReadStream); } } /** * Call this method in doBytesAvailable instead of CFReadStreamRead(). * This method support pre-buffering properly. **/ - (CFIndex)readIntoBuffer:(void *)buffer maxLength:(NSUInteger)length { if([partialReadBuffer length] > 0) { // Determine the maximum amount of data to read NSUInteger bytesToRead = MIN(length, [partialReadBuffer length]); // Copy the bytes from the partial read buffer memcpy(buffer, [partialReadBuffer bytes], (size_t)bytesToRead); // Remove the copied bytes from the partial read buffer [partialReadBuffer replaceBytesInRange:NSMakeRange(0, bytesToRead) withBytes:NULL length:0]; return (CFIndex)bytesToRead; } else { // Unset the "has-bytes-available" flag theFlags &= ~kSocketHasBytesAvailable; return CFReadStreamRead(theReadStream, (UInt8 *)buffer, length); } } /** * This method is called when a new read is taken from the read queue or when new data becomes available on the stream. **/ - (void)doBytesAvailable { // If data is available on the stream, but there is no read request, then we don't need to process the data yet. // Also, if there is a read request but no read stream setup, we can't process any data yet. if((theCurrentRead == nil) || (theReadStream == NULL)) { return; } // Note: This method is not called if theCurrentRead is an AsyncSpecialPacket (startTLS packet) NSUInteger totalBytesRead = 0; BOOL done = NO; BOOL socketError = NO; BOOL maxoutError = NO; while(!done && !socketError && !maxoutError && [self hasBytesAvailable]) { BOOL didPreBuffer = NO; BOOL didReadFromPreBuffer = NO; // There are 3 types of read packets: // // 1) Read all available data. // 2) Read a specific length of data. // 3) Read up to a particular terminator. NSUInteger bytesToRead; if (theCurrentRead->term != nil) { // Read type #3 - read up to a terminator // // If pre-buffering is enabled we'll read a chunk and search for the terminator. // If the terminator is found, overflow data will be placed in the partialReadBuffer for the next read. // // If pre-buffering is disabled we'll be forced to read only a few bytes. // Just enough to ensure we don't go past our term or over our max limit. // // If we already have data pre-buffered, we can read directly from it. if ([partialReadBuffer length] > 0) { didReadFromPreBuffer = YES; bytesToRead = [theCurrentRead readLengthForTermWithPreBuffer:partialReadBuffer found:&done]; } else { if (theFlags & kEnablePreBuffering) { didPreBuffer = YES; bytesToRead = [theCurrentRead prebufferReadLengthForTerm]; } else { bytesToRead = [theCurrentRead readLengthForTerm]; } } } else { // Read type #1 or #2 bytesToRead = [theCurrentRead readLengthForNonTerm]; } // Make sure we have enough room in the buffer for our read NSUInteger buffSize = [theCurrentRead->buffer length]; NSUInteger buffSpace = buffSize - theCurrentRead->startOffset - theCurrentRead->bytesDone; if (bytesToRead > buffSpace) { NSUInteger buffInc = bytesToRead - buffSpace; [theCurrentRead->buffer increaseLengthBy:buffInc]; } // Read data into packet buffer void *buffer = [theCurrentRead->buffer mutableBytes] + theCurrentRead->startOffset; void *subBuffer = buffer + theCurrentRead->bytesDone; CFIndex result = [self readIntoBuffer:subBuffer maxLength:bytesToRead]; // Check results if (result < 0) { socketError = YES; } else { CFIndex bytesRead = result; // Update total amount read for the current read theCurrentRead->bytesDone += bytesRead; // Update total amount read in this method invocation totalBytesRead += bytesRead; // Is packet done? if (theCurrentRead->readLength > 0) { // Read type #2 - read a specific length of data done = (theCurrentRead->bytesDone == theCurrentRead->readLength); } else if (theCurrentRead->term != nil) { // Read type #3 - read up to a terminator if (didPreBuffer) { // Search for the terminating sequence within the big chunk we just read. NSInteger overflow = [theCurrentRead searchForTermAfterPreBuffering:result]; if (overflow > 0) { // Copy excess data into partialReadBuffer void *overflowBuffer = buffer + theCurrentRead->bytesDone - overflow; [partialReadBuffer appendBytes:overflowBuffer length:overflow]; // Update the bytesDone variable. theCurrentRead->bytesDone -= overflow; // Note: The completeCurrentRead method will trim the buffer for us. } done = (overflow >= 0); } else if (didReadFromPreBuffer) { // Our 'done' variable was updated via the readLengthForTermWithPreBuffer:found: method } else { // Search for the terminating sequence at the end of the buffer NSUInteger termlen = [theCurrentRead->term length]; if(theCurrentRead->bytesDone >= termlen) { void *bufferEnd = buffer + (theCurrentRead->bytesDone - termlen); const void *seq = [theCurrentRead->term bytes]; done = (memcmp (bufferEnd, seq, termlen) == 0); } } if(!done && theCurrentRead->maxLength > 0) { // We're not done and there's a set maxLength. // Have we reached that maxLength yet? if(theCurrentRead->bytesDone >= theCurrentRead->maxLength) { maxoutError = YES; } } } else { // Read type #1 - read all available data // // We're done when: // - we reach maxLength (if there is a max) // - all readable is read (see below) if (theCurrentRead->maxLength > 0) { done = (theCurrentRead->bytesDone >= theCurrentRead->maxLength); } } } } if (theCurrentRead->readLength <= 0 && theCurrentRead->term == nil) { // Read type #1 - read all available data if (theCurrentRead->bytesDone > 0) { // Ran out of bytes, so the "read-all-available-data" type packet is done done = YES; } } if (done) { [self completeCurrentRead]; if (!socketError) [self scheduleDequeueRead]; } else if (totalBytesRead > 0) { // We're not done with the readToLength or readToData yet, but we have read in some bytes if ([theDelegate respondsToSelector:@selector(onSocket:didReadPartialDataOfLength:tag:)]) { [theDelegate onSocket:self didReadPartialDataOfLength:totalBytesRead tag:theCurrentRead->tag]; } } if(socketError) { CFStreamError err = CFReadStreamGetError(theReadStream); [self closeWithError:[self errorFromCFStreamError:err]]; return; } if(maxoutError) { [self closeWithError:[self getReadMaxedOutError]]; return; } } // Ends current read and calls delegate. - (void)completeCurrentRead { NSAssert(theCurrentRead, @"Trying to complete current read when there is no current read."); NSData *result; if (theCurrentRead->bufferOwner) { // We created the buffer on behalf of the user. // Trim our buffer to be the proper size. [theCurrentRead->buffer setLength:theCurrentRead->bytesDone]; result = theCurrentRead->buffer; } else { // We did NOT create the buffer. // The buffer is owned by the caller. // Only trim the buffer if we had to increase its size. if ([theCurrentRead->buffer length] > theCurrentRead->originalBufferLength) { NSUInteger readSize = theCurrentRead->startOffset + theCurrentRead->bytesDone; NSUInteger origSize = theCurrentRead->originalBufferLength; NSUInteger buffSize = MAX(readSize, origSize); [theCurrentRead->buffer setLength:buffSize]; } void *buffer = [theCurrentRead->buffer mutableBytes] + theCurrentRead->startOffset; result = [NSData dataWithBytesNoCopy:buffer length:theCurrentRead->bytesDone freeWhenDone:NO]; } if([theDelegate respondsToSelector:@selector(onSocket:didReadData:withTag:)]) { [theDelegate onSocket:self didReadData:result withTag:theCurrentRead->tag]; } // Caller may have disconnected in the above delegate method if (theCurrentRead != nil) { [self endCurrentRead]; } } // Ends current read. - (void)endCurrentRead { NSAssert(theCurrentRead, @"Trying to end current read when there is no current read."); [theReadTimer invalidate]; theReadTimer = nil; theCurrentRead = nil; } - (void)doReadTimeout:(NSTimer *)timer { #pragma unused(timer) NSTimeInterval timeoutExtension = 0.0; if([theDelegate respondsToSelector:@selector(onSocket:shouldTimeoutReadWithTag:elapsed:bytesDone:)]) { timeoutExtension = [theDelegate onSocket:self shouldTimeoutReadWithTag:theCurrentRead->tag elapsed:theCurrentRead->timeout bytesDone:theCurrentRead->bytesDone]; } if(timeoutExtension > 0.0) { theCurrentRead->timeout += timeoutExtension; theReadTimer = [NSTimer timerWithTimeInterval:timeoutExtension target:self selector:@selector(doReadTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theReadTimer]; } else { // Do not call endCurrentRead here. // We must allow the delegate access to any partial read in the unreadData method. [self closeWithError:[self getReadTimeoutError]]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Writing //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if (data == nil || [data length] == 0) return; if (theFlags & kForbidReadsWrites) return; AsyncWritePacket *packet = [[AsyncWritePacket alloc] initWithData:data timeout:timeout tag:tag]; [theWriteQueue addObject:packet]; [self scheduleDequeueWrite]; } - (void)scheduleDequeueWrite { if((theFlags & kDequeueWriteScheduled) == 0) { theFlags |= kDequeueWriteScheduled; [self performSelector:@selector(maybeDequeueWrite) withObject:nil afterDelay:0 inModes:theRunLoopModes]; } } /** * Conditionally starts a new write. * * IF there is not another write in process * AND there is a write queued * AND we have a write stream available * * This method also handles auto-disconnect post read/write completion. **/ - (void)maybeDequeueWrite { // Unset the flag indicating a call to this method is scheduled theFlags &= ~kDequeueWriteScheduled; // If we're not currently processing a write AND we have an available write stream if((theCurrentWrite == nil) && (theWriteStream != NULL)) { if([theWriteQueue count] > 0) { // Dequeue the next object in the write queue theCurrentWrite = [theWriteQueue objectAtIndex:0]; [theWriteQueue removeObjectAtIndex:0]; if([theCurrentWrite isKindOfClass:[AsyncSpecialPacket class]]) { // Attempt to start TLS theFlags |= kStartingWriteTLS; // This method won't do anything unless both kStartingReadTLS and kStartingWriteTLS are set [self maybeStartTLS]; } else { // Start time-out timer if(theCurrentWrite->timeout >= 0.0) { theWriteTimer = [NSTimer timerWithTimeInterval:theCurrentWrite->timeout target:self selector:@selector(doWriteTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theWriteTimer]; } // Immediately write, if possible [self doSendBytes]; } } else if(theFlags & kDisconnectAfterWrites) { if(theFlags & kDisconnectAfterReads) { if(([theReadQueue count] == 0) && (theCurrentRead == nil)) { [self disconnect]; } } else { [self disconnect]; } } } } /** * Call this method in doSendBytes instead of CFWriteStreamCanAcceptBytes(). * This method supports the kSocketCanAcceptBytes flag. **/ - (BOOL)canAcceptBytes { if (theFlags & kSocketCanAcceptBytes) { return YES; } else { return CFWriteStreamCanAcceptBytes(theWriteStream); } } - (void)doSendBytes { if ((theCurrentWrite == nil) || (theWriteStream == NULL)) { return; } // Note: This method is not called if theCurrentWrite is an AsyncSpecialPacket (startTLS packet) NSUInteger totalBytesWritten = 0; BOOL done = NO; BOOL error = NO; while (!done && !error && [self canAcceptBytes]) { // Figure out what to write NSUInteger bytesRemaining = [theCurrentWrite->buffer length] - theCurrentWrite->bytesDone; NSUInteger bytesToWrite = (bytesRemaining < WRITE_CHUNKSIZE) ? bytesRemaining : WRITE_CHUNKSIZE; UInt8 *writestart = (UInt8 *)([theCurrentWrite->buffer bytes] + theCurrentWrite->bytesDone); // Write CFIndex result = CFWriteStreamWrite(theWriteStream, writestart, bytesToWrite); // Unset the "can accept bytes" flag theFlags &= ~kSocketCanAcceptBytes; // Check results if (result < 0) { error = YES; } else { CFIndex bytesWritten = result; // Update total amount read for the current write theCurrentWrite->bytesDone += bytesWritten; // Update total amount written in this method invocation totalBytesWritten += bytesWritten; // Is packet done? done = ([theCurrentWrite->buffer length] == theCurrentWrite->bytesDone); } } if(done) { [self completeCurrentWrite]; [self scheduleDequeueWrite]; } else if(error) { CFStreamError err = CFWriteStreamGetError(theWriteStream); [self closeWithError:[self errorFromCFStreamError:err]]; return; } else if (totalBytesWritten > 0) { // We're not done with the entire write, but we have written some bytes if ([theDelegate respondsToSelector:@selector(onSocket:didWritePartialDataOfLength:tag:)]) { [theDelegate onSocket:self didWritePartialDataOfLength:totalBytesWritten tag:theCurrentWrite->tag]; } } } // Ends current write and calls delegate. - (void)completeCurrentWrite { NSAssert(theCurrentWrite, @"Trying to complete current write when there is no current write."); if ([theDelegate respondsToSelector:@selector(onSocket:didWriteDataWithTag:)]) { [theDelegate onSocket:self didWriteDataWithTag:theCurrentWrite->tag]; } if (theCurrentWrite != nil) [self endCurrentWrite]; // Caller may have disconnected. } // Ends current write. - (void)endCurrentWrite { NSAssert(theCurrentWrite, @"Trying to complete current write when there is no current write."); [theWriteTimer invalidate]; theWriteTimer = nil; theCurrentWrite = nil; } - (void)doWriteTimeout:(NSTimer *)timer { #pragma unused(timer) NSTimeInterval timeoutExtension = 0.0; if([theDelegate respondsToSelector:@selector(onSocket:shouldTimeoutWriteWithTag:elapsed:bytesDone:)]) { timeoutExtension = [theDelegate onSocket:self shouldTimeoutWriteWithTag:theCurrentWrite->tag elapsed:theCurrentWrite->timeout bytesDone:theCurrentWrite->bytesDone]; } if(timeoutExtension > 0.0) { theCurrentWrite->timeout += timeoutExtension; theWriteTimer = [NSTimer timerWithTimeInterval:timeoutExtension target:self selector:@selector(doWriteTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theWriteTimer]; } else { [self closeWithError:[self getWriteTimeoutError]]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Security //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)startTLS:(NSDictionary *)tlsSettings { #if DEBUG_THREAD_SAFETY [self checkForThreadSafety]; #endif if(tlsSettings == nil) { // Passing nil/NULL to CFReadStreamSetProperty will appear to work the same as passing an empty dictionary, // but causes problems if we later try to fetch the remote host's certificate. // // To be exact, it causes the following to return NULL instead of the normal result: // CFReadStreamCopyProperty(readStream, kCFStreamPropertySSLPeerCertificates) // // So we use an empty dictionary instead, which works perfectly. tlsSettings = [NSDictionary dictionary]; } AsyncSpecialPacket *packet = [[AsyncSpecialPacket alloc] initWithTLSSettings:tlsSettings]; [theReadQueue addObject:packet]; [self scheduleDequeueRead]; [theWriteQueue addObject:packet]; [self scheduleDequeueWrite]; } - (void)maybeStartTLS { // We can't start TLS until: // - All queued reads prior to the user calling StartTLS are complete // - All queued writes prior to the user calling StartTLS are complete // // We'll know these conditions are met when both kStartingReadTLS and kStartingWriteTLS are set if((theFlags & kStartingReadTLS) && (theFlags & kStartingWriteTLS)) { AsyncSpecialPacket *tlsPacket = (AsyncSpecialPacket *)theCurrentRead; BOOL didStartOnReadStream = CFReadStreamSetProperty(theReadStream, kCFStreamPropertySSLSettings, (__bridge CFDictionaryRef)tlsPacket->tlsSettings); BOOL didStartOnWriteStream = CFWriteStreamSetProperty(theWriteStream, kCFStreamPropertySSLSettings, (__bridge CFDictionaryRef)tlsPacket->tlsSettings); if(!didStartOnReadStream || !didStartOnWriteStream) { [self closeWithError:[self getSocketError]]; } } } - (void)onTLSHandshakeSuccessful { if((theFlags & kStartingReadTLS) && (theFlags & kStartingWriteTLS)) { theFlags &= ~kStartingReadTLS; theFlags &= ~kStartingWriteTLS; if([theDelegate respondsToSelector:@selector(onSocketDidSecure:)]) { [theDelegate onSocketDidSecure:self]; } [self endCurrentRead]; [self endCurrentWrite]; [self scheduleDequeueRead]; [self scheduleDequeueWrite]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark CF Callbacks //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)doCFSocketCallback:(CFSocketCallBackType)type forSocket:(CFSocketRef)sock withAddress:(NSData *)address withData:(const void *)pData { #pragma unused(address) NSParameterAssert ((sock == theSocket4) || (sock == theSocket6)); switch (type) { case kCFSocketConnectCallBack: // The data argument is either NULL or a pointer to an SInt32 error code, if the connect failed. if(pData) [self doSocketOpen:sock withCFSocketError:kCFSocketError]; else [self doSocketOpen:sock withCFSocketError:kCFSocketSuccess]; break; case kCFSocketAcceptCallBack: [self doAcceptFromSocket:sock withNewNativeSocket:*((CFSocketNativeHandle *)pData)]; break; default: NSLog(@"AsyncSocket %p received unexpected CFSocketCallBackType %i", self, (int)type); break; } } - (void)doCFReadStreamCallback:(CFStreamEventType)type forStream:(CFReadStreamRef)stream { #pragma unused(stream) NSParameterAssert(theReadStream != NULL); CFStreamError err; switch (type) { case kCFStreamEventOpenCompleted: theFlags |= kDidCompleteOpenForRead; [self doStreamOpen]; break; case kCFStreamEventHasBytesAvailable: if(theFlags & kStartingReadTLS) { [self onTLSHandshakeSuccessful]; } else { theFlags |= kSocketHasBytesAvailable; [self doBytesAvailable]; } break; case kCFStreamEventErrorOccurred: case kCFStreamEventEndEncountered: err = CFReadStreamGetError (theReadStream); [self closeWithError: [self errorFromCFStreamError:err]]; break; default: NSLog(@"AsyncSocket %p received unexpected CFReadStream callback, CFStreamEventType %i", self, (int)type); } } - (void)doCFWriteStreamCallback:(CFStreamEventType)type forStream:(CFWriteStreamRef)stream { #pragma unused(stream) NSParameterAssert(theWriteStream != NULL); CFStreamError err; switch (type) { case kCFStreamEventOpenCompleted: theFlags |= kDidCompleteOpenForWrite; [self doStreamOpen]; break; case kCFStreamEventCanAcceptBytes: if(theFlags & kStartingWriteTLS) { [self onTLSHandshakeSuccessful]; } else { theFlags |= kSocketCanAcceptBytes; [self doSendBytes]; } break; case kCFStreamEventErrorOccurred: case kCFStreamEventEndEncountered: err = CFWriteStreamGetError (theWriteStream); [self closeWithError: [self errorFromCFStreamError:err]]; break; default: NSLog(@"AsyncSocket %p received unexpected CFWriteStream callback, CFStreamEventType %i", self, (int)type); } } /** * This is the callback we setup for CFSocket. * This method does nothing but forward the call to it's Objective-C counterpart **/ static void MyCFSocketCallback (CFSocketRef sref, CFSocketCallBackType type, CFDataRef inAddress, const void *pData, void *pInfo) { @autoreleasepool { AsyncSocket *theSocket = (__bridge AsyncSocket *)pInfo; NSData *address = [(__bridge NSData *)inAddress copy]; [theSocket doCFSocketCallback:type forSocket:sref withAddress:address withData:pData]; } } /** * This is the callback we setup for CFReadStream. * This method does nothing but forward the call to it's Objective-C counterpart **/ static void MyCFReadStreamCallback (CFReadStreamRef stream, CFStreamEventType type, void *pInfo) { @autoreleasepool { AsyncSocket *theSocket = (__bridge AsyncSocket *)pInfo; [theSocket doCFReadStreamCallback:type forStream:stream]; } } /** * This is the callback we setup for CFWriteStream. * This method does nothing but forward the call to it's Objective-C counterpart **/ static void MyCFWriteStreamCallback (CFWriteStreamRef stream, CFStreamEventType type, void *pInfo) { @autoreleasepool { AsyncSocket *theSocket = (__bridge AsyncSocket *)pInfo; [theSocket doCFWriteStreamCallback:type forStream:stream]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Class Methods //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// // Return line separators. + (NSData *)CRLFData { return [NSData dataWithBytes:"\x0D\x0A" length:2]; } + (NSData *)CRData { return [NSData dataWithBytes:"\x0D" length:1]; } + (NSData *)LFData { return [NSData dataWithBytes:"\x0A" length:1]; } + (NSData *)ZeroData { return [NSData dataWithBytes:"" length:1]; } @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/AsyncUdpSocket.h ================================================ // // AsyncUdpSocket.h // // This class is in the public domain. // Originally created by Robbie Hanson on Wed Oct 01 2008. // Updated and maintained by Deusty Designs and the Mac development community. // // http://code.google.com/p/cocoaasyncsocket/ // #import @class AsyncSendPacket; @class AsyncReceivePacket; extern NSString *const AsyncUdpSocketException; extern NSString *const AsyncUdpSocketErrorDomain; typedef NS_ENUM(NSInteger, AsyncUdpSocketError) { AsyncUdpSocketCFSocketError = kCFSocketError, // From CFSocketError enum AsyncUdpSocketNoError = 0, // Never used AsyncUdpSocketBadParameter, // Used if given a bad parameter (such as an improper address) AsyncUdpSocketIPv4Unavailable, // Used if you bind/connect using IPv6 only AsyncUdpSocketIPv6Unavailable, // Used if you bind/connect using IPv4 only (or iPhone) AsyncUdpSocketSendTimeoutError, AsyncUdpSocketReceiveTimeoutError }; @interface AsyncUdpSocket : NSObject { CFSocketRef theSocket4; // IPv4 socket CFSocketRef theSocket6; // IPv6 socket CFRunLoopSourceRef theSource4; // For theSocket4 CFRunLoopSourceRef theSource6; // For theSocket6 CFRunLoopRef theRunLoop; CFSocketContext theContext; NSArray *theRunLoopModes; NSMutableArray *theSendQueue; AsyncSendPacket *theCurrentSend; NSTimer *theSendTimer; NSMutableArray *theReceiveQueue; AsyncReceivePacket *theCurrentReceive; NSTimer *theReceiveTimer; id theDelegate; UInt16 theFlags; long theUserData; NSString *cachedLocalHost; UInt16 cachedLocalPort; NSString *cachedConnectedHost; UInt16 cachedConnectedPort; UInt32 maxReceiveBufferSize; } /** * Creates new instances of AsyncUdpSocket. **/ - (id)init; - (id)initWithDelegate:(id)delegate; - (id)initWithDelegate:(id)delegate userData:(long)userData; /** * Creates new instances of AsyncUdpSocket that support only IPv4 or IPv6. * The other init methods will support both, unless specifically binded or connected to one protocol. * If you know you'll only be using one protocol, these init methods may be a bit more efficient. **/ - (id)initIPv4; - (id)initIPv6; - (id)delegate; - (void)setDelegate:(id)delegate; - (long)userData; - (void)setUserData:(long)userData; /** * Returns the local address info for the socket. * * Note: Address info may not be available until after the socket has been bind'ed, * or until after data has been sent. **/ - (NSString *)localHost; - (UInt16)localPort; /** * Returns the remote address info for the socket. * * Note: Since UDP is connectionless by design, connected address info * will not be available unless the socket is explicitly connected to a remote host/port **/ - (NSString *)connectedHost; - (UInt16)connectedPort; /** * Returns whether or not this socket has been connected to a single host. * By design, UDP is a connectionless protocol, and connecting is not needed. * If connected, the socket will only be able to send/receive data to/from the connected host. **/ - (BOOL)isConnected; /** * Returns whether or not this socket has been closed. * The only way a socket can be closed is if you explicitly call one of the close methods. **/ - (BOOL)isClosed; /** * Returns whether or not this socket supports IPv4. * By default this will be true, unless the socket is specifically initialized as IPv6 only, * or is binded or connected to an IPv6 address. **/ - (BOOL)isIPv4; /** * Returns whether or not this socket supports IPv6. * By default this will be true, unless the socket is specifically initialized as IPv4 only, * or is binded or connected to an IPv4 address. * * This method will also return false on platforms that do not support IPv6. * Note: The iPhone does not currently support IPv6. **/ - (BOOL)isIPv6; /** * Returns the mtu of the socket. * If unknown, returns zero. * * Sending data larger than this may result in an error. * This is an advanced topic, and one should understand the wide range of mtu's on networks and the internet. * Therefore this method is only for reference and may be of little use in many situations. **/ - (unsigned int)maximumTransmissionUnit; /** * Binds the UDP socket to the given port and optional address. * Binding should be done for server sockets that receive data prior to sending it. * Client sockets can skip binding, * as the OS will automatically assign the socket an available port when it starts sending data. * * You cannot bind a socket after its been connected. * You can only bind a socket once. * You can still connect a socket (if desired) after binding. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)bindToPort:(UInt16)port error:(NSError **)errPtr; - (BOOL)bindToAddress:(NSString *)localAddr port:(UInt16)port error:(NSError **)errPtr; /** * Connects the UDP socket to the given host and port. * By design, UDP is a connectionless protocol, and connecting is not needed. * * Choosing to connect to a specific host/port has the following effect: * - You will only be able to send data to the connected host/port. * - You will only be able to receive data from the connected host/port. * - You will receive ICMP messages that come from the connected host/port, such as "connection refused". * * Connecting a UDP socket does not result in any communication on the socket. * It simply changes the internal state of the socket. * * You cannot bind a socket after its been connected. * You can only connect a socket once. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)connectToHost:(NSString *)host onPort:(UInt16)port error:(NSError **)errPtr; - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; /** * Join multicast group * * Group should be an IP address (eg @"225.228.0.1") **/ - (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr; - (BOOL)joinMulticastGroup:(NSString *)group withAddress:(NSString *)interface error:(NSError **)errPtr; /** * By default, the underlying socket in the OS will not allow you to send broadcast messages. * In order to send broadcast messages, you need to enable this functionality in the socket. * * A broadcast is a UDP message to addresses like "192.168.255.255" or "255.255.255.255" that is * delivered to every host on the network. * The reason this is generally disabled by default is to prevent * accidental broadcast messages from flooding the network. **/ - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr; /** * Asynchronously sends the given data, with the given timeout and tag. * * This method may only be used with a connected socket. * * If data is nil or zero-length, this method does nothing and immediately returns NO. * If the socket is not connected, this method does nothing and immediately returns NO. **/ - (BOOL)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Asynchronously sends the given data, with the given timeout and tag, to the given host and port. * * This method cannot be used with a connected socket. * * If data is nil or zero-length, this method does nothing and immediately returns NO. * If the socket is connected, this method does nothing and immediately returns NO. * If unable to resolve host to a valid IPv4 or IPv6 address, this method returns NO. **/ - (BOOL)sendData:(NSData *)data toHost:(NSString *)host port:(UInt16)port withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Asynchronously sends the given data, with the given timeout and tag, to the given address. * * This method cannot be used with a connected socket. * * If data is nil or zero-length, this method does nothing and immediately returns NO. * If the socket is connected, this method does nothing and immediately returns NO. **/ - (BOOL)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Asynchronously receives a single datagram packet. * * If the receive succeeds, the onUdpSocket:didReceiveData:fromHost:port:tag delegate method will be called. * Otherwise, a timeout will occur, and the onUdpSocket:didNotReceiveDataWithTag: delegate method will be called. **/ - (void)receiveWithTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Closes the socket immediately. Any pending send or receive operations are dropped. **/ - (void)close; /** * Closes after all pending send operations have completed. * After calling this, the sendData: and receive: methods will do nothing. * In other words, you won't be able to add any more send or receive operations to the queue. * The socket will close even if there are still pending receive operations. **/ - (void)closeAfterSending; /** * Closes after all pending receive operations have completed. * After calling this, the sendData: and receive: methods will do nothing. * In other words, you won't be able to add any more send or receive operations to the queue. * The socket will close even if there are still pending send operations. **/ - (void)closeAfterReceiving; /** * Closes after all pending send and receive operations have completed. * After calling this, the sendData: and receive: methods will do nothing. * In other words, you won't be able to add any more send or receive operations to the queue. **/ - (void)closeAfterSendingAndReceiving; /** * Gets/Sets the maximum size of the buffer that will be allocated for receive operations. * The default size is 9216 bytes. * * The theoretical maximum size of any IPv4 UDP packet is UINT16_MAX = 65535. * The theoretical maximum size of any IPv6 UDP packet is UINT32_MAX = 4294967295. * * In practice, however, the size of UDP packets will be much smaller. * Indeed most protocols will send and receive packets of only a few bytes, * or will set a limit on the size of packets to prevent fragmentation in the IP layer. * * If you set the buffer size too small, the sockets API in the OS will silently discard * any extra data, and you will not be notified of the error. **/ - (UInt32)maxReceiveBufferSize; - (void)setMaxReceiveBufferSize:(UInt32)max; /** * When you create an AsyncUdpSocket, it is added to the runloop of the current thread. * So it is easiest to simply create the socket on the thread you intend to use it. * * If, however, you need to move the socket to a separate thread at a later time, this * method may be used to accomplish the task. * * This method must be called from the thread/runloop the socket is currently running on. * * Note: After calling this method, all further method calls to this object should be done from the given runloop. * Also, all delegate calls will be sent on the given runloop. **/ - (BOOL)moveToRunLoop:(NSRunLoop *)runLoop; /** * Allows you to configure which run loop modes the socket uses. * The default set of run loop modes is NSDefaultRunLoopMode. * * If you'd like your socket to continue operation during other modes, you may want to add modes such as * NSModalPanelRunLoopMode or NSEventTrackingRunLoopMode. Or you may simply want to use NSRunLoopCommonModes. * * Note: NSRunLoopCommonModes is defined in 10.5. For previous versions one can use kCFRunLoopCommonModes. **/ - (BOOL)setRunLoopModes:(NSArray *)runLoopModes; /** * Returns the current run loop modes the AsyncSocket instance is operating in. * The default set of run loop modes is NSDefaultRunLoopMode. **/ - (NSArray *)runLoopModes; @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @protocol AsyncUdpSocketDelegate @optional /** * Called when the datagram with the given tag has been sent. **/ - (void)onUdpSocket:(AsyncUdpSocket *)sock didSendDataWithTag:(long)tag; /** * Called if an error occurs while trying to send a datagram. * This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet. **/ - (void)onUdpSocket:(AsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error; /** * Called when the socket has received the requested datagram. * * Due to the nature of UDP, you may occasionally receive undesired packets. * These may be rogue UDP packets from unknown hosts, * or they may be delayed packets arriving after retransmissions have already occurred. * It's important these packets are properly ignored, while not interfering with the flow of your implementation. * As an aid, this delegate method has a boolean return value. * If you ever need to ignore a received packet, simply return NO, * and AsyncUdpSocket will continue as if the packet never arrived. * That is, the original receive request will still be queued, and will still timeout as usual if a timeout was set. * For example, say you requested to receive data, and you set a timeout of 500 milliseconds, using a tag of 15. * If rogue data arrives after 250 milliseconds, this delegate method would be invoked, and you could simply return NO. * If the expected data then arrives within the next 250 milliseconds, * this delegate method will be invoked, with a tag of 15, just as if the rogue data never appeared. * * Under normal circumstances, you simply return YES from this method. **/ - (BOOL)onUdpSocket:(AsyncUdpSocket *)sock didReceiveData:(NSData *)data withTag:(long)tag fromHost:(NSString *)host port:(UInt16)port; /** * Called if an error occurs while trying to receive a requested datagram. * This is generally due to a timeout, but could potentially be something else if some kind of OS error occurred. **/ - (void)onUdpSocket:(AsyncUdpSocket *)sock didNotReceiveDataWithTag:(long)tag dueToError:(NSError *)error; /** * Called when the socket is closed. * A socket is only closed if you explicitly call one of the close methods. **/ - (void)onUdpSocketDidClose:(AsyncUdpSocket *)sock; @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/AsyncUdpSocket.m ================================================ // // AsyncUdpSocket.m // // This class is in the public domain. // Originally created by Robbie Hanson on Wed Oct 01 2008. // Updated and maintained by Deusty Designs and the Mac development community. // // http://code.google.com/p/cocoaasyncsocket/ // #if ! __has_feature(objc_arc) #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). #endif #import "AsyncUdpSocket.h" #import #import #import #import #import #import #import #if TARGET_OS_IPHONE // Note: You may need to add the CFNetwork Framework to your project #import #endif #define SENDQUEUE_CAPACITY 5 // Initial capacity #define RECEIVEQUEUE_CAPACITY 5 // Initial capacity #define DEFAULT_MAX_RECEIVE_BUFFER_SIZE 9216 NSString *const AsyncUdpSocketException = @"AsyncUdpSocketException"; NSString *const AsyncUdpSocketErrorDomain = @"AsyncUdpSocketErrorDomain"; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 // Mutex lock used by all instances of AsyncUdpSocket, to protect getaddrinfo. // Prior to Mac OS X 10.5 this method was not thread-safe. static NSString *getaddrinfoLock = @"lock"; #endif enum AsyncUdpSocketFlags { kDidBind = 1 << 0, // If set, bind has been called. kDidConnect = 1 << 1, // If set, connect has been called. kSock4CanAcceptBytes = 1 << 2, // If set, we know socket4 can accept bytes. If unset, it's unknown. kSock6CanAcceptBytes = 1 << 3, // If set, we know socket6 can accept bytes. If unset, it's unknown. kSock4HasBytesAvailable = 1 << 4, // If set, we know socket4 has bytes available. If unset, it's unknown. kSock6HasBytesAvailable = 1 << 5, // If set, we know socket6 has bytes available. If unset, it's unknown. kForbidSendReceive = 1 << 6, // If set, no new send or receive operations are allowed to be queued. kCloseAfterSends = 1 << 7, // If set, close as soon as no more sends are queued. kCloseAfterReceives = 1 << 8, // If set, close as soon as no more receives are queued. kDidClose = 1 << 9, // If set, the socket has been closed, and should not be used anymore. kDequeueSendScheduled = 1 << 10, // If set, a maybeDequeueSend operation is already scheduled. kDequeueReceiveScheduled = 1 << 11, // If set, a maybeDequeueReceive operation is already scheduled. kFlipFlop = 1 << 12, // Used to alternate between IPv4 and IPv6 sockets. }; @interface AsyncUdpSocket (Private) // Run Loop - (void)runLoopAddSource:(CFRunLoopSourceRef)source; - (void)runLoopRemoveSource:(CFRunLoopSourceRef)source; - (void)runLoopAddTimer:(NSTimer *)timer; - (void)runLoopRemoveTimer:(NSTimer *)timer; // Utilities - (NSString *)addressHost4:(struct sockaddr_in *)pSockaddr4; - (NSString *)addressHost6:(struct sockaddr_in6 *)pSockaddr6; - (NSString *)addressHost:(struct sockaddr *)pSockaddr; // Disconnect Implementation - (void)emptyQueues; - (void)closeSocket4; - (void)closeSocket6; - (void)maybeScheduleClose; // Errors - (NSError *)getErrnoError; - (NSError *)getSocketError; - (NSError *)getIPv4UnavailableError; - (NSError *)getIPv6UnavailableError; - (NSError *)getSendTimeoutError; - (NSError *)getReceiveTimeoutError; // Diagnostics - (NSString *)connectedHost:(CFSocketRef)socket; - (UInt16)connectedPort:(CFSocketRef)socket; - (NSString *)localHost:(CFSocketRef)socket; - (UInt16)localPort:(CFSocketRef)socket; // Sending - (BOOL)canAcceptBytes:(CFSocketRef)sockRef; - (void)scheduleDequeueSend; - (void)maybeDequeueSend; - (void)doSend:(CFSocketRef)sockRef; - (void)completeCurrentSend; - (void)failCurrentSend:(NSError *)error; - (void)endCurrentSend; - (void)doSendTimeout:(NSTimer *)timer; // Receiving - (BOOL)hasBytesAvailable:(CFSocketRef)sockRef; - (void)scheduleDequeueReceive; - (void)maybeDequeueReceive; - (void)doReceive4; - (void)doReceive6; - (void)doReceive:(CFSocketRef)sockRef; - (BOOL)maybeCompleteCurrentReceive; - (void)failCurrentReceive:(NSError *)error; - (void)endCurrentReceive; - (void)doReceiveTimeout:(NSTimer *)timer; @end static void MyCFSocketCallback(CFSocketRef, CFSocketCallBackType, CFDataRef, const void *, void *); //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The AsyncSendPacket encompasses the instructions for a single send/write. **/ @interface AsyncSendPacket : NSObject { @public NSData *buffer; NSData *address; NSTimeInterval timeout; long tag; } - (id)initWithData:(NSData *)d address:(NSData *)a timeout:(NSTimeInterval)t tag:(long)i; @end @implementation AsyncSendPacket - (id)initWithData:(NSData *)d address:(NSData *)a timeout:(NSTimeInterval)t tag:(long)i { if((self = [super init])) { buffer = d; address = a; timeout = t; tag = i; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The AsyncReceivePacket encompasses the instructions for a single receive/read. **/ @interface AsyncReceivePacket : NSObject { @public NSTimeInterval timeout; long tag; NSData *buffer; NSString *host; UInt16 port; } - (id)initWithTimeout:(NSTimeInterval)t tag:(long)i; @end @implementation AsyncReceivePacket - (id)initWithTimeout:(NSTimeInterval)t tag:(long)i { if((self = [super init])) { timeout = t; tag = i; buffer = nil; host = nil; port = 0; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @implementation AsyncUdpSocket - (id)initWithDelegate:(id)delegate userData:(long)userData enableIPv4:(BOOL)enableIPv4 enableIPv6:(BOOL)enableIPv6 { if((self = [super init])) { theFlags = 0; theDelegate = delegate; theUserData = userData; maxReceiveBufferSize = DEFAULT_MAX_RECEIVE_BUFFER_SIZE; theSendQueue = [[NSMutableArray alloc] initWithCapacity:SENDQUEUE_CAPACITY]; theCurrentSend = nil; theSendTimer = nil; theReceiveQueue = [[NSMutableArray alloc] initWithCapacity:RECEIVEQUEUE_CAPACITY]; theCurrentReceive = nil; theReceiveTimer = nil; // Socket context theContext.version = 0; theContext.info = (__bridge void *)self; theContext.retain = nil; theContext.release = nil; theContext.copyDescription = nil; // Create the sockets theSocket4 = NULL; theSocket6 = NULL; if(enableIPv4) { theSocket4 = CFSocketCreate(kCFAllocatorDefault, PF_INET, SOCK_DGRAM, IPPROTO_UDP, kCFSocketReadCallBack | kCFSocketWriteCallBack, (CFSocketCallBack)&MyCFSocketCallback, &theContext); } if(enableIPv6) { theSocket6 = CFSocketCreate(kCFAllocatorDefault, PF_INET6, SOCK_DGRAM, IPPROTO_UDP, kCFSocketReadCallBack | kCFSocketWriteCallBack, (CFSocketCallBack)&MyCFSocketCallback, &theContext); } // Disable continuous callbacks for read and write. // If we don't do this, the socket(s) will just sit there firing read callbacks // at us hundreds of times a second if we don't immediately read the available data. if(theSocket4) { CFSocketSetSocketFlags(theSocket4, kCFSocketCloseOnInvalidate); } if(theSocket6) { CFSocketSetSocketFlags(theSocket6, kCFSocketCloseOnInvalidate); } // Prevent sendto calls from sending SIGPIPE signal when socket has been shutdown for writing. // sendto will instead let us handle errors as usual by returning -1. int noSigPipe = 1; if(theSocket4) { setsockopt(CFSocketGetNative(theSocket4), SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(noSigPipe)); } if(theSocket6) { setsockopt(CFSocketGetNative(theSocket6), SOL_SOCKET, SO_NOSIGPIPE, &noSigPipe, sizeof(noSigPipe)); } // Get the CFRunLoop to which the socket should be attached. theRunLoop = CFRunLoopGetCurrent(); // Set default run loop modes theRunLoopModes = [NSArray arrayWithObject:NSDefaultRunLoopMode]; // Attach the sockets to the run loop if(theSocket4) { theSource4 = CFSocketCreateRunLoopSource(kCFAllocatorDefault, theSocket4, 0); [self runLoopAddSource:theSource4]; } if(theSocket6) { theSource6 = CFSocketCreateRunLoopSource(kCFAllocatorDefault, theSocket6, 0); [self runLoopAddSource:theSource6]; } cachedLocalPort = 0; cachedConnectedPort = 0; } return self; } - (id)init { return [self initWithDelegate:nil userData:0 enableIPv4:YES enableIPv6:YES]; } - (id)initWithDelegate:(id)delegate { return [self initWithDelegate:delegate userData:0 enableIPv4:YES enableIPv6:YES]; } - (id)initWithDelegate:(id)delegate userData:(long)userData { return [self initWithDelegate:delegate userData:userData enableIPv4:YES enableIPv6:YES]; } - (id)initIPv4 { return [self initWithDelegate:nil userData:0 enableIPv4:YES enableIPv6:NO]; } - (id)initIPv6 { return [self initWithDelegate:nil userData:0 enableIPv4:NO enableIPv6:YES]; } - (void) dealloc { [self close]; [NSObject cancelPreviousPerformRequestsWithTarget:theDelegate selector:@selector(onUdpSocketDidClose:) object:self]; [NSObject cancelPreviousPerformRequestsWithTarget:self]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Accessors //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (id)delegate { return theDelegate; } - (void)setDelegate:(id)delegate { theDelegate = delegate; } - (long)userData { return theUserData; } - (void)setUserData:(long)userData { theUserData = userData; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Run Loop //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)runLoopAddSource:(CFRunLoopSourceRef)source { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopAddSource(theRunLoop, source, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopRemoveSource:(CFRunLoopSourceRef)source { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopRemoveSource(theRunLoop, source, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopAddTimer:(NSTimer *)timer { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopAddTimer(theRunLoop, (__bridge CFRunLoopTimerRef)timer, (__bridge CFStringRef)runLoopMode); } } - (void)runLoopRemoveTimer:(NSTimer *)timer { for (NSString *runLoopMode in theRunLoopModes) { CFRunLoopRemoveTimer(theRunLoop, (__bridge CFRunLoopTimerRef)timer, (__bridge CFStringRef)runLoopMode); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Configuration //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (UInt32)maxReceiveBufferSize { return maxReceiveBufferSize; } - (void)setMaxReceiveBufferSize:(UInt32)max { maxReceiveBufferSize = max; } /** * See the header file for a full explanation of this method. **/ - (BOOL)moveToRunLoop:(NSRunLoop *)runLoop { NSAssert((theRunLoop == NULL) || (theRunLoop == CFRunLoopGetCurrent()), @"moveToRunLoop must be called from within the current RunLoop!"); if(runLoop == nil) { return NO; } if(theRunLoop == [runLoop getCFRunLoop]) { return YES; } [NSObject cancelPreviousPerformRequestsWithTarget:self]; theFlags &= ~kDequeueSendScheduled; theFlags &= ~kDequeueReceiveScheduled; if(theSource4) [self runLoopRemoveSource:theSource4]; if(theSource6) [self runLoopRemoveSource:theSource6]; if(theSendTimer) [self runLoopRemoveTimer:theSendTimer]; if(theReceiveTimer) [self runLoopRemoveTimer:theReceiveTimer]; theRunLoop = [runLoop getCFRunLoop]; if(theSendTimer) [self runLoopAddTimer:theSendTimer]; if(theReceiveTimer) [self runLoopAddTimer:theReceiveTimer]; if(theSource4) [self runLoopAddSource:theSource4]; if(theSource6) [self runLoopAddSource:theSource6]; [runLoop performSelector:@selector(maybeDequeueSend) target:self argument:nil order:0 modes:theRunLoopModes]; [runLoop performSelector:@selector(maybeDequeueReceive) target:self argument:nil order:0 modes:theRunLoopModes]; [runLoop performSelector:@selector(maybeScheduleClose) target:self argument:nil order:0 modes:theRunLoopModes]; return YES; } /** * See the header file for a full explanation of this method. **/ - (BOOL)setRunLoopModes:(NSArray *)runLoopModes { NSAssert((theRunLoop == NULL) || (theRunLoop == CFRunLoopGetCurrent()), @"setRunLoopModes must be called from within the current RunLoop!"); if([runLoopModes count] == 0) { return NO; } if([theRunLoopModes isEqualToArray:runLoopModes]) { return YES; } [NSObject cancelPreviousPerformRequestsWithTarget:self]; theFlags &= ~kDequeueSendScheduled; theFlags &= ~kDequeueReceiveScheduled; if(theSource4) [self runLoopRemoveSource:theSource4]; if(theSource6) [self runLoopRemoveSource:theSource6]; if(theSendTimer) [self runLoopRemoveTimer:theSendTimer]; if(theReceiveTimer) [self runLoopRemoveTimer:theReceiveTimer]; theRunLoopModes = [runLoopModes copy]; if(theSendTimer) [self runLoopAddTimer:theSendTimer]; if(theReceiveTimer) [self runLoopAddTimer:theReceiveTimer]; if(theSource4) [self runLoopAddSource:theSource4]; if(theSource6) [self runLoopAddSource:theSource6]; [self performSelector:@selector(maybeDequeueSend) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeDequeueReceive) withObject:nil afterDelay:0 inModes:theRunLoopModes]; [self performSelector:@selector(maybeScheduleClose) withObject:nil afterDelay:0 inModes:theRunLoopModes]; return YES; } - (NSArray *)runLoopModes { return [theRunLoopModes copy]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Utilities: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Attempts to convert the given host/port into and IPv4 and/or IPv6 data structure. * The data structure is of type sockaddr_in for IPv4 and sockaddr_in6 for IPv6. * * Returns zero on success, or one of the error codes listed in gai_strerror if an error occurs (as per getaddrinfo). **/ - (int)convertForBindHost:(NSString *)host port:(UInt16)port intoAddress4:(NSData **)address4 address6:(NSData **)address6 { if(host == nil || ([host length] == 0)) { // Use ANY address struct sockaddr_in nativeAddr; nativeAddr.sin_len = sizeof(struct sockaddr_in); nativeAddr.sin_family = AF_INET; nativeAddr.sin_port = htons(port); nativeAddr.sin_addr.s_addr = htonl(INADDR_ANY); memset(&(nativeAddr.sin_zero), 0, sizeof(nativeAddr.sin_zero)); struct sockaddr_in6 nativeAddr6; nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); nativeAddr6.sin6_family = AF_INET6; nativeAddr6.sin6_port = htons(port); nativeAddr6.sin6_flowinfo = 0; nativeAddr6.sin6_addr = in6addr_any; nativeAddr6.sin6_scope_id = 0; // Wrap the native address structures for CFSocketSetAddress. if(address4) *address4 = [NSData dataWithBytes:&nativeAddr length:sizeof(nativeAddr)]; if(address6) *address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; return 0; } else if([host isEqualToString:@"localhost"] || [host isEqualToString:@"loopback"]) { // Note: getaddrinfo("localhost",...) fails on 10.5.3 // Use LOOPBACK address struct sockaddr_in nativeAddr; nativeAddr.sin_len = sizeof(struct sockaddr_in); nativeAddr.sin_family = AF_INET; nativeAddr.sin_port = htons(port); nativeAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); memset(&(nativeAddr.sin_zero), 0, sizeof(nativeAddr.sin_zero)); struct sockaddr_in6 nativeAddr6; nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); nativeAddr6.sin6_family = AF_INET6; nativeAddr6.sin6_port = htons(port); nativeAddr6.sin6_flowinfo = 0; nativeAddr6.sin6_addr = in6addr_loopback; nativeAddr6.sin6_scope_id = 0; // Wrap the native address structures for CFSocketSetAddress. if(address4) *address4 = [NSData dataWithBytes:&nativeAddr length:sizeof(nativeAddr)]; if(address6) *address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; return 0; } else { NSString *portStr = [NSString stringWithFormat:@"%hu", port]; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 @synchronized (getaddrinfoLock) #endif { struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_PASSIVE; int error = getaddrinfo([host UTF8String], [portStr UTF8String], &hints, &res0); if(error) return error; for(res = res0; res; res = res->ai_next) { if(address4 && !*address4 && (res->ai_family == AF_INET)) { // Found IPv4 address // Wrap the native address structures for CFSocketSetAddress. if(address4) *address4 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } else if(address6 && !*address6 && (res->ai_family == AF_INET6)) { // Found IPv6 address // Wrap the native address structures for CFSocketSetAddress. if(address6) *address6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } } freeaddrinfo(res0); } return 0; } } /** * Attempts to convert the given host/port into and IPv4 and/or IPv6 data structure. * The data structure is of type sockaddr_in for IPv4 and sockaddr_in6 for IPv6. * * Returns zero on success, or one of the error codes listed in gai_strerror if an error occurs (as per getaddrinfo). **/ - (int)convertForSendHost:(NSString *)host port:(UInt16)port intoAddress4:(NSData **)address4 address6:(NSData **)address6 { if(host == nil || ([host length] == 0)) { // We're not binding, so what are we supposed to do with this? return EAI_NONAME; } else if([host isEqualToString:@"localhost"] || [host isEqualToString:@"loopback"]) { // Note: getaddrinfo("localhost",...) fails on 10.5.3 // Use LOOPBACK address struct sockaddr_in nativeAddr; nativeAddr.sin_len = sizeof(struct sockaddr_in); nativeAddr.sin_family = AF_INET; nativeAddr.sin_port = htons(port); nativeAddr.sin_addr.s_addr = htonl(INADDR_LOOPBACK); memset(&(nativeAddr.sin_zero), 0, sizeof(nativeAddr.sin_zero)); struct sockaddr_in6 nativeAddr6; nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); nativeAddr6.sin6_family = AF_INET6; nativeAddr6.sin6_port = htons(port); nativeAddr6.sin6_flowinfo = 0; nativeAddr6.sin6_addr = in6addr_loopback; nativeAddr6.sin6_scope_id = 0; // Wrap the native address structures for CFSocketSetAddress. if(address4) *address4 = [NSData dataWithBytes:&nativeAddr length:sizeof(nativeAddr)]; if(address6) *address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; return 0; } else { NSString *portStr = [NSString stringWithFormat:@"%hu", port]; #if MAC_OS_X_VERSION_MIN_REQUIRED < MAC_OS_X_VERSION_10_5 @synchronized (getaddrinfoLock) #endif { struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; // No passive flag on a send or connect int error = getaddrinfo([host UTF8String], [portStr UTF8String], &hints, &res0); if(error) return error; for(res = res0; res; res = res->ai_next) { if(address4 && !*address4 && (res->ai_family == AF_INET)) { // Found IPv4 address // Wrap the native address structures for CFSocketSetAddress. if(address4) *address4 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } else if(address6 && !*address6 && (res->ai_family == AF_INET6)) { // Found IPv6 address // Wrap the native address structures for CFSocketSetAddress. if(address6) *address6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } } freeaddrinfo(res0); } return 0; } } - (NSString *)addressHost4:(struct sockaddr_in *)pSockaddr4 { char addrBuf[INET_ADDRSTRLEN]; if(inet_ntop(AF_INET, &pSockaddr4->sin_addr, addrBuf, sizeof(addrBuf)) == NULL) { [NSException raise:NSInternalInconsistencyException format:@"Cannot convert address to string."]; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } - (NSString *)addressHost6:(struct sockaddr_in6 *)pSockaddr6 { char addrBuf[INET6_ADDRSTRLEN]; if(inet_ntop(AF_INET6, &pSockaddr6->sin6_addr, addrBuf, sizeof(addrBuf)) == NULL) { [NSException raise:NSInternalInconsistencyException format:@"Cannot convert address to string."]; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } - (NSString *)addressHost:(struct sockaddr *)pSockaddr { if(pSockaddr->sa_family == AF_INET) { return [self addressHost4:(struct sockaddr_in *)pSockaddr]; } else { return [self addressHost6:(struct sockaddr_in6 *)pSockaddr]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Socket Implementation: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Binds the underlying socket(s) to the given port. * The socket(s) will be able to receive data on any interface. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)bindToPort:(UInt16)port error:(NSError **)errPtr { return [self bindToAddress:nil port:port error:errPtr]; } /** * Binds the underlying socket(s) to the given address and port. * The sockets(s) will be able to receive data only on the given interface. * * To receive data on any interface, pass nil or "". * To receive data only on the loopback interface, pass "localhost" or "loopback". * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)bindToAddress:(NSString *)host port:(UInt16)port error:(NSError **)errPtr { if(theFlags & kDidClose) { [NSException raise:AsyncUdpSocketException format:@"The socket is closed."]; } if(theFlags & kDidBind) { [NSException raise:AsyncUdpSocketException format:@"Cannot bind a socket more than once."]; } if(theFlags & kDidConnect) { [NSException raise:AsyncUdpSocketException format:@"Cannot bind after connecting. If needed, bind first, then connect."]; } // Convert the given host/port into native address structures for CFSocketSetAddress NSData *address4 = nil, *address6 = nil; int gai_error = [self convertForBindHost:host port:port intoAddress4:&address4 address6:&address6]; if(gai_error) { if(errPtr) { NSString *errMsg = [NSString stringWithCString:gai_strerror(gai_error) encoding:NSASCIIStringEncoding]; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:gai_error userInfo:info]; } return NO; } NSAssert((address4 || address6), @"address4 and address6 are nil"); // Set the SO_REUSEADDR flags int reuseOn = 1; if (theSocket4) setsockopt(CFSocketGetNative(theSocket4), SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); if (theSocket6) setsockopt(CFSocketGetNative(theSocket6), SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); // Bind the sockets if(address4) { if(theSocket4) { CFSocketError error = CFSocketSetAddress(theSocket4, (__bridge CFDataRef)address4); if(error != kCFSocketSuccess) { if(errPtr) *errPtr = [self getSocketError]; return NO; } if(!address6) { // Using IPv4 only [self closeSocket6]; } } else if(!address6) { if(errPtr) *errPtr = [self getIPv4UnavailableError]; return NO; } } if(address6) { // Note: The iPhone doesn't currently support IPv6 if(theSocket6) { CFSocketError error = CFSocketSetAddress(theSocket6, (__bridge CFDataRef)address6); if(error != kCFSocketSuccess) { if(errPtr) *errPtr = [self getSocketError]; return NO; } if(!address4) { // Using IPv6 only [self closeSocket4]; } } else if(!address4) { if(errPtr) *errPtr = [self getIPv6UnavailableError]; return NO; } } theFlags |= kDidBind; return YES; } /** * Connects the underlying UDP socket to the given host and port. * If an IPv4 address is resolved, the IPv4 socket is connected, and the IPv6 socket is invalidated and released. * If an IPv6 address is resolved, the IPv6 socket is connected, and the IPv4 socket is invalidated and released. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)connectToHost:(NSString *)host onPort:(UInt16)port error:(NSError **)errPtr { if(theFlags & kDidClose) { [NSException raise:AsyncUdpSocketException format:@"The socket is closed."]; } if(theFlags & kDidConnect) { [NSException raise:AsyncUdpSocketException format:@"Cannot connect a socket more than once."]; } // Convert the given host/port into native address structures for CFSocketSetAddress NSData *address4 = nil, *address6 = nil; int error = [self convertForSendHost:host port:port intoAddress4:&address4 address6:&address6]; if(error) { if(errPtr) { NSString *errMsg = [NSString stringWithCString:gai_strerror(error) encoding:NSASCIIStringEncoding]; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:error userInfo:info]; } return NO; } NSAssert((address4 || address6), @"address4 and address6 are nil"); // We only want to connect via a single interface. // IPv4 is currently preferred, but this may change in the future. CFSocketError sockErr; if (address4) { if (theSocket4) { sockErr = CFSocketConnectToAddress(theSocket4, (__bridge CFDataRef)address4, (CFTimeInterval)0.0); if (sockErr != kCFSocketSuccess) { if(errPtr) *errPtr = [self getSocketError]; return NO; } theFlags |= kDidConnect; // We're connected to an IPv4 address, so no need for the IPv6 socket [self closeSocket6]; return YES; } else if(!address6) { if(errPtr) *errPtr = [self getIPv4UnavailableError]; return NO; } } if (address6) { // Note: The iPhone doesn't currently support IPv6 if (theSocket6) { sockErr = CFSocketConnectToAddress(theSocket6, (__bridge CFDataRef)address6, (CFTimeInterval)0.0); if (sockErr != kCFSocketSuccess) { if(errPtr) *errPtr = [self getSocketError]; return NO; } theFlags |= kDidConnect; // We're connected to an IPv6 address, so no need for the IPv4 socket [self closeSocket4]; return YES; } else { if(errPtr) *errPtr = [self getIPv6UnavailableError]; return NO; } } // It shouldn't be possible to get to this point because either address4 or address6 was non-nil. if(errPtr) *errPtr = nil; return NO; } /** * Connects the underlying UDP socket to the remote address. * If the address is an IPv4 address, the IPv4 socket is connected, and the IPv6 socket is invalidated and released. * If the address is an IPv6 address, the IPv6 socket is connected, and the IPv4 socket is invalidated and released. * * The address is a native address structure, as may be returned from API's such as Bonjour. * An address may be created manually by simply wrapping a sockaddr_in or sockaddr_in6 in an NSData object. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr { if (theFlags & kDidClose) { [NSException raise:AsyncUdpSocketException format:@"The socket is closed."]; } if (theFlags & kDidConnect) { [NSException raise:AsyncUdpSocketException format:@"Cannot connect a socket more than once."]; } CFSocketError sockErr; // Is remoteAddr an IPv4 address? if ([remoteAddr length] == sizeof(struct sockaddr_in)) { if (theSocket4) { sockErr = CFSocketConnectToAddress(theSocket4, (__bridge CFDataRef)remoteAddr, (CFTimeInterval)0.0); if (sockErr != kCFSocketSuccess) { if(errPtr) *errPtr = [self getSocketError]; return NO; } theFlags |= kDidConnect; // We're connected to an IPv4 address, so no need for the IPv6 socket [self closeSocket6]; return YES; } else { if(errPtr) *errPtr = [self getIPv4UnavailableError]; return NO; } } // Is remoteAddr an IPv6 address? if ([remoteAddr length] == sizeof(struct sockaddr_in6)) { if (theSocket6) { sockErr = CFSocketConnectToAddress(theSocket6, (__bridge CFDataRef)remoteAddr, (CFTimeInterval)0.0); if (sockErr != kCFSocketSuccess) { if(errPtr) *errPtr = [self getSocketError]; return NO; } theFlags |= kDidConnect; // We're connected to an IPv6 address, so no need for the IPv4 socket [self closeSocket4]; return YES; } else { if(errPtr) *errPtr = [self getIPv6UnavailableError]; return NO; } } // The remoteAddr was invalid if(errPtr) { NSString *errMsg = @"remoteAddr parameter is not a valid address"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketBadParameter userInfo:info]; } return NO; } /** * Join multicast group * * Group should be a multicast IP address (eg. @"239.255.250.250" for IPv4). * Address is local interface for IPv4, but currently defaults under IPv6. **/ - (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr { return [self joinMulticastGroup:group withAddress:nil error:errPtr]; } - (BOOL)joinMulticastGroup:(NSString *)group withAddress:(NSString *)address error:(NSError **)errPtr { if(theFlags & kDidClose) { [NSException raise:AsyncUdpSocketException format:@"The socket is closed."]; } if(!(theFlags & kDidBind)) { [NSException raise:AsyncUdpSocketException format:@"Must bind a socket before joining a multicast group."]; } if(theFlags & kDidConnect) { [NSException raise:AsyncUdpSocketException format:@"Cannot join a multicast group if connected."]; } // Get local interface address // Convert the given host/port into native address structures for CFSocketSetAddress NSData *address4 = nil, *address6 = nil; int error = [self convertForBindHost:address port:0 intoAddress4:&address4 address6:&address6]; if(error) { if(errPtr) { NSString *errMsg = [NSString stringWithCString:gai_strerror(error) encoding:NSASCIIStringEncoding]; NSString *errDsc = [NSString stringWithFormat:@"Invalid parameter 'address': %@", errMsg]; NSDictionary *info = [NSDictionary dictionaryWithObject:errDsc forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:error userInfo:info]; } return NO; } NSAssert((address4 || address6), @"address4 and address6 are nil"); // Get multicast address (group) NSData *group4 = nil, *group6 = nil; error = [self convertForBindHost:group port:0 intoAddress4:&group4 address6:&group6]; if(error) { if(errPtr) { NSString *errMsg = [NSString stringWithCString:gai_strerror(error) encoding:NSASCIIStringEncoding]; NSString *errDsc = [NSString stringWithFormat:@"Invalid parameter 'group': %@", errMsg]; NSDictionary *info = [NSDictionary dictionaryWithObject:errDsc forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:error userInfo:info]; } return NO; } NSAssert((group4 || group6), @"group4 and group6 are nil"); if(theSocket4 && group4 && address4) { const struct sockaddr_in* nativeAddress = [address4 bytes]; const struct sockaddr_in* nativeGroup = [group4 bytes]; struct ip_mreq imreq; imreq.imr_multiaddr = nativeGroup->sin_addr; imreq.imr_interface = nativeAddress->sin_addr; // JOIN multicast group on default interface error = setsockopt(CFSocketGetNative(theSocket4), IPPROTO_IP, IP_ADD_MEMBERSHIP, (const void *)&imreq, sizeof(struct ip_mreq)); if(error) { if(errPtr) { NSString *errMsg = @"Unable to join IPv4 multicast group"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainPOSIX" code:error userInfo:info]; } return NO; } // Using IPv4 only [self closeSocket6]; return YES; } if(theSocket6 && group6 && address6) { const struct sockaddr_in6* nativeGroup = [group6 bytes]; struct ipv6_mreq imreq; imreq.ipv6mr_multiaddr = nativeGroup->sin6_addr; imreq.ipv6mr_interface = 0; // JOIN multicast group on default interface error = setsockopt(CFSocketGetNative(theSocket6), IPPROTO_IP, IPV6_JOIN_GROUP, (const void *)&imreq, sizeof(struct ipv6_mreq)); if(error) { if(errPtr) { NSString *errMsg = @"Unable to join IPv6 multicast group"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainPOSIX" code:error userInfo:info]; } return NO; } // Using IPv6 only [self closeSocket4]; return YES; } // The given address and group didn't match the existing socket(s). // This means there were no compatible combination of all IPv4 or IPv6 socket, group and address. if(errPtr) { NSString *errMsg = @"Invalid group and/or address, not matching existing socket(s)"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketBadParameter userInfo:info]; } return NO; } /** * By default, the underlying socket in the OS will not allow you to send broadcast messages. * In order to send broadcast messages, you need to enable this functionality in the socket. * * A broadcast is a UDP message to addresses like "192.168.255.255" or "255.255.255.255" that is * delivered to every host on the network. * The reason this is generally disabled by default is to prevent * accidental broadcast messages from flooding the network. **/ - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr { if (theSocket4) { int value = flag ? 1 : 0; int error = setsockopt(CFSocketGetNative(theSocket4), SOL_SOCKET, SO_BROADCAST, (const void *)&value, sizeof(value)); if(error) { if(errPtr) { NSString *errMsg = @"Unable to enable broadcast message sending"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; *errPtr = [NSError errorWithDomain:@"kCFStreamErrorDomainPOSIX" code:error userInfo:info]; } return NO; } } // IPv6 does not implement broadcast, the ability to send a packet to all hosts on the attached link. // The same effect can be achieved by sending a packet to the link-local all hosts multicast group. return YES; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Disconnect Implementation: //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)emptyQueues { if (theCurrentSend) [self endCurrentSend]; if (theCurrentReceive) [self endCurrentReceive]; [theSendQueue removeAllObjects]; [theReceiveQueue removeAllObjects]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(maybeDequeueSend) object:nil]; [NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(maybeDequeueReceive) object:nil]; theFlags &= ~kDequeueSendScheduled; theFlags &= ~kDequeueReceiveScheduled; } - (void)closeSocket4 { if (theSocket4 != NULL) { CFSocketInvalidate(theSocket4); CFRelease(theSocket4); theSocket4 = NULL; } if (theSource4 != NULL) { [self runLoopRemoveSource:theSource4]; CFRelease(theSource4); theSource4 = NULL; } } - (void)closeSocket6 { if (theSocket6 != NULL) { CFSocketInvalidate(theSocket6); CFRelease(theSocket6); theSocket6 = NULL; } if (theSource6 != NULL) { [self runLoopRemoveSource:theSource6]; CFRelease(theSource6); theSource6 = NULL; } } - (void)close { [self emptyQueues]; [self closeSocket4]; [self closeSocket6]; theRunLoop = NULL; // Delay notification to give user freedom to release without returning here and core-dumping. if ([theDelegate respondsToSelector:@selector(onUdpSocketDidClose:)]) { [theDelegate performSelector:@selector(onUdpSocketDidClose:) withObject:self afterDelay:0 inModes:theRunLoopModes]; } theFlags |= kDidClose; } - (void)closeAfterSending { if(theFlags & kDidClose) return; theFlags |= (kForbidSendReceive | kCloseAfterSends); [self maybeScheduleClose]; } - (void)closeAfterReceiving { if(theFlags & kDidClose) return; theFlags |= (kForbidSendReceive | kCloseAfterReceives); [self maybeScheduleClose]; } - (void)closeAfterSendingAndReceiving { if(theFlags & kDidClose) return; theFlags |= (kForbidSendReceive | kCloseAfterSends | kCloseAfterReceives); [self maybeScheduleClose]; } - (void)maybeScheduleClose { BOOL shouldDisconnect = NO; if(theFlags & kCloseAfterSends) { if(([theSendQueue count] == 0) && (theCurrentSend == nil)) { if(theFlags & kCloseAfterReceives) { if(([theReceiveQueue count] == 0) && (theCurrentReceive == nil)) { shouldDisconnect = YES; } } else { shouldDisconnect = YES; } } } else if(theFlags & kCloseAfterReceives) { if(([theReceiveQueue count] == 0) && (theCurrentReceive == nil)) { shouldDisconnect = YES; } } if(shouldDisconnect) { [self performSelector:@selector(close) withObject:nil afterDelay:0 inModes:theRunLoopModes]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Errors //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Returns a standard error object for the current errno value. * Errno is used for low-level BSD socket errors. **/ - (NSError *)getErrnoError { NSString *errorMsg = [NSString stringWithUTF8String:strerror(errno)]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errorMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } /** * Returns a standard error message for a CFSocket error. * Unfortunately, CFSocket offers no feedback on its errors. **/ - (NSError *)getSocketError { NSString *errMsg = @"General CFSocket error"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketCFSocketError userInfo:info]; } - (NSError *)getIPv4UnavailableError { NSString *errMsg = @"IPv4 is unavailable due to binding/connecting using IPv6 only"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketIPv4Unavailable userInfo:info]; } - (NSError *)getIPv6UnavailableError { NSString *errMsg = @"IPv6 is unavailable due to binding/connecting using IPv4 only or is not supported on this platform"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketIPv6Unavailable userInfo:info]; } - (NSError *)getSendTimeoutError { NSString *errMsg = @"Send operation timed out"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketSendTimeoutError userInfo:info]; } - (NSError *)getReceiveTimeoutError { NSString *errMsg = @"Receive operation timed out"; NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:AsyncUdpSocketErrorDomain code:AsyncUdpSocketReceiveTimeoutError userInfo:info]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Diagnostics //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (NSString *)localHost { if(cachedLocalHost) return cachedLocalHost; if(theSocket4) return [self localHost:theSocket4]; else return [self localHost:theSocket6]; } - (UInt16)localPort { if(cachedLocalPort > 0) return cachedLocalPort; if(theSocket4) return [self localPort:theSocket4]; else return [self localPort:theSocket6]; } - (NSString *)connectedHost { if(cachedConnectedHost) return cachedConnectedHost; if(theSocket4) return [self connectedHost:theSocket4]; else return [self connectedHost:theSocket6]; } - (UInt16)connectedPort { if(cachedConnectedPort > 0) return cachedConnectedPort; if(theSocket4) return [self connectedPort:theSocket4]; else return [self connectedPort:theSocket6]; } - (NSString *)localHost:(CFSocketRef)theSocket { if (theSocket == NULL) return nil; // Unfortunately we can't use CFSocketCopyAddress. // The CFSocket library caches the address the first time you call CFSocketCopyAddress. // So if this is called prior to binding/connecting/sending, it won't be updated again when necessary, // and will continue to return the old value of the socket address. NSString *result = nil; if (theSocket == theSocket4) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getsockname(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return nil; } result = [self addressHost4:&sockaddr4]; } else { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getsockname(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return nil; } result = [self addressHost6:&sockaddr6]; } if (theFlags & kDidBind) { cachedLocalHost = [result copy]; } return result; } - (UInt16)localPort:(CFSocketRef)theSocket { if (theSocket == NULL) return 0; // Unfortunately we can't use CFSocketCopyAddress. // The CFSocket library caches the address the first time you call CFSocketCopyAddress. // So if this is called prior to binding/connecting/sending, it won't be updated again when necessary, // and will continue to return the old value of the socket address. UInt16 result = 0; if (theSocket == theSocket4) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getsockname(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return 0; } result = ntohs(sockaddr4.sin_port); } else { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getsockname(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return 0; } result = ntohs(sockaddr6.sin6_port); } if (theFlags & kDidBind) { cachedLocalPort = result; } return result; } - (NSString *)connectedHost:(CFSocketRef)theSocket { if (theSocket == NULL) return nil; // Unfortunately we can't use CFSocketCopyPeerAddress. // The CFSocket library caches the address the first time you call CFSocketCopyPeerAddress. // So if this is called prior to binding/connecting/sending, it may not be updated again when necessary, // and will continue to return the old value of the socket peer address. NSString *result = nil; if (theSocket == theSocket4) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getpeername(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return nil; } result = [self addressHost4:&sockaddr4]; } else { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getpeername(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return nil; } result = [self addressHost6:&sockaddr6]; } if (theFlags & kDidConnect) { cachedConnectedHost = [result copy]; } return result; } - (UInt16)connectedPort:(CFSocketRef)theSocket { if(theSocket == NULL) return 0; // Unfortunately we can't use CFSocketCopyPeerAddress. // The CFSocket library caches the address the first time you call CFSocketCopyPeerAddress. // So if this is called prior to binding/connecting/sending, it may not be updated again when necessary, // and will continue to return the old value of the socket peer address. UInt16 result = 0; if(theSocket == theSocket4) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if(getpeername(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return 0; } result = ntohs(sockaddr4.sin_port); } else { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if(getpeername(CFSocketGetNative(theSocket), (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return 0; } result = ntohs(sockaddr6.sin6_port); } if(theFlags & kDidConnect) { cachedConnectedPort = result; } return result; } - (BOOL)isConnected { return (((theFlags & kDidConnect) != 0) && ((theFlags & kDidClose) == 0)); } - (BOOL)isConnectedToHost:(NSString *)host port:(UInt16)port { return [[self connectedHost] isEqualToString:host] && ([self connectedPort] == port); } - (BOOL)isClosed { return (theFlags & kDidClose) ? YES : NO; } - (BOOL)isIPv4 { return (theSocket4 != NULL); } - (BOOL)isIPv6 { return (theSocket6 != NULL); } - (unsigned int)maximumTransmissionUnit { CFSocketNativeHandle theNativeSocket; if(theSocket4) theNativeSocket = CFSocketGetNative(theSocket4); else if(theSocket6) theNativeSocket = CFSocketGetNative(theSocket6); else return 0; if(theNativeSocket == 0) { return 0; } struct ifreq ifr; bzero(&ifr, sizeof(ifr)); if(if_indextoname(theNativeSocket, ifr.ifr_name) == NULL) { return 0; } if(ioctl(theNativeSocket, SIOCGIFMTU, &ifr) >= 0) { return ifr.ifr_mtu; } return 0; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Sending //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag { if([data length] == 0) return NO; if(theFlags & kForbidSendReceive) return NO; if(theFlags & kDidClose) return NO; // This method is only for connected sockets if(![self isConnected]) return NO; AsyncSendPacket *packet = [[AsyncSendPacket alloc] initWithData:data address:nil timeout:timeout tag:tag]; [theSendQueue addObject:packet]; [self scheduleDequeueSend]; return YES; } - (BOOL)sendData:(NSData *)data toHost:(NSString *)host port:(UInt16)port withTimeout:(NSTimeInterval)timeout tag:(long)tag { if([data length] == 0) return NO; if(theFlags & kForbidSendReceive) return NO; if(theFlags & kDidClose) return NO; // This method is only for non-connected sockets if([self isConnected]) return NO; NSData *address4 = nil, *address6 = nil; [self convertForSendHost:host port:port intoAddress4:&address4 address6:&address6]; AsyncSendPacket *packet = nil; if(address4 && theSocket4) packet = [[AsyncSendPacket alloc] initWithData:data address:address4 timeout:timeout tag:tag]; else if(address6 && theSocket6) packet = [[AsyncSendPacket alloc] initWithData:data address:address6 timeout:timeout tag:tag]; else return NO; [theSendQueue addObject:packet]; [self scheduleDequeueSend]; return YES; } - (BOOL)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag { if([data length] == 0) return NO; if(theFlags & kForbidSendReceive) return NO; if(theFlags & kDidClose) return NO; // This method is only for non-connected sockets if([self isConnected]) return NO; if([remoteAddr length] == sizeof(struct sockaddr_in) && !theSocket4) return NO; if([remoteAddr length] == sizeof(struct sockaddr_in6) && !theSocket6) return NO; AsyncSendPacket *packet = [[AsyncSendPacket alloc] initWithData:data address:remoteAddr timeout:timeout tag:tag]; [theSendQueue addObject:packet]; [self scheduleDequeueSend]; return YES; } - (BOOL)canAcceptBytes:(CFSocketRef)sockRef { if(sockRef == theSocket4) { if(theFlags & kSock4CanAcceptBytes) return YES; } else { if(theFlags & kSock6CanAcceptBytes) return YES; } CFSocketNativeHandle theNativeSocket = CFSocketGetNative(sockRef); if(theNativeSocket == 0) { NSLog(@"Error - Could not get CFSocketNativeHandle from CFSocketRef"); return NO; } fd_set fds; FD_ZERO(&fds); FD_SET(theNativeSocket, &fds); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 0; return select(FD_SETSIZE, NULL, &fds, NULL, &timeout) > 0; } - (CFSocketRef)socketForPacket:(AsyncSendPacket *)packet { if(!theSocket4) return theSocket6; if(!theSocket6) return theSocket4; return ([packet->address length] == sizeof(struct sockaddr_in)) ? theSocket4 : theSocket6; } /** * Puts a maybeDequeueSend on the run loop. **/ - (void)scheduleDequeueSend { if((theFlags & kDequeueSendScheduled) == 0) { theFlags |= kDequeueSendScheduled; [self performSelector:@selector(maybeDequeueSend) withObject:nil afterDelay:0 inModes:theRunLoopModes]; } } /** * This method starts a new send, if needed. * It is called when a user requests a send. **/ - (void)maybeDequeueSend { // Unset the flag indicating a call to this method is scheduled theFlags &= ~kDequeueSendScheduled; if(theCurrentSend == nil) { if([theSendQueue count] > 0) { // Dequeue next send packet theCurrentSend = [theSendQueue objectAtIndex:0]; [theSendQueue removeObjectAtIndex:0]; // Start time-out timer. if(theCurrentSend->timeout >= 0.0) { theSendTimer = [NSTimer timerWithTimeInterval:theCurrentSend->timeout target:self selector:@selector(doSendTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theSendTimer]; } // Immediately send, if possible. [self doSend:[self socketForPacket:theCurrentSend]]; } else if(theFlags & kCloseAfterSends) { if(theFlags & kCloseAfterReceives) { if(([theReceiveQueue count] == 0) && (theCurrentReceive == nil)) { [self close]; } } else { [self close]; } } } } /** * This method is called when a new read is taken from the read queue or when new data becomes available on the stream. **/ - (void)doSend:(CFSocketRef)theSocket { if(theCurrentSend != nil) { if(theSocket != [self socketForPacket:theCurrentSend]) { // Current send is for the other socket return; } if([self canAcceptBytes:theSocket]) { ssize_t result; CFSocketNativeHandle theNativeSocket = CFSocketGetNative(theSocket); const void *buf = [theCurrentSend->buffer bytes]; NSUInteger bufSize = [theCurrentSend->buffer length]; if([self isConnected]) { result = send(theNativeSocket, buf, (size_t)bufSize, 0); } else { const void *dst = [theCurrentSend->address bytes]; NSUInteger dstSize = [theCurrentSend->address length]; result = sendto(theNativeSocket, buf, (size_t)bufSize, 0, dst, (socklen_t)dstSize); } if(theSocket == theSocket4) theFlags &= ~kSock4CanAcceptBytes; else theFlags &= ~kSock6CanAcceptBytes; if(result < 0) { [self failCurrentSend:[self getErrnoError]]; } else { // If it wasn't bound before, it's bound now theFlags |= kDidBind; [self completeCurrentSend]; } [self scheduleDequeueSend]; } else { // Request notification when the socket is ready to send more data CFSocketEnableCallBacks(theSocket, kCFSocketReadCallBack | kCFSocketWriteCallBack); } } } - (void)completeCurrentSend { NSAssert (theCurrentSend, @"Trying to complete current send when there is no current send."); if ([theDelegate respondsToSelector:@selector(onUdpSocket:didSendDataWithTag:)]) { [theDelegate onUdpSocket:self didSendDataWithTag:theCurrentSend->tag]; } if (theCurrentSend != nil) [self endCurrentSend]; // Caller may have disconnected. } - (void)failCurrentSend:(NSError *)error { NSAssert (theCurrentSend, @"Trying to fail current send when there is no current send."); if ([theDelegate respondsToSelector:@selector(onUdpSocket:didNotSendDataWithTag:dueToError:)]) { [theDelegate onUdpSocket:self didNotSendDataWithTag:theCurrentSend->tag dueToError:error]; } if (theCurrentSend != nil) [self endCurrentSend]; // Caller may have disconnected. } /** * Ends the current send, and all associated variables such as the send timer. **/ - (void)endCurrentSend { NSAssert (theCurrentSend, @"Trying to end current send when there is no current send."); [theSendTimer invalidate]; theSendTimer = nil; theCurrentSend = nil; } - (void)doSendTimeout:(NSTimer *)timer { if (timer != theSendTimer) return; // Old timer. Ignore it. if (theCurrentSend != nil) { [self failCurrentSend:[self getSendTimeoutError]]; [self scheduleDequeueSend]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Receiving //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)receiveWithTimeout:(NSTimeInterval)timeout tag:(long)tag { if(theFlags & kForbidSendReceive) return; if(theFlags & kDidClose) return; AsyncReceivePacket *packet = [[AsyncReceivePacket alloc] initWithTimeout:timeout tag:tag]; [theReceiveQueue addObject:packet]; [self scheduleDequeueReceive]; } - (BOOL)hasBytesAvailable:(CFSocketRef)sockRef { if(sockRef == theSocket4) { if(theFlags & kSock4HasBytesAvailable) return YES; } else { if(theFlags & kSock6HasBytesAvailable) return YES; } CFSocketNativeHandle theNativeSocket = CFSocketGetNative(sockRef); if(theNativeSocket == 0) { NSLog(@"Error - Could not get CFSocketNativeHandle from CFSocketRef"); return NO; } fd_set fds; FD_ZERO(&fds); FD_SET(theNativeSocket, &fds); struct timeval timeout; timeout.tv_sec = 0; timeout.tv_usec = 0; return select(FD_SETSIZE, &fds, NULL, NULL, &timeout) > 0; } /** * Puts a maybeDequeueReceive on the run loop. **/ - (void)scheduleDequeueReceive { if((theFlags & kDequeueReceiveScheduled) == 0) { theFlags |= kDequeueReceiveScheduled; [self performSelector:@selector(maybeDequeueReceive) withObject:nil afterDelay:0 inModes:theRunLoopModes]; } } /** * Starts a new receive operation if needed **/ - (void)maybeDequeueReceive { // Unset the flag indicating a call to this method is scheduled theFlags &= ~kDequeueReceiveScheduled; if (theCurrentReceive == nil) { if ([theReceiveQueue count] > 0) { // Dequeue next receive packet theCurrentReceive = [theReceiveQueue objectAtIndex:0]; [theReceiveQueue removeObjectAtIndex:0]; // Start time-out timer. if (theCurrentReceive->timeout >= 0.0) { theReceiveTimer = [NSTimer timerWithTimeInterval:theCurrentReceive->timeout target:self selector:@selector(doReceiveTimeout:) userInfo:nil repeats:NO]; [self runLoopAddTimer:theReceiveTimer]; } // Immediately receive, if possible // We always check both sockets so we don't ever starve one of them. // We also check them in alternating orders to prevent starvation if both of them // have a continuous flow of incoming data. if(theFlags & kFlipFlop) { [self doReceive4]; [self doReceive6]; } else { [self doReceive6]; [self doReceive4]; } theFlags ^= kFlipFlop; } else if(theFlags & kCloseAfterReceives) { if(theFlags & kCloseAfterSends) { if(([theSendQueue count] == 0) && (theCurrentSend == nil)) { [self close]; } } else { [self close]; } } } } - (void)doReceive4 { if(theSocket4) [self doReceive:theSocket4]; } - (void)doReceive6 { if(theSocket6) [self doReceive:theSocket6]; } - (void)doReceive:(CFSocketRef)theSocket { if (theCurrentReceive != nil) { BOOL appIgnoredReceivedData; BOOL userIgnoredReceivedData; do { // Set or reset ignored variables. // If the app or user ignores the received data, we'll continue this do-while loop. appIgnoredReceivedData = NO; userIgnoredReceivedData = NO; if([self hasBytesAvailable:theSocket]) { NSData* bufferData = nil; ssize_t result; CFSocketNativeHandle theNativeSocket = CFSocketGetNative(theSocket); // Allocate buffer for recvfrom operation. // If the operation is successful, we'll realloc the buffer to the appropriate size, // and create an NSData wrapper around it without needing to copy any bytes around. void *buf = malloc(maxReceiveBufferSize); size_t bufSize = maxReceiveBufferSize; if(theSocket == theSocket4) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); result = recvfrom(theNativeSocket, buf, bufSize, 0, (struct sockaddr *)&sockaddr4, &sockaddr4len); if(result >= 0) { NSString *host = [self addressHost4:&sockaddr4]; UInt16 port = ntohs(sockaddr4.sin_port); if([self isConnected] && ![self isConnectedToHost:host port:port]) { // The user connected to an address, and the received data doesn't match the address. // This may happen if the data is received by the kernel prior to the connect call. appIgnoredReceivedData = YES; } else { if(result != bufSize) { buf = realloc(buf, result); } bufferData = [[NSData alloc] initWithBytesNoCopy:buf length:result freeWhenDone:YES]; theCurrentReceive->buffer = bufferData; theCurrentReceive->host = host; theCurrentReceive->port = port; } } theFlags &= ~kSock4HasBytesAvailable; } else { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); result = recvfrom(theNativeSocket, buf, bufSize, 0, (struct sockaddr *)&sockaddr6, &sockaddr6len); if(result >= 0) { NSString *host = [self addressHost6:&sockaddr6]; UInt16 port = ntohs(sockaddr6.sin6_port); if([self isConnected] && ![self isConnectedToHost:host port:port]) { // The user connected to an address, and the received data doesn't match the address. // This may happen if the data is received by the kernel prior to the connect call. appIgnoredReceivedData = YES; } else { if(result != bufSize) { buf = realloc(buf, result); } bufferData = [[NSData alloc] initWithBytesNoCopy:buf length:result freeWhenDone:YES]; theCurrentReceive->buffer = bufferData; theCurrentReceive->host = host; theCurrentReceive->port = port; } } theFlags &= ~kSock6HasBytesAvailable; } // Check to see if we need to free our alloc'd buffer // If bufferData is non-nil, it has taken ownership of the buffer if(bufferData == nil) { free(buf); } if(result < 0) { [self failCurrentReceive:[self getErrnoError]]; [self scheduleDequeueReceive]; } else if(!appIgnoredReceivedData) { BOOL finished = [self maybeCompleteCurrentReceive]; if(finished) { [self scheduleDequeueReceive]; } else { theCurrentReceive->buffer = nil; theCurrentReceive->host = nil; userIgnoredReceivedData = YES; } } } else { // Request notification when the socket is ready to receive more data CFSocketEnableCallBacks(theSocket, kCFSocketReadCallBack | kCFSocketWriteCallBack); } } while(appIgnoredReceivedData || userIgnoredReceivedData); } } - (BOOL)maybeCompleteCurrentReceive { NSAssert (theCurrentReceive, @"Trying to complete current receive when there is no current receive."); BOOL finished = YES; if ([theDelegate respondsToSelector:@selector(onUdpSocket:didReceiveData:withTag:fromHost:port:)]) { finished = [theDelegate onUdpSocket:self didReceiveData:theCurrentReceive->buffer withTag:theCurrentReceive->tag fromHost:theCurrentReceive->host port:theCurrentReceive->port]; } if (finished) { if (theCurrentReceive != nil) [self endCurrentReceive]; // Caller may have disconnected. } return finished; } - (void)failCurrentReceive:(NSError *)error { NSAssert (theCurrentReceive, @"Trying to fail current receive when there is no current receive."); if ([theDelegate respondsToSelector:@selector(onUdpSocket:didNotReceiveDataWithTag:dueToError:)]) { [theDelegate onUdpSocket:self didNotReceiveDataWithTag:theCurrentReceive->tag dueToError:error]; } if (theCurrentReceive != nil) [self endCurrentReceive]; // Caller may have disconnected. } - (void)endCurrentReceive { NSAssert (theCurrentReceive, @"Trying to end current receive when there is no current receive."); [theReceiveTimer invalidate]; theReceiveTimer = nil; theCurrentReceive = nil; } - (void)doReceiveTimeout:(NSTimer *)timer { if (timer != theReceiveTimer) return; // Old timer. Ignore it. if (theCurrentReceive != nil) { [self failCurrentReceive:[self getReceiveTimeoutError]]; [self scheduleDequeueReceive]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark CF Callbacks //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)doCFSocketCallback:(CFSocketCallBackType)type forSocket:(CFSocketRef)sock withAddress:(NSData *)address withData:(const void *)pData { NSParameterAssert((sock == theSocket4) || (sock == theSocket6)); switch (type) { case kCFSocketReadCallBack: if(sock == theSocket4) theFlags |= kSock4HasBytesAvailable; else theFlags |= kSock6HasBytesAvailable; [self doReceive:sock]; break; case kCFSocketWriteCallBack: if(sock == theSocket4) theFlags |= kSock4CanAcceptBytes; else theFlags |= kSock6CanAcceptBytes; [self doSend:sock]; break; default: NSLog (@"AsyncUdpSocket %p received unexpected CFSocketCallBackType %lu.", self, (unsigned long)type); break; } } /** * This is the callback we setup for CFSocket. * This method does nothing but forward the call to it's Objective-C counterpart **/ static void MyCFSocketCallback(CFSocketRef sref, CFSocketCallBackType type, CFDataRef address, const void *pData, void *pInfo) { @autoreleasepool { AsyncUdpSocket *theSocket = (__bridge AsyncUdpSocket *)pInfo; [theSocket doCFSocketCallback:type forSocket:sref withAddress:(__bridge NSData *)address withData:pData]; } } @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/GCDAsyncSocket.h ================================================ // // GCDAsyncSocket.h // // This class is in the public domain. // Originally created by Robbie Hanson in Q3 2010. // Updated and maintained by Deusty LLC and the Apple development community. // // https://github.com/robbiehanson/CocoaAsyncSocket // #import #import #import #import #import #include // AF_INET, AF_INET6 @class GCDAsyncReadPacket; @class GCDAsyncWritePacket; @class GCDAsyncSocketPreBuffer; extern NSString *const GCDAsyncSocketException; extern NSString *const GCDAsyncSocketErrorDomain; extern NSString *const GCDAsyncSocketQueueName; extern NSString *const GCDAsyncSocketThreadName; extern NSString *const GCDAsyncSocketManuallyEvaluateTrust; #if TARGET_OS_IPHONE extern NSString *const GCDAsyncSocketUseCFStreamForTLS; #endif #define GCDAsyncSocketSSLPeerName (NSString *)kCFStreamSSLPeerName #define GCDAsyncSocketSSLCertificates (NSString *)kCFStreamSSLCertificates #define GCDAsyncSocketSSLIsServer (NSString *)kCFStreamSSLIsServer extern NSString *const GCDAsyncSocketSSLPeerID; extern NSString *const GCDAsyncSocketSSLProtocolVersionMin; extern NSString *const GCDAsyncSocketSSLProtocolVersionMax; extern NSString *const GCDAsyncSocketSSLSessionOptionFalseStart; extern NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord; extern NSString *const GCDAsyncSocketSSLCipherSuites; #if !TARGET_OS_IPHONE extern NSString *const GCDAsyncSocketSSLDiffieHellmanParameters; #endif #define GCDAsyncSocketLoggingContext 65535 typedef NS_ENUM(NSInteger, GCDAsyncSocketError) { GCDAsyncSocketNoError = 0, // Never used GCDAsyncSocketBadConfigError, // Invalid configuration GCDAsyncSocketBadParamError, // Invalid parameter was passed GCDAsyncSocketConnectTimeoutError, // A connect operation timed out GCDAsyncSocketReadTimeoutError, // A read operation timed out GCDAsyncSocketWriteTimeoutError, // A write operation timed out GCDAsyncSocketReadMaxedOutError, // Reached set maxLength without completing GCDAsyncSocketClosedError, // The remote peer closed the connection GCDAsyncSocketOtherError, // Description provided in userInfo }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @interface GCDAsyncSocket : NSObject /** * GCDAsyncSocket uses the standard delegate paradigm, * but executes all delegate callbacks on a given delegate dispatch queue. * This allows for maximum concurrency, while at the same time providing easy thread safety. * * You MUST set a delegate AND delegate dispatch queue before attempting to * use the socket, or you will get an error. * * The socket queue is optional. * If you pass NULL, GCDAsyncSocket will automatically create it's own socket queue. * If you choose to provide a socket queue, the socket queue must not be a concurrent queue. * If you choose to provide a socket queue, and the socket queue has a configured target queue, * then please see the discussion for the method markSocketQueueTargetQueue. * * The delegate queue and socket queue can optionally be the same. **/ - (id)init; - (id)initWithSocketQueue:(dispatch_queue_t)sq; - (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq; - (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq; #pragma mark Configuration @property (atomic, weak, readwrite) id delegate; #if OS_OBJECT_USE_OBJC @property (atomic, strong, readwrite) dispatch_queue_t delegateQueue; #else @property (atomic, assign, readwrite) dispatch_queue_t delegateQueue; #endif - (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr; - (void)setDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue; /** * If you are setting the delegate to nil within the delegate's dealloc method, * you may need to use the synchronous versions below. **/ - (void)synchronouslySetDelegate:(id)delegate; - (void)synchronouslySetDelegateQueue:(dispatch_queue_t)delegateQueue; - (void)synchronouslySetDelegate:(id)delegate delegateQueue:(dispatch_queue_t)delegateQueue; /** * By default, both IPv4 and IPv6 are enabled. * * For accepting incoming connections, this means GCDAsyncSocket automatically supports both protocols, * and can simulataneously accept incoming connections on either protocol. * * For outgoing connections, this means GCDAsyncSocket can connect to remote hosts running either protocol. * If a DNS lookup returns only IPv4 results, GCDAsyncSocket will automatically use IPv4. * If a DNS lookup returns only IPv6 results, GCDAsyncSocket will automatically use IPv6. * If a DNS lookup returns both IPv4 and IPv6 results, the preferred protocol will be chosen. * By default, the preferred protocol is IPv4, but may be configured as desired. **/ @property (atomic, assign, readwrite, getter=isIPv4Enabled) BOOL IPv4Enabled; @property (atomic, assign, readwrite, getter=isIPv6Enabled) BOOL IPv6Enabled; @property (atomic, assign, readwrite, getter=isIPv4PreferredOverIPv6) BOOL IPv4PreferredOverIPv6; /** * User data allows you to associate arbitrary information with the socket. * This data is not used internally by socket in any way. **/ @property (atomic, strong, readwrite) id userData; #pragma mark Accepting /** * Tells the socket to begin listening and accepting connections on the given port. * When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it, * and the socket:didAcceptNewSocket: delegate method will be invoked. * * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) **/ - (BOOL)acceptOnPort:(uint16_t)port error:(NSError **)errPtr; /** * This method is the same as acceptOnPort:error: with the * additional option of specifying which interface to listen on. * * For example, you could specify that the socket should only accept connections over ethernet, * and not other interfaces such as wifi. * * The interface may be specified by name (e.g. "en1" or "lo0") or by IP address (e.g. "192.168.4.34"). * You may also use the special strings "localhost" or "loopback" to specify that * the socket only accept connections from the local machine. * * You can see the list of interfaces via the command line utility "ifconfig", * or programmatically via the getifaddrs() function. * * To accept connections on any interface pass nil, or simply use the acceptOnPort:error: method. **/ - (BOOL)acceptOnInterface:(NSString *)interface port:(uint16_t)port error:(NSError **)errPtr; /** * Tells the socket to begin listening and accepting connections on the unix domain at the given url. * When a connection is accepted, a new instance of GCDAsyncSocket will be spawned to handle it, * and the socket:didAcceptNewSocket: delegate method will be invoked. * * The socket will listen on all available interfaces (e.g. wifi, ethernet, etc) **/ - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; #pragma mark Connecting /** * Connects to the given host and port. * * This method invokes connectToHost:onPort:viaInterface:withTimeout:error: * and uses the default interface, and no timeout. **/ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr; /** * Connects to the given host and port with an optional timeout. * * This method invokes connectToHost:onPort:viaInterface:withTimeout:error: and uses the default interface. **/ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; /** * Connects to the given host & port, via the optional interface, with an optional timeout. * * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). * The host may also be the special strings "localhost" or "loopback" to specify connecting * to a service on the local machine. * * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). * The interface may also be used to specify the local port (see below). * * To not time out use a negative time interval. * * This method will return NO if an error is detected, and set the error pointer (if one was given). * Possible errors would be a nil host, invalid interface, or socket is already connected. * * If no errors are detected, this method will start a background connect operation and immediately return YES. * The delegate callbacks are used to notify you when the socket connects, or if the host was unreachable. * * Since this class supports queued reads and writes, you can immediately start reading and/or writing. * All read/write operations will be queued, and upon socket connection, * the operations will be dequeued and processed in order. * * The interface may optionally contain a port number at the end of the string, separated by a colon. * This allows you to specify the local port that should be used for the outgoing connection. (read paragraph to end) * To specify both interface and local port: "en1:8082" or "192.168.4.35:2424". * To specify only local port: ":8082". * Please note this is an advanced feature, and is somewhat hidden on purpose. * You should understand that 99.999% of the time you should NOT specify the local port for an outgoing connection. * If you think you need to, there is a very good chance you have a fundamental misunderstanding somewhere. * Local ports do NOT need to match remote ports. In fact, they almost never do. * This feature is here for networking professionals using very advanced techniques. **/ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port viaInterface:(NSString *)interface withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; /** * Connects to the given address, specified as a sockaddr structure wrapped in a NSData object. * For example, a NSData object returned from NSNetService's addresses method. * * If you have an existing struct sockaddr you can convert it to a NSData object like so: * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; * * This method invokes connectToAdd **/ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; /** * This method is the same as connectToAddress:error: with an additional timeout option. * To not time out use a negative time interval, or simply use the connectToAddress:error: method. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; /** * Connects to the given address, using the specified interface and timeout. * * The address is specified as a sockaddr structure wrapped in a NSData object. * For example, a NSData object returned from NSNetService's addresses method. * * If you have an existing struct sockaddr you can convert it to a NSData object like so: * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; * * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). * The interface may also be used to specify the local port (see below). * * The timeout is optional. To not time out use a negative time interval. * * This method will return NO if an error is detected, and set the error pointer (if one was given). * Possible errors would be a nil host, invalid interface, or socket is already connected. * * If no errors are detected, this method will start a background connect operation and immediately return YES. * The delegate callbacks are used to notify you when the socket connects, or if the host was unreachable. * * Since this class supports queued reads and writes, you can immediately start reading and/or writing. * All read/write operations will be queued, and upon socket connection, * the operations will be dequeued and processed in order. * * The interface may optionally contain a port number at the end of the string, separated by a colon. * This allows you to specify the local port that should be used for the outgoing connection. (read paragraph to end) * To specify both interface and local port: "en1:8082" or "192.168.4.35:2424". * To specify only local port: ":8082". * Please note this is an advanced feature, and is somewhat hidden on purpose. * You should understand that 99.999% of the time you should NOT specify the local port for an outgoing connection. * If you think you need to, there is a very good chance you have a fundamental misunderstanding somewhere. * Local ports do NOT need to match remote ports. In fact, they almost never do. * This feature is here for networking professionals using very advanced techniques. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr viaInterface:(NSString *)interface withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; /** * Connects to the unix domain socket at the given url, using the specified timeout. */ - (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; #pragma mark Disconnecting /** * Disconnects immediately (synchronously). Any pending reads or writes are dropped. * * If the socket is not already disconnected, an invocation to the socketDidDisconnect:withError: delegate method * will be queued onto the delegateQueue asynchronously (behind any previously queued delegate methods). * In other words, the disconnected delegate method will be invoked sometime shortly after this method returns. * * Please note the recommended way of releasing a GCDAsyncSocket instance (e.g. in a dealloc method) * [asyncSocket setDelegate:nil]; * [asyncSocket disconnect]; * [asyncSocket release]; * * If you plan on disconnecting the socket, and then immediately asking it to connect again, * you'll likely want to do so like this: * [asyncSocket setDelegate:nil]; * [asyncSocket disconnect]; * [asyncSocket setDelegate:self]; * [asyncSocket connect...]; **/ - (void)disconnect; /** * Disconnects after all pending reads have completed. * After calling this, the read and write methods will do nothing. * The socket will disconnect even if there are still pending writes. **/ - (void)disconnectAfterReading; /** * Disconnects after all pending writes have completed. * After calling this, the read and write methods will do nothing. * The socket will disconnect even if there are still pending reads. **/ - (void)disconnectAfterWriting; /** * Disconnects after all pending reads and writes have completed. * After calling this, the read and write methods will do nothing. **/ - (void)disconnectAfterReadingAndWriting; #pragma mark Diagnostics /** * Returns whether the socket is disconnected or connected. * * A disconnected socket may be recycled. * That is, it can used again for connecting or listening. * * If a socket is in the process of connecting, it may be neither disconnected nor connected. **/ @property (atomic, readonly) BOOL isDisconnected; @property (atomic, readonly) BOOL isConnected; /** * Returns the local or remote host and port to which this socket is connected, or nil and 0 if not connected. * The host will be an IP address. **/ @property (atomic, readonly) NSString *connectedHost; @property (atomic, readonly) uint16_t connectedPort; @property (atomic, readonly) NSURL *connectedUrl; @property (atomic, readonly) NSString *localHost; @property (atomic, readonly) uint16_t localPort; /** * Returns the local or remote address to which this socket is connected, * specified as a sockaddr structure wrapped in a NSData object. * * @seealso connectedHost * @seealso connectedPort * @seealso localHost * @seealso localPort **/ @property (atomic, readonly) NSData *connectedAddress; @property (atomic, readonly) NSData *localAddress; /** * Returns whether the socket is IPv4 or IPv6. * An accepting socket may be both. **/ @property (atomic, readonly) BOOL isIPv4; @property (atomic, readonly) BOOL isIPv6; /** * Returns whether or not the socket has been secured via SSL/TLS. * * See also the startTLS method. **/ @property (atomic, readonly) BOOL isSecure; #pragma mark Reading // The readData and writeData methods won't block (they are asynchronous). // // When a read is complete the socket:didReadData:withTag: delegate method is dispatched on the delegateQueue. // When a write is complete the socket:didWriteDataWithTag: delegate method is dispatched on the delegateQueue. // // You may optionally set a timeout for any read/write operation. (To not timeout, use a negative time interval.) // If a read/write opertion times out, the corresponding "socket:shouldTimeout..." delegate method // is called to optionally allow you to extend the timeout. // Upon a timeout, the "socket:didDisconnectWithError:" method is called // // The tag is for your convenience. // You can use it as an array index, step number, state id, pointer, etc. /** * Reads the first available bytes that become available on the socket. * * If the timeout value is negative, the read operation will not use a timeout. **/ - (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads the first available bytes that become available on the socket. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, the socket will create a buffer for you. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while the socket is using it. * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer via * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. **/ - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag; /** * Reads the first available bytes that become available on the socket. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * A maximum of length bytes will be read. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * If maxLength is zero, no length restriction is enforced. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while the socket is using it. * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer via * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. **/ - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag; /** * Reads the given number of bytes. * * If the timeout value is negative, the read operation will not use a timeout. * * If the length is 0, this method does nothing and the delegate is not called. **/ - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads the given number of bytes. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * * If the length is 0, this method does nothing and the delegate is not called. * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing, and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while AsyncSocket is using it. * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer via * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. **/ - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * * If the timeout value is negative, the read operation will not use a timeout. * * If you pass nil or zero-length data as the "data" parameter, * the method will do nothing (except maybe print a warning), and the delegate will not be called. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * If you're developing your own custom protocol, be sure your separator can not occur naturally as * part of the data between separators. * For example, imagine you want to send several small documents over a socket. * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. * In this particular example, it would be better to use a protocol similar to HTTP with * a header that includes the length of the document. * Also be careful that your separator cannot occur naturally as part of the encoding for a character. * * The given data (separator) parameter should be immutable. * For performance reasons, the socket will retain it, not copy it. * So if it is immutable, don't modify it while the socket is using it. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing (except maybe print a warning), and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while the socket is using it. * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer via * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * If you're developing your own custom protocol, be sure your separator can not occur naturally as * part of the data between separators. * For example, imagine you want to send several small documents over a socket. * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. * In this particular example, it would be better to use a protocol similar to HTTP with * a header that includes the length of the document. * Also be careful that your separator cannot occur naturally as part of the encoding for a character. * * The given data (separator) parameter should be immutable. * For performance reasons, the socket will retain it, not copy it. * So if it is immutable, don't modify it while the socket is using it. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * * If the timeout value is negative, the read operation will not use a timeout. * * If maxLength is zero, no length restriction is enforced. * Otherwise if maxLength bytes are read without completing the read, * it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError. * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. * * If you pass nil or zero-length data as the "data" parameter, * the method will do nothing (except maybe print a warning), and the delegate will not be called. * If you pass a maxLength parameter that is less than the length of the data parameter, * the method will do nothing (except maybe print a warning), and the delegate will not be called. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * If you're developing your own custom protocol, be sure your separator can not occur naturally as * part of the data between separators. * For example, imagine you want to send several small documents over a socket. * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. * In this particular example, it would be better to use a protocol similar to HTTP with * a header that includes the length of the document. * Also be careful that your separator cannot occur naturally as part of the encoding for a character. * * The given data (separator) parameter should be immutable. * For performance reasons, the socket will retain it, not copy it. * So if it is immutable, don't modify it while the socket is using it. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag; /** * Reads bytes until (and including) the passed "data" parameter, which acts as a separator. * The bytes will be appended to the given byte buffer starting at the given offset. * The given buffer will automatically be increased in size if needed. * * If the timeout value is negative, the read operation will not use a timeout. * If the buffer if nil, a buffer will automatically be created for you. * * If maxLength is zero, no length restriction is enforced. * Otherwise if maxLength bytes are read without completing the read, * it is treated similarly to a timeout - the socket is closed with a GCDAsyncSocketReadMaxedOutError. * The read will complete successfully if exactly maxLength bytes are read and the given data is found at the end. * * If you pass a maxLength parameter that is less than the length of the data (separator) parameter, * the method will do nothing (except maybe print a warning), and the delegate will not be called. * If the bufferOffset is greater than the length of the given buffer, * the method will do nothing (except maybe print a warning), and the delegate will not be called. * * If you pass a buffer, you must not alter it in any way while the socket is using it. * After completion, the data returned in socket:didReadData:withTag: will be a subset of the given buffer. * That is, it will reference the bytes that were appended to the given buffer via * the method [NSData dataWithBytesNoCopy:length:freeWhenDone:NO]. * * To read a line from the socket, use the line separator (e.g. CRLF for HTTP, see below) as the "data" parameter. * If you're developing your own custom protocol, be sure your separator can not occur naturally as * part of the data between separators. * For example, imagine you want to send several small documents over a socket. * Using CRLF as a separator is likely unwise, as a CRLF could easily exist within the documents. * In this particular example, it would be better to use a protocol similar to HTTP with * a header that includes the length of the document. * Also be careful that your separator cannot occur naturally as part of the encoding for a character. * * The given data (separator) parameter should be immutable. * For performance reasons, the socket will retain it, not copy it. * So if it is immutable, don't modify it while the socket is using it. **/ - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag; /** * Returns progress of the current read, from 0.0 to 1.0, or NaN if no current read (use isnan() to check). * The parameters "tag", "done" and "total" will be filled in if they aren't NULL. **/ - (float)progressOfReadReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr; #pragma mark Writing /** * Writes data to the socket, and calls the delegate when finished. * * If you pass in nil or zero-length data, this method does nothing and the delegate will not be called. * If the timeout value is negative, the write operation will not use a timeout. * * Thread-Safety Note: * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while * the socket is writing it. In other words, it's not safe to alter the data until after the delegate method * socket:didWriteDataWithTag: is invoked signifying that this particular write operation has completed. * This is due to the fact that GCDAsyncSocket does NOT copy the data. It simply retains it. * This is for performance reasons. Often times, if NSMutableData is passed, it is because * a request/response was built up in memory. Copying this data adds an unwanted/unneeded overhead. * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket * completes writing the bytes (which is NOT immediately after this method returns, but rather at a later time * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. **/ - (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Returns progress of the current write, from 0.0 to 1.0, or NaN if no current write (use isnan() to check). * The parameters "tag", "done" and "total" will be filled in if they aren't NULL. **/ - (float)progressOfWriteReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr; #pragma mark Security /** * Secures the connection using SSL/TLS. * * This method may be called at any time, and the TLS handshake will occur after all pending reads and writes * are finished. This allows one the option of sending a protocol dependent StartTLS message, and queuing * the upgrade to TLS at the same time, without having to wait for the write to finish. * Any reads or writes scheduled after this method is called will occur over the secured connection. * * ==== The available TOP-LEVEL KEYS are: * * - GCDAsyncSocketManuallyEvaluateTrust * The value must be of type NSNumber, encapsulating a BOOL value. * If you set this to YES, then the underlying SecureTransport system will not evaluate the SecTrustRef of the peer. * Instead it will pause at the moment evaulation would typically occur, * and allow us to handle the security evaluation however we see fit. * So GCDAsyncSocket will invoke the delegate method socket:shouldTrustPeer: passing the SecTrustRef. * * Note that if you set this option, then all other configuration keys are ignored. * Evaluation will be completely up to you during the socket:didReceiveTrust:completionHandler: delegate method. * * For more information on trust evaluation see: * Apple's Technical Note TN2232 - HTTPS Server Trust Evaluation * https://developer.apple.com/library/ios/technotes/tn2232/_index.html * * If unspecified, the default value is NO. * * - GCDAsyncSocketUseCFStreamForTLS (iOS only) * The value must be of type NSNumber, encapsulating a BOOL value. * By default GCDAsyncSocket will use the SecureTransport layer to perform encryption. * This gives us more control over the security protocol (many more configuration options), * plus it allows us to optimize things like sys calls and buffer allocation. * * However, if you absolutely must, you can instruct GCDAsyncSocket to use the old-fashioned encryption * technique by going through the CFStream instead. So instead of using SecureTransport, GCDAsyncSocket * will instead setup a CFRead/CFWriteStream. And then set the kCFStreamPropertySSLSettings property * (via CFReadStreamSetProperty / CFWriteStreamSetProperty) and will pass the given options to this method. * * Thus all the other keys in the given dictionary will be ignored by GCDAsyncSocket, * and will passed directly CFReadStreamSetProperty / CFWriteStreamSetProperty. * For more infomation on these keys, please see the documentation for kCFStreamPropertySSLSettings. * * If unspecified, the default value is NO. * * ==== The available CONFIGURATION KEYS are: * * - kCFStreamSSLPeerName * The value must be of type NSString. * It should match the name in the X.509 certificate given by the remote party. * See Apple's documentation for SSLSetPeerDomainName. * * - kCFStreamSSLCertificates * The value must be of type NSArray. * See Apple's documentation for SSLSetCertificate. * * - kCFStreamSSLIsServer * The value must be of type NSNumber, encapsulationg a BOOL value. * See Apple's documentation for SSLCreateContext for iOS. * This is optional for iOS. If not supplied, a NO value is the default. * This is not needed for Mac OS X, and the value is ignored. * * - GCDAsyncSocketSSLPeerID * The value must be of type NSData. * You must set this value if you want to use TLS session resumption. * See Apple's documentation for SSLSetPeerID. * * - GCDAsyncSocketSSLProtocolVersionMin * - GCDAsyncSocketSSLProtocolVersionMax * The value(s) must be of type NSNumber, encapsulting a SSLProtocol value. * See Apple's documentation for SSLSetProtocolVersionMin & SSLSetProtocolVersionMax. * See also the SSLProtocol typedef. * * - GCDAsyncSocketSSLSessionOptionFalseStart * The value must be of type NSNumber, encapsulating a BOOL value. * See Apple's documentation for kSSLSessionOptionFalseStart. * * - GCDAsyncSocketSSLSessionOptionSendOneByteRecord * The value must be of type NSNumber, encapsulating a BOOL value. * See Apple's documentation for kSSLSessionOptionSendOneByteRecord. * * - GCDAsyncSocketSSLCipherSuites * The values must be of type NSArray. * Each item within the array must be a NSNumber, encapsulating * See Apple's documentation for SSLSetEnabledCiphers. * See also the SSLCipherSuite typedef. * * - GCDAsyncSocketSSLDiffieHellmanParameters (Mac OS X only) * The value must be of type NSData. * See Apple's documentation for SSLSetDiffieHellmanParams. * * ==== The following UNAVAILABLE KEYS are: (with throw an exception) * * - kCFStreamSSLAllowsAnyRoot (UNAVAILABLE) * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). * Corresponding deprecated method: SSLSetAllowsAnyRoot * * - kCFStreamSSLAllowsExpiredRoots (UNAVAILABLE) * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). * Corresponding deprecated method: SSLSetAllowsExpiredRoots * * - kCFStreamSSLAllowsExpiredCertificates (UNAVAILABLE) * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). * Corresponding deprecated method: SSLSetAllowsExpiredCerts * * - kCFStreamSSLValidatesCertificateChain (UNAVAILABLE) * You MUST use manual trust evaluation instead (see GCDAsyncSocketManuallyEvaluateTrust). * Corresponding deprecated method: SSLSetEnableCertVerify * * - kCFStreamSSLLevel (UNAVAILABLE) * You MUST use GCDAsyncSocketSSLProtocolVersionMin & GCDAsyncSocketSSLProtocolVersionMin instead. * Corresponding deprecated method: SSLSetProtocolVersionEnabled * * * Please refer to Apple's documentation for corresponding SSLFunctions. * * If you pass in nil or an empty dictionary, the default settings will be used. * * IMPORTANT SECURITY NOTE: * The default settings will check to make sure the remote party's certificate is signed by a * trusted 3rd party certificate agency (e.g. verisign) and that the certificate is not expired. * However it will not verify the name on the certificate unless you * give it a name to verify against via the kCFStreamSSLPeerName key. * The security implications of this are important to understand. * Imagine you are attempting to create a secure connection to MySecureServer.com, * but your socket gets directed to MaliciousServer.com because of a hacked DNS server. * If you simply use the default settings, and MaliciousServer.com has a valid certificate, * the default settings will not detect any problems since the certificate is valid. * To properly secure your connection in this particular scenario you * should set the kCFStreamSSLPeerName property to "MySecureServer.com". * * You can also perform additional validation in socketDidSecure. **/ - (void)startTLS:(NSDictionary *)tlsSettings; #pragma mark Advanced /** * Traditionally sockets are not closed until the conversation is over. * However, it is technically possible for the remote enpoint to close its write stream. * Our socket would then be notified that there is no more data to be read, * but our socket would still be writeable and the remote endpoint could continue to receive our data. * * The argument for this confusing functionality stems from the idea that a client could shut down its * write stream after sending a request to the server, thus notifying the server there are to be no further requests. * In practice, however, this technique did little to help server developers. * * To make matters worse, from a TCP perspective there is no way to tell the difference from a read stream close * and a full socket close. They both result in the TCP stack receiving a FIN packet. The only way to tell * is by continuing to write to the socket. If it was only a read stream close, then writes will continue to work. * Otherwise an error will be occur shortly (when the remote end sends us a RST packet). * * In addition to the technical challenges and confusion, many high level socket/stream API's provide * no support for dealing with the problem. If the read stream is closed, the API immediately declares the * socket to be closed, and shuts down the write stream as well. In fact, this is what Apple's CFStream API does. * It might sound like poor design at first, but in fact it simplifies development. * * The vast majority of the time if the read stream is closed it's because the remote endpoint closed its socket. * Thus it actually makes sense to close the socket at this point. * And in fact this is what most networking developers want and expect to happen. * However, if you are writing a server that interacts with a plethora of clients, * you might encounter a client that uses the discouraged technique of shutting down its write stream. * If this is the case, you can set this property to NO, * and make use of the socketDidCloseReadStream delegate method. * * The default value is YES. **/ @property (atomic, assign, readwrite) BOOL autoDisconnectOnClosedReadStream; /** * GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue. * In most cases, the instance creates this queue itself. * However, to allow for maximum flexibility, the internal queue may be passed in the init method. * This allows for some advanced options such as controlling socket priority via target queues. * However, when one begins to use target queues like this, they open the door to some specific deadlock issues. * * For example, imagine there are 2 queues: * dispatch_queue_t socketQueue; * dispatch_queue_t socketTargetQueue; * * If you do this (pseudo-code): * socketQueue.targetQueue = socketTargetQueue; * * Then all socketQueue operations will actually get run on the given socketTargetQueue. * This is fine and works great in most situations. * But if you run code directly from within the socketTargetQueue that accesses the socket, * you could potentially get deadlock. Imagine the following code: * * - (BOOL)socketHasSomething * { * __block BOOL result = NO; * dispatch_block_t block = ^{ * result = [self someInternalMethodToBeRunOnlyOnSocketQueue]; * } * if (is_executing_on_queue(socketQueue)) * block(); * else * dispatch_sync(socketQueue, block); * * return result; * } * * What happens if you call this method from the socketTargetQueue? The result is deadlock. * This is because the GCD API offers no mechanism to discover a queue's targetQueue. * Thus we have no idea if our socketQueue is configured with a targetQueue. * If we had this information, we could easily avoid deadlock. * But, since these API's are missing or unfeasible, you'll have to explicitly set it. * * IF you pass a socketQueue via the init method, * AND you've configured the passed socketQueue with a targetQueue, * THEN you should pass the end queue in the target hierarchy. * * For example, consider the following queue hierarchy: * socketQueue -> ipQueue -> moduleQueue * * This example demonstrates priority shaping within some server. * All incoming client connections from the same IP address are executed on the same target queue. * And all connections for a particular module are executed on the same target queue. * Thus, the priority of all networking for the entire module can be changed on the fly. * Additionally, networking traffic from a single IP cannot monopolize the module. * * Here's how you would accomplish something like that: * - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock * { * dispatch_queue_t socketQueue = dispatch_queue_create("", NULL); * dispatch_queue_t ipQueue = [self ipQueueForAddress:address]; * * dispatch_set_target_queue(socketQueue, ipQueue); * dispatch_set_target_queue(iqQueue, moduleQueue); * * return socketQueue; * } * - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket * { * [clientConnections addObject:newSocket]; * [newSocket markSocketQueueTargetQueue:moduleQueue]; * } * * Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue. * This is often NOT the case, as such queues are used solely for execution shaping. **/ - (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue; - (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue; /** * It's not thread-safe to access certain variables from outside the socket's internal queue. * * For example, the socket file descriptor. * File descriptors are simply integers which reference an index in the per-process file table. * However, when one requests a new file descriptor (by opening a file or socket), * the file descriptor returned is guaranteed to be the lowest numbered unused descriptor. * So if we're not careful, the following could be possible: * * - Thread A invokes a method which returns the socket's file descriptor. * - The socket is closed via the socket's internal queue on thread B. * - Thread C opens a file, and subsequently receives the file descriptor that was previously the socket's FD. * - Thread A is now accessing/altering the file instead of the socket. * * In addition to this, other variables are not actually objects, * and thus cannot be retained/released or even autoreleased. * An example is the sslContext, of type SSLContextRef, which is actually a malloc'd struct. * * Although there are internal variables that make it difficult to maintain thread-safety, * it is important to provide access to these variables * to ensure this class can be used in a wide array of environments. * This method helps to accomplish this by invoking the current block on the socket's internal queue. * The methods below can be invoked from within the block to access * those generally thread-unsafe internal variables in a thread-safe manner. * The given block will be invoked synchronously on the socket's internal queue. * * If you save references to any protected variables and use them outside the block, you do so at your own peril. **/ - (void)performBlock:(dispatch_block_t)block; /** * These methods are only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Provides access to the socket's file descriptor(s). * If the socket is a server socket (is accepting incoming connections), * it might actually have multiple internal socket file descriptors - one for IPv4 and one for IPv6. **/ - (int)socketFD; - (int)socket4FD; - (int)socket6FD; #if TARGET_OS_IPHONE /** * These methods are only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Provides access to the socket's internal CFReadStream/CFWriteStream. * * These streams are only used as workarounds for specific iOS shortcomings: * * - Apple has decided to keep the SecureTransport framework private is iOS. * This means the only supplied way to do SSL/TLS is via CFStream or some other API layered on top of it. * Thus, in order to provide SSL/TLS support on iOS we are forced to rely on CFStream, * instead of the preferred and faster and more powerful SecureTransport. * * - If a socket doesn't have backgrounding enabled, and that socket is closed while the app is backgrounded, * Apple only bothers to notify us via the CFStream API. * The faster and more powerful GCD API isn't notified properly in this case. * * See also: (BOOL)enableBackgroundingOnSocket **/ - (CFReadStreamRef)readStream; - (CFWriteStreamRef)writeStream; /** * This method is only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Configures the socket to allow it to operate when the iOS application has been backgrounded. * In other words, this method creates a read & write stream, and invokes: * * CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); * CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); * * Returns YES if successful, NO otherwise. * * Note: Apple does not officially support backgrounding server sockets. * That is, if your socket is accepting incoming connections, Apple does not officially support * allowing iOS applications to accept incoming connections while an app is backgrounded. * * Example usage: * * - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port * { * [asyncSocket performBlock:^{ * [asyncSocket enableBackgroundingOnSocket]; * }]; * } **/ - (BOOL)enableBackgroundingOnSocket; #endif /** * This method is only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Provides access to the socket's SSLContext, if SSL/TLS has been started on the socket. **/ - (SSLContextRef)sslContext; #pragma mark Utilities /** * The address lookup utility used by the class. * This method is synchronous, so it's recommended you use it on a background thread/queue. * * The special strings "localhost" and "loopback" return the loopback address for IPv4 and IPv6. * * @returns * A mutable array with all IPv4 and IPv6 addresses returned by getaddrinfo. * The addresses are specifically for TCP connections. * You can filter the addresses, if needed, using the other utility methods provided by the class. **/ + (NSMutableArray *)lookupHost:(NSString *)host port:(uint16_t)port error:(NSError **)errPtr; /** * Extracting host and port information from raw address data. **/ + (NSString *)hostFromAddress:(NSData *)address; + (uint16_t)portFromAddress:(NSData *)address; + (BOOL)isIPv4Address:(NSData *)address; + (BOOL)isIPv6Address:(NSData *)address; + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr fromAddress:(NSData *)address; + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(sa_family_t *)afPtr fromAddress:(NSData *)address; /** * A few common line separators, for use with the readDataToData:... methods. **/ + (NSData *)CRLFData; // 0x0D0A + (NSData *)CRData; // 0x0D + (NSData *)LFData; // 0x0A + (NSData *)ZeroData; // 0x00 @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @protocol GCDAsyncSocketDelegate @optional /** * This method is called immediately prior to socket:didAcceptNewSocket:. * It optionally allows a listening socket to specify the socketQueue for a new accepted socket. * If this method is not implemented, or returns NULL, the new accepted socket will create its own default queue. * * Since you cannot autorelease a dispatch_queue, * this method uses the "new" prefix in its name to specify that the returned queue has been retained. * * Thus you could do something like this in the implementation: * return dispatch_queue_create("MyQueue", NULL); * * If you are placing multiple sockets on the same queue, * then care should be taken to increment the retain count each time this method is invoked. * * For example, your implementation might look something like this: * dispatch_retain(myExistingQueue); * return myExistingQueue; **/ - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock; /** * Called when a socket accepts a connection. * Another socket is automatically spawned to handle it. * * You must retain the newSocket if you wish to handle the connection. * Otherwise the newSocket instance will be released and the spawned connection will be closed. * * By default the new socket will have the same delegate and delegateQueue. * You may, of course, change this at any time. **/ - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket; /** * Called when a socket connects and is ready for reading and writing. * The host parameter will be an IP address, not a DNS name. **/ - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port; /** * Called when a socket connects and is ready for reading and writing. * The host parameter will be an IP address, not a DNS name. **/ - (void)socket:(GCDAsyncSocket *)sock didConnectToUrl:(NSURL *)url; /** * Called when a socket has completed reading the requested data into memory. * Not called if there is an error. **/ - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag; /** * Called when a socket has read in data, but has not yet completed the read. * This would occur if using readToData: or readToLength: methods. * It may be used to for things such as updating progress bars. **/ - (void)socket:(GCDAsyncSocket *)sock didReadPartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; /** * Called when a socket has completed writing the requested data. Not called if there is an error. **/ - (void)socket:(GCDAsyncSocket *)sock didWriteDataWithTag:(long)tag; /** * Called when a socket has written some data, but has not yet completed the entire write. * It may be used to for things such as updating progress bars. **/ - (void)socket:(GCDAsyncSocket *)sock didWritePartialDataOfLength:(NSUInteger)partialLength tag:(long)tag; /** * Called if a read operation has reached its timeout without completing. * This method allows you to optionally extend the timeout. * If you return a positive time interval (> 0) the read's timeout will be extended by the given amount. * If you don't implement this method, or return a non-positive time interval (<= 0) the read will timeout as usual. * * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. * The length parameter is the number of bytes that have been read so far for the read operation. * * Note that this method may be called multiple times for a single read if you return positive numbers. **/ - (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutReadWithTag:(long)tag elapsed:(NSTimeInterval)elapsed bytesDone:(NSUInteger)length; /** * Called if a write operation has reached its timeout without completing. * This method allows you to optionally extend the timeout. * If you return a positive time interval (> 0) the write's timeout will be extended by the given amount. * If you don't implement this method, or return a non-positive time interval (<= 0) the write will timeout as usual. * * The elapsed parameter is the sum of the original timeout, plus any additions previously added via this method. * The length parameter is the number of bytes that have been written so far for the write operation. * * Note that this method may be called multiple times for a single write if you return positive numbers. **/ - (NSTimeInterval)socket:(GCDAsyncSocket *)sock shouldTimeoutWriteWithTag:(long)tag elapsed:(NSTimeInterval)elapsed bytesDone:(NSUInteger)length; /** * Conditionally called if the read stream closes, but the write stream may still be writeable. * * This delegate method is only called if autoDisconnectOnClosedReadStream has been set to NO. * See the discussion on the autoDisconnectOnClosedReadStream method for more information. **/ - (void)socketDidCloseReadStream:(GCDAsyncSocket *)sock; /** * Called when a socket disconnects with or without error. * * If you call the disconnect method, and the socket wasn't already disconnected, * then an invocation of this delegate method will be enqueued on the delegateQueue * before the disconnect method returns. * * Note: If the GCDAsyncSocket instance is deallocated while it is still connected, * and the delegate is not also deallocated, then this method will be invoked, * but the sock parameter will be nil. (It must necessarily be nil since it is no longer available.) * This is a generally rare, but is possible if one writes code like this: * * asyncSocket = nil; // I'm implicitly disconnecting the socket * * In this case it may preferrable to nil the delegate beforehand, like this: * * asyncSocket.delegate = nil; // Don't invoke my delegate method * asyncSocket = nil; // I'm implicitly disconnecting the socket * * Of course, this depends on how your state machine is configured. **/ - (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)err; /** * Called after the socket has successfully completed SSL/TLS negotiation. * This method is not called unless you use the provided startTLS method. * * If a SSL/TLS negotiation fails (invalid certificate, etc) then the socket will immediately close, * and the socketDidDisconnect:withError: delegate method will be called with the specific SSL error code. **/ - (void)socketDidSecure:(GCDAsyncSocket *)sock; /** * Allows a socket delegate to hook into the TLS handshake and manually validate the peer it's connecting to. * * This is only called if startTLS is invoked with options that include: * - GCDAsyncSocketManuallyEvaluateTrust == YES * * Typically the delegate will use SecTrustEvaluate (and related functions) to properly validate the peer. * * Note from Apple's documentation: * Because [SecTrustEvaluate] might look on the network for certificates in the certificate chain, * [it] might block while attempting network access. You should never call it from your main thread; * call it only from within a function running on a dispatch queue or on a separate thread. * * Thus this method uses a completionHandler block rather than a normal return value. * The completionHandler block is thread-safe, and may be invoked from a background queue/thread. * It is safe to invoke the completionHandler block even if the socket has been closed. **/ - (void)socket:(GCDAsyncSocket *)sock didReceiveTrust:(SecTrustRef)trust completionHandler:(void (^)(BOOL shouldTrustPeer))completionHandler; @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/GCDAsyncSocket.m ================================================ // // GCDAsyncSocket.m // // This class is in the public domain. // Originally created by Robbie Hanson in Q4 2010. // Updated and maintained by Deusty LLC and the Apple development community. // // https://github.com/robbiehanson/CocoaAsyncSocket // #import "GCDAsyncSocket.h" #if TARGET_OS_IPHONE #import #endif #import #import #import #import #import #import #import #import #import #import #import #import #import #import #if ! __has_feature(objc_arc) #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). // For more information see: https://github.com/robbiehanson/CocoaAsyncSocket/wiki/ARC #endif #ifndef GCDAsyncSocketLoggingEnabled #define GCDAsyncSocketLoggingEnabled 0 #endif #if GCDAsyncSocketLoggingEnabled // Logging Enabled - See log level below // Logging uses the CocoaLumberjack framework (which is also GCD based). // https://github.com/robbiehanson/CocoaLumberjack // // It allows us to do a lot of logging without significantly slowing down the code. #import "DDLogMacros.h" #define LogAsync YES #define LogContext GCDAsyncSocketLoggingContext #define LogObjc(flg, frmt, ...) LOG_MAYBE(LogAsync, logLevel, flg, LogContext, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) #define LogC(flg, frmt, ...) LOG_MAYBE(LogAsync, logLevel, flg, LogContext, nil, __PRETTY_FUNCTION__, frmt, ##__VA_ARGS__) #define LogError(frmt, ...) LogObjc(DDLogFlagError, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogWarn(frmt, ...) LogObjc(DDLogFlagWarning, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogInfo(frmt, ...) LogObjc(DDLogFlagInfo, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogVerbose(frmt, ...) LogObjc(DDLogFlagVerbose, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCError(frmt, ...) LogC(DDLogFlagError, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCWarn(frmt, ...) LogC(DDLogFlagWarning, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCInfo(frmt, ...) LogC(DDLogFlagInfo, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCVerbose(frmt, ...) LogC(DDLogFlagVerbose, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogTrace() LogObjc(DDLogFlagVerbose, @"%@: %@", THIS_FILE, THIS_METHOD) #define LogCTrace() LogC(DDLogFlagVerbose, @"%@: %s", THIS_FILE, __FUNCTION__) #ifndef GCDAsyncSocketLogLevel #define GCDAsyncSocketLogLevel DDLogLevelVerbose #endif // Log levels : off, error, warn, info, verbose static const int logLevel = GCDAsyncSocketLogLevel; #else // Logging Disabled #define LogError(frmt, ...) {} #define LogWarn(frmt, ...) {} #define LogInfo(frmt, ...) {} #define LogVerbose(frmt, ...) {} #define LogCError(frmt, ...) {} #define LogCWarn(frmt, ...) {} #define LogCInfo(frmt, ...) {} #define LogCVerbose(frmt, ...) {} #define LogTrace() {} #define LogCTrace(frmt, ...) {} #endif /** * Seeing a return statements within an inner block * can sometimes be mistaken for a return point of the enclosing method. * This makes inline blocks a bit easier to read. **/ #define return_from_block return /** * A socket file descriptor is really just an integer. * It represents the index of the socket within the kernel. * This makes invalid file descriptor comparisons easier to read. **/ #define SOCKET_NULL -1 NSString *const GCDAsyncSocketException = @"GCDAsyncSocketException"; NSString *const GCDAsyncSocketErrorDomain = @"GCDAsyncSocketErrorDomain"; NSString *const GCDAsyncSocketQueueName = @"GCDAsyncSocket"; NSString *const GCDAsyncSocketThreadName = @"GCDAsyncSocket-CFStream"; NSString *const GCDAsyncSocketManuallyEvaluateTrust = @"GCDAsyncSocketManuallyEvaluateTrust"; #if TARGET_OS_IPHONE NSString *const GCDAsyncSocketUseCFStreamForTLS = @"GCDAsyncSocketUseCFStreamForTLS"; #endif NSString *const GCDAsyncSocketSSLPeerID = @"GCDAsyncSocketSSLPeerID"; NSString *const GCDAsyncSocketSSLProtocolVersionMin = @"GCDAsyncSocketSSLProtocolVersionMin"; NSString *const GCDAsyncSocketSSLProtocolVersionMax = @"GCDAsyncSocketSSLProtocolVersionMax"; NSString *const GCDAsyncSocketSSLSessionOptionFalseStart = @"GCDAsyncSocketSSLSessionOptionFalseStart"; NSString *const GCDAsyncSocketSSLSessionOptionSendOneByteRecord = @"GCDAsyncSocketSSLSessionOptionSendOneByteRecord"; NSString *const GCDAsyncSocketSSLCipherSuites = @"GCDAsyncSocketSSLCipherSuites"; #if !TARGET_OS_IPHONE NSString *const GCDAsyncSocketSSLDiffieHellmanParameters = @"GCDAsyncSocketSSLDiffieHellmanParameters"; #endif enum GCDAsyncSocketFlags { kSocketStarted = 1 << 0, // If set, socket has been started (accepting/connecting) kConnected = 1 << 1, // If set, the socket is connected kForbidReadsWrites = 1 << 2, // If set, no new reads or writes are allowed kReadsPaused = 1 << 3, // If set, reads are paused due to possible timeout kWritesPaused = 1 << 4, // If set, writes are paused due to possible timeout kDisconnectAfterReads = 1 << 5, // If set, disconnect after no more reads are queued kDisconnectAfterWrites = 1 << 6, // If set, disconnect after no more writes are queued kSocketCanAcceptBytes = 1 << 7, // If set, we know socket can accept bytes. If unset, it's unknown. kReadSourceSuspended = 1 << 8, // If set, the read source is suspended kWriteSourceSuspended = 1 << 9, // If set, the write source is suspended kQueuedTLS = 1 << 10, // If set, we've queued an upgrade to TLS kStartingReadTLS = 1 << 11, // If set, we're waiting for TLS negotiation to complete kStartingWriteTLS = 1 << 12, // If set, we're waiting for TLS negotiation to complete kSocketSecure = 1 << 13, // If set, socket is using secure communication via SSL/TLS kSocketHasReadEOF = 1 << 14, // If set, we have read EOF from socket kReadStreamClosed = 1 << 15, // If set, we've read EOF plus prebuffer has been drained kDealloc = 1 << 16, // If set, the socket is being deallocated #if TARGET_OS_IPHONE kAddedStreamsToRunLoop = 1 << 17, // If set, CFStreams have been added to listener thread kUsingCFStreamForTLS = 1 << 18, // If set, we're forced to use CFStream instead of SecureTransport kSecureSocketHasBytesAvailable = 1 << 19, // If set, CFReadStream has notified us of bytes available #endif }; enum GCDAsyncSocketConfig { kIPv4Disabled = 1 << 0, // If set, IPv4 is disabled kIPv6Disabled = 1 << 1, // If set, IPv6 is disabled kPreferIPv6 = 1 << 2, // If set, IPv6 is preferred over IPv4 kAllowHalfDuplexConnection = 1 << 3, // If set, the socket will stay open even if the read stream closes }; #if TARGET_OS_IPHONE static NSThread *cfstreamThread; // Used for CFStreams static uint64_t cfstreamThreadRetainCount; // setup & teardown static dispatch_queue_t cfstreamThreadSetupQueue; // setup & teardown #endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * A PreBuffer is used when there is more data available on the socket * than is being requested by current read request. * In this case we slurp up all data from the socket (to minimize sys calls), * and store additional yet unread data in a "prebuffer". * * The prebuffer is entirely drained before we read from the socket again. * In other words, a large chunk of data is written is written to the prebuffer. * The prebuffer is then drained via a series of one or more reads (for subsequent read request(s)). * * A ring buffer was once used for this purpose. * But a ring buffer takes up twice as much memory as needed (double the size for mirroring). * In fact, it generally takes up more than twice the needed size as everything has to be rounded up to vm_page_size. * And since the prebuffer is always completely drained after being written to, a full ring buffer isn't needed. * * The current design is very simple and straight-forward, while also keeping memory requirements lower. **/ @interface GCDAsyncSocketPreBuffer : NSObject { uint8_t *preBuffer; size_t preBufferSize; uint8_t *readPointer; uint8_t *writePointer; } - (id)initWithCapacity:(size_t)numBytes; - (void)ensureCapacityForWrite:(size_t)numBytes; - (size_t)availableBytes; - (uint8_t *)readBuffer; - (void)getReadBuffer:(uint8_t **)bufferPtr availableBytes:(size_t *)availableBytesPtr; - (size_t)availableSpace; - (uint8_t *)writeBuffer; - (void)getWriteBuffer:(uint8_t **)bufferPtr availableSpace:(size_t *)availableSpacePtr; - (void)didRead:(size_t)bytesRead; - (void)didWrite:(size_t)bytesWritten; - (void)reset; @end @implementation GCDAsyncSocketPreBuffer - (id)initWithCapacity:(size_t)numBytes { if ((self = [super init])) { preBufferSize = numBytes; preBuffer = malloc(preBufferSize); readPointer = preBuffer; writePointer = preBuffer; } return self; } - (void)dealloc { if (preBuffer) free(preBuffer); } - (void)ensureCapacityForWrite:(size_t)numBytes { size_t availableSpace = [self availableSpace]; if (numBytes > availableSpace) { size_t additionalBytes = numBytes - availableSpace; size_t newPreBufferSize = preBufferSize + additionalBytes; uint8_t *newPreBuffer = realloc(preBuffer, newPreBufferSize); size_t readPointerOffset = readPointer - preBuffer; size_t writePointerOffset = writePointer - preBuffer; preBuffer = newPreBuffer; preBufferSize = newPreBufferSize; readPointer = preBuffer + readPointerOffset; writePointer = preBuffer + writePointerOffset; } } - (size_t)availableBytes { return writePointer - readPointer; } - (uint8_t *)readBuffer { return readPointer; } - (void)getReadBuffer:(uint8_t **)bufferPtr availableBytes:(size_t *)availableBytesPtr { if (bufferPtr) *bufferPtr = readPointer; if (availableBytesPtr) *availableBytesPtr = [self availableBytes]; } - (void)didRead:(size_t)bytesRead { readPointer += bytesRead; if (readPointer == writePointer) { // The prebuffer has been drained. Reset pointers. readPointer = preBuffer; writePointer = preBuffer; } } - (size_t)availableSpace { return preBufferSize - (writePointer - preBuffer); } - (uint8_t *)writeBuffer { return writePointer; } - (void)getWriteBuffer:(uint8_t **)bufferPtr availableSpace:(size_t *)availableSpacePtr { if (bufferPtr) *bufferPtr = writePointer; if (availableSpacePtr) *availableSpacePtr = [self availableSpace]; } - (void)didWrite:(size_t)bytesWritten { writePointer += bytesWritten; } - (void)reset { readPointer = preBuffer; writePointer = preBuffer; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The GCDAsyncReadPacket encompasses the instructions for any given read. * The content of a read packet allows the code to determine if we're: * - reading to a certain length * - reading to a certain separator * - or simply reading the first chunk of available data **/ @interface GCDAsyncReadPacket : NSObject { @public NSMutableData *buffer; NSUInteger startOffset; NSUInteger bytesDone; NSUInteger maxLength; NSTimeInterval timeout; NSUInteger readLength; NSData *term; BOOL bufferOwner; NSUInteger originalBufferLength; long tag; } - (id)initWithData:(NSMutableData *)d startOffset:(NSUInteger)s maxLength:(NSUInteger)m timeout:(NSTimeInterval)t readLength:(NSUInteger)l terminator:(NSData *)e tag:(long)i; - (void)ensureCapacityForAdditionalDataOfLength:(NSUInteger)bytesToRead; - (NSUInteger)optimalReadLengthWithDefault:(NSUInteger)defaultValue shouldPreBuffer:(BOOL *)shouldPreBufferPtr; - (NSUInteger)readLengthForNonTermWithHint:(NSUInteger)bytesAvailable; - (NSUInteger)readLengthForTermWithHint:(NSUInteger)bytesAvailable shouldPreBuffer:(BOOL *)shouldPreBufferPtr; - (NSUInteger)readLengthForTermWithPreBuffer:(GCDAsyncSocketPreBuffer *)preBuffer found:(BOOL *)foundPtr; - (NSInteger)searchForTermAfterPreBuffering:(ssize_t)numBytes; @end @implementation GCDAsyncReadPacket - (id)initWithData:(NSMutableData *)d startOffset:(NSUInteger)s maxLength:(NSUInteger)m timeout:(NSTimeInterval)t readLength:(NSUInteger)l terminator:(NSData *)e tag:(long)i { if((self = [super init])) { bytesDone = 0; maxLength = m; timeout = t; readLength = l; term = [e copy]; tag = i; if (d) { buffer = d; startOffset = s; bufferOwner = NO; originalBufferLength = [d length]; } else { if (readLength > 0) buffer = [[NSMutableData alloc] initWithLength:readLength]; else buffer = [[NSMutableData alloc] initWithLength:0]; startOffset = 0; bufferOwner = YES; originalBufferLength = 0; } } return self; } /** * Increases the length of the buffer (if needed) to ensure a read of the given size will fit. **/ - (void)ensureCapacityForAdditionalDataOfLength:(NSUInteger)bytesToRead { NSUInteger buffSize = [buffer length]; NSUInteger buffUsed = startOffset + bytesDone; NSUInteger buffSpace = buffSize - buffUsed; if (bytesToRead > buffSpace) { NSUInteger buffInc = bytesToRead - buffSpace; [buffer increaseLengthBy:buffInc]; } } /** * This method is used when we do NOT know how much data is available to be read from the socket. * This method returns the default value unless it exceeds the specified readLength or maxLength. * * Furthermore, the shouldPreBuffer decision is based upon the packet type, * and whether the returned value would fit in the current buffer without requiring a resize of the buffer. **/ - (NSUInteger)optimalReadLengthWithDefault:(NSUInteger)defaultValue shouldPreBuffer:(BOOL *)shouldPreBufferPtr { NSUInteger result; if (readLength > 0) { // Read a specific length of data result = MIN(defaultValue, (readLength - bytesDone)); // There is no need to prebuffer since we know exactly how much data we need to read. // Even if the buffer isn't currently big enough to fit this amount of data, // it would have to be resized eventually anyway. if (shouldPreBufferPtr) *shouldPreBufferPtr = NO; } else { // Either reading until we find a specified terminator, // or we're simply reading all available data. // // In other words, one of: // // - readDataToData packet // - readDataWithTimeout packet if (maxLength > 0) result = MIN(defaultValue, (maxLength - bytesDone)); else result = defaultValue; // Since we don't know the size of the read in advance, // the shouldPreBuffer decision is based upon whether the returned value would fit // in the current buffer without requiring a resize of the buffer. // // This is because, in all likelyhood, the amount read from the socket will be less than the default value. // Thus we should avoid over-allocating the read buffer when we can simply use the pre-buffer instead. if (shouldPreBufferPtr) { NSUInteger buffSize = [buffer length]; NSUInteger buffUsed = startOffset + bytesDone; NSUInteger buffSpace = buffSize - buffUsed; if (buffSpace >= result) *shouldPreBufferPtr = NO; else *shouldPreBufferPtr = YES; } } return result; } /** * For read packets without a set terminator, returns the amount of data * that can be read without exceeding the readLength or maxLength. * * The given parameter indicates the number of bytes estimated to be available on the socket, * which is taken into consideration during the calculation. * * The given hint MUST be greater than zero. **/ - (NSUInteger)readLengthForNonTermWithHint:(NSUInteger)bytesAvailable { NSAssert(term == nil, @"This method does not apply to term reads"); NSAssert(bytesAvailable > 0, @"Invalid parameter: bytesAvailable"); if (readLength > 0) { // Read a specific length of data return MIN(bytesAvailable, (readLength - bytesDone)); // No need to avoid resizing the buffer. // If the user provided their own buffer, // and told us to read a certain length of data that exceeds the size of the buffer, // then it is clear that our code will resize the buffer during the read operation. // // This method does not actually do any resizing. // The resizing will happen elsewhere if needed. } else { // Read all available data NSUInteger result = bytesAvailable; if (maxLength > 0) { result = MIN(result, (maxLength - bytesDone)); } // No need to avoid resizing the buffer. // If the user provided their own buffer, // and told us to read all available data without giving us a maxLength, // then it is clear that our code might resize the buffer during the read operation. // // This method does not actually do any resizing. // The resizing will happen elsewhere if needed. return result; } } /** * For read packets with a set terminator, returns the amount of data * that can be read without exceeding the maxLength. * * The given parameter indicates the number of bytes estimated to be available on the socket, * which is taken into consideration during the calculation. * * To optimize memory allocations, mem copies, and mem moves * the shouldPreBuffer boolean value will indicate if the data should be read into a prebuffer first, * or if the data can be read directly into the read packet's buffer. **/ - (NSUInteger)readLengthForTermWithHint:(NSUInteger)bytesAvailable shouldPreBuffer:(BOOL *)shouldPreBufferPtr { NSAssert(term != nil, @"This method does not apply to non-term reads"); NSAssert(bytesAvailable > 0, @"Invalid parameter: bytesAvailable"); NSUInteger result = bytesAvailable; if (maxLength > 0) { result = MIN(result, (maxLength - bytesDone)); } // Should the data be read into the read packet's buffer, or into a pre-buffer first? // // One would imagine the preferred option is the faster one. // So which one is faster? // // Reading directly into the packet's buffer requires: // 1. Possibly resizing packet buffer (malloc/realloc) // 2. Filling buffer (read) // 3. Searching for term (memcmp) // 4. Possibly copying overflow into prebuffer (malloc/realloc, memcpy) // // Reading into prebuffer first: // 1. Possibly resizing prebuffer (malloc/realloc) // 2. Filling buffer (read) // 3. Searching for term (memcmp) // 4. Copying underflow into packet buffer (malloc/realloc, memcpy) // 5. Removing underflow from prebuffer (memmove) // // Comparing the performance of the two we can see that reading // data into the prebuffer first is slower due to the extra memove. // // However: // The implementation of NSMutableData is open source via core foundation's CFMutableData. // Decreasing the length of a mutable data object doesn't cause a realloc. // In other words, the capacity of a mutable data object can grow, but doesn't shrink. // // This means the prebuffer will rarely need a realloc. // The packet buffer, on the other hand, may often need a realloc. // This is especially true if we are the buffer owner. // Furthermore, if we are constantly realloc'ing the packet buffer, // and then moving the overflow into the prebuffer, // then we're consistently over-allocating memory for each term read. // And now we get into a bit of a tradeoff between speed and memory utilization. // // The end result is that the two perform very similarly. // And we can answer the original question very simply by another means. // // If we can read all the data directly into the packet's buffer without resizing it first, // then we do so. Otherwise we use the prebuffer. if (shouldPreBufferPtr) { NSUInteger buffSize = [buffer length]; NSUInteger buffUsed = startOffset + bytesDone; if ((buffSize - buffUsed) >= result) *shouldPreBufferPtr = NO; else *shouldPreBufferPtr = YES; } return result; } /** * For read packets with a set terminator, * returns the amount of data that can be read from the given preBuffer, * without going over a terminator or the maxLength. * * It is assumed the terminator has not already been read. **/ - (NSUInteger)readLengthForTermWithPreBuffer:(GCDAsyncSocketPreBuffer *)preBuffer found:(BOOL *)foundPtr { NSAssert(term != nil, @"This method does not apply to non-term reads"); NSAssert([preBuffer availableBytes] > 0, @"Invoked with empty pre buffer!"); // We know that the terminator, as a whole, doesn't exist in our own buffer. // But it is possible that a _portion_ of it exists in our buffer. // So we're going to look for the terminator starting with a portion of our own buffer. // // Example: // // term length = 3 bytes // bytesDone = 5 bytes // preBuffer length = 5 bytes // // If we append the preBuffer to our buffer, // it would look like this: // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // --------------------- // // So we start our search here: // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // -------^-^-^--------- // // And move forwards... // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // ---------^-^-^------- // // Until we find the terminator or reach the end. // // --------------------- // |B|B|B|B|B|P|P|P|P|P| // ---------------^-^-^- BOOL found = NO; NSUInteger termLength = [term length]; NSUInteger preBufferLength = [preBuffer availableBytes]; if ((bytesDone + preBufferLength) < termLength) { // Not enough data for a full term sequence yet return preBufferLength; } NSUInteger maxPreBufferLength; if (maxLength > 0) { maxPreBufferLength = MIN(preBufferLength, (maxLength - bytesDone)); // Note: maxLength >= termLength } else { maxPreBufferLength = preBufferLength; } uint8_t seq[termLength]; const void *termBuf = [term bytes]; NSUInteger bufLen = MIN(bytesDone, (termLength - 1)); uint8_t *buf = (uint8_t *)[buffer mutableBytes] + startOffset + bytesDone - bufLen; NSUInteger preLen = termLength - bufLen; const uint8_t *pre = [preBuffer readBuffer]; NSUInteger loopCount = bufLen + maxPreBufferLength - termLength + 1; // Plus one. See example above. NSUInteger result = maxPreBufferLength; NSUInteger i; for (i = 0; i < loopCount; i++) { if (bufLen > 0) { // Combining bytes from buffer and preBuffer memcpy(seq, buf, bufLen); memcpy(seq + bufLen, pre, preLen); if (memcmp(seq, termBuf, termLength) == 0) { result = preLen; found = YES; break; } buf++; bufLen--; preLen++; } else { // Comparing directly from preBuffer if (memcmp(pre, termBuf, termLength) == 0) { NSUInteger preOffset = pre - [preBuffer readBuffer]; // pointer arithmetic result = preOffset + termLength; found = YES; break; } pre++; } } // There is no need to avoid resizing the buffer in this particular situation. if (foundPtr) *foundPtr = found; return result; } /** * For read packets with a set terminator, scans the packet buffer for the term. * It is assumed the terminator had not been fully read prior to the new bytes. * * If the term is found, the number of excess bytes after the term are returned. * If the term is not found, this method will return -1. * * Note: A return value of zero means the term was found at the very end. * * Prerequisites: * The given number of bytes have been added to the end of our buffer. * Our bytesDone variable has NOT been changed due to the prebuffered bytes. **/ - (NSInteger)searchForTermAfterPreBuffering:(ssize_t)numBytes { NSAssert(term != nil, @"This method does not apply to non-term reads"); // The implementation of this method is very similar to the above method. // See the above method for a discussion of the algorithm used here. uint8_t *buff = [buffer mutableBytes]; NSUInteger buffLength = bytesDone + numBytes; const void *termBuff = [term bytes]; NSUInteger termLength = [term length]; // Note: We are dealing with unsigned integers, // so make sure the math doesn't go below zero. NSUInteger i = ((buffLength - numBytes) >= termLength) ? (buffLength - numBytes - termLength + 1) : 0; while (i + termLength <= buffLength) { uint8_t *subBuffer = buff + startOffset + i; if (memcmp(subBuffer, termBuff, termLength) == 0) { return buffLength - (i + termLength); } i++; } return -1; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The GCDAsyncWritePacket encompasses the instructions for any given write. **/ @interface GCDAsyncWritePacket : NSObject { @public NSData *buffer; NSUInteger bytesDone; long tag; NSTimeInterval timeout; } - (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i; @end @implementation GCDAsyncWritePacket - (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i { if((self = [super init])) { buffer = d; // Retain not copy. For performance as documented in header file. bytesDone = 0; timeout = t; tag = i; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The GCDAsyncSpecialPacket encompasses special instructions for interruptions in the read/write queues. * This class my be altered to support more than just TLS in the future. **/ @interface GCDAsyncSpecialPacket : NSObject { @public NSDictionary *tlsSettings; } - (id)initWithTLSSettings:(NSDictionary *)settings; @end @implementation GCDAsyncSpecialPacket - (id)initWithTLSSettings:(NSDictionary *)settings { if((self = [super init])) { tlsSettings = [settings copy]; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @implementation GCDAsyncSocket { uint32_t flags; uint16_t config; __weak id delegate; dispatch_queue_t delegateQueue; int socket4FD; int socket6FD; int socketUN; NSURL *socketUrl; int stateIndex; NSData * connectInterface4; NSData * connectInterface6; NSData * connectInterfaceUN; dispatch_queue_t socketQueue; dispatch_source_t accept4Source; dispatch_source_t accept6Source; dispatch_source_t acceptUNSource; dispatch_source_t connectTimer; dispatch_source_t readSource; dispatch_source_t writeSource; dispatch_source_t readTimer; dispatch_source_t writeTimer; NSMutableArray *readQueue; NSMutableArray *writeQueue; GCDAsyncReadPacket *currentRead; GCDAsyncWritePacket *currentWrite; unsigned long socketFDBytesAvailable; GCDAsyncSocketPreBuffer *preBuffer; #if TARGET_OS_IPHONE CFStreamClientContext streamContext; CFReadStreamRef readStream; CFWriteStreamRef writeStream; #endif SSLContextRef sslContext; GCDAsyncSocketPreBuffer *sslPreBuffer; size_t sslWriteCachedLength; OSStatus sslErrCode; OSStatus lastSSLHandshakeError; void *IsOnSocketQueueOrTargetQueueKey; id userData; } - (id)init { return [self initWithDelegate:nil delegateQueue:NULL socketQueue:NULL]; } - (id)initWithSocketQueue:(dispatch_queue_t)sq { return [self initWithDelegate:nil delegateQueue:NULL socketQueue:sq]; } - (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq { return [self initWithDelegate:aDelegate delegateQueue:dq socketQueue:NULL]; } - (id)initWithDelegate:(id)aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq { if((self = [super init])) { delegate = aDelegate; delegateQueue = dq; #if !OS_OBJECT_USE_OBJC if (dq) dispatch_retain(dq); #endif socket4FD = SOCKET_NULL; socket6FD = SOCKET_NULL; socketUN = SOCKET_NULL; socketUrl = nil; stateIndex = 0; if (sq) { NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), @"The given socketQueue parameter must not be a concurrent queue."); NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), @"The given socketQueue parameter must not be a concurrent queue."); NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), @"The given socketQueue parameter must not be a concurrent queue."); socketQueue = sq; #if !OS_OBJECT_USE_OBJC dispatch_retain(sq); #endif } else { socketQueue = dispatch_queue_create([GCDAsyncSocketQueueName UTF8String], NULL); } // The dispatch_queue_set_specific() and dispatch_get_specific() functions take a "void *key" parameter. // From the documentation: // // > Keys are only compared as pointers and are never dereferenced. // > Thus, you can use a pointer to a static variable for a specific subsystem or // > any other value that allows you to identify the value uniquely. // // We're just going to use the memory address of an ivar. // Specifically an ivar that is explicitly named for our purpose to make the code more readable. // // However, it feels tedious (and less readable) to include the "&" all the time: // dispatch_get_specific(&IsOnSocketQueueOrTargetQueueKey) // // So we're going to make it so it doesn't matter if we use the '&' or not, // by assigning the value of the ivar to the address of the ivar. // Thus: IsOnSocketQueueOrTargetQueueKey == &IsOnSocketQueueOrTargetQueueKey; IsOnSocketQueueOrTargetQueueKey = &IsOnSocketQueueOrTargetQueueKey; void *nonNullUnusedPointer = (__bridge void *)self; dispatch_queue_set_specific(socketQueue, IsOnSocketQueueOrTargetQueueKey, nonNullUnusedPointer, NULL); readQueue = [[NSMutableArray alloc] initWithCapacity:5]; currentRead = nil; writeQueue = [[NSMutableArray alloc] initWithCapacity:5]; currentWrite = nil; preBuffer = [[GCDAsyncSocketPreBuffer alloc] initWithCapacity:(1024 * 4)]; } return self; } - (void)dealloc { LogInfo(@"%@ - %@ (start)", THIS_METHOD, self); // Set dealloc flag. // This is used by closeWithError to ensure we don't accidentally retain ourself. flags |= kDealloc; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { [self closeWithError:nil]; } else { dispatch_sync(socketQueue, ^{ [self closeWithError:nil]; }); } delegate = nil; #if !OS_OBJECT_USE_OBJC if (delegateQueue) dispatch_release(delegateQueue); #endif delegateQueue = NULL; #if !OS_OBJECT_USE_OBJC if (socketQueue) dispatch_release(socketQueue); #endif socketQueue = NULL; LogInfo(@"%@ - %@ (finish)", THIS_METHOD, self); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Configuration //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (id)delegate { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return delegate; } else { __block id result; dispatch_sync(socketQueue, ^{ result = delegate; }); return result; } } - (void)setDelegate:(id)newDelegate synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ delegate = newDelegate; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); } else { if (synchronously) dispatch_sync(socketQueue, block); else dispatch_async(socketQueue, block); } } - (void)setDelegate:(id)newDelegate { [self setDelegate:newDelegate synchronously:NO]; } - (void)synchronouslySetDelegate:(id)newDelegate { [self setDelegate:newDelegate synchronously:YES]; } - (dispatch_queue_t)delegateQueue { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return delegateQueue; } else { __block dispatch_queue_t result; dispatch_sync(socketQueue, ^{ result = delegateQueue; }); return result; } } - (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC if (delegateQueue) dispatch_release(delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); } else { if (synchronously) dispatch_sync(socketQueue, block); else dispatch_async(socketQueue, block); } } - (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegateQueue:newDelegateQueue synchronously:NO]; } - (void)synchronouslySetDelegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegateQueue:newDelegateQueue synchronously:YES]; } - (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (delegatePtr) *delegatePtr = delegate; if (delegateQueuePtr) *delegateQueuePtr = delegateQueue; } else { __block id dPtr = NULL; __block dispatch_queue_t dqPtr = NULL; dispatch_sync(socketQueue, ^{ dPtr = delegate; dqPtr = delegateQueue; }); if (delegatePtr) *delegatePtr = dPtr; if (delegateQueuePtr) *delegateQueuePtr = dqPtr; } } - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ delegate = newDelegate; #if !OS_OBJECT_USE_OBJC if (delegateQueue) dispatch_release(delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); } else { if (synchronously) dispatch_sync(socketQueue, block); else dispatch_async(socketQueue, block); } } - (void)setDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:NO]; } - (void)synchronouslySetDelegate:(id)newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:YES]; } - (BOOL)isIPv4Enabled { // Note: YES means kIPv4Disabled is OFF if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return ((config & kIPv4Disabled) == 0); } else { __block BOOL result; dispatch_sync(socketQueue, ^{ result = ((config & kIPv4Disabled) == 0); }); return result; } } - (void)setIPv4Enabled:(BOOL)flag { // Note: YES means kIPv4Disabled is OFF dispatch_block_t block = ^{ if (flag) config &= ~kIPv4Disabled; else config |= kIPv4Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (BOOL)isIPv6Enabled { // Note: YES means kIPv6Disabled is OFF if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return ((config & kIPv6Disabled) == 0); } else { __block BOOL result; dispatch_sync(socketQueue, ^{ result = ((config & kIPv6Disabled) == 0); }); return result; } } - (void)setIPv6Enabled:(BOOL)flag { // Note: YES means kIPv6Disabled is OFF dispatch_block_t block = ^{ if (flag) config &= ~kIPv6Disabled; else config |= kIPv6Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (BOOL)isIPv4PreferredOverIPv6 { // Note: YES means kPreferIPv6 is OFF if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return ((config & kPreferIPv6) == 0); } else { __block BOOL result; dispatch_sync(socketQueue, ^{ result = ((config & kPreferIPv6) == 0); }); return result; } } - (void)setIPv4PreferredOverIPv6:(BOOL)flag { // Note: YES means kPreferIPv6 is OFF dispatch_block_t block = ^{ if (flag) config &= ~kPreferIPv6; else config |= kPreferIPv6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (id)userData { __block id result = nil; dispatch_block_t block = ^{ result = userData; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setUserData:(id)arbitraryUserData { dispatch_block_t block = ^{ if (userData != arbitraryUserData) { userData = arbitraryUserData; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Accepting //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)acceptOnPort:(uint16_t)port error:(NSError **)errPtr { return [self acceptOnInterface:nil port:port error:errPtr]; } - (BOOL)acceptOnInterface:(NSString *)inInterface port:(uint16_t)port error:(NSError **)errPtr { LogTrace(); // Just in-case interface parameter is immutable. NSString *interface = [inInterface copy]; __block BOOL result = NO; __block NSError *err = nil; // CreateSocket Block // This block will be invoked within the dispatch block below. int(^createSocket)(int, NSData*) = ^int (int domain, NSData *interfaceAddr) { int socketFD = socket(domain, SOCK_STREAM, 0); if (socketFD == SOCKET_NULL) { NSString *reason = @"Error in socket() function"; err = [self errnoErrorWithReason:reason]; return SOCKET_NULL; } int status; // Set socket options status = fcntl(socketFD, F_SETFL, O_NONBLOCK); if (status == -1) { NSString *reason = @"Error enabling non-blocking IO on socket (fcntl)"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } int reuseOn = 1; status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); if (status == -1) { NSString *reason = @"Error enabling address reuse (setsockopt)"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } // Bind socket status = bind(socketFD, (const struct sockaddr *)[interfaceAddr bytes], (socklen_t)[interfaceAddr length]); if (status == -1) { NSString *reason = @"Error in bind() function"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } // Listen status = listen(socketFD, 1024); if (status == -1) { NSString *reason = @"Error in listen() function"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } return socketFD; }; // Create dispatch block and run on socketQueue dispatch_block_t block = ^{ @autoreleasepool { if (delegate == nil) // Must have delegate set { NSString *msg = @"Attempting to accept without a delegate. Set a delegate first."; err = [self badConfigError:msg]; return_from_block; } if (delegateQueue == NULL) // Must have delegate queue set { NSString *msg = @"Attempting to accept without a delegate queue. Set a delegate queue first."; err = [self badConfigError:msg]; return_from_block; } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled { NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; err = [self badConfigError:msg]; return_from_block; } if (![self isDisconnected]) // Must be disconnected { NSString *msg = @"Attempting to accept while connected or accepting connections. Disconnect first."; err = [self badConfigError:msg]; return_from_block; } // Clear queues (spurious read/write requests post disconnect) [readQueue removeAllObjects]; [writeQueue removeAllObjects]; // Resolve interface from description NSMutableData *interface4 = nil; NSMutableData *interface6 = nil; [self getInterfaceAddress4:&interface4 address6:&interface6 fromDescription:interface port:port]; if ((interface4 == nil) && (interface6 == nil)) { NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; err = [self badParamError:msg]; return_from_block; } if (isIPv4Disabled && (interface6 == nil)) { NSString *msg = @"IPv4 has been disabled and specified interface doesn't support IPv6."; err = [self badParamError:msg]; return_from_block; } if (isIPv6Disabled && (interface4 == nil)) { NSString *msg = @"IPv6 has been disabled and specified interface doesn't support IPv4."; err = [self badParamError:msg]; return_from_block; } BOOL enableIPv4 = !isIPv4Disabled && (interface4 != nil); BOOL enableIPv6 = !isIPv6Disabled && (interface6 != nil); // Create sockets, configure, bind, and listen if (enableIPv4) { LogVerbose(@"Creating IPv4 socket"); socket4FD = createSocket(AF_INET, interface4); if (socket4FD == SOCKET_NULL) { return_from_block; } } if (enableIPv6) { LogVerbose(@"Creating IPv6 socket"); if (enableIPv4 && (port == 0)) { // No specific port was specified, so we allowed the OS to pick an available port for us. // Now we need to make sure the IPv6 socket listens on the same port as the IPv4 socket. struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)[interface6 mutableBytes]; addr6->sin6_port = htons([self localPort4]); } socket6FD = createSocket(AF_INET6, interface6); if (socket6FD == SOCKET_NULL) { if (socket4FD != SOCKET_NULL) { LogVerbose(@"close(socket4FD)"); close(socket4FD); } return_from_block; } } // Create accept sources if (enableIPv4) { accept4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket4FD, 0, socketQueue); int socketFD = socket4FD; dispatch_source_t acceptSource = accept4Source; __weak GCDAsyncSocket *weakSelf = self; dispatch_source_set_event_handler(accept4Source, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; LogVerbose(@"event4Block"); unsigned long i = 0; unsigned long numPendingConnections = dispatch_source_get_data(acceptSource); LogVerbose(@"numPendingConnections: %lu", numPendingConnections); while ([strongSelf doAccept:socketFD] && (++i < numPendingConnections)); #pragma clang diagnostic pop }}); dispatch_source_set_cancel_handler(accept4Source, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(accept4Source)"); dispatch_release(acceptSource); #endif LogVerbose(@"close(socket4FD)"); close(socketFD); #pragma clang diagnostic pop }); LogVerbose(@"dispatch_resume(accept4Source)"); dispatch_resume(accept4Source); } if (enableIPv6) { accept6Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket6FD, 0, socketQueue); int socketFD = socket6FD; dispatch_source_t acceptSource = accept6Source; __weak GCDAsyncSocket *weakSelf = self; dispatch_source_set_event_handler(accept6Source, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; LogVerbose(@"event6Block"); unsigned long i = 0; unsigned long numPendingConnections = dispatch_source_get_data(acceptSource); LogVerbose(@"numPendingConnections: %lu", numPendingConnections); while ([strongSelf doAccept:socketFD] && (++i < numPendingConnections)); #pragma clang diagnostic pop }}); dispatch_source_set_cancel_handler(accept6Source, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(accept6Source)"); dispatch_release(acceptSource); #endif LogVerbose(@"close(socket6FD)"); close(socketFD); #pragma clang diagnostic pop }); LogVerbose(@"dispatch_resume(accept6Source)"); dispatch_resume(accept6Source); } flags |= kSocketStarted; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (result == NO) { LogInfo(@"Error in accept: %@", err); if (errPtr) *errPtr = err; } return result; } - (BOOL)acceptOnUrl:(NSURL *)url error:(NSError **)errPtr; { LogTrace(); __block BOOL result = NO; __block NSError *err = nil; // CreateSocket Block // This block will be invoked within the dispatch block below. int(^createSocket)(int, NSData*) = ^int (int domain, NSData *interfaceAddr) { int socketFD = socket(domain, SOCK_STREAM, 0); if (socketFD == SOCKET_NULL) { NSString *reason = @"Error in socket() function"; err = [self errnoErrorWithReason:reason]; return SOCKET_NULL; } int status; // Set socket options status = fcntl(socketFD, F_SETFL, O_NONBLOCK); if (status == -1) { NSString *reason = @"Error enabling non-blocking IO on socket (fcntl)"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } int reuseOn = 1; status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); if (status == -1) { NSString *reason = @"Error enabling address reuse (setsockopt)"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } // Bind socket status = bind(socketFD, (const struct sockaddr *)[interfaceAddr bytes], (socklen_t)[interfaceAddr length]); if (status == -1) { NSString *reason = @"Error in bind() function"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } // Listen status = listen(socketFD, 1024); if (status == -1) { NSString *reason = @"Error in listen() function"; err = [self errnoErrorWithReason:reason]; LogVerbose(@"close(socketFD)"); close(socketFD); return SOCKET_NULL; } return socketFD; }; // Create dispatch block and run on socketQueue dispatch_block_t block = ^{ @autoreleasepool { if (delegate == nil) // Must have delegate set { NSString *msg = @"Attempting to accept without a delegate. Set a delegate first."; err = [self badConfigError:msg]; return_from_block; } if (delegateQueue == NULL) // Must have delegate queue set { NSString *msg = @"Attempting to accept without a delegate queue. Set a delegate queue first."; err = [self badConfigError:msg]; return_from_block; } if (![self isDisconnected]) // Must be disconnected { NSString *msg = @"Attempting to accept while connected or accepting connections. Disconnect first."; err = [self badConfigError:msg]; return_from_block; } // Clear queues (spurious read/write requests post disconnect) [readQueue removeAllObjects]; [writeQueue removeAllObjects]; // Remove a previous socket NSError *error = nil; NSFileManager *fileManager = [NSFileManager defaultManager]; if ([fileManager fileExistsAtPath:url.path]) { if (![[NSFileManager defaultManager] removeItemAtURL:url error:&error]) { NSString *msg = @"Could not remove previous unix domain socket at given url."; err = [self otherError:msg]; return_from_block; } } // Resolve interface from description NSData *interface = [self getInterfaceAddressFromUrl:url]; if (interface == nil) { NSString *msg = @"Invalid unix domain url. Specify a valid file url that does not exist (e.g. \"file:///tmp/socket\")"; err = [self badParamError:msg]; return_from_block; } // Create sockets, configure, bind, and listen LogVerbose(@"Creating unix domain socket"); socketUN = createSocket(AF_UNIX, interface); if (socketUN == SOCKET_NULL) { return_from_block; } socketUrl = url; // Create accept sources acceptUNSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socketUN, 0, socketQueue); int socketFD = socketUN; dispatch_source_t acceptSource = acceptUNSource; dispatch_source_set_event_handler(acceptUNSource, ^{ @autoreleasepool { LogVerbose(@"eventUNBlock"); unsigned long i = 0; unsigned long numPendingConnections = dispatch_source_get_data(acceptSource); LogVerbose(@"numPendingConnections: %lu", numPendingConnections); while ([self doAccept:socketFD] && (++i < numPendingConnections)); }}); dispatch_source_set_cancel_handler(acceptUNSource, ^{ #if NEEDS_DISPATCH_RETAIN_RELEASE LogVerbose(@"dispatch_release(accept4Source)"); dispatch_release(acceptSource); #endif LogVerbose(@"close(socket4FD)"); close(socketFD); }); LogVerbose(@"dispatch_resume(accept4Source)"); dispatch_resume(acceptUNSource); flags |= kSocketStarted; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (result == NO) { LogInfo(@"Error in accept: %@", err); if (errPtr) *errPtr = err; } return result; } - (BOOL)doAccept:(int)parentSocketFD { LogTrace(); int socketType; int childSocketFD; NSData *childSocketAddress; if (parentSocketFD == socket4FD) { socketType = 0; struct sockaddr_in addr; socklen_t addrLen = sizeof(addr); childSocketFD = accept(parentSocketFD, (struct sockaddr *)&addr, &addrLen); if (childSocketFD == -1) { LogWarn(@"Accept failed with error: %@", [self errnoError]); return NO; } childSocketAddress = [NSData dataWithBytes:&addr length:addrLen]; } else if (parentSocketFD == socket6FD) { socketType = 1; struct sockaddr_in6 addr; socklen_t addrLen = sizeof(addr); childSocketFD = accept(parentSocketFD, (struct sockaddr *)&addr, &addrLen); if (childSocketFD == -1) { LogWarn(@"Accept failed with error: %@", [self errnoError]); return NO; } childSocketAddress = [NSData dataWithBytes:&addr length:addrLen]; } else // if (parentSocketFD == socketUN) { socketType = 2; struct sockaddr_un addr; socklen_t addrLen = sizeof(addr); childSocketFD = accept(parentSocketFD, (struct sockaddr *)&addr, &addrLen); if (childSocketFD == -1) { LogWarn(@"Accept failed with error: %@", [self errnoError]); return NO; } childSocketAddress = [NSData dataWithBytes:&addr length:addrLen]; } // Enable non-blocking IO on the socket int result = fcntl(childSocketFD, F_SETFL, O_NONBLOCK); if (result == -1) { LogWarn(@"Error enabling non-blocking IO on accepted socket (fcntl)"); return NO; } // Prevent SIGPIPE signals int nosigpipe = 1; setsockopt(childSocketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); // Notify delegate if (delegateQueue) { __strong id theDelegate = delegate; dispatch_async(delegateQueue, ^{ @autoreleasepool { // Query delegate for custom socket queue dispatch_queue_t childSocketQueue = NULL; if ([theDelegate respondsToSelector:@selector(newSocketQueueForConnectionFromAddress:onSocket:)]) { childSocketQueue = [theDelegate newSocketQueueForConnectionFromAddress:childSocketAddress onSocket:self]; } // Create GCDAsyncSocket instance for accepted socket GCDAsyncSocket *acceptedSocket = [[[self class] alloc] initWithDelegate:theDelegate delegateQueue:delegateQueue socketQueue:childSocketQueue]; if (socketType == 0) acceptedSocket->socket4FD = childSocketFD; else if (socketType == 1) acceptedSocket->socket6FD = childSocketFD; else acceptedSocket->socketUN = childSocketFD; acceptedSocket->flags = (kSocketStarted | kConnected); // Setup read and write sources for accepted socket dispatch_async(acceptedSocket->socketQueue, ^{ @autoreleasepool { [acceptedSocket setupReadAndWriteSourcesForNewlyConnectedSocket:childSocketFD]; }}); // Notify delegate if ([theDelegate respondsToSelector:@selector(socket:didAcceptNewSocket:)]) { [theDelegate socket:self didAcceptNewSocket:acceptedSocket]; } // Release the socket queue returned from the delegate (it was retained by acceptedSocket) #if !OS_OBJECT_USE_OBJC if (childSocketQueue) dispatch_release(childSocketQueue); #endif // The accepted socket should have been retained by the delegate. // Otherwise it gets properly released when exiting the block. }}); } return YES; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Connecting //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * This method runs through the various checks required prior to a connection attempt. * It is shared between the connectToHost and connectToAddress methods. * **/ - (BOOL)preConnectWithInterface:(NSString *)interface error:(NSError **)errPtr { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (delegate == nil) // Must have delegate set { if (errPtr) { NSString *msg = @"Attempting to connect without a delegate. Set a delegate first."; *errPtr = [self badConfigError:msg]; } return NO; } if (delegateQueue == NULL) // Must have delegate queue set { if (errPtr) { NSString *msg = @"Attempting to connect without a delegate queue. Set a delegate queue first."; *errPtr = [self badConfigError:msg]; } return NO; } if (![self isDisconnected]) // Must be disconnected { if (errPtr) { NSString *msg = @"Attempting to connect while connected or accepting connections. Disconnect first."; *errPtr = [self badConfigError:msg]; } return NO; } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled { if (errPtr) { NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; *errPtr = [self badConfigError:msg]; } return NO; } if (interface) { NSMutableData *interface4 = nil; NSMutableData *interface6 = nil; [self getInterfaceAddress4:&interface4 address6:&interface6 fromDescription:interface port:0]; if ((interface4 == nil) && (interface6 == nil)) { if (errPtr) { NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; *errPtr = [self badParamError:msg]; } return NO; } if (isIPv4Disabled && (interface6 == nil)) { if (errPtr) { NSString *msg = @"IPv4 has been disabled and specified interface doesn't support IPv6."; *errPtr = [self badParamError:msg]; } return NO; } if (isIPv6Disabled && (interface4 == nil)) { if (errPtr) { NSString *msg = @"IPv6 has been disabled and specified interface doesn't support IPv4."; *errPtr = [self badParamError:msg]; } return NO; } connectInterface4 = interface4; connectInterface6 = interface6; } // Clear queues (spurious read/write requests post disconnect) [readQueue removeAllObjects]; [writeQueue removeAllObjects]; return YES; } - (BOOL)preConnectWithUrl:(NSURL *)url error:(NSError **)errPtr { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (delegate == nil) // Must have delegate set { if (errPtr) { NSString *msg = @"Attempting to connect without a delegate. Set a delegate first."; *errPtr = [self badConfigError:msg]; } return NO; } if (delegateQueue == NULL) // Must have delegate queue set { if (errPtr) { NSString *msg = @"Attempting to connect without a delegate queue. Set a delegate queue first."; *errPtr = [self badConfigError:msg]; } return NO; } if (![self isDisconnected]) // Must be disconnected { if (errPtr) { NSString *msg = @"Attempting to connect while connected or accepting connections. Disconnect first."; *errPtr = [self badConfigError:msg]; } return NO; } NSData *interface = [self getInterfaceAddressFromUrl:url]; if (interface == nil) { if (errPtr) { NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; *errPtr = [self badParamError:msg]; } return NO; } connectInterfaceUN = interface; // Clear queues (spurious read/write requests post disconnect) [readQueue removeAllObjects]; [writeQueue removeAllObjects]; return YES; } - (BOOL)connectToHost:(NSString*)host onPort:(uint16_t)port error:(NSError **)errPtr { return [self connectToHost:host onPort:port withTimeout:-1 error:errPtr]; } - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { return [self connectToHost:host onPort:port viaInterface:nil withTimeout:timeout error:errPtr]; } - (BOOL)connectToHost:(NSString *)inHost onPort:(uint16_t)port viaInterface:(NSString *)inInterface withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { LogTrace(); // Just in case immutable objects were passed NSString *host = [inHost copy]; NSString *interface = [inInterface copy]; __block BOOL result = NO; __block NSError *preConnectErr = nil; dispatch_block_t block = ^{ @autoreleasepool { // Check for problems with host parameter if ([host length] == 0) { NSString *msg = @"Invalid host parameter (nil or \"\"). Should be a domain name or IP address string."; preConnectErr = [self badParamError:msg]; return_from_block; } // Run through standard pre-connect checks if (![self preConnectWithInterface:interface error:&preConnectErr]) { return_from_block; } // We've made it past all the checks. // It's time to start the connection process. flags |= kSocketStarted; LogVerbose(@"Dispatching DNS lookup..."); // It's possible that the given host parameter is actually a NSMutableString. // So we want to copy it now, within this block that will be executed synchronously. // This way the asynchronous lookup block below doesn't have to worry about it changing. NSString *hostCpy = [host copy]; int aStateIndex = stateIndex; __weak GCDAsyncSocket *weakSelf = self; dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(globalConcurrentQueue, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" NSError *lookupErr = nil; NSMutableArray *addresses = [GCDAsyncSocket lookupHost:hostCpy port:port error:&lookupErr]; __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; if (lookupErr) { dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { [strongSelf lookup:aStateIndex didFail:lookupErr]; }}); } else { NSData *address4 = nil; NSData *address6 = nil; for (NSData *address in addresses) { if (!address4 && [GCDAsyncSocket isIPv4Address:address]) { address4 = address; } else if (!address6 && [GCDAsyncSocket isIPv6Address:address]) { address6 = address; } } dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { [strongSelf lookup:aStateIndex didSucceedWithAddress4:address4 address6:address6]; }}); } #pragma clang diagnostic pop }}); [self startConnectTimeout:timeout]; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (errPtr) *errPtr = preConnectErr; return result; } - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr { return [self connectToAddress:remoteAddr viaInterface:nil withTimeout:-1 error:errPtr]; } - (BOOL)connectToAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { return [self connectToAddress:remoteAddr viaInterface:nil withTimeout:timeout error:errPtr]; } - (BOOL)connectToAddress:(NSData *)inRemoteAddr viaInterface:(NSString *)inInterface withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr { LogTrace(); // Just in case immutable objects were passed NSData *remoteAddr = [inRemoteAddr copy]; NSString *interface = [inInterface copy]; __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Check for problems with remoteAddr parameter NSData *address4 = nil; NSData *address6 = nil; if ([remoteAddr length] >= sizeof(struct sockaddr)) { const struct sockaddr *sockaddr = (const struct sockaddr *)[remoteAddr bytes]; if (sockaddr->sa_family == AF_INET) { if ([remoteAddr length] == sizeof(struct sockaddr_in)) { address4 = remoteAddr; } } else if (sockaddr->sa_family == AF_INET6) { if ([remoteAddr length] == sizeof(struct sockaddr_in6)) { address6 = remoteAddr; } } } if ((address4 == nil) && (address6 == nil)) { NSString *msg = @"A valid IPv4 or IPv6 address was not given"; err = [self badParamError:msg]; return_from_block; } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && (address4 != nil)) { NSString *msg = @"IPv4 has been disabled and an IPv4 address was passed."; err = [self badParamError:msg]; return_from_block; } if (isIPv6Disabled && (address6 != nil)) { NSString *msg = @"IPv6 has been disabled and an IPv6 address was passed."; err = [self badParamError:msg]; return_from_block; } // Run through standard pre-connect checks if (![self preConnectWithInterface:interface error:&err]) { return_from_block; } // We've made it past all the checks. // It's time to start the connection process. if (![self connectWithAddress4:address4 address6:address6 error:&err]) { return_from_block; } flags |= kSocketStarted; [self startConnectTimeout:timeout]; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (result == NO) { if (errPtr) *errPtr = err; } return result; } - (BOOL)connectToUrl:(NSURL *)url withTimeout:(NSTimeInterval)timeout error:(NSError **)errPtr; { LogTrace(); __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Check for problems with host parameter if ([url.path length] == 0) { NSString *msg = @"Invalid unix domain socket url."; err = [self badParamError:msg]; return_from_block; } // Run through standard pre-connect checks if (![self preConnectWithUrl:url error:&err]) { return_from_block; } // We've made it past all the checks. // It's time to start the connection process. flags |= kSocketStarted; // Start the normal connection process NSError *err = nil; if (![self connectWithAddressUN:connectInterfaceUN error:&err]) { [self closeWithError:err]; return_from_block; } [self startConnectTimeout:timeout]; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (result == NO) { if (errPtr) *errPtr = err; } return result; } - (void)lookup:(int)aStateIndex didSucceedWithAddress4:(NSData *)address4 address6:(NSData *)address6 { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(address4 || address6, @"Expected at least one valid address"); if (aStateIndex != stateIndex) { LogInfo(@"Ignoring lookupDidSucceed, already disconnected"); // The connect operation has been cancelled. // That is, socket was disconnected, or connection has already timed out. return; } // Check for problems BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && (address6 == nil)) { NSString *msg = @"IPv4 has been disabled and DNS lookup found no IPv6 address."; [self closeWithError:[self otherError:msg]]; return; } if (isIPv6Disabled && (address4 == nil)) { NSString *msg = @"IPv6 has been disabled and DNS lookup found no IPv4 address."; [self closeWithError:[self otherError:msg]]; return; } // Start the normal connection process NSError *err = nil; if (![self connectWithAddress4:address4 address6:address6 error:&err]) { [self closeWithError:err]; } } /** * This method is called if the DNS lookup fails. * This method is executed on the socketQueue. * * Since the DNS lookup executed synchronously on a global concurrent queue, * the original connection request may have already been cancelled or timed-out by the time this method is invoked. * The lookupIndex tells us whether the lookup is still valid or not. **/ - (void)lookup:(int)aStateIndex didFail:(NSError *)error { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (aStateIndex != stateIndex) { LogInfo(@"Ignoring lookup:didFail: - already disconnected"); // The connect operation has been cancelled. // That is, socket was disconnected, or connection has already timed out. return; } [self endConnectTimeout]; [self closeWithError:error]; } - (BOOL)connectWithAddress4:(NSData *)address4 address6:(NSData *)address6 error:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); LogVerbose(@"IPv4: %@:%hu", [[self class] hostFromAddress:address4], [[self class] portFromAddress:address4]); LogVerbose(@"IPv6: %@:%hu", [[self class] hostFromAddress:address6], [[self class] portFromAddress:address6]); // Determine socket type BOOL preferIPv6 = (config & kPreferIPv6) ? YES : NO; BOOL useIPv6 = ((preferIPv6 && address6) || (address4 == nil)); // Create the socket int socketFD; NSData *address; NSData *connectInterface; if (useIPv6) { LogVerbose(@"Creating IPv6 socket"); socket6FD = socket(AF_INET6, SOCK_STREAM, 0); socketFD = socket6FD; address = address6; connectInterface = connectInterface6; } else { LogVerbose(@"Creating IPv4 socket"); socket4FD = socket(AF_INET, SOCK_STREAM, 0); socketFD = socket4FD; address = address4; connectInterface = connectInterface4; } if (socketFD == SOCKET_NULL) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error in socket() function"]; return NO; } // Bind the socket to the desired interface (if needed) if (connectInterface) { LogVerbose(@"Binding socket..."); if ([[self class] portFromAddress:connectInterface] > 0) { // Since we're going to be binding to a specific port, // we should turn on reuseaddr to allow us to override sockets in time_wait. int reuseOn = 1; setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); } const struct sockaddr *interfaceAddr = (const struct sockaddr *)[connectInterface bytes]; int result = bind(socketFD, interfaceAddr, (socklen_t)[connectInterface length]); if (result != 0) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error in bind() function"]; return NO; } } // Prevent SIGPIPE signals int nosigpipe = 1; setsockopt(socketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); // Start the connection process in a background queue int aStateIndex = stateIndex; __weak GCDAsyncSocket *weakSelf = self; dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(globalConcurrentQueue, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" int result = connect(socketFD, (const struct sockaddr *)[address bytes], (socklen_t)[address length]); __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; if (result == 0) { dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { [strongSelf didConnect:aStateIndex]; }}); } else { NSError *error = [strongSelf errnoErrorWithReason:@"Error in connect() function"]; dispatch_async(strongSelf->socketQueue, ^{ @autoreleasepool { [strongSelf didNotConnect:aStateIndex error:error]; }}); } #pragma clang diagnostic pop }); LogVerbose(@"Connecting..."); return YES; } - (BOOL)connectWithAddressUN:(NSData *)address error:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); // Create the socket int socketFD; LogVerbose(@"Creating unix domain socket"); socketUN = socket(AF_UNIX, SOCK_STREAM, 0); socketFD = socketUN; if (socketFD == SOCKET_NULL) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error in socket() function"]; return NO; } // Bind the socket to the desired interface (if needed) LogVerbose(@"Binding socket..."); int reuseOn = 1; setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseOn, sizeof(reuseOn)); // const struct sockaddr *interfaceAddr = (const struct sockaddr *)[address bytes]; // // int result = bind(socketFD, interfaceAddr, (socklen_t)[address length]); // if (result != 0) // { // if (errPtr) // *errPtr = [self errnoErrorWithReason:@"Error in bind() function"]; // // return NO; // } // Prevent SIGPIPE signals int nosigpipe = 1; setsockopt(socketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); // Start the connection process in a background queue int aStateIndex = stateIndex; dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(globalConcurrentQueue, ^{ const struct sockaddr *addr = (const struct sockaddr *)[address bytes]; int result = connect(socketFD, addr, addr->sa_len); if (result == 0) { dispatch_async(socketQueue, ^{ @autoreleasepool { [self didConnect:aStateIndex]; }}); } else { // TODO: Bad file descriptor perror("connect"); NSError *error = [self errnoErrorWithReason:@"Error in connect() function"]; dispatch_async(socketQueue, ^{ @autoreleasepool { [self didNotConnect:aStateIndex error:error]; }}); } }); LogVerbose(@"Connecting..."); return YES; } - (void)didConnect:(int)aStateIndex { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (aStateIndex != stateIndex) { LogInfo(@"Ignoring didConnect, already disconnected"); // The connect operation has been cancelled. // That is, socket was disconnected, or connection has already timed out. return; } flags |= kConnected; [self endConnectTimeout]; #if TARGET_OS_IPHONE // The endConnectTimeout method executed above incremented the stateIndex. aStateIndex = stateIndex; #endif // Setup read/write streams (as workaround for specific shortcomings in the iOS platform) // // Note: // There may be configuration options that must be set by the delegate before opening the streams. // The primary example is the kCFStreamNetworkServiceTypeVoIP flag, which only works on an unopened stream. // // Thus we wait until after the socket:didConnectToHost:port: delegate method has completed. // This gives the delegate time to properly configure the streams if needed. dispatch_block_t SetupStreamsPart1 = ^{ #if TARGET_OS_IPHONE if (![self createReadAndWriteStream]) { [self closeWithError:[self otherError:@"Error creating CFStreams"]]; return; } if (![self registerForStreamCallbacksIncludingReadWrite:NO]) { [self closeWithError:[self otherError:@"Error in CFStreamSetClient"]]; return; } #endif }; dispatch_block_t SetupStreamsPart2 = ^{ #if TARGET_OS_IPHONE if (aStateIndex != stateIndex) { // The socket has been disconnected. return; } if (![self addStreamsToRunLoop]) { [self closeWithError:[self otherError:@"Error in CFStreamScheduleWithRunLoop"]]; return; } if (![self openStreams]) { [self closeWithError:[self otherError:@"Error creating CFStreams"]]; return; } #endif }; // Notify delegate NSString *host = [self connectedHost]; uint16_t port = [self connectedPort]; NSURL *url = [self connectedUrl]; __strong id theDelegate = delegate; if (delegateQueue && host != nil && [theDelegate respondsToSelector:@selector(socket:didConnectToHost:port:)]) { SetupStreamsPart1(); dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didConnectToHost:host port:port]; dispatch_async(socketQueue, ^{ @autoreleasepool { SetupStreamsPart2(); }}); }}); } else if (delegateQueue && url != nil && [theDelegate respondsToSelector:@selector(socket:didConnectToUrl:)]) { SetupStreamsPart1(); dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didConnectToUrl:url]; dispatch_async(socketQueue, ^{ @autoreleasepool { SetupStreamsPart2(); }}); }}); } else { SetupStreamsPart1(); SetupStreamsPart2(); } // Get the connected socket int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; // Enable non-blocking IO on the socket int result = fcntl(socketFD, F_SETFL, O_NONBLOCK); if (result == -1) { NSString *errMsg = @"Error enabling non-blocking IO on socket (fcntl)"; [self closeWithError:[self otherError:errMsg]]; return; } // Setup our read/write sources [self setupReadAndWriteSourcesForNewlyConnectedSocket:socketFD]; // Dequeue any pending read/write requests [self maybeDequeueRead]; [self maybeDequeueWrite]; } - (void)didNotConnect:(int)aStateIndex error:(NSError *)error { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (aStateIndex != stateIndex) { LogInfo(@"Ignoring didNotConnect, already disconnected"); // The connect operation has been cancelled. // That is, socket was disconnected, or connection has already timed out. return; } [self closeWithError:error]; } - (void)startConnectTimeout:(NSTimeInterval)timeout { if (timeout >= 0.0) { connectTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); __weak GCDAsyncSocket *weakSelf = self; dispatch_source_set_event_handler(connectTimer, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; [strongSelf doConnectTimeout]; #pragma clang diagnostic pop }}); #if !OS_OBJECT_USE_OBJC dispatch_source_t theConnectTimer = connectTimer; dispatch_source_set_cancel_handler(connectTimer, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" LogVerbose(@"dispatch_release(connectTimer)"); dispatch_release(theConnectTimer); #pragma clang diagnostic pop }); #endif dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); dispatch_source_set_timer(connectTimer, tt, DISPATCH_TIME_FOREVER, 0); dispatch_resume(connectTimer); } } - (void)endConnectTimeout { LogTrace(); if (connectTimer) { dispatch_source_cancel(connectTimer); connectTimer = NULL; } // Increment stateIndex. // This will prevent us from processing results from any related background asynchronous operations. // // Note: This should be called from close method even if connectTimer is NULL. // This is because one might disconnect a socket prior to a successful connection which had no timeout. stateIndex++; if (connectInterface4) { connectInterface4 = nil; } if (connectInterface6) { connectInterface6 = nil; } } - (void)doConnectTimeout { LogTrace(); [self endConnectTimeout]; [self closeWithError:[self connectTimeoutError]]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Disconnecting //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)closeWithError:(NSError *)error { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); [self endConnectTimeout]; if (currentRead != nil) [self endCurrentRead]; if (currentWrite != nil) [self endCurrentWrite]; [readQueue removeAllObjects]; [writeQueue removeAllObjects]; [preBuffer reset]; #if TARGET_OS_IPHONE { if (readStream || writeStream) { [self removeStreamsFromRunLoop]; if (readStream) { CFReadStreamSetClient(readStream, kCFStreamEventNone, NULL, NULL); CFReadStreamClose(readStream); CFRelease(readStream); readStream = NULL; } if (writeStream) { CFWriteStreamSetClient(writeStream, kCFStreamEventNone, NULL, NULL); CFWriteStreamClose(writeStream); CFRelease(writeStream); writeStream = NULL; } } } #endif [sslPreBuffer reset]; sslErrCode = lastSSLHandshakeError = noErr; if (sslContext) { // Getting a linker error here about the SSLx() functions? // You need to add the Security Framework to your application. SSLClose(sslContext); #if TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) CFRelease(sslContext); #else SSLDisposeContext(sslContext); #endif sslContext = NULL; } // For some crazy reason (in my opinion), cancelling a dispatch source doesn't // invoke the cancel handler if the dispatch source is paused. // So we have to unpause the source if needed. // This allows the cancel handler to be run, which in turn releases the source and closes the socket. if (!accept4Source && !accept6Source && !acceptUNSource && !readSource && !writeSource) { LogVerbose(@"manually closing close"); if (socket4FD != SOCKET_NULL) { LogVerbose(@"close(socket4FD)"); close(socket4FD); socket4FD = SOCKET_NULL; } if (socket6FD != SOCKET_NULL) { LogVerbose(@"close(socket6FD)"); close(socket6FD); socket6FD = SOCKET_NULL; } if (socketUN != SOCKET_NULL) { LogVerbose(@"close(socketUN)"); close(socketUN); socketUN = SOCKET_NULL; unlink(socketUrl.path.fileSystemRepresentation); socketUrl = nil; } } else { if (accept4Source) { LogVerbose(@"dispatch_source_cancel(accept4Source)"); dispatch_source_cancel(accept4Source); // We never suspend accept4Source accept4Source = NULL; } if (accept6Source) { LogVerbose(@"dispatch_source_cancel(accept6Source)"); dispatch_source_cancel(accept6Source); // We never suspend accept6Source accept6Source = NULL; } if (acceptUNSource) { LogVerbose(@"dispatch_source_cancel(acceptUNSource)"); dispatch_source_cancel(acceptUNSource); // We never suspend acceptUNSource acceptUNSource = NULL; } if (readSource) { LogVerbose(@"dispatch_source_cancel(readSource)"); dispatch_source_cancel(readSource); [self resumeReadSource]; readSource = NULL; } if (writeSource) { LogVerbose(@"dispatch_source_cancel(writeSource)"); dispatch_source_cancel(writeSource); [self resumeWriteSource]; writeSource = NULL; } // The sockets will be closed by the cancel handlers of the corresponding source socket4FD = SOCKET_NULL; socket6FD = SOCKET_NULL; socketUN = SOCKET_NULL; } // If the client has passed the connect/accept method, then the connection has at least begun. // Notify delegate that it is now ending. BOOL shouldCallDelegate = (flags & kSocketStarted) ? YES : NO; BOOL isDeallocating = (flags & kDealloc) ? YES : NO; // Clear stored socket info and all flags (config remains as is) socketFDBytesAvailable = 0; flags = 0; sslWriteCachedLength = 0; if (shouldCallDelegate) { __strong id theDelegate = delegate; __strong id theSelf = isDeallocating ? nil : self; if (delegateQueue && [theDelegate respondsToSelector: @selector(socketDidDisconnect:withError:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socketDidDisconnect:theSelf withError:error]; }}); } } } - (void)disconnect { dispatch_block_t block = ^{ @autoreleasepool { if (flags & kSocketStarted) { [self closeWithError:nil]; } }}; // Synchronous disconnection, as documented in the header file if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); } - (void)disconnectAfterReading { dispatch_async(socketQueue, ^{ @autoreleasepool { if (flags & kSocketStarted) { flags |= (kForbidReadsWrites | kDisconnectAfterReads); [self maybeClose]; } }}); } - (void)disconnectAfterWriting { dispatch_async(socketQueue, ^{ @autoreleasepool { if (flags & kSocketStarted) { flags |= (kForbidReadsWrites | kDisconnectAfterWrites); [self maybeClose]; } }}); } - (void)disconnectAfterReadingAndWriting { dispatch_async(socketQueue, ^{ @autoreleasepool { if (flags & kSocketStarted) { flags |= (kForbidReadsWrites | kDisconnectAfterReads | kDisconnectAfterWrites); [self maybeClose]; } }}); } /** * Closes the socket if possible. * That is, if all writes have completed, and we're set to disconnect after writing, * or if all reads have completed, and we're set to disconnect after reading. **/ - (void)maybeClose { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); BOOL shouldClose = NO; if (flags & kDisconnectAfterReads) { if (([readQueue count] == 0) && (currentRead == nil)) { if (flags & kDisconnectAfterWrites) { if (([writeQueue count] == 0) && (currentWrite == nil)) { shouldClose = YES; } } else { shouldClose = YES; } } } else if (flags & kDisconnectAfterWrites) { if (([writeQueue count] == 0) && (currentWrite == nil)) { shouldClose = YES; } } if (shouldClose) { [self closeWithError:nil]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Errors //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (NSError *)badConfigError:(NSString *)errMsg { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketBadConfigError userInfo:userInfo]; } - (NSError *)badParamError:(NSString *)errMsg { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketBadParamError userInfo:userInfo]; } + (NSError *)gaiError:(int)gai_error { NSString *errMsg = [NSString stringWithCString:gai_strerror(gai_error) encoding:NSASCIIStringEncoding]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:gai_error userInfo:userInfo]; } - (NSError *)errnoErrorWithReason:(NSString *)reason { NSString *errMsg = [NSString stringWithUTF8String:strerror(errno)]; NSDictionary *userInfo = [NSDictionary dictionaryWithObjectsAndKeys:errMsg, NSLocalizedDescriptionKey, reason, NSLocalizedFailureReasonErrorKey, nil]; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } - (NSError *)errnoError { NSString *errMsg = [NSString stringWithUTF8String:strerror(errno)]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } - (NSError *)sslError:(OSStatus)ssl_error { NSString *msg = @"Error code definition can be found in Apple's SecureTransport.h"; NSDictionary *userInfo = [NSDictionary dictionaryWithObject:msg forKey:NSLocalizedRecoverySuggestionErrorKey]; return [NSError errorWithDomain:@"kCFStreamErrorDomainSSL" code:ssl_error userInfo:userInfo]; } - (NSError *)connectTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketConnectTimeoutError", @"GCDAsyncSocket", [NSBundle mainBundle], @"Attempt to connect to host timed out", nil); NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketConnectTimeoutError userInfo:userInfo]; } /** * Returns a standard AsyncSocket maxed out error. **/ - (NSError *)readMaxedOutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketReadMaxedOutError", @"GCDAsyncSocket", [NSBundle mainBundle], @"Read operation reached set maximum length", nil); NSDictionary *info = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketReadMaxedOutError userInfo:info]; } /** * Returns a standard AsyncSocket write timeout error. **/ - (NSError *)readTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketReadTimeoutError", @"GCDAsyncSocket", [NSBundle mainBundle], @"Read operation timed out", nil); NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketReadTimeoutError userInfo:userInfo]; } /** * Returns a standard AsyncSocket write timeout error. **/ - (NSError *)writeTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketWriteTimeoutError", @"GCDAsyncSocket", [NSBundle mainBundle], @"Write operation timed out", nil); NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketWriteTimeoutError userInfo:userInfo]; } - (NSError *)connectionClosedError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncSocketClosedError", @"GCDAsyncSocket", [NSBundle mainBundle], @"Socket closed by remote peer", nil); NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketClosedError userInfo:userInfo]; } - (NSError *)otherError:(NSString *)errMsg { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncSocketErrorDomain code:GCDAsyncSocketOtherError userInfo:userInfo]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Diagnostics //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)isDisconnected { __block BOOL result = NO; dispatch_block_t block = ^{ result = (flags & kSocketStarted) ? NO : YES; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isConnected { __block BOOL result = NO; dispatch_block_t block = ^{ result = (flags & kConnected) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (NSString *)connectedHost { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (socket4FD != SOCKET_NULL) return [self connectedHostFromSocket4:socket4FD]; if (socket6FD != SOCKET_NULL) return [self connectedHostFromSocket6:socket6FD]; return nil; } else { __block NSString *result = nil; dispatch_sync(socketQueue, ^{ @autoreleasepool { if (socket4FD != SOCKET_NULL) result = [self connectedHostFromSocket4:socket4FD]; else if (socket6FD != SOCKET_NULL) result = [self connectedHostFromSocket6:socket6FD]; }}); return result; } } - (uint16_t)connectedPort { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (socket4FD != SOCKET_NULL) return [self connectedPortFromSocket4:socket4FD]; if (socket6FD != SOCKET_NULL) return [self connectedPortFromSocket6:socket6FD]; return 0; } else { __block uint16_t result = 0; dispatch_sync(socketQueue, ^{ // No need for autorelease pool if (socket4FD != SOCKET_NULL) result = [self connectedPortFromSocket4:socket4FD]; else if (socket6FD != SOCKET_NULL) result = [self connectedPortFromSocket6:socket6FD]; }); return result; } } - (NSURL *)connectedUrl { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (socketUN != SOCKET_NULL) return [self connectedUrlFromSocketUN:socketUN]; return nil; } else { __block NSURL *result = nil; dispatch_sync(socketQueue, ^{ @autoreleasepool { if (socketUN != SOCKET_NULL) result = [self connectedUrlFromSocketUN:socketUN]; }}); return result; } } - (NSString *)localHost { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (socket4FD != SOCKET_NULL) return [self localHostFromSocket4:socket4FD]; if (socket6FD != SOCKET_NULL) return [self localHostFromSocket6:socket6FD]; return nil; } else { __block NSString *result = nil; dispatch_sync(socketQueue, ^{ @autoreleasepool { if (socket4FD != SOCKET_NULL) result = [self localHostFromSocket4:socket4FD]; else if (socket6FD != SOCKET_NULL) result = [self localHostFromSocket6:socket6FD]; }}); return result; } } - (uint16_t)localPort { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (socket4FD != SOCKET_NULL) return [self localPortFromSocket4:socket4FD]; if (socket6FD != SOCKET_NULL) return [self localPortFromSocket6:socket6FD]; return 0; } else { __block uint16_t result = 0; dispatch_sync(socketQueue, ^{ // No need for autorelease pool if (socket4FD != SOCKET_NULL) result = [self localPortFromSocket4:socket4FD]; else if (socket6FD != SOCKET_NULL) result = [self localPortFromSocket6:socket6FD]; }); return result; } } - (NSString *)connectedHost4 { if (socket4FD != SOCKET_NULL) return [self connectedHostFromSocket4:socket4FD]; return nil; } - (NSString *)connectedHost6 { if (socket6FD != SOCKET_NULL) return [self connectedHostFromSocket6:socket6FD]; return nil; } - (uint16_t)connectedPort4 { if (socket4FD != SOCKET_NULL) return [self connectedPortFromSocket4:socket4FD]; return 0; } - (uint16_t)connectedPort6 { if (socket6FD != SOCKET_NULL) return [self connectedPortFromSocket6:socket6FD]; return 0; } - (NSString *)localHost4 { if (socket4FD != SOCKET_NULL) return [self localHostFromSocket4:socket4FD]; return nil; } - (NSString *)localHost6 { if (socket6FD != SOCKET_NULL) return [self localHostFromSocket6:socket6FD]; return nil; } - (uint16_t)localPort4 { if (socket4FD != SOCKET_NULL) return [self localPortFromSocket4:socket4FD]; return 0; } - (uint16_t)localPort6 { if (socket6FD != SOCKET_NULL) return [self localPortFromSocket6:socket6FD]; return 0; } - (NSString *)connectedHostFromSocket4:(int)socketFD { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getpeername(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return nil; } return [[self class] hostFromSockaddr4:&sockaddr4]; } - (NSString *)connectedHostFromSocket6:(int)socketFD { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getpeername(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return nil; } return [[self class] hostFromSockaddr6:&sockaddr6]; } - (uint16_t)connectedPortFromSocket4:(int)socketFD { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getpeername(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return 0; } return [[self class] portFromSockaddr4:&sockaddr4]; } - (uint16_t)connectedPortFromSocket6:(int)socketFD { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getpeername(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return 0; } return [[self class] portFromSockaddr6:&sockaddr6]; } - (NSURL *)connectedUrlFromSocketUN:(int)socketFD { struct sockaddr_un sockaddr; socklen_t sockaddrlen = sizeof(sockaddr); if (getpeername(socketFD, (struct sockaddr *)&sockaddr, &sockaddrlen) < 0) { return 0; } return [[self class] urlFromSockaddrUN:&sockaddr]; } - (NSString *)localHostFromSocket4:(int)socketFD { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getsockname(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return nil; } return [[self class] hostFromSockaddr4:&sockaddr4]; } - (NSString *)localHostFromSocket6:(int)socketFD { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getsockname(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return nil; } return [[self class] hostFromSockaddr6:&sockaddr6]; } - (uint16_t)localPortFromSocket4:(int)socketFD { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getsockname(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) < 0) { return 0; } return [[self class] portFromSockaddr4:&sockaddr4]; } - (uint16_t)localPortFromSocket6:(int)socketFD { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getsockname(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) < 0) { return 0; } return [[self class] portFromSockaddr6:&sockaddr6]; } - (NSData *)connectedAddress { __block NSData *result = nil; dispatch_block_t block = ^{ if (socket4FD != SOCKET_NULL) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getpeername(socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr4 length:sockaddr4len]; } } if (socket6FD != SOCKET_NULL) { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getpeername(socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr6 length:sockaddr6len]; } } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (NSData *)localAddress { __block NSData *result = nil; dispatch_block_t block = ^{ if (socket4FD != SOCKET_NULL) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getsockname(socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr4 length:sockaddr4len]; } } if (socket6FD != SOCKET_NULL) { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getsockname(socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) { result = [[NSData alloc] initWithBytes:&sockaddr6 length:sockaddr6len]; } } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isIPv4 { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return (socket4FD != SOCKET_NULL); } else { __block BOOL result = NO; dispatch_sync(socketQueue, ^{ result = (socket4FD != SOCKET_NULL); }); return result; } } - (BOOL)isIPv6 { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return (socket6FD != SOCKET_NULL); } else { __block BOOL result = NO; dispatch_sync(socketQueue, ^{ result = (socket6FD != SOCKET_NULL); }); return result; } } - (BOOL)isSecure { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return (flags & kSocketSecure) ? YES : NO; } else { __block BOOL result; dispatch_sync(socketQueue, ^{ result = (flags & kSocketSecure) ? YES : NO; }); return result; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Utilities //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * Finds the address of an interface description. * An inteface description may be an interface name (en0, en1, lo0) or corresponding IP (192.168.4.34). * * The interface description may optionally contain a port number at the end, separated by a colon. * If a non-zero port parameter is provided, any port number in the interface description is ignored. * * The returned value is a 'struct sockaddr' wrapped in an NSMutableData object. **/ - (void)getInterfaceAddress4:(NSMutableData **)interfaceAddr4Ptr address6:(NSMutableData **)interfaceAddr6Ptr fromDescription:(NSString *)interfaceDescription port:(uint16_t)port { NSMutableData *addr4 = nil; NSMutableData *addr6 = nil; NSString *interface = nil; NSArray *components = [interfaceDescription componentsSeparatedByString:@":"]; if ([components count] > 0) { NSString *temp = [components objectAtIndex:0]; if ([temp length] > 0) { interface = temp; } } if ([components count] > 1 && port == 0) { long portL = strtol([[components objectAtIndex:1] UTF8String], NULL, 10); if (portL > 0 && portL <= UINT16_MAX) { port = (uint16_t)portL; } } if (interface == nil) { // ANY address struct sockaddr_in sockaddr4; memset(&sockaddr4, 0, sizeof(sockaddr4)); sockaddr4.sin_len = sizeof(sockaddr4); sockaddr4.sin_family = AF_INET; sockaddr4.sin_port = htons(port); sockaddr4.sin_addr.s_addr = htonl(INADDR_ANY); struct sockaddr_in6 sockaddr6; memset(&sockaddr6, 0, sizeof(sockaddr6)); sockaddr6.sin6_len = sizeof(sockaddr6); sockaddr6.sin6_family = AF_INET6; sockaddr6.sin6_port = htons(port); sockaddr6.sin6_addr = in6addr_any; addr4 = [NSMutableData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]; addr6 = [NSMutableData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]; } else if ([interface isEqualToString:@"localhost"] || [interface isEqualToString:@"loopback"]) { // LOOPBACK address struct sockaddr_in sockaddr4; memset(&sockaddr4, 0, sizeof(sockaddr4)); sockaddr4.sin_len = sizeof(sockaddr4); sockaddr4.sin_family = AF_INET; sockaddr4.sin_port = htons(port); sockaddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); struct sockaddr_in6 sockaddr6; memset(&sockaddr6, 0, sizeof(sockaddr6)); sockaddr6.sin6_len = sizeof(sockaddr6); sockaddr6.sin6_family = AF_INET6; sockaddr6.sin6_port = htons(port); sockaddr6.sin6_addr = in6addr_loopback; addr4 = [NSMutableData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]; addr6 = [NSMutableData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]; } else { const char *iface = [interface UTF8String]; struct ifaddrs *addrs; const struct ifaddrs *cursor; if ((getifaddrs(&addrs) == 0)) { cursor = addrs; while (cursor != NULL) { if ((addr4 == nil) && (cursor->ifa_addr->sa_family == AF_INET)) { // IPv4 struct sockaddr_in nativeAddr4; memcpy(&nativeAddr4, cursor->ifa_addr, sizeof(nativeAddr4)); if (strcmp(cursor->ifa_name, iface) == 0) { // Name match nativeAddr4.sin_port = htons(port); addr4 = [NSMutableData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; } else { char ip[INET_ADDRSTRLEN]; const char *conversion = inet_ntop(AF_INET, &nativeAddr4.sin_addr, ip, sizeof(ip)); if ((conversion != NULL) && (strcmp(ip, iface) == 0)) { // IP match nativeAddr4.sin_port = htons(port); addr4 = [NSMutableData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; } } } else if ((addr6 == nil) && (cursor->ifa_addr->sa_family == AF_INET6)) { // IPv6 struct sockaddr_in6 nativeAddr6; memcpy(&nativeAddr6, cursor->ifa_addr, sizeof(nativeAddr6)); if (strcmp(cursor->ifa_name, iface) == 0) { // Name match nativeAddr6.sin6_port = htons(port); addr6 = [NSMutableData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; } else { char ip[INET6_ADDRSTRLEN]; const char *conversion = inet_ntop(AF_INET6, &nativeAddr6.sin6_addr, ip, sizeof(ip)); if ((conversion != NULL) && (strcmp(ip, iface) == 0)) { // IP match nativeAddr6.sin6_port = htons(port); addr6 = [NSMutableData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; } } } cursor = cursor->ifa_next; } freeifaddrs(addrs); } } if (interfaceAddr4Ptr) *interfaceAddr4Ptr = addr4; if (interfaceAddr6Ptr) *interfaceAddr6Ptr = addr6; } - (NSData *)getInterfaceAddressFromUrl:(NSURL *)url; { NSString *path = url.path; if (path.length == 0) { return nil; } struct sockaddr_un nativeAddr; nativeAddr.sun_family = AF_UNIX; strlcpy(nativeAddr.sun_path, path.fileSystemRepresentation, sizeof(nativeAddr.sun_path)); nativeAddr.sun_len = SUN_LEN(&nativeAddr); NSData *interface = [NSData dataWithBytes:&nativeAddr length:sizeof(struct sockaddr_un)]; return interface; } - (void)setupReadAndWriteSourcesForNewlyConnectedSocket:(int)socketFD { readSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socketFD, 0, socketQueue); writeSource = dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE, socketFD, 0, socketQueue); // Setup event handlers __weak GCDAsyncSocket *weakSelf = self; dispatch_source_set_event_handler(readSource, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; LogVerbose(@"readEventBlock"); strongSelf->socketFDBytesAvailable = dispatch_source_get_data(strongSelf->readSource); LogVerbose(@"socketFDBytesAvailable: %lu", strongSelf->socketFDBytesAvailable); if (strongSelf->socketFDBytesAvailable > 0) [strongSelf doReadData]; else [strongSelf doReadEOF]; #pragma clang diagnostic pop }}); dispatch_source_set_event_handler(writeSource, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; LogVerbose(@"writeEventBlock"); strongSelf->flags |= kSocketCanAcceptBytes; [strongSelf doWriteData]; #pragma clang diagnostic pop }}); // Setup cancel handlers __block int socketFDRefCount = 2; #if !OS_OBJECT_USE_OBJC dispatch_source_t theReadSource = readSource; dispatch_source_t theWriteSource = writeSource; #endif dispatch_source_set_cancel_handler(readSource, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" LogVerbose(@"readCancelBlock"); #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(readSource)"); dispatch_release(theReadSource); #endif if (--socketFDRefCount == 0) { LogVerbose(@"close(socketFD)"); close(socketFD); } #pragma clang diagnostic pop }); dispatch_source_set_cancel_handler(writeSource, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" LogVerbose(@"writeCancelBlock"); #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(writeSource)"); dispatch_release(theWriteSource); #endif if (--socketFDRefCount == 0) { LogVerbose(@"close(socketFD)"); close(socketFD); } #pragma clang diagnostic pop }); // We will not be able to read until data arrives. // But we should be able to write immediately. socketFDBytesAvailable = 0; flags &= ~kReadSourceSuspended; LogVerbose(@"dispatch_resume(readSource)"); dispatch_resume(readSource); flags |= kSocketCanAcceptBytes; flags |= kWriteSourceSuspended; } - (BOOL)usingCFStreamForTLS { #if TARGET_OS_IPHONE if ((flags & kSocketSecure) && (flags & kUsingCFStreamForTLS)) { // The startTLS method was given the GCDAsyncSocketUseCFStreamForTLS flag. return YES; } #endif return NO; } - (BOOL)usingSecureTransportForTLS { // Invoking this method is equivalent to ![self usingCFStreamForTLS] (just more readable) #if TARGET_OS_IPHONE if ((flags & kSocketSecure) && (flags & kUsingCFStreamForTLS)) { // The startTLS method was given the GCDAsyncSocketUseCFStreamForTLS flag. return NO; } #endif return YES; } - (void)suspendReadSource { if (!(flags & kReadSourceSuspended)) { LogVerbose(@"dispatch_suspend(readSource)"); dispatch_suspend(readSource); flags |= kReadSourceSuspended; } } - (void)resumeReadSource { if (flags & kReadSourceSuspended) { LogVerbose(@"dispatch_resume(readSource)"); dispatch_resume(readSource); flags &= ~kReadSourceSuspended; } } - (void)suspendWriteSource { if (!(flags & kWriteSourceSuspended)) { LogVerbose(@"dispatch_suspend(writeSource)"); dispatch_suspend(writeSource); flags |= kWriteSourceSuspended; } } - (void)resumeWriteSource { if (flags & kWriteSourceSuspended) { LogVerbose(@"dispatch_resume(writeSource)"); dispatch_resume(writeSource); flags &= ~kWriteSourceSuspended; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Reading //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)readDataWithTimeout:(NSTimeInterval)timeout tag:(long)tag { [self readDataWithTimeout:timeout buffer:nil bufferOffset:0 maxLength:0 tag:tag]; } - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag { [self readDataWithTimeout:timeout buffer:buffer bufferOffset:offset maxLength:0 tag:tag]; } - (void)readDataWithTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)length tag:(long)tag { if (offset > [buffer length]) { LogWarn(@"Cannot read: offset > [buffer length]"); return; } GCDAsyncReadPacket *packet = [[GCDAsyncReadPacket alloc] initWithData:buffer startOffset:offset maxLength:length timeout:timeout readLength:0 terminator:nil tag:tag]; dispatch_async(socketQueue, ^{ @autoreleasepool { LogTrace(); if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) { [readQueue addObject:packet]; [self maybeDequeueRead]; } }}); // Do not rely on the block being run in order to release the packet, // as the queue might get released without the block completing. } - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout tag:(long)tag { [self readDataToLength:length withTimeout:timeout buffer:nil bufferOffset:0 tag:tag]; } - (void)readDataToLength:(NSUInteger)length withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag { if (length == 0) { LogWarn(@"Cannot read: length == 0"); return; } if (offset > [buffer length]) { LogWarn(@"Cannot read: offset > [buffer length]"); return; } GCDAsyncReadPacket *packet = [[GCDAsyncReadPacket alloc] initWithData:buffer startOffset:offset maxLength:0 timeout:timeout readLength:length terminator:nil tag:tag]; dispatch_async(socketQueue, ^{ @autoreleasepool { LogTrace(); if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) { [readQueue addObject:packet]; [self maybeDequeueRead]; } }}); // Do not rely on the block being run in order to release the packet, // as the queue might get released without the block completing. } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag { [self readDataToData:data withTimeout:timeout buffer:nil bufferOffset:0 maxLength:0 tag:tag]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset tag:(long)tag { [self readDataToData:data withTimeout:timeout buffer:buffer bufferOffset:offset maxLength:0 tag:tag]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout maxLength:(NSUInteger)length tag:(long)tag { [self readDataToData:data withTimeout:timeout buffer:nil bufferOffset:0 maxLength:length tag:tag]; } - (void)readDataToData:(NSData *)data withTimeout:(NSTimeInterval)timeout buffer:(NSMutableData *)buffer bufferOffset:(NSUInteger)offset maxLength:(NSUInteger)maxLength tag:(long)tag { if ([data length] == 0) { LogWarn(@"Cannot read: [data length] == 0"); return; } if (offset > [buffer length]) { LogWarn(@"Cannot read: offset > [buffer length]"); return; } if (maxLength > 0 && maxLength < [data length]) { LogWarn(@"Cannot read: maxLength > 0 && maxLength < [data length]"); return; } GCDAsyncReadPacket *packet = [[GCDAsyncReadPacket alloc] initWithData:buffer startOffset:offset maxLength:maxLength timeout:timeout readLength:0 terminator:data tag:tag]; dispatch_async(socketQueue, ^{ @autoreleasepool { LogTrace(); if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) { [readQueue addObject:packet]; [self maybeDequeueRead]; } }}); // Do not rely on the block being run in order to release the packet, // as the queue might get released without the block completing. } - (float)progressOfReadReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr { __block float result = 0.0F; dispatch_block_t block = ^{ if (!currentRead || ![currentRead isKindOfClass:[GCDAsyncReadPacket class]]) { // We're not reading anything right now. if (tagPtr != NULL) *tagPtr = 0; if (donePtr != NULL) *donePtr = 0; if (totalPtr != NULL) *totalPtr = 0; result = NAN; } else { // It's only possible to know the progress of our read if we're reading to a certain length. // If we're reading to data, we of course have no idea when the data will arrive. // If we're reading to timeout, then we have no idea when the next chunk of data will arrive. NSUInteger done = currentRead->bytesDone; NSUInteger total = currentRead->readLength; if (tagPtr != NULL) *tagPtr = currentRead->tag; if (donePtr != NULL) *donePtr = done; if (totalPtr != NULL) *totalPtr = total; if (total > 0) result = (float)done / (float)total; else result = 1.0F; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } /** * This method starts a new read, if needed. * * It is called when: * - a user requests a read * - after a read request has finished (to handle the next request) * - immediately after the socket opens to handle any pending requests * * This method also handles auto-disconnect post read/write completion. **/ - (void)maybeDequeueRead { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); // If we're not currently processing a read AND we have an available read stream if ((currentRead == nil) && (flags & kConnected)) { if ([readQueue count] > 0) { // Dequeue the next object in the write queue currentRead = [readQueue objectAtIndex:0]; [readQueue removeObjectAtIndex:0]; if ([currentRead isKindOfClass:[GCDAsyncSpecialPacket class]]) { LogVerbose(@"Dequeued GCDAsyncSpecialPacket"); // Attempt to start TLS flags |= kStartingReadTLS; // This method won't do anything unless both kStartingReadTLS and kStartingWriteTLS are set [self maybeStartTLS]; } else { LogVerbose(@"Dequeued GCDAsyncReadPacket"); // Setup read timer (if needed) [self setupReadTimerWithTimeout:currentRead->timeout]; // Immediately read, if possible [self doReadData]; } } else if (flags & kDisconnectAfterReads) { if (flags & kDisconnectAfterWrites) { if (([writeQueue count] == 0) && (currentWrite == nil)) { [self closeWithError:nil]; } } else { [self closeWithError:nil]; } } else if (flags & kSocketSecure) { [self flushSSLBuffers]; // Edge case: // // We just drained all data from the ssl buffers, // and all known data from the socket (socketFDBytesAvailable). // // If we didn't get any data from this process, // then we may have reached the end of the TCP stream. // // Be sure callbacks are enabled so we're notified about a disconnection. if ([preBuffer availableBytes] == 0) { if ([self usingCFStreamForTLS]) { // Callbacks never disabled } else { [self resumeReadSource]; } } } } } - (void)flushSSLBuffers { LogTrace(); NSAssert((flags & kSocketSecure), @"Cannot flush ssl buffers on non-secure socket"); if ([preBuffer availableBytes] > 0) { // Only flush the ssl buffers if the prebuffer is empty. // This is to avoid growing the prebuffer inifinitely large. return; } #if TARGET_OS_IPHONE if ([self usingCFStreamForTLS]) { if ((flags & kSecureSocketHasBytesAvailable) && CFReadStreamHasBytesAvailable(readStream)) { LogVerbose(@"%@ - Flushing ssl buffers into prebuffer...", THIS_METHOD); CFIndex defaultBytesToRead = (1024 * 4); [preBuffer ensureCapacityForWrite:defaultBytesToRead]; uint8_t *buffer = [preBuffer writeBuffer]; CFIndex result = CFReadStreamRead(readStream, buffer, defaultBytesToRead); LogVerbose(@"%@ - CFReadStreamRead(): result = %i", THIS_METHOD, (int)result); if (result > 0) { [preBuffer didWrite:result]; } flags &= ~kSecureSocketHasBytesAvailable; } return; } #endif __block NSUInteger estimatedBytesAvailable = 0; dispatch_block_t updateEstimatedBytesAvailable = ^{ // Figure out if there is any data available to be read // // socketFDBytesAvailable <- Number of encrypted bytes we haven't read from the bsd socket // [sslPreBuffer availableBytes] <- Number of encrypted bytes we've buffered from bsd socket // sslInternalBufSize <- Number of decrypted bytes SecureTransport has buffered // // We call the variable "estimated" because we don't know how many decrypted bytes we'll get // from the encrypted bytes in the sslPreBuffer. // However, we do know this is an upper bound on the estimation. estimatedBytesAvailable = socketFDBytesAvailable + [sslPreBuffer availableBytes]; size_t sslInternalBufSize = 0; SSLGetBufferedReadSize(sslContext, &sslInternalBufSize); estimatedBytesAvailable += sslInternalBufSize; }; updateEstimatedBytesAvailable(); if (estimatedBytesAvailable > 0) { LogVerbose(@"%@ - Flushing ssl buffers into prebuffer...", THIS_METHOD); BOOL done = NO; do { LogVerbose(@"%@ - estimatedBytesAvailable = %lu", THIS_METHOD, (unsigned long)estimatedBytesAvailable); // Make sure there's enough room in the prebuffer [preBuffer ensureCapacityForWrite:estimatedBytesAvailable]; // Read data into prebuffer uint8_t *buffer = [preBuffer writeBuffer]; size_t bytesRead = 0; OSStatus result = SSLRead(sslContext, buffer, (size_t)estimatedBytesAvailable, &bytesRead); LogVerbose(@"%@ - read from secure socket = %u", THIS_METHOD, (unsigned)bytesRead); if (bytesRead > 0) { [preBuffer didWrite:bytesRead]; } LogVerbose(@"%@ - prebuffer.length = %zu", THIS_METHOD, [preBuffer availableBytes]); if (result != noErr) { done = YES; } else { updateEstimatedBytesAvailable(); } } while (!done && estimatedBytesAvailable > 0); } } - (void)doReadData { LogTrace(); // This method is called on the socketQueue. // It might be called directly, or via the readSource when data is available to be read. if ((currentRead == nil) || (flags & kReadsPaused)) { LogVerbose(@"No currentRead or kReadsPaused"); // Unable to read at this time if (flags & kSocketSecure) { // Here's the situation: // // We have an established secure connection. // There may not be a currentRead, but there might be encrypted data sitting around for us. // When the user does get around to issuing a read, that encrypted data will need to be decrypted. // // So why make the user wait? // We might as well get a head start on decrypting some data now. // // The other reason we do this has to do with detecting a socket disconnection. // The SSL/TLS protocol has it's own disconnection handshake. // So when a secure socket is closed, a "goodbye" packet comes across the wire. // We want to make sure we read the "goodbye" packet so we can properly detect the TCP disconnection. [self flushSSLBuffers]; } if ([self usingCFStreamForTLS]) { // CFReadStream only fires once when there is available data. // It won't fire again until we've invoked CFReadStreamRead. } else { // If the readSource is firing, we need to pause it // or else it will continue to fire over and over again. // // If the readSource is not firing, // we want it to continue monitoring the socket. if (socketFDBytesAvailable > 0) { [self suspendReadSource]; } } return; } BOOL hasBytesAvailable = NO; unsigned long estimatedBytesAvailable = 0; if ([self usingCFStreamForTLS]) { #if TARGET_OS_IPHONE // Requested CFStream, rather than SecureTransport, for TLS (via GCDAsyncSocketUseCFStreamForTLS) estimatedBytesAvailable = 0; if ((flags & kSecureSocketHasBytesAvailable) && CFReadStreamHasBytesAvailable(readStream)) hasBytesAvailable = YES; else hasBytesAvailable = NO; #endif } else { estimatedBytesAvailable = socketFDBytesAvailable; if (flags & kSocketSecure) { // There are 2 buffers to be aware of here. // // We are using SecureTransport, a TLS/SSL security layer which sits atop TCP. // We issue a read to the SecureTranport API, which in turn issues a read to our SSLReadFunction. // Our SSLReadFunction then reads from the BSD socket and returns the encrypted data to SecureTransport. // SecureTransport then decrypts the data, and finally returns the decrypted data back to us. // // The first buffer is one we create. // SecureTransport often requests small amounts of data. // This has to do with the encypted packets that are coming across the TCP stream. // But it's non-optimal to do a bunch of small reads from the BSD socket. // So our SSLReadFunction reads all available data from the socket (optimizing the sys call) // and may store excess in the sslPreBuffer. estimatedBytesAvailable += [sslPreBuffer availableBytes]; // The second buffer is within SecureTransport. // As mentioned earlier, there are encrypted packets coming across the TCP stream. // SecureTransport needs the entire packet to decrypt it. // But if the entire packet produces X bytes of decrypted data, // and we only asked SecureTransport for X/2 bytes of data, // it must store the extra X/2 bytes of decrypted data for the next read. // // The SSLGetBufferedReadSize function will tell us the size of this internal buffer. // From the documentation: // // "This function does not block or cause any low-level read operations to occur." size_t sslInternalBufSize = 0; SSLGetBufferedReadSize(sslContext, &sslInternalBufSize); estimatedBytesAvailable += sslInternalBufSize; } hasBytesAvailable = (estimatedBytesAvailable > 0); } if ((hasBytesAvailable == NO) && ([preBuffer availableBytes] == 0)) { LogVerbose(@"No data available to read..."); // No data available to read. if (![self usingCFStreamForTLS]) { // Need to wait for readSource to fire and notify us of // available data in the socket's internal read buffer. [self resumeReadSource]; } return; } if (flags & kStartingReadTLS) { LogVerbose(@"Waiting for SSL/TLS handshake to complete"); // The readQueue is waiting for SSL/TLS handshake to complete. if (flags & kStartingWriteTLS) { if ([self usingSecureTransportForTLS] && lastSSLHandshakeError == errSSLWouldBlock) { // We are in the process of a SSL Handshake. // We were waiting for incoming data which has just arrived. [self ssl_continueSSLHandshake]; } } else { // We are still waiting for the writeQueue to drain and start the SSL/TLS process. // We now know data is available to read. if (![self usingCFStreamForTLS]) { // Suspend the read source or else it will continue to fire nonstop. [self suspendReadSource]; } } return; } BOOL done = NO; // Completed read operation NSError *error = nil; // Error occurred NSUInteger totalBytesReadForCurrentRead = 0; // // STEP 1 - READ FROM PREBUFFER // if ([preBuffer availableBytes] > 0) { // There are 3 types of read packets: // // 1) Read all available data. // 2) Read a specific length of data. // 3) Read up to a particular terminator. NSUInteger bytesToCopy; if (currentRead->term != nil) { // Read type #3 - read up to a terminator bytesToCopy = [currentRead readLengthForTermWithPreBuffer:preBuffer found:&done]; } else { // Read type #1 or #2 bytesToCopy = [currentRead readLengthForNonTermWithHint:[preBuffer availableBytes]]; } // Make sure we have enough room in the buffer for our read. [currentRead ensureCapacityForAdditionalDataOfLength:bytesToCopy]; // Copy bytes from prebuffer into packet buffer uint8_t *buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + currentRead->bytesDone; memcpy(buffer, [preBuffer readBuffer], bytesToCopy); // Remove the copied bytes from the preBuffer [preBuffer didRead:bytesToCopy]; LogVerbose(@"copied(%lu) preBufferLength(%zu)", (unsigned long)bytesToCopy, [preBuffer availableBytes]); // Update totals currentRead->bytesDone += bytesToCopy; totalBytesReadForCurrentRead += bytesToCopy; // Check to see if the read operation is done if (currentRead->readLength > 0) { // Read type #2 - read a specific length of data done = (currentRead->bytesDone == currentRead->readLength); } else if (currentRead->term != nil) { // Read type #3 - read up to a terminator // Our 'done' variable was updated via the readLengthForTermWithPreBuffer:found: method if (!done && currentRead->maxLength > 0) { // We're not done and there's a set maxLength. // Have we reached that maxLength yet? if (currentRead->bytesDone >= currentRead->maxLength) { error = [self readMaxedOutError]; } } } else { // Read type #1 - read all available data // // We're done as soon as // - we've read all available data (in prebuffer and socket) // - we've read the maxLength of read packet. done = ((currentRead->maxLength > 0) && (currentRead->bytesDone == currentRead->maxLength)); } } // // STEP 2 - READ FROM SOCKET // BOOL socketEOF = (flags & kSocketHasReadEOF) ? YES : NO; // Nothing more to read via socket (end of file) BOOL waiting = !done && !error && !socketEOF && !hasBytesAvailable; // Ran out of data, waiting for more if (!done && !error && !socketEOF && hasBytesAvailable) { NSAssert(([preBuffer availableBytes] == 0), @"Invalid logic"); BOOL readIntoPreBuffer = NO; uint8_t *buffer = NULL; size_t bytesRead = 0; if (flags & kSocketSecure) { if ([self usingCFStreamForTLS]) { #if TARGET_OS_IPHONE // Using CFStream, rather than SecureTransport, for TLS NSUInteger defaultReadLength = (1024 * 32); NSUInteger bytesToRead = [currentRead optimalReadLengthWithDefault:defaultReadLength shouldPreBuffer:&readIntoPreBuffer]; // Make sure we have enough room in the buffer for our read. // // We are either reading directly into the currentRead->buffer, // or we're reading into the temporary preBuffer. if (readIntoPreBuffer) { [preBuffer ensureCapacityForWrite:bytesToRead]; buffer = [preBuffer writeBuffer]; } else { [currentRead ensureCapacityForAdditionalDataOfLength:bytesToRead]; buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + currentRead->bytesDone; } // Read data into buffer CFIndex result = CFReadStreamRead(readStream, buffer, (CFIndex)bytesToRead); LogVerbose(@"CFReadStreamRead(): result = %i", (int)result); if (result < 0) { error = (__bridge_transfer NSError *)CFReadStreamCopyError(readStream); } else if (result == 0) { socketEOF = YES; } else { waiting = YES; bytesRead = (size_t)result; } // We only know how many decrypted bytes were read. // The actual number of bytes read was likely more due to the overhead of the encryption. // So we reset our flag, and rely on the next callback to alert us of more data. flags &= ~kSecureSocketHasBytesAvailable; #endif } else { // Using SecureTransport for TLS // // We know: // - how many bytes are available on the socket // - how many encrypted bytes are sitting in the sslPreBuffer // - how many decypted bytes are sitting in the sslContext // // But we do NOT know: // - how many encypted bytes are sitting in the sslContext // // So we play the regular game of using an upper bound instead. NSUInteger defaultReadLength = (1024 * 32); if (defaultReadLength < estimatedBytesAvailable) { defaultReadLength = estimatedBytesAvailable + (1024 * 16); } NSUInteger bytesToRead = [currentRead optimalReadLengthWithDefault:defaultReadLength shouldPreBuffer:&readIntoPreBuffer]; if (bytesToRead > SIZE_MAX) { // NSUInteger may be bigger than size_t bytesToRead = SIZE_MAX; } // Make sure we have enough room in the buffer for our read. // // We are either reading directly into the currentRead->buffer, // or we're reading into the temporary preBuffer. if (readIntoPreBuffer) { [preBuffer ensureCapacityForWrite:bytesToRead]; buffer = [preBuffer writeBuffer]; } else { [currentRead ensureCapacityForAdditionalDataOfLength:bytesToRead]; buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + currentRead->bytesDone; } // The documentation from Apple states: // // "a read operation might return errSSLWouldBlock, // indicating that less data than requested was actually transferred" // // However, starting around 10.7, the function will sometimes return noErr, // even if it didn't read as much data as requested. So we need to watch out for that. OSStatus result; do { void *loop_buffer = buffer + bytesRead; size_t loop_bytesToRead = (size_t)bytesToRead - bytesRead; size_t loop_bytesRead = 0; result = SSLRead(sslContext, loop_buffer, loop_bytesToRead, &loop_bytesRead); LogVerbose(@"read from secure socket = %u", (unsigned)loop_bytesRead); bytesRead += loop_bytesRead; } while ((result == noErr) && (bytesRead < bytesToRead)); if (result != noErr) { if (result == errSSLWouldBlock) waiting = YES; else { if (result == errSSLClosedGraceful || result == errSSLClosedAbort) { // We've reached the end of the stream. // Handle this the same way we would an EOF from the socket. socketEOF = YES; sslErrCode = result; } else { error = [self sslError:result]; } } // It's possible that bytesRead > 0, even if the result was errSSLWouldBlock. // This happens when the SSLRead function is able to read some data, // but not the entire amount we requested. if (bytesRead <= 0) { bytesRead = 0; } } // Do not modify socketFDBytesAvailable. // It will be updated via the SSLReadFunction(). } } else { // Normal socket operation NSUInteger bytesToRead; // There are 3 types of read packets: // // 1) Read all available data. // 2) Read a specific length of data. // 3) Read up to a particular terminator. if (currentRead->term != nil) { // Read type #3 - read up to a terminator bytesToRead = [currentRead readLengthForTermWithHint:estimatedBytesAvailable shouldPreBuffer:&readIntoPreBuffer]; } else { // Read type #1 or #2 bytesToRead = [currentRead readLengthForNonTermWithHint:estimatedBytesAvailable]; } if (bytesToRead > SIZE_MAX) { // NSUInteger may be bigger than size_t (read param 3) bytesToRead = SIZE_MAX; } // Make sure we have enough room in the buffer for our read. // // We are either reading directly into the currentRead->buffer, // or we're reading into the temporary preBuffer. if (readIntoPreBuffer) { [preBuffer ensureCapacityForWrite:bytesToRead]; buffer = [preBuffer writeBuffer]; } else { [currentRead ensureCapacityForAdditionalDataOfLength:bytesToRead]; buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + currentRead->bytesDone; } // Read data into buffer int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; ssize_t result = read(socketFD, buffer, (size_t)bytesToRead); LogVerbose(@"read from socket = %i", (int)result); if (result < 0) { if (errno == EWOULDBLOCK) waiting = YES; else error = [self errnoErrorWithReason:@"Error in read() function"]; socketFDBytesAvailable = 0; } else if (result == 0) { socketEOF = YES; socketFDBytesAvailable = 0; } else { bytesRead = result; if (bytesRead < bytesToRead) { // The read returned less data than requested. // This means socketFDBytesAvailable was a bit off due to timing, // because we read from the socket right when the readSource event was firing. socketFDBytesAvailable = 0; } else { if (socketFDBytesAvailable <= bytesRead) socketFDBytesAvailable = 0; else socketFDBytesAvailable -= bytesRead; } if (socketFDBytesAvailable == 0) { waiting = YES; } } } if (bytesRead > 0) { // Check to see if the read operation is done if (currentRead->readLength > 0) { // Read type #2 - read a specific length of data // // Note: We should never be using a prebuffer when we're reading a specific length of data. NSAssert(readIntoPreBuffer == NO, @"Invalid logic"); currentRead->bytesDone += bytesRead; totalBytesReadForCurrentRead += bytesRead; done = (currentRead->bytesDone == currentRead->readLength); } else if (currentRead->term != nil) { // Read type #3 - read up to a terminator if (readIntoPreBuffer) { // We just read a big chunk of data into the preBuffer [preBuffer didWrite:bytesRead]; LogVerbose(@"read data into preBuffer - preBuffer.length = %zu", [preBuffer availableBytes]); // Search for the terminating sequence NSUInteger bytesToCopy = [currentRead readLengthForTermWithPreBuffer:preBuffer found:&done]; LogVerbose(@"copying %lu bytes from preBuffer", (unsigned long)bytesToCopy); // Ensure there's room on the read packet's buffer [currentRead ensureCapacityForAdditionalDataOfLength:bytesToCopy]; // Copy bytes from prebuffer into read buffer uint8_t *readBuf = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + currentRead->bytesDone; memcpy(readBuf, [preBuffer readBuffer], bytesToCopy); // Remove the copied bytes from the prebuffer [preBuffer didRead:bytesToCopy]; LogVerbose(@"preBuffer.length = %zu", [preBuffer availableBytes]); // Update totals currentRead->bytesDone += bytesToCopy; totalBytesReadForCurrentRead += bytesToCopy; // Our 'done' variable was updated via the readLengthForTermWithPreBuffer:found: method above } else { // We just read a big chunk of data directly into the packet's buffer. // We need to move any overflow into the prebuffer. NSInteger overflow = [currentRead searchForTermAfterPreBuffering:bytesRead]; if (overflow == 0) { // Perfect match! // Every byte we read stays in the read buffer, // and the last byte we read was the last byte of the term. currentRead->bytesDone += bytesRead; totalBytesReadForCurrentRead += bytesRead; done = YES; } else if (overflow > 0) { // The term was found within the data that we read, // and there are extra bytes that extend past the end of the term. // We need to move these excess bytes out of the read packet and into the prebuffer. NSInteger underflow = bytesRead - overflow; // Copy excess data into preBuffer LogVerbose(@"copying %ld overflow bytes into preBuffer", (long)overflow); [preBuffer ensureCapacityForWrite:overflow]; uint8_t *overflowBuffer = buffer + underflow; memcpy([preBuffer writeBuffer], overflowBuffer, overflow); [preBuffer didWrite:overflow]; LogVerbose(@"preBuffer.length = %zu", [preBuffer availableBytes]); // Note: The completeCurrentRead method will trim the buffer for us. currentRead->bytesDone += underflow; totalBytesReadForCurrentRead += underflow; done = YES; } else { // The term was not found within the data that we read. currentRead->bytesDone += bytesRead; totalBytesReadForCurrentRead += bytesRead; done = NO; } } if (!done && currentRead->maxLength > 0) { // We're not done and there's a set maxLength. // Have we reached that maxLength yet? if (currentRead->bytesDone >= currentRead->maxLength) { error = [self readMaxedOutError]; } } } else { // Read type #1 - read all available data if (readIntoPreBuffer) { // We just read a chunk of data into the preBuffer [preBuffer didWrite:bytesRead]; // Now copy the data into the read packet. // // Recall that we didn't read directly into the packet's buffer to avoid // over-allocating memory since we had no clue how much data was available to be read. // // Ensure there's room on the read packet's buffer [currentRead ensureCapacityForAdditionalDataOfLength:bytesRead]; // Copy bytes from prebuffer into read buffer uint8_t *readBuf = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset + currentRead->bytesDone; memcpy(readBuf, [preBuffer readBuffer], bytesRead); // Remove the copied bytes from the prebuffer [preBuffer didRead:bytesRead]; // Update totals currentRead->bytesDone += bytesRead; totalBytesReadForCurrentRead += bytesRead; } else { currentRead->bytesDone += bytesRead; totalBytesReadForCurrentRead += bytesRead; } done = YES; } } // if (bytesRead > 0) } // if (!done && !error && !socketEOF && hasBytesAvailable) if (!done && currentRead->readLength == 0 && currentRead->term == nil) { // Read type #1 - read all available data // // We might arrive here if we read data from the prebuffer but not from the socket. done = (totalBytesReadForCurrentRead > 0); } // Check to see if we're done, or if we've made progress if (done) { [self completeCurrentRead]; if (!error && (!socketEOF || [preBuffer availableBytes] > 0)) { [self maybeDequeueRead]; } } else if (totalBytesReadForCurrentRead > 0) { // We're not done read type #2 or #3 yet, but we have read in some bytes __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReadPartialDataOfLength:tag:)]) { long theReadTag = currentRead->tag; dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didReadPartialDataOfLength:totalBytesReadForCurrentRead tag:theReadTag]; }}); } } // Check for errors if (error) { [self closeWithError:error]; } else if (socketEOF) { [self doReadEOF]; } else if (waiting) { if (![self usingCFStreamForTLS]) { // Monitor the socket for readability (if we're not already doing so) [self resumeReadSource]; } } // Do not add any code here without first adding return statements in the error cases above. } - (void)doReadEOF { LogTrace(); // This method may be called more than once. // If the EOF is read while there is still data in the preBuffer, // then this method may be called continually after invocations of doReadData to see if it's time to disconnect. flags |= kSocketHasReadEOF; if (flags & kSocketSecure) { // If the SSL layer has any buffered data, flush it into the preBuffer now. [self flushSSLBuffers]; } BOOL shouldDisconnect = NO; NSError *error = nil; if ((flags & kStartingReadTLS) || (flags & kStartingWriteTLS)) { // We received an EOF during or prior to startTLS. // The SSL/TLS handshake is now impossible, so this is an unrecoverable situation. shouldDisconnect = YES; if ([self usingSecureTransportForTLS]) { error = [self sslError:errSSLClosedAbort]; } } else if (flags & kReadStreamClosed) { // The preBuffer has already been drained. // The config allows half-duplex connections. // We've previously checked the socket, and it appeared writeable. // So we marked the read stream as closed and notified the delegate. // // As per the half-duplex contract, the socket will be closed when a write fails, // or when the socket is manually closed. shouldDisconnect = NO; } else if ([preBuffer availableBytes] > 0) { LogVerbose(@"Socket reached EOF, but there is still data available in prebuffer"); // Although we won't be able to read any more data from the socket, // there is existing data that has been prebuffered that we can read. shouldDisconnect = NO; } else if (config & kAllowHalfDuplexConnection) { // We just received an EOF (end of file) from the socket's read stream. // This means the remote end of the socket (the peer we're connected to) // has explicitly stated that it will not be sending us any more data. // // Query the socket to see if it is still writeable. (Perhaps the peer will continue reading data from us) int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; struct pollfd pfd[1]; pfd[0].fd = socketFD; pfd[0].events = POLLOUT; pfd[0].revents = 0; poll(pfd, 1, 0); if (pfd[0].revents & POLLOUT) { // Socket appears to still be writeable shouldDisconnect = NO; flags |= kReadStreamClosed; // Notify the delegate that we're going half-duplex __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidCloseReadStream:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socketDidCloseReadStream:self]; }}); } } else { shouldDisconnect = YES; } } else { shouldDisconnect = YES; } if (shouldDisconnect) { if (error == nil) { if ([self usingSecureTransportForTLS]) { if (sslErrCode != noErr && sslErrCode != errSSLClosedGraceful) { error = [self sslError:sslErrCode]; } else { error = [self connectionClosedError]; } } else { error = [self connectionClosedError]; } } [self closeWithError:error]; } else { if (![self usingCFStreamForTLS]) { // Suspend the read source (if needed) [self suspendReadSource]; } } } - (void)completeCurrentRead { LogTrace(); NSAssert(currentRead, @"Trying to complete current read when there is no current read."); NSData *result = nil; if (currentRead->bufferOwner) { // We created the buffer on behalf of the user. // Trim our buffer to be the proper size. [currentRead->buffer setLength:currentRead->bytesDone]; result = currentRead->buffer; } else { // We did NOT create the buffer. // The buffer is owned by the caller. // Only trim the buffer if we had to increase its size. if ([currentRead->buffer length] > currentRead->originalBufferLength) { NSUInteger readSize = currentRead->startOffset + currentRead->bytesDone; NSUInteger origSize = currentRead->originalBufferLength; NSUInteger buffSize = MAX(readSize, origSize); [currentRead->buffer setLength:buffSize]; } uint8_t *buffer = (uint8_t *)[currentRead->buffer mutableBytes] + currentRead->startOffset; result = [NSData dataWithBytesNoCopy:buffer length:currentRead->bytesDone freeWhenDone:NO]; } __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReadData:withTag:)]) { GCDAsyncReadPacket *theRead = currentRead; // Ensure currentRead retained since result may not own buffer dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didReadData:result withTag:theRead->tag]; }}); } [self endCurrentRead]; } - (void)endCurrentRead { if (readTimer) { dispatch_source_cancel(readTimer); readTimer = NULL; } currentRead = nil; } - (void)setupReadTimerWithTimeout:(NSTimeInterval)timeout { if (timeout >= 0.0) { readTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); __weak GCDAsyncSocket *weakSelf = self; dispatch_source_set_event_handler(readTimer, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; [strongSelf doReadTimeout]; #pragma clang diagnostic pop }}); #if !OS_OBJECT_USE_OBJC dispatch_source_t theReadTimer = readTimer; dispatch_source_set_cancel_handler(readTimer, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" LogVerbose(@"dispatch_release(readTimer)"); dispatch_release(theReadTimer); #pragma clang diagnostic pop }); #endif dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); dispatch_source_set_timer(readTimer, tt, DISPATCH_TIME_FOREVER, 0); dispatch_resume(readTimer); } } - (void)doReadTimeout { // This is a little bit tricky. // Ideally we'd like to synchronously query the delegate about a timeout extension. // But if we do so synchronously we risk a possible deadlock. // So instead we have to do so asynchronously, and callback to ourselves from within the delegate block. flags |= kReadsPaused; __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:shouldTimeoutReadWithTag:elapsed:bytesDone:)]) { GCDAsyncReadPacket *theRead = currentRead; dispatch_async(delegateQueue, ^{ @autoreleasepool { NSTimeInterval timeoutExtension = 0.0; timeoutExtension = [theDelegate socket:self shouldTimeoutReadWithTag:theRead->tag elapsed:theRead->timeout bytesDone:theRead->bytesDone]; dispatch_async(socketQueue, ^{ @autoreleasepool { [self doReadTimeoutWithExtension:timeoutExtension]; }}); }}); } else { [self doReadTimeoutWithExtension:0.0]; } } - (void)doReadTimeoutWithExtension:(NSTimeInterval)timeoutExtension { if (currentRead) { if (timeoutExtension > 0.0) { currentRead->timeout += timeoutExtension; // Reschedule the timer dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeoutExtension * NSEC_PER_SEC)); dispatch_source_set_timer(readTimer, tt, DISPATCH_TIME_FOREVER, 0); // Unpause reads, and continue flags &= ~kReadsPaused; [self doReadData]; } else { LogVerbose(@"ReadTimeout"); [self closeWithError:[self readTimeoutError]]; } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Writing //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)writeData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag { if ([data length] == 0) return; GCDAsyncWritePacket *packet = [[GCDAsyncWritePacket alloc] initWithData:data timeout:timeout tag:tag]; dispatch_async(socketQueue, ^{ @autoreleasepool { LogTrace(); if ((flags & kSocketStarted) && !(flags & kForbidReadsWrites)) { [writeQueue addObject:packet]; [self maybeDequeueWrite]; } }}); // Do not rely on the block being run in order to release the packet, // as the queue might get released without the block completing. } - (float)progressOfWriteReturningTag:(long *)tagPtr bytesDone:(NSUInteger *)donePtr total:(NSUInteger *)totalPtr { __block float result = 0.0F; dispatch_block_t block = ^{ if (!currentWrite || ![currentWrite isKindOfClass:[GCDAsyncWritePacket class]]) { // We're not writing anything right now. if (tagPtr != NULL) *tagPtr = 0; if (donePtr != NULL) *donePtr = 0; if (totalPtr != NULL) *totalPtr = 0; result = NAN; } else { NSUInteger done = currentWrite->bytesDone; NSUInteger total = [currentWrite->buffer length]; if (tagPtr != NULL) *tagPtr = currentWrite->tag; if (donePtr != NULL) *donePtr = done; if (totalPtr != NULL) *totalPtr = total; result = (float)done / (float)total; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } /** * Conditionally starts a new write. * * It is called when: * - a user requests a write * - after a write request has finished (to handle the next request) * - immediately after the socket opens to handle any pending requests * * This method also handles auto-disconnect post read/write completion. **/ - (void)maybeDequeueWrite { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); // If we're not currently processing a write AND we have an available write stream if ((currentWrite == nil) && (flags & kConnected)) { if ([writeQueue count] > 0) { // Dequeue the next object in the write queue currentWrite = [writeQueue objectAtIndex:0]; [writeQueue removeObjectAtIndex:0]; if ([currentWrite isKindOfClass:[GCDAsyncSpecialPacket class]]) { LogVerbose(@"Dequeued GCDAsyncSpecialPacket"); // Attempt to start TLS flags |= kStartingWriteTLS; // This method won't do anything unless both kStartingReadTLS and kStartingWriteTLS are set [self maybeStartTLS]; } else { LogVerbose(@"Dequeued GCDAsyncWritePacket"); // Setup write timer (if needed) [self setupWriteTimerWithTimeout:currentWrite->timeout]; // Immediately write, if possible [self doWriteData]; } } else if (flags & kDisconnectAfterWrites) { if (flags & kDisconnectAfterReads) { if (([readQueue count] == 0) && (currentRead == nil)) { [self closeWithError:nil]; } } else { [self closeWithError:nil]; } } } } - (void)doWriteData { LogTrace(); // This method is called by the writeSource via the socketQueue if ((currentWrite == nil) || (flags & kWritesPaused)) { LogVerbose(@"No currentWrite or kWritesPaused"); // Unable to write at this time if ([self usingCFStreamForTLS]) { // CFWriteStream only fires once when there is available data. // It won't fire again until we've invoked CFWriteStreamWrite. } else { // If the writeSource is firing, we need to pause it // or else it will continue to fire over and over again. if (flags & kSocketCanAcceptBytes) { [self suspendWriteSource]; } } return; } if (!(flags & kSocketCanAcceptBytes)) { LogVerbose(@"No space available to write..."); // No space available to write. if (![self usingCFStreamForTLS]) { // Need to wait for writeSource to fire and notify us of // available space in the socket's internal write buffer. [self resumeWriteSource]; } return; } if (flags & kStartingWriteTLS) { LogVerbose(@"Waiting for SSL/TLS handshake to complete"); // The writeQueue is waiting for SSL/TLS handshake to complete. if (flags & kStartingReadTLS) { if ([self usingSecureTransportForTLS] && lastSSLHandshakeError == errSSLWouldBlock) { // We are in the process of a SSL Handshake. // We were waiting for available space in the socket's internal OS buffer to continue writing. [self ssl_continueSSLHandshake]; } } else { // We are still waiting for the readQueue to drain and start the SSL/TLS process. // We now know we can write to the socket. if (![self usingCFStreamForTLS]) { // Suspend the write source or else it will continue to fire nonstop. [self suspendWriteSource]; } } return; } // Note: This method is not called if currentWrite is a GCDAsyncSpecialPacket (startTLS packet) BOOL waiting = NO; NSError *error = nil; size_t bytesWritten = 0; if (flags & kSocketSecure) { if ([self usingCFStreamForTLS]) { #if TARGET_OS_IPHONE // // Writing data using CFStream (over internal TLS) // const uint8_t *buffer = (const uint8_t *)[currentWrite->buffer bytes] + currentWrite->bytesDone; NSUInteger bytesToWrite = [currentWrite->buffer length] - currentWrite->bytesDone; if (bytesToWrite > SIZE_MAX) // NSUInteger may be bigger than size_t (write param 3) { bytesToWrite = SIZE_MAX; } CFIndex result = CFWriteStreamWrite(writeStream, buffer, (CFIndex)bytesToWrite); LogVerbose(@"CFWriteStreamWrite(%lu) = %li", (unsigned long)bytesToWrite, result); if (result < 0) { error = (__bridge_transfer NSError *)CFWriteStreamCopyError(writeStream); } else { bytesWritten = (size_t)result; // We always set waiting to true in this scenario. // CFStream may have altered our underlying socket to non-blocking. // Thus if we attempt to write without a callback, we may end up blocking our queue. waiting = YES; } #endif } else { // We're going to use the SSLWrite function. // // OSStatus SSLWrite(SSLContextRef context, const void *data, size_t dataLength, size_t *processed) // // Parameters: // context - An SSL session context reference. // data - A pointer to the buffer of data to write. // dataLength - The amount, in bytes, of data to write. // processed - On return, the length, in bytes, of the data actually written. // // It sounds pretty straight-forward, // but there are a few caveats you should be aware of. // // The SSLWrite method operates in a non-obvious (and rather annoying) manner. // According to the documentation: // // Because you may configure the underlying connection to operate in a non-blocking manner, // a write operation might return errSSLWouldBlock, indicating that less data than requested // was actually transferred. In this case, you should repeat the call to SSLWrite until some // other result is returned. // // This sounds perfect, but when our SSLWriteFunction returns errSSLWouldBlock, // then the SSLWrite method returns (with the proper errSSLWouldBlock return value), // but it sets processed to dataLength !! // // In other words, if the SSLWrite function doesn't completely write all the data we tell it to, // then it doesn't tell us how many bytes were actually written. So, for example, if we tell it to // write 256 bytes then it might actually write 128 bytes, but then report 0 bytes written. // // You might be wondering: // If the SSLWrite function doesn't tell us how many bytes were written, // then how in the world are we supposed to update our parameters (buffer & bytesToWrite) // for the next time we invoke SSLWrite? // // The answer is that SSLWrite cached all the data we told it to write, // and it will push out that data next time we call SSLWrite. // If we call SSLWrite with new data, it will push out the cached data first, and then the new data. // If we call SSLWrite with empty data, then it will simply push out the cached data. // // For this purpose we're going to break large writes into a series of smaller writes. // This allows us to report progress back to the delegate. OSStatus result; BOOL hasCachedDataToWrite = (sslWriteCachedLength > 0); BOOL hasNewDataToWrite = YES; if (hasCachedDataToWrite) { size_t processed = 0; result = SSLWrite(sslContext, NULL, 0, &processed); if (result == noErr) { bytesWritten = sslWriteCachedLength; sslWriteCachedLength = 0; if ([currentWrite->buffer length] == (currentWrite->bytesDone + bytesWritten)) { // We've written all data for the current write. hasNewDataToWrite = NO; } } else { if (result == errSSLWouldBlock) { waiting = YES; } else { error = [self sslError:result]; } // Can't write any new data since we were unable to write the cached data. hasNewDataToWrite = NO; } } if (hasNewDataToWrite) { const uint8_t *buffer = (const uint8_t *)[currentWrite->buffer bytes] + currentWrite->bytesDone + bytesWritten; NSUInteger bytesToWrite = [currentWrite->buffer length] - currentWrite->bytesDone - bytesWritten; if (bytesToWrite > SIZE_MAX) // NSUInteger may be bigger than size_t (write param 3) { bytesToWrite = SIZE_MAX; } size_t bytesRemaining = bytesToWrite; BOOL keepLooping = YES; while (keepLooping) { const size_t sslMaxBytesToWrite = 32768; size_t sslBytesToWrite = MIN(bytesRemaining, sslMaxBytesToWrite); size_t sslBytesWritten = 0; result = SSLWrite(sslContext, buffer, sslBytesToWrite, &sslBytesWritten); if (result == noErr) { buffer += sslBytesWritten; bytesWritten += sslBytesWritten; bytesRemaining -= sslBytesWritten; keepLooping = (bytesRemaining > 0); } else { if (result == errSSLWouldBlock) { waiting = YES; sslWriteCachedLength = sslBytesToWrite; } else { error = [self sslError:result]; } keepLooping = NO; } } // while (keepLooping) } // if (hasNewDataToWrite) } } else { // // Writing data directly over raw socket // int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; const uint8_t *buffer = (const uint8_t *)[currentWrite->buffer bytes] + currentWrite->bytesDone; NSUInteger bytesToWrite = [currentWrite->buffer length] - currentWrite->bytesDone; if (bytesToWrite > SIZE_MAX) // NSUInteger may be bigger than size_t (write param 3) { bytesToWrite = SIZE_MAX; } ssize_t result = write(socketFD, buffer, (size_t)bytesToWrite); LogVerbose(@"wrote to socket = %zd", result); // Check results if (result < 0) { if (errno == EWOULDBLOCK) { waiting = YES; } else { error = [self errnoErrorWithReason:@"Error in write() function"]; } } else { bytesWritten = result; } } // We're done with our writing. // If we explictly ran into a situation where the socket told us there was no room in the buffer, // then we immediately resume listening for notifications. // // We must do this before we dequeue another write, // as that may in turn invoke this method again. // // Note that if CFStream is involved, it may have maliciously put our socket in blocking mode. if (waiting) { flags &= ~kSocketCanAcceptBytes; if (![self usingCFStreamForTLS]) { [self resumeWriteSource]; } } // Check our results BOOL done = NO; if (bytesWritten > 0) { // Update total amount read for the current write currentWrite->bytesDone += bytesWritten; LogVerbose(@"currentWrite->bytesDone = %lu", (unsigned long)currentWrite->bytesDone); // Is packet done? done = (currentWrite->bytesDone == [currentWrite->buffer length]); } if (done) { [self completeCurrentWrite]; if (!error) { dispatch_async(socketQueue, ^{ @autoreleasepool{ [self maybeDequeueWrite]; }}); } } else { // We were unable to finish writing the data, // so we're waiting for another callback to notify us of available space in the lower-level output buffer. if (!waiting && !error) { // This would be the case if our write was able to accept some data, but not all of it. flags &= ~kSocketCanAcceptBytes; if (![self usingCFStreamForTLS]) { [self resumeWriteSource]; } } if (bytesWritten > 0) { // We're not done with the entire write, but we have written some bytes __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didWritePartialDataOfLength:tag:)]) { long theWriteTag = currentWrite->tag; dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didWritePartialDataOfLength:bytesWritten tag:theWriteTag]; }}); } } } // Check for errors if (error) { [self closeWithError:[self errnoErrorWithReason:@"Error in write() function"]]; } // Do not add any code here without first adding a return statement in the error case above. } - (void)completeCurrentWrite { LogTrace(); NSAssert(currentWrite, @"Trying to complete current write when there is no current write."); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didWriteDataWithTag:)]) { long theWriteTag = currentWrite->tag; dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didWriteDataWithTag:theWriteTag]; }}); } [self endCurrentWrite]; } - (void)endCurrentWrite { if (writeTimer) { dispatch_source_cancel(writeTimer); writeTimer = NULL; } currentWrite = nil; } - (void)setupWriteTimerWithTimeout:(NSTimeInterval)timeout { if (timeout >= 0.0) { writeTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); __weak GCDAsyncSocket *weakSelf = self; dispatch_source_set_event_handler(writeTimer, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf == nil) return_from_block; [strongSelf doWriteTimeout]; #pragma clang diagnostic pop }}); #if !OS_OBJECT_USE_OBJC dispatch_source_t theWriteTimer = writeTimer; dispatch_source_set_cancel_handler(writeTimer, ^{ #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" LogVerbose(@"dispatch_release(writeTimer)"); dispatch_release(theWriteTimer); #pragma clang diagnostic pop }); #endif dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); dispatch_source_set_timer(writeTimer, tt, DISPATCH_TIME_FOREVER, 0); dispatch_resume(writeTimer); } } - (void)doWriteTimeout { // This is a little bit tricky. // Ideally we'd like to synchronously query the delegate about a timeout extension. // But if we do so synchronously we risk a possible deadlock. // So instead we have to do so asynchronously, and callback to ourselves from within the delegate block. flags |= kWritesPaused; __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:shouldTimeoutWriteWithTag:elapsed:bytesDone:)]) { GCDAsyncWritePacket *theWrite = currentWrite; dispatch_async(delegateQueue, ^{ @autoreleasepool { NSTimeInterval timeoutExtension = 0.0; timeoutExtension = [theDelegate socket:self shouldTimeoutWriteWithTag:theWrite->tag elapsed:theWrite->timeout bytesDone:theWrite->bytesDone]; dispatch_async(socketQueue, ^{ @autoreleasepool { [self doWriteTimeoutWithExtension:timeoutExtension]; }}); }}); } else { [self doWriteTimeoutWithExtension:0.0]; } } - (void)doWriteTimeoutWithExtension:(NSTimeInterval)timeoutExtension { if (currentWrite) { if (timeoutExtension > 0.0) { currentWrite->timeout += timeoutExtension; // Reschedule the timer dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeoutExtension * NSEC_PER_SEC)); dispatch_source_set_timer(writeTimer, tt, DISPATCH_TIME_FOREVER, 0); // Unpause writes, and continue flags &= ~kWritesPaused; [self doWriteData]; } else { LogVerbose(@"WriteTimeout"); [self closeWithError:[self writeTimeoutError]]; } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Security //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)startTLS:(NSDictionary *)tlsSettings { LogTrace(); if (tlsSettings == nil) { // Passing nil/NULL to CFReadStreamSetProperty will appear to work the same as passing an empty dictionary, // but causes problems if we later try to fetch the remote host's certificate. // // To be exact, it causes the following to return NULL instead of the normal result: // CFReadStreamCopyProperty(readStream, kCFStreamPropertySSLPeerCertificates) // // So we use an empty dictionary instead, which works perfectly. tlsSettings = [NSDictionary dictionary]; } GCDAsyncSpecialPacket *packet = [[GCDAsyncSpecialPacket alloc] initWithTLSSettings:tlsSettings]; dispatch_async(socketQueue, ^{ @autoreleasepool { if ((flags & kSocketStarted) && !(flags & kQueuedTLS) && !(flags & kForbidReadsWrites)) { [readQueue addObject:packet]; [writeQueue addObject:packet]; flags |= kQueuedTLS; [self maybeDequeueRead]; [self maybeDequeueWrite]; } }}); } - (void)maybeStartTLS { // We can't start TLS until: // - All queued reads prior to the user calling startTLS are complete // - All queued writes prior to the user calling startTLS are complete // // We'll know these conditions are met when both kStartingReadTLS and kStartingWriteTLS are set if ((flags & kStartingReadTLS) && (flags & kStartingWriteTLS)) { BOOL useSecureTransport = YES; #if TARGET_OS_IPHONE { GCDAsyncSpecialPacket *tlsPacket = (GCDAsyncSpecialPacket *)currentRead; NSDictionary *tlsSettings = tlsPacket->tlsSettings; NSNumber *value = [tlsSettings objectForKey:GCDAsyncSocketUseCFStreamForTLS]; if (value && [value boolValue]) useSecureTransport = NO; } #endif if (useSecureTransport) { [self ssl_startTLS]; } else { #if TARGET_OS_IPHONE [self cf_startTLS]; #endif } } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Security via SecureTransport //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (OSStatus)sslReadWithBuffer:(void *)buffer length:(size_t *)bufferLength { LogVerbose(@"sslReadWithBuffer:%p length:%lu", buffer, (unsigned long)*bufferLength); if ((socketFDBytesAvailable == 0) && ([sslPreBuffer availableBytes] == 0)) { LogVerbose(@"%@ - No data available to read...", THIS_METHOD); // No data available to read. // // Need to wait for readSource to fire and notify us of // available data in the socket's internal read buffer. [self resumeReadSource]; *bufferLength = 0; return errSSLWouldBlock; } size_t totalBytesRead = 0; size_t totalBytesLeftToBeRead = *bufferLength; BOOL done = NO; BOOL socketError = NO; // // STEP 1 : READ FROM SSL PRE BUFFER // size_t sslPreBufferLength = [sslPreBuffer availableBytes]; if (sslPreBufferLength > 0) { LogVerbose(@"%@: Reading from SSL pre buffer...", THIS_METHOD); size_t bytesToCopy; if (sslPreBufferLength > totalBytesLeftToBeRead) bytesToCopy = totalBytesLeftToBeRead; else bytesToCopy = sslPreBufferLength; LogVerbose(@"%@: Copying %zu bytes from sslPreBuffer", THIS_METHOD, bytesToCopy); memcpy(buffer, [sslPreBuffer readBuffer], bytesToCopy); [sslPreBuffer didRead:bytesToCopy]; LogVerbose(@"%@: sslPreBuffer.length = %zu", THIS_METHOD, [sslPreBuffer availableBytes]); totalBytesRead += bytesToCopy; totalBytesLeftToBeRead -= bytesToCopy; done = (totalBytesLeftToBeRead == 0); if (done) LogVerbose(@"%@: Complete", THIS_METHOD); } // // STEP 2 : READ FROM SOCKET // if (!done && (socketFDBytesAvailable > 0)) { LogVerbose(@"%@: Reading from socket...", THIS_METHOD); int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; BOOL readIntoPreBuffer; size_t bytesToRead; uint8_t *buf; if (socketFDBytesAvailable > totalBytesLeftToBeRead) { // Read all available data from socket into sslPreBuffer. // Then copy requested amount into dataBuffer. LogVerbose(@"%@: Reading into sslPreBuffer...", THIS_METHOD); [sslPreBuffer ensureCapacityForWrite:socketFDBytesAvailable]; readIntoPreBuffer = YES; bytesToRead = (size_t)socketFDBytesAvailable; buf = [sslPreBuffer writeBuffer]; } else { // Read available data from socket directly into dataBuffer. LogVerbose(@"%@: Reading directly into dataBuffer...", THIS_METHOD); readIntoPreBuffer = NO; bytesToRead = totalBytesLeftToBeRead; buf = (uint8_t *)buffer + totalBytesRead; } ssize_t result = read(socketFD, buf, bytesToRead); LogVerbose(@"%@: read from socket = %zd", THIS_METHOD, result); if (result < 0) { LogVerbose(@"%@: read errno = %i", THIS_METHOD, errno); if (errno != EWOULDBLOCK) { socketError = YES; } socketFDBytesAvailable = 0; } else if (result == 0) { LogVerbose(@"%@: read EOF", THIS_METHOD); socketError = YES; socketFDBytesAvailable = 0; } else { size_t bytesReadFromSocket = result; if (socketFDBytesAvailable > bytesReadFromSocket) socketFDBytesAvailable -= bytesReadFromSocket; else socketFDBytesAvailable = 0; if (readIntoPreBuffer) { [sslPreBuffer didWrite:bytesReadFromSocket]; size_t bytesToCopy = MIN(totalBytesLeftToBeRead, bytesReadFromSocket); LogVerbose(@"%@: Copying %zu bytes out of sslPreBuffer", THIS_METHOD, bytesToCopy); memcpy((uint8_t *)buffer + totalBytesRead, [sslPreBuffer readBuffer], bytesToCopy); [sslPreBuffer didRead:bytesToCopy]; totalBytesRead += bytesToCopy; totalBytesLeftToBeRead -= bytesToCopy; LogVerbose(@"%@: sslPreBuffer.length = %zu", THIS_METHOD, [sslPreBuffer availableBytes]); } else { totalBytesRead += bytesReadFromSocket; totalBytesLeftToBeRead -= bytesReadFromSocket; } done = (totalBytesLeftToBeRead == 0); if (done) LogVerbose(@"%@: Complete", THIS_METHOD); } } *bufferLength = totalBytesRead; if (done) return noErr; if (socketError) return errSSLClosedAbort; return errSSLWouldBlock; } - (OSStatus)sslWriteWithBuffer:(const void *)buffer length:(size_t *)bufferLength { if (!(flags & kSocketCanAcceptBytes)) { // Unable to write. // // Need to wait for writeSource to fire and notify us of // available space in the socket's internal write buffer. [self resumeWriteSource]; *bufferLength = 0; return errSSLWouldBlock; } size_t bytesToWrite = *bufferLength; size_t bytesWritten = 0; BOOL done = NO; BOOL socketError = NO; int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; ssize_t result = write(socketFD, buffer, bytesToWrite); if (result < 0) { if (errno != EWOULDBLOCK) { socketError = YES; } flags &= ~kSocketCanAcceptBytes; } else if (result == 0) { flags &= ~kSocketCanAcceptBytes; } else { bytesWritten = result; done = (bytesWritten == bytesToWrite); } *bufferLength = bytesWritten; if (done) return noErr; if (socketError) return errSSLClosedAbort; return errSSLWouldBlock; } static OSStatus SSLReadFunction(SSLConnectionRef connection, void *data, size_t *dataLength) { GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)connection; NSCAssert(dispatch_get_specific(asyncSocket->IsOnSocketQueueOrTargetQueueKey), @"What the deuce?"); return [asyncSocket sslReadWithBuffer:data length:dataLength]; } static OSStatus SSLWriteFunction(SSLConnectionRef connection, const void *data, size_t *dataLength) { GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)connection; NSCAssert(dispatch_get_specific(asyncSocket->IsOnSocketQueueOrTargetQueueKey), @"What the deuce?"); return [asyncSocket sslWriteWithBuffer:data length:dataLength]; } - (void)ssl_startTLS { LogTrace(); LogVerbose(@"Starting TLS (via SecureTransport)..."); OSStatus status; GCDAsyncSpecialPacket *tlsPacket = (GCDAsyncSpecialPacket *)currentRead; if (tlsPacket == nil) // Code to quiet the analyzer { NSAssert(NO, @"Logic error"); [self closeWithError:[self otherError:@"Logic error"]]; return; } NSDictionary *tlsSettings = tlsPacket->tlsSettings; // Create SSLContext, and setup IO callbacks and connection ref BOOL isServer = [[tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLIsServer] boolValue]; #if TARGET_OS_IPHONE || (__MAC_OS_X_VERSION_MIN_REQUIRED >= 1080) { if (isServer) sslContext = SSLCreateContext(kCFAllocatorDefault, kSSLServerSide, kSSLStreamType); else sslContext = SSLCreateContext(kCFAllocatorDefault, kSSLClientSide, kSSLStreamType); if (sslContext == NULL) { [self closeWithError:[self otherError:@"Error in SSLCreateContext"]]; return; } } #else // (__MAC_OS_X_VERSION_MIN_REQUIRED < 1080) { status = SSLNewContext(isServer, &sslContext); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLNewContext"]]; return; } } #endif status = SSLSetIOFuncs(sslContext, &SSLReadFunction, &SSLWriteFunction); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetIOFuncs"]]; return; } status = SSLSetConnection(sslContext, (__bridge SSLConnectionRef)self); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetConnection"]]; return; } BOOL shouldManuallyEvaluateTrust = [[tlsSettings objectForKey:GCDAsyncSocketManuallyEvaluateTrust] boolValue]; if (shouldManuallyEvaluateTrust) { if (isServer) { [self closeWithError:[self otherError:@"Manual trust validation is not supported for server sockets"]]; return; } status = SSLSetSessionOption(sslContext, kSSLSessionOptionBreakOnServerAuth, true); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetSessionOption"]]; return; } #if !TARGET_OS_IPHONE && (__MAC_OS_X_VERSION_MIN_REQUIRED < 1080) // Note from Apple's documentation: // // It is only necessary to call SSLSetEnableCertVerify on the Mac prior to OS X 10.8. // On OS X 10.8 and later setting kSSLSessionOptionBreakOnServerAuth always disables the // built-in trust evaluation. All versions of iOS behave like OS X 10.8 and thus // SSLSetEnableCertVerify is not available on that platform at all. status = SSLSetEnableCertVerify(sslContext, NO); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetEnableCertVerify"]]; return; } #endif } // Configure SSLContext from given settings // // Checklist: // 1. kCFStreamSSLPeerName // 2. kCFStreamSSLCertificates // 3. GCDAsyncSocketSSLPeerID // 4. GCDAsyncSocketSSLProtocolVersionMin // 5. GCDAsyncSocketSSLProtocolVersionMax // 6. GCDAsyncSocketSSLSessionOptionFalseStart // 7. GCDAsyncSocketSSLSessionOptionSendOneByteRecord // 8. GCDAsyncSocketSSLCipherSuites // 9. GCDAsyncSocketSSLDiffieHellmanParameters (Mac) // // Deprecated (throw error): // 10. kCFStreamSSLAllowsAnyRoot // 11. kCFStreamSSLAllowsExpiredRoots // 12. kCFStreamSSLAllowsExpiredCertificates // 13. kCFStreamSSLValidatesCertificateChain // 14. kCFStreamSSLLevel id value; // 1. kCFStreamSSLPeerName value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLPeerName]; if ([value isKindOfClass:[NSString class]]) { NSString *peerName = (NSString *)value; const char *peer = [peerName UTF8String]; size_t peerLen = strlen(peer); status = SSLSetPeerDomainName(sslContext, peer, peerLen); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetPeerDomainName"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for kCFStreamSSLPeerName. Value must be of type NSString."); [self closeWithError:[self otherError:@"Invalid value for kCFStreamSSLPeerName."]]; return; } // 2. kCFStreamSSLCertificates value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLCertificates]; if ([value isKindOfClass:[NSArray class]]) { CFArrayRef certs = (__bridge CFArrayRef)value; status = SSLSetCertificate(sslContext, certs); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetCertificate"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for kCFStreamSSLCertificates. Value must be of type NSArray."); [self closeWithError:[self otherError:@"Invalid value for kCFStreamSSLCertificates."]]; return; } // 3. GCDAsyncSocketSSLPeerID value = [tlsSettings objectForKey:GCDAsyncSocketSSLPeerID]; if ([value isKindOfClass:[NSData class]]) { NSData *peerIdData = (NSData *)value; status = SSLSetPeerID(sslContext, [peerIdData bytes], [peerIdData length]); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetPeerID"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLPeerID. Value must be of type NSData." @" (You can convert strings to data using a method like" @" [string dataUsingEncoding:NSUTF8StringEncoding])"); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLPeerID."]]; return; } // 4. GCDAsyncSocketSSLProtocolVersionMin value = [tlsSettings objectForKey:GCDAsyncSocketSSLProtocolVersionMin]; if ([value isKindOfClass:[NSNumber class]]) { SSLProtocol minProtocol = (SSLProtocol)[(NSNumber *)value intValue]; if (minProtocol != kSSLProtocolUnknown) { status = SSLSetProtocolVersionMin(sslContext, minProtocol); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetProtocolVersionMin"]]; return; } } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLProtocolVersionMin. Value must be of type NSNumber."); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLProtocolVersionMin."]]; return; } // 5. GCDAsyncSocketSSLProtocolVersionMax value = [tlsSettings objectForKey:GCDAsyncSocketSSLProtocolVersionMax]; if ([value isKindOfClass:[NSNumber class]]) { SSLProtocol maxProtocol = (SSLProtocol)[(NSNumber *)value intValue]; if (maxProtocol != kSSLProtocolUnknown) { status = SSLSetProtocolVersionMax(sslContext, maxProtocol); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetProtocolVersionMax"]]; return; } } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLProtocolVersionMax. Value must be of type NSNumber."); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLProtocolVersionMax."]]; return; } // 6. GCDAsyncSocketSSLSessionOptionFalseStart value = [tlsSettings objectForKey:GCDAsyncSocketSSLSessionOptionFalseStart]; if ([value isKindOfClass:[NSNumber class]]) { status = SSLSetSessionOption(sslContext, kSSLSessionOptionFalseStart, [value boolValue]); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetSessionOption (kSSLSessionOptionFalseStart)"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLSessionOptionFalseStart. Value must be of type NSNumber."); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLSessionOptionFalseStart."]]; return; } // 7. GCDAsyncSocketSSLSessionOptionSendOneByteRecord value = [tlsSettings objectForKey:GCDAsyncSocketSSLSessionOptionSendOneByteRecord]; if ([value isKindOfClass:[NSNumber class]]) { status = SSLSetSessionOption(sslContext, kSSLSessionOptionSendOneByteRecord, [value boolValue]); if (status != noErr) { [self closeWithError: [self otherError:@"Error in SSLSetSessionOption (kSSLSessionOptionSendOneByteRecord)"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLSessionOptionSendOneByteRecord." @" Value must be of type NSNumber."); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLSessionOptionSendOneByteRecord."]]; return; } // 8. GCDAsyncSocketSSLCipherSuites value = [tlsSettings objectForKey:GCDAsyncSocketSSLCipherSuites]; if ([value isKindOfClass:[NSArray class]]) { NSArray *cipherSuites = (NSArray *)value; NSUInteger numberCiphers = [cipherSuites count]; SSLCipherSuite ciphers[numberCiphers]; NSUInteger cipherIndex; for (cipherIndex = 0; cipherIndex < numberCiphers; cipherIndex++) { NSNumber *cipherObject = [cipherSuites objectAtIndex:cipherIndex]; ciphers[cipherIndex] = [cipherObject shortValue]; } status = SSLSetEnabledCiphers(sslContext, ciphers, numberCiphers); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetEnabledCiphers"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLCipherSuites. Value must be of type NSArray."); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLCipherSuites."]]; return; } // 9. GCDAsyncSocketSSLDiffieHellmanParameters #if !TARGET_OS_IPHONE value = [tlsSettings objectForKey:GCDAsyncSocketSSLDiffieHellmanParameters]; if ([value isKindOfClass:[NSData class]]) { NSData *diffieHellmanData = (NSData *)value; status = SSLSetDiffieHellmanParams(sslContext, [diffieHellmanData bytes], [diffieHellmanData length]); if (status != noErr) { [self closeWithError:[self otherError:@"Error in SSLSetDiffieHellmanParams"]]; return; } } else if (value) { NSAssert(NO, @"Invalid value for GCDAsyncSocketSSLDiffieHellmanParameters. Value must be of type NSData."); [self closeWithError:[self otherError:@"Invalid value for GCDAsyncSocketSSLDiffieHellmanParameters."]]; return; } #endif // DEPRECATED checks // 10. kCFStreamSSLAllowsAnyRoot #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLAllowsAnyRoot]; #pragma clang diagnostic pop if (value) { NSAssert(NO, @"Security option unavailable - kCFStreamSSLAllowsAnyRoot" @" - You must use manual trust evaluation"); [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLAllowsAnyRoot"]]; return; } // 11. kCFStreamSSLAllowsExpiredRoots #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLAllowsExpiredRoots]; #pragma clang diagnostic pop if (value) { NSAssert(NO, @"Security option unavailable - kCFStreamSSLAllowsExpiredRoots" @" - You must use manual trust evaluation"); [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLAllowsExpiredRoots"]]; return; } // 12. kCFStreamSSLValidatesCertificateChain #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLValidatesCertificateChain]; #pragma clang diagnostic pop if (value) { NSAssert(NO, @"Security option unavailable - kCFStreamSSLValidatesCertificateChain" @" - You must use manual trust evaluation"); [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLValidatesCertificateChain"]]; return; } // 13. kCFStreamSSLAllowsExpiredCertificates #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLAllowsExpiredCertificates]; #pragma clang diagnostic pop if (value) { NSAssert(NO, @"Security option unavailable - kCFStreamSSLAllowsExpiredCertificates" @" - You must use manual trust evaluation"); [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLAllowsExpiredCertificates"]]; return; } // 14. kCFStreamSSLLevel #pragma clang diagnostic push #pragma clang diagnostic ignored "-Wdeprecated-declarations" value = [tlsSettings objectForKey:(__bridge NSString *)kCFStreamSSLLevel]; #pragma clang diagnostic pop if (value) { NSAssert(NO, @"Security option unavailable - kCFStreamSSLLevel" @" - You must use GCDAsyncSocketSSLProtocolVersionMin & GCDAsyncSocketSSLProtocolVersionMax"); [self closeWithError:[self otherError:@"Security option unavailable - kCFStreamSSLLevel"]]; return; } // Setup the sslPreBuffer // // Any data in the preBuffer needs to be moved into the sslPreBuffer, // as this data is now part of the secure read stream. sslPreBuffer = [[GCDAsyncSocketPreBuffer alloc] initWithCapacity:(1024 * 4)]; size_t preBufferLength = [preBuffer availableBytes]; if (preBufferLength > 0) { [sslPreBuffer ensureCapacityForWrite:preBufferLength]; memcpy([sslPreBuffer writeBuffer], [preBuffer readBuffer], preBufferLength); [preBuffer didRead:preBufferLength]; [sslPreBuffer didWrite:preBufferLength]; } sslErrCode = lastSSLHandshakeError = noErr; // Start the SSL Handshake process [self ssl_continueSSLHandshake]; } - (void)ssl_continueSSLHandshake { LogTrace(); // If the return value is noErr, the session is ready for normal secure communication. // If the return value is errSSLWouldBlock, the SSLHandshake function must be called again. // If the return value is errSSLServerAuthCompleted, we ask delegate if we should trust the // server and then call SSLHandshake again to resume the handshake or close the connection // errSSLPeerBadCert SSL error. // Otherwise, the return value indicates an error code. OSStatus status = SSLHandshake(sslContext); lastSSLHandshakeError = status; if (status == noErr) { LogVerbose(@"SSLHandshake complete"); flags &= ~kStartingReadTLS; flags &= ~kStartingWriteTLS; flags |= kSocketSecure; __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidSecure:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socketDidSecure:self]; }}); } [self endCurrentRead]; [self endCurrentWrite]; [self maybeDequeueRead]; [self maybeDequeueWrite]; } else if (status == errSSLPeerAuthCompleted) { LogVerbose(@"SSLHandshake peerAuthCompleted - awaiting delegate approval"); __block SecTrustRef trust = NULL; status = SSLCopyPeerTrust(sslContext, &trust); if (status != noErr) { [self closeWithError:[self sslError:status]]; return; } int aStateIndex = stateIndex; dispatch_queue_t theSocketQueue = socketQueue; __weak GCDAsyncSocket *weakSelf = self; void (^comletionHandler)(BOOL) = ^(BOOL shouldTrust){ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" dispatch_async(theSocketQueue, ^{ @autoreleasepool { if (trust) { CFRelease(trust); trust = NULL; } __strong GCDAsyncSocket *strongSelf = weakSelf; if (strongSelf) { [strongSelf ssl_shouldTrustPeer:shouldTrust stateIndex:aStateIndex]; } }}); #pragma clang diagnostic pop }}; __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socket:didReceiveTrust:completionHandler:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socket:self didReceiveTrust:trust completionHandler:comletionHandler]; }}); } else { if (trust) { CFRelease(trust); trust = NULL; } NSString *msg = @"GCDAsyncSocketManuallyEvaluateTrust specified in tlsSettings," @" but delegate doesn't implement socket:shouldTrustPeer:"; [self closeWithError:[self otherError:msg]]; return; } } else if (status == errSSLWouldBlock) { LogVerbose(@"SSLHandshake continues..."); // Handshake continues... // // This method will be called again from doReadData or doWriteData. } else { [self closeWithError:[self sslError:status]]; } } - (void)ssl_shouldTrustPeer:(BOOL)shouldTrust stateIndex:(int)aStateIndex { LogTrace(); if (aStateIndex != stateIndex) { LogInfo(@"Ignoring ssl_shouldTrustPeer - invalid state (maybe disconnected)"); // One of the following is true // - the socket was disconnected // - the startTLS operation timed out // - the completionHandler was already invoked once return; } // Increment stateIndex to ensure completionHandler can only be called once. stateIndex++; if (shouldTrust) { NSAssert(lastSSLHandshakeError == errSSLPeerAuthCompleted, @"ssl_shouldTrustPeer called when last error is %d and not errSSLPeerAuthCompleted", (int)lastSSLHandshakeError); [self ssl_continueSSLHandshake]; } else { [self closeWithError:[self sslError:errSSLPeerBadCert]]; } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Security via CFStream //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #if TARGET_OS_IPHONE - (void)cf_finishSSLHandshake { LogTrace(); if ((flags & kStartingReadTLS) && (flags & kStartingWriteTLS)) { flags &= ~kStartingReadTLS; flags &= ~kStartingWriteTLS; flags |= kSocketSecure; __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(socketDidSecure:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate socketDidSecure:self]; }}); } [self endCurrentRead]; [self endCurrentWrite]; [self maybeDequeueRead]; [self maybeDequeueWrite]; } } - (void)cf_abortSSLHandshake:(NSError *)error { LogTrace(); if ((flags & kStartingReadTLS) && (flags & kStartingWriteTLS)) { flags &= ~kStartingReadTLS; flags &= ~kStartingWriteTLS; [self closeWithError:error]; } } - (void)cf_startTLS { LogTrace(); LogVerbose(@"Starting TLS (via CFStream)..."); if ([preBuffer availableBytes] > 0) { NSString *msg = @"Invalid TLS transition. Handshake has already been read from socket."; [self closeWithError:[self otherError:msg]]; return; } [self suspendReadSource]; [self suspendWriteSource]; socketFDBytesAvailable = 0; flags &= ~kSocketCanAcceptBytes; flags &= ~kSecureSocketHasBytesAvailable; flags |= kUsingCFStreamForTLS; if (![self createReadAndWriteStream]) { [self closeWithError:[self otherError:@"Error in CFStreamCreatePairWithSocket"]]; return; } if (![self registerForStreamCallbacksIncludingReadWrite:YES]) { [self closeWithError:[self otherError:@"Error in CFStreamSetClient"]]; return; } if (![self addStreamsToRunLoop]) { [self closeWithError:[self otherError:@"Error in CFStreamScheduleWithRunLoop"]]; return; } NSAssert([currentRead isKindOfClass:[GCDAsyncSpecialPacket class]], @"Invalid read packet for startTLS"); NSAssert([currentWrite isKindOfClass:[GCDAsyncSpecialPacket class]], @"Invalid write packet for startTLS"); GCDAsyncSpecialPacket *tlsPacket = (GCDAsyncSpecialPacket *)currentRead; CFDictionaryRef tlsSettings = (__bridge CFDictionaryRef)tlsPacket->tlsSettings; // Getting an error concerning kCFStreamPropertySSLSettings ? // You need to add the CFNetwork framework to your iOS application. BOOL r1 = CFReadStreamSetProperty(readStream, kCFStreamPropertySSLSettings, tlsSettings); BOOL r2 = CFWriteStreamSetProperty(writeStream, kCFStreamPropertySSLSettings, tlsSettings); // For some reason, starting around the time of iOS 4.3, // the first call to set the kCFStreamPropertySSLSettings will return true, // but the second will return false. // // Order doesn't seem to matter. // So you could call CFReadStreamSetProperty and then CFWriteStreamSetProperty, or you could reverse the order. // Either way, the first call will return true, and the second returns false. // // Interestingly, this doesn't seem to affect anything. // Which is not altogether unusual, as the documentation seems to suggest that (for many settings) // setting it on one side of the stream automatically sets it for the other side of the stream. // // Although there isn't anything in the documentation to suggest that the second attempt would fail. // // Furthermore, this only seems to affect streams that are negotiating a security upgrade. // In other words, the socket gets connected, there is some back-and-forth communication over the unsecure // connection, and then a startTLS is issued. // So this mostly affects newer protocols (XMPP, IMAP) as opposed to older protocols (HTTPS). if (!r1 && !r2) // Yes, the && is correct - workaround for apple bug. { [self closeWithError:[self otherError:@"Error in CFStreamSetProperty"]]; return; } if (![self openStreams]) { [self closeWithError:[self otherError:@"Error in CFStreamOpen"]]; return; } LogVerbose(@"Waiting for SSL Handshake to complete..."); } #endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark CFStream //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #if TARGET_OS_IPHONE + (void)ignore:(id)_ {} + (void)startCFStreamThreadIfNeeded { LogTrace(); static dispatch_once_t predicate; dispatch_once(&predicate, ^{ cfstreamThreadRetainCount = 0; cfstreamThreadSetupQueue = dispatch_queue_create("GCDAsyncSocket-CFStreamThreadSetup", DISPATCH_QUEUE_SERIAL); }); dispatch_sync(cfstreamThreadSetupQueue, ^{ @autoreleasepool { if (++cfstreamThreadRetainCount == 1) { cfstreamThread = [[NSThread alloc] initWithTarget:self selector:@selector(cfstreamThread) object:nil]; [cfstreamThread start]; } }}); } + (void)stopCFStreamThreadIfNeeded { LogTrace(); // The creation of the cfstreamThread is relatively expensive. // So we'd like to keep it available for recycling. // However, there's a tradeoff here, because it shouldn't remain alive forever. // So what we're going to do is use a little delay before taking it down. // This way it can be reused properly in situations where multiple sockets are continually in flux. int delayInSeconds = 30; dispatch_time_t when = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(delayInSeconds * NSEC_PER_SEC)); dispatch_after(when, cfstreamThreadSetupQueue, ^{ @autoreleasepool { #pragma clang diagnostic push #pragma clang diagnostic warning "-Wimplicit-retain-self" if (cfstreamThreadRetainCount == 0) { LogWarn(@"Logic error concerning cfstreamThread start / stop"); return_from_block; } if (--cfstreamThreadRetainCount == 0) { [cfstreamThread cancel]; // set isCancelled flag // wake up the thread [GCDAsyncSocket performSelector:@selector(ignore:) onThread:cfstreamThread withObject:[NSNull null] waitUntilDone:NO]; cfstreamThread = nil; } #pragma clang diagnostic pop }}); } + (void)cfstreamThread { @autoreleasepool { [[NSThread currentThread] setName:GCDAsyncSocketThreadName]; LogInfo(@"CFStreamThread: Started"); // We can't run the run loop unless it has an associated input source or a timer. // So we'll just create a timer that will never fire - unless the server runs for decades. [NSTimer scheduledTimerWithTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow] target:self selector:@selector(ignore:) userInfo:nil repeats:YES]; NSThread *currentThread = [NSThread currentThread]; NSRunLoop *currentRunLoop = [NSRunLoop currentRunLoop]; BOOL isCancelled = [currentThread isCancelled]; while (!isCancelled && [currentRunLoop runMode:NSDefaultRunLoopMode beforeDate:[NSDate distantFuture]]) { isCancelled = [currentThread isCancelled]; } LogInfo(@"CFStreamThread: Stopped"); }} + (void)scheduleCFStreams:(GCDAsyncSocket *)asyncSocket { LogTrace(); NSAssert([NSThread currentThread] == cfstreamThread, @"Invoked on wrong thread"); CFRunLoopRef runLoop = CFRunLoopGetCurrent(); if (asyncSocket->readStream) CFReadStreamScheduleWithRunLoop(asyncSocket->readStream, runLoop, kCFRunLoopDefaultMode); if (asyncSocket->writeStream) CFWriteStreamScheduleWithRunLoop(asyncSocket->writeStream, runLoop, kCFRunLoopDefaultMode); } + (void)unscheduleCFStreams:(GCDAsyncSocket *)asyncSocket { LogTrace(); NSAssert([NSThread currentThread] == cfstreamThread, @"Invoked on wrong thread"); CFRunLoopRef runLoop = CFRunLoopGetCurrent(); if (asyncSocket->readStream) CFReadStreamUnscheduleFromRunLoop(asyncSocket->readStream, runLoop, kCFRunLoopDefaultMode); if (asyncSocket->writeStream) CFWriteStreamUnscheduleFromRunLoop(asyncSocket->writeStream, runLoop, kCFRunLoopDefaultMode); } static void CFReadStreamCallback (CFReadStreamRef stream, CFStreamEventType type, void *pInfo) { GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)pInfo; switch(type) { case kCFStreamEventHasBytesAvailable: { dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { LogCVerbose(@"CFReadStreamCallback - HasBytesAvailable"); if (asyncSocket->readStream != stream) return_from_block; if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) { // If we set kCFStreamPropertySSLSettings before we opened the streams, this might be a lie. // (A callback related to the tcp stream, but not to the SSL layer). if (CFReadStreamHasBytesAvailable(asyncSocket->readStream)) { asyncSocket->flags |= kSecureSocketHasBytesAvailable; [asyncSocket cf_finishSSLHandshake]; } } else { asyncSocket->flags |= kSecureSocketHasBytesAvailable; [asyncSocket doReadData]; } }}); break; } default: { NSError *error = (__bridge_transfer NSError *)CFReadStreamCopyError(stream); if (error == nil && type == kCFStreamEventEndEncountered) { error = [asyncSocket connectionClosedError]; } dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { LogCVerbose(@"CFReadStreamCallback - Other"); if (asyncSocket->readStream != stream) return_from_block; if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) { [asyncSocket cf_abortSSLHandshake:error]; } else { [asyncSocket closeWithError:error]; } }}); break; } } } static void CFWriteStreamCallback (CFWriteStreamRef stream, CFStreamEventType type, void *pInfo) { GCDAsyncSocket *asyncSocket = (__bridge GCDAsyncSocket *)pInfo; switch(type) { case kCFStreamEventCanAcceptBytes: { dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { LogCVerbose(@"CFWriteStreamCallback - CanAcceptBytes"); if (asyncSocket->writeStream != stream) return_from_block; if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) { // If we set kCFStreamPropertySSLSettings before we opened the streams, this might be a lie. // (A callback related to the tcp stream, but not to the SSL layer). if (CFWriteStreamCanAcceptBytes(asyncSocket->writeStream)) { asyncSocket->flags |= kSocketCanAcceptBytes; [asyncSocket cf_finishSSLHandshake]; } } else { asyncSocket->flags |= kSocketCanAcceptBytes; [asyncSocket doWriteData]; } }}); break; } default: { NSError *error = (__bridge_transfer NSError *)CFWriteStreamCopyError(stream); if (error == nil && type == kCFStreamEventEndEncountered) { error = [asyncSocket connectionClosedError]; } dispatch_async(asyncSocket->socketQueue, ^{ @autoreleasepool { LogCVerbose(@"CFWriteStreamCallback - Other"); if (asyncSocket->writeStream != stream) return_from_block; if ((asyncSocket->flags & kStartingReadTLS) && (asyncSocket->flags & kStartingWriteTLS)) { [asyncSocket cf_abortSSLHandshake:error]; } else { [asyncSocket closeWithError:error]; } }}); break; } } } - (BOOL)createReadAndWriteStream { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (readStream || writeStream) { // Streams already created return YES; } int socketFD = (socket4FD != SOCKET_NULL) ? socket4FD : (socket6FD != SOCKET_NULL) ? socket6FD : socketUN; if (socketFD == SOCKET_NULL) { // Cannot create streams without a file descriptor return NO; } if (![self isConnected]) { // Cannot create streams until file descriptor is connected return NO; } LogVerbose(@"Creating read and write stream..."); CFStreamCreatePairWithSocket(NULL, (CFSocketNativeHandle)socketFD, &readStream, &writeStream); // The kCFStreamPropertyShouldCloseNativeSocket property should be false by default (for our case). // But let's not take any chances. if (readStream) CFReadStreamSetProperty(readStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); if (writeStream) CFWriteStreamSetProperty(writeStream, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); if ((readStream == NULL) || (writeStream == NULL)) { LogWarn(@"Unable to create read and write stream..."); if (readStream) { CFReadStreamClose(readStream); CFRelease(readStream); readStream = NULL; } if (writeStream) { CFWriteStreamClose(writeStream); CFRelease(writeStream); writeStream = NULL; } return NO; } return YES; } - (BOOL)registerForStreamCallbacksIncludingReadWrite:(BOOL)includeReadWrite { LogVerbose(@"%@ %@", THIS_METHOD, (includeReadWrite ? @"YES" : @"NO")); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); streamContext.version = 0; streamContext.info = (__bridge void *)(self); streamContext.retain = nil; streamContext.release = nil; streamContext.copyDescription = nil; CFOptionFlags readStreamEvents = kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered; if (includeReadWrite) readStreamEvents |= kCFStreamEventHasBytesAvailable; if (!CFReadStreamSetClient(readStream, readStreamEvents, &CFReadStreamCallback, &streamContext)) { return NO; } CFOptionFlags writeStreamEvents = kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered; if (includeReadWrite) writeStreamEvents |= kCFStreamEventCanAcceptBytes; if (!CFWriteStreamSetClient(writeStream, writeStreamEvents, &CFWriteStreamCallback, &streamContext)) { return NO; } return YES; } - (BOOL)addStreamsToRunLoop { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); if (!(flags & kAddedStreamsToRunLoop)) { LogVerbose(@"Adding streams to runloop..."); [[self class] startCFStreamThreadIfNeeded]; [[self class] performSelector:@selector(scheduleCFStreams:) onThread:cfstreamThread withObject:self waitUntilDone:YES]; flags |= kAddedStreamsToRunLoop; } return YES; } - (void)removeStreamsFromRunLoop { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); if (flags & kAddedStreamsToRunLoop) { LogVerbose(@"Removing streams from runloop..."); [[self class] performSelector:@selector(unscheduleCFStreams:) onThread:cfstreamThread withObject:self waitUntilDone:YES]; [[self class] stopCFStreamThreadIfNeeded]; flags &= ~kAddedStreamsToRunLoop; } } - (BOOL)openStreams { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert((readStream != NULL && writeStream != NULL), @"Read/Write stream is null"); CFStreamStatus readStatus = CFReadStreamGetStatus(readStream); CFStreamStatus writeStatus = CFWriteStreamGetStatus(writeStream); if ((readStatus == kCFStreamStatusNotOpen) || (writeStatus == kCFStreamStatusNotOpen)) { LogVerbose(@"Opening read and write stream..."); BOOL r1 = CFReadStreamOpen(readStream); BOOL r2 = CFWriteStreamOpen(writeStream); if (!r1 || !r2) { LogError(@"Error in CFStreamOpen"); return NO; } } return YES; } #endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Advanced //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * See header file for big discussion of this method. **/ - (BOOL)autoDisconnectOnClosedReadStream { // Note: YES means kAllowHalfDuplexConnection is OFF if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return ((config & kAllowHalfDuplexConnection) == 0); } else { __block BOOL result; dispatch_sync(socketQueue, ^{ result = ((config & kAllowHalfDuplexConnection) == 0); }); return result; } } /** * See header file for big discussion of this method. **/ - (void)setAutoDisconnectOnClosedReadStream:(BOOL)flag { // Note: YES means kAllowHalfDuplexConnection is OFF dispatch_block_t block = ^{ if (flag) config &= ~kAllowHalfDuplexConnection; else config |= kAllowHalfDuplexConnection; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } /** * See header file for big discussion of this method. **/ - (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketNewTargetQueue { void *nonNullUnusedPointer = (__bridge void *)self; dispatch_queue_set_specific(socketNewTargetQueue, IsOnSocketQueueOrTargetQueueKey, nonNullUnusedPointer, NULL); } /** * See header file for big discussion of this method. **/ - (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketOldTargetQueue { dispatch_queue_set_specific(socketOldTargetQueue, IsOnSocketQueueOrTargetQueueKey, NULL, NULL); } /** * See header file for big discussion of this method. **/ - (void)performBlock:(dispatch_block_t)block { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); } /** * Questions? Have you read the header file? **/ - (int)socketFD { if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return SOCKET_NULL; } if (socket4FD != SOCKET_NULL) return socket4FD; else return socket6FD; } /** * Questions? Have you read the header file? **/ - (int)socket4FD { if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return SOCKET_NULL; } return socket4FD; } /** * Questions? Have you read the header file? **/ - (int)socket6FD { if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return SOCKET_NULL; } return socket6FD; } #if TARGET_OS_IPHONE /** * Questions? Have you read the header file? **/ - (CFReadStreamRef)readStream { if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return NULL; } if (readStream == NULL) [self createReadAndWriteStream]; return readStream; } /** * Questions? Have you read the header file? **/ - (CFWriteStreamRef)writeStream { if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return NULL; } if (writeStream == NULL) [self createReadAndWriteStream]; return writeStream; } - (BOOL)enableBackgroundingOnSocketWithCaveat:(BOOL)caveat { if (![self createReadAndWriteStream]) { // Error occurred creating streams (perhaps socket isn't open) return NO; } BOOL r1, r2; LogVerbose(@"Enabling backgrouding on socket"); r1 = CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); r2 = CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); if (!r1 || !r2) { return NO; } if (!caveat) { if (![self openStreams]) { return NO; } } return YES; } /** * Questions? Have you read the header file? **/ - (BOOL)enableBackgroundingOnSocket { LogTrace(); if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return NO; } return [self enableBackgroundingOnSocketWithCaveat:NO]; } - (BOOL)enableBackgroundingOnSocketWithCaveat // Deprecated in iOS 4.??? { // This method was created as a workaround for a bug in iOS. // Apple has since fixed this bug. // I'm not entirely sure which version of iOS they fixed it in... LogTrace(); if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return NO; } return [self enableBackgroundingOnSocketWithCaveat:YES]; } #endif - (SSLContextRef)sslContext { if (!dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@ - Method only available from within the context of a performBlock: invocation", THIS_METHOD); return NULL; } return sslContext; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Class Utilities //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + (NSMutableArray *)lookupHost:(NSString *)host port:(uint16_t)port error:(NSError **)errPtr { LogTrace(); NSMutableArray *addresses = nil; NSError *error = nil; if ([host isEqualToString:@"localhost"] || [host isEqualToString:@"loopback"]) { // Use LOOPBACK address struct sockaddr_in nativeAddr4; nativeAddr4.sin_len = sizeof(struct sockaddr_in); nativeAddr4.sin_family = AF_INET; nativeAddr4.sin_port = htons(port); nativeAddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); memset(&(nativeAddr4.sin_zero), 0, sizeof(nativeAddr4.sin_zero)); struct sockaddr_in6 nativeAddr6; nativeAddr6.sin6_len = sizeof(struct sockaddr_in6); nativeAddr6.sin6_family = AF_INET6; nativeAddr6.sin6_port = htons(port); nativeAddr6.sin6_flowinfo = 0; nativeAddr6.sin6_addr = in6addr_loopback; nativeAddr6.sin6_scope_id = 0; // Wrap the native address structures NSData *address4 = [NSData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; NSData *address6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; addresses = [NSMutableArray arrayWithCapacity:2]; [addresses addObject:address4]; [addresses addObject:address6]; } else { NSString *portStr = [NSString stringWithFormat:@"%hu", port]; struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_STREAM; hints.ai_protocol = IPPROTO_TCP;//IPPROTO_TCP int gai_error = getaddrinfo([host UTF8String], [portStr UTF8String], &hints, &res0); if (gai_error) { error = [self gaiError:gai_error]; } else { NSUInteger capacity = 0; for (res = res0; res; res = res->ai_next) { if (res->ai_family == AF_INET || res->ai_family == AF_INET6) { capacity++; } } addresses = [NSMutableArray arrayWithCapacity:capacity]; for (res = res0; res; res = res->ai_next) { if (res->ai_family == AF_INET) { // Found IPv4 address. // Wrap the native address structure, and add to results. ((struct sockaddr_in*)(res->ai_addr))->sin_port = htons(port); NSData *address4 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; [addresses addObject:address4]; } else if (res->ai_family == AF_INET6) { // Found IPv6 address. // Wrap the native address structure, and add to results. ((struct sockaddr_in6*)(res->ai_addr))->sin6_port = htons(port); NSData *address6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; [addresses addObject:address6]; } } freeaddrinfo(res0); if ([addresses count] == 0) { error = [self gaiError:EAI_FAIL]; } } } if (errPtr) *errPtr = error; return addresses; } + (NSString *)hostFromSockaddr4:(const struct sockaddr_in *)pSockaddr4 { char addrBuf[INET_ADDRSTRLEN]; if (inet_ntop(AF_INET, &pSockaddr4->sin_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) { addrBuf[0] = '\0'; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } + (NSString *)hostFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6 { char addrBuf[INET6_ADDRSTRLEN]; if (inet_ntop(AF_INET6, &pSockaddr6->sin6_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) { addrBuf[0] = '\0'; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } + (uint16_t)portFromSockaddr4:(const struct sockaddr_in *)pSockaddr4 { return ntohs(pSockaddr4->sin_port); } + (uint16_t)portFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6 { return ntohs(pSockaddr6->sin6_port); } + (NSURL *)urlFromSockaddrUN:(const struct sockaddr_un *)pSockaddr { NSString *path = [NSString stringWithUTF8String:pSockaddr->sun_path]; return [NSURL fileURLWithPath:path]; } + (NSString *)hostFromAddress:(NSData *)address { NSString *host; if ([self getHost:&host port:NULL fromAddress:address]) return host; else return nil; } + (uint16_t)portFromAddress:(NSData *)address { uint16_t port; if ([self getHost:NULL port:&port fromAddress:address]) return port; else return 0; } + (BOOL)isIPv4Address:(NSData *)address { if ([address length] >= sizeof(struct sockaddr)) { const struct sockaddr *sockaddrX = [address bytes]; if (sockaddrX->sa_family == AF_INET) { return YES; } } return NO; } + (BOOL)isIPv6Address:(NSData *)address { if ([address length] >= sizeof(struct sockaddr)) { const struct sockaddr *sockaddrX = [address bytes]; if (sockaddrX->sa_family == AF_INET6) { return YES; } } return NO; } + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr fromAddress:(NSData *)address { return [self getHost:hostPtr port:portPtr family:NULL fromAddress:address]; } + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(sa_family_t *)afPtr fromAddress:(NSData *)address { if ([address length] >= sizeof(struct sockaddr)) { const struct sockaddr *sockaddrX = [address bytes]; if (sockaddrX->sa_family == AF_INET) { if ([address length] >= sizeof(struct sockaddr_in)) { struct sockaddr_in sockaddr4; memcpy(&sockaddr4, sockaddrX, sizeof(sockaddr4)); if (hostPtr) *hostPtr = [self hostFromSockaddr4:&sockaddr4]; if (portPtr) *portPtr = [self portFromSockaddr4:&sockaddr4]; if (afPtr) *afPtr = AF_INET; return YES; } } else if (sockaddrX->sa_family == AF_INET6) { if ([address length] >= sizeof(struct sockaddr_in6)) { struct sockaddr_in6 sockaddr6; memcpy(&sockaddr6, sockaddrX, sizeof(sockaddr6)); if (hostPtr) *hostPtr = [self hostFromSockaddr6:&sockaddr6]; if (portPtr) *portPtr = [self portFromSockaddr6:&sockaddr6]; if (afPtr) *afPtr = AF_INET6; return YES; } } } return NO; } + (NSData *)CRLFData { return [NSData dataWithBytes:"\x0D\x0A" length:2]; } + (NSData *)CRData { return [NSData dataWithBytes:"\x0D" length:1]; } + (NSData *)LFData { return [NSData dataWithBytes:"\x0A" length:1]; } + (NSData *)ZeroData { return [NSData dataWithBytes:"" length:1]; } @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/GCDAsyncUdpSocket.h ================================================ // // GCDAsyncUdpSocket // // This class is in the public domain. // Originally created by Robbie Hanson of Deusty LLC. // Updated and maintained by Deusty LLC and the Apple development community. // // https://github.com/robbiehanson/CocoaAsyncSocket // #import #import #import #import extern NSString *const GCDAsyncUdpSocketException; extern NSString *const GCDAsyncUdpSocketErrorDomain; extern NSString *const GCDAsyncUdpSocketQueueName; extern NSString *const GCDAsyncUdpSocketThreadName; typedef NS_ENUM(NSInteger, GCDAsyncUdpSocketError) { GCDAsyncUdpSocketNoError = 0, // Never used GCDAsyncUdpSocketBadConfigError, // Invalid configuration GCDAsyncUdpSocketBadParamError, // Invalid parameter was passed GCDAsyncUdpSocketSendTimeoutError, // A send operation timed out GCDAsyncUdpSocketClosedError, // The socket was closed GCDAsyncUdpSocketOtherError, // Description provided in userInfo }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @class GCDAsyncUdpSocket; @protocol GCDAsyncUdpSocketDelegate @optional /** * By design, UDP is a connectionless protocol, and connecting is not needed. * However, you may optionally choose to connect to a particular host for reasons * outlined in the documentation for the various connect methods listed above. * * This method is called if one of the connect methods are invoked, and the connection is successful. **/ - (void)udpSocket:(GCDAsyncUdpSocket *)sock didConnectToAddress:(NSData *)address; /** * By design, UDP is a connectionless protocol, and connecting is not needed. * However, you may optionally choose to connect to a particular host for reasons * outlined in the documentation for the various connect methods listed above. * * This method is called if one of the connect methods are invoked, and the connection fails. * This may happen, for example, if a domain name is given for the host and the domain name is unable to be resolved. **/ - (void)udpSocket:(GCDAsyncUdpSocket *)sock didNotConnect:(NSError *)error; /** * Called when the datagram with the given tag has been sent. **/ - (void)udpSocket:(GCDAsyncUdpSocket *)sock didSendDataWithTag:(long)tag; /** * Called if an error occurs while trying to send a datagram. * This could be due to a timeout, or something more serious such as the data being too large to fit in a sigle packet. **/ - (void)udpSocket:(GCDAsyncUdpSocket *)sock didNotSendDataWithTag:(long)tag dueToError:(NSError *)error; /** * Called when the socket has received the requested datagram. **/ - (void)udpSocket:(GCDAsyncUdpSocket *)sock didReceiveData:(NSData *)data fromAddress:(NSData *)address withFilterContext:(id)filterContext; /** * Called when the socket is closed. **/ - (void)udpSocketDidClose:(GCDAsyncUdpSocket *)sock withError:(NSError *)error; @end /** * You may optionally set a receive filter for the socket. * A filter can provide several useful features: * * 1. Many times udp packets need to be parsed. * Since the filter can run in its own independent queue, you can parallelize this parsing quite easily. * The end result is a parallel socket io, datagram parsing, and packet processing. * * 2. Many times udp packets are discarded because they are duplicate/unneeded/unsolicited. * The filter can prevent such packets from arriving at the delegate. * And because the filter can run in its own independent queue, this doesn't slow down the delegate. * * - Since the udp protocol does not guarantee delivery, udp packets may be lost. * Many protocols built atop udp thus provide various resend/re-request algorithms. * This sometimes results in duplicate packets arriving. * A filter may allow you to architect the duplicate detection code to run in parallel to normal processing. * * - Since the udp socket may be connectionless, its possible for unsolicited packets to arrive. * Such packets need to be ignored. * * 3. Sometimes traffic shapers are needed to simulate real world environments. * A filter allows you to write custom code to simulate such environments. * The ability to code this yourself is especially helpful when your simulated environment * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), * or the system tools to handle this aren't available (e.g. on a mobile device). * * @param data - The packet that was received. * @param address - The address the data was received from. * See utilities section for methods to extract info from address. * @param context - Out parameter you may optionally set, which will then be passed to the delegate method. * For example, filter block can parse the data and then, * pass the parsed data to the delegate. * * @returns - YES if the received packet should be passed onto the delegate. * NO if the received packet should be discarded, and not reported to the delegete. * * Example: * * GCDAsyncUdpSocketReceiveFilterBlock filter = ^BOOL (NSData *data, NSData *address, id *context) { * * MyProtocolMessage *msg = [MyProtocol parseMessage:data]; * * *context = response; * return (response != nil); * }; * [udpSocket setReceiveFilter:filter withQueue:myParsingQueue]; * **/ typedef BOOL (^GCDAsyncUdpSocketReceiveFilterBlock)(NSData *data, NSData *address, id *context); /** * You may optionally set a send filter for the socket. * A filter can provide several interesting possibilities: * * 1. Optional caching of resolved addresses for domain names. * The cache could later be consulted, resulting in fewer system calls to getaddrinfo. * * 2. Reusable modules of code for bandwidth monitoring. * * 3. Sometimes traffic shapers are needed to simulate real world environments. * A filter allows you to write custom code to simulate such environments. * The ability to code this yourself is especially helpful when your simulated environment * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), * or the system tools to handle this aren't available (e.g. on a mobile device). * * @param data - The packet that was received. * @param address - The address the data was received from. * See utilities section for methods to extract info from address. * @param tag - The tag that was passed in the send method. * * @returns - YES if the packet should actually be sent over the socket. * NO if the packet should be silently dropped (not sent over the socket). * * Regardless of the return value, the delegate will be informed that the packet was successfully sent. * **/ typedef BOOL (^GCDAsyncUdpSocketSendFilterBlock)(NSData *data, NSData *address, long tag); @interface GCDAsyncUdpSocket : NSObject /** * GCDAsyncUdpSocket uses the standard delegate paradigm, * but executes all delegate callbacks on a given delegate dispatch queue. * This allows for maximum concurrency, while at the same time providing easy thread safety. * * You MUST set a delegate AND delegate dispatch queue before attempting to * use the socket, or you will get an error. * * The socket queue is optional. * If you pass NULL, GCDAsyncSocket will automatically create its own socket queue. * If you choose to provide a socket queue, the socket queue must not be a concurrent queue, * then please see the discussion for the method markSocketQueueTargetQueue. * * The delegate queue and socket queue can optionally be the same. **/ - (id)init; - (id)initWithSocketQueue:(dispatch_queue_t)sq; - (id)initWithDelegate:(id )aDelegate delegateQueue:(dispatch_queue_t)dq; - (id)initWithDelegate:(id )aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq; #pragma mark Configuration - (id )delegate; - (void)setDelegate:(id )delegate; - (void)synchronouslySetDelegate:(id )delegate; - (dispatch_queue_t)delegateQueue; - (void)setDelegateQueue:(dispatch_queue_t)delegateQueue; - (void)synchronouslySetDelegateQueue:(dispatch_queue_t)delegateQueue; - (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr; - (void)setDelegate:(id )delegate delegateQueue:(dispatch_queue_t)delegateQueue; - (void)synchronouslySetDelegate:(id )delegate delegateQueue:(dispatch_queue_t)delegateQueue; /** * By default, both IPv4 and IPv6 are enabled. * * This means GCDAsyncUdpSocket automatically supports both protocols, * and can send to IPv4 or IPv6 addresses, * as well as receive over IPv4 and IPv6. * * For operations that require DNS resolution, GCDAsyncUdpSocket supports both IPv4 and IPv6. * If a DNS lookup returns only IPv4 results, GCDAsyncUdpSocket will automatically use IPv4. * If a DNS lookup returns only IPv6 results, GCDAsyncUdpSocket will automatically use IPv6. * If a DNS lookup returns both IPv4 and IPv6 results, then the protocol used depends on the configured preference. * If IPv4 is preferred, then IPv4 is used. * If IPv6 is preferred, then IPv6 is used. * If neutral, then the first IP version in the resolved array will be used. * * Starting with Mac OS X 10.7 Lion and iOS 5, the default IP preference is neutral. * On prior systems the default IP preference is IPv4. **/ - (BOOL)isIPv4Enabled; - (void)setIPv4Enabled:(BOOL)flag; - (BOOL)isIPv6Enabled; - (void)setIPv6Enabled:(BOOL)flag; - (BOOL)isIPv4Preferred; - (BOOL)isIPv6Preferred; - (BOOL)isIPVersionNeutral; - (void)setPreferIPv4; - (void)setPreferIPv6; - (void)setIPVersionNeutral; /** * Gets/Sets the maximum size of the buffer that will be allocated for receive operations. * The default maximum size is 9216 bytes. * * The theoretical maximum size of any IPv4 UDP packet is UINT16_MAX = 65535. * The theoretical maximum size of any IPv6 UDP packet is UINT32_MAX = 4294967295. * * Since the OS/GCD notifies us of the size of each received UDP packet, * the actual allocated buffer size for each packet is exact. * And in practice the size of UDP packets is generally much smaller than the max. * Indeed most protocols will send and receive packets of only a few bytes, * or will set a limit on the size of packets to prevent fragmentation in the IP layer. * * If you set the buffer size too small, the sockets API in the OS will silently discard * any extra data, and you will not be notified of the error. **/ - (uint16_t)maxReceiveIPv4BufferSize; - (void)setMaxReceiveIPv4BufferSize:(uint16_t)max; - (uint32_t)maxReceiveIPv6BufferSize; - (void)setMaxReceiveIPv6BufferSize:(uint32_t)max; /** * User data allows you to associate arbitrary information with the socket. * This data is not used internally in any way. **/ - (id)userData; - (void)setUserData:(id)arbitraryUserData; #pragma mark Diagnostics /** * Returns the local address info for the socket. * * The localAddress method returns a sockaddr structure wrapped in a NSData object. * The localHost method returns the human readable IP address as a string. * * Note: Address info may not be available until after the socket has been binded, connected * or until after data has been sent. **/ - (NSData *)localAddress; - (NSString *)localHost; - (uint16_t)localPort; - (NSData *)localAddress_IPv4; - (NSString *)localHost_IPv4; - (uint16_t)localPort_IPv4; - (NSData *)localAddress_IPv6; - (NSString *)localHost_IPv6; - (uint16_t)localPort_IPv6; /** * Returns the remote address info for the socket. * * The connectedAddress method returns a sockaddr structure wrapped in a NSData object. * The connectedHost method returns the human readable IP address as a string. * * Note: Since UDP is connectionless by design, connected address info * will not be available unless the socket is explicitly connected to a remote host/port. * If the socket is not connected, these methods will return nil / 0. **/ - (NSData *)connectedAddress; - (NSString *)connectedHost; - (uint16_t)connectedPort; /** * Returns whether or not this socket has been connected to a single host. * By design, UDP is a connectionless protocol, and connecting is not needed. * If connected, the socket will only be able to send/receive data to/from the connected host. **/ - (BOOL)isConnected; /** * Returns whether or not this socket has been closed. * The only way a socket can be closed is if you explicitly call one of the close methods. **/ - (BOOL)isClosed; /** * Returns whether or not this socket is IPv4. * * By default this will be true, unless: * - IPv4 is disabled (via setIPv4Enabled:) * - The socket is explicitly bound to an IPv6 address * - The socket is connected to an IPv6 address **/ - (BOOL)isIPv4; /** * Returns whether or not this socket is IPv6. * * By default this will be true, unless: * - IPv6 is disabled (via setIPv6Enabled:) * - The socket is explicitly bound to an IPv4 address * _ The socket is connected to an IPv4 address * * This method will also return false on platforms that do not support IPv6. * Note: The iPhone does not currently support IPv6. **/ - (BOOL)isIPv6; #pragma mark Binding /** * Binds the UDP socket to the given port. * Binding should be done for server sockets that receive data prior to sending it. * Client sockets can skip binding, * as the OS will automatically assign the socket an available port when it starts sending data. * * You may optionally pass a port number of zero to immediately bind the socket, * yet still allow the OS to automatically assign an available port. * * You cannot bind a socket after its been connected. * You can only bind a socket once. * You can still connect a socket (if desired) after binding. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. **/ - (BOOL)bindToPort:(uint16_t)port error:(NSError **)errPtr; /** * Binds the UDP socket to the given port and optional interface. * Binding should be done for server sockets that receive data prior to sending it. * Client sockets can skip binding, * as the OS will automatically assign the socket an available port when it starts sending data. * * You may optionally pass a port number of zero to immediately bind the socket, * yet still allow the OS to automatically assign an available port. * * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). * You may also use the special strings "localhost" or "loopback" to specify that * the socket only accept packets from the local machine. * * You cannot bind a socket after its been connected. * You can only bind a socket once. * You can still connect a socket (if desired) after binding. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. **/ - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError **)errPtr; /** * Binds the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object. * * If you have an existing struct sockaddr you can convert it to a NSData object like so: * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; * * Binding should be done for server sockets that receive data prior to sending it. * Client sockets can skip binding, * as the OS will automatically assign the socket an available port when it starts sending data. * * You cannot bind a socket after its been connected. * You can only bind a socket once. * You can still connect a socket (if desired) after binding. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass NULL for errPtr. **/ - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr; #pragma mark Connecting /** * Connects the UDP socket to the given host and port. * By design, UDP is a connectionless protocol, and connecting is not needed. * * Choosing to connect to a specific host/port has the following effect: * - You will only be able to send data to the connected host/port. * - You will only be able to receive data from the connected host/port. * - You will receive ICMP messages that come from the connected host/port, such as "connection refused". * * The actual process of connecting a UDP socket does not result in any communication on the socket. * It simply changes the internal state of the socket. * * You cannot bind a socket after it has been connected. * You can only connect a socket once. * * The host may be a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). * * This method is asynchronous as it requires a DNS lookup to resolve the given host name. * If an obvious error is detected, this method immediately returns NO and sets errPtr. * If you don't care about the error, you can pass nil for errPtr. * Otherwise, this method returns YES and begins the asynchronous connection process. * The result of the asynchronous connection process will be reported via the delegate methods. **/ - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr; /** * Connects the UDP socket to the given address, specified as a sockaddr structure wrapped in a NSData object. * * If you have an existing struct sockaddr you can convert it to a NSData object like so: * struct sockaddr sa -> NSData *dsa = [NSData dataWithBytes:&remoteAddr length:remoteAddr.sa_len]; * struct sockaddr *sa -> NSData *dsa = [NSData dataWithBytes:remoteAddr length:remoteAddr->sa_len]; * * By design, UDP is a connectionless protocol, and connecting is not needed. * * Choosing to connect to a specific address has the following effect: * - You will only be able to send data to the connected address. * - You will only be able to receive data from the connected address. * - You will receive ICMP messages that come from the connected address, such as "connection refused". * * Connecting a UDP socket does not result in any communication on the socket. * It simply changes the internal state of the socket. * * You cannot bind a socket after its been connected. * You can only connect a socket once. * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. * * Note: Unlike the connectToHost:onPort:error: method, this method does not require a DNS lookup. * Thus when this method returns, the connection has either failed or fully completed. * In other words, this method is synchronous, unlike the asynchronous connectToHost::: method. * However, for compatibility and simplification of delegate code, if this method returns YES * then the corresponding delegate method (udpSocket:didConnectToHost:port:) is still invoked. **/ - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr; #pragma mark Multicast /** * Join multicast group. * Group should be an IP address (eg @"225.228.0.1"). * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr; /** * Join multicast group. * Group should be an IP address (eg @"225.228.0.1"). * The interface may be a name (e.g. "en1" or "lo0") or the corresponding IP address (e.g. "192.168.4.35"). * * On success, returns YES. * Otherwise returns NO, and sets errPtr. If you don't care about the error, you can pass nil for errPtr. **/ - (BOOL)joinMulticastGroup:(NSString *)group onInterface:(NSString *)interface error:(NSError **)errPtr; - (BOOL)leaveMulticastGroup:(NSString *)group error:(NSError **)errPtr; - (BOOL)leaveMulticastGroup:(NSString *)group onInterface:(NSString *)interface error:(NSError **)errPtr; #pragma mark Reuse Port /** * By default, only one socket can be bound to a given IP address + port at a time. * To enable multiple processes to simultaneously bind to the same address+port, * you need to enable this functionality in the socket. All processes that wish to * use the address+port simultaneously must all enable reuse port on the socket * bound to that port. **/ - (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr; #pragma mark Broadcast /** * By default, the underlying socket in the OS will not allow you to send broadcast messages. * In order to send broadcast messages, you need to enable this functionality in the socket. * * A broadcast is a UDP message to addresses like "192.168.255.255" or "255.255.255.255" that is * delivered to every host on the network. * The reason this is generally disabled by default (by the OS) is to prevent * accidental broadcast messages from flooding the network. **/ - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr; #pragma mark Sending /** * Asynchronously sends the given data, with the given timeout and tag. * * This method may only be used with a connected socket. * Recall that connecting is optional for a UDP socket. * For connected sockets, data can only be sent to the connected address. * For non-connected sockets, the remote destination is specified for each packet. * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. * * @param data * The data to send. * If data is nil or zero-length, this method does nothing. * If passing NSMutableData, please read the thread-safety notice below. * * @param timeout * The timeout for the send opeartion. * If the timeout value is negative, the send operation will not use a timeout. * * @param tag * The tag is for your convenience. * It is not sent or received over the socket in any manner what-so-ever. * It is reported back as a parameter in the udpSocket:didSendDataWithTag: * or udpSocket:didNotSendDataWithTag:dueToError: methods. * You can use it as an array index, state id, type constant, etc. * * * Thread-Safety Note: * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying * that this particular send operation has completed. * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. * It simply retains it for performance reasons. * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. * Copying this data adds an unwanted/unneeded overhead. * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. **/ - (void)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Asynchronously sends the given data, with the given timeout and tag, to the given host and port. * * This method cannot be used with a connected socket. * Recall that connecting is optional for a UDP socket. * For connected sockets, data can only be sent to the connected address. * For non-connected sockets, the remote destination is specified for each packet. * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. * * @param data * The data to send. * If data is nil or zero-length, this method does nothing. * If passing NSMutableData, please read the thread-safety notice below. * * @param host * The destination to send the udp packet to. * May be specified as a domain name (e.g. "deusty.com") or an IP address string (e.g. "192.168.0.2"). * You may also use the convenience strings of "loopback" or "localhost". * * @param port * The port of the host to send to. * * @param timeout * The timeout for the send opeartion. * If the timeout value is negative, the send operation will not use a timeout. * * @param tag * The tag is for your convenience. * It is not sent or received over the socket in any manner what-so-ever. * It is reported back as a parameter in the udpSocket:didSendDataWithTag: * or udpSocket:didNotSendDataWithTag:dueToError: methods. * You can use it as an array index, state id, type constant, etc. * * * Thread-Safety Note: * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying * that this particular send operation has completed. * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. * It simply retains it for performance reasons. * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. * Copying this data adds an unwanted/unneeded overhead. * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. **/ - (void)sendData:(NSData *)data toHost:(NSString *)host port:(uint16_t)port withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * Asynchronously sends the given data, with the given timeout and tag, to the given address. * * This method cannot be used with a connected socket. * Recall that connecting is optional for a UDP socket. * For connected sockets, data can only be sent to the connected address. * For non-connected sockets, the remote destination is specified for each packet. * For more information about optionally connecting udp sockets, see the documentation for the connect methods above. * * @param data * The data to send. * If data is nil or zero-length, this method does nothing. * If passing NSMutableData, please read the thread-safety notice below. * * @param remoteAddr * The address to send the data to (specified as a sockaddr structure wrapped in a NSData object). * * @param timeout * The timeout for the send opeartion. * If the timeout value is negative, the send operation will not use a timeout. * * @param tag * The tag is for your convenience. * It is not sent or received over the socket in any manner what-so-ever. * It is reported back as a parameter in the udpSocket:didSendDataWithTag: * or udpSocket:didNotSendDataWithTag:dueToError: methods. * You can use it as an array index, state id, type constant, etc. * * * Thread-Safety Note: * If the given data parameter is mutable (NSMutableData) then you MUST NOT alter the data while * the socket is sending it. In other words, it's not safe to alter the data until after the delegate method * udpSocket:didSendDataWithTag: or udpSocket:didNotSendDataWithTag:dueToError: is invoked signifying * that this particular send operation has completed. * This is due to the fact that GCDAsyncUdpSocket does NOT copy the data. * It simply retains it for performance reasons. * Often times, if NSMutableData is passed, it is because a request/response was built up in memory. * Copying this data adds an unwanted/unneeded overhead. * If you need to write data from an immutable buffer, and you need to alter the buffer before the socket * completes sending the bytes (which is NOT immediately after this method returns, but rather at a later time * when the delegate method notifies you), then you should first copy the bytes, and pass the copy to this method. **/ - (void)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag; /** * You may optionally set a send filter for the socket. * A filter can provide several interesting possibilities: * * 1. Optional caching of resolved addresses for domain names. * The cache could later be consulted, resulting in fewer system calls to getaddrinfo. * * 2. Reusable modules of code for bandwidth monitoring. * * 3. Sometimes traffic shapers are needed to simulate real world environments. * A filter allows you to write custom code to simulate such environments. * The ability to code this yourself is especially helpful when your simulated environment * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), * or the system tools to handle this aren't available (e.g. on a mobile device). * * For more information about GCDAsyncUdpSocketSendFilterBlock, see the documentation for its typedef. * To remove a previously set filter, invoke this method and pass a nil filterBlock and NULL filterQueue. * * Note: This method invokes setSendFilter:withQueue:isAsynchronous: (documented below), * passing YES for the isAsynchronous parameter. **/ - (void)setSendFilter:(GCDAsyncUdpSocketSendFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue; /** * The receive filter can be run via dispatch_async or dispatch_sync. * Most typical situations call for asynchronous operation. * * However, there are a few situations in which synchronous operation is preferred. * Such is the case when the filter is extremely minimal and fast. * This is because dispatch_sync is faster than dispatch_async. * * If you choose synchronous operation, be aware of possible deadlock conditions. * Since the socket queue is executing your block via dispatch_sync, * then you cannot perform any tasks which may invoke dispatch_sync on the socket queue. * For example, you can't query properties on the socket. **/ - (void)setSendFilter:(GCDAsyncUdpSocketSendFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue isAsynchronous:(BOOL)isAsynchronous; #pragma mark Receiving /** * There are two modes of operation for receiving packets: one-at-a-time & continuous. * * In one-at-a-time mode, you call receiveOnce everytime your delegate is ready to process an incoming udp packet. * Receiving packets one-at-a-time may be better suited for implementing certain state machine code, * where your state machine may not always be ready to process incoming packets. * * In continuous mode, the delegate is invoked immediately everytime incoming udp packets are received. * Receiving packets continuously is better suited to real-time streaming applications. * * You may switch back and forth between one-at-a-time mode and continuous mode. * If the socket is currently in continuous mode, calling this method will switch it to one-at-a-time mode. * * When a packet is received (and not filtered by the optional receive filter), * the delegate method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked. * * If the socket is able to begin receiving packets, this method returns YES. * Otherwise it returns NO, and sets the errPtr with appropriate error information. * * An example error: * You created a udp socket to act as a server, and immediately called receive. * You forgot to first bind the socket to a port number, and received a error with a message like: * "Must bind socket before you can receive data." **/ - (BOOL)receiveOnce:(NSError **)errPtr; /** * There are two modes of operation for receiving packets: one-at-a-time & continuous. * * In one-at-a-time mode, you call receiveOnce everytime your delegate is ready to process an incoming udp packet. * Receiving packets one-at-a-time may be better suited for implementing certain state machine code, * where your state machine may not always be ready to process incoming packets. * * In continuous mode, the delegate is invoked immediately everytime incoming udp packets are received. * Receiving packets continuously is better suited to real-time streaming applications. * * You may switch back and forth between one-at-a-time mode and continuous mode. * If the socket is currently in one-at-a-time mode, calling this method will switch it to continuous mode. * * For every received packet (not filtered by the optional receive filter), * the delegate method (udpSocket:didReceiveData:fromAddress:withFilterContext:) is invoked. * * If the socket is able to begin receiving packets, this method returns YES. * Otherwise it returns NO, and sets the errPtr with appropriate error information. * * An example error: * You created a udp socket to act as a server, and immediately called receive. * You forgot to first bind the socket to a port number, and received a error with a message like: * "Must bind socket before you can receive data." **/ - (BOOL)beginReceiving:(NSError **)errPtr; /** * If the socket is currently receiving (beginReceiving has been called), this method pauses the receiving. * That is, it won't read any more packets from the underlying OS socket until beginReceiving is called again. * * Important Note: * GCDAsyncUdpSocket may be running in parallel with your code. * That is, your delegate is likely running on a separate thread/dispatch_queue. * When you invoke this method, GCDAsyncUdpSocket may have already dispatched delegate methods to be invoked. * Thus, if those delegate methods have already been dispatch_async'd, * your didReceive delegate method may still be invoked after this method has been called. * You should be aware of this, and program defensively. **/ - (void)pauseReceiving; /** * You may optionally set a receive filter for the socket. * This receive filter may be set to run in its own queue (independent of delegate queue). * * A filter can provide several useful features. * * 1. Many times udp packets need to be parsed. * Since the filter can run in its own independent queue, you can parallelize this parsing quite easily. * The end result is a parallel socket io, datagram parsing, and packet processing. * * 2. Many times udp packets are discarded because they are duplicate/unneeded/unsolicited. * The filter can prevent such packets from arriving at the delegate. * And because the filter can run in its own independent queue, this doesn't slow down the delegate. * * - Since the udp protocol does not guarantee delivery, udp packets may be lost. * Many protocols built atop udp thus provide various resend/re-request algorithms. * This sometimes results in duplicate packets arriving. * A filter may allow you to architect the duplicate detection code to run in parallel to normal processing. * * - Since the udp socket may be connectionless, its possible for unsolicited packets to arrive. * Such packets need to be ignored. * * 3. Sometimes traffic shapers are needed to simulate real world environments. * A filter allows you to write custom code to simulate such environments. * The ability to code this yourself is especially helpful when your simulated environment * is more complicated than simple traffic shaping (e.g. simulating a cone port restricted router), * or the system tools to handle this aren't available (e.g. on a mobile device). * * Example: * * GCDAsyncUdpSocketReceiveFilterBlock filter = ^BOOL (NSData *data, NSData *address, id *context) { * * MyProtocolMessage *msg = [MyProtocol parseMessage:data]; * * *context = response; * return (response != nil); * }; * [udpSocket setReceiveFilter:filter withQueue:myParsingQueue]; * * For more information about GCDAsyncUdpSocketReceiveFilterBlock, see the documentation for its typedef. * To remove a previously set filter, invoke this method and pass a nil filterBlock and NULL filterQueue. * * Note: This method invokes setReceiveFilter:withQueue:isAsynchronous: (documented below), * passing YES for the isAsynchronous parameter. **/ - (void)setReceiveFilter:(GCDAsyncUdpSocketReceiveFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue; /** * The receive filter can be run via dispatch_async or dispatch_sync. * Most typical situations call for asynchronous operation. * * However, there are a few situations in which synchronous operation is preferred. * Such is the case when the filter is extremely minimal and fast. * This is because dispatch_sync is faster than dispatch_async. * * If you choose synchronous operation, be aware of possible deadlock conditions. * Since the socket queue is executing your block via dispatch_sync, * then you cannot perform any tasks which may invoke dispatch_sync on the socket queue. * For example, you can't query properties on the socket. **/ - (void)setReceiveFilter:(GCDAsyncUdpSocketReceiveFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue isAsynchronous:(BOOL)isAsynchronous; #pragma mark Closing /** * Immediately closes the underlying socket. * Any pending send operations are discarded. * * The GCDAsyncUdpSocket instance may optionally be used again. * (it will setup/configure/use another unnderlying BSD socket). **/ - (void)close; /** * Closes the underlying socket after all pending send operations have been sent. * * The GCDAsyncUdpSocket instance may optionally be used again. * (it will setup/configure/use another unnderlying BSD socket). **/ - (void)closeAfterSending; #pragma mark Advanced /** * GCDAsyncSocket maintains thread safety by using an internal serial dispatch_queue. * In most cases, the instance creates this queue itself. * However, to allow for maximum flexibility, the internal queue may be passed in the init method. * This allows for some advanced options such as controlling socket priority via target queues. * However, when one begins to use target queues like this, they open the door to some specific deadlock issues. * * For example, imagine there are 2 queues: * dispatch_queue_t socketQueue; * dispatch_queue_t socketTargetQueue; * * If you do this (pseudo-code): * socketQueue.targetQueue = socketTargetQueue; * * Then all socketQueue operations will actually get run on the given socketTargetQueue. * This is fine and works great in most situations. * But if you run code directly from within the socketTargetQueue that accesses the socket, * you could potentially get deadlock. Imagine the following code: * * - (BOOL)socketHasSomething * { * __block BOOL result = NO; * dispatch_block_t block = ^{ * result = [self someInternalMethodToBeRunOnlyOnSocketQueue]; * } * if (is_executing_on_queue(socketQueue)) * block(); * else * dispatch_sync(socketQueue, block); * * return result; * } * * What happens if you call this method from the socketTargetQueue? The result is deadlock. * This is because the GCD API offers no mechanism to discover a queue's targetQueue. * Thus we have no idea if our socketQueue is configured with a targetQueue. * If we had this information, we could easily avoid deadlock. * But, since these API's are missing or unfeasible, you'll have to explicitly set it. * * IF you pass a socketQueue via the init method, * AND you've configured the passed socketQueue with a targetQueue, * THEN you should pass the end queue in the target hierarchy. * * For example, consider the following queue hierarchy: * socketQueue -> ipQueue -> moduleQueue * * This example demonstrates priority shaping within some server. * All incoming client connections from the same IP address are executed on the same target queue. * And all connections for a particular module are executed on the same target queue. * Thus, the priority of all networking for the entire module can be changed on the fly. * Additionally, networking traffic from a single IP cannot monopolize the module. * * Here's how you would accomplish something like that: * - (dispatch_queue_t)newSocketQueueForConnectionFromAddress:(NSData *)address onSocket:(GCDAsyncSocket *)sock * { * dispatch_queue_t socketQueue = dispatch_queue_create("", NULL); * dispatch_queue_t ipQueue = [self ipQueueForAddress:address]; * * dispatch_set_target_queue(socketQueue, ipQueue); * dispatch_set_target_queue(iqQueue, moduleQueue); * * return socketQueue; * } * - (void)socket:(GCDAsyncSocket *)sock didAcceptNewSocket:(GCDAsyncSocket *)newSocket * { * [clientConnections addObject:newSocket]; * [newSocket markSocketQueueTargetQueue:moduleQueue]; * } * * Note: This workaround is ONLY needed if you intend to execute code directly on the ipQueue or moduleQueue. * This is often NOT the case, as such queues are used solely for execution shaping. **/ - (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreConfiguredTargetQueue; - (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketQueuesPreviouslyConfiguredTargetQueue; /** * It's not thread-safe to access certain variables from outside the socket's internal queue. * * For example, the socket file descriptor. * File descriptors are simply integers which reference an index in the per-process file table. * However, when one requests a new file descriptor (by opening a file or socket), * the file descriptor returned is guaranteed to be the lowest numbered unused descriptor. * So if we're not careful, the following could be possible: * * - Thread A invokes a method which returns the socket's file descriptor. * - The socket is closed via the socket's internal queue on thread B. * - Thread C opens a file, and subsequently receives the file descriptor that was previously the socket's FD. * - Thread A is now accessing/altering the file instead of the socket. * * In addition to this, other variables are not actually objects, * and thus cannot be retained/released or even autoreleased. * An example is the sslContext, of type SSLContextRef, which is actually a malloc'd struct. * * Although there are internal variables that make it difficult to maintain thread-safety, * it is important to provide access to these variables * to ensure this class can be used in a wide array of environments. * This method helps to accomplish this by invoking the current block on the socket's internal queue. * The methods below can be invoked from within the block to access * those generally thread-unsafe internal variables in a thread-safe manner. * The given block will be invoked synchronously on the socket's internal queue. * * If you save references to any protected variables and use them outside the block, you do so at your own peril. **/ - (void)performBlock:(dispatch_block_t)block; /** * These methods are only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Provides access to the socket's file descriptor(s). * If the socket isn't connected, or explicity bound to a particular interface, * it might actually have multiple internal socket file descriptors - one for IPv4 and one for IPv6. **/ - (int)socketFD; - (int)socket4FD; - (int)socket6FD; #if TARGET_OS_IPHONE /** * These methods are only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Returns (creating if necessary) a CFReadStream/CFWriteStream for the internal socket. * * Generally GCDAsyncUdpSocket doesn't use CFStream. (It uses the faster GCD API's.) * However, if you need one for any reason, * these methods are a convenient way to get access to a safe instance of one. **/ - (CFReadStreamRef)readStream; - (CFWriteStreamRef)writeStream; /** * This method is only available from within the context of a performBlock: invocation. * See the documentation for the performBlock: method above. * * Configures the socket to allow it to operate when the iOS application has been backgrounded. * In other words, this method creates a read & write stream, and invokes: * * CFReadStreamSetProperty(readStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); * CFWriteStreamSetProperty(writeStream, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); * * Returns YES if successful, NO otherwise. * * Example usage: * * [asyncUdpSocket performBlock:^{ * [asyncUdpSocket enableBackgroundingOnSocket]; * }]; * * * NOTE : Apple doesn't currently support backgrounding UDP sockets. (Only TCP for now). **/ //- (BOOL)enableBackgroundingOnSockets; #endif #pragma mark Utilities /** * Extracting host/port/family information from raw address data. **/ + (NSString *)hostFromAddress:(NSData *)address; + (uint16_t)portFromAddress:(NSData *)address; + (int)familyFromAddress:(NSData *)address; + (BOOL)isIPv4Address:(NSData *)address; + (BOOL)isIPv6Address:(NSData *)address; + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr fromAddress:(NSData *)address; + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(int *)afPtr fromAddress:(NSData *)address; @end ================================================ FILE: GCDAsyncSocket/CocoaAsyncSocket/GCDAsyncUdpSocket.m ================================================ // // GCDAsyncUdpSocket // // This class is in the public domain. // Originally created by Robbie Hanson of Deusty LLC. // Updated and maintained by Deusty LLC and the Apple development community. // // https://github.com/robbiehanson/CocoaAsyncSocket // #import "GCDAsyncUdpSocket.h" #if ! __has_feature(objc_arc) #warning This file must be compiled with ARC. Use -fobjc-arc flag (or convert project to ARC). // For more information see: https://github.com/robbiehanson/CocoaAsyncSocket/wiki/ARC #endif #if TARGET_OS_IPHONE #import #import #endif #import #import #import #import #import #import #import #if 0 // Logging Enabled - See log level below // Logging uses the CocoaLumberjack framework (which is also GCD based). // http://code.google.com/p/cocoalumberjack/ // // It allows us to do a lot of logging without significantly slowing down the code. #import "DDLog.h" #define LogAsync NO #define LogContext 65535 #define LogObjc(flg, frmt, ...) LOG_OBJC_MAYBE(LogAsync, logLevel, flg, LogContext, frmt, ##__VA_ARGS__) #define LogC(flg, frmt, ...) LOG_C_MAYBE(LogAsync, logLevel, flg, LogContext, frmt, ##__VA_ARGS__) #define LogError(frmt, ...) LogObjc(LOG_FLAG_ERROR, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogWarn(frmt, ...) LogObjc(LOG_FLAG_WARN, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogInfo(frmt, ...) LogObjc(LOG_FLAG_INFO, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogVerbose(frmt, ...) LogObjc(LOG_FLAG_VERBOSE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCError(frmt, ...) LogC(LOG_FLAG_ERROR, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCWarn(frmt, ...) LogC(LOG_FLAG_WARN, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCInfo(frmt, ...) LogC(LOG_FLAG_INFO, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogCVerbose(frmt, ...) LogC(LOG_FLAG_VERBOSE, (@"%@: " frmt), THIS_FILE, ##__VA_ARGS__) #define LogTrace() LogObjc(LOG_FLAG_VERBOSE, @"%@: %@", THIS_FILE, THIS_METHOD) #define LogCTrace() LogC(LOG_FLAG_VERBOSE, @"%@: %s", THIS_FILE, __FUNCTION__) // Log levels : off, error, warn, info, verbose static const int logLevel = LOG_LEVEL_VERBOSE; #else // Logging Disabled #define LogError(frmt, ...) {} #define LogWarn(frmt, ...) {} #define LogInfo(frmt, ...) {} #define LogVerbose(frmt, ...) {} #define LogCError(frmt, ...) {} #define LogCWarn(frmt, ...) {} #define LogCInfo(frmt, ...) {} #define LogCVerbose(frmt, ...) {} #define LogTrace() {} #define LogCTrace(frmt, ...) {} #endif /** * Seeing a return statements within an inner block * can sometimes be mistaken for a return point of the enclosing method. * This makes inline blocks a bit easier to read. **/ #define return_from_block return /** * A socket file descriptor is really just an integer. * It represents the index of the socket within the kernel. * This makes invalid file descriptor comparisons easier to read. **/ #define SOCKET_NULL -1 /** * Just to type less code. **/ #define AutoreleasedBlock(block) ^{ @autoreleasepool { block(); }} @class GCDAsyncUdpSendPacket; NSString *const GCDAsyncUdpSocketException = @"GCDAsyncUdpSocketException"; NSString *const GCDAsyncUdpSocketErrorDomain = @"GCDAsyncUdpSocketErrorDomain"; NSString *const GCDAsyncUdpSocketQueueName = @"GCDAsyncUdpSocket"; NSString *const GCDAsyncUdpSocketThreadName = @"GCDAsyncUdpSocket-CFStream"; enum GCDAsyncUdpSocketFlags { kDidCreateSockets = 1 << 0, // If set, the sockets have been created. kDidBind = 1 << 1, // If set, bind has been called. kConnecting = 1 << 2, // If set, a connection attempt is in progress. kDidConnect = 1 << 3, // If set, socket is connected. kReceiveOnce = 1 << 4, // If set, one-at-a-time receive is enabled kReceiveContinuous = 1 << 5, // If set, continuous receive is enabled kIPv4Deactivated = 1 << 6, // If set, socket4 was closed due to bind or connect on IPv6. kIPv6Deactivated = 1 << 7, // If set, socket6 was closed due to bind or connect on IPv4. kSend4SourceSuspended = 1 << 8, // If set, send4Source is suspended. kSend6SourceSuspended = 1 << 9, // If set, send6Source is suspended. kReceive4SourceSuspended = 1 << 10, // If set, receive4Source is suspended. kReceive6SourceSuspended = 1 << 11, // If set, receive6Source is suspended. kSock4CanAcceptBytes = 1 << 12, // If set, we know socket4 can accept bytes. If unset, it's unknown. kSock6CanAcceptBytes = 1 << 13, // If set, we know socket6 can accept bytes. If unset, it's unknown. kForbidSendReceive = 1 << 14, // If set, no new send or receive operations are allowed to be queued. kCloseAfterSends = 1 << 15, // If set, close as soon as no more sends are queued. kFlipFlop = 1 << 16, // Used to alternate between IPv4 and IPv6 sockets. #if TARGET_OS_IPHONE kAddedStreamListener = 1 << 17, // If set, CFStreams have been added to listener thread #endif }; enum GCDAsyncUdpSocketConfig { kIPv4Disabled = 1 << 0, // If set, IPv4 is disabled kIPv6Disabled = 1 << 1, // If set, IPv6 is disabled kPreferIPv4 = 1 << 2, // If set, IPv4 is preferred over IPv6 kPreferIPv6 = 1 << 3, // If set, IPv6 is preferred over IPv4 }; //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @interface GCDAsyncUdpSocket () { #if __has_feature(objc_arc_weak) __weak id delegate; #else __unsafe_unretained id delegate; #endif dispatch_queue_t delegateQueue; GCDAsyncUdpSocketReceiveFilterBlock receiveFilterBlock; dispatch_queue_t receiveFilterQueue; BOOL receiveFilterAsync; GCDAsyncUdpSocketSendFilterBlock sendFilterBlock; dispatch_queue_t sendFilterQueue; BOOL sendFilterAsync; uint32_t flags; uint16_t config; uint16_t max4ReceiveSize; uint32_t max6ReceiveSize; int socket4FD; int socket6FD; dispatch_queue_t socketQueue; dispatch_source_t send4Source; dispatch_source_t send6Source; dispatch_source_t receive4Source; dispatch_source_t receive6Source; dispatch_source_t sendTimer; GCDAsyncUdpSendPacket *currentSend; NSMutableArray *sendQueue; unsigned long socket4FDBytesAvailable; unsigned long socket6FDBytesAvailable; uint32_t pendingFilterOperations; NSData *cachedLocalAddress4; NSString *cachedLocalHost4; uint16_t cachedLocalPort4; NSData *cachedLocalAddress6; NSString *cachedLocalHost6; uint16_t cachedLocalPort6; NSData *cachedConnectedAddress; NSString *cachedConnectedHost; uint16_t cachedConnectedPort; int cachedConnectedFamily; void *IsOnSocketQueueOrTargetQueueKey; #if TARGET_OS_IPHONE CFStreamClientContext streamContext; CFReadStreamRef readStream4; CFReadStreamRef readStream6; CFWriteStreamRef writeStream4; CFWriteStreamRef writeStream6; #endif id userData; } - (void)resumeSend4Source; - (void)resumeSend6Source; - (void)resumeReceive4Source; - (void)resumeReceive6Source; - (void)closeSockets; - (void)maybeConnect; - (BOOL)connectWithAddress4:(NSData *)address4 error:(NSError **)errPtr; - (BOOL)connectWithAddress6:(NSData *)address6 error:(NSError **)errPtr; - (void)maybeDequeueSend; - (void)doPreSend; - (void)doSend; - (void)endCurrentSend; - (void)setupSendTimerWithTimeout:(NSTimeInterval)timeout; - (void)doReceive; - (void)doReceiveEOF; - (void)closeWithError:(NSError *)error; - (BOOL)performMulticastRequest:(int)requestType forGroup:(NSString *)group onInterface:(NSString *)interface error:(NSError **)errPtr; #if TARGET_OS_IPHONE - (BOOL)createReadAndWriteStreams:(NSError **)errPtr; - (BOOL)registerForStreamCallbacks:(NSError **)errPtr; - (BOOL)addStreamsToRunLoop:(NSError **)errPtr; - (BOOL)openStreams:(NSError **)errPtr; - (void)removeStreamsFromRunLoop; - (void)closeReadAndWriteStreams; #endif + (NSString *)hostFromSockaddr4:(const struct sockaddr_in *)pSockaddr4; + (NSString *)hostFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6; + (uint16_t)portFromSockaddr4:(const struct sockaddr_in *)pSockaddr4; + (uint16_t)portFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6; #if TARGET_OS_IPHONE // Forward declaration + (void)listenerThread; #endif @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * The GCDAsyncUdpSendPacket encompasses the instructions for a single send/write. **/ @interface GCDAsyncUdpSendPacket : NSObject { @public NSData *buffer; NSTimeInterval timeout; long tag; BOOL resolveInProgress; BOOL filterInProgress; NSArray *resolvedAddresses; NSError *resolveError; NSData *address; int addressFamily; } - (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i; @end @implementation GCDAsyncUdpSendPacket - (id)initWithData:(NSData *)d timeout:(NSTimeInterval)t tag:(long)i { if ((self = [super init])) { buffer = d; timeout = t; tag = i; resolveInProgress = NO; } return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @interface GCDAsyncUdpSpecialPacket : NSObject { @public // uint8_t type; BOOL resolveInProgress; NSArray *addresses; NSError *error; } - (id)init; @end @implementation GCDAsyncUdpSpecialPacket - (id)init { self = [super init]; return self; } @end //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark - //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// @implementation GCDAsyncUdpSocket - (id)init { LogTrace(); return [self initWithDelegate:nil delegateQueue:NULL socketQueue:NULL]; } - (id)initWithSocketQueue:(dispatch_queue_t)sq { LogTrace(); return [self initWithDelegate:nil delegateQueue:NULL socketQueue:sq]; } - (id)initWithDelegate:(id )aDelegate delegateQueue:(dispatch_queue_t)dq { LogTrace(); return [self initWithDelegate:aDelegate delegateQueue:dq socketQueue:NULL]; } - (id)initWithDelegate:(id )aDelegate delegateQueue:(dispatch_queue_t)dq socketQueue:(dispatch_queue_t)sq { LogTrace(); if ((self = [super init])) { delegate = aDelegate; if (dq) { delegateQueue = dq; #if !OS_OBJECT_USE_OBJC dispatch_retain(delegateQueue); #endif } max4ReceiveSize = 9216; max6ReceiveSize = 9216; socket4FD = SOCKET_NULL; socket6FD = SOCKET_NULL; if (sq) { NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), @"The given socketQueue parameter must not be a concurrent queue."); NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0), @"The given socketQueue parameter must not be a concurrent queue."); NSAssert(sq != dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), @"The given socketQueue parameter must not be a concurrent queue."); socketQueue = sq; #if !OS_OBJECT_USE_OBJC dispatch_retain(socketQueue); #endif } else { socketQueue = dispatch_queue_create([GCDAsyncUdpSocketQueueName UTF8String], NULL); } // The dispatch_queue_set_specific() and dispatch_get_specific() functions take a "void *key" parameter. // From the documentation: // // > Keys are only compared as pointers and are never dereferenced. // > Thus, you can use a pointer to a static variable for a specific subsystem or // > any other value that allows you to identify the value uniquely. // // We're just going to use the memory address of an ivar. // Specifically an ivar that is explicitly named for our purpose to make the code more readable. // // However, it feels tedious (and less readable) to include the "&" all the time: // dispatch_get_specific(&IsOnSocketQueueOrTargetQueueKey) // // So we're going to make it so it doesn't matter if we use the '&' or not, // by assigning the value of the ivar to the address of the ivar. // Thus: IsOnSocketQueueOrTargetQueueKey == &IsOnSocketQueueOrTargetQueueKey; IsOnSocketQueueOrTargetQueueKey = &IsOnSocketQueueOrTargetQueueKey; void *nonNullUnusedPointer = (__bridge void *)self; dispatch_queue_set_specific(socketQueue, IsOnSocketQueueOrTargetQueueKey, nonNullUnusedPointer, NULL); currentSend = nil; sendQueue = [[NSMutableArray alloc] initWithCapacity:5]; #if TARGET_OS_IPHONE [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillEnterForeground:) name:UIApplicationWillEnterForegroundNotification object:nil]; #endif } return self; } - (void)dealloc { LogInfo(@"%@ - %@ (start)", THIS_METHOD, self); #if TARGET_OS_IPHONE [[NSNotificationCenter defaultCenter] removeObserver:self]; #endif if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { [self closeWithError:nil]; } else { dispatch_sync(socketQueue, ^{ [self closeWithError:nil]; }); } delegate = nil; #if !OS_OBJECT_USE_OBJC if (delegateQueue) dispatch_release(delegateQueue); #endif delegateQueue = NULL; #if !OS_OBJECT_USE_OBJC if (socketQueue) dispatch_release(socketQueue); #endif socketQueue = NULL; LogInfo(@"%@ - %@ (finish)", THIS_METHOD, self); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Configuration //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (id)delegate { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return delegate; } else { __block id result = nil; dispatch_sync(socketQueue, ^{ result = delegate; }); return result; } } - (void)setDelegate:(id )newDelegate synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ delegate = newDelegate; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); } else { if (synchronously) dispatch_sync(socketQueue, block); else dispatch_async(socketQueue, block); } } - (void)setDelegate:(id )newDelegate { [self setDelegate:newDelegate synchronously:NO]; } - (void)synchronouslySetDelegate:(id )newDelegate { [self setDelegate:newDelegate synchronously:YES]; } - (dispatch_queue_t)delegateQueue { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { return delegateQueue; } else { __block dispatch_queue_t result = NULL; dispatch_sync(socketQueue, ^{ result = delegateQueue; }); return result; } } - (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC if (delegateQueue) dispatch_release(delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); } else { if (synchronously) dispatch_sync(socketQueue, block); else dispatch_async(socketQueue, block); } } - (void)setDelegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegateQueue:newDelegateQueue synchronously:NO]; } - (void)synchronouslySetDelegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegateQueue:newDelegateQueue synchronously:YES]; } - (void)getDelegate:(id *)delegatePtr delegateQueue:(dispatch_queue_t *)delegateQueuePtr { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { if (delegatePtr) *delegatePtr = delegate; if (delegateQueuePtr) *delegateQueuePtr = delegateQueue; } else { __block id dPtr = NULL; __block dispatch_queue_t dqPtr = NULL; dispatch_sync(socketQueue, ^{ dPtr = delegate; dqPtr = delegateQueue; }); if (delegatePtr) *delegatePtr = dPtr; if (delegateQueuePtr) *delegateQueuePtr = dqPtr; } } - (void)setDelegate:(id )newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue synchronously:(BOOL)synchronously { dispatch_block_t block = ^{ delegate = newDelegate; #if !OS_OBJECT_USE_OBJC if (delegateQueue) dispatch_release(delegateQueue); if (newDelegateQueue) dispatch_retain(newDelegateQueue); #endif delegateQueue = newDelegateQueue; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { block(); } else { if (synchronously) dispatch_sync(socketQueue, block); else dispatch_async(socketQueue, block); } } - (void)setDelegate:(id )newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:NO]; } - (void)synchronouslySetDelegate:(id )newDelegate delegateQueue:(dispatch_queue_t)newDelegateQueue { [self setDelegate:newDelegate delegateQueue:newDelegateQueue synchronously:YES]; } - (BOOL)isIPv4Enabled { // Note: YES means kIPv4Disabled is OFF __block BOOL result = NO; dispatch_block_t block = ^{ result = ((config & kIPv4Disabled) == 0); }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setIPv4Enabled:(BOOL)flag { // Note: YES means kIPv4Disabled is OFF dispatch_block_t block = ^{ LogVerbose(@"%@ %@", THIS_METHOD, (flag ? @"YES" : @"NO")); if (flag) config &= ~kIPv4Disabled; else config |= kIPv4Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (BOOL)isIPv6Enabled { // Note: YES means kIPv6Disabled is OFF __block BOOL result = NO; dispatch_block_t block = ^{ result = ((config & kIPv6Disabled) == 0); }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setIPv6Enabled:(BOOL)flag { // Note: YES means kIPv6Disabled is OFF dispatch_block_t block = ^{ LogVerbose(@"%@ %@", THIS_METHOD, (flag ? @"YES" : @"NO")); if (flag) config &= ~kIPv6Disabled; else config |= kIPv6Disabled; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (BOOL)isIPv4Preferred { __block BOOL result = NO; dispatch_block_t block = ^{ result = (config & kPreferIPv4) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isIPv6Preferred { __block BOOL result = NO; dispatch_block_t block = ^{ result = (config & kPreferIPv6) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isIPVersionNeutral { __block BOOL result = NO; dispatch_block_t block = ^{ result = (config & (kPreferIPv4 | kPreferIPv6)) == 0; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setPreferIPv4 { dispatch_block_t block = ^{ LogTrace(); config |= kPreferIPv4; config &= ~kPreferIPv6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (void)setPreferIPv6 { dispatch_block_t block = ^{ LogTrace(); config &= ~kPreferIPv4; config |= kPreferIPv6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (void)setIPVersionNeutral { dispatch_block_t block = ^{ LogTrace(); config &= ~kPreferIPv4; config &= ~kPreferIPv6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (uint16_t)maxReceiveIPv4BufferSize { __block uint16_t result = 0; dispatch_block_t block = ^{ result = max4ReceiveSize; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setMaxReceiveIPv4BufferSize:(uint16_t)max { dispatch_block_t block = ^{ LogVerbose(@"%@ %u", THIS_METHOD, (unsigned)max); max4ReceiveSize = max; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (uint32_t)maxReceiveIPv6BufferSize { __block uint32_t result = 0; dispatch_block_t block = ^{ result = max6ReceiveSize; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setMaxReceiveIPv6BufferSize:(uint32_t)max { dispatch_block_t block = ^{ LogVerbose(@"%@ %u", THIS_METHOD, (unsigned)max); max6ReceiveSize = max; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (id)userData { __block id result = nil; dispatch_block_t block = ^{ result = userData; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (void)setUserData:(id)arbitraryUserData { dispatch_block_t block = ^{ if (userData != arbitraryUserData) { userData = arbitraryUserData; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Delegate Helpers //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)notifyDidConnectToAddress:(NSData *)anAddress { LogTrace(); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didConnectToAddress:)]) { NSData *address = [anAddress copy]; // In case param is NSMutableData dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate udpSocket:self didConnectToAddress:address]; }}); } } - (void)notifyDidNotConnect:(NSError *)error { LogTrace(); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didNotConnect:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate udpSocket:self didNotConnect:error]; }}); } } - (void)notifyDidSendDataWithTag:(long)tag { LogTrace(); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didSendDataWithTag:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate udpSocket:self didSendDataWithTag:tag]; }}); } } - (void)notifyDidNotSendDataWithTag:(long)tag dueToError:(NSError *)error { LogTrace(); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocket:didNotSendDataWithTag:dueToError:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate udpSocket:self didNotSendDataWithTag:tag dueToError:error]; }}); } } - (void)notifyDidReceiveData:(NSData *)data fromAddress:(NSData *)address withFilterContext:(id)context { LogTrace(); SEL selector = @selector(udpSocket:didReceiveData:fromAddress:withFilterContext:); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:selector]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate udpSocket:self didReceiveData:data fromAddress:address withFilterContext:context]; }}); } } - (void)notifyDidCloseWithError:(NSError *)error { LogTrace(); __strong id theDelegate = delegate; if (delegateQueue && [theDelegate respondsToSelector:@selector(udpSocketDidClose:withError:)]) { dispatch_async(delegateQueue, ^{ @autoreleasepool { [theDelegate udpSocketDidClose:self withError:error]; }}); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Errors //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (NSError *)badConfigError:(NSString *)errMsg { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketBadConfigError userInfo:userInfo]; } - (NSError *)badParamError:(NSString *)errMsg { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketBadParamError userInfo:userInfo]; } - (NSError *)gaiError:(int)gai_error { NSString *errMsg = [NSString stringWithCString:gai_strerror(gai_error) encoding:NSASCIIStringEncoding]; NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:@"kCFStreamErrorDomainNetDB" code:gai_error userInfo:userInfo]; } - (NSError *)errnoErrorWithReason:(NSString *)reason { NSString *errMsg = [NSString stringWithUTF8String:strerror(errno)]; NSDictionary *userInfo; if (reason) userInfo = [NSDictionary dictionaryWithObjectsAndKeys:errMsg, NSLocalizedDescriptionKey, reason, NSLocalizedFailureReasonErrorKey, nil]; else userInfo = [NSDictionary dictionaryWithObjectsAndKeys:errMsg, NSLocalizedDescriptionKey, nil]; return [NSError errorWithDomain:NSPOSIXErrorDomain code:errno userInfo:userInfo]; } - (NSError *)errnoError { return [self errnoErrorWithReason:nil]; } /** * Returns a standard send timeout error. **/ - (NSError *)sendTimeoutError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncUdpSocketSendTimeoutError", @"GCDAsyncUdpSocket", [NSBundle mainBundle], @"Send operation timed out", nil); NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketSendTimeoutError userInfo:userInfo]; } - (NSError *)socketClosedError { NSString *errMsg = NSLocalizedStringWithDefaultValue(@"GCDAsyncUdpSocketClosedError", @"GCDAsyncUdpSocket", [NSBundle mainBundle], @"Socket closed", nil); NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketClosedError userInfo:userInfo]; } - (NSError *)otherError:(NSString *)errMsg { NSDictionary *userInfo = [NSDictionary dictionaryWithObject:errMsg forKey:NSLocalizedDescriptionKey]; return [NSError errorWithDomain:GCDAsyncUdpSocketErrorDomain code:GCDAsyncUdpSocketOtherError userInfo:userInfo]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Utilities //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)preOp:(NSError **)errPtr { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (delegate == nil) // Must have delegate set { if (errPtr) { NSString *msg = @"Attempting to use socket without a delegate. Set a delegate first."; *errPtr = [self badConfigError:msg]; } return NO; } if (delegateQueue == NULL) // Must have delegate queue set { if (errPtr) { NSString *msg = @"Attempting to use socket without a delegate queue. Set a delegate queue first."; *errPtr = [self badConfigError:msg]; } return NO; } return YES; } /** * This method executes on a global concurrent queue. * When complete, it executes the given completion block on the socketQueue. **/ - (void)asyncResolveHost:(NSString *)aHost port:(uint16_t)port withCompletionBlock:(void (^)(NSArray *addresses, NSError *error))completionBlock { LogTrace(); // Check parameter(s) if (aHost == nil) { NSString *msg = @"The host param is nil. Should be domain name or IP address string."; NSError *error = [self badParamError:msg]; // We should still use dispatch_async since this method is expected to be asynchronous dispatch_async(socketQueue, ^{ @autoreleasepool { completionBlock(nil, error); }}); return; } // It's possible that the given aHost parameter is actually a NSMutableString. // So we want to copy it now, within this block that will be executed synchronously. // This way the asynchronous lookup block below doesn't have to worry about it changing. NSString *host = [aHost copy]; dispatch_queue_t globalConcurrentQueue = dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0); dispatch_async(globalConcurrentQueue, ^{ @autoreleasepool { NSMutableArray *addresses = [NSMutableArray arrayWithCapacity:2]; NSError *error = nil; if ([host isEqualToString:@"localhost"] || [host isEqualToString:@"loopback"]) { // Use LOOPBACK address struct sockaddr_in sockaddr4; memset(&sockaddr4, 0, sizeof(sockaddr4)); sockaddr4.sin_len = sizeof(struct sockaddr_in); sockaddr4.sin_family = AF_INET; sockaddr4.sin_port = htons(port); sockaddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); struct sockaddr_in6 sockaddr6; memset(&sockaddr6, 0, sizeof(sockaddr6)); sockaddr6.sin6_len = sizeof(struct sockaddr_in6); sockaddr6.sin6_family = AF_INET6; sockaddr6.sin6_port = htons(port); sockaddr6.sin6_addr = in6addr_loopback; // Wrap the native address structures and add to list [addresses addObject:[NSData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]]; [addresses addObject:[NSData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]]; } else { NSString *portStr = [NSString stringWithFormat:@"%hu", port]; struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; int gai_error = getaddrinfo([host UTF8String], [portStr UTF8String], &hints, &res0); if (gai_error) { error = [self gaiError:gai_error]; } else { for(res = res0; res; res = res->ai_next) { if (res->ai_family == AF_INET) { // Found IPv4 address // Wrap the native address structure and add to list [addresses addObject:[NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]]; } else if (res->ai_family == AF_INET6) { // Found IPv6 address // Wrap the native address structure and add to list [addresses addObject:[NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]]; } } freeaddrinfo(res0); if ([addresses count] == 0) { error = [self gaiError:EAI_FAIL]; } } } dispatch_async(socketQueue, ^{ @autoreleasepool { completionBlock(addresses, error); }}); }}); } /** * This method picks an address from the given list of addresses. * The address picked depends upon which protocols are disabled, deactived, & preferred. * * Returns the address family (AF_INET or AF_INET6) of the picked address, * or AF_UNSPEC and the corresponding error is there's a problem. **/ - (int)getAddress:(NSData **)addressPtr error:(NSError **)errorPtr fromAddresses:(NSArray *)addresses { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert([addresses count] > 0, @"Expected at least one address"); int resultAF = AF_UNSPEC; NSData *resultAddress = nil; NSError *resultError = nil; // Check for problems BOOL resolvedIPv4Address = NO; BOOL resolvedIPv6Address = NO; for (NSData *address in addresses) { switch ([[self class] familyFromAddress:address]) { case AF_INET : resolvedIPv4Address = YES; break; case AF_INET6 : resolvedIPv6Address = YES; break; default : NSAssert(NO, @"Addresses array contains invalid address"); } } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && !resolvedIPv6Address) { NSString *msg = @"IPv4 has been disabled and DNS lookup found no IPv6 address(es)."; resultError = [self otherError:msg]; if (addressPtr) *addressPtr = resultAddress; if (errorPtr) *errorPtr = resultError; return resultAF; } if (isIPv6Disabled && !resolvedIPv4Address) { NSString *msg = @"IPv6 has been disabled and DNS lookup found no IPv4 address(es)."; resultError = [self otherError:msg]; if (addressPtr) *addressPtr = resultAddress; if (errorPtr) *errorPtr = resultError; return resultAF; } BOOL isIPv4Deactivated = (flags & kIPv4Deactivated) ? YES : NO; BOOL isIPv6Deactivated = (flags & kIPv6Deactivated) ? YES : NO; if (isIPv4Deactivated && !resolvedIPv6Address) { NSString *msg = @"IPv4 has been deactivated due to bind/connect, and DNS lookup found no IPv6 address(es)."; resultError = [self otherError:msg]; if (addressPtr) *addressPtr = resultAddress; if (errorPtr) *errorPtr = resultError; return resultAF; } if (isIPv6Deactivated && !resolvedIPv4Address) { NSString *msg = @"IPv6 has been deactivated due to bind/connect, and DNS lookup found no IPv4 address(es)."; resultError = [self otherError:msg]; if (addressPtr) *addressPtr = resultAddress; if (errorPtr) *errorPtr = resultError; return resultAF; } // Extract first IPv4 and IPv6 address in list BOOL ipv4WasFirstInList = YES; NSData *address4 = nil; NSData *address6 = nil; for (NSData *address in addresses) { int af = [[self class] familyFromAddress:address]; if (af == AF_INET) { if (address4 == nil) { address4 = address; if (address6) break; else ipv4WasFirstInList = YES; } } else // af == AF_INET6 { if (address6 == nil) { address6 = address; if (address4) break; else ipv4WasFirstInList = NO; } } } // Determine socket type BOOL preferIPv4 = (config & kPreferIPv4) ? YES : NO; BOOL preferIPv6 = (config & kPreferIPv6) ? YES : NO; BOOL useIPv4 = ((preferIPv4 && address4) || (address6 == nil)); BOOL useIPv6 = ((preferIPv6 && address6) || (address4 == nil)); NSAssert(!(preferIPv4 && preferIPv6), @"Invalid config state"); NSAssert(!(useIPv4 && useIPv6), @"Invalid logic"); if (useIPv4 || (!useIPv6 && ipv4WasFirstInList)) { resultAF = AF_INET; resultAddress = address4; } else { resultAF = AF_INET6; resultAddress = address6; } if (addressPtr) *addressPtr = resultAddress; if (errorPtr) *errorPtr = resultError; return resultAF; } /** * Finds the address(es) of an interface description. * An inteface description may be an interface name (en0, en1, lo0) or corresponding IP (192.168.4.34). **/ - (void)convertIntefaceDescription:(NSString *)interfaceDescription port:(uint16_t)port intoAddress4:(NSData **)interfaceAddr4Ptr address6:(NSData **)interfaceAddr6Ptr { NSData *addr4 = nil; NSData *addr6 = nil; if (interfaceDescription == nil) { // ANY address struct sockaddr_in sockaddr4; memset(&sockaddr4, 0, sizeof(sockaddr4)); sockaddr4.sin_len = sizeof(sockaddr4); sockaddr4.sin_family = AF_INET; sockaddr4.sin_port = htons(port); sockaddr4.sin_addr.s_addr = htonl(INADDR_ANY); struct sockaddr_in6 sockaddr6; memset(&sockaddr6, 0, sizeof(sockaddr6)); sockaddr6.sin6_len = sizeof(sockaddr6); sockaddr6.sin6_family = AF_INET6; sockaddr6.sin6_port = htons(port); sockaddr6.sin6_addr = in6addr_any; addr4 = [NSData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]; addr6 = [NSData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]; } else if ([interfaceDescription isEqualToString:@"localhost"] || [interfaceDescription isEqualToString:@"loopback"]) { // LOOPBACK address struct sockaddr_in sockaddr4; memset(&sockaddr4, 0, sizeof(sockaddr4)); sockaddr4.sin_len = sizeof(struct sockaddr_in); sockaddr4.sin_family = AF_INET; sockaddr4.sin_port = htons(port); sockaddr4.sin_addr.s_addr = htonl(INADDR_LOOPBACK); struct sockaddr_in6 sockaddr6; memset(&sockaddr6, 0, sizeof(sockaddr6)); sockaddr6.sin6_len = sizeof(struct sockaddr_in6); sockaddr6.sin6_family = AF_INET6; sockaddr6.sin6_port = htons(port); sockaddr6.sin6_addr = in6addr_loopback; addr4 = [NSData dataWithBytes:&sockaddr4 length:sizeof(sockaddr4)]; addr6 = [NSData dataWithBytes:&sockaddr6 length:sizeof(sockaddr6)]; } else { const char *iface = [interfaceDescription UTF8String]; struct ifaddrs *addrs; const struct ifaddrs *cursor; if ((getifaddrs(&addrs) == 0)) { cursor = addrs; while (cursor != NULL) { if ((addr4 == nil) && (cursor->ifa_addr->sa_family == AF_INET)) { // IPv4 struct sockaddr_in *addr = (struct sockaddr_in *)cursor->ifa_addr; if (strcmp(cursor->ifa_name, iface) == 0) { // Name match struct sockaddr_in nativeAddr4 = *addr; nativeAddr4.sin_port = htons(port); addr4 = [NSData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; } else { char ip[INET_ADDRSTRLEN]; const char *conversion; conversion = inet_ntop(AF_INET, &addr->sin_addr, ip, sizeof(ip)); if ((conversion != NULL) && (strcmp(ip, iface) == 0)) { // IP match struct sockaddr_in nativeAddr4 = *addr; nativeAddr4.sin_port = htons(port); addr4 = [NSData dataWithBytes:&nativeAddr4 length:sizeof(nativeAddr4)]; } } } else if ((addr6 == nil) && (cursor->ifa_addr->sa_family == AF_INET6)) { // IPv6 struct sockaddr_in6 *addr = (struct sockaddr_in6 *)cursor->ifa_addr; if (strcmp(cursor->ifa_name, iface) == 0) { // Name match struct sockaddr_in6 nativeAddr6 = *addr; nativeAddr6.sin6_port = htons(port); addr6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; } else { char ip[INET6_ADDRSTRLEN]; const char *conversion; conversion = inet_ntop(AF_INET6, &addr->sin6_addr, ip, sizeof(ip)); if ((conversion != NULL) && (strcmp(ip, iface) == 0)) { // IP match struct sockaddr_in6 nativeAddr6 = *addr; nativeAddr6.sin6_port = htons(port); addr6 = [NSData dataWithBytes:&nativeAddr6 length:sizeof(nativeAddr6)]; } } } cursor = cursor->ifa_next; } freeifaddrs(addrs); } } if (interfaceAddr4Ptr) *interfaceAddr4Ptr = addr4; if (interfaceAddr6Ptr) *interfaceAddr6Ptr = addr6; } /** * Converts a numeric hostname into its corresponding address. * The hostname is expected to be an IPv4 or IPv6 address represented as a human-readable string. (e.g. 192.168.4.34) **/ - (void)convertNumericHost:(NSString *)numericHost port:(uint16_t)port intoAddress4:(NSData **)addr4Ptr address6:(NSData **)addr6Ptr { NSData *addr4 = nil; NSData *addr6 = nil; if (numericHost) { NSString *portStr = [NSString stringWithFormat:@"%hu", port]; struct addrinfo hints, *res, *res0; memset(&hints, 0, sizeof(hints)); hints.ai_family = PF_UNSPEC; hints.ai_socktype = SOCK_DGRAM; hints.ai_protocol = IPPROTO_UDP; hints.ai_flags = AI_NUMERICHOST; // No name resolution should be attempted if (getaddrinfo([numericHost UTF8String], [portStr UTF8String], &hints, &res0) == 0) { for (res = res0; res; res = res->ai_next) { if ((addr4 == nil) && (res->ai_family == AF_INET)) { // Found IPv4 address // Wrap the native address structure addr4 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } else if ((addr6 == nil) && (res->ai_family == AF_INET6)) { // Found IPv6 address // Wrap the native address structure addr6 = [NSData dataWithBytes:res->ai_addr length:res->ai_addrlen]; } } freeaddrinfo(res0); } } if (addr4Ptr) *addr4Ptr = addr4; if (addr6Ptr) *addr6Ptr = addr6; } - (BOOL)isConnectedToAddress4:(NSData *)someAddr4 { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(flags & kDidConnect, @"Not connected"); NSAssert(cachedConnectedAddress, @"Expected cached connected address"); if (cachedConnectedFamily != AF_INET) { return NO; } const struct sockaddr_in *sSockaddr4 = (struct sockaddr_in *)[someAddr4 bytes]; const struct sockaddr_in *cSockaddr4 = (struct sockaddr_in *)[cachedConnectedAddress bytes]; if (memcmp(&sSockaddr4->sin_addr, &cSockaddr4->sin_addr, sizeof(struct in_addr)) != 0) { return NO; } if (memcmp(&sSockaddr4->sin_port, &cSockaddr4->sin_port, sizeof(in_port_t)) != 0) { return NO; } return YES; } - (BOOL)isConnectedToAddress6:(NSData *)someAddr6 { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(flags & kDidConnect, @"Not connected"); NSAssert(cachedConnectedAddress, @"Expected cached connected address"); if (cachedConnectedFamily != AF_INET6) { return NO; } const struct sockaddr_in6 *sSockaddr6 = (struct sockaddr_in6 *)[someAddr6 bytes]; const struct sockaddr_in6 *cSockaddr6 = (struct sockaddr_in6 *)[cachedConnectedAddress bytes]; if (memcmp(&sSockaddr6->sin6_addr, &cSockaddr6->sin6_addr, sizeof(struct in6_addr)) != 0) { return NO; } if (memcmp(&sSockaddr6->sin6_port, &cSockaddr6->sin6_port, sizeof(in_port_t)) != 0) { return NO; } return YES; } - (unsigned int)indexOfInterfaceAddr4:(NSData *)interfaceAddr4 { if (interfaceAddr4 == nil) return 0; if ([interfaceAddr4 length] != sizeof(struct sockaddr_in)) return 0; int result = 0; struct sockaddr_in *ifaceAddr = (struct sockaddr_in *)[interfaceAddr4 bytes]; struct ifaddrs *addrs; const struct ifaddrs *cursor; if ((getifaddrs(&addrs) == 0)) { cursor = addrs; while (cursor != NULL) { if (cursor->ifa_addr->sa_family == AF_INET) { // IPv4 struct sockaddr_in *addr = (struct sockaddr_in *)cursor->ifa_addr; if (memcmp(&addr->sin_addr, &ifaceAddr->sin_addr, sizeof(struct in_addr)) == 0) { result = if_nametoindex(cursor->ifa_name); break; } } cursor = cursor->ifa_next; } freeifaddrs(addrs); } return result; } - (unsigned int)indexOfInterfaceAddr6:(NSData *)interfaceAddr6 { if (interfaceAddr6 == nil) return 0; if ([interfaceAddr6 length] != sizeof(struct sockaddr_in6)) return 0; int result = 0; struct sockaddr_in6 *ifaceAddr = (struct sockaddr_in6 *)[interfaceAddr6 bytes]; struct ifaddrs *addrs; const struct ifaddrs *cursor; if ((getifaddrs(&addrs) == 0)) { cursor = addrs; while (cursor != NULL) { if (cursor->ifa_addr->sa_family == AF_INET6) { // IPv6 struct sockaddr_in6 *addr = (struct sockaddr_in6 *)cursor->ifa_addr; if (memcmp(&addr->sin6_addr, &ifaceAddr->sin6_addr, sizeof(struct in6_addr)) == 0) { result = if_nametoindex(cursor->ifa_name); break; } } cursor = cursor->ifa_next; } freeifaddrs(addrs); } return result; } - (void)setupSendAndReceiveSourcesForSocket4 { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); send4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE, socket4FD, 0, socketQueue); receive4Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket4FD, 0, socketQueue); // Setup event handlers dispatch_source_set_event_handler(send4Source, ^{ @autoreleasepool { LogVerbose(@"send4EventBlock"); LogVerbose(@"dispatch_source_get_data(send4Source) = %lu", dispatch_source_get_data(send4Source)); flags |= kSock4CanAcceptBytes; // If we're ready to send data, do so immediately. // Otherwise pause the send source or it will continue to fire over and over again. if (currentSend == nil) { LogVerbose(@"Nothing to send"); [self suspendSend4Source]; } else if (currentSend->resolveInProgress) { LogVerbose(@"currentSend - waiting for address resolve"); [self suspendSend4Source]; } else if (currentSend->filterInProgress) { LogVerbose(@"currentSend - waiting on sendFilter"); [self suspendSend4Source]; } else { [self doSend]; } }}); dispatch_source_set_event_handler(receive4Source, ^{ @autoreleasepool { LogVerbose(@"receive4EventBlock"); socket4FDBytesAvailable = dispatch_source_get_data(receive4Source); LogVerbose(@"socket4FDBytesAvailable: %lu", socket4FDBytesAvailable); if (socket4FDBytesAvailable > 0) [self doReceive]; else [self doReceiveEOF]; }}); // Setup cancel handlers __block int socketFDRefCount = 2; int theSocketFD = socket4FD; #if !OS_OBJECT_USE_OBJC dispatch_source_t theSendSource = send4Source; dispatch_source_t theReceiveSource = receive4Source; #endif dispatch_source_set_cancel_handler(send4Source, ^{ LogVerbose(@"send4CancelBlock"); #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(send4Source)"); dispatch_release(theSendSource); #endif if (--socketFDRefCount == 0) { LogVerbose(@"close(socket4FD)"); close(theSocketFD); } }); dispatch_source_set_cancel_handler(receive4Source, ^{ LogVerbose(@"receive4CancelBlock"); #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(receive4Source)"); dispatch_release(theReceiveSource); #endif if (--socketFDRefCount == 0) { LogVerbose(@"close(socket4FD)"); close(theSocketFD); } }); // We will not be able to receive until the socket is bound to a port, // either explicitly via bind, or implicitly by connect or by sending data. // // But we should be able to send immediately. socket4FDBytesAvailable = 0; flags |= kSock4CanAcceptBytes; flags |= kSend4SourceSuspended; flags |= kReceive4SourceSuspended; } - (void)setupSendAndReceiveSourcesForSocket6 { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); send6Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_WRITE, socket6FD, 0, socketQueue); receive6Source = dispatch_source_create(DISPATCH_SOURCE_TYPE_READ, socket6FD, 0, socketQueue); // Setup event handlers dispatch_source_set_event_handler(send6Source, ^{ @autoreleasepool { LogVerbose(@"send6EventBlock"); LogVerbose(@"dispatch_source_get_data(send6Source) = %lu", dispatch_source_get_data(send6Source)); flags |= kSock6CanAcceptBytes; // If we're ready to send data, do so immediately. // Otherwise pause the send source or it will continue to fire over and over again. if (currentSend == nil) { LogVerbose(@"Nothing to send"); [self suspendSend6Source]; } else if (currentSend->resolveInProgress) { LogVerbose(@"currentSend - waiting for address resolve"); [self suspendSend6Source]; } else if (currentSend->filterInProgress) { LogVerbose(@"currentSend - waiting on sendFilter"); [self suspendSend6Source]; } else { [self doSend]; } }}); dispatch_source_set_event_handler(receive6Source, ^{ @autoreleasepool { LogVerbose(@"receive6EventBlock"); socket6FDBytesAvailable = dispatch_source_get_data(receive6Source); LogVerbose(@"socket6FDBytesAvailable: %lu", socket6FDBytesAvailable); if (socket6FDBytesAvailable > 0) [self doReceive]; else [self doReceiveEOF]; }}); // Setup cancel handlers __block int socketFDRefCount = 2; int theSocketFD = socket6FD; #if !OS_OBJECT_USE_OBJC dispatch_source_t theSendSource = send6Source; dispatch_source_t theReceiveSource = receive6Source; #endif dispatch_source_set_cancel_handler(send6Source, ^{ LogVerbose(@"send6CancelBlock"); #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(send6Source)"); dispatch_release(theSendSource); #endif if (--socketFDRefCount == 0) { LogVerbose(@"close(socket6FD)"); close(theSocketFD); } }); dispatch_source_set_cancel_handler(receive6Source, ^{ LogVerbose(@"receive6CancelBlock"); #if !OS_OBJECT_USE_OBJC LogVerbose(@"dispatch_release(receive6Source)"); dispatch_release(theReceiveSource); #endif if (--socketFDRefCount == 0) { LogVerbose(@"close(socket6FD)"); close(theSocketFD); } }); // We will not be able to receive until the socket is bound to a port, // either explicitly via bind, or implicitly by connect or by sending data. // // But we should be able to send immediately. socket6FDBytesAvailable = 0; flags |= kSock6CanAcceptBytes; flags |= kSend6SourceSuspended; flags |= kReceive6SourceSuspended; } - (BOOL)createSocket4:(BOOL)useIPv4 socket6:(BOOL)useIPv6 error:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(((flags & kDidCreateSockets) == 0), @"Sockets have already been created"); // CreateSocket Block // This block will be invoked below. int(^createSocket)(int) = ^int (int domain) { int socketFD = socket(domain, SOCK_DGRAM, 0); if (socketFD == SOCKET_NULL) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error in socket() function"]; return SOCKET_NULL; } int status; // Set socket options status = fcntl(socketFD, F_SETFL, O_NONBLOCK); if (status == -1) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error enabling non-blocking IO on socket (fcntl)"]; close(socketFD); return SOCKET_NULL; } int reuseaddr = 1; status = setsockopt(socketFD, SOL_SOCKET, SO_REUSEADDR, &reuseaddr, sizeof(reuseaddr)); if (status == -1) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error enabling address reuse (setsockopt)"]; close(socketFD); return SOCKET_NULL; } int nosigpipe = 1; status = setsockopt(socketFD, SOL_SOCKET, SO_NOSIGPIPE, &nosigpipe, sizeof(nosigpipe)); if (status == -1) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error disabling sigpipe (setsockopt)"]; close(socketFD); return SOCKET_NULL; } return socketFD; }; // Create sockets depending upon given configuration. if (useIPv4) { LogVerbose(@"Creating IPv4 socket"); socket4FD = createSocket(AF_INET); if (socket4FD == SOCKET_NULL) { // errPtr set in local createSocket() block return NO; } } if (useIPv6) { LogVerbose(@"Creating IPv6 socket"); socket6FD = createSocket(AF_INET6); if (socket6FD == SOCKET_NULL) { // errPtr set in local createSocket() block if (socket4FD != SOCKET_NULL) { close(socket4FD); socket4FD = SOCKET_NULL; } return NO; } } // Setup send and receive sources if (useIPv4) [self setupSendAndReceiveSourcesForSocket4]; if (useIPv6) [self setupSendAndReceiveSourcesForSocket6]; flags |= kDidCreateSockets; return YES; } - (BOOL)createSockets:(NSError **)errPtr { LogTrace(); BOOL useIPv4 = [self isIPv4Enabled]; BOOL useIPv6 = [self isIPv6Enabled]; return [self createSocket4:useIPv4 socket6:useIPv6 error:errPtr]; } - (void)suspendSend4Source { if (send4Source && !(flags & kSend4SourceSuspended)) { LogVerbose(@"dispatch_suspend(send4Source)"); dispatch_suspend(send4Source); flags |= kSend4SourceSuspended; } } - (void)suspendSend6Source { if (send6Source && !(flags & kSend6SourceSuspended)) { LogVerbose(@"dispatch_suspend(send6Source)"); dispatch_suspend(send6Source); flags |= kSend6SourceSuspended; } } - (void)resumeSend4Source { if (send4Source && (flags & kSend4SourceSuspended)) { LogVerbose(@"dispatch_resume(send4Source)"); dispatch_resume(send4Source); flags &= ~kSend4SourceSuspended; } } - (void)resumeSend6Source { if (send6Source && (flags & kSend6SourceSuspended)) { LogVerbose(@"dispatch_resume(send6Source)"); dispatch_resume(send6Source); flags &= ~kSend6SourceSuspended; } } - (void)suspendReceive4Source { if (receive4Source && !(flags & kReceive4SourceSuspended)) { LogVerbose(@"dispatch_suspend(receive4Source)"); dispatch_suspend(receive4Source); flags |= kReceive4SourceSuspended; } } - (void)suspendReceive6Source { if (receive6Source && !(flags & kReceive6SourceSuspended)) { LogVerbose(@"dispatch_suspend(receive6Source)"); dispatch_suspend(receive6Source); flags |= kReceive6SourceSuspended; } } - (void)resumeReceive4Source { if (receive4Source && (flags & kReceive4SourceSuspended)) { LogVerbose(@"dispatch_resume(receive4Source)"); dispatch_resume(receive4Source); flags &= ~kReceive4SourceSuspended; } } - (void)resumeReceive6Source { if (receive6Source && (flags & kReceive6SourceSuspended)) { LogVerbose(@"dispatch_resume(receive6Source)"); dispatch_resume(receive6Source); flags &= ~kReceive6SourceSuspended; } } - (void)closeSocket4 { if (socket4FD != SOCKET_NULL) { LogVerbose(@"dispatch_source_cancel(send4Source)"); dispatch_source_cancel(send4Source); LogVerbose(@"dispatch_source_cancel(receive4Source)"); dispatch_source_cancel(receive4Source); // For some crazy reason (in my opinion), cancelling a dispatch source doesn't // invoke the cancel handler if the dispatch source is paused. // So we have to unpause the source if needed. // This allows the cancel handler to be run, which in turn releases the source and closes the socket. [self resumeSend4Source]; [self resumeReceive4Source]; // The sockets will be closed by the cancel handlers of the corresponding source send4Source = NULL; receive4Source = NULL; socket4FD = SOCKET_NULL; // Clear socket states socket4FDBytesAvailable = 0; flags &= ~kSock4CanAcceptBytes; // Clear cached info cachedLocalAddress4 = nil; cachedLocalHost4 = nil; cachedLocalPort4 = 0; } } - (void)closeSocket6 { if (socket6FD != SOCKET_NULL) { LogVerbose(@"dispatch_source_cancel(send6Source)"); dispatch_source_cancel(send6Source); LogVerbose(@"dispatch_source_cancel(receive6Source)"); dispatch_source_cancel(receive6Source); // For some crazy reason (in my opinion), cancelling a dispatch source doesn't // invoke the cancel handler if the dispatch source is paused. // So we have to unpause the source if needed. // This allows the cancel handler to be run, which in turn releases the source and closes the socket. [self resumeSend6Source]; [self resumeReceive6Source]; send6Source = NULL; receive6Source = NULL; // The sockets will be closed by the cancel handlers of the corresponding source socket6FD = SOCKET_NULL; // Clear socket states socket6FDBytesAvailable = 0; flags &= ~kSock6CanAcceptBytes; // Clear cached info cachedLocalAddress6 = nil; cachedLocalHost6 = nil; cachedLocalPort6 = 0; } } - (void)closeSockets { [self closeSocket4]; [self closeSocket6]; flags &= ~kDidCreateSockets; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Diagnostics //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)getLocalAddress:(NSData **)dataPtr host:(NSString **)hostPtr port:(uint16_t *)portPtr forSocket:(int)socketFD withFamily:(int)socketFamily { NSData *data = nil; NSString *host = nil; uint16_t port = 0; if (socketFamily == AF_INET) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getsockname(socketFD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) { data = [NSData dataWithBytes:&sockaddr4 length:sockaddr4len]; host = [[self class] hostFromSockaddr4:&sockaddr4]; port = [[self class] portFromSockaddr4:&sockaddr4]; } else { LogWarn(@"Error in getsockname: %@", [self errnoError]); } } else if (socketFamily == AF_INET6) { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getsockname(socketFD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) { data = [NSData dataWithBytes:&sockaddr6 length:sockaddr6len]; host = [[self class] hostFromSockaddr6:&sockaddr6]; port = [[self class] portFromSockaddr6:&sockaddr6]; } else { LogWarn(@"Error in getsockname: %@", [self errnoError]); } } if (dataPtr) *dataPtr = data; if (hostPtr) *hostPtr = host; if (portPtr) *portPtr = port; return (data != nil); } - (void)maybeUpdateCachedLocalAddress4Info { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if ( cachedLocalAddress4 || ((flags & kDidBind) == 0) || (socket4FD == SOCKET_NULL) ) { return; } NSData *address = nil; NSString *host = nil; uint16_t port = 0; if ([self getLocalAddress:&address host:&host port:&port forSocket:socket4FD withFamily:AF_INET]) { cachedLocalAddress4 = address; cachedLocalHost4 = host; cachedLocalPort4 = port; } } - (void)maybeUpdateCachedLocalAddress6Info { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if ( cachedLocalAddress6 || ((flags & kDidBind) == 0) || (socket6FD == SOCKET_NULL) ) { return; } NSData *address = nil; NSString *host = nil; uint16_t port = 0; if ([self getLocalAddress:&address host:&host port:&port forSocket:socket6FD withFamily:AF_INET6]) { cachedLocalAddress6 = address; cachedLocalHost6 = host; cachedLocalPort6 = port; } } - (NSData *)localAddress { __block NSData *result = nil; dispatch_block_t block = ^{ if (socket4FD != SOCKET_NULL) { [self maybeUpdateCachedLocalAddress4Info]; result = cachedLocalAddress4; } else { [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalAddress6; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (NSString *)localHost { __block NSString *result = nil; dispatch_block_t block = ^{ if (socket4FD != SOCKET_NULL) { [self maybeUpdateCachedLocalAddress4Info]; result = cachedLocalHost4; } else { [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalHost6; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (uint16_t)localPort { __block uint16_t result = 0; dispatch_block_t block = ^{ if (socket4FD != SOCKET_NULL) { [self maybeUpdateCachedLocalAddress4Info]; result = cachedLocalPort4; } else { [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalPort6; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (NSData *)localAddress_IPv4 { __block NSData *result = nil; dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress4Info]; result = cachedLocalAddress4; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (NSString *)localHost_IPv4 { __block NSString *result = nil; dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress4Info]; result = cachedLocalHost4; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (uint16_t)localPort_IPv4 { __block uint16_t result = 0; dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress4Info]; result = cachedLocalPort4; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (NSData *)localAddress_IPv6 { __block NSData *result = nil; dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalAddress6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (NSString *)localHost_IPv6 { __block NSString *result = nil; dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalHost6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (uint16_t)localPort_IPv6 { __block uint16_t result = 0; dispatch_block_t block = ^{ [self maybeUpdateCachedLocalAddress6Info]; result = cachedLocalPort6; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (void)maybeUpdateCachedConnectedAddressInfo { NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (cachedConnectedAddress || (flags & kDidConnect) == 0) { return; } NSData *data = nil; NSString *host = nil; uint16_t port = 0; int family = AF_UNSPEC; if (socket4FD != SOCKET_NULL) { struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); if (getpeername(socket4FD, (struct sockaddr *)&sockaddr4, &sockaddr4len) == 0) { data = [NSData dataWithBytes:&sockaddr4 length:sockaddr4len]; host = [[self class] hostFromSockaddr4:&sockaddr4]; port = [[self class] portFromSockaddr4:&sockaddr4]; family = AF_INET; } else { LogWarn(@"Error in getpeername: %@", [self errnoError]); } } else if (socket6FD != SOCKET_NULL) { struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); if (getpeername(socket6FD, (struct sockaddr *)&sockaddr6, &sockaddr6len) == 0) { data = [NSData dataWithBytes:&sockaddr6 length:sockaddr6len]; host = [[self class] hostFromSockaddr6:&sockaddr6]; port = [[self class] portFromSockaddr6:&sockaddr6]; family = AF_INET6; } else { LogWarn(@"Error in getpeername: %@", [self errnoError]); } } cachedConnectedAddress = data; cachedConnectedHost = host; cachedConnectedPort = port; cachedConnectedFamily = family; } - (NSData *)connectedAddress { __block NSData *result = nil; dispatch_block_t block = ^{ [self maybeUpdateCachedConnectedAddressInfo]; result = cachedConnectedAddress; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (NSString *)connectedHost { __block NSString *result = nil; dispatch_block_t block = ^{ [self maybeUpdateCachedConnectedAddressInfo]; result = cachedConnectedHost; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (uint16_t)connectedPort { __block uint16_t result = 0; dispatch_block_t block = ^{ [self maybeUpdateCachedConnectedAddressInfo]; result = cachedConnectedPort; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, AutoreleasedBlock(block)); return result; } - (BOOL)isConnected { __block BOOL result = NO; dispatch_block_t block = ^{ result = (flags & kDidConnect) ? YES : NO; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isClosed { __block BOOL result = YES; dispatch_block_t block = ^{ result = (flags & kDidCreateSockets) ? NO : YES; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isIPv4 { __block BOOL result = NO; dispatch_block_t block = ^{ if (flags & kDidCreateSockets) { result = (socket4FD != SOCKET_NULL); } else { result = [self isIPv4Enabled]; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } - (BOOL)isIPv6 { __block BOOL result = NO; dispatch_block_t block = ^{ if (flags & kDidCreateSockets) { result = (socket6FD != SOCKET_NULL); } else { result = [self isIPv6Enabled]; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); return result; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Binding //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * This method runs through the various checks required prior to a bind attempt. * It is shared between the various bind methods. **/ - (BOOL)preBind:(NSError **)errPtr { if (![self preOp:errPtr]) { return NO; } if (flags & kDidBind) { if (errPtr) { NSString *msg = @"Cannot bind a socket more than once."; *errPtr = [self badConfigError:msg]; } return NO; } if ((flags & kConnecting) || (flags & kDidConnect)) { if (errPtr) { NSString *msg = @"Cannot bind after connecting. If needed, bind first, then connect."; *errPtr = [self badConfigError:msg]; } return NO; } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled { if (errPtr) { NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; *errPtr = [self badConfigError:msg]; } return NO; } return YES; } - (BOOL)bindToPort:(uint16_t)port error:(NSError **)errPtr { return [self bindToPort:port interface:nil error:errPtr]; } - (BOOL)bindToPort:(uint16_t)port interface:(NSString *)interface error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks if (![self preBind:&err]) { return_from_block; } // Check the given interface NSData *interface4 = nil; NSData *interface6 = nil; [self convertIntefaceDescription:interface port:port intoAddress4:&interface4 address6:&interface6]; if ((interface4 == nil) && (interface6 == nil)) { NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; err = [self badParamError:msg]; return_from_block; } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && (interface6 == nil)) { NSString *msg = @"IPv4 has been disabled and specified interface doesn't support IPv6."; err = [self badParamError:msg]; return_from_block; } if (isIPv6Disabled && (interface4 == nil)) { NSString *msg = @"IPv6 has been disabled and specified interface doesn't support IPv4."; err = [self badParamError:msg]; return_from_block; } // Determine protocol(s) BOOL useIPv4 = !isIPv4Disabled && (interface4 != nil); BOOL useIPv6 = !isIPv6Disabled && (interface6 != nil); // Create the socket(s) if needed if ((flags & kDidCreateSockets) == 0) { if (![self createSocket4:useIPv4 socket6:useIPv6 error:&err]) { return_from_block; } } // Bind the socket(s) LogVerbose(@"Binding socket to port(%hu) interface(%@)", port, interface); if (useIPv4) { int status = bind(socket4FD, (struct sockaddr *)[interface4 bytes], (socklen_t)[interface4 length]); if (status == -1) { [self closeSockets]; NSString *reason = @"Error in bind() function"; err = [self errnoErrorWithReason:reason]; return_from_block; } } if (useIPv6) { int status = bind(socket6FD, (struct sockaddr *)[interface6 bytes], (socklen_t)[interface6 length]); if (status == -1) { [self closeSockets]; NSString *reason = @"Error in bind() function"; err = [self errnoErrorWithReason:reason]; return_from_block; } } // Update flags flags |= kDidBind; if (!useIPv4) flags |= kIPv4Deactivated; if (!useIPv6) flags |= kIPv6Deactivated; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (err) LogError(@"Error binding to port/interface: %@", err); if (errPtr) *errPtr = err; return result; } - (BOOL)bindToAddress:(NSData *)localAddr error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks if (![self preBind:&err]) { return_from_block; } // Check the given address int addressFamily = [[self class] familyFromAddress:localAddr]; if (addressFamily == AF_UNSPEC) { NSString *msg = @"A valid IPv4 or IPv6 address was not given"; err = [self badParamError:msg]; return_from_block; } NSData *localAddr4 = (addressFamily == AF_INET) ? localAddr : nil; NSData *localAddr6 = (addressFamily == AF_INET6) ? localAddr : nil; BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && localAddr4) { NSString *msg = @"IPv4 has been disabled and an IPv4 address was passed."; err = [self badParamError:msg]; return_from_block; } if (isIPv6Disabled && localAddr6) { NSString *msg = @"IPv6 has been disabled and an IPv6 address was passed."; err = [self badParamError:msg]; return_from_block; } // Determine protocol(s) BOOL useIPv4 = !isIPv4Disabled && (localAddr4 != nil); BOOL useIPv6 = !isIPv6Disabled && (localAddr6 != nil); // Create the socket(s) if needed if ((flags & kDidCreateSockets) == 0) { if (![self createSocket4:useIPv4 socket6:useIPv6 error:&err]) { return_from_block; } } // Bind the socket(s) if (useIPv4) { LogVerbose(@"Binding socket to address(%@:%hu)", [[self class] hostFromAddress:localAddr4], [[self class] portFromAddress:localAddr4]); int status = bind(socket4FD, (struct sockaddr *)[localAddr4 bytes], (socklen_t)[localAddr4 length]); if (status == -1) { [self closeSockets]; NSString *reason = @"Error in bind() function"; err = [self errnoErrorWithReason:reason]; return_from_block; } } else { LogVerbose(@"Binding socket to address(%@:%hu)", [[self class] hostFromAddress:localAddr6], [[self class] portFromAddress:localAddr6]); int status = bind(socket6FD, (struct sockaddr *)[localAddr6 bytes], (socklen_t)[localAddr6 length]); if (status == -1) { [self closeSockets]; NSString *reason = @"Error in bind() function"; err = [self errnoErrorWithReason:reason]; return_from_block; } } // Update flags flags |= kDidBind; if (!useIPv4) flags |= kIPv4Deactivated; if (!useIPv6) flags |= kIPv6Deactivated; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (err) LogError(@"Error binding to address: %@", err); if (errPtr) *errPtr = err; return result; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Connecting //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * This method runs through the various checks required prior to a connect attempt. * It is shared between the various connect methods. **/ - (BOOL)preConnect:(NSError **)errPtr { if (![self preOp:errPtr]) { return NO; } if ((flags & kConnecting) || (flags & kDidConnect)) { if (errPtr) { NSString *msg = @"Cannot connect a socket more than once."; *errPtr = [self badConfigError:msg]; } return NO; } BOOL isIPv4Disabled = (config & kIPv4Disabled) ? YES : NO; BOOL isIPv6Disabled = (config & kIPv6Disabled) ? YES : NO; if (isIPv4Disabled && isIPv6Disabled) // Must have IPv4 or IPv6 enabled { if (errPtr) { NSString *msg = @"Both IPv4 and IPv6 have been disabled. Must enable at least one protocol first."; *errPtr = [self badConfigError:msg]; } return NO; } return YES; } - (BOOL)connectToHost:(NSString *)host onPort:(uint16_t)port error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks. if (![self preConnect:&err]) { return_from_block; } // Check parameter(s) if (host == nil) { NSString *msg = @"The host param is nil. Should be domain name or IP address string."; err = [self badParamError:msg]; return_from_block; } // Create the socket(s) if needed if ((flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { return_from_block; } } // Create special connect packet GCDAsyncUdpSpecialPacket *packet = [[GCDAsyncUdpSpecialPacket alloc] init]; packet->resolveInProgress = YES; // Start asynchronous DNS resolve for host:port on background queue LogVerbose(@"Dispatching DNS resolve for connect..."); [self asyncResolveHost:host port:port withCompletionBlock:^(NSArray *addresses, NSError *error) { // The asyncResolveHost:port:: method asynchronously dispatches a task onto the global concurrent queue, // and immediately returns. Once the async resolve task completes, // this block is executed on our socketQueue. packet->resolveInProgress = NO; packet->addresses = addresses; packet->error = error; [self maybeConnect]; }]; // Updates flags, add connect packet to send queue, and pump send queue flags |= kConnecting; [sendQueue addObject:packet]; [self maybeDequeueSend]; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (err) LogError(@"Error connecting to host/port: %@", err); if (errPtr) *errPtr = err; return result; } - (BOOL)connectToAddress:(NSData *)remoteAddr error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks. if (![self preConnect:&err]) { return_from_block; } // Check parameter(s) if (remoteAddr == nil) { NSString *msg = @"The address param is nil. Should be a valid address."; err = [self badParamError:msg]; return_from_block; } // Create the socket(s) if needed if ((flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { return_from_block; } } // The remoteAddr parameter could be of type NSMutableData. // So we copy it to be safe. NSData *address = [remoteAddr copy]; NSArray *addresses = [NSArray arrayWithObject:address]; GCDAsyncUdpSpecialPacket *packet = [[GCDAsyncUdpSpecialPacket alloc] init]; packet->addresses = addresses; // Updates flags, add connect packet to send queue, and pump send queue flags |= kConnecting; [sendQueue addObject:packet]; [self maybeDequeueSend]; result = YES; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (err) LogError(@"Error connecting to address: %@", err); if (errPtr) *errPtr = err; return result; } - (void)maybeConnect { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); BOOL sendQueueReady = [currentSend isKindOfClass:[GCDAsyncUdpSpecialPacket class]]; if (sendQueueReady) { GCDAsyncUdpSpecialPacket *connectPacket = (GCDAsyncUdpSpecialPacket *)currentSend; if (connectPacket->resolveInProgress) { LogVerbose(@"Waiting for DNS resolve..."); } else { if (connectPacket->error) { [self notifyDidNotConnect:connectPacket->error]; } else { NSData *address = nil; NSError *error = nil; int addressFamily = [self getAddress:&address error:&error fromAddresses:connectPacket->addresses]; // Perform connect BOOL result = NO; switch (addressFamily) { case AF_INET : result = [self connectWithAddress4:address error:&error]; break; case AF_INET6 : result = [self connectWithAddress6:address error:&error]; break; } if (result) { flags |= kDidBind; flags |= kDidConnect; cachedConnectedAddress = address; cachedConnectedHost = [[self class] hostFromAddress:address]; cachedConnectedPort = [[self class] portFromAddress:address]; cachedConnectedFamily = addressFamily; [self notifyDidConnectToAddress:address]; } else { [self notifyDidNotConnect:error]; } } flags &= ~kConnecting; [self endCurrentSend]; [self maybeDequeueSend]; } } } - (BOOL)connectWithAddress4:(NSData *)address4 error:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); int status = connect(socket4FD, (struct sockaddr *)[address4 bytes], (socklen_t)[address4 length]); if (status != 0) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error in connect() function"]; return NO; } [self closeSocket6]; flags |= kIPv6Deactivated; return YES; } - (BOOL)connectWithAddress6:(NSData *)address6 error:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); int status = connect(socket6FD, (struct sockaddr *)[address6 bytes], (socklen_t)[address6 length]); if (status != 0) { if (errPtr) *errPtr = [self errnoErrorWithReason:@"Error in connect() function"]; return NO; } [self closeSocket4]; flags |= kIPv4Deactivated; return YES; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Multicast //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)preJoin:(NSError **)errPtr { if (![self preOp:errPtr]) { return NO; } if (!(flags & kDidBind)) { if (errPtr) { NSString *msg = @"Must bind a socket before joining a multicast group."; *errPtr = [self badConfigError:msg]; } return NO; } if ((flags & kConnecting) || (flags & kDidConnect)) { if (errPtr) { NSString *msg = @"Cannot join a multicast group if connected."; *errPtr = [self badConfigError:msg]; } return NO; } return YES; } - (BOOL)joinMulticastGroup:(NSString *)group error:(NSError **)errPtr { return [self joinMulticastGroup:group onInterface:nil error:errPtr]; } - (BOOL)joinMulticastGroup:(NSString *)group onInterface:(NSString *)interface error:(NSError **)errPtr { // IP_ADD_MEMBERSHIP == IPV6_JOIN_GROUP return [self performMulticastRequest:IP_ADD_MEMBERSHIP forGroup:group onInterface:interface error:errPtr]; } - (BOOL)leaveMulticastGroup:(NSString *)group error:(NSError **)errPtr { return [self leaveMulticastGroup:group onInterface:nil error:errPtr]; } - (BOOL)leaveMulticastGroup:(NSString *)group onInterface:(NSString *)interface error:(NSError **)errPtr { // IP_DROP_MEMBERSHIP == IPV6_LEAVE_GROUP return [self performMulticastRequest:IP_DROP_MEMBERSHIP forGroup:group onInterface:interface error:errPtr]; } - (BOOL)performMulticastRequest:(int)requestType forGroup:(NSString *)group onInterface:(NSString *)interface error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { // Run through sanity checks if (![self preJoin:&err]) { return_from_block; } // Convert group to address NSData *groupAddr4 = nil; NSData *groupAddr6 = nil; [self convertNumericHost:group port:0 intoAddress4:&groupAddr4 address6:&groupAddr6]; if ((groupAddr4 == nil) && (groupAddr6 == nil)) { NSString *msg = @"Unknown group. Specify valid group IP address."; err = [self badParamError:msg]; return_from_block; } // Convert interface to address NSData *interfaceAddr4 = nil; NSData *interfaceAddr6 = nil; [self convertIntefaceDescription:interface port:0 intoAddress4:&interfaceAddr4 address6:&interfaceAddr6]; if ((interfaceAddr4 == nil) && (interfaceAddr6 == nil)) { NSString *msg = @"Unknown interface. Specify valid interface by name (e.g. \"en1\") or IP address."; err = [self badParamError:msg]; return_from_block; } // Perform join if ((socket4FD != SOCKET_NULL) && groupAddr4 && interfaceAddr4) { const struct sockaddr_in *nativeGroup = (struct sockaddr_in *)[groupAddr4 bytes]; const struct sockaddr_in *nativeIface = (struct sockaddr_in *)[interfaceAddr4 bytes]; struct ip_mreq imreq; imreq.imr_multiaddr = nativeGroup->sin_addr; imreq.imr_interface = nativeIface->sin_addr; int status = setsockopt(socket4FD, IPPROTO_IP, requestType, (const void *)&imreq, sizeof(imreq)); if (status != 0) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; return_from_block; } // Using IPv4 only [self closeSocket6]; result = YES; } else if ((socket6FD != SOCKET_NULL) && groupAddr6 && interfaceAddr6) { const struct sockaddr_in6 *nativeGroup = (struct sockaddr_in6 *)[groupAddr6 bytes]; struct ipv6_mreq imreq; imreq.ipv6mr_multiaddr = nativeGroup->sin6_addr; imreq.ipv6mr_interface = [self indexOfInterfaceAddr6:interfaceAddr6]; int status = setsockopt(socket6FD, IPPROTO_IPV6, requestType, (const void *)&imreq, sizeof(imreq)); if (status != 0) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; return_from_block; } // Using IPv6 only [self closeSocket4]; result = YES; } else { NSString *msg = @"Socket, group, and interface do not have matching IP versions"; err = [self badParamError:msg]; return_from_block; } }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (errPtr) *errPtr = err; return result; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Reuse port //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)enableReusePort:(BOOL)flag error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { if (![self preOp:&err]) { return_from_block; } if ((flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { return_from_block; } } int value = flag ? 1 : 0; if (socket4FD != SOCKET_NULL) { int error = setsockopt(socket4FD, SOL_SOCKET, SO_REUSEPORT, (const void *)&value, sizeof(value)); if (error) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; return_from_block; } result = YES; } if (socket6FD != SOCKET_NULL) { int error = setsockopt(socket6FD, SOL_SOCKET, SO_REUSEPORT, (const void *)&value, sizeof(value)); if (error) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; return_from_block; } result = YES; } }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (errPtr) *errPtr = err; return result; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Broadcast //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)enableBroadcast:(BOOL)flag error:(NSError **)errPtr { __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ @autoreleasepool { if (![self preOp:&err]) { return_from_block; } if ((flags & kDidCreateSockets) == 0) { if (![self createSockets:&err]) { return_from_block; } } if (socket4FD != SOCKET_NULL) { int value = flag ? 1 : 0; int error = setsockopt(socket4FD, SOL_SOCKET, SO_BROADCAST, (const void *)&value, sizeof(value)); if (error) { err = [self errnoErrorWithReason:@"Error in setsockopt() function"]; return_from_block; } result = YES; } // IPv6 does not implement broadcast, the ability to send a packet to all hosts on the attached link. // The same effect can be achieved by sending a packet to the link-local all hosts multicast group. }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (errPtr) *errPtr = err; return result; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Sending //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)sendData:(NSData *)data withTag:(long)tag { [self sendData:data withTimeout:-1.0 tag:tag]; } - (void)sendData:(NSData *)data withTimeout:(NSTimeInterval)timeout tag:(long)tag { LogTrace(); if ([data length] == 0) { LogWarn(@"Ignoring attempt to send nil/empty data."); return; } GCDAsyncUdpSendPacket *packet = [[GCDAsyncUdpSendPacket alloc] initWithData:data timeout:timeout tag:tag]; dispatch_async(socketQueue, ^{ @autoreleasepool { [sendQueue addObject:packet]; [self maybeDequeueSend]; }}); } - (void)sendData:(NSData *)data toHost:(NSString *)host port:(uint16_t)port withTimeout:(NSTimeInterval)timeout tag:(long)tag { LogTrace(); if ([data length] == 0) { LogWarn(@"Ignoring attempt to send nil/empty data."); return; } GCDAsyncUdpSendPacket *packet = [[GCDAsyncUdpSendPacket alloc] initWithData:data timeout:timeout tag:tag]; packet->resolveInProgress = YES; [self asyncResolveHost:host port:port withCompletionBlock:^(NSArray *addresses, NSError *error) { // The asyncResolveHost:port:: method asynchronously dispatches a task onto the global concurrent queue, // and immediately returns. Once the async resolve task completes, // this block is executed on our socketQueue. packet->resolveInProgress = NO; packet->resolvedAddresses = addresses; packet->resolveError = error; if (packet == currentSend) { LogVerbose(@"currentSend - address resolved"); [self doPreSend]; } }]; dispatch_async(socketQueue, ^{ @autoreleasepool { [sendQueue addObject:packet]; [self maybeDequeueSend]; }}); } - (void)sendData:(NSData *)data toAddress:(NSData *)remoteAddr withTimeout:(NSTimeInterval)timeout tag:(long)tag { LogTrace(); if ([data length] == 0) { LogWarn(@"Ignoring attempt to send nil/empty data."); return; } GCDAsyncUdpSendPacket *packet = [[GCDAsyncUdpSendPacket alloc] initWithData:data timeout:timeout tag:tag]; packet->addressFamily = [GCDAsyncUdpSocket familyFromAddress:remoteAddr]; packet->address = remoteAddr; dispatch_async(socketQueue, ^{ @autoreleasepool { [sendQueue addObject:packet]; [self maybeDequeueSend]; }}); } - (void)setSendFilter:(GCDAsyncUdpSocketSendFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue { [self setSendFilter:filterBlock withQueue:filterQueue isAsynchronous:YES]; } - (void)setSendFilter:(GCDAsyncUdpSocketSendFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue isAsynchronous:(BOOL)isAsynchronous { GCDAsyncUdpSocketSendFilterBlock newFilterBlock = NULL; dispatch_queue_t newFilterQueue = NULL; if (filterBlock) { NSAssert(filterQueue, @"Must provide a dispatch_queue in which to run the filter block."); newFilterBlock = [filterBlock copy]; newFilterQueue = filterQueue; #if !OS_OBJECT_USE_OBJC dispatch_retain(newFilterQueue); #endif } dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC if (sendFilterQueue) dispatch_release(sendFilterQueue); #endif sendFilterBlock = newFilterBlock; sendFilterQueue = newFilterQueue; sendFilterAsync = isAsynchronous; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (void)maybeDequeueSend { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); // If we don't have a send operation already in progress if (currentSend == nil) { // Create the sockets if needed if ((flags & kDidCreateSockets) == 0) { NSError *err = nil; if (![self createSockets:&err]) { [self closeWithError:err]; return; } } while ([sendQueue count] > 0) { // Dequeue the next object in the queue currentSend = [sendQueue objectAtIndex:0]; [sendQueue removeObjectAtIndex:0]; if ([currentSend isKindOfClass:[GCDAsyncUdpSpecialPacket class]]) { [self maybeConnect]; return; // The maybeConnect method, if it connects, will invoke this method again } else if (currentSend->resolveError) { // Notify delegate [self notifyDidNotSendDataWithTag:currentSend->tag dueToError:currentSend->resolveError]; // Clear currentSend currentSend = nil; continue; } else { // Start preprocessing checks on the send packet [self doPreSend]; break; } } if ((currentSend == nil) && (flags & kCloseAfterSends)) { [self closeWithError:nil]; } } } /** * This method is called after a sendPacket has been dequeued. * It performs various preprocessing checks on the packet, * and queries the sendFilter (if set) to determine if the packet can be sent. * * If the packet passes all checks, it will be passed on to the doSend method. **/ - (void)doPreSend { LogTrace(); // // 1. Check for problems with send packet // BOOL waitingForResolve = NO; NSError *error = nil; if (flags & kDidConnect) { // Connected socket if (currentSend->resolveInProgress || currentSend->resolvedAddresses || currentSend->resolveError) { NSString *msg = @"Cannot specify destination of packet for connected socket"; error = [self badConfigError:msg]; } else { currentSend->address = cachedConnectedAddress; currentSend->addressFamily = cachedConnectedFamily; } } else { // Non-Connected socket if (currentSend->resolveInProgress) { // We're waiting for the packet's destination to be resolved. waitingForResolve = YES; } else if (currentSend->resolveError) { error = currentSend->resolveError; } else if (currentSend->address == nil) { if (currentSend->resolvedAddresses == nil) { NSString *msg = @"You must specify destination of packet for a non-connected socket"; error = [self badConfigError:msg]; } else { // Pick the proper address to use (out of possibly several resolved addresses) NSData *address = nil; int addressFamily = AF_UNSPEC; addressFamily = [self getAddress:&address error:&error fromAddresses:currentSend->resolvedAddresses]; currentSend->address = address; currentSend->addressFamily = addressFamily; } } } if (waitingForResolve) { // We're waiting for the packet's destination to be resolved. LogVerbose(@"currentSend - waiting for address resolve"); if (flags & kSock4CanAcceptBytes) { [self suspendSend4Source]; } if (flags & kSock6CanAcceptBytes) { [self suspendSend6Source]; } return; } if (error) { // Unable to send packet due to some error. // Notify delegate and move on. [self notifyDidNotSendDataWithTag:currentSend->tag dueToError:error]; [self endCurrentSend]; [self maybeDequeueSend]; return; } // // 2. Query sendFilter (if applicable) // if (sendFilterBlock && sendFilterQueue) { // Query sendFilter if (sendFilterAsync) { // Scenario 1 of 3 - Need to asynchronously query sendFilter currentSend->filterInProgress = YES; GCDAsyncUdpSendPacket *sendPacket = currentSend; dispatch_async(sendFilterQueue, ^{ @autoreleasepool { BOOL allowed = sendFilterBlock(sendPacket->buffer, sendPacket->address, sendPacket->tag); dispatch_async(socketQueue, ^{ @autoreleasepool { sendPacket->filterInProgress = NO; if (sendPacket == currentSend) { if (allowed) { [self doSend]; } else { LogVerbose(@"currentSend - silently dropped by sendFilter"); [self notifyDidSendDataWithTag:currentSend->tag]; [self endCurrentSend]; [self maybeDequeueSend]; } } }}); }}); } else { // Scenario 2 of 3 - Need to synchronously query sendFilter __block BOOL allowed = YES; dispatch_sync(sendFilterQueue, ^{ @autoreleasepool { allowed = sendFilterBlock(currentSend->buffer, currentSend->address, currentSend->tag); }}); if (allowed) { [self doSend]; } else { LogVerbose(@"currentSend - silently dropped by sendFilter"); [self notifyDidSendDataWithTag:currentSend->tag]; [self endCurrentSend]; [self maybeDequeueSend]; } } } else // if (!sendFilterBlock || !sendFilterQueue) { // Scenario 3 of 3 - No sendFilter. Just go straight into sending. [self doSend]; } } /** * This method performs the actual sending of data in the currentSend packet. * It should only be called if the **/ - (void)doSend { LogTrace(); NSAssert(currentSend != nil, @"Invalid logic"); // Perform the actual send ssize_t result = 0; if (flags & kDidConnect) { // Connected socket const void *buffer = [currentSend->buffer bytes]; size_t length = (size_t)[currentSend->buffer length]; if (currentSend->addressFamily == AF_INET) { result = send(socket4FD, buffer, length, 0); LogVerbose(@"send(socket4FD) = %d", result); } else { result = send(socket6FD, buffer, length, 0); LogVerbose(@"send(socket6FD) = %d", result); } } else { // Non-Connected socket const void *buffer = [currentSend->buffer bytes]; size_t length = (size_t)[currentSend->buffer length]; const void *dst = [currentSend->address bytes]; socklen_t dstSize = (socklen_t)[currentSend->address length]; if (currentSend->addressFamily == AF_INET) { result = sendto(socket4FD, buffer, length, 0, dst, dstSize); LogVerbose(@"sendto(socket4FD) = %d", result); } else { result = sendto(socket6FD, buffer, length, 0, dst, dstSize); LogVerbose(@"sendto(socket6FD) = %d", result); } } // If the socket wasn't bound before, it is now if ((flags & kDidBind) == 0) { flags |= kDidBind; } // Check the results. // // From the send() & sendto() manpage: // // Upon successful completion, the number of bytes which were sent is returned. // Otherwise, -1 is returned and the global variable errno is set to indicate the error. BOOL waitingForSocket = NO; NSError *socketError = nil; if (result == 0) { waitingForSocket = YES; } else if (result < 0) { if (errno == EAGAIN) waitingForSocket = YES; else socketError = [self errnoErrorWithReason:@"Error in send() function."]; } if (waitingForSocket) { // Not enough room in the underlying OS socket send buffer. // Wait for a notification of available space. LogVerbose(@"currentSend - waiting for socket"); if (!(flags & kSock4CanAcceptBytes)) { [self resumeSend4Source]; } if (!(flags & kSock6CanAcceptBytes)) { [self resumeSend6Source]; } if ((sendTimer == NULL) && (currentSend->timeout >= 0.0)) { // Unable to send packet right away. // Start timer to timeout the send operation. [self setupSendTimerWithTimeout:currentSend->timeout]; } } else if (socketError) { [self closeWithError:socketError]; } else // done { [self notifyDidSendDataWithTag:currentSend->tag]; [self endCurrentSend]; [self maybeDequeueSend]; } } /** * Releases all resources associated with the currentSend. **/ - (void)endCurrentSend { if (sendTimer) { dispatch_source_cancel(sendTimer); #if !OS_OBJECT_USE_OBJC dispatch_release(sendTimer); #endif sendTimer = NULL; } currentSend = nil; } /** * Performs the operations to timeout the current send operation, and move on. **/ - (void)doSendTimeout { LogTrace(); [self notifyDidNotSendDataWithTag:currentSend->tag dueToError:[self sendTimeoutError]]; [self endCurrentSend]; [self maybeDequeueSend]; } /** * Sets up a timer that fires to timeout the current send operation. * This method should only be called once per send packet. **/ - (void)setupSendTimerWithTimeout:(NSTimeInterval)timeout { NSAssert(sendTimer == NULL, @"Invalid logic"); NSAssert(timeout >= 0.0, @"Invalid logic"); LogTrace(); sendTimer = dispatch_source_create(DISPATCH_SOURCE_TYPE_TIMER, 0, 0, socketQueue); dispatch_source_set_event_handler(sendTimer, ^{ @autoreleasepool { [self doSendTimeout]; }}); dispatch_time_t tt = dispatch_time(DISPATCH_TIME_NOW, (int64_t)(timeout * NSEC_PER_SEC)); dispatch_source_set_timer(sendTimer, tt, DISPATCH_TIME_FOREVER, 0); dispatch_resume(sendTimer); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Receiving //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (BOOL)receiveOnce:(NSError **)errPtr { LogTrace(); __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ if ((flags & kReceiveOnce) == 0) { if ((flags & kDidCreateSockets) == 0) { NSString *msg = @"Must bind socket before you can receive data. " @"You can do this explicitly via bind, or implicitly via connect or by sending data."; err = [self badConfigError:msg]; return_from_block; } flags |= kReceiveOnce; // Enable flags &= ~kReceiveContinuous; // Disable dispatch_async(socketQueue, ^{ @autoreleasepool { [self doReceive]; }}); } result = YES; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (err) LogError(@"Error in beginReceiving: %@", err); if (errPtr) *errPtr = err; return result; } - (BOOL)beginReceiving:(NSError **)errPtr { LogTrace(); __block BOOL result = NO; __block NSError *err = nil; dispatch_block_t block = ^{ if ((flags & kReceiveContinuous) == 0) { if ((flags & kDidCreateSockets) == 0) { NSString *msg = @"Must bind socket before you can receive data. " @"You can do this explicitly via bind, or implicitly via connect or by sending data."; err = [self badConfigError:msg]; return_from_block; } flags |= kReceiveContinuous; // Enable flags &= ~kReceiveOnce; // Disable dispatch_async(socketQueue, ^{ @autoreleasepool { [self doReceive]; }}); } result = YES; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); if (err) LogError(@"Error in beginReceiving: %@", err); if (errPtr) *errPtr = err; return result; } - (void)pauseReceiving { LogTrace(); dispatch_block_t block = ^{ flags &= ~kReceiveOnce; // Disable flags &= ~kReceiveContinuous; // Disable if (socket4FDBytesAvailable > 0) { [self suspendReceive4Source]; } if (socket6FDBytesAvailable > 0) { [self suspendReceive6Source]; } }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (void)setReceiveFilter:(GCDAsyncUdpSocketReceiveFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue { [self setReceiveFilter:filterBlock withQueue:filterQueue isAsynchronous:YES]; } - (void)setReceiveFilter:(GCDAsyncUdpSocketReceiveFilterBlock)filterBlock withQueue:(dispatch_queue_t)filterQueue isAsynchronous:(BOOL)isAsynchronous { GCDAsyncUdpSocketReceiveFilterBlock newFilterBlock = NULL; dispatch_queue_t newFilterQueue = NULL; if (filterBlock) { NSAssert(filterQueue, @"Must provide a dispatch_queue in which to run the filter block."); newFilterBlock = [filterBlock copy]; newFilterQueue = filterQueue; #if !OS_OBJECT_USE_OBJC dispatch_retain(newFilterQueue); #endif } dispatch_block_t block = ^{ #if !OS_OBJECT_USE_OBJC if (receiveFilterQueue) dispatch_release(receiveFilterQueue); #endif receiveFilterBlock = newFilterBlock; receiveFilterQueue = newFilterQueue; receiveFilterAsync = isAsynchronous; }; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } - (void)doReceive { LogTrace(); if ((flags & (kReceiveOnce | kReceiveContinuous)) == 0) { LogVerbose(@"Receiving is paused..."); if (socket4FDBytesAvailable > 0) { [self suspendReceive4Source]; } if (socket6FDBytesAvailable > 0) { [self suspendReceive6Source]; } return; } if ((flags & kReceiveOnce) && (pendingFilterOperations > 0)) { LogVerbose(@"Receiving is temporarily paused (pending filter operations)..."); if (socket4FDBytesAvailable > 0) { [self suspendReceive4Source]; } if (socket6FDBytesAvailable > 0) { [self suspendReceive6Source]; } return; } if ((socket4FDBytesAvailable == 0) && (socket6FDBytesAvailable == 0)) { LogVerbose(@"No data available to receive..."); if (socket4FDBytesAvailable == 0) { [self resumeReceive4Source]; } if (socket6FDBytesAvailable == 0) { [self resumeReceive6Source]; } return; } // Figure out if we should receive on socket4 or socket6 BOOL doReceive4; if (flags & kDidConnect) { // Connected socket doReceive4 = (socket4FD != SOCKET_NULL); } else { // Non-Connected socket if (socket4FDBytesAvailable > 0) { if (socket6FDBytesAvailable > 0) { // Bytes available on socket4 & socket6 doReceive4 = (flags & kFlipFlop) ? YES : NO; flags ^= kFlipFlop; // flags = flags xor kFlipFlop; (toggle flip flop bit) } else { // Bytes available on socket4, but not socket6 doReceive4 = YES; } } else { // Bytes available on socket6, but not socket4 doReceive4 = NO; } } // Perform socket IO ssize_t result = 0; NSData *data = nil; NSData *addr4 = nil; NSData *addr6 = nil; if (doReceive4) { NSAssert(socket4FDBytesAvailable > 0, @"Invalid logic"); LogVerbose(@"Receiving on IPv4"); struct sockaddr_in sockaddr4; socklen_t sockaddr4len = sizeof(sockaddr4); // #222: GCD does not necessarily return the size of an entire UDP packet // from dispatch_source_get_data(), so we must use the maximum packet size. size_t bufSize = max4ReceiveSize; void *buf = malloc(bufSize); result = recvfrom(socket4FD, buf, bufSize, 0, (struct sockaddr *)&sockaddr4, &sockaddr4len); LogVerbose(@"recvfrom(socket4FD) = %i", (int)result); if (result > 0) { if ((size_t)result >= socket4FDBytesAvailable) socket4FDBytesAvailable = 0; else socket4FDBytesAvailable -= result; if ((size_t)result != bufSize) { buf = realloc(buf, result); } data = [NSData dataWithBytesNoCopy:buf length:result freeWhenDone:YES]; addr4 = [NSData dataWithBytes:&sockaddr4 length:sockaddr4len]; } else { LogVerbose(@"recvfrom(socket4FD) = %@", [self errnoError]); socket4FDBytesAvailable = 0; free(buf); } } else { NSAssert(socket6FDBytesAvailable > 0, @"Invalid logic"); LogVerbose(@"Receiving on IPv6"); struct sockaddr_in6 sockaddr6; socklen_t sockaddr6len = sizeof(sockaddr6); // #222: GCD does not necessarily return the size of an entire UDP packet // from dispatch_source_get_data(), so we must use the maximum packet size. size_t bufSize = max6ReceiveSize; void *buf = malloc(bufSize); result = recvfrom(socket6FD, buf, bufSize, 0, (struct sockaddr *)&sockaddr6, &sockaddr6len); LogVerbose(@"recvfrom(socket6FD) -> %i", (int)result); if (result > 0) { if ((size_t)result >= socket6FDBytesAvailable) socket6FDBytesAvailable = 0; else socket6FDBytesAvailable -= result; if ((size_t)result != bufSize) { buf = realloc(buf, result); } data = [NSData dataWithBytesNoCopy:buf length:result freeWhenDone:YES]; addr6 = [NSData dataWithBytes:&sockaddr6 length:sockaddr6len]; } else { LogVerbose(@"recvfrom(socket6FD) = %@", [self errnoError]); socket6FDBytesAvailable = 0; free(buf); } } BOOL waitingForSocket = NO; BOOL notifiedDelegate = NO; BOOL ignored = NO; NSError *socketError = nil; if (result == 0) { waitingForSocket = YES; } else if (result < 0) { if (errno == EAGAIN) waitingForSocket = YES; else socketError = [self errnoErrorWithReason:@"Error in recvfrom() function"]; } else { if (flags & kDidConnect) { if (addr4 && ![self isConnectedToAddress4:addr4]) ignored = YES; if (addr6 && ![self isConnectedToAddress6:addr6]) ignored = YES; } NSData *addr = (addr4 != nil) ? addr4 : addr6; if (!ignored) { if (receiveFilterBlock && receiveFilterQueue) { // Run data through filter, and if approved, notify delegate __block id filterContext = nil; __block BOOL allowed = NO; if (receiveFilterAsync) { pendingFilterOperations++; dispatch_async(receiveFilterQueue, ^{ @autoreleasepool { allowed = receiveFilterBlock(data, addr, &filterContext); // Transition back to socketQueue to get the current delegate / delegateQueue dispatch_async(socketQueue, ^{ @autoreleasepool { pendingFilterOperations--; if (allowed) { [self notifyDidReceiveData:data fromAddress:addr withFilterContext:filterContext]; } else { LogVerbose(@"received packet silently dropped by receiveFilter"); } if (flags & kReceiveOnce) { if (allowed) { // The delegate has been notified, // so our receive once operation has completed. flags &= ~kReceiveOnce; } else if (pendingFilterOperations == 0) { // All pending filter operations have completed, // and none were allowed through. // Our receive once operation hasn't completed yet. [self doReceive]; } } }}); }}); } else // if (!receiveFilterAsync) { dispatch_sync(receiveFilterQueue, ^{ @autoreleasepool { allowed = receiveFilterBlock(data, addr, &filterContext); }}); if (allowed) { [self notifyDidReceiveData:data fromAddress:addr withFilterContext:filterContext]; notifiedDelegate = YES; } else { LogVerbose(@"received packet silently dropped by receiveFilter"); ignored = YES; } } } else // if (!receiveFilterBlock || !receiveFilterQueue) { [self notifyDidReceiveData:data fromAddress:addr withFilterContext:nil]; notifiedDelegate = YES; } } } if (waitingForSocket) { // Wait for a notification of available data. if (socket4FDBytesAvailable == 0) { [self resumeReceive4Source]; } if (socket6FDBytesAvailable == 0) { [self resumeReceive6Source]; } } else if (socketError) { [self closeWithError:socketError]; } else { if (flags & kReceiveContinuous) { // Continuous receive mode [self doReceive]; } else { // One-at-a-time receive mode if (notifiedDelegate) { // The delegate has been notified (no set filter). // So our receive once operation has completed. flags &= ~kReceiveOnce; } else if (ignored) { [self doReceive]; } else { // Waiting on asynchronous receive filter... } } } } - (void)doReceiveEOF { LogTrace(); [self closeWithError:[self socketClosedError]]; } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Closing //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// - (void)closeWithError:(NSError *)error { LogVerbose(@"closeWithError: %@", error); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (currentSend) [self endCurrentSend]; [sendQueue removeAllObjects]; // If a socket has been created, we should notify the delegate. BOOL shouldCallDelegate = (flags & kDidCreateSockets) ? YES : NO; // Close all sockets, send/receive sources, cfstreams, etc #if TARGET_OS_IPHONE [self removeStreamsFromRunLoop]; [self closeReadAndWriteStreams]; #endif [self closeSockets]; // Clear all flags (config remains as is) flags = 0; if (shouldCallDelegate) { [self notifyDidCloseWithError:error]; } } - (void)close { LogTrace(); dispatch_block_t block = ^{ @autoreleasepool { [self closeWithError:nil]; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); } - (void)closeAfterSending { LogTrace(); dispatch_block_t block = ^{ @autoreleasepool { flags |= kCloseAfterSends; if (currentSend == nil && [sendQueue count] == 0) { [self closeWithError:nil]; } }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark CFStream //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #if TARGET_OS_IPHONE static NSThread *listenerThread; + (void)ignore:(id)_ {} + (void)startListenerThreadIfNeeded { static dispatch_once_t predicate; dispatch_once(&predicate, ^{ listenerThread = [[NSThread alloc] initWithTarget:self selector:@selector(listenerThread) object:nil]; [listenerThread start]; }); } + (void)listenerThread { @autoreleasepool { [[NSThread currentThread] setName:GCDAsyncUdpSocketThreadName]; LogInfo(@"ListenerThread: Started"); // We can't run the run loop unless it has an associated input source or a timer. // So we'll just create a timer that will never fire - unless the server runs for a decades. [NSTimer scheduledTimerWithTimeInterval:[[NSDate distantFuture] timeIntervalSinceNow] target:self selector:@selector(ignore:) userInfo:nil repeats:YES]; [[NSRunLoop currentRunLoop] run]; LogInfo(@"ListenerThread: Stopped"); } } + (void)addStreamListener:(GCDAsyncUdpSocket *)asyncUdpSocket { LogTrace(); NSAssert([NSThread currentThread] == listenerThread, @"Invoked on wrong thread"); CFRunLoopRef runLoop = CFRunLoopGetCurrent(); if (asyncUdpSocket->readStream4) CFReadStreamScheduleWithRunLoop(asyncUdpSocket->readStream4, runLoop, kCFRunLoopDefaultMode); if (asyncUdpSocket->readStream6) CFReadStreamScheduleWithRunLoop(asyncUdpSocket->readStream6, runLoop, kCFRunLoopDefaultMode); if (asyncUdpSocket->writeStream4) CFWriteStreamScheduleWithRunLoop(asyncUdpSocket->writeStream4, runLoop, kCFRunLoopDefaultMode); if (asyncUdpSocket->writeStream6) CFWriteStreamScheduleWithRunLoop(asyncUdpSocket->writeStream6, runLoop, kCFRunLoopDefaultMode); } + (void)removeStreamListener:(GCDAsyncUdpSocket *)asyncUdpSocket { LogTrace(); NSAssert([NSThread currentThread] == listenerThread, @"Invoked on wrong thread"); CFRunLoopRef runLoop = CFRunLoopGetCurrent(); if (asyncUdpSocket->readStream4) CFReadStreamUnscheduleFromRunLoop(asyncUdpSocket->readStream4, runLoop, kCFRunLoopDefaultMode); if (asyncUdpSocket->readStream6) CFReadStreamUnscheduleFromRunLoop(asyncUdpSocket->readStream6, runLoop, kCFRunLoopDefaultMode); if (asyncUdpSocket->writeStream4) CFWriteStreamUnscheduleFromRunLoop(asyncUdpSocket->writeStream4, runLoop, kCFRunLoopDefaultMode); if (asyncUdpSocket->writeStream6) CFWriteStreamUnscheduleFromRunLoop(asyncUdpSocket->writeStream6, runLoop, kCFRunLoopDefaultMode); } static void CFReadStreamCallback(CFReadStreamRef stream, CFStreamEventType type, void *pInfo) { @autoreleasepool { GCDAsyncUdpSocket *asyncUdpSocket = (__bridge GCDAsyncUdpSocket *)pInfo; switch(type) { case kCFStreamEventOpenCompleted: { LogCVerbose(@"CFReadStreamCallback - Open"); break; } case kCFStreamEventHasBytesAvailable: { LogCVerbose(@"CFReadStreamCallback - HasBytesAvailable"); break; } case kCFStreamEventErrorOccurred: case kCFStreamEventEndEncountered: { NSError *error = (__bridge_transfer NSError *)CFReadStreamCopyError(stream); if (error == nil && type == kCFStreamEventEndEncountered) { error = [asyncUdpSocket socketClosedError]; } dispatch_async(asyncUdpSocket->socketQueue, ^{ @autoreleasepool { LogCVerbose(@"CFReadStreamCallback - %@", (type == kCFStreamEventErrorOccurred) ? @"Error" : @"EndEncountered"); if (stream != asyncUdpSocket->readStream4 && stream != asyncUdpSocket->readStream6 ) { LogCVerbose(@"CFReadStreamCallback - Ignored"); return_from_block; } [asyncUdpSocket closeWithError:error]; }}); break; } default: { LogCError(@"CFReadStreamCallback - UnknownType: %i", (int)type); } } } } static void CFWriteStreamCallback(CFWriteStreamRef stream, CFStreamEventType type, void *pInfo) { @autoreleasepool { GCDAsyncUdpSocket *asyncUdpSocket = (__bridge GCDAsyncUdpSocket *)pInfo; switch(type) { case kCFStreamEventOpenCompleted: { LogCVerbose(@"CFWriteStreamCallback - Open"); break; } case kCFStreamEventCanAcceptBytes: { LogCVerbose(@"CFWriteStreamCallback - CanAcceptBytes"); break; } case kCFStreamEventErrorOccurred: case kCFStreamEventEndEncountered: { NSError *error = (__bridge_transfer NSError *)CFWriteStreamCopyError(stream); if (error == nil && type == kCFStreamEventEndEncountered) { error = [asyncUdpSocket socketClosedError]; } dispatch_async(asyncUdpSocket->socketQueue, ^{ @autoreleasepool { LogCVerbose(@"CFWriteStreamCallback - %@", (type == kCFStreamEventErrorOccurred) ? @"Error" : @"EndEncountered"); if (stream != asyncUdpSocket->writeStream4 && stream != asyncUdpSocket->writeStream6 ) { LogCVerbose(@"CFWriteStreamCallback - Ignored"); return_from_block; } [asyncUdpSocket closeWithError:error]; }}); break; } default: { LogCError(@"CFWriteStreamCallback - UnknownType: %i", (int)type); } } } } - (BOOL)createReadAndWriteStreams:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSError *err = nil; if (readStream4 || writeStream4 || readStream6 || writeStream6) { // Streams already created return YES; } if (socket4FD == SOCKET_NULL && socket6FD == SOCKET_NULL) { err = [self otherError:@"Cannot create streams without a file descriptor"]; goto Failed; } // Create streams LogVerbose(@"Creating read and write stream(s)..."); if (socket4FD != SOCKET_NULL) { CFStreamCreatePairWithSocket(NULL, (CFSocketNativeHandle)socket4FD, &readStream4, &writeStream4); if (!readStream4 || !writeStream4) { err = [self otherError:@"Error in CFStreamCreatePairWithSocket() [IPv4]"]; goto Failed; } } if (socket6FD != SOCKET_NULL) { CFStreamCreatePairWithSocket(NULL, (CFSocketNativeHandle)socket6FD, &readStream6, &writeStream6); if (!readStream6 || !writeStream6) { err = [self otherError:@"Error in CFStreamCreatePairWithSocket() [IPv6]"]; goto Failed; } } // Ensure the CFStream's don't close our underlying socket CFReadStreamSetProperty(readStream4, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); CFWriteStreamSetProperty(writeStream4, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); CFReadStreamSetProperty(readStream6, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); CFWriteStreamSetProperty(writeStream6, kCFStreamPropertyShouldCloseNativeSocket, kCFBooleanFalse); return YES; Failed: if (readStream4) { CFReadStreamClose(readStream4); CFRelease(readStream4); readStream4 = NULL; } if (writeStream4) { CFWriteStreamClose(writeStream4); CFRelease(writeStream4); writeStream4 = NULL; } if (readStream6) { CFReadStreamClose(readStream6); CFRelease(readStream6); readStream6 = NULL; } if (writeStream6) { CFWriteStreamClose(writeStream6); CFRelease(writeStream6); writeStream6 = NULL; } if (errPtr) *errPtr = err; return NO; } - (BOOL)registerForStreamCallbacks:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(readStream4 || writeStream4 || readStream6 || writeStream6, @"Read/Write streams are null"); NSError *err = nil; streamContext.version = 0; streamContext.info = (__bridge void *)self; streamContext.retain = nil; streamContext.release = nil; streamContext.copyDescription = nil; CFOptionFlags readStreamEvents = kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered; CFOptionFlags writeStreamEvents = kCFStreamEventErrorOccurred | kCFStreamEventEndEncountered; // readStreamEvents |= (kCFStreamEventOpenCompleted | kCFStreamEventHasBytesAvailable); // writeStreamEvents |= (kCFStreamEventOpenCompleted | kCFStreamEventCanAcceptBytes); if (socket4FD != SOCKET_NULL) { if (readStream4 == NULL || writeStream4 == NULL) { err = [self otherError:@"Read/Write stream4 is null"]; goto Failed; } BOOL r1 = CFReadStreamSetClient(readStream4, readStreamEvents, &CFReadStreamCallback, &streamContext); BOOL r2 = CFWriteStreamSetClient(writeStream4, writeStreamEvents, &CFWriteStreamCallback, &streamContext); if (!r1 || !r2) { err = [self otherError:@"Error in CFStreamSetClient(), [IPv4]"]; goto Failed; } } if (socket6FD != SOCKET_NULL) { if (readStream6 == NULL || writeStream6 == NULL) { err = [self otherError:@"Read/Write stream6 is null"]; goto Failed; } BOOL r1 = CFReadStreamSetClient(readStream6, readStreamEvents, &CFReadStreamCallback, &streamContext); BOOL r2 = CFWriteStreamSetClient(writeStream6, writeStreamEvents, &CFWriteStreamCallback, &streamContext); if (!r1 || !r2) { err = [self otherError:@"Error in CFStreamSetClient() [IPv6]"]; goto Failed; } } return YES; Failed: if (readStream4) { CFReadStreamSetClient(readStream4, kCFStreamEventNone, NULL, NULL); } if (writeStream4) { CFWriteStreamSetClient(writeStream4, kCFStreamEventNone, NULL, NULL); } if (readStream6) { CFReadStreamSetClient(readStream6, kCFStreamEventNone, NULL, NULL); } if (writeStream6) { CFWriteStreamSetClient(writeStream6, kCFStreamEventNone, NULL, NULL); } if (errPtr) *errPtr = err; return NO; } - (BOOL)addStreamsToRunLoop:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(readStream4 || writeStream4 || readStream6 || writeStream6, @"Read/Write streams are null"); if (!(flags & kAddedStreamListener)) { [[self class] startListenerThreadIfNeeded]; [[self class] performSelector:@selector(addStreamListener:) onThread:listenerThread withObject:self waitUntilDone:YES]; flags |= kAddedStreamListener; } return YES; } - (BOOL)openStreams:(NSError **)errPtr { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); NSAssert(readStream4 || writeStream4 || readStream6 || writeStream6, @"Read/Write streams are null"); NSError *err = nil; if (socket4FD != SOCKET_NULL) { BOOL r1 = CFReadStreamOpen(readStream4); BOOL r2 = CFWriteStreamOpen(writeStream4); if (!r1 || !r2) { err = [self otherError:@"Error in CFStreamOpen() [IPv4]"]; goto Failed; } } if (socket6FD != SOCKET_NULL) { BOOL r1 = CFReadStreamOpen(readStream6); BOOL r2 = CFWriteStreamOpen(writeStream6); if (!r1 || !r2) { err = [self otherError:@"Error in CFStreamOpen() [IPv6]"]; goto Failed; } } return YES; Failed: if (errPtr) *errPtr = err; return NO; } - (void)removeStreamsFromRunLoop { LogTrace(); NSAssert(dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey), @"Must be dispatched on socketQueue"); if (flags & kAddedStreamListener) { [[self class] performSelector:@selector(removeStreamListener:) onThread:listenerThread withObject:self waitUntilDone:YES]; flags &= ~kAddedStreamListener; } } - (void)closeReadAndWriteStreams { LogTrace(); if (readStream4) { CFReadStreamSetClient(readStream4, kCFStreamEventNone, NULL, NULL); CFReadStreamClose(readStream4); CFRelease(readStream4); readStream4 = NULL; } if (writeStream4) { CFWriteStreamSetClient(writeStream4, kCFStreamEventNone, NULL, NULL); CFWriteStreamClose(writeStream4); CFRelease(writeStream4); writeStream4 = NULL; } if (readStream6) { CFReadStreamSetClient(readStream6, kCFStreamEventNone, NULL, NULL); CFReadStreamClose(readStream6); CFRelease(readStream6); readStream6 = NULL; } if (writeStream6) { CFWriteStreamSetClient(writeStream6, kCFStreamEventNone, NULL, NULL); CFWriteStreamClose(writeStream6); CFRelease(writeStream6); writeStream6 = NULL; } } #endif - (void)applicationWillEnterForeground:(NSNotification *)notification { LogTrace(); // If the application was backgrounded, then iOS may have shut down our sockets. // So we take a quick look to see if any of them received an EOF. dispatch_block_t block = ^{ @autoreleasepool { [self resumeReceive4Source]; [self resumeReceive6Source]; }}; if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_async(socketQueue, block); } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Advanced //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// /** * See header file for big discussion of this method. **/ - (void)markSocketQueueTargetQueue:(dispatch_queue_t)socketNewTargetQueue { void *nonNullUnusedPointer = (__bridge void *)self; dispatch_queue_set_specific(socketNewTargetQueue, IsOnSocketQueueOrTargetQueueKey, nonNullUnusedPointer, NULL); } /** * See header file for big discussion of this method. **/ - (void)unmarkSocketQueueTargetQueue:(dispatch_queue_t)socketOldTargetQueue { dispatch_queue_set_specific(socketOldTargetQueue, IsOnSocketQueueOrTargetQueueKey, NULL, NULL); } - (void)performBlock:(dispatch_block_t)block { if (dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) block(); else dispatch_sync(socketQueue, block); } - (int)socketFD { if (! dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@: %@ - Method only available from within the context of a performBlock: invocation", THIS_FILE, THIS_METHOD); return SOCKET_NULL; } if (socket4FD != SOCKET_NULL) return socket4FD; else return socket6FD; } - (int)socket4FD { if (! dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@: %@ - Method only available from within the context of a performBlock: invocation", THIS_FILE, THIS_METHOD); return SOCKET_NULL; } return socket4FD; } - (int)socket6FD { if (! dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@: %@ - Method only available from within the context of a performBlock: invocation", THIS_FILE, THIS_METHOD); return SOCKET_NULL; } return socket6FD; } #if TARGET_OS_IPHONE - (CFReadStreamRef)readStream { if (! dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@: %@ - Method only available from within the context of a performBlock: invocation", THIS_FILE, THIS_METHOD); return NULL; } NSError *err = nil; if (![self createReadAndWriteStreams:&err]) { LogError(@"Error creating CFStream(s): %@", err); return NULL; } // Todo... if (readStream4) return readStream4; else return readStream6; } - (CFWriteStreamRef)writeStream { if (! dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@: %@ - Method only available from within the context of a performBlock: invocation", THIS_FILE, THIS_METHOD); return NULL; } NSError *err = nil; if (![self createReadAndWriteStreams:&err]) { LogError(@"Error creating CFStream(s): %@", err); return NULL; } if (writeStream4) return writeStream4; else return writeStream6; } - (BOOL)enableBackgroundingOnSockets { if (! dispatch_get_specific(IsOnSocketQueueOrTargetQueueKey)) { LogWarn(@"%@: %@ - Method only available from within the context of a performBlock: invocation", THIS_FILE, THIS_METHOD); return NO; } // Why is this commented out? // See comments below. // NSError *err = nil; // if (![self createReadAndWriteStreams:&err]) // { // LogError(@"Error creating CFStream(s): %@", err); // return NO; // } // // LogVerbose(@"Enabling backgrouding on socket"); // // BOOL r1, r2; // // if (readStream4 && writeStream4) // { // r1 = CFReadStreamSetProperty(readStream4, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); // r2 = CFWriteStreamSetProperty(writeStream4, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); // // if (!r1 || !r2) // { // LogError(@"Error setting voip type (IPv4)"); // return NO; // } // } // // if (readStream6 && writeStream6) // { // r1 = CFReadStreamSetProperty(readStream6, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); // r2 = CFWriteStreamSetProperty(writeStream6, kCFStreamNetworkServiceType, kCFStreamNetworkServiceTypeVoIP); // // if (!r1 || !r2) // { // LogError(@"Error setting voip type (IPv6)"); // return NO; // } // } // // return YES; // The above code will actually appear to work. // The methods will return YES, and everything will appear fine. // // One tiny problem: the sockets will still get closed when the app gets backgrounded. // // Apple does not officially support backgrounding UDP sockets. return NO; } #endif //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// #pragma mark Class Methods //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// + (NSString *)hostFromSockaddr4:(const struct sockaddr_in *)pSockaddr4 { char addrBuf[INET_ADDRSTRLEN]; if (inet_ntop(AF_INET, &pSockaddr4->sin_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) { addrBuf[0] = '\0'; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } + (NSString *)hostFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6 { char addrBuf[INET6_ADDRSTRLEN]; if (inet_ntop(AF_INET6, &pSockaddr6->sin6_addr, addrBuf, (socklen_t)sizeof(addrBuf)) == NULL) { addrBuf[0] = '\0'; } return [NSString stringWithCString:addrBuf encoding:NSASCIIStringEncoding]; } + (uint16_t)portFromSockaddr4:(const struct sockaddr_in *)pSockaddr4 { return ntohs(pSockaddr4->sin_port); } + (uint16_t)portFromSockaddr6:(const struct sockaddr_in6 *)pSockaddr6 { return ntohs(pSockaddr6->sin6_port); } + (NSString *)hostFromAddress:(NSData *)address { NSString *host = nil; [self getHost:&host port:NULL family:NULL fromAddress:address]; return host; } + (uint16_t)portFromAddress:(NSData *)address { uint16_t port = 0; [self getHost:NULL port:&port family:NULL fromAddress:address]; return port; } + (int)familyFromAddress:(NSData *)address { int af = AF_UNSPEC; [self getHost:NULL port:NULL family:&af fromAddress:address]; return af; } + (BOOL)isIPv4Address:(NSData *)address { int af = AF_UNSPEC; [self getHost:NULL port:NULL family:&af fromAddress:address]; return (af == AF_INET); } + (BOOL)isIPv6Address:(NSData *)address { int af = AF_UNSPEC; [self getHost:NULL port:NULL family:&af fromAddress:address]; return (af == AF_INET6); } + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr fromAddress:(NSData *)address { return [self getHost:hostPtr port:portPtr family:NULL fromAddress:address]; } + (BOOL)getHost:(NSString **)hostPtr port:(uint16_t *)portPtr family:(int *)afPtr fromAddress:(NSData *)address { if ([address length] >= sizeof(struct sockaddr)) { const struct sockaddr *addrX = (const struct sockaddr *)[address bytes]; if (addrX->sa_family == AF_INET) { if ([address length] >= sizeof(struct sockaddr_in)) { const struct sockaddr_in *addr4 = (const struct sockaddr_in *)addrX; if (hostPtr) *hostPtr = [self hostFromSockaddr4:addr4]; if (portPtr) *portPtr = [self portFromSockaddr4:addr4]; if (afPtr) *afPtr = AF_INET; return YES; } } else if (addrX->sa_family == AF_INET6) { if ([address length] >= sizeof(struct sockaddr_in6)) { const struct sockaddr_in6 *addr6 = (const struct sockaddr_in6 *)addrX; if (hostPtr) *hostPtr = [self hostFromSockaddr6:addr6]; if (portPtr) *portPtr = [self portFromSockaddr6:addr6]; if (afPtr) *afPtr = AF_INET6; return YES; } } } if (hostPtr) *hostPtr = nil; if (portPtr) *portPtr = 0; if (afPtr) *afPtr = AF_UNSPEC; return NO; } @end ================================================ FILE: GCDAsyncSocket/Info.plist ================================================ CFBundleDevelopmentRegion en CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName $(PRODUCT_NAME) CFBundlePackageType APPL CFBundleShortVersionString 1.0 CFBundleSignature ???? CFBundleVersion 1 LSRequiresIPhoneOS UILaunchStoryboardName LaunchScreen UIMainStoryboardFile Main UIRequiredDeviceCapabilities armv7 UISupportedInterfaceOrientations UIInterfaceOrientationPortrait ================================================ FILE: GCDAsyncSocket/NetWorkManager.h ================================================ // // NetWorkManager.h // GCDAsyncSocket // // Created by caokun on 16/7/6. // Copyright © 2016年 caokun. All rights reserved. // #import #define NetWorkDidChangeNotification @"NetWorkDidChangeNotification" // 网络状态变化通知 // 网络状态管理 @interface NetWorkManager : NSObject + (NetWorkManager *)instance; - (void)startListen; - (void)stopListen; - (BOOL)status; @end ================================================ FILE: GCDAsyncSocket/NetWorkManager.m ================================================ // // NetWorkManager.m // GCDAsyncSocket // // Created by caokun on 16/7/6. // Copyright © 2016年 caokun. All rights reserved. // #import "NetWorkManager.h" #import "AFNetworkReachabilityManager.h" @implementation NetWorkManager static NetWorkManager *instance = nil; + (NetWorkManager *)instance { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [[NetWorkManager alloc] init]; }); return instance; } - (instancetype)init { if (self = [super init]) { // 网络状态监听 [[AFNetworkReachabilityManager sharedManager] setReachabilityStatusChangeBlock:^(AFNetworkReachabilityStatus status) { if (status == AFNetworkReachabilityStatusReachableViaWWAN || status == AFNetworkReachabilityStatusReachableViaWiFi) { NSLog(@"有网络"); [[NSNotificationCenter defaultCenter] postNotificationName:NetWorkDidChangeNotification object:nil userInfo:@{@"status": [NSNumber numberWithBool:true]}]; } else { NSLog(@"无网络"); [[NSNotificationCenter defaultCenter] postNotificationName:NetWorkDidChangeNotification object:nil userInfo:@{@"status": [NSNumber numberWithBool:false]}]; } }]; } return self; } - (void)startListen { [[AFNetworkReachabilityManager sharedManager] startMonitoring]; } - (void)stopListen { [[AFNetworkReachabilityManager sharedManager] stopMonitoring]; } - (BOOL)status { AFNetworkReachabilityStatus status = [AFNetworkReachabilityManager sharedManager].networkReachabilityStatus; if (status == AFNetworkReachabilityStatusReachableViaWWAN || status == AFNetworkReachabilityStatusReachableViaWiFi) { return true; } return false; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/AbstractMessage.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "Message.h" /** * A partial implementation of the {@link Message} interface which implements * as many methods of that interface as possible in terms of other methods. * * @author Cyrus Najmabadi */ @interface PBAbstractMessage : NSObject { @private } /** * Writes a string description of the message into the given mutable string * respecting a given indent. */ - (void)writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent; - (void) storeInDictionary: (NSMutableDictionary *) dic; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/AbstractMessage.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "AbstractMessage.h" #import "CodedOutputStream.h" @implementation PBAbstractMessage - (instancetype) init { if ((self = [super init])) { } return self; } - (NSData*) data { NSMutableData* data = [NSMutableData dataWithLength:self.serializedSize]; PBCodedOutputStream* stream = [PBCodedOutputStream streamWithData:data]; [self writeToCodedOutputStream:stream]; return data; } - (BOOL) isInitialized { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (SInt32) serializedSize { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (void) writeToOutputStream:(NSOutputStream*) output { PBCodedOutputStream* codedOutput = [PBCodedOutputStream streamWithOutputStream:output]; [self writeToCodedOutputStream:codedOutput]; [codedOutput flush]; } - (instancetype) defaultInstance { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (PBUnknownFieldSet*) unknownFields { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) builder { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) toBuilder { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (NSString*) description { NSMutableString* output = [NSMutableString string]; [self writeDescriptionTo:output withIndent:@""]; return output; } - (void) storeInDictionary: (NSMutableDictionary *) dic { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (NSDictionary *) dictionaryRepresentation { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/AbstractMessageBuilder.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "MessageBuilder.h" /** * A partial implementation of the {@link Message.Builder} interface which * implements as many methods of that interface as possible in terms of * other methods. */ @interface PBAbstractMessageBuilder : NSObject { } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/AbstractMessageBuilder.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "AbstractMessageBuilder.h" #import "CodedInputStream.h" #import "ExtensionRegistry.h" #import "MessageBuilder.h" #import "UnknownFieldSet.h" #import "UnknownFieldSetBuilder.h" @implementation PBAbstractMessageBuilder - (id) clone { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) clear { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (id) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) mergeUnknownFields:(PBUnknownFieldSet*) unknownFields { PBUnknownFieldSet* merged = [[[PBUnknownFieldSet builderWithUnknownFields:self.unknownFields] mergeUnknownFields:unknownFields] build]; [self setUnknownFields:merged]; return self; } - (id) mergeFromData:(NSData*) data { PBCodedInputStream* input = [PBCodedInputStream streamWithData:data]; [self mergeFromCodedInputStream:input]; [input checkLastTagWas:0]; return self; } - (id) mergeFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBCodedInputStream* input = [PBCodedInputStream streamWithData:data]; [self mergeFromCodedInputStream:input extensionRegistry:extensionRegistry]; [input checkLastTagWas:0]; return self; } - (id) mergeFromInputStream:(NSInputStream*) input { PBCodedInputStream* codedInput = [PBCodedInputStream streamWithInputStream:input]; [self mergeFromCodedInputStream:codedInput]; [codedInput checkLastTagWas:0]; return self; } - (id) mergeFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBCodedInputStream* codedInput = [PBCodedInputStream streamWithInputStream:input]; [self mergeFromCodedInputStream:codedInput extensionRegistry:extensionRegistry]; [codedInput checkLastTagWas:0]; return self; } - (id) build { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) buildPartial { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (BOOL) isInitialized { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (instancetype) defaultInstance { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (PBUnknownFieldSet*) unknownFields { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (id) setUnknownFields:(PBUnknownFieldSet*) unknownFields { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Bootstrap.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import #import "ForwardDeclarations.h" #import "CodedInputStream.h" #import "CodedOutputStream.h" #import "ExtendableMessage.h" #import "ExtendableMessageBuilder.h" #import "ExtensionRegistry.h" #import "GeneratedMessage.h" #import "GeneratedMessageBuilder.h" #import "MessageBuilder.h" #import "UnknownFieldSet.h" #import "UnknownFieldSetBuilder.h" #import "Utilities.h" ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/CodedInputStream.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import @class PBExtensionRegistry; @class PBUnknownFieldSetBuilder; @protocol PBMessageBuilder; /** * Reads and decodes protocol message fields. * * This class contains two kinds of methods: methods that read specific * protocol message constructs and field types (e.g. {@link #readTag()} and * {@link #readInt32()}) and methods that read low-level values (e.g. * {@link #readRawVarint32()} and {@link #readRawBytes}). If you are reading * encoded protocol messages, you should use the former methods, but if you are * reading some other format of your own design, use the latter. * * @author Cyrus Najmabadi */ @interface PBCodedInputStream : NSObject { @private NSMutableData* buffer; SInt32 bufferSize; SInt32 bufferSizeAfterLimit; SInt32 bufferPos; NSInputStream* input; SInt32 lastTag; /** * The total number of bytes read before the current buffer. The total * bytes read up to the current position can be computed as * {@code totalBytesRetired + bufferPos}. */ SInt32 totalBytesRetired; /** The absolute position of the end of the current message. */ SInt32 currentLimit; /** See setRecursionLimit() */ SInt32 recursionDepth; SInt32 recursionLimit; /** See setSizeLimit() */ SInt32 sizeLimit; } + (PBCodedInputStream*) streamWithData:(NSData*) data; + (PBCodedInputStream*) streamWithInputStream:(NSInputStream*) input; /** * Attempt to read a field tag, returning zero if we have reached EOF. * Protocol message parsers use this to read tags, since a protocol message * may legally end wherever a tag occurs, and zero is not a valid tag number. */ - (SInt32) readTag; - (BOOL) refillBuffer:(BOOL) mustSucceed; - (Float64) readDouble; - (Float32) readFloat; - (SInt64) readUInt64; - (SInt32) readUInt32; - (SInt64) readInt64; - (SInt32) readInt32; - (SInt64) readFixed64; - (SInt32) readFixed32; - (SInt32) readEnum; - (SInt32) readSFixed32; - (SInt64) readSFixed64; - (SInt32) readSInt32; - (SInt64) readSInt64; /** * Read one byte from the input. * * @throws InvalidProtocolBuffer The end of the stream or the current * limit was reached. */ - (int8_t) readRawByte; /** * Read a raw Varint from the stream. If larger than 32 bits, discard the * upper bits. */ - (SInt32) readRawVarint32; - (SInt64) readRawVarint64; - (SInt32) readRawLittleEndian32; - (SInt64) readRawLittleEndian64; /** * Read a fixed size of bytes from the input. * * @throws InvalidProtocolBuffer The end of the stream or the current * limit was reached. */ - (NSData*) readRawData:(SInt32) size; /** * Reads and discards a single field, given its tag value. * * @return {@code false} if the tag is an endgroup tag, in which case * nothing is skipped. Otherwise, returns {@code true}. */ - (BOOL) skipField:(SInt32) tag; /** * Reads and discards {@code size} bytes. * * @throws InvalidProtocolBuffer The end of the stream or the current * limit was reached. */ - (void) skipRawData:(SInt32) size; /** * Reads and discards an entire message. This will read either until EOF * or until an endgroup tag, whichever comes first. */ - (void) skipMessage; - (BOOL) isAtEnd; - (SInt32) pushLimit:(SInt32) byteLimit; - (void) recomputeBufferSizeAfterLimit; - (void) popLimit:(SInt32) oldLimit; - (SInt32) bytesUntilLimit; /** Read an embedded message field value from the stream. */ - (void) readMessage:(id) builder extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) readBool; - (NSString*) readString; - (NSData*) readData; - (void) readGroup:(SInt32) fieldNumber builder:(id) builder extensionRegistry:(PBExtensionRegistry*) extensionRegistry; /** * Reads a {@code group} field value from the stream and merges it into the * given {@link UnknownFieldSet}. */ - (void) readUnknownGroup:(SInt32) fieldNumber builder:(PBUnknownFieldSetBuilder*) builder; /** * Verifies that the last call to readTag() returned the given tag value. * This is used to verify that a nested group ended with the correct * end tag. * * @throws InvalidProtocolBuffer {@code value} does not match the * last tag. */ - (void) checkLastTagWas:(SInt32) value; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/CodedInputStream.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "CodedInputStream.h" #import "MessageBuilder.h" #import "Utilities.h" #import "WireFormat.h" #import "UnknownFieldSetBuilder.h" #import "UnknownFieldSet.h" @interface PBCodedInputStream () @property (strong) NSMutableData* buffer; @property (strong) NSInputStream* input; @end @implementation PBCodedInputStream const SInt32 DEFAULT_RECURSION_LIMIT = 64; const SInt32 DEFAULT_SIZE_LIMIT = 64 << 20; // 64MB const SInt32 BUFFER_SIZE = 4096; @synthesize buffer; @synthesize input; - (void) commonInit { currentLimit = INT_MAX; recursionLimit = DEFAULT_RECURSION_LIMIT; sizeLimit = DEFAULT_SIZE_LIMIT; } - (instancetype) initWithData:(NSData*) data { if ((self = [super init])) { self.buffer = [NSMutableData dataWithData:data]; bufferSize = (UInt32)buffer.length; self.input = nil; [self commonInit]; } return self; } - (instancetype) initWithInputStream:(NSInputStream*) input_ { if ((self = [super init])) { self.buffer = [NSMutableData dataWithLength:BUFFER_SIZE]; bufferSize = 0; self.input = input_; [input open]; [self commonInit]; } return self; } + (PBCodedInputStream*) streamWithData:(NSData*) data { return [[PBCodedInputStream alloc] initWithData:data]; } + (PBCodedInputStream*) streamWithInputStream:(NSInputStream*) input { return [[PBCodedInputStream alloc] initWithInputStream:input]; } /** * Attempt to read a field tag, returning zero if we have reached EOF. * Protocol message parsers use this to read tags, since a protocol message * may legally end wherever a tag occurs, and zero is not a valid tag number. */ - (SInt32) readTag { if (self.isAtEnd) { lastTag = 0; return 0; } lastTag = [self readRawVarint32]; if (lastTag == 0) { // If we actually read zero, that's not a valid tag. @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"Invalid Tag" userInfo:nil]; } return lastTag; } /** * Verifies that the last call to readTag() returned the given tag value. * This is used to verify that a nested group ended with the correct * end tag. * * @throws InvalidProtocolBufferException {@code value} does not match the * last tag. */ - (void) checkLastTagWas:(SInt32) value { if (lastTag != value) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"Invalid End Tag" userInfo:nil]; } } /** * Reads and discards a single field, given its tag value. * * @return {@code NO} if the tag is an endgroup tag, in which case * nothing is skipped. Otherwise, returns {@code YES}. */ - (BOOL) skipField:(SInt32) tag { switch (PBWireFormatGetTagWireType(tag)) { case PBWireFormatVarint: [self readInt32]; return YES; case PBWireFormatFixed64: [self readRawLittleEndian64]; return YES; case PBWireFormatLengthDelimited: [self skipRawData:[self readRawVarint32]]; return YES; case PBWireFormatStartGroup: [self skipMessage]; [self checkLastTagWas: PBWireFormatMakeTag(PBWireFormatGetTagFieldNumber(tag), PBWireFormatEndGroup)]; return YES; case PBWireFormatEndGroup: return NO; case PBWireFormatFixed32: [self readRawLittleEndian32]; return YES; default: @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"Invalid Wire Type" userInfo:nil]; } } /** * Reads and discards an entire message. This will read either until EOF * or until an endgroup tag, whichever comes first. */ - (void) skipMessage { while (YES) { SInt32 tag = [self readTag]; if (tag == 0 || ![self skipField:tag]) { return; } } } /** Read a {@code double} field value from the stream. */ - (Float64) readDouble { return convertInt64ToFloat64([self readRawLittleEndian64]); } /** Read a {@code float} field value from the stream. */ - (Float32) readFloat { return convertInt32ToFloat32([self readRawLittleEndian32]); } /** Read a {@code uint64} field value from the stream. */ - (SInt64) readUInt64 { return [self readRawVarint64]; } /** Read an {@code int64} field value from the stream. */ - (SInt64) readInt64 { return [self readRawVarint64]; } /** Read an {@code int32} field value from the stream. */ - (SInt32) readInt32 { return [self readRawVarint32]; } /** Read a {@code fixed64} field value from the stream. */ - (SInt64) readFixed64 { return [self readRawLittleEndian64]; } /** Read a {@code fixed32} field value from the stream. */ - (SInt32) readFixed32 { return [self readRawLittleEndian32]; } /** Read a {@code bool} field value from the stream. */ - (BOOL) readBool { return [self readRawVarint32] != 0; } /** Read a {@code string} field value from the stream. */ - (NSString*) readString { SInt32 size = [self readRawVarint32]; if (size <= (bufferSize - bufferPos) && size > 0) { // Fast path: We already have the bytes in a contiguous buffer, so // just copy directly from it. // new String(buffer, bufferPos, size, "UTF-8"); NSString* result = [[NSString alloc] initWithBytes:(((uint8_t*) buffer.bytes) + bufferPos) length:size encoding:NSUTF8StringEncoding]; bufferPos += size; return result; } else { // Slow path: Build a byte array first then copy it. NSData* data = [self readRawData:size]; return [[NSString alloc] initWithData:data encoding:NSUTF8StringEncoding]; } } /** Read a {@code group} field value from the stream. */ - (void) readGroup:(SInt32) fieldNumber builder:(id) builder extensionRegistry:(PBExtensionRegistry*) extensionRegistry { if (recursionDepth >= recursionLimit) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"Recursion Limit Exceeded" userInfo:nil]; } ++recursionDepth; [builder mergeFromCodedInputStream:self extensionRegistry:extensionRegistry]; [self checkLastTagWas:PBWireFormatMakeTag(fieldNumber, PBWireFormatEndGroup)]; --recursionDepth; } /** * Reads a {@code group} field value from the stream and merges it into the * given {@link PBUnknownFieldSet}. */ - (void) readUnknownGroup:(SInt32) fieldNumber builder:(PBUnknownFieldSetBuilder*) builder { if (recursionDepth >= recursionLimit) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"Recursion Limit Exceeded" userInfo:nil]; } ++recursionDepth; [builder mergeFromCodedInputStream:self]; [self checkLastTagWas:PBWireFormatMakeTag(fieldNumber, PBWireFormatEndGroup)]; --recursionDepth; } /** Read an embedded message field value from the stream. */ - (void) readMessage:(id) builder extensionRegistry:(PBExtensionRegistry*) extensionRegistry { SInt32 length = [self readRawVarint32]; if (recursionDepth >= recursionLimit) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"Recursion Limit Exceeded" userInfo:nil]; } SInt32 oldLimit = [self pushLimit:length]; ++recursionDepth; [builder mergeFromCodedInputStream:self extensionRegistry:extensionRegistry]; [self checkLastTagWas:0]; --recursionDepth; [self popLimit:oldLimit]; } /** Read a {@code bytes} field value from the stream. */ - (NSData*) readData { SInt32 size = [self readRawVarint32]; if (size < bufferSize - bufferPos && size > 0) { // Fast path: We already have the bytes in a contiguous buffer, so // just copy directly from it. NSData* result = [NSData dataWithBytes:(((uint8_t*) buffer.bytes) + bufferPos) length:size]; bufferPos += size; return result; } else { // Slow path: Build a byte array first then copy it. return [self readRawData:size]; } } /** Read a {@code uint32} field value from the stream. */ - (SInt32) readUInt32 { return [self readRawVarint32]; } /** * Read an enum field value from the stream. Caller is responsible * for converting the numeric value to an actual enum. */ - (SInt32) readEnum { return [self readRawVarint32]; } /** Read an {@code sfixed32} field value from the stream. */ - (SInt32) readSFixed32 { return [self readRawLittleEndian32]; } /** Read an {@code sfixed64} field value from the stream. */ - (SInt64) readSFixed64 { return [self readRawLittleEndian64]; } /** Read an {@code sint32} field value from the stream. */ - (SInt32) readSInt32 { return decodeZigZag32([self readRawVarint32]); } /** Read an {@code sint64} field value from the stream. */ - (SInt64) readSInt64 { return decodeZigZag64([self readRawVarint64]); } // ================================================================= /** * Read a raw Varint from the stream. If larger than 32 bits, discard the * upper bits. */ - (SInt32) readRawVarint32 { int8_t tmp = [self readRawByte]; if (tmp >= 0) { return tmp; } SInt32 result = tmp & 0x7f; if ((tmp = [self readRawByte]) >= 0) { result |= tmp << 7; } else { result |= (tmp & 0x7f) << 7; if ((tmp = [self readRawByte]) >= 0) { result |= tmp << 14; } else { result |= (tmp & 0x7f) << 14; if ((tmp = [self readRawByte]) >= 0) { result |= tmp << 21; } else { result |= (tmp & 0x7f) << 21; result |= (tmp = [self readRawByte]) << 28; if (tmp < 0) { // Discard upper 32 bits. for (int i = 0; i < 5; i++) { if ([self readRawByte] >= 0) { return result; } } @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"malformedVarint" userInfo:nil]; } } } } return result; } /** Read a raw Varint from the stream. */ - (SInt64) readRawVarint64 { SInt32 shift = 0; SInt64 result = 0; while (shift < 64) { int8_t b = [self readRawByte]; result |= (SInt64)(b & 0x7F) << shift; if ((b & 0x80) == 0) { return result; } shift += 7; } @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"malformedVarint" userInfo:nil]; } /** Read a 32-bit little-endian integer from the stream. */ - (SInt32) readRawLittleEndian32 { int8_t b1 = [self readRawByte]; int8_t b2 = [self readRawByte]; int8_t b3 = [self readRawByte]; int8_t b4 = [self readRawByte]; return (((SInt32)b1 & 0xff) ) | (((SInt32)b2 & 0xff) << 8) | (((SInt32)b3 & 0xff) << 16) | (((SInt32)b4 & 0xff) << 24); } /** Read a 64-bit little-endian integer from the stream. */ - (SInt64) readRawLittleEndian64 { int8_t b1 = [self readRawByte]; int8_t b2 = [self readRawByte]; int8_t b3 = [self readRawByte]; int8_t b4 = [self readRawByte]; int8_t b5 = [self readRawByte]; int8_t b6 = [self readRawByte]; int8_t b7 = [self readRawByte]; int8_t b8 = [self readRawByte]; return (((SInt64)b1 & 0xff) ) | (((SInt64)b2 & 0xff) << 8) | (((SInt64)b3 & 0xff) << 16) | (((SInt64)b4 & 0xff) << 24) | (((SInt64)b5 & 0xff) << 32) | (((SInt64)b6 & 0xff) << 40) | (((SInt64)b7 & 0xff) << 48) | (((SInt64)b8 & 0xff) << 56); } /** * Set the maximum message recursion depth. In order to prevent malicious * messages from causing stack overflows, {@code PBCodedInputStream} limits * how deeply messages may be nested. The default limit is 64. * * @return the old limit. */ - (SInt32) setRecursionLimit:(SInt32) limit { if (limit < 0) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Recursion limit cannot be negative" userInfo:nil]; } SInt32 oldLimit = recursionLimit; recursionLimit = limit; return oldLimit; } /** * Set the maximum message size. In order to prevent malicious * messages from exhausting memory or causing integer overflows, * {@code PBCodedInputStream} limits how large a message may be. * The default limit is 64MB. You should set this limit as small * as you can without harming your app's functionality. Note that * size limits only apply when reading from an {@code InputStream}, not * when constructed around a raw byte array. * * @return the old limit. */ - (SInt32) setSizeLimit:(SInt32) limit { if (limit < 0) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Size limit cannot be negative:" userInfo:nil]; } SInt32 oldLimit = sizeLimit; sizeLimit = limit; return oldLimit; } /** * Resets the current size counter to zero (see {@link #setSizeLimit(int)}). */ - (void) resetSizeCounter { totalBytesRetired = 0; } /** * Sets {@code currentLimit} to (current position) + {@code byteLimit}. This * is called when descending into a length-delimited embedded message. * * @return the old limit. */ - (SInt32) pushLimit:(SInt32) byteLimit { if (byteLimit < 0) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"negativeSize" userInfo:nil]; } byteLimit += totalBytesRetired + bufferPos; SInt32 oldLimit = currentLimit; if (byteLimit > oldLimit) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } currentLimit = byteLimit; [self recomputeBufferSizeAfterLimit]; return oldLimit; } - (void) recomputeBufferSizeAfterLimit { bufferSize += bufferSizeAfterLimit; SInt32 bufferEnd = totalBytesRetired + bufferSize; if (bufferEnd > currentLimit) { // Limit is in current buffer. bufferSizeAfterLimit = bufferEnd - currentLimit; bufferSize -= bufferSizeAfterLimit; } else { bufferSizeAfterLimit = 0; } } /** * Discards the current limit, returning to the previous limit. * * @param oldLimit The old limit, as returned by {@code pushLimit}. */ - (void) popLimit:(SInt32) oldLimit { currentLimit = oldLimit; [self recomputeBufferSizeAfterLimit]; } /** * Returns the number of bytes to be read before the current limit. * If no limit is set, returns -1. */ - (SInt32) bytesUntilLimit { if (currentLimit == INT_MAX) { return -1; } SInt32 currentAbsolutePosition = totalBytesRetired + bufferPos; return currentLimit - currentAbsolutePosition; } /** * Returns true if the stream has reached the end of the input. This is the * case if either the end of the underlying input source has been reached or * if the stream has reached a limit created using {@link #pushLimit(int)}. */ - (BOOL) isAtEnd { return bufferPos == bufferSize && ![self refillBuffer:NO]; } /** * Called with {@code this.buffer} is empty to read more bytes from the * input. If {@code mustSucceed} is YES, refillBuffer() gurantees that * either there will be at least one byte in the buffer when it returns * or it will throw an exception. If {@code mustSucceed} is NO, * refillBuffer() returns NO if no more bytes were available. */ - (BOOL) refillBuffer:(BOOL) mustSucceed { if (bufferPos < bufferSize) { @throw [NSException exceptionWithName:@"IllegalState" reason:@"refillBuffer called when buffer wasn't empty." userInfo:nil]; } if (totalBytesRetired + bufferSize == currentLimit) { // Oops, we hit a limit. if (mustSucceed) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } else { return NO; } } totalBytesRetired += bufferSize; // TODO(cyrusn): does NSInputStream behave the same as java.io.InputStream // when there is no more data? bufferPos = 0; bufferSize = 0; if (input != nil) { bufferSize = (SInt32)[input read:buffer.mutableBytes maxLength:buffer.length]; } if (bufferSize <= 0) { bufferSize = 0; if (mustSucceed) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } else { return NO; } } else { [self recomputeBufferSizeAfterLimit]; SInt32 totalBytesRead = totalBytesRetired + bufferSize + bufferSizeAfterLimit; if (totalBytesRead > sizeLimit || totalBytesRead < 0) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"sizeLimitExceeded" userInfo:nil]; } return YES; } } /** * Read one byte from the input. * * @throws InvalidProtocolBufferException The end of the stream or the current * limit was reached. */ - (int8_t) readRawByte { if (bufferPos == bufferSize) { [self refillBuffer:YES]; } int8_t* bytes = (int8_t*)buffer.bytes; return bytes[bufferPos++]; } /** * Read a fixed size of bytes from the input. * * @throws InvalidProtocolBufferException The end of the stream or the current * limit was reached. */ - (NSData*) readRawData:(SInt32) size { if (size < 0) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"negativeSize" userInfo:nil]; } if (totalBytesRetired + bufferPos + size > currentLimit) { // Read to the end of the stream anyway. [self skipRawData:currentLimit - totalBytesRetired - bufferPos]; // Then fail. @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } if (size <= bufferSize - bufferPos) { // We have all the bytes we need already. NSData* data = [NSData dataWithBytes:(((int8_t*) buffer.bytes) + bufferPos) length:size]; bufferPos += size; return data; } else if (size < BUFFER_SIZE) { // Reading more bytes than are in the buffer, but not an excessive number // of bytes. We can safely allocate the resulting array ahead of time. // First copy what we have. NSMutableData* bytes = [NSMutableData dataWithLength:size]; SInt32 pos = bufferSize - bufferPos; memcpy(bytes.mutableBytes, ((int8_t*)buffer.bytes) + bufferPos, pos); bufferPos = bufferSize; // We want to use refillBuffer() and then copy from the buffer into our // byte array rather than reading directly into our byte array because // the input may be unbuffered. [self refillBuffer:YES]; while (size - pos > bufferSize) { memcpy(((int8_t*)bytes.mutableBytes) + pos, buffer.bytes, bufferSize); pos += bufferSize; bufferPos = bufferSize; [self refillBuffer:YES]; } memcpy(((int8_t*)bytes.mutableBytes) + pos, buffer.bytes, size - pos); bufferPos = size - pos; return bytes; } else { // The size is very large. For security reasons, we can't allocate the // entire byte array yet. The size comes directly from the input, so a // maliciously-crafted message could provide a bogus very large size in // order to trick the app into allocating a lot of memory. We avoid this // by allocating and reading only a small chunk at a time, so that the // malicious message must actuall* e* extremely large to cause // problems. Meanwhile, we limit the allowed size of a message elsewhere. // Remember the buffer markers since we'll have to copy the bytes out of // it later. SInt32 originalBufferPos = bufferPos; SInt32 originalBufferSize = bufferSize; // Mark the current buffer consumed. totalBytesRetired += bufferSize; bufferPos = 0; bufferSize = 0; // Read all the rest of the bytes we need. SInt32 sizeLeft = size - (originalBufferSize - originalBufferPos); NSMutableArray* chunks = [NSMutableArray array]; while (sizeLeft > 0) { NSMutableData* chunk = [NSMutableData dataWithLength:MIN(sizeLeft, BUFFER_SIZE)]; SInt32 pos = 0; while (pos < chunk.length) { SInt32 n = 0; if (input != nil) { n = (SInt32)[input read:(((uint8_t*) chunk.mutableBytes) + pos) maxLength:chunk.length - pos]; } if (n <= 0) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } totalBytesRetired += n; pos += n; } sizeLeft -= chunk.length; [chunks addObject:chunk]; } // OK, got everything. Now concatenate it all into one buffer. NSMutableData* bytes = [NSMutableData dataWithLength:size]; // Start by copying the leftover bytes from this.buffer. SInt32 pos = originalBufferSize - originalBufferPos; memcpy(bytes.mutableBytes, ((int8_t*)buffer.bytes) + originalBufferPos, pos); // And now all the chunks. for (NSData* chunk in chunks) { memcpy(((int8_t*)bytes.mutableBytes) + pos, chunk.bytes, chunk.length); pos += chunk.length; } // Done. return bytes; } } /** * Reads and discards {@code size} bytes. * * @throws InvalidProtocolBufferException The end of the stream or the current * limit was reached. */ - (void) skipRawData:(SInt32) size { if (size < 0) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"negativeSize" userInfo:nil]; } if (totalBytesRetired + bufferPos + size > currentLimit) { // Read to the end of the stream anyway. [self skipRawData:currentLimit - totalBytesRetired - bufferPos]; // Then fail. @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } if (size <= (bufferSize - bufferPos)) { // We have all the bytes we need already. bufferPos += size; } else { // Skipping more bytes than are in the buffer. First skip what we have. SInt32 pos = bufferSize - bufferPos; totalBytesRetired += pos; bufferPos = 0; bufferSize = 0; // Then skip directly from the InputStream for the rest. while (pos < size) { NSMutableData* data = [NSMutableData dataWithLength:(size - pos)]; SInt32 n = (input == nil) ? -1 : (SInt32)[input read:data.mutableBytes maxLength:(size - pos)]; if (n <= 0) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"truncatedMessage" userInfo:nil]; } pos += n; totalBytesRetired += n; } } } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/CodedOutputStream.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * Encodes and writes protocol message fields. * *

This class contains two kinds of methods: methods that write specific * protocol message constructs and field types (e.g. {@link #writeTag} and * {@link #writeInt32}) and methods that write low-level values (e.g. * {@link #writeRawVarint32} and {@link #writeRawBytes}). If you are * writing encoded protocol messages, you should use the former methods, but if * you are writing some other format of your own design, use the latter. * *

This class is totally unsynchronized. * * @author Cyrus Najmabadi */ #import @class PBUnknownFieldSet; @class RingBuffer; @protocol PBMessage; @interface PBCodedOutputStream : NSObject { NSOutputStream *output; RingBuffer *buffer; } + (PBCodedOutputStream*) streamWithData:(NSMutableData*) data; + (PBCodedOutputStream*) streamWithOutputStream:(NSOutputStream*) output; + (PBCodedOutputStream*) streamWithOutputStream:(NSOutputStream*) output bufferSize:(SInt32) bufferSize; /** * Flushes the stream and forces any buffered bytes to be written. This * does not flush the underlying NSOutputStream. Returns free space in buffer. */ - (void) flush; /** Write a single byte. */ - (void) writeRawByte:(uint8_t) value; /** Encode and write a tag. */ - (void) writeTag:(SInt32) fieldNumber format:(SInt32) format; /** Write a little-endian 32-bit integer. */ - (void) writeRawLittleEndian32:(SInt32) value; /** Write a little-endian 64-bit integer. */ - (void) writeRawLittleEndian64:(SInt64) value; /** * Encode and write a varint. {@code value} is treated as * unsigned, so it won't be sign-extended if negative. */ - (void) writeRawVarint32:(SInt32) value; /** Encode and write a varint. */ - (void) writeRawVarint64:(SInt64) value; //- (void) writeRawLittleEndian32:(SInt32) value; //- (void) writeRawLittleEndian64:(SInt64) value; /** Write an array of bytes. */ - (void) writeRawData:(const NSData*) data; - (void) writeRawData:(const NSData*) data offset:(SInt32) offset length:(SInt32) length; - (void) writeData:(SInt32) fieldNumber value:(const NSData*) value; - (void) writeDouble:(SInt32) fieldNumber value:(Float64) value; - (void) writeFloat:(SInt32) fieldNumber value:(Float32) value; - (void) writeUInt64:(SInt32) fieldNumber value:(SInt64) value; - (void) writeInt64:(SInt32) fieldNumber value:(SInt64) value; - (void) writeInt32:(SInt32) fieldNumber value:(SInt32) value; - (void) writeFixed64:(SInt32) fieldNumber value:(SInt64) value; - (void) writeFixed32:(SInt32) fieldNumber value:(SInt32) value; - (void) writeBool:(SInt32) fieldNumber value:(BOOL) value; - (void) writeString:(SInt32) fieldNumber value:(const NSString*) value; - (void) writeGroup:(SInt32) fieldNumber value:(const id) value; - (void) writeUnknownGroup:(SInt32) fieldNumber value:(const PBUnknownFieldSet*) value; - (void) writeMessage:(SInt32) fieldNumber value:(const id) value; - (void) writeUInt32:(SInt32) fieldNumber value:(SInt32) value; - (void) writeSFixed32:(SInt32) fieldNumber value:(SInt32) value; - (void) writeSFixed64:(SInt32) fieldNumber value:(SInt64) value; - (void) writeSInt32:(SInt32) fieldNumber value:(SInt32) value; - (void) writeSInt64:(SInt32) fieldNumber value:(SInt64) value; - (void) writeDoubleNoTag:(Float64) value; - (void) writeFloatNoTag:(Float32) value; - (void) writeUInt64NoTag:(SInt64) value; - (void) writeInt64NoTag:(SInt64) value; - (void) writeInt32NoTag:(SInt32) value; - (void) writeFixed64NoTag:(SInt64) value; - (void) writeFixed32NoTag:(SInt32) value; - (void) writeBoolNoTag:(BOOL) value; - (void) writeStringNoTag:(const NSString*) value; - (void) writeGroupNoTag:(SInt32) fieldNumber value:(const id) value; - (void) writeUnknownGroupNoTag:(SInt32) fieldNumber value:(const PBUnknownFieldSet*) value; - (void) writeMessageNoTag:(const id) value; - (void) writeDataNoTag:(const NSData*) value; - (void) writeUInt32NoTag:(SInt32) value; - (void) writeEnumNoTag:(SInt32) value; - (void) writeSFixed32NoTag:(SInt32) value; - (void) writeSFixed64NoTag:(SInt64) value; - (void) writeSInt32NoTag:(SInt32) value; - (void) writeSInt64NoTag:(SInt64) value; /** * Write a MessageSet extension field to the stream. For historical reasons, * the wire format differs from normal fields. */ - (void) writeMessageSetExtension:(SInt32) fieldNumber value:(const id) value; /** * Write an unparsed MessageSet extension field to the stream. For * historical reasons, the wire format differs from normal fields. */ - (void) writeRawMessageSetExtension:(SInt32) fieldNumber value:(const NSData*) value; /** * Write an enum field, including tag, to the stream. Caller is responsible * for converting the enum value to its numeric value. */ - (void) writeEnum:(SInt32) fieldNumber value:(SInt32) value; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/CodedOutputStream.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "CodedOutputStream.h" #import "RingBuffer.h" #import "Message.h" #import "Utilities.h" #import "WireFormat.h" #import "UnknownFieldSetBuilder.h" #import "UnknownFieldSet.h" @implementation PBCodedOutputStream const SInt32 DEFAULT_BUFFER_SIZE = 4 * 1024; - (instancetype)initWithOutputStream:(NSOutputStream*)_output data:(NSMutableData*)data { if ( (self = [super init]) ) { output = _output; buffer = [[RingBuffer alloc] initWithData:data]; } return self; } + (PBCodedOutputStream*)streamWithOutputStream:(NSOutputStream*)output bufferSize:(SInt32)bufferSize { NSMutableData *data = [NSMutableData dataWithLength:bufferSize]; return [[PBCodedOutputStream alloc] initWithOutputStream:output data:data]; } + (PBCodedOutputStream*)streamWithOutputStream:(NSOutputStream*)output { return [PBCodedOutputStream streamWithOutputStream:output bufferSize:DEFAULT_BUFFER_SIZE]; } + (PBCodedOutputStream*)streamWithData:(NSMutableData*)data { return [[PBCodedOutputStream alloc] initWithOutputStream:nil data:data]; } - (void)flush { if (output == nil) { // We're writing to a single buffer. @throw [NSException exceptionWithName:@"OutOfSpace" reason:@"" userInfo:nil]; } [buffer flushToOutputStream:output]; } - (void)writeRawByte:(uint8_t)value { while (![buffer appendByte:value]) { [self flush]; } } - (void)writeRawData:(const NSData*)data { [self writeRawData:data offset:0 length:(SInt32)data.length]; } - (void)writeRawData:(const NSData*)value offset:(SInt32)offset length:(SInt32)length { while (length > 0) { SInt32 written = [buffer appendData:value offset:offset length:length]; offset += written; length -= written; if (!written || length > 0) { [self flush]; } } } - (void)writeDoubleNoTag:(Float64)value { [self writeRawLittleEndian64:convertFloat64ToInt64(value)]; } /** Write a {@code double} field, including tag, to the stream. */ - (void)writeDouble:(SInt32)fieldNumber value:(Float64)value { [self writeTag:fieldNumber format:PBWireFormatFixed64]; [self writeDoubleNoTag:value]; } - (void)writeFloatNoTag:(Float32)value { [self writeRawLittleEndian32:convertFloat32ToInt32(value)]; } /** Write a {@code float} field, including tag, to the stream. */ - (void)writeFloat:(SInt32)fieldNumber value:(Float32)value { [self writeTag:fieldNumber format:PBWireFormatFixed32]; [self writeFloatNoTag:value]; } - (void)writeUInt64NoTag:(SInt64)value { [self writeRawVarint64:value]; } /** Write a {@code uint64} field, including tag, to the stream. */ - (void)writeUInt64:(SInt32)fieldNumber value:(SInt64)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeUInt64NoTag:value]; } - (void)writeInt64NoTag:(SInt64)value { [self writeRawVarint64:value]; } /** Write an {@code int64} field, including tag, to the stream. */ - (void)writeInt64:(SInt32)fieldNumber value:(SInt64)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeInt64NoTag:value]; } - (void)writeInt32NoTag:(SInt32)value { if (value >= 0) { [self writeRawVarint32:value]; } else { // Must sign-extend [self writeRawVarint64:value]; } } /** Write an {@code int32} field, including tag, to the stream. */ - (void)writeInt32:(SInt32)fieldNumber value:(SInt32)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeInt32NoTag:value]; } - (void)writeFixed64NoTag:(SInt64)value { [self writeRawLittleEndian64:value]; } /** Write a {@code fixed64} field, including tag, to the stream. */ - (void)writeFixed64:(SInt32)fieldNumber value:(SInt64)value { [self writeTag:fieldNumber format:PBWireFormatFixed64]; [self writeFixed64NoTag:value]; } - (void)writeFixed32NoTag:(SInt32)value { [self writeRawLittleEndian32:value]; } /** Write a {@code fixed32} field, including tag, to the stream. */ - (void)writeFixed32:(SInt32)fieldNumber value:(SInt32)value { [self writeTag:fieldNumber format:PBWireFormatFixed32]; [self writeFixed32NoTag:value]; } - (void)writeBoolNoTag:(BOOL)value { [self writeRawByte:(value ? 1 : 0)]; } /** Write a {@code bool} field, including tag, to the stream. */ - (void)writeBool:(SInt32)fieldNumber value:(BOOL)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeBoolNoTag:value]; } - (void)writeStringNoTag:(const NSString*)value { NSData* data = [value dataUsingEncoding:NSUTF8StringEncoding]; [self writeRawVarint32:(SInt32)data.length]; [self writeRawData:data]; } /** Write a {@code string} field, including tag, to the stream. */ - (void)writeString:(SInt32)fieldNumber value:(const NSString*)value { [self writeTag:fieldNumber format:PBWireFormatLengthDelimited]; [self writeStringNoTag:value]; } - (void)writeGroupNoTag:(SInt32)fieldNumber value:(const id)value { [value writeToCodedOutputStream:self]; [self writeTag:fieldNumber format:PBWireFormatEndGroup]; } /** Write a {@code group} field, including tag, to the stream. */ - (void)writeGroup:(SInt32)fieldNumber value:(const id)value { [self writeTag:fieldNumber format:PBWireFormatStartGroup]; [self writeGroupNoTag:fieldNumber value:value]; } - (void)writeUnknownGroupNoTag:(SInt32)fieldNumber value:(const PBUnknownFieldSet*)value { [value writeToCodedOutputStream:self]; [self writeTag:fieldNumber format:PBWireFormatEndGroup]; } /** Write a group represented by an {@link PBUnknownFieldSet}. */ - (void)writeUnknownGroup:(SInt32)fieldNumber value:(const PBUnknownFieldSet*)value { [self writeTag:fieldNumber format:PBWireFormatStartGroup]; [self writeUnknownGroupNoTag:fieldNumber value:value]; } - (void)writeMessageNoTag:(const id)value { [self writeRawVarint32:[value serializedSize]]; [value writeToCodedOutputStream:self]; } /** Write an embedded message field, including tag, to the stream. */ - (void)writeMessage:(SInt32)fieldNumber value:(const id)value { [self writeTag:fieldNumber format:PBWireFormatLengthDelimited]; [self writeMessageNoTag:value]; } - (void)writeDataNoTag:(const NSData*)value { [self writeRawVarint32:(SInt32)value.length]; [self writeRawData:value]; } /** Write a {@code bytes} field, including tag, to the stream. */ - (void)writeData:(SInt32)fieldNumber value:(const NSData*)value { [self writeTag:fieldNumber format:PBWireFormatLengthDelimited]; [self writeDataNoTag:value]; } - (void)writeUInt32NoTag:(SInt32)value { [self writeRawVarint32:value]; } /** Write a {@code uint32} field, including tag, to the stream. */ - (void)writeUInt32:(SInt32)fieldNumber value:(SInt32)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeUInt32NoTag:value]; } - (void)writeEnumNoTag:(SInt32)value { [self writeRawVarint32:value]; } - (void)writeEnum:(SInt32)fieldNumber value:(SInt32)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeEnumNoTag:value]; } - (void)writeSFixed32NoTag:(SInt32)value { [self writeRawLittleEndian32:value]; } /** Write an {@code sfixed32} field, including tag, to the stream. */ - (void)writeSFixed32:(SInt32)fieldNumber value:(SInt32)value { [self writeTag:fieldNumber format:PBWireFormatFixed32]; [self writeSFixed32NoTag:value]; } - (void)writeSFixed64NoTag:(SInt64)value { [self writeRawLittleEndian64:value]; } /** Write an {@code sfixed64} field, including tag, to the stream. */ - (void)writeSFixed64:(SInt32)fieldNumber value:(SInt64)value { [self writeTag:fieldNumber format:PBWireFormatFixed64]; [self writeSFixed64NoTag:value]; } - (void)writeSInt32NoTag:(SInt32)value { [self writeRawVarint32:encodeZigZag32(value)]; } /** Write an {@code sint32} field, including tag, to the stream. */ - (void)writeSInt32:(SInt32)fieldNumber value:(SInt32)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeSInt32NoTag:value]; } - (void)writeSInt64NoTag:(SInt64)value { [self writeRawVarint64:encodeZigZag64(value)]; } /** Write an {@code sint64} field, including tag, to the stream. */ - (void)writeSInt64:(SInt32)fieldNumber value:(SInt64)value { [self writeTag:fieldNumber format:PBWireFormatVarint]; [self writeSInt64NoTag:value]; } /** * Write a MessageSet extension field to the stream. For historical reasons, * the wire format differs from normal fields. */ - (void)writeMessageSetExtension:(SInt32)fieldNumber value:(const id)value { [self writeTag:PBWireFormatMessageSetItem format:PBWireFormatStartGroup]; [self writeUInt32:PBWireFormatMessageSetTypeId value:fieldNumber]; [self writeMessage:PBWireFormatMessageSetMessage value:value]; [self writeTag:PBWireFormatMessageSetItem format:PBWireFormatEndGroup]; } /** * Write an unparsed MessageSet extension field to the stream. For * historical reasons, the wire format differs from normal fields. */ - (void)writeRawMessageSetExtension:(SInt32)fieldNumber value:(const NSData*)value { [self writeTag:PBWireFormatMessageSetItem format:PBWireFormatStartGroup]; [self writeUInt32:PBWireFormatMessageSetTypeId value:fieldNumber]; [self writeData:PBWireFormatMessageSetMessage value:value]; [self writeTag:PBWireFormatMessageSetItem format:PBWireFormatEndGroup]; } - (void)writeTag:(SInt32)fieldNumber format:(SInt32)format { [self writeRawVarint32:PBWireFormatMakeTag(fieldNumber, format)]; } - (void)writeRawVarint32:(SInt32)value { while (YES) { if ((value & ~0x7F) == 0) { [self writeRawByte:value]; return; } else { [self writeRawByte:((value & 0x7F) | 0x80)]; value = logicalRightShift32(value, 7); } } } - (void)writeRawVarint64:(SInt64)value { while (YES) { if ((value & ~0x7FL) == 0) { [self writeRawByte:((SInt32)value)]; return; } else { [self writeRawByte:(((SInt32)value & 0x7F) | 0x80)]; value = logicalRightShift64(value, 7); } } } - (void)writeRawLittleEndian32:(SInt32)value { [self writeRawByte:((value ) & 0xFF)]; [self writeRawByte:((value >> 8) & 0xFF)]; [self writeRawByte:((value >> 16) & 0xFF)]; [self writeRawByte:((value >> 24) & 0xFF)]; } - (void)writeRawLittleEndian64:(SInt64)value { [self writeRawByte:((SInt32)(value ) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 8) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 16) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 24) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 32) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 40) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 48) & 0xFF)]; [self writeRawByte:((SInt32)(value >> 56) & 0xFF)]; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ConcreteExtensionField.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "ExtensionField.h" typedef enum { PBExtensionTypeBool, PBExtensionTypeFixed32, PBExtensionTypeSFixed32, PBExtensionTypeFloat, PBExtensionTypeFixed64, PBExtensionTypeSFixed64, PBExtensionTypeDouble, PBExtensionTypeInt32, PBExtensionTypeInt64, PBExtensionTypeSInt32, PBExtensionTypeSInt64, PBExtensionTypeUInt32, PBExtensionTypeUInt64, PBExtensionTypeBytes, PBExtensionTypeString, PBExtensionTypeMessage, PBExtensionTypeGroup, PBExtensionTypeEnum } PBExtensionType; @interface PBConcreteExtensionField : NSObject { @private PBExtensionType type; Class extendedClass; SInt32 fieldNumber; id defaultValue; Class messageOrGroupClass; BOOL isRepeated; BOOL isPacked; BOOL isMessageSetWireFormat; } + (PBConcreteExtensionField*) extensionWithType:(PBExtensionType) type extendedClass:(Class) extendedClass fieldNumber:(SInt32) fieldNumber defaultValue:(id) defaultValue messageOrGroupClass:(Class) messageOrGroupClass isRepeated:(BOOL) isRepeated isPacked:(BOOL) isPacked isMessageSetWireFormat:(BOOL) isMessageSetWireFormat; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ConcreteExtensionField.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "ConcreteExtensionField.h" #import "AbstractMessage.h" #import "CodedInputStream.h" #import "CodedOutputStream.h" #import "ExtendableMessageBuilder.h" #import "MessageBuilder.h" #import "Utilities.h" #import "WireFormat.h" @interface PBConcreteExtensionField() @property PBExtensionType type; @property (assign) Class extendedClass; @property SInt32 fieldNumber; @property (strong) id defaultValue; @property (assign) Class messageOrGroupClass; @property BOOL isRepeated; @property BOOL isPacked; @property BOOL isMessageSetWireFormat; @end @implementation PBConcreteExtensionField @synthesize type; @synthesize extendedClass; @synthesize fieldNumber; @synthesize defaultValue; @synthesize messageOrGroupClass; @synthesize isRepeated; @synthesize isPacked; @synthesize isMessageSetWireFormat; - (instancetype) initWithType:(PBExtensionType) type_ extendedClass:(Class) extendedClass_ fieldNumber:(SInt32) fieldNumber_ defaultValue:(id) defaultValue_ messageOrGroupClass:(Class) messageOrGroupClass_ isRepeated:(BOOL) isRepeated_ isPacked:(BOOL) isPacked_ isMessageSetWireFormat:(BOOL) isMessageSetWireFormat_ { if ((self = [super init])) { self.type = type_; self.extendedClass = extendedClass_; self.fieldNumber = fieldNumber_; self.defaultValue = defaultValue_; self.messageOrGroupClass = messageOrGroupClass_; self.isRepeated = isRepeated_; self.isPacked = isPacked_; self.isMessageSetWireFormat = isMessageSetWireFormat_; } return self; } + (PBConcreteExtensionField*) extensionWithType:(PBExtensionType) type extendedClass:(Class) extendedClass fieldNumber:(SInt32) fieldNumber defaultValue:(id) defaultValue messageOrGroupClass:(Class) messageOrGroupClass isRepeated:(BOOL) isRepeated isPacked:(BOOL) isPacked isMessageSetWireFormat:(BOOL) isMessageSetWireFormat { return [[PBConcreteExtensionField alloc] initWithType:type extendedClass:extendedClass fieldNumber:fieldNumber defaultValue:defaultValue messageOrGroupClass:messageOrGroupClass isRepeated:isRepeated isPacked:isPacked isMessageSetWireFormat:isMessageSetWireFormat]; } - (PBWireFormat) wireType { if (isPacked) { return PBWireFormatLengthDelimited; } switch (type) { case PBExtensionTypeBool: return PBWireFormatVarint; case PBExtensionTypeFixed32: return PBWireFormatFixed32; case PBExtensionTypeSFixed32: return PBWireFormatFixed32; case PBExtensionTypeFloat: return PBWireFormatFixed32; case PBExtensionTypeFixed64: return PBWireFormatFixed64; case PBExtensionTypeSFixed64: return PBWireFormatFixed64; case PBExtensionTypeDouble: return PBWireFormatFixed64; case PBExtensionTypeInt32: return PBWireFormatVarint; case PBExtensionTypeInt64: return PBWireFormatVarint; case PBExtensionTypeSInt32: return PBWireFormatVarint; case PBExtensionTypeSInt64: return PBWireFormatVarint; case PBExtensionTypeUInt32: return PBWireFormatVarint; case PBExtensionTypeUInt64: return PBWireFormatVarint; case PBExtensionTypeBytes: return PBWireFormatLengthDelimited; case PBExtensionTypeString: return PBWireFormatLengthDelimited; case PBExtensionTypeMessage: return PBWireFormatLengthDelimited; case PBExtensionTypeGroup: return PBWireFormatStartGroup; case PBExtensionTypeEnum: return PBWireFormatVarint; } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } BOOL typeIsFixedSize(PBExtensionType type) { switch (type) { case PBExtensionTypeBool: case PBExtensionTypeFixed32: case PBExtensionTypeSFixed32: case PBExtensionTypeFloat: case PBExtensionTypeFixed64: case PBExtensionTypeSFixed64: case PBExtensionTypeDouble: return YES; default: return NO; } } SInt32 typeSize(PBExtensionType type) { switch (type) { case PBExtensionTypeBool: return 1; case PBExtensionTypeFixed32: case PBExtensionTypeSFixed32: case PBExtensionTypeFloat: return 4; case PBExtensionTypeFixed64: case PBExtensionTypeSFixed64: case PBExtensionTypeDouble: return 8; default: break; } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (void) writeSingleValue:(id) value includingTagToCodedOutputStream:(PBCodedOutputStream*) output { switch (type) { case PBExtensionTypeBool: [output writeBool:fieldNumber value:[value boolValue]]; return; case PBExtensionTypeFixed32: [output writeFixed32:fieldNumber value:(SInt32)[value integerValue]]; return; case PBExtensionTypeSFixed32: [output writeSFixed32:fieldNumber value:(SInt32)[value integerValue]]; return; case PBExtensionTypeFloat: [output writeFloat:fieldNumber value:[value floatValue]]; return; case PBExtensionTypeFixed64: [output writeFixed64:fieldNumber value:[value longLongValue]]; return; case PBExtensionTypeSFixed64: [output writeSFixed64:fieldNumber value:[value longLongValue]]; return; case PBExtensionTypeDouble: [output writeDouble:fieldNumber value:[value doubleValue]]; return; case PBExtensionTypeInt32: [output writeInt32:fieldNumber value:(SInt32)[value integerValue]]; return; case PBExtensionTypeInt64: [output writeInt64:fieldNumber value:[value longLongValue]]; return; case PBExtensionTypeSInt32: [output writeSInt32:fieldNumber value:(SInt32)[value integerValue]]; return; case PBExtensionTypeSInt64: [output writeSInt64:fieldNumber value:[value longLongValue]]; return; case PBExtensionTypeUInt32: [output writeUInt32:fieldNumber value:(SInt32)[value integerValue]]; return; case PBExtensionTypeUInt64: [output writeUInt64:fieldNumber value:[value longLongValue]]; return; case PBExtensionTypeBytes: [output writeData:fieldNumber value:value]; return; case PBExtensionTypeString: [output writeString:fieldNumber value:value]; return; case PBExtensionTypeGroup: [output writeGroup:fieldNumber value:value]; return; case PBExtensionTypeEnum: [output writeEnum:fieldNumber value:(SInt32)[value integerValue]]; return; case PBExtensionTypeMessage: if (isMessageSetWireFormat) { [output writeMessageSetExtension:fieldNumber value:value]; } else { [output writeMessage:fieldNumber value:value]; } return; } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (void) writeSingleValue:(id) value noTagToCodedOutputStream:(PBCodedOutputStream*) output { switch (type) { case PBExtensionTypeBool: [output writeBoolNoTag:[value boolValue]]; return; case PBExtensionTypeFixed32: [output writeFixed32NoTag:(SInt32)[value integerValue]]; return; case PBExtensionTypeSFixed32: [output writeSFixed32NoTag:(SInt32)[value integerValue]]; return; case PBExtensionTypeFloat: [output writeFloatNoTag:[value floatValue]]; return; case PBExtensionTypeFixed64: [output writeFixed64NoTag:[value longLongValue]]; return; case PBExtensionTypeSFixed64: [output writeSFixed64NoTag:[value longLongValue]]; return; case PBExtensionTypeDouble: [output writeDoubleNoTag:[value doubleValue]]; return; case PBExtensionTypeInt32: [output writeInt32NoTag:(SInt32)[value integerValue]]; return; case PBExtensionTypeInt64: [output writeInt64NoTag:[value longLongValue]]; return; case PBExtensionTypeSInt32: [output writeSInt32NoTag:(SInt32)[value integerValue]]; return; case PBExtensionTypeSInt64: [output writeSInt64NoTag:[value longLongValue]]; return; case PBExtensionTypeUInt32: [output writeUInt32NoTag:(SInt32)[value integerValue]]; return; case PBExtensionTypeUInt64: [output writeUInt64NoTag:[value longLongValue]]; return; case PBExtensionTypeBytes: [output writeDataNoTag:value]; return; case PBExtensionTypeString: [output writeStringNoTag:value]; return; case PBExtensionTypeGroup: [output writeGroupNoTag:fieldNumber value:value]; return; case PBExtensionTypeEnum: [output writeEnumNoTag:(SInt32)[value integerValue]]; return; case PBExtensionTypeMessage: [output writeMessageNoTag:value]; return; } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (SInt32) computeSingleSerializedSizeNoTag:(id) value { switch (type) { case PBExtensionTypeBool: return computeBoolSizeNoTag([value boolValue]); case PBExtensionTypeFixed32: return computeFixed32SizeNoTag((SInt32)[value integerValue]); case PBExtensionTypeSFixed32: return computeSFixed32SizeNoTag((SInt32)[value integerValue]); case PBExtensionTypeFloat: return computeFloatSizeNoTag([value floatValue]); case PBExtensionTypeFixed64: return computeFixed64SizeNoTag([value longLongValue]); case PBExtensionTypeSFixed64: return computeSFixed64SizeNoTag([value longLongValue]); case PBExtensionTypeDouble: return computeDoubleSizeNoTag([value doubleValue]); case PBExtensionTypeInt32: return computeInt32SizeNoTag((SInt32)[value integerValue]); case PBExtensionTypeInt64: return computeInt64SizeNoTag([value longLongValue]); case PBExtensionTypeSInt32: return computeSInt32SizeNoTag((SInt32)[value integerValue]); case PBExtensionTypeSInt64: return computeSInt64SizeNoTag([value longLongValue]); case PBExtensionTypeUInt32: return computeUInt32SizeNoTag((SInt32)[value integerValue]); case PBExtensionTypeUInt64: return computeUInt64SizeNoTag([value longLongValue]); case PBExtensionTypeBytes: return computeDataSizeNoTag(value); case PBExtensionTypeString: return computeStringSizeNoTag(value); case PBExtensionTypeGroup: return computeGroupSizeNoTag(value); case PBExtensionTypeEnum: return computeEnumSizeNoTag((SInt32)[value integerValue]); case PBExtensionTypeMessage: return computeMessageSizeNoTag(value); } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (SInt32) computeSingleSerializedSizeIncludingTag:(id) value { switch (type) { case PBExtensionTypeBool: return computeBoolSize(fieldNumber, [value boolValue]); case PBExtensionTypeFixed32: return computeFixed32Size(fieldNumber,(SInt32) [value integerValue]); case PBExtensionTypeSFixed32: return computeSFixed32Size(fieldNumber, (SInt32)[value integerValue]); case PBExtensionTypeFloat: return computeFloatSize(fieldNumber, [value floatValue]); case PBExtensionTypeFixed64: return computeFixed64Size(fieldNumber, [value longLongValue]); case PBExtensionTypeSFixed64: return computeSFixed64Size(fieldNumber, [value longLongValue]); case PBExtensionTypeDouble: return computeDoubleSize(fieldNumber, [value doubleValue]); case PBExtensionTypeInt32: return computeInt32Size(fieldNumber, (SInt32)[value integerValue]); case PBExtensionTypeInt64: return computeInt64Size(fieldNumber, [value longLongValue]); case PBExtensionTypeSInt32: return computeSInt32Size(fieldNumber, (SInt32)[value integerValue]); case PBExtensionTypeSInt64: return computeSInt64Size(fieldNumber, [value longLongValue]); case PBExtensionTypeUInt32: return computeUInt32Size(fieldNumber, (SInt32)[value integerValue]); case PBExtensionTypeUInt64: return computeUInt64Size(fieldNumber, [value longLongValue]); case PBExtensionTypeBytes: return computeDataSize(fieldNumber, value); case PBExtensionTypeString: return computeStringSize(fieldNumber, value); case PBExtensionTypeGroup: return computeGroupSize(fieldNumber, value); case PBExtensionTypeEnum: return computeEnumSize(fieldNumber, (SInt32)[value integerValue]); case PBExtensionTypeMessage: if (isMessageSetWireFormat) { return computeMessageSetExtensionSize(fieldNumber, value); } else { return computeMessageSize(fieldNumber, value); } } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (void) writeDescriptionOfSingleValue:(id) value to:(NSMutableString*) output withIndent:(NSString*) indent { switch (type) { case PBExtensionTypeBool: case PBExtensionTypeFixed32: case PBExtensionTypeSFixed32: case PBExtensionTypeFloat: case PBExtensionTypeFixed64: case PBExtensionTypeSFixed64: case PBExtensionTypeDouble: case PBExtensionTypeInt32: case PBExtensionTypeInt64: case PBExtensionTypeSInt32: case PBExtensionTypeSInt64: case PBExtensionTypeUInt32: case PBExtensionTypeUInt64: case PBExtensionTypeBytes: case PBExtensionTypeString: case PBExtensionTypeEnum: [output appendFormat:@"%@%@\n", indent, value]; return; case PBExtensionTypeGroup: case PBExtensionTypeMessage: [((PBAbstractMessage *)value) writeDescriptionTo:output withIndent:indent]; return; } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (void)writeRepeatedValues:(NSArray*) values includingTagsToCodedOutputStream:(PBCodedOutputStream*) output { if (isPacked) { [output writeTag:fieldNumber format:PBWireFormatLengthDelimited]; SInt32 dataSize = 0; if (typeIsFixedSize(type)) { dataSize = (SInt32)(values.count * typeSize(type)); } else { for (id value in values) { dataSize += [self computeSingleSerializedSizeNoTag:value]; } } [output writeRawVarint32:dataSize]; for (id value in values) { [self writeSingleValue:value noTagToCodedOutputStream:output]; } } else { for (id value in values) { [self writeSingleValue:value includingTagToCodedOutputStream:output]; } } } - (void) writeValue:(id) value includingTagToCodedOutputStream:(PBCodedOutputStream*) output { if (isRepeated) { [self writeRepeatedValues:value includingTagsToCodedOutputStream:output]; } else { [self writeSingleValue:value includingTagToCodedOutputStream:output]; } } - (SInt32) computeRepeatedSerializedSizeIncludingTags:(NSArray*) values { if (isPacked) { SInt32 size = 0; if (typeIsFixedSize(type)) { size = (SInt32)(values.count * typeSize(type)); } else { for (id value in values) { size += [self computeSingleSerializedSizeNoTag:value]; } } return size + computeTagSize(fieldNumber) + computeRawVarint32Size(size); } else { SInt32 size = 0; for (id value in values) { size += [self computeSingleSerializedSizeIncludingTag:value]; } return size; } } - (SInt32) computeSerializedSizeIncludingTag:(id) value { if (isRepeated) { return [self computeRepeatedSerializedSizeIncludingTags:value]; } else { return [self computeSingleSerializedSizeIncludingTag:value]; } } - (void) writeDescriptionOf:(id)value to:(NSMutableString *)output withIndent:(NSString *)indent { if (isRepeated) { NSArray* values = value; for (id singleValue in values) { [self writeDescriptionOfSingleValue:singleValue to:output withIndent:indent]; } } else { [self writeDescriptionOfSingleValue:value to:output withIndent:indent]; } } - (id) dictionaryObjectValueForObject: (id) object { switch (type) { case PBExtensionTypeBool: case PBExtensionTypeFixed32: case PBExtensionTypeSFixed32: case PBExtensionTypeFloat: case PBExtensionTypeFixed64: case PBExtensionTypeSFixed64: case PBExtensionTypeDouble: case PBExtensionTypeInt32: case PBExtensionTypeInt64: case PBExtensionTypeSInt32: case PBExtensionTypeSInt64: case PBExtensionTypeUInt32: case PBExtensionTypeUInt64: case PBExtensionTypeBytes: case PBExtensionTypeString: case PBExtensionTypeEnum: return object; case PBExtensionTypeGroup: case PBExtensionTypeMessage: { NSMutableDictionary * dic = [NSMutableDictionary new]; [((PBAbstractMessage *)object) storeInDictionary:dic]; return dic; } } } - (void) addDictionaryEntriesOf:(id) value to:(NSMutableDictionary*) dictionary { if (isRepeated) { NSArray* values = value; NSMutableArray * arr = [NSMutableArray new]; for (id singleValue in values) { [arr addObject: [self dictionaryObjectValueForObject:singleValue]]; } [dictionary setObject: arr forKey: NSStringFromClass([self extendedClass])]; } else { [dictionary setObject: [self dictionaryObjectValueForObject:value] forKey: NSStringFromClass([self extendedClass])]; } } - (void) mergeMessageSetExtentionFromCodedInputStream:(PBCodedInputStream*) input unknownFields:(PBUnknownFieldSetBuilder*) unknownFields { @throw [NSException exceptionWithName:@"NYI" reason:@"" userInfo:nil]; // The wire format for MessageSet is: // message MessageSet { // repeated group Item = 1 { // required int32 typeId = 2; // required bytes message = 3; // } // } // "typeId" is the extension's field number. The extension can only be // a message type, where "message" contains the encoded bytes of that // message. // // In practice, we will probably never see a MessageSet item in which // the message appears before the type ID, or where either field does not // appear exactly once. However, in theory such cases are valid, so we // should be prepared to accept them. //int typeId = 0; // ByteString rawBytes = null; // // while (true) { // final int tag = input.readTag(); // if (tag == 0) { // break; // } // // if (tag == WireFormat.MESSAGE_SET_TYPE_ID_TAG) { // typeId = input.readUInt32(); // // Zero is not a valid type ID. // if (typeId != 0) { // if (rawBytes != null) { // unknownFields.mergeField(typeId, // UnknownFieldSet.Field.newBuilder() // .addLengthDelimited(rawBytes) // .build()); // rawBytes = null; // } // } // } else if (tag == WireFormat.MESSAGE_SET_MESSAGE_TAG) { // if (typeId == 0) { // // We haven't seen a type ID yet, so we have to store the raw bytes // // for now. // rawBytes = input.readBytes(); // } else { // unknownFields.mergeField(typeId, // UnknownFieldSet.Field.newBuilder() // .addLengthDelimited(input.readBytes()) // .build()); // } // } else { // // Unknown fieldNumber. Skip it. // if (!input.skipField(tag)) { // break; // end of group // } // } // } // // input.checkLastTagWas(WireFormat.MESSAGE_SET_ITEM_END_TAG); } - (id) readSingleValueFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { switch (type) { case PBExtensionTypeBool: return [NSNumber numberWithBool:[input readBool]]; case PBExtensionTypeFixed32: return @([input readFixed32]); case PBExtensionTypeSFixed32: return @([input readSFixed32]); case PBExtensionTypeFloat: return [NSNumber numberWithFloat:[input readFloat]]; case PBExtensionTypeFixed64: return [NSNumber numberWithLongLong:[input readFixed64]]; case PBExtensionTypeSFixed64: return [NSNumber numberWithLongLong:[input readSFixed64]]; case PBExtensionTypeDouble: return [NSNumber numberWithDouble:[input readDouble]]; case PBExtensionTypeInt32: return @([input readInt32]); case PBExtensionTypeInt64: return [NSNumber numberWithLongLong:[input readInt64]]; case PBExtensionTypeSInt32: return @([input readSInt32]); case PBExtensionTypeSInt64: return [NSNumber numberWithLongLong:[input readSInt64]]; case PBExtensionTypeUInt32: return @([input readUInt32]); case PBExtensionTypeUInt64: return [NSNumber numberWithLongLong:[input readUInt64]]; case PBExtensionTypeBytes: return [input readData]; case PBExtensionTypeString: return [input readString]; case PBExtensionTypeEnum: return @([input readEnum]); case PBExtensionTypeGroup: { id builder = [messageOrGroupClass builder]; [input readGroup:fieldNumber builder:builder extensionRegistry:extensionRegistry]; return [builder build]; } case PBExtensionTypeMessage: { id builder = [messageOrGroupClass builder]; [input readMessage:builder extensionRegistry:extensionRegistry]; return [builder build]; } } @throw [NSException exceptionWithName:@"InternalError" reason:@"" userInfo:nil]; } - (void) mergeFromCodedInputStream:(PBCodedInputStream*) input unknownFields:(PBUnknownFieldSetBuilder*) unknownFields extensionRegistry:(PBExtensionRegistry*) extensionRegistry builder:(PBExtendableMessageBuilder*) builder tag:(SInt32) tag { if (isPacked) { SInt32 length = [input readRawVarint32]; SInt32 limit = [input pushLimit:length]; while ([input bytesUntilLimit] > 0) { id value = [self readSingleValueFromCodedInputStream:input extensionRegistry:extensionRegistry]; [builder addExtension:self value:value]; } [input popLimit:limit]; } else if (isMessageSetWireFormat) { [self mergeMessageSetExtentionFromCodedInputStream:input unknownFields:unknownFields]; } else { id value = [self readSingleValueFromCodedInputStream:input extensionRegistry:extensionRegistry]; if (isRepeated) { [builder addExtension:self value:value]; } else { [builder setExtension:self value:value]; } } } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Descriptor.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" // @@protoc_insertion_point(imports) @class PBDescriptorProto; @class PBDescriptorProtoBuilder; @class PBDescriptorProtoExtensionRange; @class PBDescriptorProtoExtensionRangeBuilder; @class PBEnumDescriptorProto; @class PBEnumDescriptorProtoBuilder; @class PBEnumOptions; @class PBEnumOptionsBuilder; @class PBEnumValueDescriptorProto; @class PBEnumValueDescriptorProtoBuilder; @class PBEnumValueOptions; @class PBEnumValueOptionsBuilder; @class PBFieldDescriptorProto; @class PBFieldDescriptorProtoBuilder; @class PBFieldOptions; @class PBFieldOptionsBuilder; @class PBFileDescriptorProto; @class PBFileDescriptorProtoBuilder; @class PBFileDescriptorSet; @class PBFileDescriptorSetBuilder; @class PBFileOptions; @class PBFileOptionsBuilder; @class PBMessageOptions; @class PBMessageOptionsBuilder; @class PBMethodDescriptorProto; @class PBMethodDescriptorProtoBuilder; @class PBMethodOptions; @class PBMethodOptionsBuilder; @class PBOneofDescriptorProto; @class PBOneofDescriptorProtoBuilder; @class PBServiceDescriptorProto; @class PBServiceDescriptorProtoBuilder; @class PBServiceOptions; @class PBServiceOptionsBuilder; @class PBSourceCodeInfo; @class PBSourceCodeInfoBuilder; @class PBSourceCodeInfoLocation; @class PBSourceCodeInfoLocationBuilder; @class PBUninterpretedOption; @class PBUninterpretedOptionBuilder; @class PBUninterpretedOptionNamePart; @class PBUninterpretedOptionNamePartBuilder; typedef NS_ENUM(SInt32, PBFieldDescriptorProtoType) { PBFieldDescriptorProtoTypeTypeDouble = 1, PBFieldDescriptorProtoTypeTypeFloat = 2, PBFieldDescriptorProtoTypeTypeInt64 = 3, PBFieldDescriptorProtoTypeTypeUint64 = 4, PBFieldDescriptorProtoTypeTypeInt32 = 5, PBFieldDescriptorProtoTypeTypeFixed64 = 6, PBFieldDescriptorProtoTypeTypeFixed32 = 7, PBFieldDescriptorProtoTypeTypeBool = 8, PBFieldDescriptorProtoTypeTypeString = 9, PBFieldDescriptorProtoTypeTypeGroup = 10, PBFieldDescriptorProtoTypeTypeMessage = 11, PBFieldDescriptorProtoTypeTypeBytes = 12, PBFieldDescriptorProtoTypeTypeUint32 = 13, PBFieldDescriptorProtoTypeTypeEnum = 14, PBFieldDescriptorProtoTypeTypeSfixed32 = 15, PBFieldDescriptorProtoTypeTypeSfixed64 = 16, PBFieldDescriptorProtoTypeTypeSint32 = 17, PBFieldDescriptorProtoTypeTypeSint64 = 18, }; BOOL PBFieldDescriptorProtoTypeIsValidValue(PBFieldDescriptorProtoType value); NSString *NSStringFromPBFieldDescriptorProtoType(PBFieldDescriptorProtoType value); typedef NS_ENUM(SInt32, PBFieldDescriptorProtoLabel) { PBFieldDescriptorProtoLabelLabelOptional = 1, PBFieldDescriptorProtoLabelLabelRequired = 2, PBFieldDescriptorProtoLabelLabelRepeated = 3, }; BOOL PBFieldDescriptorProtoLabelIsValidValue(PBFieldDescriptorProtoLabel value); NSString *NSStringFromPBFieldDescriptorProtoLabel(PBFieldDescriptorProtoLabel value); typedef NS_ENUM(SInt32, PBFileOptionsOptimizeMode) { PBFileOptionsOptimizeModeSpeed = 1, PBFileOptionsOptimizeModeCodeSize = 2, PBFileOptionsOptimizeModeLiteRuntime = 3, }; BOOL PBFileOptionsOptimizeModeIsValidValue(PBFileOptionsOptimizeMode value); NSString *NSStringFromPBFileOptionsOptimizeMode(PBFileOptionsOptimizeMode value); typedef NS_ENUM(SInt32, PBFieldOptionsCType) { PBFieldOptionsCTypeString = 0, PBFieldOptionsCTypeCord = 1, PBFieldOptionsCTypeStringPiece = 2, }; BOOL PBFieldOptionsCTypeIsValidValue(PBFieldOptionsCType value); NSString *NSStringFromPBFieldOptionsCType(PBFieldOptionsCType value); @interface PBDescriptorRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define FileDescriptorSet_file @"file" @interface PBFileDescriptorSet : PBGeneratedMessage { @private NSMutableArray * fileArray; } @property (readonly, strong) NSArray * file; - (PBFileDescriptorProto*)fileAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBFileDescriptorSetBuilder*) builder; + (PBFileDescriptorSetBuilder*) builder; + (PBFileDescriptorSetBuilder*) builderWithPrototype:(PBFileDescriptorSet*) prototype; - (PBFileDescriptorSetBuilder*) toBuilder; + (PBFileDescriptorSet*) parseFromData:(NSData*) data; + (PBFileDescriptorSet*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFileDescriptorSet*) parseFromInputStream:(NSInputStream*) input; + (PBFileDescriptorSet*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFileDescriptorSet*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBFileDescriptorSet*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBFileDescriptorSetBuilder : PBGeneratedMessageBuilder { @private PBFileDescriptorSet* resultFileDescriptorSet; } - (PBFileDescriptorSet*) defaultInstance; - (PBFileDescriptorSetBuilder*) clear; - (PBFileDescriptorSetBuilder*) clone; - (PBFileDescriptorSet*) build; - (PBFileDescriptorSet*) buildPartial; - (PBFileDescriptorSetBuilder*) mergeFrom:(PBFileDescriptorSet*) other; - (PBFileDescriptorSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBFileDescriptorSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)file; - (PBFileDescriptorProto*)fileAtIndex:(NSUInteger)index; - (PBFileDescriptorSetBuilder *)addFile:(PBFileDescriptorProto*)value; - (PBFileDescriptorSetBuilder *)setFileArray:(NSArray *)array; - (PBFileDescriptorSetBuilder *)clearFile; @end #define FileDescriptorProto_name @"name" #define FileDescriptorProto_package @"package" #define FileDescriptorProto_dependency @"dependency" #define FileDescriptorProto_public_dependency @"publicDependency" #define FileDescriptorProto_weak_dependency @"weakDependency" #define FileDescriptorProto_message_type @"messageType" #define FileDescriptorProto_enum_type @"enumType" #define FileDescriptorProto_service @"service" #define FileDescriptorProto_extension @"extension" #define FileDescriptorProto_options @"options" #define FileDescriptorProto_source_code_info @"sourceCodeInfo" @interface PBFileDescriptorProto : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasPackage_:1; BOOL hasOptions_:1; BOOL hasSourceCodeInfo_:1; NSString* name; NSString* package; PBFileOptions* options; PBSourceCodeInfo* sourceCodeInfo; PBAppendableArray * publicDependencyArray; PBAppendableArray * weakDependencyArray; NSMutableArray * dependencyArray; NSMutableArray * messageTypeArray; NSMutableArray * enumTypeArray; NSMutableArray * serviceArray; NSMutableArray * extensionArray; } - (BOOL) hasName; - (BOOL) hasPackage; - (BOOL) hasOptions; - (BOOL) hasSourceCodeInfo; @property (readonly, strong) NSString* name; @property (readonly, strong) NSString* package; @property (readonly, strong) NSArray * dependency; @property (readonly, strong) PBArray * publicDependency; @property (readonly, strong) PBArray * weakDependency; @property (readonly, strong) NSArray * messageType; @property (readonly, strong) NSArray * enumType; @property (readonly, strong) NSArray * service; @property (readonly, strong) NSArray * extension; @property (readonly, strong) PBFileOptions* options; @property (readonly, strong) PBSourceCodeInfo* sourceCodeInfo; - (NSString*)dependencyAtIndex:(NSUInteger)index; - (SInt32)publicDependencyAtIndex:(NSUInteger)index; - (SInt32)weakDependencyAtIndex:(NSUInteger)index; - (PBDescriptorProto*)messageTypeAtIndex:(NSUInteger)index; - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index; - (PBServiceDescriptorProto*)serviceAtIndex:(NSUInteger)index; - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBFileDescriptorProtoBuilder*) builder; + (PBFileDescriptorProtoBuilder*) builder; + (PBFileDescriptorProtoBuilder*) builderWithPrototype:(PBFileDescriptorProto*) prototype; - (PBFileDescriptorProtoBuilder*) toBuilder; + (PBFileDescriptorProto*) parseFromData:(NSData*) data; + (PBFileDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFileDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBFileDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFileDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBFileDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBFileDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBFileDescriptorProto* resultFileDescriptorProto; } - (PBFileDescriptorProto*) defaultInstance; - (PBFileDescriptorProtoBuilder*) clear; - (PBFileDescriptorProtoBuilder*) clone; - (PBFileDescriptorProto*) build; - (PBFileDescriptorProto*) buildPartial; - (PBFileDescriptorProtoBuilder*) mergeFrom:(PBFileDescriptorProto*) other; - (PBFileDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBFileDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBFileDescriptorProtoBuilder*) setName:(NSString*) value; - (PBFileDescriptorProtoBuilder*) clearName; - (BOOL) hasPackage; - (NSString*) package; - (PBFileDescriptorProtoBuilder*) setPackage:(NSString*) value; - (PBFileDescriptorProtoBuilder*) clearPackage; - (NSMutableArray *)dependency; - (NSString*)dependencyAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addDependency:(NSString*)value; - (PBFileDescriptorProtoBuilder *)setDependencyArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)clearDependency; - (PBAppendableArray *)publicDependency; - (SInt32)publicDependencyAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addPublicDependency:(SInt32)value; - (PBFileDescriptorProtoBuilder *)setPublicDependencyArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)setPublicDependencyValues:(const SInt32 *)values count:(NSUInteger)count; - (PBFileDescriptorProtoBuilder *)clearPublicDependency; - (PBAppendableArray *)weakDependency; - (SInt32)weakDependencyAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addWeakDependency:(SInt32)value; - (PBFileDescriptorProtoBuilder *)setWeakDependencyArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)setWeakDependencyValues:(const SInt32 *)values count:(NSUInteger)count; - (PBFileDescriptorProtoBuilder *)clearWeakDependency; - (NSMutableArray *)messageType; - (PBDescriptorProto*)messageTypeAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addMessageType:(PBDescriptorProto*)value; - (PBFileDescriptorProtoBuilder *)setMessageTypeArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)clearMessageType; - (NSMutableArray *)enumType; - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addEnumType:(PBEnumDescriptorProto*)value; - (PBFileDescriptorProtoBuilder *)setEnumTypeArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)clearEnumType; - (NSMutableArray *)service; - (PBServiceDescriptorProto*)serviceAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addService:(PBServiceDescriptorProto*)value; - (PBFileDescriptorProtoBuilder *)setServiceArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)clearService; - (NSMutableArray *)extension; - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index; - (PBFileDescriptorProtoBuilder *)addExtension:(PBFieldDescriptorProto*)value; - (PBFileDescriptorProtoBuilder *)setExtensionArray:(NSArray *)array; - (PBFileDescriptorProtoBuilder *)clearExtension; - (BOOL) hasOptions; - (PBFileOptions*) options; - (PBFileDescriptorProtoBuilder*) setOptions:(PBFileOptions*) value; - (PBFileDescriptorProtoBuilder*) setOptionsBuilder:(PBFileOptionsBuilder*) builderForValue; - (PBFileDescriptorProtoBuilder*) mergeOptions:(PBFileOptions*) value; - (PBFileDescriptorProtoBuilder*) clearOptions; - (BOOL) hasSourceCodeInfo; - (PBSourceCodeInfo*) sourceCodeInfo; - (PBFileDescriptorProtoBuilder*) setSourceCodeInfo:(PBSourceCodeInfo*) value; - (PBFileDescriptorProtoBuilder*) setSourceCodeInfoBuilder:(PBSourceCodeInfoBuilder*) builderForValue; - (PBFileDescriptorProtoBuilder*) mergeSourceCodeInfo:(PBSourceCodeInfo*) value; - (PBFileDescriptorProtoBuilder*) clearSourceCodeInfo; @end #define DescriptorProto_name @"name" #define DescriptorProto_field @"field" #define DescriptorProto_extension @"extension" #define DescriptorProto_nested_type @"nestedType" #define DescriptorProto_enum_type @"enumType" #define DescriptorProto_extension_range @"extensionRange" #define DescriptorProto_oneof_decl @"oneofDecl" #define DescriptorProto_options @"options" @interface PBDescriptorProto : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasOptions_:1; NSString* name; PBMessageOptions* options; NSMutableArray * fieldArray; NSMutableArray * extensionArray; NSMutableArray * nestedTypeArray; NSMutableArray * enumTypeArray; NSMutableArray * extensionRangeArray; NSMutableArray * oneofDeclArray; } - (BOOL) hasName; - (BOOL) hasOptions; @property (readonly, strong) NSString* name; @property (readonly, strong) NSArray * field; @property (readonly, strong) NSArray * extension; @property (readonly, strong) NSArray * nestedType; @property (readonly, strong) NSArray * enumType; @property (readonly, strong) NSArray * extensionRange; @property (readonly, strong) NSArray * oneofDecl; @property (readonly, strong) PBMessageOptions* options; - (PBFieldDescriptorProto*)fieldAtIndex:(NSUInteger)index; - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index; - (PBDescriptorProto*)nestedTypeAtIndex:(NSUInteger)index; - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index; - (PBDescriptorProtoExtensionRange*)extensionRangeAtIndex:(NSUInteger)index; - (PBOneofDescriptorProto*)oneofDeclAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBDescriptorProtoBuilder*) builder; + (PBDescriptorProtoBuilder*) builder; + (PBDescriptorProtoBuilder*) builderWithPrototype:(PBDescriptorProto*) prototype; - (PBDescriptorProtoBuilder*) toBuilder; + (PBDescriptorProto*) parseFromData:(NSData*) data; + (PBDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end #define ExtensionRange_start @"start" #define ExtensionRange_end @"end" @interface PBDescriptorProtoExtensionRange : PBGeneratedMessage { @private BOOL hasStart_:1; BOOL hasEnd_:1; SInt32 start; SInt32 end; } - (BOOL) hasStart; - (BOOL) hasEnd; @property (readonly) SInt32 start; @property (readonly) SInt32 end; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBDescriptorProtoExtensionRangeBuilder*) builder; + (PBDescriptorProtoExtensionRangeBuilder*) builder; + (PBDescriptorProtoExtensionRangeBuilder*) builderWithPrototype:(PBDescriptorProtoExtensionRange*) prototype; - (PBDescriptorProtoExtensionRangeBuilder*) toBuilder; + (PBDescriptorProtoExtensionRange*) parseFromData:(NSData*) data; + (PBDescriptorProtoExtensionRange*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBDescriptorProtoExtensionRange*) parseFromInputStream:(NSInputStream*) input; + (PBDescriptorProtoExtensionRange*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBDescriptorProtoExtensionRange*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBDescriptorProtoExtensionRange*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBDescriptorProtoExtensionRangeBuilder : PBGeneratedMessageBuilder { @private PBDescriptorProtoExtensionRange* resultExtensionRange; } - (PBDescriptorProtoExtensionRange*) defaultInstance; - (PBDescriptorProtoExtensionRangeBuilder*) clear; - (PBDescriptorProtoExtensionRangeBuilder*) clone; - (PBDescriptorProtoExtensionRange*) build; - (PBDescriptorProtoExtensionRange*) buildPartial; - (PBDescriptorProtoExtensionRangeBuilder*) mergeFrom:(PBDescriptorProtoExtensionRange*) other; - (PBDescriptorProtoExtensionRangeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBDescriptorProtoExtensionRangeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasStart; - (SInt32) start; - (PBDescriptorProtoExtensionRangeBuilder*) setStart:(SInt32) value; - (PBDescriptorProtoExtensionRangeBuilder*) clearStart; - (BOOL) hasEnd; - (SInt32) end; - (PBDescriptorProtoExtensionRangeBuilder*) setEnd:(SInt32) value; - (PBDescriptorProtoExtensionRangeBuilder*) clearEnd; @end @interface PBDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBDescriptorProto* resultDescriptorProto; } - (PBDescriptorProto*) defaultInstance; - (PBDescriptorProtoBuilder*) clear; - (PBDescriptorProtoBuilder*) clone; - (PBDescriptorProto*) build; - (PBDescriptorProto*) buildPartial; - (PBDescriptorProtoBuilder*) mergeFrom:(PBDescriptorProto*) other; - (PBDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBDescriptorProtoBuilder*) setName:(NSString*) value; - (PBDescriptorProtoBuilder*) clearName; - (NSMutableArray *)field; - (PBFieldDescriptorProto*)fieldAtIndex:(NSUInteger)index; - (PBDescriptorProtoBuilder *)addField:(PBFieldDescriptorProto*)value; - (PBDescriptorProtoBuilder *)setFieldArray:(NSArray *)array; - (PBDescriptorProtoBuilder *)clearField; - (NSMutableArray *)extension; - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index; - (PBDescriptorProtoBuilder *)addExtension:(PBFieldDescriptorProto*)value; - (PBDescriptorProtoBuilder *)setExtensionArray:(NSArray *)array; - (PBDescriptorProtoBuilder *)clearExtension; - (NSMutableArray *)nestedType; - (PBDescriptorProto*)nestedTypeAtIndex:(NSUInteger)index; - (PBDescriptorProtoBuilder *)addNestedType:(PBDescriptorProto*)value; - (PBDescriptorProtoBuilder *)setNestedTypeArray:(NSArray *)array; - (PBDescriptorProtoBuilder *)clearNestedType; - (NSMutableArray *)enumType; - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index; - (PBDescriptorProtoBuilder *)addEnumType:(PBEnumDescriptorProto*)value; - (PBDescriptorProtoBuilder *)setEnumTypeArray:(NSArray *)array; - (PBDescriptorProtoBuilder *)clearEnumType; - (NSMutableArray *)extensionRange; - (PBDescriptorProtoExtensionRange*)extensionRangeAtIndex:(NSUInteger)index; - (PBDescriptorProtoBuilder *)addExtensionRange:(PBDescriptorProtoExtensionRange*)value; - (PBDescriptorProtoBuilder *)setExtensionRangeArray:(NSArray *)array; - (PBDescriptorProtoBuilder *)clearExtensionRange; - (NSMutableArray *)oneofDecl; - (PBOneofDescriptorProto*)oneofDeclAtIndex:(NSUInteger)index; - (PBDescriptorProtoBuilder *)addOneofDecl:(PBOneofDescriptorProto*)value; - (PBDescriptorProtoBuilder *)setOneofDeclArray:(NSArray *)array; - (PBDescriptorProtoBuilder *)clearOneofDecl; - (BOOL) hasOptions; - (PBMessageOptions*) options; - (PBDescriptorProtoBuilder*) setOptions:(PBMessageOptions*) value; - (PBDescriptorProtoBuilder*) setOptionsBuilder:(PBMessageOptionsBuilder*) builderForValue; - (PBDescriptorProtoBuilder*) mergeOptions:(PBMessageOptions*) value; - (PBDescriptorProtoBuilder*) clearOptions; @end #define FieldDescriptorProto_name @"name" #define FieldDescriptorProto_number @"number" #define FieldDescriptorProto_label @"label" #define FieldDescriptorProto_type @"type" #define FieldDescriptorProto_type_name @"typeName" #define FieldDescriptorProto_extendee @"extendee" #define FieldDescriptorProto_default_value @"defaultValue" #define FieldDescriptorProto_oneof_index @"oneofIndex" #define FieldDescriptorProto_options @"options" @interface PBFieldDescriptorProto : PBGeneratedMessage { @private BOOL hasNumber_:1; BOOL hasOneofIndex_:1; BOOL hasName_:1; BOOL hasTypeName_:1; BOOL hasExtendee_:1; BOOL hasDefaultValue_:1; BOOL hasOptions_:1; BOOL hasLabel_:1; BOOL hasType_:1; SInt32 number; SInt32 oneofIndex; NSString* name; NSString* typeName; NSString* extendee; NSString* defaultValue; PBFieldOptions* options; PBFieldDescriptorProtoLabel label; PBFieldDescriptorProtoType type; } - (BOOL) hasName; - (BOOL) hasNumber; - (BOOL) hasLabel; - (BOOL) hasType; - (BOOL) hasTypeName; - (BOOL) hasExtendee; - (BOOL) hasDefaultValue; - (BOOL) hasOneofIndex; - (BOOL) hasOptions; @property (readonly, strong) NSString* name; @property (readonly) SInt32 number; @property (readonly) PBFieldDescriptorProtoLabel label; @property (readonly) PBFieldDescriptorProtoType type; @property (readonly, strong) NSString* typeName; @property (readonly, strong) NSString* extendee; @property (readonly, strong) NSString* defaultValue; @property (readonly) SInt32 oneofIndex; @property (readonly, strong) PBFieldOptions* options; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBFieldDescriptorProtoBuilder*) builder; + (PBFieldDescriptorProtoBuilder*) builder; + (PBFieldDescriptorProtoBuilder*) builderWithPrototype:(PBFieldDescriptorProto*) prototype; - (PBFieldDescriptorProtoBuilder*) toBuilder; + (PBFieldDescriptorProto*) parseFromData:(NSData*) data; + (PBFieldDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFieldDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBFieldDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFieldDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBFieldDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBFieldDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBFieldDescriptorProto* resultFieldDescriptorProto; } - (PBFieldDescriptorProto*) defaultInstance; - (PBFieldDescriptorProtoBuilder*) clear; - (PBFieldDescriptorProtoBuilder*) clone; - (PBFieldDescriptorProto*) build; - (PBFieldDescriptorProto*) buildPartial; - (PBFieldDescriptorProtoBuilder*) mergeFrom:(PBFieldDescriptorProto*) other; - (PBFieldDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBFieldDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBFieldDescriptorProtoBuilder*) setName:(NSString*) value; - (PBFieldDescriptorProtoBuilder*) clearName; - (BOOL) hasNumber; - (SInt32) number; - (PBFieldDescriptorProtoBuilder*) setNumber:(SInt32) value; - (PBFieldDescriptorProtoBuilder*) clearNumber; - (BOOL) hasLabel; - (PBFieldDescriptorProtoLabel) label; - (PBFieldDescriptorProtoBuilder*) setLabel:(PBFieldDescriptorProtoLabel) value; - (PBFieldDescriptorProtoBuilder*) clearLabel; - (BOOL) hasType; - (PBFieldDescriptorProtoType) type; - (PBFieldDescriptorProtoBuilder*) setType:(PBFieldDescriptorProtoType) value; - (PBFieldDescriptorProtoBuilder*) clearType; - (BOOL) hasTypeName; - (NSString*) typeName; - (PBFieldDescriptorProtoBuilder*) setTypeName:(NSString*) value; - (PBFieldDescriptorProtoBuilder*) clearTypeName; - (BOOL) hasExtendee; - (NSString*) extendee; - (PBFieldDescriptorProtoBuilder*) setExtendee:(NSString*) value; - (PBFieldDescriptorProtoBuilder*) clearExtendee; - (BOOL) hasDefaultValue; - (NSString*) defaultValue; - (PBFieldDescriptorProtoBuilder*) setDefaultValue:(NSString*) value; - (PBFieldDescriptorProtoBuilder*) clearDefaultValue; - (BOOL) hasOneofIndex; - (SInt32) oneofIndex; - (PBFieldDescriptorProtoBuilder*) setOneofIndex:(SInt32) value; - (PBFieldDescriptorProtoBuilder*) clearOneofIndex; - (BOOL) hasOptions; - (PBFieldOptions*) options; - (PBFieldDescriptorProtoBuilder*) setOptions:(PBFieldOptions*) value; - (PBFieldDescriptorProtoBuilder*) setOptionsBuilder:(PBFieldOptionsBuilder*) builderForValue; - (PBFieldDescriptorProtoBuilder*) mergeOptions:(PBFieldOptions*) value; - (PBFieldDescriptorProtoBuilder*) clearOptions; @end #define OneofDescriptorProto_name @"name" @interface PBOneofDescriptorProto : PBGeneratedMessage { @private BOOL hasName_:1; NSString* name; } - (BOOL) hasName; @property (readonly, strong) NSString* name; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBOneofDescriptorProtoBuilder*) builder; + (PBOneofDescriptorProtoBuilder*) builder; + (PBOneofDescriptorProtoBuilder*) builderWithPrototype:(PBOneofDescriptorProto*) prototype; - (PBOneofDescriptorProtoBuilder*) toBuilder; + (PBOneofDescriptorProto*) parseFromData:(NSData*) data; + (PBOneofDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBOneofDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBOneofDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBOneofDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBOneofDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBOneofDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBOneofDescriptorProto* resultOneofDescriptorProto; } - (PBOneofDescriptorProto*) defaultInstance; - (PBOneofDescriptorProtoBuilder*) clear; - (PBOneofDescriptorProtoBuilder*) clone; - (PBOneofDescriptorProto*) build; - (PBOneofDescriptorProto*) buildPartial; - (PBOneofDescriptorProtoBuilder*) mergeFrom:(PBOneofDescriptorProto*) other; - (PBOneofDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBOneofDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBOneofDescriptorProtoBuilder*) setName:(NSString*) value; - (PBOneofDescriptorProtoBuilder*) clearName; @end #define EnumDescriptorProto_name @"name" #define EnumDescriptorProto_value @"value" #define EnumDescriptorProto_options @"options" @interface PBEnumDescriptorProto : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasOptions_:1; NSString* name; PBEnumOptions* options; NSMutableArray * valueArray; } - (BOOL) hasName; - (BOOL) hasOptions; @property (readonly, strong) NSString* name; @property (readonly, strong) NSArray * value; @property (readonly, strong) PBEnumOptions* options; - (PBEnumValueDescriptorProto*)valueAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBEnumDescriptorProtoBuilder*) builder; + (PBEnumDescriptorProtoBuilder*) builder; + (PBEnumDescriptorProtoBuilder*) builderWithPrototype:(PBEnumDescriptorProto*) prototype; - (PBEnumDescriptorProtoBuilder*) toBuilder; + (PBEnumDescriptorProto*) parseFromData:(NSData*) data; + (PBEnumDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBEnumDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBEnumDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBEnumDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBEnumDescriptorProto* resultEnumDescriptorProto; } - (PBEnumDescriptorProto*) defaultInstance; - (PBEnumDescriptorProtoBuilder*) clear; - (PBEnumDescriptorProtoBuilder*) clone; - (PBEnumDescriptorProto*) build; - (PBEnumDescriptorProto*) buildPartial; - (PBEnumDescriptorProtoBuilder*) mergeFrom:(PBEnumDescriptorProto*) other; - (PBEnumDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBEnumDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBEnumDescriptorProtoBuilder*) setName:(NSString*) value; - (PBEnumDescriptorProtoBuilder*) clearName; - (NSMutableArray *)value; - (PBEnumValueDescriptorProto*)valueAtIndex:(NSUInteger)index; - (PBEnumDescriptorProtoBuilder *)addValue:(PBEnumValueDescriptorProto*)value; - (PBEnumDescriptorProtoBuilder *)setValueArray:(NSArray *)array; - (PBEnumDescriptorProtoBuilder *)clearValue; - (BOOL) hasOptions; - (PBEnumOptions*) options; - (PBEnumDescriptorProtoBuilder*) setOptions:(PBEnumOptions*) value; - (PBEnumDescriptorProtoBuilder*) setOptionsBuilder:(PBEnumOptionsBuilder*) builderForValue; - (PBEnumDescriptorProtoBuilder*) mergeOptions:(PBEnumOptions*) value; - (PBEnumDescriptorProtoBuilder*) clearOptions; @end #define EnumValueDescriptorProto_name @"name" #define EnumValueDescriptorProto_number @"number" #define EnumValueDescriptorProto_options @"options" @interface PBEnumValueDescriptorProto : PBGeneratedMessage { @private BOOL hasNumber_:1; BOOL hasName_:1; BOOL hasOptions_:1; SInt32 number; NSString* name; PBEnumValueOptions* options; } - (BOOL) hasName; - (BOOL) hasNumber; - (BOOL) hasOptions; @property (readonly, strong) NSString* name; @property (readonly) SInt32 number; @property (readonly, strong) PBEnumValueOptions* options; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBEnumValueDescriptorProtoBuilder*) builder; + (PBEnumValueDescriptorProtoBuilder*) builder; + (PBEnumValueDescriptorProtoBuilder*) builderWithPrototype:(PBEnumValueDescriptorProto*) prototype; - (PBEnumValueDescriptorProtoBuilder*) toBuilder; + (PBEnumValueDescriptorProto*) parseFromData:(NSData*) data; + (PBEnumValueDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumValueDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBEnumValueDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumValueDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBEnumValueDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBEnumValueDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBEnumValueDescriptorProto* resultEnumValueDescriptorProto; } - (PBEnumValueDescriptorProto*) defaultInstance; - (PBEnumValueDescriptorProtoBuilder*) clear; - (PBEnumValueDescriptorProtoBuilder*) clone; - (PBEnumValueDescriptorProto*) build; - (PBEnumValueDescriptorProto*) buildPartial; - (PBEnumValueDescriptorProtoBuilder*) mergeFrom:(PBEnumValueDescriptorProto*) other; - (PBEnumValueDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBEnumValueDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBEnumValueDescriptorProtoBuilder*) setName:(NSString*) value; - (PBEnumValueDescriptorProtoBuilder*) clearName; - (BOOL) hasNumber; - (SInt32) number; - (PBEnumValueDescriptorProtoBuilder*) setNumber:(SInt32) value; - (PBEnumValueDescriptorProtoBuilder*) clearNumber; - (BOOL) hasOptions; - (PBEnumValueOptions*) options; - (PBEnumValueDescriptorProtoBuilder*) setOptions:(PBEnumValueOptions*) value; - (PBEnumValueDescriptorProtoBuilder*) setOptionsBuilder:(PBEnumValueOptionsBuilder*) builderForValue; - (PBEnumValueDescriptorProtoBuilder*) mergeOptions:(PBEnumValueOptions*) value; - (PBEnumValueDescriptorProtoBuilder*) clearOptions; @end #define ServiceDescriptorProto_name @"name" #define ServiceDescriptorProto_method @"method" #define ServiceDescriptorProto_options @"options" @interface PBServiceDescriptorProto : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasOptions_:1; NSString* name; PBServiceOptions* options; NSMutableArray * methodArray; } - (BOOL) hasName; - (BOOL) hasOptions; @property (readonly, strong) NSString* name; @property (readonly, strong) NSArray * method; @property (readonly, strong) PBServiceOptions* options; - (PBMethodDescriptorProto*)methodAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBServiceDescriptorProtoBuilder*) builder; + (PBServiceDescriptorProtoBuilder*) builder; + (PBServiceDescriptorProtoBuilder*) builderWithPrototype:(PBServiceDescriptorProto*) prototype; - (PBServiceDescriptorProtoBuilder*) toBuilder; + (PBServiceDescriptorProto*) parseFromData:(NSData*) data; + (PBServiceDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBServiceDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBServiceDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBServiceDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBServiceDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBServiceDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBServiceDescriptorProto* resultServiceDescriptorProto; } - (PBServiceDescriptorProto*) defaultInstance; - (PBServiceDescriptorProtoBuilder*) clear; - (PBServiceDescriptorProtoBuilder*) clone; - (PBServiceDescriptorProto*) build; - (PBServiceDescriptorProto*) buildPartial; - (PBServiceDescriptorProtoBuilder*) mergeFrom:(PBServiceDescriptorProto*) other; - (PBServiceDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBServiceDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBServiceDescriptorProtoBuilder*) setName:(NSString*) value; - (PBServiceDescriptorProtoBuilder*) clearName; - (NSMutableArray *)method; - (PBMethodDescriptorProto*)methodAtIndex:(NSUInteger)index; - (PBServiceDescriptorProtoBuilder *)addMethod:(PBMethodDescriptorProto*)value; - (PBServiceDescriptorProtoBuilder *)setMethodArray:(NSArray *)array; - (PBServiceDescriptorProtoBuilder *)clearMethod; - (BOOL) hasOptions; - (PBServiceOptions*) options; - (PBServiceDescriptorProtoBuilder*) setOptions:(PBServiceOptions*) value; - (PBServiceDescriptorProtoBuilder*) setOptionsBuilder:(PBServiceOptionsBuilder*) builderForValue; - (PBServiceDescriptorProtoBuilder*) mergeOptions:(PBServiceOptions*) value; - (PBServiceDescriptorProtoBuilder*) clearOptions; @end #define MethodDescriptorProto_name @"name" #define MethodDescriptorProto_input_type @"inputType" #define MethodDescriptorProto_output_type @"outputType" #define MethodDescriptorProto_options @"options" @interface PBMethodDescriptorProto : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasInputType_:1; BOOL hasOutputType_:1; BOOL hasOptions_:1; NSString* name; NSString* inputType; NSString* outputType; PBMethodOptions* options; } - (BOOL) hasName; - (BOOL) hasInputType; - (BOOL) hasOutputType; - (BOOL) hasOptions; @property (readonly, strong) NSString* name; @property (readonly, strong) NSString* inputType; @property (readonly, strong) NSString* outputType; @property (readonly, strong) PBMethodOptions* options; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBMethodDescriptorProtoBuilder*) builder; + (PBMethodDescriptorProtoBuilder*) builder; + (PBMethodDescriptorProtoBuilder*) builderWithPrototype:(PBMethodDescriptorProto*) prototype; - (PBMethodDescriptorProtoBuilder*) toBuilder; + (PBMethodDescriptorProto*) parseFromData:(NSData*) data; + (PBMethodDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBMethodDescriptorProto*) parseFromInputStream:(NSInputStream*) input; + (PBMethodDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBMethodDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBMethodDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBMethodDescriptorProtoBuilder : PBGeneratedMessageBuilder { @private PBMethodDescriptorProto* resultMethodDescriptorProto; } - (PBMethodDescriptorProto*) defaultInstance; - (PBMethodDescriptorProtoBuilder*) clear; - (PBMethodDescriptorProtoBuilder*) clone; - (PBMethodDescriptorProto*) build; - (PBMethodDescriptorProto*) buildPartial; - (PBMethodDescriptorProtoBuilder*) mergeFrom:(PBMethodDescriptorProto*) other; - (PBMethodDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBMethodDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (PBMethodDescriptorProtoBuilder*) setName:(NSString*) value; - (PBMethodDescriptorProtoBuilder*) clearName; - (BOOL) hasInputType; - (NSString*) inputType; - (PBMethodDescriptorProtoBuilder*) setInputType:(NSString*) value; - (PBMethodDescriptorProtoBuilder*) clearInputType; - (BOOL) hasOutputType; - (NSString*) outputType; - (PBMethodDescriptorProtoBuilder*) setOutputType:(NSString*) value; - (PBMethodDescriptorProtoBuilder*) clearOutputType; - (BOOL) hasOptions; - (PBMethodOptions*) options; - (PBMethodDescriptorProtoBuilder*) setOptions:(PBMethodOptions*) value; - (PBMethodDescriptorProtoBuilder*) setOptionsBuilder:(PBMethodOptionsBuilder*) builderForValue; - (PBMethodDescriptorProtoBuilder*) mergeOptions:(PBMethodOptions*) value; - (PBMethodDescriptorProtoBuilder*) clearOptions; @end #define FileOptions_java_package @"javaPackage" #define FileOptions_java_outer_classname @"javaOuterClassname" #define FileOptions_java_multiple_files @"javaMultipleFiles" #define FileOptions_java_generate_equals_and_hash @"javaGenerateEqualsAndHash" #define FileOptions_java_string_check_utf8 @"javaStringCheckUtf8" #define FileOptions_optimize_for @"optimizeFor" #define FileOptions_go_package @"goPackage" #define FileOptions_cc_generic_services @"ccGenericServices" #define FileOptions_java_generic_services @"javaGenericServices" #define FileOptions_py_generic_services @"pyGenericServices" #define FileOptions_deprecated @"deprecated" #define FileOptions_uninterpreted_option @"uninterpretedOption" @interface PBFileOptions : PBExtendableMessage { @private BOOL hasJavaMultipleFiles_:1; BOOL hasJavaGenerateEqualsAndHash_:1; BOOL hasJavaStringCheckUtf8_:1; BOOL hasCcGenericServices_:1; BOOL hasJavaGenericServices_:1; BOOL hasPyGenericServices_:1; BOOL hasDeprecated_:1; BOOL hasJavaPackage_:1; BOOL hasJavaOuterClassname_:1; BOOL hasGoPackage_:1; BOOL hasOptimizeFor_:1; BOOL javaMultipleFiles_:1; BOOL javaGenerateEqualsAndHash_:1; BOOL javaStringCheckUtf8_:1; BOOL ccGenericServices_:1; BOOL javaGenericServices_:1; BOOL pyGenericServices_:1; BOOL deprecated_:1; NSString* javaPackage; NSString* javaOuterClassname; NSString* goPackage; PBFileOptionsOptimizeMode optimizeFor; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasJavaPackage; - (BOOL) hasJavaOuterClassname; - (BOOL) hasJavaMultipleFiles; - (BOOL) hasJavaGenerateEqualsAndHash; - (BOOL) hasJavaStringCheckUtf8; - (BOOL) hasOptimizeFor; - (BOOL) hasGoPackage; - (BOOL) hasCcGenericServices; - (BOOL) hasJavaGenericServices; - (BOOL) hasPyGenericServices; - (BOOL) hasDeprecated; @property (readonly, strong) NSString* javaPackage; @property (readonly, strong) NSString* javaOuterClassname; - (BOOL) javaMultipleFiles; - (BOOL) javaGenerateEqualsAndHash; - (BOOL) javaStringCheckUtf8; @property (readonly) PBFileOptionsOptimizeMode optimizeFor; @property (readonly, strong) NSString* goPackage; - (BOOL) ccGenericServices; - (BOOL) javaGenericServices; - (BOOL) pyGenericServices; - (BOOL) deprecated; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBFileOptionsBuilder*) builder; + (PBFileOptionsBuilder*) builder; + (PBFileOptionsBuilder*) builderWithPrototype:(PBFileOptions*) prototype; - (PBFileOptionsBuilder*) toBuilder; + (PBFileOptions*) parseFromData:(NSData*) data; + (PBFileOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFileOptions*) parseFromInputStream:(NSInputStream*) input; + (PBFileOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBFileOptionsBuilder : PBExtendableMessageBuilder { @private PBFileOptions* resultFileOptions; } - (PBFileOptions*) defaultInstance; - (PBFileOptionsBuilder*) clear; - (PBFileOptionsBuilder*) clone; - (PBFileOptions*) build; - (PBFileOptions*) buildPartial; - (PBFileOptionsBuilder*) mergeFrom:(PBFileOptions*) other; - (PBFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasJavaPackage; - (NSString*) javaPackage; - (PBFileOptionsBuilder*) setJavaPackage:(NSString*) value; - (PBFileOptionsBuilder*) clearJavaPackage; - (BOOL) hasJavaOuterClassname; - (NSString*) javaOuterClassname; - (PBFileOptionsBuilder*) setJavaOuterClassname:(NSString*) value; - (PBFileOptionsBuilder*) clearJavaOuterClassname; - (BOOL) hasJavaMultipleFiles; - (BOOL) javaMultipleFiles; - (PBFileOptionsBuilder*) setJavaMultipleFiles:(BOOL) value; - (PBFileOptionsBuilder*) clearJavaMultipleFiles; - (BOOL) hasJavaGenerateEqualsAndHash; - (BOOL) javaGenerateEqualsAndHash; - (PBFileOptionsBuilder*) setJavaGenerateEqualsAndHash:(BOOL) value; - (PBFileOptionsBuilder*) clearJavaGenerateEqualsAndHash; - (BOOL) hasJavaStringCheckUtf8; - (BOOL) javaStringCheckUtf8; - (PBFileOptionsBuilder*) setJavaStringCheckUtf8:(BOOL) value; - (PBFileOptionsBuilder*) clearJavaStringCheckUtf8; - (BOOL) hasOptimizeFor; - (PBFileOptionsOptimizeMode) optimizeFor; - (PBFileOptionsBuilder*) setOptimizeFor:(PBFileOptionsOptimizeMode) value; - (PBFileOptionsBuilder*) clearOptimizeFor; - (BOOL) hasGoPackage; - (NSString*) goPackage; - (PBFileOptionsBuilder*) setGoPackage:(NSString*) value; - (PBFileOptionsBuilder*) clearGoPackage; - (BOOL) hasCcGenericServices; - (BOOL) ccGenericServices; - (PBFileOptionsBuilder*) setCcGenericServices:(BOOL) value; - (PBFileOptionsBuilder*) clearCcGenericServices; - (BOOL) hasJavaGenericServices; - (BOOL) javaGenericServices; - (PBFileOptionsBuilder*) setJavaGenericServices:(BOOL) value; - (PBFileOptionsBuilder*) clearJavaGenericServices; - (BOOL) hasPyGenericServices; - (BOOL) pyGenericServices; - (PBFileOptionsBuilder*) setPyGenericServices:(BOOL) value; - (PBFileOptionsBuilder*) clearPyGenericServices; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBFileOptionsBuilder*) setDeprecated:(BOOL) value; - (PBFileOptionsBuilder*) clearDeprecated; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBFileOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBFileOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBFileOptionsBuilder *)clearUninterpretedOption; @end #define MessageOptions_message_set_wire_format @"messageSetWireFormat" #define MessageOptions_no_standard_descriptor_accessor @"noStandardDescriptorAccessor" #define MessageOptions_deprecated @"deprecated" #define MessageOptions_uninterpreted_option @"uninterpretedOption" @interface PBMessageOptions : PBExtendableMessage { @private BOOL hasMessageSetWireFormat_:1; BOOL hasNoStandardDescriptorAccessor_:1; BOOL hasDeprecated_:1; BOOL messageSetWireFormat_:1; BOOL noStandardDescriptorAccessor_:1; BOOL deprecated_:1; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasMessageSetWireFormat; - (BOOL) hasNoStandardDescriptorAccessor; - (BOOL) hasDeprecated; - (BOOL) messageSetWireFormat; - (BOOL) noStandardDescriptorAccessor; - (BOOL) deprecated; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBMessageOptionsBuilder*) builder; + (PBMessageOptionsBuilder*) builder; + (PBMessageOptionsBuilder*) builderWithPrototype:(PBMessageOptions*) prototype; - (PBMessageOptionsBuilder*) toBuilder; + (PBMessageOptions*) parseFromData:(NSData*) data; + (PBMessageOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBMessageOptions*) parseFromInputStream:(NSInputStream*) input; + (PBMessageOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBMessageOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBMessageOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBMessageOptionsBuilder : PBExtendableMessageBuilder { @private PBMessageOptions* resultMessageOptions; } - (PBMessageOptions*) defaultInstance; - (PBMessageOptionsBuilder*) clear; - (PBMessageOptionsBuilder*) clone; - (PBMessageOptions*) build; - (PBMessageOptions*) buildPartial; - (PBMessageOptionsBuilder*) mergeFrom:(PBMessageOptions*) other; - (PBMessageOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBMessageOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasMessageSetWireFormat; - (BOOL) messageSetWireFormat; - (PBMessageOptionsBuilder*) setMessageSetWireFormat:(BOOL) value; - (PBMessageOptionsBuilder*) clearMessageSetWireFormat; - (BOOL) hasNoStandardDescriptorAccessor; - (BOOL) noStandardDescriptorAccessor; - (PBMessageOptionsBuilder*) setNoStandardDescriptorAccessor:(BOOL) value; - (PBMessageOptionsBuilder*) clearNoStandardDescriptorAccessor; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBMessageOptionsBuilder*) setDeprecated:(BOOL) value; - (PBMessageOptionsBuilder*) clearDeprecated; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBMessageOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBMessageOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBMessageOptionsBuilder *)clearUninterpretedOption; @end #define FieldOptions_ctype @"ctype" #define FieldOptions_packed @"packed" #define FieldOptions_lazy @"lazy" #define FieldOptions_deprecated @"deprecated" #define FieldOptions_experimental_map_key @"experimentalMapKey" #define FieldOptions_weak @"weak" #define FieldOptions_uninterpreted_option @"uninterpretedOption" @interface PBFieldOptions : PBExtendableMessage { @private BOOL hasPacked_:1; BOOL hasLazy_:1; BOOL hasDeprecated_:1; BOOL hasWeak_:1; BOOL hasExperimentalMapKey_:1; BOOL hasCtype_:1; BOOL packed_:1; BOOL lazy_:1; BOOL deprecated_:1; BOOL weak_:1; NSString* experimentalMapKey; PBFieldOptionsCType ctype; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasCtype; - (BOOL) hasPacked; - (BOOL) hasLazy; - (BOOL) hasDeprecated; - (BOOL) hasExperimentalMapKey; - (BOOL) hasWeak; @property (readonly) PBFieldOptionsCType ctype; - (BOOL) packed; - (BOOL) lazy; - (BOOL) deprecated; @property (readonly, strong) NSString* experimentalMapKey; - (BOOL) weak; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBFieldOptionsBuilder*) builder; + (PBFieldOptionsBuilder*) builder; + (PBFieldOptionsBuilder*) builderWithPrototype:(PBFieldOptions*) prototype; - (PBFieldOptionsBuilder*) toBuilder; + (PBFieldOptions*) parseFromData:(NSData*) data; + (PBFieldOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFieldOptions*) parseFromInputStream:(NSInputStream*) input; + (PBFieldOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBFieldOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBFieldOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBFieldOptionsBuilder : PBExtendableMessageBuilder { @private PBFieldOptions* resultFieldOptions; } - (PBFieldOptions*) defaultInstance; - (PBFieldOptionsBuilder*) clear; - (PBFieldOptionsBuilder*) clone; - (PBFieldOptions*) build; - (PBFieldOptions*) buildPartial; - (PBFieldOptionsBuilder*) mergeFrom:(PBFieldOptions*) other; - (PBFieldOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBFieldOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCtype; - (PBFieldOptionsCType) ctype; - (PBFieldOptionsBuilder*) setCtype:(PBFieldOptionsCType) value; - (PBFieldOptionsBuilder*) clearCtype; - (BOOL) hasPacked; - (BOOL) packed; - (PBFieldOptionsBuilder*) setPacked:(BOOL) value; - (PBFieldOptionsBuilder*) clearPacked; - (BOOL) hasLazy; - (BOOL) lazy; - (PBFieldOptionsBuilder*) setLazy:(BOOL) value; - (PBFieldOptionsBuilder*) clearLazy; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBFieldOptionsBuilder*) setDeprecated:(BOOL) value; - (PBFieldOptionsBuilder*) clearDeprecated; - (BOOL) hasExperimentalMapKey; - (NSString*) experimentalMapKey; - (PBFieldOptionsBuilder*) setExperimentalMapKey:(NSString*) value; - (PBFieldOptionsBuilder*) clearExperimentalMapKey; - (BOOL) hasWeak; - (BOOL) weak; - (PBFieldOptionsBuilder*) setWeak:(BOOL) value; - (PBFieldOptionsBuilder*) clearWeak; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBFieldOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBFieldOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBFieldOptionsBuilder *)clearUninterpretedOption; @end #define EnumOptions_allow_alias @"allowAlias" #define EnumOptions_deprecated @"deprecated" #define EnumOptions_uninterpreted_option @"uninterpretedOption" @interface PBEnumOptions : PBExtendableMessage { @private BOOL hasAllowAlias_:1; BOOL hasDeprecated_:1; BOOL allowAlias_:1; BOOL deprecated_:1; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasAllowAlias; - (BOOL) hasDeprecated; - (BOOL) allowAlias; - (BOOL) deprecated; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBEnumOptionsBuilder*) builder; + (PBEnumOptionsBuilder*) builder; + (PBEnumOptionsBuilder*) builderWithPrototype:(PBEnumOptions*) prototype; - (PBEnumOptionsBuilder*) toBuilder; + (PBEnumOptions*) parseFromData:(NSData*) data; + (PBEnumOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumOptions*) parseFromInputStream:(NSInputStream*) input; + (PBEnumOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBEnumOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBEnumOptionsBuilder : PBExtendableMessageBuilder { @private PBEnumOptions* resultEnumOptions; } - (PBEnumOptions*) defaultInstance; - (PBEnumOptionsBuilder*) clear; - (PBEnumOptionsBuilder*) clone; - (PBEnumOptions*) build; - (PBEnumOptions*) buildPartial; - (PBEnumOptionsBuilder*) mergeFrom:(PBEnumOptions*) other; - (PBEnumOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBEnumOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasAllowAlias; - (BOOL) allowAlias; - (PBEnumOptionsBuilder*) setAllowAlias:(BOOL) value; - (PBEnumOptionsBuilder*) clearAllowAlias; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBEnumOptionsBuilder*) setDeprecated:(BOOL) value; - (PBEnumOptionsBuilder*) clearDeprecated; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBEnumOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBEnumOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBEnumOptionsBuilder *)clearUninterpretedOption; @end #define EnumValueOptions_deprecated @"deprecated" #define EnumValueOptions_uninterpreted_option @"uninterpretedOption" @interface PBEnumValueOptions : PBExtendableMessage { @private BOOL hasDeprecated_:1; BOOL deprecated_:1; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasDeprecated; - (BOOL) deprecated; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBEnumValueOptionsBuilder*) builder; + (PBEnumValueOptionsBuilder*) builder; + (PBEnumValueOptionsBuilder*) builderWithPrototype:(PBEnumValueOptions*) prototype; - (PBEnumValueOptionsBuilder*) toBuilder; + (PBEnumValueOptions*) parseFromData:(NSData*) data; + (PBEnumValueOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumValueOptions*) parseFromInputStream:(NSInputStream*) input; + (PBEnumValueOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBEnumValueOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBEnumValueOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBEnumValueOptionsBuilder : PBExtendableMessageBuilder { @private PBEnumValueOptions* resultEnumValueOptions; } - (PBEnumValueOptions*) defaultInstance; - (PBEnumValueOptionsBuilder*) clear; - (PBEnumValueOptionsBuilder*) clone; - (PBEnumValueOptions*) build; - (PBEnumValueOptions*) buildPartial; - (PBEnumValueOptionsBuilder*) mergeFrom:(PBEnumValueOptions*) other; - (PBEnumValueOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBEnumValueOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBEnumValueOptionsBuilder*) setDeprecated:(BOOL) value; - (PBEnumValueOptionsBuilder*) clearDeprecated; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBEnumValueOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBEnumValueOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBEnumValueOptionsBuilder *)clearUninterpretedOption; @end #define ServiceOptions_deprecated @"deprecated" #define ServiceOptions_uninterpreted_option @"uninterpretedOption" @interface PBServiceOptions : PBExtendableMessage { @private BOOL hasDeprecated_:1; BOOL deprecated_:1; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasDeprecated; - (BOOL) deprecated; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBServiceOptionsBuilder*) builder; + (PBServiceOptionsBuilder*) builder; + (PBServiceOptionsBuilder*) builderWithPrototype:(PBServiceOptions*) prototype; - (PBServiceOptionsBuilder*) toBuilder; + (PBServiceOptions*) parseFromData:(NSData*) data; + (PBServiceOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBServiceOptions*) parseFromInputStream:(NSInputStream*) input; + (PBServiceOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBServiceOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBServiceOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBServiceOptionsBuilder : PBExtendableMessageBuilder { @private PBServiceOptions* resultServiceOptions; } - (PBServiceOptions*) defaultInstance; - (PBServiceOptionsBuilder*) clear; - (PBServiceOptionsBuilder*) clone; - (PBServiceOptions*) build; - (PBServiceOptions*) buildPartial; - (PBServiceOptionsBuilder*) mergeFrom:(PBServiceOptions*) other; - (PBServiceOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBServiceOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBServiceOptionsBuilder*) setDeprecated:(BOOL) value; - (PBServiceOptionsBuilder*) clearDeprecated; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBServiceOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBServiceOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBServiceOptionsBuilder *)clearUninterpretedOption; @end #define MethodOptions_deprecated @"deprecated" #define MethodOptions_uninterpreted_option @"uninterpretedOption" @interface PBMethodOptions : PBExtendableMessage { @private BOOL hasDeprecated_:1; BOOL deprecated_:1; NSMutableArray * uninterpretedOptionArray; } - (BOOL) hasDeprecated; - (BOOL) deprecated; @property (readonly, strong) NSArray * uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBMethodOptionsBuilder*) builder; + (PBMethodOptionsBuilder*) builder; + (PBMethodOptionsBuilder*) builderWithPrototype:(PBMethodOptions*) prototype; - (PBMethodOptionsBuilder*) toBuilder; + (PBMethodOptions*) parseFromData:(NSData*) data; + (PBMethodOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBMethodOptions*) parseFromInputStream:(NSInputStream*) input; + (PBMethodOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBMethodOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBMethodOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBMethodOptionsBuilder : PBExtendableMessageBuilder { @private PBMethodOptions* resultMethodOptions; } - (PBMethodOptions*) defaultInstance; - (PBMethodOptionsBuilder*) clear; - (PBMethodOptionsBuilder*) clone; - (PBMethodOptions*) build; - (PBMethodOptions*) buildPartial; - (PBMethodOptionsBuilder*) mergeFrom:(PBMethodOptions*) other; - (PBMethodOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBMethodOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDeprecated; - (BOOL) deprecated; - (PBMethodOptionsBuilder*) setDeprecated:(BOOL) value; - (PBMethodOptionsBuilder*) clearDeprecated; - (NSMutableArray *)uninterpretedOption; - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index; - (PBMethodOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value; - (PBMethodOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array; - (PBMethodOptionsBuilder *)clearUninterpretedOption; @end #define UninterpretedOption_name @"name" #define UninterpretedOption_identifier_value @"identifierValue" #define UninterpretedOption_positive_int_value @"positiveIntValue" #define UninterpretedOption_negative_int_value @"negativeIntValue" #define UninterpretedOption_double_value @"doubleValue" #define UninterpretedOption_string_value @"stringValue" #define UninterpretedOption_aggregate_value @"aggregateValue" @interface PBUninterpretedOption : PBGeneratedMessage { @private BOOL hasDoubleValue_:1; BOOL hasNegativeIntValue_:1; BOOL hasPositiveIntValue_:1; BOOL hasIdentifierValue_:1; BOOL hasAggregateValue_:1; BOOL hasStringValue_:1; Float64 doubleValue; SInt64 negativeIntValue; UInt64 positiveIntValue; NSString* identifierValue; NSString* aggregateValue; NSData* stringValue; NSMutableArray * nameArray; } - (BOOL) hasIdentifierValue; - (BOOL) hasPositiveIntValue; - (BOOL) hasNegativeIntValue; - (BOOL) hasDoubleValue; - (BOOL) hasStringValue; - (BOOL) hasAggregateValue; @property (readonly, strong) NSArray * name; @property (readonly, strong) NSString* identifierValue; @property (readonly) UInt64 positiveIntValue; @property (readonly) SInt64 negativeIntValue; @property (readonly) Float64 doubleValue; @property (readonly, strong) NSData* stringValue; @property (readonly, strong) NSString* aggregateValue; - (PBUninterpretedOptionNamePart*)nameAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBUninterpretedOptionBuilder*) builder; + (PBUninterpretedOptionBuilder*) builder; + (PBUninterpretedOptionBuilder*) builderWithPrototype:(PBUninterpretedOption*) prototype; - (PBUninterpretedOptionBuilder*) toBuilder; + (PBUninterpretedOption*) parseFromData:(NSData*) data; + (PBUninterpretedOption*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBUninterpretedOption*) parseFromInputStream:(NSInputStream*) input; + (PBUninterpretedOption*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBUninterpretedOption*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBUninterpretedOption*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end #define NamePart_name_part @"namePart" #define NamePart_is_extension @"isExtension" @interface PBUninterpretedOptionNamePart : PBGeneratedMessage { @private BOOL hasIsExtension_:1; BOOL hasNamePart_:1; BOOL isExtension_:1; NSString* namePart; } - (BOOL) hasNamePart; - (BOOL) hasIsExtension; @property (readonly, strong) NSString* namePart; - (BOOL) isExtension; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBUninterpretedOptionNamePartBuilder*) builder; + (PBUninterpretedOptionNamePartBuilder*) builder; + (PBUninterpretedOptionNamePartBuilder*) builderWithPrototype:(PBUninterpretedOptionNamePart*) prototype; - (PBUninterpretedOptionNamePartBuilder*) toBuilder; + (PBUninterpretedOptionNamePart*) parseFromData:(NSData*) data; + (PBUninterpretedOptionNamePart*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBUninterpretedOptionNamePart*) parseFromInputStream:(NSInputStream*) input; + (PBUninterpretedOptionNamePart*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBUninterpretedOptionNamePart*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBUninterpretedOptionNamePart*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBUninterpretedOptionNamePartBuilder : PBGeneratedMessageBuilder { @private PBUninterpretedOptionNamePart* resultNamePart; } - (PBUninterpretedOptionNamePart*) defaultInstance; - (PBUninterpretedOptionNamePartBuilder*) clear; - (PBUninterpretedOptionNamePartBuilder*) clone; - (PBUninterpretedOptionNamePart*) build; - (PBUninterpretedOptionNamePart*) buildPartial; - (PBUninterpretedOptionNamePartBuilder*) mergeFrom:(PBUninterpretedOptionNamePart*) other; - (PBUninterpretedOptionNamePartBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBUninterpretedOptionNamePartBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasNamePart; - (NSString*) namePart; - (PBUninterpretedOptionNamePartBuilder*) setNamePart:(NSString*) value; - (PBUninterpretedOptionNamePartBuilder*) clearNamePart; - (BOOL) hasIsExtension; - (BOOL) isExtension; - (PBUninterpretedOptionNamePartBuilder*) setIsExtension:(BOOL) value; - (PBUninterpretedOptionNamePartBuilder*) clearIsExtension; @end @interface PBUninterpretedOptionBuilder : PBGeneratedMessageBuilder { @private PBUninterpretedOption* resultUninterpretedOption; } - (PBUninterpretedOption*) defaultInstance; - (PBUninterpretedOptionBuilder*) clear; - (PBUninterpretedOptionBuilder*) clone; - (PBUninterpretedOption*) build; - (PBUninterpretedOption*) buildPartial; - (PBUninterpretedOptionBuilder*) mergeFrom:(PBUninterpretedOption*) other; - (PBUninterpretedOptionBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBUninterpretedOptionBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)name; - (PBUninterpretedOptionNamePart*)nameAtIndex:(NSUInteger)index; - (PBUninterpretedOptionBuilder *)addName:(PBUninterpretedOptionNamePart*)value; - (PBUninterpretedOptionBuilder *)setNameArray:(NSArray *)array; - (PBUninterpretedOptionBuilder *)clearName; - (BOOL) hasIdentifierValue; - (NSString*) identifierValue; - (PBUninterpretedOptionBuilder*) setIdentifierValue:(NSString*) value; - (PBUninterpretedOptionBuilder*) clearIdentifierValue; - (BOOL) hasPositiveIntValue; - (UInt64) positiveIntValue; - (PBUninterpretedOptionBuilder*) setPositiveIntValue:(UInt64) value; - (PBUninterpretedOptionBuilder*) clearPositiveIntValue; - (BOOL) hasNegativeIntValue; - (SInt64) negativeIntValue; - (PBUninterpretedOptionBuilder*) setNegativeIntValue:(SInt64) value; - (PBUninterpretedOptionBuilder*) clearNegativeIntValue; - (BOOL) hasDoubleValue; - (Float64) doubleValue; - (PBUninterpretedOptionBuilder*) setDoubleValue:(Float64) value; - (PBUninterpretedOptionBuilder*) clearDoubleValue; - (BOOL) hasStringValue; - (NSData*) stringValue; - (PBUninterpretedOptionBuilder*) setStringValue:(NSData*) value; - (PBUninterpretedOptionBuilder*) clearStringValue; - (BOOL) hasAggregateValue; - (NSString*) aggregateValue; - (PBUninterpretedOptionBuilder*) setAggregateValue:(NSString*) value; - (PBUninterpretedOptionBuilder*) clearAggregateValue; @end #define SourceCodeInfo_location @"location" @interface PBSourceCodeInfo : PBGeneratedMessage { @private NSMutableArray * locationArray; } @property (readonly, strong) NSArray * location; - (PBSourceCodeInfoLocation*)locationAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBSourceCodeInfoBuilder*) builder; + (PBSourceCodeInfoBuilder*) builder; + (PBSourceCodeInfoBuilder*) builderWithPrototype:(PBSourceCodeInfo*) prototype; - (PBSourceCodeInfoBuilder*) toBuilder; + (PBSourceCodeInfo*) parseFromData:(NSData*) data; + (PBSourceCodeInfo*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBSourceCodeInfo*) parseFromInputStream:(NSInputStream*) input; + (PBSourceCodeInfo*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBSourceCodeInfo*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBSourceCodeInfo*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end #define Location_path @"path" #define Location_span @"span" #define Location_leading_comments @"leadingComments" #define Location_trailing_comments @"trailingComments" @interface PBSourceCodeInfoLocation : PBGeneratedMessage { @private BOOL hasLeadingComments_:1; BOOL hasTrailingComments_:1; NSString* leadingComments; NSString* trailingComments; PBAppendableArray * pathArray; SInt32 pathMemoizedSerializedSize; PBAppendableArray * spanArray; SInt32 spanMemoizedSerializedSize; } - (BOOL) hasLeadingComments; - (BOOL) hasTrailingComments; @property (readonly, strong) PBArray * path; @property (readonly, strong) PBArray * span; @property (readonly, strong) NSString* leadingComments; @property (readonly, strong) NSString* trailingComments; - (SInt32)pathAtIndex:(NSUInteger)index; - (SInt32)spanAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (PBSourceCodeInfoLocationBuilder*) builder; + (PBSourceCodeInfoLocationBuilder*) builder; + (PBSourceCodeInfoLocationBuilder*) builderWithPrototype:(PBSourceCodeInfoLocation*) prototype; - (PBSourceCodeInfoLocationBuilder*) toBuilder; + (PBSourceCodeInfoLocation*) parseFromData:(NSData*) data; + (PBSourceCodeInfoLocation*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBSourceCodeInfoLocation*) parseFromInputStream:(NSInputStream*) input; + (PBSourceCodeInfoLocation*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (PBSourceCodeInfoLocation*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (PBSourceCodeInfoLocation*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBSourceCodeInfoLocationBuilder : PBGeneratedMessageBuilder { @private PBSourceCodeInfoLocation* resultLocation; } - (PBSourceCodeInfoLocation*) defaultInstance; - (PBSourceCodeInfoLocationBuilder*) clear; - (PBSourceCodeInfoLocationBuilder*) clone; - (PBSourceCodeInfoLocation*) build; - (PBSourceCodeInfoLocation*) buildPartial; - (PBSourceCodeInfoLocationBuilder*) mergeFrom:(PBSourceCodeInfoLocation*) other; - (PBSourceCodeInfoLocationBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBSourceCodeInfoLocationBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (PBAppendableArray *)path; - (SInt32)pathAtIndex:(NSUInteger)index; - (PBSourceCodeInfoLocationBuilder *)addPath:(SInt32)value; - (PBSourceCodeInfoLocationBuilder *)setPathArray:(NSArray *)array; - (PBSourceCodeInfoLocationBuilder *)setPathValues:(const SInt32 *)values count:(NSUInteger)count; - (PBSourceCodeInfoLocationBuilder *)clearPath; - (PBAppendableArray *)span; - (SInt32)spanAtIndex:(NSUInteger)index; - (PBSourceCodeInfoLocationBuilder *)addSpan:(SInt32)value; - (PBSourceCodeInfoLocationBuilder *)setSpanArray:(NSArray *)array; - (PBSourceCodeInfoLocationBuilder *)setSpanValues:(const SInt32 *)values count:(NSUInteger)count; - (PBSourceCodeInfoLocationBuilder *)clearSpan; - (BOOL) hasLeadingComments; - (NSString*) leadingComments; - (PBSourceCodeInfoLocationBuilder*) setLeadingComments:(NSString*) value; - (PBSourceCodeInfoLocationBuilder*) clearLeadingComments; - (BOOL) hasTrailingComments; - (NSString*) trailingComments; - (PBSourceCodeInfoLocationBuilder*) setTrailingComments:(NSString*) value; - (PBSourceCodeInfoLocationBuilder*) clearTrailingComments; @end @interface PBSourceCodeInfoBuilder : PBGeneratedMessageBuilder { @private PBSourceCodeInfo* resultSourceCodeInfo; } - (PBSourceCodeInfo*) defaultInstance; - (PBSourceCodeInfoBuilder*) clear; - (PBSourceCodeInfoBuilder*) clone; - (PBSourceCodeInfo*) build; - (PBSourceCodeInfo*) buildPartial; - (PBSourceCodeInfoBuilder*) mergeFrom:(PBSourceCodeInfo*) other; - (PBSourceCodeInfoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBSourceCodeInfoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)location; - (PBSourceCodeInfoLocation*)locationAtIndex:(NSUInteger)index; - (PBSourceCodeInfoBuilder *)addLocation:(PBSourceCodeInfoLocation*)value; - (PBSourceCodeInfoBuilder *)setLocationArray:(NSArray *)array; - (PBSourceCodeInfoBuilder *)clearLocation; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Descriptor.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Descriptor.pb.h" // @@protoc_insertion_point(imports) @implementation PBDescriptorRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [PBDescriptorRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end @interface PBFileDescriptorSet () @property (strong) NSMutableArray * fileArray; @end @implementation PBFileDescriptorSet @synthesize fileArray; @dynamic file; - (instancetype) init { if ((self = [super init])) { } return self; } static PBFileDescriptorSet* defaultPBFileDescriptorSetInstance = nil; + (void) initialize { if (self == [PBFileDescriptorSet class]) { defaultPBFileDescriptorSetInstance = [[PBFileDescriptorSet alloc] init]; } } + (instancetype) defaultInstance { return defaultPBFileDescriptorSetInstance; } - (instancetype) defaultInstance { return defaultPBFileDescriptorSetInstance; } - (NSArray *)file { return fileArray; } - (PBFileDescriptorProto*)fileAtIndex:(NSUInteger)index { return [fileArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitfile = YES; [self.file enumerateObjectsUsingBlock:^(PBFileDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitfile = NO; *stop = YES; } }]; if (!isInitfile) return isInitfile; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.fileArray enumerateObjectsUsingBlock:^(PBFileDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.fileArray enumerateObjectsUsingBlock:^(PBFileDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBFileDescriptorSet*) parseFromData:(NSData*) data { return (PBFileDescriptorSet*)[[[PBFileDescriptorSet builder] mergeFromData:data] build]; } + (PBFileDescriptorSet*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileDescriptorSet*)[[[PBFileDescriptorSet builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBFileDescriptorSet*) parseFromInputStream:(NSInputStream*) input { return (PBFileDescriptorSet*)[[[PBFileDescriptorSet builder] mergeFromInputStream:input] build]; } + (PBFileDescriptorSet*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileDescriptorSet*)[[[PBFileDescriptorSet builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFileDescriptorSet*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBFileDescriptorSet*)[[[PBFileDescriptorSet builder] mergeFromCodedInputStream:input] build]; } + (PBFileDescriptorSet*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileDescriptorSet*)[[[PBFileDescriptorSet builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFileDescriptorSetBuilder*) builder { return [[PBFileDescriptorSetBuilder alloc] init]; } + (PBFileDescriptorSetBuilder*) builderWithPrototype:(PBFileDescriptorSet*) prototype { return [[PBFileDescriptorSet builder] mergeFrom:prototype]; } - (PBFileDescriptorSetBuilder*) builder { return [PBFileDescriptorSet builder]; } - (PBFileDescriptorSetBuilder*) toBuilder { return [PBFileDescriptorSet builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.fileArray enumerateObjectsUsingBlock:^(PBFileDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"file"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (PBFileDescriptorProto* element in self.fileArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"file"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBFileDescriptorSet class]]) { return NO; } PBFileDescriptorSet *otherMessage = other; return [self.fileArray isEqualToArray:otherMessage.fileArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.fileArray enumerateObjectsUsingBlock:^(PBFileDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBFileDescriptorSetBuilder() @property (strong) PBFileDescriptorSet* resultFileDescriptorSet; @end @implementation PBFileDescriptorSetBuilder @synthesize resultFileDescriptorSet; - (instancetype) init { if ((self = [super init])) { self.resultFileDescriptorSet = [[PBFileDescriptorSet alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultFileDescriptorSet; } - (PBFileDescriptorSetBuilder*) clear { self.resultFileDescriptorSet = [[PBFileDescriptorSet alloc] init]; return self; } - (PBFileDescriptorSetBuilder*) clone { return [PBFileDescriptorSet builderWithPrototype:resultFileDescriptorSet]; } - (PBFileDescriptorSet*) defaultInstance { return [PBFileDescriptorSet defaultInstance]; } - (PBFileDescriptorSet*) build { [self checkInitialized]; return [self buildPartial]; } - (PBFileDescriptorSet*) buildPartial { PBFileDescriptorSet* returnMe = resultFileDescriptorSet; self.resultFileDescriptorSet = nil; return returnMe; } - (PBFileDescriptorSetBuilder*) mergeFrom:(PBFileDescriptorSet*) other { if (other == [PBFileDescriptorSet defaultInstance]) { return self; } if (other.fileArray.count > 0) { if (resultFileDescriptorSet.fileArray == nil) { resultFileDescriptorSet.fileArray = [[NSMutableArray alloc] initWithArray:other.fileArray]; } else { [resultFileDescriptorSet.fileArray addObjectsFromArray:other.fileArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBFileDescriptorSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBFileDescriptorSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { PBFileDescriptorProtoBuilder* subBuilder = [PBFileDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addFile:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)file { return resultFileDescriptorSet.fileArray; } - (PBFileDescriptorProto*)fileAtIndex:(NSUInteger)index { return [resultFileDescriptorSet fileAtIndex:index]; } - (PBFileDescriptorSetBuilder *)addFile:(PBFileDescriptorProto*)value { if (resultFileDescriptorSet.fileArray == nil) { resultFileDescriptorSet.fileArray = [[NSMutableArray alloc]init]; } [resultFileDescriptorSet.fileArray addObject:value]; return self; } - (PBFileDescriptorSetBuilder *)setFileArray:(NSArray *)array { resultFileDescriptorSet.fileArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFileDescriptorSetBuilder *)clearFile { resultFileDescriptorSet.fileArray = nil; return self; } @end @interface PBFileDescriptorProto () @property (strong) NSString* name; @property (strong) NSString* package; @property (strong) NSMutableArray * dependencyArray; @property (strong) PBAppendableArray * publicDependencyArray; @property (strong) PBAppendableArray * weakDependencyArray; @property (strong) NSMutableArray * messageTypeArray; @property (strong) NSMutableArray * enumTypeArray; @property (strong) NSMutableArray * serviceArray; @property (strong) NSMutableArray * extensionArray; @property (strong) PBFileOptions* options; @property (strong) PBSourceCodeInfo* sourceCodeInfo; @end @implementation PBFileDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasPackage { return !!hasPackage_; } - (void) setHasPackage:(BOOL) _value_ { hasPackage_ = !!_value_; } @synthesize package; @synthesize dependencyArray; @dynamic dependency; @synthesize publicDependencyArray; @dynamic publicDependency; @synthesize weakDependencyArray; @dynamic weakDependency; @synthesize messageTypeArray; @dynamic messageType; @synthesize enumTypeArray; @dynamic enumType; @synthesize serviceArray; @dynamic service; @synthesize extensionArray; @dynamic extension; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (BOOL) hasSourceCodeInfo { return !!hasSourceCodeInfo_; } - (void) setHasSourceCodeInfo:(BOOL) _value_ { hasSourceCodeInfo_ = !!_value_; } @synthesize sourceCodeInfo; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.package = @""; self.options = [PBFileOptions defaultInstance]; self.sourceCodeInfo = [PBSourceCodeInfo defaultInstance]; } return self; } static PBFileDescriptorProto* defaultPBFileDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBFileDescriptorProto class]) { defaultPBFileDescriptorProtoInstance = [[PBFileDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBFileDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBFileDescriptorProtoInstance; } - (NSArray *)dependency { return dependencyArray; } - (NSString*)dependencyAtIndex:(NSUInteger)index { return [dependencyArray objectAtIndex:index]; } - (PBArray *)publicDependency { return publicDependencyArray; } - (SInt32)publicDependencyAtIndex:(NSUInteger)index { return [publicDependencyArray int32AtIndex:index]; } - (PBArray *)weakDependency { return weakDependencyArray; } - (SInt32)weakDependencyAtIndex:(NSUInteger)index { return [weakDependencyArray int32AtIndex:index]; } - (NSArray *)messageType { return messageTypeArray; } - (PBDescriptorProto*)messageTypeAtIndex:(NSUInteger)index { return [messageTypeArray objectAtIndex:index]; } - (NSArray *)enumType { return enumTypeArray; } - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index { return [enumTypeArray objectAtIndex:index]; } - (NSArray *)service { return serviceArray; } - (PBServiceDescriptorProto*)serviceAtIndex:(NSUInteger)index { return [serviceArray objectAtIndex:index]; } - (NSArray *)extension { return extensionArray; } - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index { return [extensionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitmessageType = YES; [self.messageType enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitmessageType = NO; *stop = YES; } }]; if (!isInitmessageType) return isInitmessageType; __block BOOL isInitenumType = YES; [self.enumType enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitenumType = NO; *stop = YES; } }]; if (!isInitenumType) return isInitenumType; __block BOOL isInitservice = YES; [self.service enumerateObjectsUsingBlock:^(PBServiceDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitservice = NO; *stop = YES; } }]; if (!isInitservice) return isInitservice; __block BOOL isInitextension = YES; [self.extension enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitextension = NO; *stop = YES; } }]; if (!isInitextension) return isInitextension; if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } if (self.hasPackage) { [output writeString:2 value:self.package]; } [self.dependencyArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { [output writeString:3 value:element]; }]; [self.messageTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:4 value:element]; }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:5 value:element]; }]; [self.serviceArray enumerateObjectsUsingBlock:^(PBServiceDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:6 value:element]; }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:7 value:element]; }]; if (self.hasOptions) { [output writeMessage:8 value:self.options]; } if (self.hasSourceCodeInfo) { [output writeMessage:9 value:self.sourceCodeInfo]; } const NSUInteger publicDependencyArrayCount = self.publicDependencyArray.count; if (publicDependencyArrayCount > 0) { const SInt32 *values = (const SInt32 *)self.publicDependencyArray.data; for (NSUInteger i = 0; i < publicDependencyArrayCount; ++i) { [output writeInt32:10 value:values[i]]; } } const NSUInteger weakDependencyArrayCount = self.weakDependencyArray.count; if (weakDependencyArrayCount > 0) { const SInt32 *values = (const SInt32 *)self.weakDependencyArray.data; for (NSUInteger i = 0; i < weakDependencyArrayCount; ++i) { [output writeInt32:11 value:values[i]]; } } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } if (self.hasPackage) { size_ += computeStringSize(2, self.package); } { __block SInt32 dataSize = 0; const NSUInteger count = self.dependencyArray.count; [self.dependencyArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { dataSize += computeStringSizeNoTag(element); }]; size_ += dataSize; size_ += (SInt32)(1 * count); } [self.messageTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(4, element); }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(5, element); }]; [self.serviceArray enumerateObjectsUsingBlock:^(PBServiceDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(6, element); }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(7, element); }]; if (self.hasOptions) { size_ += computeMessageSize(8, self.options); } if (self.hasSourceCodeInfo) { size_ += computeMessageSize(9, self.sourceCodeInfo); } { __block SInt32 dataSize = 0; const NSUInteger count = self.publicDependencyArray.count; const SInt32 *values = (const SInt32 *)self.publicDependencyArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeInt32SizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } { __block SInt32 dataSize = 0; const NSUInteger count = self.weakDependencyArray.count; const SInt32 *values = (const SInt32 *)self.weakDependencyArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeInt32SizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBFileDescriptorProto*) parseFromData:(NSData*) data { return (PBFileDescriptorProto*)[[[PBFileDescriptorProto builder] mergeFromData:data] build]; } + (PBFileDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileDescriptorProto*)[[[PBFileDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBFileDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBFileDescriptorProto*)[[[PBFileDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBFileDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileDescriptorProto*)[[[PBFileDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFileDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBFileDescriptorProto*)[[[PBFileDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBFileDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileDescriptorProto*)[[[PBFileDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFileDescriptorProtoBuilder*) builder { return [[PBFileDescriptorProtoBuilder alloc] init]; } + (PBFileDescriptorProtoBuilder*) builderWithPrototype:(PBFileDescriptorProto*) prototype { return [[PBFileDescriptorProto builder] mergeFrom:prototype]; } - (PBFileDescriptorProtoBuilder*) builder { return [PBFileDescriptorProto builder]; } - (PBFileDescriptorProtoBuilder*) toBuilder { return [PBFileDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasPackage) { [output appendFormat:@"%@%@: %@\n", indent, @"package", self.package]; } [self.dependencyArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"dependency", obj]; }]; [self.messageTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"messageType"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"enumType"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.serviceArray enumerateObjectsUsingBlock:^(PBServiceDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"service"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"extension"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } if (self.hasSourceCodeInfo) { [output appendFormat:@"%@%@ {\n", indent, @"sourceCodeInfo"]; [self.sourceCodeInfo writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.publicDependencyArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"publicDependency", obj]; }]; [self.weakDependencyArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"weakDependency", obj]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasPackage) { [dictionary setObject: self.package forKey: @"package"]; } [dictionary setObject:self.dependency forKey: @"dependency"]; for (PBDescriptorProto* element in self.messageTypeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"messageType"]; } for (PBEnumDescriptorProto* element in self.enumTypeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"enumType"]; } for (PBServiceDescriptorProto* element in self.serviceArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"service"]; } for (PBFieldDescriptorProto* element in self.extensionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"extension"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } if (self.hasSourceCodeInfo) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.sourceCodeInfo storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"sourceCodeInfo"]; } NSMutableArray * publicDependencyArrayArray = [NSMutableArray new]; NSUInteger publicDependencyArrayCount=self.publicDependencyArray.count; for(int i=0;i 0) { if (resultFileDescriptorProto.dependencyArray == nil) { resultFileDescriptorProto.dependencyArray = [[NSMutableArray alloc] initWithArray:other.dependencyArray]; } else { [resultFileDescriptorProto.dependencyArray addObjectsFromArray:other.dependencyArray]; } } if (other.publicDependencyArray.count > 0) { if (resultFileDescriptorProto.publicDependencyArray == nil) { resultFileDescriptorProto.publicDependencyArray = [other.publicDependencyArray copy]; } else { [resultFileDescriptorProto.publicDependencyArray appendArray:other.publicDependencyArray]; } } if (other.weakDependencyArray.count > 0) { if (resultFileDescriptorProto.weakDependencyArray == nil) { resultFileDescriptorProto.weakDependencyArray = [other.weakDependencyArray copy]; } else { [resultFileDescriptorProto.weakDependencyArray appendArray:other.weakDependencyArray]; } } if (other.messageTypeArray.count > 0) { if (resultFileDescriptorProto.messageTypeArray == nil) { resultFileDescriptorProto.messageTypeArray = [[NSMutableArray alloc] initWithArray:other.messageTypeArray]; } else { [resultFileDescriptorProto.messageTypeArray addObjectsFromArray:other.messageTypeArray]; } } if (other.enumTypeArray.count > 0) { if (resultFileDescriptorProto.enumTypeArray == nil) { resultFileDescriptorProto.enumTypeArray = [[NSMutableArray alloc] initWithArray:other.enumTypeArray]; } else { [resultFileDescriptorProto.enumTypeArray addObjectsFromArray:other.enumTypeArray]; } } if (other.serviceArray.count > 0) { if (resultFileDescriptorProto.serviceArray == nil) { resultFileDescriptorProto.serviceArray = [[NSMutableArray alloc] initWithArray:other.serviceArray]; } else { [resultFileDescriptorProto.serviceArray addObjectsFromArray:other.serviceArray]; } } if (other.extensionArray.count > 0) { if (resultFileDescriptorProto.extensionArray == nil) { resultFileDescriptorProto.extensionArray = [[NSMutableArray alloc] initWithArray:other.extensionArray]; } else { [resultFileDescriptorProto.extensionArray addObjectsFromArray:other.extensionArray]; } } if (other.hasOptions) { [self mergeOptions:other.options]; } if (other.hasSourceCodeInfo) { [self mergeSourceCodeInfo:other.sourceCodeInfo]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBFileDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBFileDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { [self setPackage:[input readString]]; break; } case 26: { [self addDependency:[input readString]]; break; } case 34: { PBDescriptorProtoBuilder* subBuilder = [PBDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addMessageType:[subBuilder buildPartial]]; break; } case 42: { PBEnumDescriptorProtoBuilder* subBuilder = [PBEnumDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addEnumType:[subBuilder buildPartial]]; break; } case 50: { PBServiceDescriptorProtoBuilder* subBuilder = [PBServiceDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addService:[subBuilder buildPartial]]; break; } case 58: { PBFieldDescriptorProtoBuilder* subBuilder = [PBFieldDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExtension:[subBuilder buildPartial]]; break; } case 66: { PBFileOptionsBuilder* subBuilder = [PBFileOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } case 74: { PBSourceCodeInfoBuilder* subBuilder = [PBSourceCodeInfo builder]; if (self.hasSourceCodeInfo) { [subBuilder mergeFrom:self.sourceCodeInfo]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSourceCodeInfo:[subBuilder buildPartial]]; break; } case 80: { [self addPublicDependency:[input readInt32]]; break; } case 88: { [self addWeakDependency:[input readInt32]]; break; } } } } - (BOOL) hasName { return resultFileDescriptorProto.hasName; } - (NSString*) name { return resultFileDescriptorProto.name; } - (PBFileDescriptorProtoBuilder*) setName:(NSString*) value { resultFileDescriptorProto.hasName = YES; resultFileDescriptorProto.name = value; return self; } - (PBFileDescriptorProtoBuilder*) clearName { resultFileDescriptorProto.hasName = NO; resultFileDescriptorProto.name = @""; return self; } - (BOOL) hasPackage { return resultFileDescriptorProto.hasPackage; } - (NSString*) package { return resultFileDescriptorProto.package; } - (PBFileDescriptorProtoBuilder*) setPackage:(NSString*) value { resultFileDescriptorProto.hasPackage = YES; resultFileDescriptorProto.package = value; return self; } - (PBFileDescriptorProtoBuilder*) clearPackage { resultFileDescriptorProto.hasPackage = NO; resultFileDescriptorProto.package = @""; return self; } - (NSMutableArray *)dependency { return resultFileDescriptorProto.dependencyArray; } - (NSString*)dependencyAtIndex:(NSUInteger)index { return [resultFileDescriptorProto dependencyAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addDependency:(NSString*)value { if (resultFileDescriptorProto.dependencyArray == nil) { resultFileDescriptorProto.dependencyArray = [[NSMutableArray alloc]init]; } [resultFileDescriptorProto.dependencyArray addObject:value]; return self; } - (PBFileDescriptorProtoBuilder *)setDependencyArray:(NSArray *)array { resultFileDescriptorProto.dependencyArray = [[NSMutableArray alloc] initWithArray:array]; return self; } - (PBFileDescriptorProtoBuilder *)clearDependency { resultFileDescriptorProto.dependencyArray = nil; return self; } - (PBAppendableArray *)publicDependency { return resultFileDescriptorProto.publicDependencyArray; } - (SInt32)publicDependencyAtIndex:(NSUInteger)index { return [resultFileDescriptorProto publicDependencyAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addPublicDependency:(SInt32)value { if (resultFileDescriptorProto.publicDependencyArray == nil) { resultFileDescriptorProto.publicDependencyArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultFileDescriptorProto.publicDependencyArray addInt32:value]; return self; } - (PBFileDescriptorProtoBuilder *)setPublicDependencyArray:(NSArray *)array { resultFileDescriptorProto.publicDependencyArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (PBFileDescriptorProtoBuilder *)setPublicDependencyValues:(const SInt32 *)values count:(NSUInteger)count { resultFileDescriptorProto.publicDependencyArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (PBFileDescriptorProtoBuilder *)clearPublicDependency { resultFileDescriptorProto.publicDependencyArray = nil; return self; } - (PBAppendableArray *)weakDependency { return resultFileDescriptorProto.weakDependencyArray; } - (SInt32)weakDependencyAtIndex:(NSUInteger)index { return [resultFileDescriptorProto weakDependencyAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addWeakDependency:(SInt32)value { if (resultFileDescriptorProto.weakDependencyArray == nil) { resultFileDescriptorProto.weakDependencyArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultFileDescriptorProto.weakDependencyArray addInt32:value]; return self; } - (PBFileDescriptorProtoBuilder *)setWeakDependencyArray:(NSArray *)array { resultFileDescriptorProto.weakDependencyArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (PBFileDescriptorProtoBuilder *)setWeakDependencyValues:(const SInt32 *)values count:(NSUInteger)count { resultFileDescriptorProto.weakDependencyArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (PBFileDescriptorProtoBuilder *)clearWeakDependency { resultFileDescriptorProto.weakDependencyArray = nil; return self; } - (NSMutableArray *)messageType { return resultFileDescriptorProto.messageTypeArray; } - (PBDescriptorProto*)messageTypeAtIndex:(NSUInteger)index { return [resultFileDescriptorProto messageTypeAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addMessageType:(PBDescriptorProto*)value { if (resultFileDescriptorProto.messageTypeArray == nil) { resultFileDescriptorProto.messageTypeArray = [[NSMutableArray alloc]init]; } [resultFileDescriptorProto.messageTypeArray addObject:value]; return self; } - (PBFileDescriptorProtoBuilder *)setMessageTypeArray:(NSArray *)array { resultFileDescriptorProto.messageTypeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFileDescriptorProtoBuilder *)clearMessageType { resultFileDescriptorProto.messageTypeArray = nil; return self; } - (NSMutableArray *)enumType { return resultFileDescriptorProto.enumTypeArray; } - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index { return [resultFileDescriptorProto enumTypeAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addEnumType:(PBEnumDescriptorProto*)value { if (resultFileDescriptorProto.enumTypeArray == nil) { resultFileDescriptorProto.enumTypeArray = [[NSMutableArray alloc]init]; } [resultFileDescriptorProto.enumTypeArray addObject:value]; return self; } - (PBFileDescriptorProtoBuilder *)setEnumTypeArray:(NSArray *)array { resultFileDescriptorProto.enumTypeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFileDescriptorProtoBuilder *)clearEnumType { resultFileDescriptorProto.enumTypeArray = nil; return self; } - (NSMutableArray *)service { return resultFileDescriptorProto.serviceArray; } - (PBServiceDescriptorProto*)serviceAtIndex:(NSUInteger)index { return [resultFileDescriptorProto serviceAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addService:(PBServiceDescriptorProto*)value { if (resultFileDescriptorProto.serviceArray == nil) { resultFileDescriptorProto.serviceArray = [[NSMutableArray alloc]init]; } [resultFileDescriptorProto.serviceArray addObject:value]; return self; } - (PBFileDescriptorProtoBuilder *)setServiceArray:(NSArray *)array { resultFileDescriptorProto.serviceArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFileDescriptorProtoBuilder *)clearService { resultFileDescriptorProto.serviceArray = nil; return self; } - (NSMutableArray *)extension { return resultFileDescriptorProto.extensionArray; } - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index { return [resultFileDescriptorProto extensionAtIndex:index]; } - (PBFileDescriptorProtoBuilder *)addExtension:(PBFieldDescriptorProto*)value { if (resultFileDescriptorProto.extensionArray == nil) { resultFileDescriptorProto.extensionArray = [[NSMutableArray alloc]init]; } [resultFileDescriptorProto.extensionArray addObject:value]; return self; } - (PBFileDescriptorProtoBuilder *)setExtensionArray:(NSArray *)array { resultFileDescriptorProto.extensionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFileDescriptorProtoBuilder *)clearExtension { resultFileDescriptorProto.extensionArray = nil; return self; } - (BOOL) hasOptions { return resultFileDescriptorProto.hasOptions; } - (PBFileOptions*) options { return resultFileDescriptorProto.options; } - (PBFileDescriptorProtoBuilder*) setOptions:(PBFileOptions*) value { resultFileDescriptorProto.hasOptions = YES; resultFileDescriptorProto.options = value; return self; } - (PBFileDescriptorProtoBuilder*) setOptionsBuilder:(PBFileOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBFileDescriptorProtoBuilder*) mergeOptions:(PBFileOptions*) value { if (resultFileDescriptorProto.hasOptions && resultFileDescriptorProto.options != [PBFileOptions defaultInstance]) { resultFileDescriptorProto.options = [[[PBFileOptions builderWithPrototype:resultFileDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultFileDescriptorProto.options = value; } resultFileDescriptorProto.hasOptions = YES; return self; } - (PBFileDescriptorProtoBuilder*) clearOptions { resultFileDescriptorProto.hasOptions = NO; resultFileDescriptorProto.options = [PBFileOptions defaultInstance]; return self; } - (BOOL) hasSourceCodeInfo { return resultFileDescriptorProto.hasSourceCodeInfo; } - (PBSourceCodeInfo*) sourceCodeInfo { return resultFileDescriptorProto.sourceCodeInfo; } - (PBFileDescriptorProtoBuilder*) setSourceCodeInfo:(PBSourceCodeInfo*) value { resultFileDescriptorProto.hasSourceCodeInfo = YES; resultFileDescriptorProto.sourceCodeInfo = value; return self; } - (PBFileDescriptorProtoBuilder*) setSourceCodeInfoBuilder:(PBSourceCodeInfoBuilder*) builderForValue { return [self setSourceCodeInfo:[builderForValue build]]; } - (PBFileDescriptorProtoBuilder*) mergeSourceCodeInfo:(PBSourceCodeInfo*) value { if (resultFileDescriptorProto.hasSourceCodeInfo && resultFileDescriptorProto.sourceCodeInfo != [PBSourceCodeInfo defaultInstance]) { resultFileDescriptorProto.sourceCodeInfo = [[[PBSourceCodeInfo builderWithPrototype:resultFileDescriptorProto.sourceCodeInfo] mergeFrom:value] buildPartial]; } else { resultFileDescriptorProto.sourceCodeInfo = value; } resultFileDescriptorProto.hasSourceCodeInfo = YES; return self; } - (PBFileDescriptorProtoBuilder*) clearSourceCodeInfo { resultFileDescriptorProto.hasSourceCodeInfo = NO; resultFileDescriptorProto.sourceCodeInfo = [PBSourceCodeInfo defaultInstance]; return self; } @end @interface PBDescriptorProto () @property (strong) NSString* name; @property (strong) NSMutableArray * fieldArray; @property (strong) NSMutableArray * extensionArray; @property (strong) NSMutableArray * nestedTypeArray; @property (strong) NSMutableArray * enumTypeArray; @property (strong) NSMutableArray * extensionRangeArray; @property (strong) NSMutableArray * oneofDeclArray; @property (strong) PBMessageOptions* options; @end @implementation PBDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize fieldArray; @dynamic field; @synthesize extensionArray; @dynamic extension; @synthesize nestedTypeArray; @dynamic nestedType; @synthesize enumTypeArray; @dynamic enumType; @synthesize extensionRangeArray; @dynamic extensionRange; @synthesize oneofDeclArray; @dynamic oneofDecl; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.options = [PBMessageOptions defaultInstance]; } return self; } static PBDescriptorProto* defaultPBDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBDescriptorProto class]) { defaultPBDescriptorProtoInstance = [[PBDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBDescriptorProtoInstance; } - (NSArray *)field { return fieldArray; } - (PBFieldDescriptorProto*)fieldAtIndex:(NSUInteger)index { return [fieldArray objectAtIndex:index]; } - (NSArray *)extension { return extensionArray; } - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index { return [extensionArray objectAtIndex:index]; } - (NSArray *)nestedType { return nestedTypeArray; } - (PBDescriptorProto*)nestedTypeAtIndex:(NSUInteger)index { return [nestedTypeArray objectAtIndex:index]; } - (NSArray *)enumType { return enumTypeArray; } - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index { return [enumTypeArray objectAtIndex:index]; } - (NSArray *)extensionRange { return extensionRangeArray; } - (PBDescriptorProtoExtensionRange*)extensionRangeAtIndex:(NSUInteger)index { return [extensionRangeArray objectAtIndex:index]; } - (NSArray *)oneofDecl { return oneofDeclArray; } - (PBOneofDescriptorProto*)oneofDeclAtIndex:(NSUInteger)index { return [oneofDeclArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitfield = YES; [self.field enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitfield = NO; *stop = YES; } }]; if (!isInitfield) return isInitfield; __block BOOL isInitextension = YES; [self.extension enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitextension = NO; *stop = YES; } }]; if (!isInitextension) return isInitextension; __block BOOL isInitnestedType = YES; [self.nestedType enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitnestedType = NO; *stop = YES; } }]; if (!isInitnestedType) return isInitnestedType; __block BOOL isInitenumType = YES; [self.enumType enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitenumType = NO; *stop = YES; } }]; if (!isInitenumType) return isInitenumType; if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } [self.fieldArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; [self.nestedTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:3 value:element]; }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:4 value:element]; }]; [self.extensionRangeArray enumerateObjectsUsingBlock:^(PBDescriptorProtoExtensionRange *element, NSUInteger idx, BOOL *stop) { [output writeMessage:5 value:element]; }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:6 value:element]; }]; if (self.hasOptions) { [output writeMessage:7 value:self.options]; } [self.oneofDeclArray enumerateObjectsUsingBlock:^(PBOneofDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:8 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } [self.fieldArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; [self.nestedTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(3, element); }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(4, element); }]; [self.extensionRangeArray enumerateObjectsUsingBlock:^(PBDescriptorProtoExtensionRange *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(5, element); }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(6, element); }]; if (self.hasOptions) { size_ += computeMessageSize(7, self.options); } [self.oneofDeclArray enumerateObjectsUsingBlock:^(PBOneofDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(8, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBDescriptorProto*) parseFromData:(NSData*) data { return (PBDescriptorProto*)[[[PBDescriptorProto builder] mergeFromData:data] build]; } + (PBDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBDescriptorProto*)[[[PBDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBDescriptorProto*)[[[PBDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBDescriptorProto*)[[[PBDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBDescriptorProto*)[[[PBDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBDescriptorProto*)[[[PBDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBDescriptorProtoBuilder*) builder { return [[PBDescriptorProtoBuilder alloc] init]; } + (PBDescriptorProtoBuilder*) builderWithPrototype:(PBDescriptorProto*) prototype { return [[PBDescriptorProto builder] mergeFrom:prototype]; } - (PBDescriptorProtoBuilder*) builder { return [PBDescriptorProto builder]; } - (PBDescriptorProtoBuilder*) toBuilder { return [PBDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.fieldArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"field"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.nestedTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"nestedType"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"enumType"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.extensionRangeArray enumerateObjectsUsingBlock:^(PBDescriptorProtoExtensionRange *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"extensionRange"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"extension"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.oneofDeclArray enumerateObjectsUsingBlock:^(PBOneofDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"oneofDecl"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } for (PBFieldDescriptorProto* element in self.fieldArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"field"]; } for (PBDescriptorProto* element in self.nestedTypeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"nestedType"]; } for (PBEnumDescriptorProto* element in self.enumTypeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"enumType"]; } for (PBDescriptorProtoExtensionRange* element in self.extensionRangeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"extensionRange"]; } for (PBFieldDescriptorProto* element in self.extensionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"extension"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } for (PBOneofDescriptorProto* element in self.oneofDeclArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"oneofDecl"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBDescriptorProto class]]) { return NO; } PBDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && [self.fieldArray isEqualToArray:otherMessage.fieldArray] && [self.nestedTypeArray isEqualToArray:otherMessage.nestedTypeArray] && [self.enumTypeArray isEqualToArray:otherMessage.enumTypeArray] && [self.extensionRangeArray isEqualToArray:otherMessage.extensionRangeArray] && [self.extensionArray isEqualToArray:otherMessage.extensionArray] && self.hasOptions == otherMessage.hasOptions && (!self.hasOptions || [self.options isEqual:otherMessage.options]) && [self.oneofDeclArray isEqualToArray:otherMessage.oneofDeclArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } [self.fieldArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; [self.nestedTypeArray enumerateObjectsUsingBlock:^(PBDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; [self.enumTypeArray enumerateObjectsUsingBlock:^(PBEnumDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; [self.extensionRangeArray enumerateObjectsUsingBlock:^(PBDescriptorProtoExtensionRange *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; [self.extensionArray enumerateObjectsUsingBlock:^(PBFieldDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasOptions) { hashCode = hashCode * 31 + [self.options hash]; } [self.oneofDeclArray enumerateObjectsUsingBlock:^(PBOneofDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBDescriptorProtoExtensionRange () @property SInt32 start; @property SInt32 end; @end @implementation PBDescriptorProtoExtensionRange - (BOOL) hasStart { return !!hasStart_; } - (void) setHasStart:(BOOL) _value_ { hasStart_ = !!_value_; } @synthesize start; - (BOOL) hasEnd { return !!hasEnd_; } - (void) setHasEnd:(BOOL) _value_ { hasEnd_ = !!_value_; } @synthesize end; - (instancetype) init { if ((self = [super init])) { self.start = 0; self.end = 0; } return self; } static PBDescriptorProtoExtensionRange* defaultPBDescriptorProtoExtensionRangeInstance = nil; + (void) initialize { if (self == [PBDescriptorProtoExtensionRange class]) { defaultPBDescriptorProtoExtensionRangeInstance = [[PBDescriptorProtoExtensionRange alloc] init]; } } + (instancetype) defaultInstance { return defaultPBDescriptorProtoExtensionRangeInstance; } - (instancetype) defaultInstance { return defaultPBDescriptorProtoExtensionRangeInstance; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasStart) { [output writeInt32:1 value:self.start]; } if (self.hasEnd) { [output writeInt32:2 value:self.end]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasStart) { size_ += computeInt32Size(1, self.start); } if (self.hasEnd) { size_ += computeInt32Size(2, self.end); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBDescriptorProtoExtensionRange*) parseFromData:(NSData*) data { return (PBDescriptorProtoExtensionRange*)[[[PBDescriptorProtoExtensionRange builder] mergeFromData:data] build]; } + (PBDescriptorProtoExtensionRange*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBDescriptorProtoExtensionRange*)[[[PBDescriptorProtoExtensionRange builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBDescriptorProtoExtensionRange*) parseFromInputStream:(NSInputStream*) input { return (PBDescriptorProtoExtensionRange*)[[[PBDescriptorProtoExtensionRange builder] mergeFromInputStream:input] build]; } + (PBDescriptorProtoExtensionRange*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBDescriptorProtoExtensionRange*)[[[PBDescriptorProtoExtensionRange builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBDescriptorProtoExtensionRange*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBDescriptorProtoExtensionRange*)[[[PBDescriptorProtoExtensionRange builder] mergeFromCodedInputStream:input] build]; } + (PBDescriptorProtoExtensionRange*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBDescriptorProtoExtensionRange*)[[[PBDescriptorProtoExtensionRange builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBDescriptorProtoExtensionRangeBuilder*) builder { return [[PBDescriptorProtoExtensionRangeBuilder alloc] init]; } + (PBDescriptorProtoExtensionRangeBuilder*) builderWithPrototype:(PBDescriptorProtoExtensionRange*) prototype { return [[PBDescriptorProtoExtensionRange builder] mergeFrom:prototype]; } - (PBDescriptorProtoExtensionRangeBuilder*) builder { return [PBDescriptorProtoExtensionRange builder]; } - (PBDescriptorProtoExtensionRangeBuilder*) toBuilder { return [PBDescriptorProtoExtensionRange builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasStart) { [output appendFormat:@"%@%@: %@\n", indent, @"start", [NSNumber numberWithInteger:self.start]]; } if (self.hasEnd) { [output appendFormat:@"%@%@: %@\n", indent, @"end", [NSNumber numberWithInteger:self.end]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasStart) { [dictionary setObject: [NSNumber numberWithInteger:self.start] forKey: @"start"]; } if (self.hasEnd) { [dictionary setObject: [NSNumber numberWithInteger:self.end] forKey: @"end"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBDescriptorProtoExtensionRange class]]) { return NO; } PBDescriptorProtoExtensionRange *otherMessage = other; return self.hasStart == otherMessage.hasStart && (!self.hasStart || self.start == otherMessage.start) && self.hasEnd == otherMessage.hasEnd && (!self.hasEnd || self.end == otherMessage.end) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasStart) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.start] hash]; } if (self.hasEnd) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.end] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBDescriptorProtoExtensionRangeBuilder() @property (strong) PBDescriptorProtoExtensionRange* resultExtensionRange; @end @implementation PBDescriptorProtoExtensionRangeBuilder @synthesize resultExtensionRange; - (instancetype) init { if ((self = [super init])) { self.resultExtensionRange = [[PBDescriptorProtoExtensionRange alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultExtensionRange; } - (PBDescriptorProtoExtensionRangeBuilder*) clear { self.resultExtensionRange = [[PBDescriptorProtoExtensionRange alloc] init]; return self; } - (PBDescriptorProtoExtensionRangeBuilder*) clone { return [PBDescriptorProtoExtensionRange builderWithPrototype:resultExtensionRange]; } - (PBDescriptorProtoExtensionRange*) defaultInstance { return [PBDescriptorProtoExtensionRange defaultInstance]; } - (PBDescriptorProtoExtensionRange*) build { [self checkInitialized]; return [self buildPartial]; } - (PBDescriptorProtoExtensionRange*) buildPartial { PBDescriptorProtoExtensionRange* returnMe = resultExtensionRange; self.resultExtensionRange = nil; return returnMe; } - (PBDescriptorProtoExtensionRangeBuilder*) mergeFrom:(PBDescriptorProtoExtensionRange*) other { if (other == [PBDescriptorProtoExtensionRange defaultInstance]) { return self; } if (other.hasStart) { [self setStart:other.start]; } if (other.hasEnd) { [self setEnd:other.end]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBDescriptorProtoExtensionRangeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBDescriptorProtoExtensionRangeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setStart:[input readInt32]]; break; } case 16: { [self setEnd:[input readInt32]]; break; } } } } - (BOOL) hasStart { return resultExtensionRange.hasStart; } - (SInt32) start { return resultExtensionRange.start; } - (PBDescriptorProtoExtensionRangeBuilder*) setStart:(SInt32) value { resultExtensionRange.hasStart = YES; resultExtensionRange.start = value; return self; } - (PBDescriptorProtoExtensionRangeBuilder*) clearStart { resultExtensionRange.hasStart = NO; resultExtensionRange.start = 0; return self; } - (BOOL) hasEnd { return resultExtensionRange.hasEnd; } - (SInt32) end { return resultExtensionRange.end; } - (PBDescriptorProtoExtensionRangeBuilder*) setEnd:(SInt32) value { resultExtensionRange.hasEnd = YES; resultExtensionRange.end = value; return self; } - (PBDescriptorProtoExtensionRangeBuilder*) clearEnd { resultExtensionRange.hasEnd = NO; resultExtensionRange.end = 0; return self; } @end @interface PBDescriptorProtoBuilder() @property (strong) PBDescriptorProto* resultDescriptorProto; @end @implementation PBDescriptorProtoBuilder @synthesize resultDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultDescriptorProto = [[PBDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultDescriptorProto; } - (PBDescriptorProtoBuilder*) clear { self.resultDescriptorProto = [[PBDescriptorProto alloc] init]; return self; } - (PBDescriptorProtoBuilder*) clone { return [PBDescriptorProto builderWithPrototype:resultDescriptorProto]; } - (PBDescriptorProto*) defaultInstance { return [PBDescriptorProto defaultInstance]; } - (PBDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBDescriptorProto*) buildPartial { PBDescriptorProto* returnMe = resultDescriptorProto; self.resultDescriptorProto = nil; return returnMe; } - (PBDescriptorProtoBuilder*) mergeFrom:(PBDescriptorProto*) other { if (other == [PBDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.fieldArray.count > 0) { if (resultDescriptorProto.fieldArray == nil) { resultDescriptorProto.fieldArray = [[NSMutableArray alloc] initWithArray:other.fieldArray]; } else { [resultDescriptorProto.fieldArray addObjectsFromArray:other.fieldArray]; } } if (other.extensionArray.count > 0) { if (resultDescriptorProto.extensionArray == nil) { resultDescriptorProto.extensionArray = [[NSMutableArray alloc] initWithArray:other.extensionArray]; } else { [resultDescriptorProto.extensionArray addObjectsFromArray:other.extensionArray]; } } if (other.nestedTypeArray.count > 0) { if (resultDescriptorProto.nestedTypeArray == nil) { resultDescriptorProto.nestedTypeArray = [[NSMutableArray alloc] initWithArray:other.nestedTypeArray]; } else { [resultDescriptorProto.nestedTypeArray addObjectsFromArray:other.nestedTypeArray]; } } if (other.enumTypeArray.count > 0) { if (resultDescriptorProto.enumTypeArray == nil) { resultDescriptorProto.enumTypeArray = [[NSMutableArray alloc] initWithArray:other.enumTypeArray]; } else { [resultDescriptorProto.enumTypeArray addObjectsFromArray:other.enumTypeArray]; } } if (other.extensionRangeArray.count > 0) { if (resultDescriptorProto.extensionRangeArray == nil) { resultDescriptorProto.extensionRangeArray = [[NSMutableArray alloc] initWithArray:other.extensionRangeArray]; } else { [resultDescriptorProto.extensionRangeArray addObjectsFromArray:other.extensionRangeArray]; } } if (other.oneofDeclArray.count > 0) { if (resultDescriptorProto.oneofDeclArray == nil) { resultDescriptorProto.oneofDeclArray = [[NSMutableArray alloc] initWithArray:other.oneofDeclArray]; } else { [resultDescriptorProto.oneofDeclArray addObjectsFromArray:other.oneofDeclArray]; } } if (other.hasOptions) { [self mergeOptions:other.options]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { PBFieldDescriptorProtoBuilder* subBuilder = [PBFieldDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addField:[subBuilder buildPartial]]; break; } case 26: { PBDescriptorProtoBuilder* subBuilder = [PBDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addNestedType:[subBuilder buildPartial]]; break; } case 34: { PBEnumDescriptorProtoBuilder* subBuilder = [PBEnumDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addEnumType:[subBuilder buildPartial]]; break; } case 42: { PBDescriptorProtoExtensionRangeBuilder* subBuilder = [PBDescriptorProtoExtensionRange builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExtensionRange:[subBuilder buildPartial]]; break; } case 50: { PBFieldDescriptorProtoBuilder* subBuilder = [PBFieldDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExtension:[subBuilder buildPartial]]; break; } case 58: { PBMessageOptionsBuilder* subBuilder = [PBMessageOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } case 66: { PBOneofDescriptorProtoBuilder* subBuilder = [PBOneofDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addOneofDecl:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasName { return resultDescriptorProto.hasName; } - (NSString*) name { return resultDescriptorProto.name; } - (PBDescriptorProtoBuilder*) setName:(NSString*) value { resultDescriptorProto.hasName = YES; resultDescriptorProto.name = value; return self; } - (PBDescriptorProtoBuilder*) clearName { resultDescriptorProto.hasName = NO; resultDescriptorProto.name = @""; return self; } - (NSMutableArray *)field { return resultDescriptorProto.fieldArray; } - (PBFieldDescriptorProto*)fieldAtIndex:(NSUInteger)index { return [resultDescriptorProto fieldAtIndex:index]; } - (PBDescriptorProtoBuilder *)addField:(PBFieldDescriptorProto*)value { if (resultDescriptorProto.fieldArray == nil) { resultDescriptorProto.fieldArray = [[NSMutableArray alloc]init]; } [resultDescriptorProto.fieldArray addObject:value]; return self; } - (PBDescriptorProtoBuilder *)setFieldArray:(NSArray *)array { resultDescriptorProto.fieldArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBDescriptorProtoBuilder *)clearField { resultDescriptorProto.fieldArray = nil; return self; } - (NSMutableArray *)extension { return resultDescriptorProto.extensionArray; } - (PBFieldDescriptorProto*)extensionAtIndex:(NSUInteger)index { return [resultDescriptorProto extensionAtIndex:index]; } - (PBDescriptorProtoBuilder *)addExtension:(PBFieldDescriptorProto*)value { if (resultDescriptorProto.extensionArray == nil) { resultDescriptorProto.extensionArray = [[NSMutableArray alloc]init]; } [resultDescriptorProto.extensionArray addObject:value]; return self; } - (PBDescriptorProtoBuilder *)setExtensionArray:(NSArray *)array { resultDescriptorProto.extensionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBDescriptorProtoBuilder *)clearExtension { resultDescriptorProto.extensionArray = nil; return self; } - (NSMutableArray *)nestedType { return resultDescriptorProto.nestedTypeArray; } - (PBDescriptorProto*)nestedTypeAtIndex:(NSUInteger)index { return [resultDescriptorProto nestedTypeAtIndex:index]; } - (PBDescriptorProtoBuilder *)addNestedType:(PBDescriptorProto*)value { if (resultDescriptorProto.nestedTypeArray == nil) { resultDescriptorProto.nestedTypeArray = [[NSMutableArray alloc]init]; } [resultDescriptorProto.nestedTypeArray addObject:value]; return self; } - (PBDescriptorProtoBuilder *)setNestedTypeArray:(NSArray *)array { resultDescriptorProto.nestedTypeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBDescriptorProtoBuilder *)clearNestedType { resultDescriptorProto.nestedTypeArray = nil; return self; } - (NSMutableArray *)enumType { return resultDescriptorProto.enumTypeArray; } - (PBEnumDescriptorProto*)enumTypeAtIndex:(NSUInteger)index { return [resultDescriptorProto enumTypeAtIndex:index]; } - (PBDescriptorProtoBuilder *)addEnumType:(PBEnumDescriptorProto*)value { if (resultDescriptorProto.enumTypeArray == nil) { resultDescriptorProto.enumTypeArray = [[NSMutableArray alloc]init]; } [resultDescriptorProto.enumTypeArray addObject:value]; return self; } - (PBDescriptorProtoBuilder *)setEnumTypeArray:(NSArray *)array { resultDescriptorProto.enumTypeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBDescriptorProtoBuilder *)clearEnumType { resultDescriptorProto.enumTypeArray = nil; return self; } - (NSMutableArray *)extensionRange { return resultDescriptorProto.extensionRangeArray; } - (PBDescriptorProtoExtensionRange*)extensionRangeAtIndex:(NSUInteger)index { return [resultDescriptorProto extensionRangeAtIndex:index]; } - (PBDescriptorProtoBuilder *)addExtensionRange:(PBDescriptorProtoExtensionRange*)value { if (resultDescriptorProto.extensionRangeArray == nil) { resultDescriptorProto.extensionRangeArray = [[NSMutableArray alloc]init]; } [resultDescriptorProto.extensionRangeArray addObject:value]; return self; } - (PBDescriptorProtoBuilder *)setExtensionRangeArray:(NSArray *)array { resultDescriptorProto.extensionRangeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBDescriptorProtoBuilder *)clearExtensionRange { resultDescriptorProto.extensionRangeArray = nil; return self; } - (NSMutableArray *)oneofDecl { return resultDescriptorProto.oneofDeclArray; } - (PBOneofDescriptorProto*)oneofDeclAtIndex:(NSUInteger)index { return [resultDescriptorProto oneofDeclAtIndex:index]; } - (PBDescriptorProtoBuilder *)addOneofDecl:(PBOneofDescriptorProto*)value { if (resultDescriptorProto.oneofDeclArray == nil) { resultDescriptorProto.oneofDeclArray = [[NSMutableArray alloc]init]; } [resultDescriptorProto.oneofDeclArray addObject:value]; return self; } - (PBDescriptorProtoBuilder *)setOneofDeclArray:(NSArray *)array { resultDescriptorProto.oneofDeclArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBDescriptorProtoBuilder *)clearOneofDecl { resultDescriptorProto.oneofDeclArray = nil; return self; } - (BOOL) hasOptions { return resultDescriptorProto.hasOptions; } - (PBMessageOptions*) options { return resultDescriptorProto.options; } - (PBDescriptorProtoBuilder*) setOptions:(PBMessageOptions*) value { resultDescriptorProto.hasOptions = YES; resultDescriptorProto.options = value; return self; } - (PBDescriptorProtoBuilder*) setOptionsBuilder:(PBMessageOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBDescriptorProtoBuilder*) mergeOptions:(PBMessageOptions*) value { if (resultDescriptorProto.hasOptions && resultDescriptorProto.options != [PBMessageOptions defaultInstance]) { resultDescriptorProto.options = [[[PBMessageOptions builderWithPrototype:resultDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultDescriptorProto.options = value; } resultDescriptorProto.hasOptions = YES; return self; } - (PBDescriptorProtoBuilder*) clearOptions { resultDescriptorProto.hasOptions = NO; resultDescriptorProto.options = [PBMessageOptions defaultInstance]; return self; } @end @interface PBFieldDescriptorProto () @property (strong) NSString* name; @property SInt32 number; @property PBFieldDescriptorProtoLabel label; @property PBFieldDescriptorProtoType type; @property (strong) NSString* typeName; @property (strong) NSString* extendee; @property (strong) NSString* defaultValue; @property SInt32 oneofIndex; @property (strong) PBFieldOptions* options; @end @implementation PBFieldDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasNumber { return !!hasNumber_; } - (void) setHasNumber:(BOOL) _value_ { hasNumber_ = !!_value_; } @synthesize number; - (BOOL) hasLabel { return !!hasLabel_; } - (void) setHasLabel:(BOOL) _value_ { hasLabel_ = !!_value_; } @synthesize label; - (BOOL) hasType { return !!hasType_; } - (void) setHasType:(BOOL) _value_ { hasType_ = !!_value_; } @synthesize type; - (BOOL) hasTypeName { return !!hasTypeName_; } - (void) setHasTypeName:(BOOL) _value_ { hasTypeName_ = !!_value_; } @synthesize typeName; - (BOOL) hasExtendee { return !!hasExtendee_; } - (void) setHasExtendee:(BOOL) _value_ { hasExtendee_ = !!_value_; } @synthesize extendee; - (BOOL) hasDefaultValue { return !!hasDefaultValue_; } - (void) setHasDefaultValue:(BOOL) _value_ { hasDefaultValue_ = !!_value_; } @synthesize defaultValue; - (BOOL) hasOneofIndex { return !!hasOneofIndex_; } - (void) setHasOneofIndex:(BOOL) _value_ { hasOneofIndex_ = !!_value_; } @synthesize oneofIndex; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.number = 0; self.label = PBFieldDescriptorProtoLabelLabelOptional; self.type = PBFieldDescriptorProtoTypeTypeDouble; self.typeName = @""; self.extendee = @""; self.defaultValue = @""; self.oneofIndex = 0; self.options = [PBFieldOptions defaultInstance]; } return self; } static PBFieldDescriptorProto* defaultPBFieldDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBFieldDescriptorProto class]) { defaultPBFieldDescriptorProtoInstance = [[PBFieldDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBFieldDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBFieldDescriptorProtoInstance; } - (BOOL) isInitialized { if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } if (self.hasExtendee) { [output writeString:2 value:self.extendee]; } if (self.hasNumber) { [output writeInt32:3 value:self.number]; } if (self.hasLabel) { [output writeEnum:4 value:self.label]; } if (self.hasType) { [output writeEnum:5 value:self.type]; } if (self.hasTypeName) { [output writeString:6 value:self.typeName]; } if (self.hasDefaultValue) { [output writeString:7 value:self.defaultValue]; } if (self.hasOptions) { [output writeMessage:8 value:self.options]; } if (self.hasOneofIndex) { [output writeInt32:9 value:self.oneofIndex]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } if (self.hasExtendee) { size_ += computeStringSize(2, self.extendee); } if (self.hasNumber) { size_ += computeInt32Size(3, self.number); } if (self.hasLabel) { size_ += computeEnumSize(4, self.label); } if (self.hasType) { size_ += computeEnumSize(5, self.type); } if (self.hasTypeName) { size_ += computeStringSize(6, self.typeName); } if (self.hasDefaultValue) { size_ += computeStringSize(7, self.defaultValue); } if (self.hasOptions) { size_ += computeMessageSize(8, self.options); } if (self.hasOneofIndex) { size_ += computeInt32Size(9, self.oneofIndex); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBFieldDescriptorProto*) parseFromData:(NSData*) data { return (PBFieldDescriptorProto*)[[[PBFieldDescriptorProto builder] mergeFromData:data] build]; } + (PBFieldDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFieldDescriptorProto*)[[[PBFieldDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBFieldDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBFieldDescriptorProto*)[[[PBFieldDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBFieldDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFieldDescriptorProto*)[[[PBFieldDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFieldDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBFieldDescriptorProto*)[[[PBFieldDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBFieldDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFieldDescriptorProto*)[[[PBFieldDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFieldDescriptorProtoBuilder*) builder { return [[PBFieldDescriptorProtoBuilder alloc] init]; } + (PBFieldDescriptorProtoBuilder*) builderWithPrototype:(PBFieldDescriptorProto*) prototype { return [[PBFieldDescriptorProto builder] mergeFrom:prototype]; } - (PBFieldDescriptorProtoBuilder*) builder { return [PBFieldDescriptorProto builder]; } - (PBFieldDescriptorProtoBuilder*) toBuilder { return [PBFieldDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasExtendee) { [output appendFormat:@"%@%@: %@\n", indent, @"extendee", self.extendee]; } if (self.hasNumber) { [output appendFormat:@"%@%@: %@\n", indent, @"number", [NSNumber numberWithInteger:self.number]]; } if (self.hasLabel) { [output appendFormat:@"%@%@: %@\n", indent, @"label", NSStringFromPBFieldDescriptorProtoLabel(self.label)]; } if (self.hasType) { [output appendFormat:@"%@%@: %@\n", indent, @"type", NSStringFromPBFieldDescriptorProtoType(self.type)]; } if (self.hasTypeName) { [output appendFormat:@"%@%@: %@\n", indent, @"typeName", self.typeName]; } if (self.hasDefaultValue) { [output appendFormat:@"%@%@: %@\n", indent, @"defaultValue", self.defaultValue]; } if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } if (self.hasOneofIndex) { [output appendFormat:@"%@%@: %@\n", indent, @"oneofIndex", [NSNumber numberWithInteger:self.oneofIndex]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasExtendee) { [dictionary setObject: self.extendee forKey: @"extendee"]; } if (self.hasNumber) { [dictionary setObject: [NSNumber numberWithInteger:self.number] forKey: @"number"]; } if (self.hasLabel) { [dictionary setObject: @(self.label) forKey: @"label"]; } if (self.hasType) { [dictionary setObject: @(self.type) forKey: @"type"]; } if (self.hasTypeName) { [dictionary setObject: self.typeName forKey: @"typeName"]; } if (self.hasDefaultValue) { [dictionary setObject: self.defaultValue forKey: @"defaultValue"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } if (self.hasOneofIndex) { [dictionary setObject: [NSNumber numberWithInteger:self.oneofIndex] forKey: @"oneofIndex"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBFieldDescriptorProto class]]) { return NO; } PBFieldDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasExtendee == otherMessage.hasExtendee && (!self.hasExtendee || [self.extendee isEqual:otherMessage.extendee]) && self.hasNumber == otherMessage.hasNumber && (!self.hasNumber || self.number == otherMessage.number) && self.hasLabel == otherMessage.hasLabel && (!self.hasLabel || self.label == otherMessage.label) && self.hasType == otherMessage.hasType && (!self.hasType || self.type == otherMessage.type) && self.hasTypeName == otherMessage.hasTypeName && (!self.hasTypeName || [self.typeName isEqual:otherMessage.typeName]) && self.hasDefaultValue == otherMessage.hasDefaultValue && (!self.hasDefaultValue || [self.defaultValue isEqual:otherMessage.defaultValue]) && self.hasOptions == otherMessage.hasOptions && (!self.hasOptions || [self.options isEqual:otherMessage.options]) && self.hasOneofIndex == otherMessage.hasOneofIndex && (!self.hasOneofIndex || self.oneofIndex == otherMessage.oneofIndex) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasExtendee) { hashCode = hashCode * 31 + [self.extendee hash]; } if (self.hasNumber) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.number] hash]; } if (self.hasLabel) { hashCode = hashCode * 31 + self.label; } if (self.hasType) { hashCode = hashCode * 31 + self.type; } if (self.hasTypeName) { hashCode = hashCode * 31 + [self.typeName hash]; } if (self.hasDefaultValue) { hashCode = hashCode * 31 + [self.defaultValue hash]; } if (self.hasOptions) { hashCode = hashCode * 31 + [self.options hash]; } if (self.hasOneofIndex) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.oneofIndex] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end BOOL PBFieldDescriptorProtoTypeIsValidValue(PBFieldDescriptorProtoType value) { switch (value) { case PBFieldDescriptorProtoTypeTypeDouble: case PBFieldDescriptorProtoTypeTypeFloat: case PBFieldDescriptorProtoTypeTypeInt64: case PBFieldDescriptorProtoTypeTypeUint64: case PBFieldDescriptorProtoTypeTypeInt32: case PBFieldDescriptorProtoTypeTypeFixed64: case PBFieldDescriptorProtoTypeTypeFixed32: case PBFieldDescriptorProtoTypeTypeBool: case PBFieldDescriptorProtoTypeTypeString: case PBFieldDescriptorProtoTypeTypeGroup: case PBFieldDescriptorProtoTypeTypeMessage: case PBFieldDescriptorProtoTypeTypeBytes: case PBFieldDescriptorProtoTypeTypeUint32: case PBFieldDescriptorProtoTypeTypeEnum: case PBFieldDescriptorProtoTypeTypeSfixed32: case PBFieldDescriptorProtoTypeTypeSfixed64: case PBFieldDescriptorProtoTypeTypeSint32: case PBFieldDescriptorProtoTypeTypeSint64: return YES; default: return NO; } } NSString *NSStringFromPBFieldDescriptorProtoType(PBFieldDescriptorProtoType value) { switch (value) { case PBFieldDescriptorProtoTypeTypeDouble: return @"PBFieldDescriptorProtoTypeTypeDouble"; case PBFieldDescriptorProtoTypeTypeFloat: return @"PBFieldDescriptorProtoTypeTypeFloat"; case PBFieldDescriptorProtoTypeTypeInt64: return @"PBFieldDescriptorProtoTypeTypeInt64"; case PBFieldDescriptorProtoTypeTypeUint64: return @"PBFieldDescriptorProtoTypeTypeUint64"; case PBFieldDescriptorProtoTypeTypeInt32: return @"PBFieldDescriptorProtoTypeTypeInt32"; case PBFieldDescriptorProtoTypeTypeFixed64: return @"PBFieldDescriptorProtoTypeTypeFixed64"; case PBFieldDescriptorProtoTypeTypeFixed32: return @"PBFieldDescriptorProtoTypeTypeFixed32"; case PBFieldDescriptorProtoTypeTypeBool: return @"PBFieldDescriptorProtoTypeTypeBool"; case PBFieldDescriptorProtoTypeTypeString: return @"PBFieldDescriptorProtoTypeTypeString"; case PBFieldDescriptorProtoTypeTypeGroup: return @"PBFieldDescriptorProtoTypeTypeGroup"; case PBFieldDescriptorProtoTypeTypeMessage: return @"PBFieldDescriptorProtoTypeTypeMessage"; case PBFieldDescriptorProtoTypeTypeBytes: return @"PBFieldDescriptorProtoTypeTypeBytes"; case PBFieldDescriptorProtoTypeTypeUint32: return @"PBFieldDescriptorProtoTypeTypeUint32"; case PBFieldDescriptorProtoTypeTypeEnum: return @"PBFieldDescriptorProtoTypeTypeEnum"; case PBFieldDescriptorProtoTypeTypeSfixed32: return @"PBFieldDescriptorProtoTypeTypeSfixed32"; case PBFieldDescriptorProtoTypeTypeSfixed64: return @"PBFieldDescriptorProtoTypeTypeSfixed64"; case PBFieldDescriptorProtoTypeTypeSint32: return @"PBFieldDescriptorProtoTypeTypeSint32"; case PBFieldDescriptorProtoTypeTypeSint64: return @"PBFieldDescriptorProtoTypeTypeSint64"; default: return nil; } } BOOL PBFieldDescriptorProtoLabelIsValidValue(PBFieldDescriptorProtoLabel value) { switch (value) { case PBFieldDescriptorProtoLabelLabelOptional: case PBFieldDescriptorProtoLabelLabelRequired: case PBFieldDescriptorProtoLabelLabelRepeated: return YES; default: return NO; } } NSString *NSStringFromPBFieldDescriptorProtoLabel(PBFieldDescriptorProtoLabel value) { switch (value) { case PBFieldDescriptorProtoLabelLabelOptional: return @"PBFieldDescriptorProtoLabelLabelOptional"; case PBFieldDescriptorProtoLabelLabelRequired: return @"PBFieldDescriptorProtoLabelLabelRequired"; case PBFieldDescriptorProtoLabelLabelRepeated: return @"PBFieldDescriptorProtoLabelLabelRepeated"; default: return nil; } } @interface PBFieldDescriptorProtoBuilder() @property (strong) PBFieldDescriptorProto* resultFieldDescriptorProto; @end @implementation PBFieldDescriptorProtoBuilder @synthesize resultFieldDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultFieldDescriptorProto = [[PBFieldDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultFieldDescriptorProto; } - (PBFieldDescriptorProtoBuilder*) clear { self.resultFieldDescriptorProto = [[PBFieldDescriptorProto alloc] init]; return self; } - (PBFieldDescriptorProtoBuilder*) clone { return [PBFieldDescriptorProto builderWithPrototype:resultFieldDescriptorProto]; } - (PBFieldDescriptorProto*) defaultInstance { return [PBFieldDescriptorProto defaultInstance]; } - (PBFieldDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBFieldDescriptorProto*) buildPartial { PBFieldDescriptorProto* returnMe = resultFieldDescriptorProto; self.resultFieldDescriptorProto = nil; return returnMe; } - (PBFieldDescriptorProtoBuilder*) mergeFrom:(PBFieldDescriptorProto*) other { if (other == [PBFieldDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasNumber) { [self setNumber:other.number]; } if (other.hasLabel) { [self setLabel:other.label]; } if (other.hasType) { [self setType:other.type]; } if (other.hasTypeName) { [self setTypeName:other.typeName]; } if (other.hasExtendee) { [self setExtendee:other.extendee]; } if (other.hasDefaultValue) { [self setDefaultValue:other.defaultValue]; } if (other.hasOneofIndex) { [self setOneofIndex:other.oneofIndex]; } if (other.hasOptions) { [self mergeOptions:other.options]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBFieldDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBFieldDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { [self setExtendee:[input readString]]; break; } case 24: { [self setNumber:[input readInt32]]; break; } case 32: { PBFieldDescriptorProtoLabel value = (PBFieldDescriptorProtoLabel)[input readEnum]; if (PBFieldDescriptorProtoLabelIsValidValue(value)) { [self setLabel:value]; } else { [unknownFields mergeVarintField:4 value:value]; } break; } case 40: { PBFieldDescriptorProtoType value = (PBFieldDescriptorProtoType)[input readEnum]; if (PBFieldDescriptorProtoTypeIsValidValue(value)) { [self setType:value]; } else { [unknownFields mergeVarintField:5 value:value]; } break; } case 50: { [self setTypeName:[input readString]]; break; } case 58: { [self setDefaultValue:[input readString]]; break; } case 66: { PBFieldOptionsBuilder* subBuilder = [PBFieldOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } case 72: { [self setOneofIndex:[input readInt32]]; break; } } } } - (BOOL) hasName { return resultFieldDescriptorProto.hasName; } - (NSString*) name { return resultFieldDescriptorProto.name; } - (PBFieldDescriptorProtoBuilder*) setName:(NSString*) value { resultFieldDescriptorProto.hasName = YES; resultFieldDescriptorProto.name = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearName { resultFieldDescriptorProto.hasName = NO; resultFieldDescriptorProto.name = @""; return self; } - (BOOL) hasNumber { return resultFieldDescriptorProto.hasNumber; } - (SInt32) number { return resultFieldDescriptorProto.number; } - (PBFieldDescriptorProtoBuilder*) setNumber:(SInt32) value { resultFieldDescriptorProto.hasNumber = YES; resultFieldDescriptorProto.number = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearNumber { resultFieldDescriptorProto.hasNumber = NO; resultFieldDescriptorProto.number = 0; return self; } - (BOOL) hasLabel { return resultFieldDescriptorProto.hasLabel; } - (PBFieldDescriptorProtoLabel) label { return resultFieldDescriptorProto.label; } - (PBFieldDescriptorProtoBuilder*) setLabel:(PBFieldDescriptorProtoLabel) value { resultFieldDescriptorProto.hasLabel = YES; resultFieldDescriptorProto.label = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearLabel { resultFieldDescriptorProto.hasLabel = NO; resultFieldDescriptorProto.label = PBFieldDescriptorProtoLabelLabelOptional; return self; } - (BOOL) hasType { return resultFieldDescriptorProto.hasType; } - (PBFieldDescriptorProtoType) type { return resultFieldDescriptorProto.type; } - (PBFieldDescriptorProtoBuilder*) setType:(PBFieldDescriptorProtoType) value { resultFieldDescriptorProto.hasType = YES; resultFieldDescriptorProto.type = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearType { resultFieldDescriptorProto.hasType = NO; resultFieldDescriptorProto.type = PBFieldDescriptorProtoTypeTypeDouble; return self; } - (BOOL) hasTypeName { return resultFieldDescriptorProto.hasTypeName; } - (NSString*) typeName { return resultFieldDescriptorProto.typeName; } - (PBFieldDescriptorProtoBuilder*) setTypeName:(NSString*) value { resultFieldDescriptorProto.hasTypeName = YES; resultFieldDescriptorProto.typeName = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearTypeName { resultFieldDescriptorProto.hasTypeName = NO; resultFieldDescriptorProto.typeName = @""; return self; } - (BOOL) hasExtendee { return resultFieldDescriptorProto.hasExtendee; } - (NSString*) extendee { return resultFieldDescriptorProto.extendee; } - (PBFieldDescriptorProtoBuilder*) setExtendee:(NSString*) value { resultFieldDescriptorProto.hasExtendee = YES; resultFieldDescriptorProto.extendee = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearExtendee { resultFieldDescriptorProto.hasExtendee = NO; resultFieldDescriptorProto.extendee = @""; return self; } - (BOOL) hasDefaultValue { return resultFieldDescriptorProto.hasDefaultValue; } - (NSString*) defaultValue { return resultFieldDescriptorProto.defaultValue; } - (PBFieldDescriptorProtoBuilder*) setDefaultValue:(NSString*) value { resultFieldDescriptorProto.hasDefaultValue = YES; resultFieldDescriptorProto.defaultValue = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearDefaultValue { resultFieldDescriptorProto.hasDefaultValue = NO; resultFieldDescriptorProto.defaultValue = @""; return self; } - (BOOL) hasOneofIndex { return resultFieldDescriptorProto.hasOneofIndex; } - (SInt32) oneofIndex { return resultFieldDescriptorProto.oneofIndex; } - (PBFieldDescriptorProtoBuilder*) setOneofIndex:(SInt32) value { resultFieldDescriptorProto.hasOneofIndex = YES; resultFieldDescriptorProto.oneofIndex = value; return self; } - (PBFieldDescriptorProtoBuilder*) clearOneofIndex { resultFieldDescriptorProto.hasOneofIndex = NO; resultFieldDescriptorProto.oneofIndex = 0; return self; } - (BOOL) hasOptions { return resultFieldDescriptorProto.hasOptions; } - (PBFieldOptions*) options { return resultFieldDescriptorProto.options; } - (PBFieldDescriptorProtoBuilder*) setOptions:(PBFieldOptions*) value { resultFieldDescriptorProto.hasOptions = YES; resultFieldDescriptorProto.options = value; return self; } - (PBFieldDescriptorProtoBuilder*) setOptionsBuilder:(PBFieldOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBFieldDescriptorProtoBuilder*) mergeOptions:(PBFieldOptions*) value { if (resultFieldDescriptorProto.hasOptions && resultFieldDescriptorProto.options != [PBFieldOptions defaultInstance]) { resultFieldDescriptorProto.options = [[[PBFieldOptions builderWithPrototype:resultFieldDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultFieldDescriptorProto.options = value; } resultFieldDescriptorProto.hasOptions = YES; return self; } - (PBFieldDescriptorProtoBuilder*) clearOptions { resultFieldDescriptorProto.hasOptions = NO; resultFieldDescriptorProto.options = [PBFieldOptions defaultInstance]; return self; } @end @interface PBOneofDescriptorProto () @property (strong) NSString* name; @end @implementation PBOneofDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (instancetype) init { if ((self = [super init])) { self.name = @""; } return self; } static PBOneofDescriptorProto* defaultPBOneofDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBOneofDescriptorProto class]) { defaultPBOneofDescriptorProtoInstance = [[PBOneofDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBOneofDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBOneofDescriptorProtoInstance; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBOneofDescriptorProto*) parseFromData:(NSData*) data { return (PBOneofDescriptorProto*)[[[PBOneofDescriptorProto builder] mergeFromData:data] build]; } + (PBOneofDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBOneofDescriptorProto*)[[[PBOneofDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBOneofDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBOneofDescriptorProto*)[[[PBOneofDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBOneofDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBOneofDescriptorProto*)[[[PBOneofDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBOneofDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBOneofDescriptorProto*)[[[PBOneofDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBOneofDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBOneofDescriptorProto*)[[[PBOneofDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBOneofDescriptorProtoBuilder*) builder { return [[PBOneofDescriptorProtoBuilder alloc] init]; } + (PBOneofDescriptorProtoBuilder*) builderWithPrototype:(PBOneofDescriptorProto*) prototype { return [[PBOneofDescriptorProto builder] mergeFrom:prototype]; } - (PBOneofDescriptorProtoBuilder*) builder { return [PBOneofDescriptorProto builder]; } - (PBOneofDescriptorProtoBuilder*) toBuilder { return [PBOneofDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBOneofDescriptorProto class]]) { return NO; } PBOneofDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBOneofDescriptorProtoBuilder() @property (strong) PBOneofDescriptorProto* resultOneofDescriptorProto; @end @implementation PBOneofDescriptorProtoBuilder @synthesize resultOneofDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultOneofDescriptorProto = [[PBOneofDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultOneofDescriptorProto; } - (PBOneofDescriptorProtoBuilder*) clear { self.resultOneofDescriptorProto = [[PBOneofDescriptorProto alloc] init]; return self; } - (PBOneofDescriptorProtoBuilder*) clone { return [PBOneofDescriptorProto builderWithPrototype:resultOneofDescriptorProto]; } - (PBOneofDescriptorProto*) defaultInstance { return [PBOneofDescriptorProto defaultInstance]; } - (PBOneofDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBOneofDescriptorProto*) buildPartial { PBOneofDescriptorProto* returnMe = resultOneofDescriptorProto; self.resultOneofDescriptorProto = nil; return returnMe; } - (PBOneofDescriptorProtoBuilder*) mergeFrom:(PBOneofDescriptorProto*) other { if (other == [PBOneofDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBOneofDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBOneofDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } } } } - (BOOL) hasName { return resultOneofDescriptorProto.hasName; } - (NSString*) name { return resultOneofDescriptorProto.name; } - (PBOneofDescriptorProtoBuilder*) setName:(NSString*) value { resultOneofDescriptorProto.hasName = YES; resultOneofDescriptorProto.name = value; return self; } - (PBOneofDescriptorProtoBuilder*) clearName { resultOneofDescriptorProto.hasName = NO; resultOneofDescriptorProto.name = @""; return self; } @end @interface PBEnumDescriptorProto () @property (strong) NSString* name; @property (strong) NSMutableArray * valueArray; @property (strong) PBEnumOptions* options; @end @implementation PBEnumDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize valueArray; @dynamic value; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.options = [PBEnumOptions defaultInstance]; } return self; } static PBEnumDescriptorProto* defaultPBEnumDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBEnumDescriptorProto class]) { defaultPBEnumDescriptorProtoInstance = [[PBEnumDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBEnumDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBEnumDescriptorProtoInstance; } - (NSArray *)value { return valueArray; } - (PBEnumValueDescriptorProto*)valueAtIndex:(NSUInteger)index { return [valueArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitvalue = YES; [self.value enumerateObjectsUsingBlock:^(PBEnumValueDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitvalue = NO; *stop = YES; } }]; if (!isInitvalue) return isInitvalue; if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } [self.valueArray enumerateObjectsUsingBlock:^(PBEnumValueDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; if (self.hasOptions) { [output writeMessage:3 value:self.options]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } [self.valueArray enumerateObjectsUsingBlock:^(PBEnumValueDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; if (self.hasOptions) { size_ += computeMessageSize(3, self.options); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBEnumDescriptorProto*) parseFromData:(NSData*) data { return (PBEnumDescriptorProto*)[[[PBEnumDescriptorProto builder] mergeFromData:data] build]; } + (PBEnumDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumDescriptorProto*)[[[PBEnumDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBEnumDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBEnumDescriptorProto*)[[[PBEnumDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBEnumDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumDescriptorProto*)[[[PBEnumDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBEnumDescriptorProto*)[[[PBEnumDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBEnumDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumDescriptorProto*)[[[PBEnumDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumDescriptorProtoBuilder*) builder { return [[PBEnumDescriptorProtoBuilder alloc] init]; } + (PBEnumDescriptorProtoBuilder*) builderWithPrototype:(PBEnumDescriptorProto*) prototype { return [[PBEnumDescriptorProto builder] mergeFrom:prototype]; } - (PBEnumDescriptorProtoBuilder*) builder { return [PBEnumDescriptorProto builder]; } - (PBEnumDescriptorProtoBuilder*) toBuilder { return [PBEnumDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.valueArray enumerateObjectsUsingBlock:^(PBEnumValueDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"value"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } for (PBEnumValueDescriptorProto* element in self.valueArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"value"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBEnumDescriptorProto class]]) { return NO; } PBEnumDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && [self.valueArray isEqualToArray:otherMessage.valueArray] && self.hasOptions == otherMessage.hasOptions && (!self.hasOptions || [self.options isEqual:otherMessage.options]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } [self.valueArray enumerateObjectsUsingBlock:^(PBEnumValueDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasOptions) { hashCode = hashCode * 31 + [self.options hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBEnumDescriptorProtoBuilder() @property (strong) PBEnumDescriptorProto* resultEnumDescriptorProto; @end @implementation PBEnumDescriptorProtoBuilder @synthesize resultEnumDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultEnumDescriptorProto = [[PBEnumDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultEnumDescriptorProto; } - (PBEnumDescriptorProtoBuilder*) clear { self.resultEnumDescriptorProto = [[PBEnumDescriptorProto alloc] init]; return self; } - (PBEnumDescriptorProtoBuilder*) clone { return [PBEnumDescriptorProto builderWithPrototype:resultEnumDescriptorProto]; } - (PBEnumDescriptorProto*) defaultInstance { return [PBEnumDescriptorProto defaultInstance]; } - (PBEnumDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBEnumDescriptorProto*) buildPartial { PBEnumDescriptorProto* returnMe = resultEnumDescriptorProto; self.resultEnumDescriptorProto = nil; return returnMe; } - (PBEnumDescriptorProtoBuilder*) mergeFrom:(PBEnumDescriptorProto*) other { if (other == [PBEnumDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.valueArray.count > 0) { if (resultEnumDescriptorProto.valueArray == nil) { resultEnumDescriptorProto.valueArray = [[NSMutableArray alloc] initWithArray:other.valueArray]; } else { [resultEnumDescriptorProto.valueArray addObjectsFromArray:other.valueArray]; } } if (other.hasOptions) { [self mergeOptions:other.options]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBEnumDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBEnumDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { PBEnumValueDescriptorProtoBuilder* subBuilder = [PBEnumValueDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addValue:[subBuilder buildPartial]]; break; } case 26: { PBEnumOptionsBuilder* subBuilder = [PBEnumOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasName { return resultEnumDescriptorProto.hasName; } - (NSString*) name { return resultEnumDescriptorProto.name; } - (PBEnumDescriptorProtoBuilder*) setName:(NSString*) value { resultEnumDescriptorProto.hasName = YES; resultEnumDescriptorProto.name = value; return self; } - (PBEnumDescriptorProtoBuilder*) clearName { resultEnumDescriptorProto.hasName = NO; resultEnumDescriptorProto.name = @""; return self; } - (NSMutableArray *)value { return resultEnumDescriptorProto.valueArray; } - (PBEnumValueDescriptorProto*)valueAtIndex:(NSUInteger)index { return [resultEnumDescriptorProto valueAtIndex:index]; } - (PBEnumDescriptorProtoBuilder *)addValue:(PBEnumValueDescriptorProto*)value { if (resultEnumDescriptorProto.valueArray == nil) { resultEnumDescriptorProto.valueArray = [[NSMutableArray alloc]init]; } [resultEnumDescriptorProto.valueArray addObject:value]; return self; } - (PBEnumDescriptorProtoBuilder *)setValueArray:(NSArray *)array { resultEnumDescriptorProto.valueArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBEnumDescriptorProtoBuilder *)clearValue { resultEnumDescriptorProto.valueArray = nil; return self; } - (BOOL) hasOptions { return resultEnumDescriptorProto.hasOptions; } - (PBEnumOptions*) options { return resultEnumDescriptorProto.options; } - (PBEnumDescriptorProtoBuilder*) setOptions:(PBEnumOptions*) value { resultEnumDescriptorProto.hasOptions = YES; resultEnumDescriptorProto.options = value; return self; } - (PBEnumDescriptorProtoBuilder*) setOptionsBuilder:(PBEnumOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBEnumDescriptorProtoBuilder*) mergeOptions:(PBEnumOptions*) value { if (resultEnumDescriptorProto.hasOptions && resultEnumDescriptorProto.options != [PBEnumOptions defaultInstance]) { resultEnumDescriptorProto.options = [[[PBEnumOptions builderWithPrototype:resultEnumDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultEnumDescriptorProto.options = value; } resultEnumDescriptorProto.hasOptions = YES; return self; } - (PBEnumDescriptorProtoBuilder*) clearOptions { resultEnumDescriptorProto.hasOptions = NO; resultEnumDescriptorProto.options = [PBEnumOptions defaultInstance]; return self; } @end @interface PBEnumValueDescriptorProto () @property (strong) NSString* name; @property SInt32 number; @property (strong) PBEnumValueOptions* options; @end @implementation PBEnumValueDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasNumber { return !!hasNumber_; } - (void) setHasNumber:(BOOL) _value_ { hasNumber_ = !!_value_; } @synthesize number; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.number = 0; self.options = [PBEnumValueOptions defaultInstance]; } return self; } static PBEnumValueDescriptorProto* defaultPBEnumValueDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBEnumValueDescriptorProto class]) { defaultPBEnumValueDescriptorProtoInstance = [[PBEnumValueDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBEnumValueDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBEnumValueDescriptorProtoInstance; } - (BOOL) isInitialized { if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } if (self.hasNumber) { [output writeInt32:2 value:self.number]; } if (self.hasOptions) { [output writeMessage:3 value:self.options]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } if (self.hasNumber) { size_ += computeInt32Size(2, self.number); } if (self.hasOptions) { size_ += computeMessageSize(3, self.options); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBEnumValueDescriptorProto*) parseFromData:(NSData*) data { return (PBEnumValueDescriptorProto*)[[[PBEnumValueDescriptorProto builder] mergeFromData:data] build]; } + (PBEnumValueDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumValueDescriptorProto*)[[[PBEnumValueDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBEnumValueDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBEnumValueDescriptorProto*)[[[PBEnumValueDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBEnumValueDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumValueDescriptorProto*)[[[PBEnumValueDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumValueDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBEnumValueDescriptorProto*)[[[PBEnumValueDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBEnumValueDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumValueDescriptorProto*)[[[PBEnumValueDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumValueDescriptorProtoBuilder*) builder { return [[PBEnumValueDescriptorProtoBuilder alloc] init]; } + (PBEnumValueDescriptorProtoBuilder*) builderWithPrototype:(PBEnumValueDescriptorProto*) prototype { return [[PBEnumValueDescriptorProto builder] mergeFrom:prototype]; } - (PBEnumValueDescriptorProtoBuilder*) builder { return [PBEnumValueDescriptorProto builder]; } - (PBEnumValueDescriptorProtoBuilder*) toBuilder { return [PBEnumValueDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasNumber) { [output appendFormat:@"%@%@: %@\n", indent, @"number", [NSNumber numberWithInteger:self.number]]; } if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasNumber) { [dictionary setObject: [NSNumber numberWithInteger:self.number] forKey: @"number"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBEnumValueDescriptorProto class]]) { return NO; } PBEnumValueDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasNumber == otherMessage.hasNumber && (!self.hasNumber || self.number == otherMessage.number) && self.hasOptions == otherMessage.hasOptions && (!self.hasOptions || [self.options isEqual:otherMessage.options]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasNumber) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.number] hash]; } if (self.hasOptions) { hashCode = hashCode * 31 + [self.options hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBEnumValueDescriptorProtoBuilder() @property (strong) PBEnumValueDescriptorProto* resultEnumValueDescriptorProto; @end @implementation PBEnumValueDescriptorProtoBuilder @synthesize resultEnumValueDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultEnumValueDescriptorProto = [[PBEnumValueDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultEnumValueDescriptorProto; } - (PBEnumValueDescriptorProtoBuilder*) clear { self.resultEnumValueDescriptorProto = [[PBEnumValueDescriptorProto alloc] init]; return self; } - (PBEnumValueDescriptorProtoBuilder*) clone { return [PBEnumValueDescriptorProto builderWithPrototype:resultEnumValueDescriptorProto]; } - (PBEnumValueDescriptorProto*) defaultInstance { return [PBEnumValueDescriptorProto defaultInstance]; } - (PBEnumValueDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBEnumValueDescriptorProto*) buildPartial { PBEnumValueDescriptorProto* returnMe = resultEnumValueDescriptorProto; self.resultEnumValueDescriptorProto = nil; return returnMe; } - (PBEnumValueDescriptorProtoBuilder*) mergeFrom:(PBEnumValueDescriptorProto*) other { if (other == [PBEnumValueDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasNumber) { [self setNumber:other.number]; } if (other.hasOptions) { [self mergeOptions:other.options]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBEnumValueDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBEnumValueDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 16: { [self setNumber:[input readInt32]]; break; } case 26: { PBEnumValueOptionsBuilder* subBuilder = [PBEnumValueOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasName { return resultEnumValueDescriptorProto.hasName; } - (NSString*) name { return resultEnumValueDescriptorProto.name; } - (PBEnumValueDescriptorProtoBuilder*) setName:(NSString*) value { resultEnumValueDescriptorProto.hasName = YES; resultEnumValueDescriptorProto.name = value; return self; } - (PBEnumValueDescriptorProtoBuilder*) clearName { resultEnumValueDescriptorProto.hasName = NO; resultEnumValueDescriptorProto.name = @""; return self; } - (BOOL) hasNumber { return resultEnumValueDescriptorProto.hasNumber; } - (SInt32) number { return resultEnumValueDescriptorProto.number; } - (PBEnumValueDescriptorProtoBuilder*) setNumber:(SInt32) value { resultEnumValueDescriptorProto.hasNumber = YES; resultEnumValueDescriptorProto.number = value; return self; } - (PBEnumValueDescriptorProtoBuilder*) clearNumber { resultEnumValueDescriptorProto.hasNumber = NO; resultEnumValueDescriptorProto.number = 0; return self; } - (BOOL) hasOptions { return resultEnumValueDescriptorProto.hasOptions; } - (PBEnumValueOptions*) options { return resultEnumValueDescriptorProto.options; } - (PBEnumValueDescriptorProtoBuilder*) setOptions:(PBEnumValueOptions*) value { resultEnumValueDescriptorProto.hasOptions = YES; resultEnumValueDescriptorProto.options = value; return self; } - (PBEnumValueDescriptorProtoBuilder*) setOptionsBuilder:(PBEnumValueOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBEnumValueDescriptorProtoBuilder*) mergeOptions:(PBEnumValueOptions*) value { if (resultEnumValueDescriptorProto.hasOptions && resultEnumValueDescriptorProto.options != [PBEnumValueOptions defaultInstance]) { resultEnumValueDescriptorProto.options = [[[PBEnumValueOptions builderWithPrototype:resultEnumValueDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultEnumValueDescriptorProto.options = value; } resultEnumValueDescriptorProto.hasOptions = YES; return self; } - (PBEnumValueDescriptorProtoBuilder*) clearOptions { resultEnumValueDescriptorProto.hasOptions = NO; resultEnumValueDescriptorProto.options = [PBEnumValueOptions defaultInstance]; return self; } @end @interface PBServiceDescriptorProto () @property (strong) NSString* name; @property (strong) NSMutableArray * methodArray; @property (strong) PBServiceOptions* options; @end @implementation PBServiceDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize methodArray; @dynamic method; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.options = [PBServiceOptions defaultInstance]; } return self; } static PBServiceDescriptorProto* defaultPBServiceDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBServiceDescriptorProto class]) { defaultPBServiceDescriptorProtoInstance = [[PBServiceDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBServiceDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBServiceDescriptorProtoInstance; } - (NSArray *)method { return methodArray; } - (PBMethodDescriptorProto*)methodAtIndex:(NSUInteger)index { return [methodArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitmethod = YES; [self.method enumerateObjectsUsingBlock:^(PBMethodDescriptorProto *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitmethod = NO; *stop = YES; } }]; if (!isInitmethod) return isInitmethod; if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } [self.methodArray enumerateObjectsUsingBlock:^(PBMethodDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; if (self.hasOptions) { [output writeMessage:3 value:self.options]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } [self.methodArray enumerateObjectsUsingBlock:^(PBMethodDescriptorProto *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; if (self.hasOptions) { size_ += computeMessageSize(3, self.options); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBServiceDescriptorProto*) parseFromData:(NSData*) data { return (PBServiceDescriptorProto*)[[[PBServiceDescriptorProto builder] mergeFromData:data] build]; } + (PBServiceDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBServiceDescriptorProto*)[[[PBServiceDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBServiceDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBServiceDescriptorProto*)[[[PBServiceDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBServiceDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBServiceDescriptorProto*)[[[PBServiceDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBServiceDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBServiceDescriptorProto*)[[[PBServiceDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBServiceDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBServiceDescriptorProto*)[[[PBServiceDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBServiceDescriptorProtoBuilder*) builder { return [[PBServiceDescriptorProtoBuilder alloc] init]; } + (PBServiceDescriptorProtoBuilder*) builderWithPrototype:(PBServiceDescriptorProto*) prototype { return [[PBServiceDescriptorProto builder] mergeFrom:prototype]; } - (PBServiceDescriptorProtoBuilder*) builder { return [PBServiceDescriptorProto builder]; } - (PBServiceDescriptorProtoBuilder*) toBuilder { return [PBServiceDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.methodArray enumerateObjectsUsingBlock:^(PBMethodDescriptorProto *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"method"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } for (PBMethodDescriptorProto* element in self.methodArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"method"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBServiceDescriptorProto class]]) { return NO; } PBServiceDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && [self.methodArray isEqualToArray:otherMessage.methodArray] && self.hasOptions == otherMessage.hasOptions && (!self.hasOptions || [self.options isEqual:otherMessage.options]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } [self.methodArray enumerateObjectsUsingBlock:^(PBMethodDescriptorProto *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasOptions) { hashCode = hashCode * 31 + [self.options hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBServiceDescriptorProtoBuilder() @property (strong) PBServiceDescriptorProto* resultServiceDescriptorProto; @end @implementation PBServiceDescriptorProtoBuilder @synthesize resultServiceDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultServiceDescriptorProto = [[PBServiceDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultServiceDescriptorProto; } - (PBServiceDescriptorProtoBuilder*) clear { self.resultServiceDescriptorProto = [[PBServiceDescriptorProto alloc] init]; return self; } - (PBServiceDescriptorProtoBuilder*) clone { return [PBServiceDescriptorProto builderWithPrototype:resultServiceDescriptorProto]; } - (PBServiceDescriptorProto*) defaultInstance { return [PBServiceDescriptorProto defaultInstance]; } - (PBServiceDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBServiceDescriptorProto*) buildPartial { PBServiceDescriptorProto* returnMe = resultServiceDescriptorProto; self.resultServiceDescriptorProto = nil; return returnMe; } - (PBServiceDescriptorProtoBuilder*) mergeFrom:(PBServiceDescriptorProto*) other { if (other == [PBServiceDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.methodArray.count > 0) { if (resultServiceDescriptorProto.methodArray == nil) { resultServiceDescriptorProto.methodArray = [[NSMutableArray alloc] initWithArray:other.methodArray]; } else { [resultServiceDescriptorProto.methodArray addObjectsFromArray:other.methodArray]; } } if (other.hasOptions) { [self mergeOptions:other.options]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBServiceDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBServiceDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { PBMethodDescriptorProtoBuilder* subBuilder = [PBMethodDescriptorProto builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addMethod:[subBuilder buildPartial]]; break; } case 26: { PBServiceOptionsBuilder* subBuilder = [PBServiceOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasName { return resultServiceDescriptorProto.hasName; } - (NSString*) name { return resultServiceDescriptorProto.name; } - (PBServiceDescriptorProtoBuilder*) setName:(NSString*) value { resultServiceDescriptorProto.hasName = YES; resultServiceDescriptorProto.name = value; return self; } - (PBServiceDescriptorProtoBuilder*) clearName { resultServiceDescriptorProto.hasName = NO; resultServiceDescriptorProto.name = @""; return self; } - (NSMutableArray *)method { return resultServiceDescriptorProto.methodArray; } - (PBMethodDescriptorProto*)methodAtIndex:(NSUInteger)index { return [resultServiceDescriptorProto methodAtIndex:index]; } - (PBServiceDescriptorProtoBuilder *)addMethod:(PBMethodDescriptorProto*)value { if (resultServiceDescriptorProto.methodArray == nil) { resultServiceDescriptorProto.methodArray = [[NSMutableArray alloc]init]; } [resultServiceDescriptorProto.methodArray addObject:value]; return self; } - (PBServiceDescriptorProtoBuilder *)setMethodArray:(NSArray *)array { resultServiceDescriptorProto.methodArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBServiceDescriptorProtoBuilder *)clearMethod { resultServiceDescriptorProto.methodArray = nil; return self; } - (BOOL) hasOptions { return resultServiceDescriptorProto.hasOptions; } - (PBServiceOptions*) options { return resultServiceDescriptorProto.options; } - (PBServiceDescriptorProtoBuilder*) setOptions:(PBServiceOptions*) value { resultServiceDescriptorProto.hasOptions = YES; resultServiceDescriptorProto.options = value; return self; } - (PBServiceDescriptorProtoBuilder*) setOptionsBuilder:(PBServiceOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBServiceDescriptorProtoBuilder*) mergeOptions:(PBServiceOptions*) value { if (resultServiceDescriptorProto.hasOptions && resultServiceDescriptorProto.options != [PBServiceOptions defaultInstance]) { resultServiceDescriptorProto.options = [[[PBServiceOptions builderWithPrototype:resultServiceDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultServiceDescriptorProto.options = value; } resultServiceDescriptorProto.hasOptions = YES; return self; } - (PBServiceDescriptorProtoBuilder*) clearOptions { resultServiceDescriptorProto.hasOptions = NO; resultServiceDescriptorProto.options = [PBServiceOptions defaultInstance]; return self; } @end @interface PBMethodDescriptorProto () @property (strong) NSString* name; @property (strong) NSString* inputType; @property (strong) NSString* outputType; @property (strong) PBMethodOptions* options; @end @implementation PBMethodDescriptorProto - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasInputType { return !!hasInputType_; } - (void) setHasInputType:(BOOL) _value_ { hasInputType_ = !!_value_; } @synthesize inputType; - (BOOL) hasOutputType { return !!hasOutputType_; } - (void) setHasOutputType:(BOOL) _value_ { hasOutputType_ = !!_value_; } @synthesize outputType; - (BOOL) hasOptions { return !!hasOptions_; } - (void) setHasOptions:(BOOL) _value_ { hasOptions_ = !!_value_; } @synthesize options; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.inputType = @""; self.outputType = @""; self.options = [PBMethodOptions defaultInstance]; } return self; } static PBMethodDescriptorProto* defaultPBMethodDescriptorProtoInstance = nil; + (void) initialize { if (self == [PBMethodDescriptorProto class]) { defaultPBMethodDescriptorProtoInstance = [[PBMethodDescriptorProto alloc] init]; } } + (instancetype) defaultInstance { return defaultPBMethodDescriptorProtoInstance; } - (instancetype) defaultInstance { return defaultPBMethodDescriptorProtoInstance; } - (BOOL) isInitialized { if (self.hasOptions) { if (!self.options.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } if (self.hasInputType) { [output writeString:2 value:self.inputType]; } if (self.hasOutputType) { [output writeString:3 value:self.outputType]; } if (self.hasOptions) { [output writeMessage:4 value:self.options]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } if (self.hasInputType) { size_ += computeStringSize(2, self.inputType); } if (self.hasOutputType) { size_ += computeStringSize(3, self.outputType); } if (self.hasOptions) { size_ += computeMessageSize(4, self.options); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBMethodDescriptorProto*) parseFromData:(NSData*) data { return (PBMethodDescriptorProto*)[[[PBMethodDescriptorProto builder] mergeFromData:data] build]; } + (PBMethodDescriptorProto*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMethodDescriptorProto*)[[[PBMethodDescriptorProto builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBMethodDescriptorProto*) parseFromInputStream:(NSInputStream*) input { return (PBMethodDescriptorProto*)[[[PBMethodDescriptorProto builder] mergeFromInputStream:input] build]; } + (PBMethodDescriptorProto*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMethodDescriptorProto*)[[[PBMethodDescriptorProto builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBMethodDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBMethodDescriptorProto*)[[[PBMethodDescriptorProto builder] mergeFromCodedInputStream:input] build]; } + (PBMethodDescriptorProto*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMethodDescriptorProto*)[[[PBMethodDescriptorProto builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBMethodDescriptorProtoBuilder*) builder { return [[PBMethodDescriptorProtoBuilder alloc] init]; } + (PBMethodDescriptorProtoBuilder*) builderWithPrototype:(PBMethodDescriptorProto*) prototype { return [[PBMethodDescriptorProto builder] mergeFrom:prototype]; } - (PBMethodDescriptorProtoBuilder*) builder { return [PBMethodDescriptorProto builder]; } - (PBMethodDescriptorProtoBuilder*) toBuilder { return [PBMethodDescriptorProto builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasInputType) { [output appendFormat:@"%@%@: %@\n", indent, @"inputType", self.inputType]; } if (self.hasOutputType) { [output appendFormat:@"%@%@: %@\n", indent, @"outputType", self.outputType]; } if (self.hasOptions) { [output appendFormat:@"%@%@ {\n", indent, @"options"]; [self.options writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasInputType) { [dictionary setObject: self.inputType forKey: @"inputType"]; } if (self.hasOutputType) { [dictionary setObject: self.outputType forKey: @"outputType"]; } if (self.hasOptions) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.options storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"options"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBMethodDescriptorProto class]]) { return NO; } PBMethodDescriptorProto *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasInputType == otherMessage.hasInputType && (!self.hasInputType || [self.inputType isEqual:otherMessage.inputType]) && self.hasOutputType == otherMessage.hasOutputType && (!self.hasOutputType || [self.outputType isEqual:otherMessage.outputType]) && self.hasOptions == otherMessage.hasOptions && (!self.hasOptions || [self.options isEqual:otherMessage.options]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasInputType) { hashCode = hashCode * 31 + [self.inputType hash]; } if (self.hasOutputType) { hashCode = hashCode * 31 + [self.outputType hash]; } if (self.hasOptions) { hashCode = hashCode * 31 + [self.options hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBMethodDescriptorProtoBuilder() @property (strong) PBMethodDescriptorProto* resultMethodDescriptorProto; @end @implementation PBMethodDescriptorProtoBuilder @synthesize resultMethodDescriptorProto; - (instancetype) init { if ((self = [super init])) { self.resultMethodDescriptorProto = [[PBMethodDescriptorProto alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultMethodDescriptorProto; } - (PBMethodDescriptorProtoBuilder*) clear { self.resultMethodDescriptorProto = [[PBMethodDescriptorProto alloc] init]; return self; } - (PBMethodDescriptorProtoBuilder*) clone { return [PBMethodDescriptorProto builderWithPrototype:resultMethodDescriptorProto]; } - (PBMethodDescriptorProto*) defaultInstance { return [PBMethodDescriptorProto defaultInstance]; } - (PBMethodDescriptorProto*) build { [self checkInitialized]; return [self buildPartial]; } - (PBMethodDescriptorProto*) buildPartial { PBMethodDescriptorProto* returnMe = resultMethodDescriptorProto; self.resultMethodDescriptorProto = nil; return returnMe; } - (PBMethodDescriptorProtoBuilder*) mergeFrom:(PBMethodDescriptorProto*) other { if (other == [PBMethodDescriptorProto defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasInputType) { [self setInputType:other.inputType]; } if (other.hasOutputType) { [self setOutputType:other.outputType]; } if (other.hasOptions) { [self mergeOptions:other.options]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBMethodDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBMethodDescriptorProtoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { [self setInputType:[input readString]]; break; } case 26: { [self setOutputType:[input readString]]; break; } case 34: { PBMethodOptionsBuilder* subBuilder = [PBMethodOptions builder]; if (self.hasOptions) { [subBuilder mergeFrom:self.options]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setOptions:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasName { return resultMethodDescriptorProto.hasName; } - (NSString*) name { return resultMethodDescriptorProto.name; } - (PBMethodDescriptorProtoBuilder*) setName:(NSString*) value { resultMethodDescriptorProto.hasName = YES; resultMethodDescriptorProto.name = value; return self; } - (PBMethodDescriptorProtoBuilder*) clearName { resultMethodDescriptorProto.hasName = NO; resultMethodDescriptorProto.name = @""; return self; } - (BOOL) hasInputType { return resultMethodDescriptorProto.hasInputType; } - (NSString*) inputType { return resultMethodDescriptorProto.inputType; } - (PBMethodDescriptorProtoBuilder*) setInputType:(NSString*) value { resultMethodDescriptorProto.hasInputType = YES; resultMethodDescriptorProto.inputType = value; return self; } - (PBMethodDescriptorProtoBuilder*) clearInputType { resultMethodDescriptorProto.hasInputType = NO; resultMethodDescriptorProto.inputType = @""; return self; } - (BOOL) hasOutputType { return resultMethodDescriptorProto.hasOutputType; } - (NSString*) outputType { return resultMethodDescriptorProto.outputType; } - (PBMethodDescriptorProtoBuilder*) setOutputType:(NSString*) value { resultMethodDescriptorProto.hasOutputType = YES; resultMethodDescriptorProto.outputType = value; return self; } - (PBMethodDescriptorProtoBuilder*) clearOutputType { resultMethodDescriptorProto.hasOutputType = NO; resultMethodDescriptorProto.outputType = @""; return self; } - (BOOL) hasOptions { return resultMethodDescriptorProto.hasOptions; } - (PBMethodOptions*) options { return resultMethodDescriptorProto.options; } - (PBMethodDescriptorProtoBuilder*) setOptions:(PBMethodOptions*) value { resultMethodDescriptorProto.hasOptions = YES; resultMethodDescriptorProto.options = value; return self; } - (PBMethodDescriptorProtoBuilder*) setOptionsBuilder:(PBMethodOptionsBuilder*) builderForValue { return [self setOptions:[builderForValue build]]; } - (PBMethodDescriptorProtoBuilder*) mergeOptions:(PBMethodOptions*) value { if (resultMethodDescriptorProto.hasOptions && resultMethodDescriptorProto.options != [PBMethodOptions defaultInstance]) { resultMethodDescriptorProto.options = [[[PBMethodOptions builderWithPrototype:resultMethodDescriptorProto.options] mergeFrom:value] buildPartial]; } else { resultMethodDescriptorProto.options = value; } resultMethodDescriptorProto.hasOptions = YES; return self; } - (PBMethodDescriptorProtoBuilder*) clearOptions { resultMethodDescriptorProto.hasOptions = NO; resultMethodDescriptorProto.options = [PBMethodOptions defaultInstance]; return self; } @end @interface PBFileOptions () @property (strong) NSString* javaPackage; @property (strong) NSString* javaOuterClassname; @property BOOL javaMultipleFiles; @property BOOL javaGenerateEqualsAndHash; @property BOOL javaStringCheckUtf8; @property PBFileOptionsOptimizeMode optimizeFor; @property (strong) NSString* goPackage; @property BOOL ccGenericServices; @property BOOL javaGenericServices; @property BOOL pyGenericServices; @property BOOL deprecated; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBFileOptions - (BOOL) hasJavaPackage { return !!hasJavaPackage_; } - (void) setHasJavaPackage:(BOOL) _value_ { hasJavaPackage_ = !!_value_; } @synthesize javaPackage; - (BOOL) hasJavaOuterClassname { return !!hasJavaOuterClassname_; } - (void) setHasJavaOuterClassname:(BOOL) _value_ { hasJavaOuterClassname_ = !!_value_; } @synthesize javaOuterClassname; - (BOOL) hasJavaMultipleFiles { return !!hasJavaMultipleFiles_; } - (void) setHasJavaMultipleFiles:(BOOL) _value_ { hasJavaMultipleFiles_ = !!_value_; } - (BOOL) javaMultipleFiles { return !!javaMultipleFiles_; } - (void) setJavaMultipleFiles:(BOOL) _value_ { javaMultipleFiles_ = !!_value_; } - (BOOL) hasJavaGenerateEqualsAndHash { return !!hasJavaGenerateEqualsAndHash_; } - (void) setHasJavaGenerateEqualsAndHash:(BOOL) _value_ { hasJavaGenerateEqualsAndHash_ = !!_value_; } - (BOOL) javaGenerateEqualsAndHash { return !!javaGenerateEqualsAndHash_; } - (void) setJavaGenerateEqualsAndHash:(BOOL) _value_ { javaGenerateEqualsAndHash_ = !!_value_; } - (BOOL) hasJavaStringCheckUtf8 { return !!hasJavaStringCheckUtf8_; } - (void) setHasJavaStringCheckUtf8:(BOOL) _value_ { hasJavaStringCheckUtf8_ = !!_value_; } - (BOOL) javaStringCheckUtf8 { return !!javaStringCheckUtf8_; } - (void) setJavaStringCheckUtf8:(BOOL) _value_ { javaStringCheckUtf8_ = !!_value_; } - (BOOL) hasOptimizeFor { return !!hasOptimizeFor_; } - (void) setHasOptimizeFor:(BOOL) _value_ { hasOptimizeFor_ = !!_value_; } @synthesize optimizeFor; - (BOOL) hasGoPackage { return !!hasGoPackage_; } - (void) setHasGoPackage:(BOOL) _value_ { hasGoPackage_ = !!_value_; } @synthesize goPackage; - (BOOL) hasCcGenericServices { return !!hasCcGenericServices_; } - (void) setHasCcGenericServices:(BOOL) _value_ { hasCcGenericServices_ = !!_value_; } - (BOOL) ccGenericServices { return !!ccGenericServices_; } - (void) setCcGenericServices:(BOOL) _value_ { ccGenericServices_ = !!_value_; } - (BOOL) hasJavaGenericServices { return !!hasJavaGenericServices_; } - (void) setHasJavaGenericServices:(BOOL) _value_ { hasJavaGenericServices_ = !!_value_; } - (BOOL) javaGenericServices { return !!javaGenericServices_; } - (void) setJavaGenericServices:(BOOL) _value_ { javaGenericServices_ = !!_value_; } - (BOOL) hasPyGenericServices { return !!hasPyGenericServices_; } - (void) setHasPyGenericServices:(BOOL) _value_ { hasPyGenericServices_ = !!_value_; } - (BOOL) pyGenericServices { return !!pyGenericServices_; } - (void) setPyGenericServices:(BOOL) _value_ { pyGenericServices_ = !!_value_; } - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.javaPackage = @""; self.javaOuterClassname = @""; self.javaMultipleFiles = NO; self.javaGenerateEqualsAndHash = NO; self.javaStringCheckUtf8 = NO; self.optimizeFor = PBFileOptionsOptimizeModeSpeed; self.goPackage = @""; self.ccGenericServices = NO; self.javaGenericServices = NO; self.pyGenericServices = NO; self.deprecated = NO; } return self; } static PBFileOptions* defaultPBFileOptionsInstance = nil; + (void) initialize { if (self == [PBFileOptions class]) { defaultPBFileOptionsInstance = [[PBFileOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBFileOptionsInstance; } - (instancetype) defaultInstance { return defaultPBFileOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasJavaPackage) { [output writeString:1 value:self.javaPackage]; } if (self.hasJavaOuterClassname) { [output writeString:8 value:self.javaOuterClassname]; } if (self.hasOptimizeFor) { [output writeEnum:9 value:self.optimizeFor]; } if (self.hasJavaMultipleFiles) { [output writeBool:10 value:self.javaMultipleFiles]; } if (self.hasGoPackage) { [output writeString:11 value:self.goPackage]; } if (self.hasCcGenericServices) { [output writeBool:16 value:self.ccGenericServices]; } if (self.hasJavaGenericServices) { [output writeBool:17 value:self.javaGenericServices]; } if (self.hasPyGenericServices) { [output writeBool:18 value:self.pyGenericServices]; } if (self.hasJavaGenerateEqualsAndHash) { [output writeBool:20 value:self.javaGenerateEqualsAndHash]; } if (self.hasDeprecated) { [output writeBool:23 value:self.deprecated]; } if (self.hasJavaStringCheckUtf8) { [output writeBool:27 value:self.javaStringCheckUtf8]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasJavaPackage) { size_ += computeStringSize(1, self.javaPackage); } if (self.hasJavaOuterClassname) { size_ += computeStringSize(8, self.javaOuterClassname); } if (self.hasOptimizeFor) { size_ += computeEnumSize(9, self.optimizeFor); } if (self.hasJavaMultipleFiles) { size_ += computeBoolSize(10, self.javaMultipleFiles); } if (self.hasGoPackage) { size_ += computeStringSize(11, self.goPackage); } if (self.hasCcGenericServices) { size_ += computeBoolSize(16, self.ccGenericServices); } if (self.hasJavaGenericServices) { size_ += computeBoolSize(17, self.javaGenericServices); } if (self.hasPyGenericServices) { size_ += computeBoolSize(18, self.pyGenericServices); } if (self.hasJavaGenerateEqualsAndHash) { size_ += computeBoolSize(20, self.javaGenerateEqualsAndHash); } if (self.hasDeprecated) { size_ += computeBoolSize(23, self.deprecated); } if (self.hasJavaStringCheckUtf8) { size_ += computeBoolSize(27, self.javaStringCheckUtf8); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBFileOptions*) parseFromData:(NSData*) data { return (PBFileOptions*)[[[PBFileOptions builder] mergeFromData:data] build]; } + (PBFileOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileOptions*)[[[PBFileOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBFileOptions*) parseFromInputStream:(NSInputStream*) input { return (PBFileOptions*)[[[PBFileOptions builder] mergeFromInputStream:input] build]; } + (PBFileOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileOptions*)[[[PBFileOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBFileOptions*)[[[PBFileOptions builder] mergeFromCodedInputStream:input] build]; } + (PBFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFileOptions*)[[[PBFileOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFileOptionsBuilder*) builder { return [[PBFileOptionsBuilder alloc] init]; } + (PBFileOptionsBuilder*) builderWithPrototype:(PBFileOptions*) prototype { return [[PBFileOptions builder] mergeFrom:prototype]; } - (PBFileOptionsBuilder*) builder { return [PBFileOptions builder]; } - (PBFileOptionsBuilder*) toBuilder { return [PBFileOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasJavaPackage) { [output appendFormat:@"%@%@: %@\n", indent, @"javaPackage", self.javaPackage]; } if (self.hasJavaOuterClassname) { [output appendFormat:@"%@%@: %@\n", indent, @"javaOuterClassname", self.javaOuterClassname]; } if (self.hasOptimizeFor) { [output appendFormat:@"%@%@: %@\n", indent, @"optimizeFor", NSStringFromPBFileOptionsOptimizeMode(self.optimizeFor)]; } if (self.hasJavaMultipleFiles) { [output appendFormat:@"%@%@: %@\n", indent, @"javaMultipleFiles", [NSNumber numberWithBool:self.javaMultipleFiles]]; } if (self.hasGoPackage) { [output appendFormat:@"%@%@: %@\n", indent, @"goPackage", self.goPackage]; } if (self.hasCcGenericServices) { [output appendFormat:@"%@%@: %@\n", indent, @"ccGenericServices", [NSNumber numberWithBool:self.ccGenericServices]]; } if (self.hasJavaGenericServices) { [output appendFormat:@"%@%@: %@\n", indent, @"javaGenericServices", [NSNumber numberWithBool:self.javaGenericServices]]; } if (self.hasPyGenericServices) { [output appendFormat:@"%@%@: %@\n", indent, @"pyGenericServices", [NSNumber numberWithBool:self.pyGenericServices]]; } if (self.hasJavaGenerateEqualsAndHash) { [output appendFormat:@"%@%@: %@\n", indent, @"javaGenerateEqualsAndHash", [NSNumber numberWithBool:self.javaGenerateEqualsAndHash]]; } if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } if (self.hasJavaStringCheckUtf8) { [output appendFormat:@"%@%@: %@\n", indent, @"javaStringCheckUtf8", [NSNumber numberWithBool:self.javaStringCheckUtf8]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasJavaPackage) { [dictionary setObject: self.javaPackage forKey: @"javaPackage"]; } if (self.hasJavaOuterClassname) { [dictionary setObject: self.javaOuterClassname forKey: @"javaOuterClassname"]; } if (self.hasOptimizeFor) { [dictionary setObject: @(self.optimizeFor) forKey: @"optimizeFor"]; } if (self.hasJavaMultipleFiles) { [dictionary setObject: [NSNumber numberWithBool:self.javaMultipleFiles] forKey: @"javaMultipleFiles"]; } if (self.hasGoPackage) { [dictionary setObject: self.goPackage forKey: @"goPackage"]; } if (self.hasCcGenericServices) { [dictionary setObject: [NSNumber numberWithBool:self.ccGenericServices] forKey: @"ccGenericServices"]; } if (self.hasJavaGenericServices) { [dictionary setObject: [NSNumber numberWithBool:self.javaGenericServices] forKey: @"javaGenericServices"]; } if (self.hasPyGenericServices) { [dictionary setObject: [NSNumber numberWithBool:self.pyGenericServices] forKey: @"pyGenericServices"]; } if (self.hasJavaGenerateEqualsAndHash) { [dictionary setObject: [NSNumber numberWithBool:self.javaGenerateEqualsAndHash] forKey: @"javaGenerateEqualsAndHash"]; } if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } if (self.hasJavaStringCheckUtf8) { [dictionary setObject: [NSNumber numberWithBool:self.javaStringCheckUtf8] forKey: @"javaStringCheckUtf8"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBFileOptions class]]) { return NO; } PBFileOptions *otherMessage = other; return self.hasJavaPackage == otherMessage.hasJavaPackage && (!self.hasJavaPackage || [self.javaPackage isEqual:otherMessage.javaPackage]) && self.hasJavaOuterClassname == otherMessage.hasJavaOuterClassname && (!self.hasJavaOuterClassname || [self.javaOuterClassname isEqual:otherMessage.javaOuterClassname]) && self.hasOptimizeFor == otherMessage.hasOptimizeFor && (!self.hasOptimizeFor || self.optimizeFor == otherMessage.optimizeFor) && self.hasJavaMultipleFiles == otherMessage.hasJavaMultipleFiles && (!self.hasJavaMultipleFiles || self.javaMultipleFiles == otherMessage.javaMultipleFiles) && self.hasGoPackage == otherMessage.hasGoPackage && (!self.hasGoPackage || [self.goPackage isEqual:otherMessage.goPackage]) && self.hasCcGenericServices == otherMessage.hasCcGenericServices && (!self.hasCcGenericServices || self.ccGenericServices == otherMessage.ccGenericServices) && self.hasJavaGenericServices == otherMessage.hasJavaGenericServices && (!self.hasJavaGenericServices || self.javaGenericServices == otherMessage.javaGenericServices) && self.hasPyGenericServices == otherMessage.hasPyGenericServices && (!self.hasPyGenericServices || self.pyGenericServices == otherMessage.pyGenericServices) && self.hasJavaGenerateEqualsAndHash == otherMessage.hasJavaGenerateEqualsAndHash && (!self.hasJavaGenerateEqualsAndHash || self.javaGenerateEqualsAndHash == otherMessage.javaGenerateEqualsAndHash) && self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && self.hasJavaStringCheckUtf8 == otherMessage.hasJavaStringCheckUtf8 && (!self.hasJavaStringCheckUtf8 || self.javaStringCheckUtf8 == otherMessage.javaStringCheckUtf8) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasJavaPackage) { hashCode = hashCode * 31 + [self.javaPackage hash]; } if (self.hasJavaOuterClassname) { hashCode = hashCode * 31 + [self.javaOuterClassname hash]; } if (self.hasOptimizeFor) { hashCode = hashCode * 31 + self.optimizeFor; } if (self.hasJavaMultipleFiles) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.javaMultipleFiles] hash]; } if (self.hasGoPackage) { hashCode = hashCode * 31 + [self.goPackage hash]; } if (self.hasCcGenericServices) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.ccGenericServices] hash]; } if (self.hasJavaGenericServices) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.javaGenericServices] hash]; } if (self.hasPyGenericServices) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.pyGenericServices] hash]; } if (self.hasJavaGenerateEqualsAndHash) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.javaGenerateEqualsAndHash] hash]; } if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } if (self.hasJavaStringCheckUtf8) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.javaStringCheckUtf8] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end BOOL PBFileOptionsOptimizeModeIsValidValue(PBFileOptionsOptimizeMode value) { switch (value) { case PBFileOptionsOptimizeModeSpeed: case PBFileOptionsOptimizeModeCodeSize: case PBFileOptionsOptimizeModeLiteRuntime: return YES; default: return NO; } } NSString *NSStringFromPBFileOptionsOptimizeMode(PBFileOptionsOptimizeMode value) { switch (value) { case PBFileOptionsOptimizeModeSpeed: return @"PBFileOptionsOptimizeModeSpeed"; case PBFileOptionsOptimizeModeCodeSize: return @"PBFileOptionsOptimizeModeCodeSize"; case PBFileOptionsOptimizeModeLiteRuntime: return @"PBFileOptionsOptimizeModeLiteRuntime"; default: return nil; } } @interface PBFileOptionsBuilder() @property (strong) PBFileOptions* resultFileOptions; @end @implementation PBFileOptionsBuilder @synthesize resultFileOptions; - (instancetype) init { if ((self = [super init])) { self.resultFileOptions = [[PBFileOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultFileOptions; } - (PBFileOptionsBuilder*) clear { self.resultFileOptions = [[PBFileOptions alloc] init]; return self; } - (PBFileOptionsBuilder*) clone { return [PBFileOptions builderWithPrototype:resultFileOptions]; } - (PBFileOptions*) defaultInstance { return [PBFileOptions defaultInstance]; } - (PBFileOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBFileOptions*) buildPartial { PBFileOptions* returnMe = resultFileOptions; self.resultFileOptions = nil; return returnMe; } - (PBFileOptionsBuilder*) mergeFrom:(PBFileOptions*) other { if (other == [PBFileOptions defaultInstance]) { return self; } if (other.hasJavaPackage) { [self setJavaPackage:other.javaPackage]; } if (other.hasJavaOuterClassname) { [self setJavaOuterClassname:other.javaOuterClassname]; } if (other.hasJavaMultipleFiles) { [self setJavaMultipleFiles:other.javaMultipleFiles]; } if (other.hasJavaGenerateEqualsAndHash) { [self setJavaGenerateEqualsAndHash:other.javaGenerateEqualsAndHash]; } if (other.hasJavaStringCheckUtf8) { [self setJavaStringCheckUtf8:other.javaStringCheckUtf8]; } if (other.hasOptimizeFor) { [self setOptimizeFor:other.optimizeFor]; } if (other.hasGoPackage) { [self setGoPackage:other.goPackage]; } if (other.hasCcGenericServices) { [self setCcGenericServices:other.ccGenericServices]; } if (other.hasJavaGenericServices) { [self setJavaGenericServices:other.javaGenericServices]; } if (other.hasPyGenericServices) { [self setPyGenericServices:other.pyGenericServices]; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.uninterpretedOptionArray.count > 0) { if (resultFileOptions.uninterpretedOptionArray == nil) { resultFileOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultFileOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setJavaPackage:[input readString]]; break; } case 66: { [self setJavaOuterClassname:[input readString]]; break; } case 72: { PBFileOptionsOptimizeMode value = (PBFileOptionsOptimizeMode)[input readEnum]; if (PBFileOptionsOptimizeModeIsValidValue(value)) { [self setOptimizeFor:value]; } else { [unknownFields mergeVarintField:9 value:value]; } break; } case 80: { [self setJavaMultipleFiles:[input readBool]]; break; } case 90: { [self setGoPackage:[input readString]]; break; } case 128: { [self setCcGenericServices:[input readBool]]; break; } case 136: { [self setJavaGenericServices:[input readBool]]; break; } case 144: { [self setPyGenericServices:[input readBool]]; break; } case 160: { [self setJavaGenerateEqualsAndHash:[input readBool]]; break; } case 184: { [self setDeprecated:[input readBool]]; break; } case 216: { [self setJavaStringCheckUtf8:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasJavaPackage { return resultFileOptions.hasJavaPackage; } - (NSString*) javaPackage { return resultFileOptions.javaPackage; } - (PBFileOptionsBuilder*) setJavaPackage:(NSString*) value { resultFileOptions.hasJavaPackage = YES; resultFileOptions.javaPackage = value; return self; } - (PBFileOptionsBuilder*) clearJavaPackage { resultFileOptions.hasJavaPackage = NO; resultFileOptions.javaPackage = @""; return self; } - (BOOL) hasJavaOuterClassname { return resultFileOptions.hasJavaOuterClassname; } - (NSString*) javaOuterClassname { return resultFileOptions.javaOuterClassname; } - (PBFileOptionsBuilder*) setJavaOuterClassname:(NSString*) value { resultFileOptions.hasJavaOuterClassname = YES; resultFileOptions.javaOuterClassname = value; return self; } - (PBFileOptionsBuilder*) clearJavaOuterClassname { resultFileOptions.hasJavaOuterClassname = NO; resultFileOptions.javaOuterClassname = @""; return self; } - (BOOL) hasJavaMultipleFiles { return resultFileOptions.hasJavaMultipleFiles; } - (BOOL) javaMultipleFiles { return resultFileOptions.javaMultipleFiles; } - (PBFileOptionsBuilder*) setJavaMultipleFiles:(BOOL) value { resultFileOptions.hasJavaMultipleFiles = YES; resultFileOptions.javaMultipleFiles = value; return self; } - (PBFileOptionsBuilder*) clearJavaMultipleFiles { resultFileOptions.hasJavaMultipleFiles = NO; resultFileOptions.javaMultipleFiles = NO; return self; } - (BOOL) hasJavaGenerateEqualsAndHash { return resultFileOptions.hasJavaGenerateEqualsAndHash; } - (BOOL) javaGenerateEqualsAndHash { return resultFileOptions.javaGenerateEqualsAndHash; } - (PBFileOptionsBuilder*) setJavaGenerateEqualsAndHash:(BOOL) value { resultFileOptions.hasJavaGenerateEqualsAndHash = YES; resultFileOptions.javaGenerateEqualsAndHash = value; return self; } - (PBFileOptionsBuilder*) clearJavaGenerateEqualsAndHash { resultFileOptions.hasJavaGenerateEqualsAndHash = NO; resultFileOptions.javaGenerateEqualsAndHash = NO; return self; } - (BOOL) hasJavaStringCheckUtf8 { return resultFileOptions.hasJavaStringCheckUtf8; } - (BOOL) javaStringCheckUtf8 { return resultFileOptions.javaStringCheckUtf8; } - (PBFileOptionsBuilder*) setJavaStringCheckUtf8:(BOOL) value { resultFileOptions.hasJavaStringCheckUtf8 = YES; resultFileOptions.javaStringCheckUtf8 = value; return self; } - (PBFileOptionsBuilder*) clearJavaStringCheckUtf8 { resultFileOptions.hasJavaStringCheckUtf8 = NO; resultFileOptions.javaStringCheckUtf8 = NO; return self; } - (BOOL) hasOptimizeFor { return resultFileOptions.hasOptimizeFor; } - (PBFileOptionsOptimizeMode) optimizeFor { return resultFileOptions.optimizeFor; } - (PBFileOptionsBuilder*) setOptimizeFor:(PBFileOptionsOptimizeMode) value { resultFileOptions.hasOptimizeFor = YES; resultFileOptions.optimizeFor = value; return self; } - (PBFileOptionsBuilder*) clearOptimizeFor { resultFileOptions.hasOptimizeFor = NO; resultFileOptions.optimizeFor = PBFileOptionsOptimizeModeSpeed; return self; } - (BOOL) hasGoPackage { return resultFileOptions.hasGoPackage; } - (NSString*) goPackage { return resultFileOptions.goPackage; } - (PBFileOptionsBuilder*) setGoPackage:(NSString*) value { resultFileOptions.hasGoPackage = YES; resultFileOptions.goPackage = value; return self; } - (PBFileOptionsBuilder*) clearGoPackage { resultFileOptions.hasGoPackage = NO; resultFileOptions.goPackage = @""; return self; } - (BOOL) hasCcGenericServices { return resultFileOptions.hasCcGenericServices; } - (BOOL) ccGenericServices { return resultFileOptions.ccGenericServices; } - (PBFileOptionsBuilder*) setCcGenericServices:(BOOL) value { resultFileOptions.hasCcGenericServices = YES; resultFileOptions.ccGenericServices = value; return self; } - (PBFileOptionsBuilder*) clearCcGenericServices { resultFileOptions.hasCcGenericServices = NO; resultFileOptions.ccGenericServices = NO; return self; } - (BOOL) hasJavaGenericServices { return resultFileOptions.hasJavaGenericServices; } - (BOOL) javaGenericServices { return resultFileOptions.javaGenericServices; } - (PBFileOptionsBuilder*) setJavaGenericServices:(BOOL) value { resultFileOptions.hasJavaGenericServices = YES; resultFileOptions.javaGenericServices = value; return self; } - (PBFileOptionsBuilder*) clearJavaGenericServices { resultFileOptions.hasJavaGenericServices = NO; resultFileOptions.javaGenericServices = NO; return self; } - (BOOL) hasPyGenericServices { return resultFileOptions.hasPyGenericServices; } - (BOOL) pyGenericServices { return resultFileOptions.pyGenericServices; } - (PBFileOptionsBuilder*) setPyGenericServices:(BOOL) value { resultFileOptions.hasPyGenericServices = YES; resultFileOptions.pyGenericServices = value; return self; } - (PBFileOptionsBuilder*) clearPyGenericServices { resultFileOptions.hasPyGenericServices = NO; resultFileOptions.pyGenericServices = NO; return self; } - (BOOL) hasDeprecated { return resultFileOptions.hasDeprecated; } - (BOOL) deprecated { return resultFileOptions.deprecated; } - (PBFileOptionsBuilder*) setDeprecated:(BOOL) value { resultFileOptions.hasDeprecated = YES; resultFileOptions.deprecated = value; return self; } - (PBFileOptionsBuilder*) clearDeprecated { resultFileOptions.hasDeprecated = NO; resultFileOptions.deprecated = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultFileOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultFileOptions uninterpretedOptionAtIndex:index]; } - (PBFileOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultFileOptions.uninterpretedOptionArray == nil) { resultFileOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultFileOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBFileOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultFileOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFileOptionsBuilder *)clearUninterpretedOption { resultFileOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBMessageOptions () @property BOOL messageSetWireFormat; @property BOOL noStandardDescriptorAccessor; @property BOOL deprecated; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBMessageOptions - (BOOL) hasMessageSetWireFormat { return !!hasMessageSetWireFormat_; } - (void) setHasMessageSetWireFormat:(BOOL) _value_ { hasMessageSetWireFormat_ = !!_value_; } - (BOOL) messageSetWireFormat { return !!messageSetWireFormat_; } - (void) setMessageSetWireFormat:(BOOL) _value_ { messageSetWireFormat_ = !!_value_; } - (BOOL) hasNoStandardDescriptorAccessor { return !!hasNoStandardDescriptorAccessor_; } - (void) setHasNoStandardDescriptorAccessor:(BOOL) _value_ { hasNoStandardDescriptorAccessor_ = !!_value_; } - (BOOL) noStandardDescriptorAccessor { return !!noStandardDescriptorAccessor_; } - (void) setNoStandardDescriptorAccessor:(BOOL) _value_ { noStandardDescriptorAccessor_ = !!_value_; } - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.messageSetWireFormat = NO; self.noStandardDescriptorAccessor = NO; self.deprecated = NO; } return self; } static PBMessageOptions* defaultPBMessageOptionsInstance = nil; + (void) initialize { if (self == [PBMessageOptions class]) { defaultPBMessageOptionsInstance = [[PBMessageOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBMessageOptionsInstance; } - (instancetype) defaultInstance { return defaultPBMessageOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasMessageSetWireFormat) { [output writeBool:1 value:self.messageSetWireFormat]; } if (self.hasNoStandardDescriptorAccessor) { [output writeBool:2 value:self.noStandardDescriptorAccessor]; } if (self.hasDeprecated) { [output writeBool:3 value:self.deprecated]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasMessageSetWireFormat) { size_ += computeBoolSize(1, self.messageSetWireFormat); } if (self.hasNoStandardDescriptorAccessor) { size_ += computeBoolSize(2, self.noStandardDescriptorAccessor); } if (self.hasDeprecated) { size_ += computeBoolSize(3, self.deprecated); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBMessageOptions*) parseFromData:(NSData*) data { return (PBMessageOptions*)[[[PBMessageOptions builder] mergeFromData:data] build]; } + (PBMessageOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMessageOptions*)[[[PBMessageOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBMessageOptions*) parseFromInputStream:(NSInputStream*) input { return (PBMessageOptions*)[[[PBMessageOptions builder] mergeFromInputStream:input] build]; } + (PBMessageOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMessageOptions*)[[[PBMessageOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBMessageOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBMessageOptions*)[[[PBMessageOptions builder] mergeFromCodedInputStream:input] build]; } + (PBMessageOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMessageOptions*)[[[PBMessageOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBMessageOptionsBuilder*) builder { return [[PBMessageOptionsBuilder alloc] init]; } + (PBMessageOptionsBuilder*) builderWithPrototype:(PBMessageOptions*) prototype { return [[PBMessageOptions builder] mergeFrom:prototype]; } - (PBMessageOptionsBuilder*) builder { return [PBMessageOptions builder]; } - (PBMessageOptionsBuilder*) toBuilder { return [PBMessageOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasMessageSetWireFormat) { [output appendFormat:@"%@%@: %@\n", indent, @"messageSetWireFormat", [NSNumber numberWithBool:self.messageSetWireFormat]]; } if (self.hasNoStandardDescriptorAccessor) { [output appendFormat:@"%@%@: %@\n", indent, @"noStandardDescriptorAccessor", [NSNumber numberWithBool:self.noStandardDescriptorAccessor]]; } if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasMessageSetWireFormat) { [dictionary setObject: [NSNumber numberWithBool:self.messageSetWireFormat] forKey: @"messageSetWireFormat"]; } if (self.hasNoStandardDescriptorAccessor) { [dictionary setObject: [NSNumber numberWithBool:self.noStandardDescriptorAccessor] forKey: @"noStandardDescriptorAccessor"]; } if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBMessageOptions class]]) { return NO; } PBMessageOptions *otherMessage = other; return self.hasMessageSetWireFormat == otherMessage.hasMessageSetWireFormat && (!self.hasMessageSetWireFormat || self.messageSetWireFormat == otherMessage.messageSetWireFormat) && self.hasNoStandardDescriptorAccessor == otherMessage.hasNoStandardDescriptorAccessor && (!self.hasNoStandardDescriptorAccessor || self.noStandardDescriptorAccessor == otherMessage.noStandardDescriptorAccessor) && self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasMessageSetWireFormat) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.messageSetWireFormat] hash]; } if (self.hasNoStandardDescriptorAccessor) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.noStandardDescriptorAccessor] hash]; } if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBMessageOptionsBuilder() @property (strong) PBMessageOptions* resultMessageOptions; @end @implementation PBMessageOptionsBuilder @synthesize resultMessageOptions; - (instancetype) init { if ((self = [super init])) { self.resultMessageOptions = [[PBMessageOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultMessageOptions; } - (PBMessageOptionsBuilder*) clear { self.resultMessageOptions = [[PBMessageOptions alloc] init]; return self; } - (PBMessageOptionsBuilder*) clone { return [PBMessageOptions builderWithPrototype:resultMessageOptions]; } - (PBMessageOptions*) defaultInstance { return [PBMessageOptions defaultInstance]; } - (PBMessageOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBMessageOptions*) buildPartial { PBMessageOptions* returnMe = resultMessageOptions; self.resultMessageOptions = nil; return returnMe; } - (PBMessageOptionsBuilder*) mergeFrom:(PBMessageOptions*) other { if (other == [PBMessageOptions defaultInstance]) { return self; } if (other.hasMessageSetWireFormat) { [self setMessageSetWireFormat:other.messageSetWireFormat]; } if (other.hasNoStandardDescriptorAccessor) { [self setNoStandardDescriptorAccessor:other.noStandardDescriptorAccessor]; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.uninterpretedOptionArray.count > 0) { if (resultMessageOptions.uninterpretedOptionArray == nil) { resultMessageOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultMessageOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBMessageOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBMessageOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setMessageSetWireFormat:[input readBool]]; break; } case 16: { [self setNoStandardDescriptorAccessor:[input readBool]]; break; } case 24: { [self setDeprecated:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasMessageSetWireFormat { return resultMessageOptions.hasMessageSetWireFormat; } - (BOOL) messageSetWireFormat { return resultMessageOptions.messageSetWireFormat; } - (PBMessageOptionsBuilder*) setMessageSetWireFormat:(BOOL) value { resultMessageOptions.hasMessageSetWireFormat = YES; resultMessageOptions.messageSetWireFormat = value; return self; } - (PBMessageOptionsBuilder*) clearMessageSetWireFormat { resultMessageOptions.hasMessageSetWireFormat = NO; resultMessageOptions.messageSetWireFormat = NO; return self; } - (BOOL) hasNoStandardDescriptorAccessor { return resultMessageOptions.hasNoStandardDescriptorAccessor; } - (BOOL) noStandardDescriptorAccessor { return resultMessageOptions.noStandardDescriptorAccessor; } - (PBMessageOptionsBuilder*) setNoStandardDescriptorAccessor:(BOOL) value { resultMessageOptions.hasNoStandardDescriptorAccessor = YES; resultMessageOptions.noStandardDescriptorAccessor = value; return self; } - (PBMessageOptionsBuilder*) clearNoStandardDescriptorAccessor { resultMessageOptions.hasNoStandardDescriptorAccessor = NO; resultMessageOptions.noStandardDescriptorAccessor = NO; return self; } - (BOOL) hasDeprecated { return resultMessageOptions.hasDeprecated; } - (BOOL) deprecated { return resultMessageOptions.deprecated; } - (PBMessageOptionsBuilder*) setDeprecated:(BOOL) value { resultMessageOptions.hasDeprecated = YES; resultMessageOptions.deprecated = value; return self; } - (PBMessageOptionsBuilder*) clearDeprecated { resultMessageOptions.hasDeprecated = NO; resultMessageOptions.deprecated = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultMessageOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultMessageOptions uninterpretedOptionAtIndex:index]; } - (PBMessageOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultMessageOptions.uninterpretedOptionArray == nil) { resultMessageOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultMessageOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBMessageOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultMessageOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBMessageOptionsBuilder *)clearUninterpretedOption { resultMessageOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBFieldOptions () @property PBFieldOptionsCType ctype; @property BOOL packed; @property BOOL lazy; @property BOOL deprecated; @property (strong) NSString* experimentalMapKey; @property BOOL weak; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBFieldOptions - (BOOL) hasCtype { return !!hasCtype_; } - (void) setHasCtype:(BOOL) _value_ { hasCtype_ = !!_value_; } @synthesize ctype; - (BOOL) hasPacked { return !!hasPacked_; } - (void) setHasPacked:(BOOL) _value_ { hasPacked_ = !!_value_; } - (BOOL) packed { return !!packed_; } - (void) setPacked:(BOOL) _value_ { packed_ = !!_value_; } - (BOOL) hasLazy { return !!hasLazy_; } - (void) setHasLazy:(BOOL) _value_ { hasLazy_ = !!_value_; } - (BOOL) lazy { return !!lazy_; } - (void) setLazy:(BOOL) _value_ { lazy_ = !!_value_; } - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } - (BOOL) hasExperimentalMapKey { return !!hasExperimentalMapKey_; } - (void) setHasExperimentalMapKey:(BOOL) _value_ { hasExperimentalMapKey_ = !!_value_; } @synthesize experimentalMapKey; - (BOOL) hasWeak { return !!hasWeak_; } - (void) setHasWeak:(BOOL) _value_ { hasWeak_ = !!_value_; } - (BOOL) weak { return !!weak_; } - (void) setWeak:(BOOL) _value_ { weak_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.ctype = PBFieldOptionsCTypeString; self.packed = NO; self.lazy = NO; self.deprecated = NO; self.experimentalMapKey = @""; self.weak = NO; } return self; } static PBFieldOptions* defaultPBFieldOptionsInstance = nil; + (void) initialize { if (self == [PBFieldOptions class]) { defaultPBFieldOptionsInstance = [[PBFieldOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBFieldOptionsInstance; } - (instancetype) defaultInstance { return defaultPBFieldOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCtype) { [output writeEnum:1 value:self.ctype]; } if (self.hasPacked) { [output writeBool:2 value:self.packed]; } if (self.hasDeprecated) { [output writeBool:3 value:self.deprecated]; } if (self.hasLazy) { [output writeBool:5 value:self.lazy]; } if (self.hasExperimentalMapKey) { [output writeString:9 value:self.experimentalMapKey]; } if (self.hasWeak) { [output writeBool:10 value:self.weak]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCtype) { size_ += computeEnumSize(1, self.ctype); } if (self.hasPacked) { size_ += computeBoolSize(2, self.packed); } if (self.hasDeprecated) { size_ += computeBoolSize(3, self.deprecated); } if (self.hasLazy) { size_ += computeBoolSize(5, self.lazy); } if (self.hasExperimentalMapKey) { size_ += computeStringSize(9, self.experimentalMapKey); } if (self.hasWeak) { size_ += computeBoolSize(10, self.weak); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBFieldOptions*) parseFromData:(NSData*) data { return (PBFieldOptions*)[[[PBFieldOptions builder] mergeFromData:data] build]; } + (PBFieldOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFieldOptions*)[[[PBFieldOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBFieldOptions*) parseFromInputStream:(NSInputStream*) input { return (PBFieldOptions*)[[[PBFieldOptions builder] mergeFromInputStream:input] build]; } + (PBFieldOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFieldOptions*)[[[PBFieldOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFieldOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBFieldOptions*)[[[PBFieldOptions builder] mergeFromCodedInputStream:input] build]; } + (PBFieldOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBFieldOptions*)[[[PBFieldOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBFieldOptionsBuilder*) builder { return [[PBFieldOptionsBuilder alloc] init]; } + (PBFieldOptionsBuilder*) builderWithPrototype:(PBFieldOptions*) prototype { return [[PBFieldOptions builder] mergeFrom:prototype]; } - (PBFieldOptionsBuilder*) builder { return [PBFieldOptions builder]; } - (PBFieldOptionsBuilder*) toBuilder { return [PBFieldOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCtype) { [output appendFormat:@"%@%@: %@\n", indent, @"ctype", NSStringFromPBFieldOptionsCType(self.ctype)]; } if (self.hasPacked) { [output appendFormat:@"%@%@: %@\n", indent, @"packed", [NSNumber numberWithBool:self.packed]]; } if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } if (self.hasLazy) { [output appendFormat:@"%@%@: %@\n", indent, @"lazy", [NSNumber numberWithBool:self.lazy]]; } if (self.hasExperimentalMapKey) { [output appendFormat:@"%@%@: %@\n", indent, @"experimentalMapKey", self.experimentalMapKey]; } if (self.hasWeak) { [output appendFormat:@"%@%@: %@\n", indent, @"weak", [NSNumber numberWithBool:self.weak]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCtype) { [dictionary setObject: @(self.ctype) forKey: @"ctype"]; } if (self.hasPacked) { [dictionary setObject: [NSNumber numberWithBool:self.packed] forKey: @"packed"]; } if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } if (self.hasLazy) { [dictionary setObject: [NSNumber numberWithBool:self.lazy] forKey: @"lazy"]; } if (self.hasExperimentalMapKey) { [dictionary setObject: self.experimentalMapKey forKey: @"experimentalMapKey"]; } if (self.hasWeak) { [dictionary setObject: [NSNumber numberWithBool:self.weak] forKey: @"weak"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBFieldOptions class]]) { return NO; } PBFieldOptions *otherMessage = other; return self.hasCtype == otherMessage.hasCtype && (!self.hasCtype || self.ctype == otherMessage.ctype) && self.hasPacked == otherMessage.hasPacked && (!self.hasPacked || self.packed == otherMessage.packed) && self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && self.hasLazy == otherMessage.hasLazy && (!self.hasLazy || self.lazy == otherMessage.lazy) && self.hasExperimentalMapKey == otherMessage.hasExperimentalMapKey && (!self.hasExperimentalMapKey || [self.experimentalMapKey isEqual:otherMessage.experimentalMapKey]) && self.hasWeak == otherMessage.hasWeak && (!self.hasWeak || self.weak == otherMessage.weak) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCtype) { hashCode = hashCode * 31 + self.ctype; } if (self.hasPacked) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.packed] hash]; } if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } if (self.hasLazy) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.lazy] hash]; } if (self.hasExperimentalMapKey) { hashCode = hashCode * 31 + [self.experimentalMapKey hash]; } if (self.hasWeak) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.weak] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end BOOL PBFieldOptionsCTypeIsValidValue(PBFieldOptionsCType value) { switch (value) { case PBFieldOptionsCTypeString: case PBFieldOptionsCTypeCord: case PBFieldOptionsCTypeStringPiece: return YES; default: return NO; } } NSString *NSStringFromPBFieldOptionsCType(PBFieldOptionsCType value) { switch (value) { case PBFieldOptionsCTypeString: return @"PBFieldOptionsCTypeString"; case PBFieldOptionsCTypeCord: return @"PBFieldOptionsCTypeCord"; case PBFieldOptionsCTypeStringPiece: return @"PBFieldOptionsCTypeStringPiece"; default: return nil; } } @interface PBFieldOptionsBuilder() @property (strong) PBFieldOptions* resultFieldOptions; @end @implementation PBFieldOptionsBuilder @synthesize resultFieldOptions; - (instancetype) init { if ((self = [super init])) { self.resultFieldOptions = [[PBFieldOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultFieldOptions; } - (PBFieldOptionsBuilder*) clear { self.resultFieldOptions = [[PBFieldOptions alloc] init]; return self; } - (PBFieldOptionsBuilder*) clone { return [PBFieldOptions builderWithPrototype:resultFieldOptions]; } - (PBFieldOptions*) defaultInstance { return [PBFieldOptions defaultInstance]; } - (PBFieldOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBFieldOptions*) buildPartial { PBFieldOptions* returnMe = resultFieldOptions; self.resultFieldOptions = nil; return returnMe; } - (PBFieldOptionsBuilder*) mergeFrom:(PBFieldOptions*) other { if (other == [PBFieldOptions defaultInstance]) { return self; } if (other.hasCtype) { [self setCtype:other.ctype]; } if (other.hasPacked) { [self setPacked:other.packed]; } if (other.hasLazy) { [self setLazy:other.lazy]; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.hasExperimentalMapKey) { [self setExperimentalMapKey:other.experimentalMapKey]; } if (other.hasWeak) { [self setWeak:other.weak]; } if (other.uninterpretedOptionArray.count > 0) { if (resultFieldOptions.uninterpretedOptionArray == nil) { resultFieldOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultFieldOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBFieldOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBFieldOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { PBFieldOptionsCType value = (PBFieldOptionsCType)[input readEnum]; if (PBFieldOptionsCTypeIsValidValue(value)) { [self setCtype:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 16: { [self setPacked:[input readBool]]; break; } case 24: { [self setDeprecated:[input readBool]]; break; } case 40: { [self setLazy:[input readBool]]; break; } case 74: { [self setExperimentalMapKey:[input readString]]; break; } case 80: { [self setWeak:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasCtype { return resultFieldOptions.hasCtype; } - (PBFieldOptionsCType) ctype { return resultFieldOptions.ctype; } - (PBFieldOptionsBuilder*) setCtype:(PBFieldOptionsCType) value { resultFieldOptions.hasCtype = YES; resultFieldOptions.ctype = value; return self; } - (PBFieldOptionsBuilder*) clearCtype { resultFieldOptions.hasCtype = NO; resultFieldOptions.ctype = PBFieldOptionsCTypeString; return self; } - (BOOL) hasPacked { return resultFieldOptions.hasPacked; } - (BOOL) packed { return resultFieldOptions.packed; } - (PBFieldOptionsBuilder*) setPacked:(BOOL) value { resultFieldOptions.hasPacked = YES; resultFieldOptions.packed = value; return self; } - (PBFieldOptionsBuilder*) clearPacked { resultFieldOptions.hasPacked = NO; resultFieldOptions.packed = NO; return self; } - (BOOL) hasLazy { return resultFieldOptions.hasLazy; } - (BOOL) lazy { return resultFieldOptions.lazy; } - (PBFieldOptionsBuilder*) setLazy:(BOOL) value { resultFieldOptions.hasLazy = YES; resultFieldOptions.lazy = value; return self; } - (PBFieldOptionsBuilder*) clearLazy { resultFieldOptions.hasLazy = NO; resultFieldOptions.lazy = NO; return self; } - (BOOL) hasDeprecated { return resultFieldOptions.hasDeprecated; } - (BOOL) deprecated { return resultFieldOptions.deprecated; } - (PBFieldOptionsBuilder*) setDeprecated:(BOOL) value { resultFieldOptions.hasDeprecated = YES; resultFieldOptions.deprecated = value; return self; } - (PBFieldOptionsBuilder*) clearDeprecated { resultFieldOptions.hasDeprecated = NO; resultFieldOptions.deprecated = NO; return self; } - (BOOL) hasExperimentalMapKey { return resultFieldOptions.hasExperimentalMapKey; } - (NSString*) experimentalMapKey { return resultFieldOptions.experimentalMapKey; } - (PBFieldOptionsBuilder*) setExperimentalMapKey:(NSString*) value { resultFieldOptions.hasExperimentalMapKey = YES; resultFieldOptions.experimentalMapKey = value; return self; } - (PBFieldOptionsBuilder*) clearExperimentalMapKey { resultFieldOptions.hasExperimentalMapKey = NO; resultFieldOptions.experimentalMapKey = @""; return self; } - (BOOL) hasWeak { return resultFieldOptions.hasWeak; } - (BOOL) weak { return resultFieldOptions.weak; } - (PBFieldOptionsBuilder*) setWeak:(BOOL) value { resultFieldOptions.hasWeak = YES; resultFieldOptions.weak = value; return self; } - (PBFieldOptionsBuilder*) clearWeak { resultFieldOptions.hasWeak = NO; resultFieldOptions.weak = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultFieldOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultFieldOptions uninterpretedOptionAtIndex:index]; } - (PBFieldOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultFieldOptions.uninterpretedOptionArray == nil) { resultFieldOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultFieldOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBFieldOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultFieldOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBFieldOptionsBuilder *)clearUninterpretedOption { resultFieldOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBEnumOptions () @property BOOL allowAlias; @property BOOL deprecated; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBEnumOptions - (BOOL) hasAllowAlias { return !!hasAllowAlias_; } - (void) setHasAllowAlias:(BOOL) _value_ { hasAllowAlias_ = !!_value_; } - (BOOL) allowAlias { return !!allowAlias_; } - (void) setAllowAlias:(BOOL) _value_ { allowAlias_ = !!_value_; } - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.allowAlias = NO; self.deprecated = NO; } return self; } static PBEnumOptions* defaultPBEnumOptionsInstance = nil; + (void) initialize { if (self == [PBEnumOptions class]) { defaultPBEnumOptionsInstance = [[PBEnumOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBEnumOptionsInstance; } - (instancetype) defaultInstance { return defaultPBEnumOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasAllowAlias) { [output writeBool:2 value:self.allowAlias]; } if (self.hasDeprecated) { [output writeBool:3 value:self.deprecated]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasAllowAlias) { size_ += computeBoolSize(2, self.allowAlias); } if (self.hasDeprecated) { size_ += computeBoolSize(3, self.deprecated); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBEnumOptions*) parseFromData:(NSData*) data { return (PBEnumOptions*)[[[PBEnumOptions builder] mergeFromData:data] build]; } + (PBEnumOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumOptions*)[[[PBEnumOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBEnumOptions*) parseFromInputStream:(NSInputStream*) input { return (PBEnumOptions*)[[[PBEnumOptions builder] mergeFromInputStream:input] build]; } + (PBEnumOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumOptions*)[[[PBEnumOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBEnumOptions*)[[[PBEnumOptions builder] mergeFromCodedInputStream:input] build]; } + (PBEnumOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumOptions*)[[[PBEnumOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumOptionsBuilder*) builder { return [[PBEnumOptionsBuilder alloc] init]; } + (PBEnumOptionsBuilder*) builderWithPrototype:(PBEnumOptions*) prototype { return [[PBEnumOptions builder] mergeFrom:prototype]; } - (PBEnumOptionsBuilder*) builder { return [PBEnumOptions builder]; } - (PBEnumOptionsBuilder*) toBuilder { return [PBEnumOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasAllowAlias) { [output appendFormat:@"%@%@: %@\n", indent, @"allowAlias", [NSNumber numberWithBool:self.allowAlias]]; } if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasAllowAlias) { [dictionary setObject: [NSNumber numberWithBool:self.allowAlias] forKey: @"allowAlias"]; } if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBEnumOptions class]]) { return NO; } PBEnumOptions *otherMessage = other; return self.hasAllowAlias == otherMessage.hasAllowAlias && (!self.hasAllowAlias || self.allowAlias == otherMessage.allowAlias) && self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasAllowAlias) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.allowAlias] hash]; } if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBEnumOptionsBuilder() @property (strong) PBEnumOptions* resultEnumOptions; @end @implementation PBEnumOptionsBuilder @synthesize resultEnumOptions; - (instancetype) init { if ((self = [super init])) { self.resultEnumOptions = [[PBEnumOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultEnumOptions; } - (PBEnumOptionsBuilder*) clear { self.resultEnumOptions = [[PBEnumOptions alloc] init]; return self; } - (PBEnumOptionsBuilder*) clone { return [PBEnumOptions builderWithPrototype:resultEnumOptions]; } - (PBEnumOptions*) defaultInstance { return [PBEnumOptions defaultInstance]; } - (PBEnumOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBEnumOptions*) buildPartial { PBEnumOptions* returnMe = resultEnumOptions; self.resultEnumOptions = nil; return returnMe; } - (PBEnumOptionsBuilder*) mergeFrom:(PBEnumOptions*) other { if (other == [PBEnumOptions defaultInstance]) { return self; } if (other.hasAllowAlias) { [self setAllowAlias:other.allowAlias]; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.uninterpretedOptionArray.count > 0) { if (resultEnumOptions.uninterpretedOptionArray == nil) { resultEnumOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultEnumOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBEnumOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBEnumOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 16: { [self setAllowAlias:[input readBool]]; break; } case 24: { [self setDeprecated:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasAllowAlias { return resultEnumOptions.hasAllowAlias; } - (BOOL) allowAlias { return resultEnumOptions.allowAlias; } - (PBEnumOptionsBuilder*) setAllowAlias:(BOOL) value { resultEnumOptions.hasAllowAlias = YES; resultEnumOptions.allowAlias = value; return self; } - (PBEnumOptionsBuilder*) clearAllowAlias { resultEnumOptions.hasAllowAlias = NO; resultEnumOptions.allowAlias = NO; return self; } - (BOOL) hasDeprecated { return resultEnumOptions.hasDeprecated; } - (BOOL) deprecated { return resultEnumOptions.deprecated; } - (PBEnumOptionsBuilder*) setDeprecated:(BOOL) value { resultEnumOptions.hasDeprecated = YES; resultEnumOptions.deprecated = value; return self; } - (PBEnumOptionsBuilder*) clearDeprecated { resultEnumOptions.hasDeprecated = NO; resultEnumOptions.deprecated = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultEnumOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultEnumOptions uninterpretedOptionAtIndex:index]; } - (PBEnumOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultEnumOptions.uninterpretedOptionArray == nil) { resultEnumOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultEnumOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBEnumOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultEnumOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBEnumOptionsBuilder *)clearUninterpretedOption { resultEnumOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBEnumValueOptions () @property BOOL deprecated; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBEnumValueOptions - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.deprecated = NO; } return self; } static PBEnumValueOptions* defaultPBEnumValueOptionsInstance = nil; + (void) initialize { if (self == [PBEnumValueOptions class]) { defaultPBEnumValueOptionsInstance = [[PBEnumValueOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBEnumValueOptionsInstance; } - (instancetype) defaultInstance { return defaultPBEnumValueOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDeprecated) { [output writeBool:1 value:self.deprecated]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDeprecated) { size_ += computeBoolSize(1, self.deprecated); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBEnumValueOptions*) parseFromData:(NSData*) data { return (PBEnumValueOptions*)[[[PBEnumValueOptions builder] mergeFromData:data] build]; } + (PBEnumValueOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumValueOptions*)[[[PBEnumValueOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBEnumValueOptions*) parseFromInputStream:(NSInputStream*) input { return (PBEnumValueOptions*)[[[PBEnumValueOptions builder] mergeFromInputStream:input] build]; } + (PBEnumValueOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumValueOptions*)[[[PBEnumValueOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumValueOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBEnumValueOptions*)[[[PBEnumValueOptions builder] mergeFromCodedInputStream:input] build]; } + (PBEnumValueOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBEnumValueOptions*)[[[PBEnumValueOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBEnumValueOptionsBuilder*) builder { return [[PBEnumValueOptionsBuilder alloc] init]; } + (PBEnumValueOptionsBuilder*) builderWithPrototype:(PBEnumValueOptions*) prototype { return [[PBEnumValueOptions builder] mergeFrom:prototype]; } - (PBEnumValueOptionsBuilder*) builder { return [PBEnumValueOptions builder]; } - (PBEnumValueOptionsBuilder*) toBuilder { return [PBEnumValueOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBEnumValueOptions class]]) { return NO; } PBEnumValueOptions *otherMessage = other; return self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBEnumValueOptionsBuilder() @property (strong) PBEnumValueOptions* resultEnumValueOptions; @end @implementation PBEnumValueOptionsBuilder @synthesize resultEnumValueOptions; - (instancetype) init { if ((self = [super init])) { self.resultEnumValueOptions = [[PBEnumValueOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultEnumValueOptions; } - (PBEnumValueOptionsBuilder*) clear { self.resultEnumValueOptions = [[PBEnumValueOptions alloc] init]; return self; } - (PBEnumValueOptionsBuilder*) clone { return [PBEnumValueOptions builderWithPrototype:resultEnumValueOptions]; } - (PBEnumValueOptions*) defaultInstance { return [PBEnumValueOptions defaultInstance]; } - (PBEnumValueOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBEnumValueOptions*) buildPartial { PBEnumValueOptions* returnMe = resultEnumValueOptions; self.resultEnumValueOptions = nil; return returnMe; } - (PBEnumValueOptionsBuilder*) mergeFrom:(PBEnumValueOptions*) other { if (other == [PBEnumValueOptions defaultInstance]) { return self; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.uninterpretedOptionArray.count > 0) { if (resultEnumValueOptions.uninterpretedOptionArray == nil) { resultEnumValueOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultEnumValueOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBEnumValueOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBEnumValueOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDeprecated:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasDeprecated { return resultEnumValueOptions.hasDeprecated; } - (BOOL) deprecated { return resultEnumValueOptions.deprecated; } - (PBEnumValueOptionsBuilder*) setDeprecated:(BOOL) value { resultEnumValueOptions.hasDeprecated = YES; resultEnumValueOptions.deprecated = value; return self; } - (PBEnumValueOptionsBuilder*) clearDeprecated { resultEnumValueOptions.hasDeprecated = NO; resultEnumValueOptions.deprecated = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultEnumValueOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultEnumValueOptions uninterpretedOptionAtIndex:index]; } - (PBEnumValueOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultEnumValueOptions.uninterpretedOptionArray == nil) { resultEnumValueOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultEnumValueOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBEnumValueOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultEnumValueOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBEnumValueOptionsBuilder *)clearUninterpretedOption { resultEnumValueOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBServiceOptions () @property BOOL deprecated; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBServiceOptions - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.deprecated = NO; } return self; } static PBServiceOptions* defaultPBServiceOptionsInstance = nil; + (void) initialize { if (self == [PBServiceOptions class]) { defaultPBServiceOptionsInstance = [[PBServiceOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBServiceOptionsInstance; } - (instancetype) defaultInstance { return defaultPBServiceOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDeprecated) { [output writeBool:33 value:self.deprecated]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDeprecated) { size_ += computeBoolSize(33, self.deprecated); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBServiceOptions*) parseFromData:(NSData*) data { return (PBServiceOptions*)[[[PBServiceOptions builder] mergeFromData:data] build]; } + (PBServiceOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBServiceOptions*)[[[PBServiceOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBServiceOptions*) parseFromInputStream:(NSInputStream*) input { return (PBServiceOptions*)[[[PBServiceOptions builder] mergeFromInputStream:input] build]; } + (PBServiceOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBServiceOptions*)[[[PBServiceOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBServiceOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBServiceOptions*)[[[PBServiceOptions builder] mergeFromCodedInputStream:input] build]; } + (PBServiceOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBServiceOptions*)[[[PBServiceOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBServiceOptionsBuilder*) builder { return [[PBServiceOptionsBuilder alloc] init]; } + (PBServiceOptionsBuilder*) builderWithPrototype:(PBServiceOptions*) prototype { return [[PBServiceOptions builder] mergeFrom:prototype]; } - (PBServiceOptionsBuilder*) builder { return [PBServiceOptions builder]; } - (PBServiceOptionsBuilder*) toBuilder { return [PBServiceOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBServiceOptions class]]) { return NO; } PBServiceOptions *otherMessage = other; return self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBServiceOptionsBuilder() @property (strong) PBServiceOptions* resultServiceOptions; @end @implementation PBServiceOptionsBuilder @synthesize resultServiceOptions; - (instancetype) init { if ((self = [super init])) { self.resultServiceOptions = [[PBServiceOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultServiceOptions; } - (PBServiceOptionsBuilder*) clear { self.resultServiceOptions = [[PBServiceOptions alloc] init]; return self; } - (PBServiceOptionsBuilder*) clone { return [PBServiceOptions builderWithPrototype:resultServiceOptions]; } - (PBServiceOptions*) defaultInstance { return [PBServiceOptions defaultInstance]; } - (PBServiceOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBServiceOptions*) buildPartial { PBServiceOptions* returnMe = resultServiceOptions; self.resultServiceOptions = nil; return returnMe; } - (PBServiceOptionsBuilder*) mergeFrom:(PBServiceOptions*) other { if (other == [PBServiceOptions defaultInstance]) { return self; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.uninterpretedOptionArray.count > 0) { if (resultServiceOptions.uninterpretedOptionArray == nil) { resultServiceOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultServiceOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBServiceOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBServiceOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 264: { [self setDeprecated:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasDeprecated { return resultServiceOptions.hasDeprecated; } - (BOOL) deprecated { return resultServiceOptions.deprecated; } - (PBServiceOptionsBuilder*) setDeprecated:(BOOL) value { resultServiceOptions.hasDeprecated = YES; resultServiceOptions.deprecated = value; return self; } - (PBServiceOptionsBuilder*) clearDeprecated { resultServiceOptions.hasDeprecated = NO; resultServiceOptions.deprecated = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultServiceOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultServiceOptions uninterpretedOptionAtIndex:index]; } - (PBServiceOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultServiceOptions.uninterpretedOptionArray == nil) { resultServiceOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultServiceOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBServiceOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultServiceOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBServiceOptionsBuilder *)clearUninterpretedOption { resultServiceOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBMethodOptions () @property BOOL deprecated; @property (strong) NSMutableArray * uninterpretedOptionArray; @end @implementation PBMethodOptions - (BOOL) hasDeprecated { return !!hasDeprecated_; } - (void) setHasDeprecated:(BOOL) _value_ { hasDeprecated_ = !!_value_; } - (BOOL) deprecated { return !!deprecated_; } - (void) setDeprecated:(BOOL) _value_ { deprecated_ = !!_value_; } @synthesize uninterpretedOptionArray; @dynamic uninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.deprecated = NO; } return self; } static PBMethodOptions* defaultPBMethodOptionsInstance = nil; + (void) initialize { if (self == [PBMethodOptions class]) { defaultPBMethodOptionsInstance = [[PBMethodOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultPBMethodOptionsInstance; } - (instancetype) defaultInstance { return defaultPBMethodOptionsInstance; } - (NSArray *)uninterpretedOption { return uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [uninterpretedOptionArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInituninterpretedOption = YES; [self.uninterpretedOption enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInituninterpretedOption = NO; *stop = YES; } }]; if (!isInituninterpretedOption) return isInituninterpretedOption; if (!self.extensionsAreInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDeprecated) { [output writeBool:33 value:self.deprecated]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output writeMessage:999 value:element]; }]; [self writeExtensionsToCodedOutputStream:output from:1000 to:536870912]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDeprecated) { size_ += computeBoolSize(33, self.deprecated); } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(999, element); }]; size_ += [self extensionsSerializedSize]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBMethodOptions*) parseFromData:(NSData*) data { return (PBMethodOptions*)[[[PBMethodOptions builder] mergeFromData:data] build]; } + (PBMethodOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMethodOptions*)[[[PBMethodOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBMethodOptions*) parseFromInputStream:(NSInputStream*) input { return (PBMethodOptions*)[[[PBMethodOptions builder] mergeFromInputStream:input] build]; } + (PBMethodOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMethodOptions*)[[[PBMethodOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBMethodOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBMethodOptions*)[[[PBMethodOptions builder] mergeFromCodedInputStream:input] build]; } + (PBMethodOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBMethodOptions*)[[[PBMethodOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBMethodOptionsBuilder*) builder { return [[PBMethodOptionsBuilder alloc] init]; } + (PBMethodOptionsBuilder*) builderWithPrototype:(PBMethodOptions*) prototype { return [[PBMethodOptions builder] mergeFrom:prototype]; } - (PBMethodOptionsBuilder*) builder { return [PBMethodOptions builder]; } - (PBMethodOptionsBuilder*) toBuilder { return [PBMethodOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDeprecated) { [output appendFormat:@"%@%@: %@\n", indent, @"deprecated", [NSNumber numberWithBool:self.deprecated]]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"uninterpretedOption"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self writeExtensionDescriptionToMutableString:(NSMutableString*)output from:1000 to:536870912 withIndent:indent]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDeprecated) { [dictionary setObject: [NSNumber numberWithBool:self.deprecated] forKey: @"deprecated"]; } for (PBUninterpretedOption* element in self.uninterpretedOptionArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"uninterpretedOption"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBMethodOptions class]]) { return NO; } PBMethodOptions *otherMessage = other; return self.hasDeprecated == otherMessage.hasDeprecated && (!self.hasDeprecated || self.deprecated == otherMessage.deprecated) && [self.uninterpretedOptionArray isEqualToArray:otherMessage.uninterpretedOptionArray] && [self isEqualExtensionsInOther:otherMessage from:1000 to:536870912] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDeprecated) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.deprecated] hash]; } [self.uninterpretedOptionArray enumerateObjectsUsingBlock:^(PBUninterpretedOption *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self hashExtensionsFrom:1000 to:536870912]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBMethodOptionsBuilder() @property (strong) PBMethodOptions* resultMethodOptions; @end @implementation PBMethodOptionsBuilder @synthesize resultMethodOptions; - (instancetype) init { if ((self = [super init])) { self.resultMethodOptions = [[PBMethodOptions alloc] init]; } return self; } - (PBExtendableMessage*) internalGetResult { return resultMethodOptions; } - (PBMethodOptionsBuilder*) clear { self.resultMethodOptions = [[PBMethodOptions alloc] init]; return self; } - (PBMethodOptionsBuilder*) clone { return [PBMethodOptions builderWithPrototype:resultMethodOptions]; } - (PBMethodOptions*) defaultInstance { return [PBMethodOptions defaultInstance]; } - (PBMethodOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (PBMethodOptions*) buildPartial { PBMethodOptions* returnMe = resultMethodOptions; self.resultMethodOptions = nil; return returnMe; } - (PBMethodOptionsBuilder*) mergeFrom:(PBMethodOptions*) other { if (other == [PBMethodOptions defaultInstance]) { return self; } if (other.hasDeprecated) { [self setDeprecated:other.deprecated]; } if (other.uninterpretedOptionArray.count > 0) { if (resultMethodOptions.uninterpretedOptionArray == nil) { resultMethodOptions.uninterpretedOptionArray = [[NSMutableArray alloc] initWithArray:other.uninterpretedOptionArray]; } else { [resultMethodOptions.uninterpretedOptionArray addObjectsFromArray:other.uninterpretedOptionArray]; } } [self mergeExtensionFields:other]; [self mergeUnknownFields:other.unknownFields]; return self; } - (PBMethodOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBMethodOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 264: { [self setDeprecated:[input readBool]]; break; } case 7994: { PBUninterpretedOptionBuilder* subBuilder = [PBUninterpretedOption builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addUninterpretedOption:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasDeprecated { return resultMethodOptions.hasDeprecated; } - (BOOL) deprecated { return resultMethodOptions.deprecated; } - (PBMethodOptionsBuilder*) setDeprecated:(BOOL) value { resultMethodOptions.hasDeprecated = YES; resultMethodOptions.deprecated = value; return self; } - (PBMethodOptionsBuilder*) clearDeprecated { resultMethodOptions.hasDeprecated = NO; resultMethodOptions.deprecated = NO; return self; } - (NSMutableArray *)uninterpretedOption { return resultMethodOptions.uninterpretedOptionArray; } - (PBUninterpretedOption*)uninterpretedOptionAtIndex:(NSUInteger)index { return [resultMethodOptions uninterpretedOptionAtIndex:index]; } - (PBMethodOptionsBuilder *)addUninterpretedOption:(PBUninterpretedOption*)value { if (resultMethodOptions.uninterpretedOptionArray == nil) { resultMethodOptions.uninterpretedOptionArray = [[NSMutableArray alloc]init]; } [resultMethodOptions.uninterpretedOptionArray addObject:value]; return self; } - (PBMethodOptionsBuilder *)setUninterpretedOptionArray:(NSArray *)array { resultMethodOptions.uninterpretedOptionArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBMethodOptionsBuilder *)clearUninterpretedOption { resultMethodOptions.uninterpretedOptionArray = nil; return self; } @end @interface PBUninterpretedOption () @property (strong) NSMutableArray * nameArray; @property (strong) NSString* identifierValue; @property UInt64 positiveIntValue; @property SInt64 negativeIntValue; @property Float64 doubleValue; @property (strong) NSData* stringValue; @property (strong) NSString* aggregateValue; @end @implementation PBUninterpretedOption @synthesize nameArray; @dynamic name; - (BOOL) hasIdentifierValue { return !!hasIdentifierValue_; } - (void) setHasIdentifierValue:(BOOL) _value_ { hasIdentifierValue_ = !!_value_; } @synthesize identifierValue; - (BOOL) hasPositiveIntValue { return !!hasPositiveIntValue_; } - (void) setHasPositiveIntValue:(BOOL) _value_ { hasPositiveIntValue_ = !!_value_; } @synthesize positiveIntValue; - (BOOL) hasNegativeIntValue { return !!hasNegativeIntValue_; } - (void) setHasNegativeIntValue:(BOOL) _value_ { hasNegativeIntValue_ = !!_value_; } @synthesize negativeIntValue; - (BOOL) hasDoubleValue { return !!hasDoubleValue_; } - (void) setHasDoubleValue:(BOOL) _value_ { hasDoubleValue_ = !!_value_; } @synthesize doubleValue; - (BOOL) hasStringValue { return !!hasStringValue_; } - (void) setHasStringValue:(BOOL) _value_ { hasStringValue_ = !!_value_; } @synthesize stringValue; - (BOOL) hasAggregateValue { return !!hasAggregateValue_; } - (void) setHasAggregateValue:(BOOL) _value_ { hasAggregateValue_ = !!_value_; } @synthesize aggregateValue; - (instancetype) init { if ((self = [super init])) { self.identifierValue = @""; self.positiveIntValue = 0L; self.negativeIntValue = 0L; self.doubleValue = 0; self.stringValue = [NSData data]; self.aggregateValue = @""; } return self; } static PBUninterpretedOption* defaultPBUninterpretedOptionInstance = nil; + (void) initialize { if (self == [PBUninterpretedOption class]) { defaultPBUninterpretedOptionInstance = [[PBUninterpretedOption alloc] init]; } } + (instancetype) defaultInstance { return defaultPBUninterpretedOptionInstance; } - (instancetype) defaultInstance { return defaultPBUninterpretedOptionInstance; } - (NSArray *)name { return nameArray; } - (PBUninterpretedOptionNamePart*)nameAtIndex:(NSUInteger)index { return [nameArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitname = YES; [self.name enumerateObjectsUsingBlock:^(PBUninterpretedOptionNamePart *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitname = NO; *stop = YES; } }]; if (!isInitname) return isInitname; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.nameArray enumerateObjectsUsingBlock:^(PBUninterpretedOptionNamePart *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; if (self.hasIdentifierValue) { [output writeString:3 value:self.identifierValue]; } if (self.hasPositiveIntValue) { [output writeUInt64:4 value:self.positiveIntValue]; } if (self.hasNegativeIntValue) { [output writeInt64:5 value:self.negativeIntValue]; } if (self.hasDoubleValue) { [output writeDouble:6 value:self.doubleValue]; } if (self.hasStringValue) { [output writeData:7 value:self.stringValue]; } if (self.hasAggregateValue) { [output writeString:8 value:self.aggregateValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.nameArray enumerateObjectsUsingBlock:^(PBUninterpretedOptionNamePart *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; if (self.hasIdentifierValue) { size_ += computeStringSize(3, self.identifierValue); } if (self.hasPositiveIntValue) { size_ += computeUInt64Size(4, self.positiveIntValue); } if (self.hasNegativeIntValue) { size_ += computeInt64Size(5, self.negativeIntValue); } if (self.hasDoubleValue) { size_ += computeDoubleSize(6, self.doubleValue); } if (self.hasStringValue) { size_ += computeDataSize(7, self.stringValue); } if (self.hasAggregateValue) { size_ += computeStringSize(8, self.aggregateValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBUninterpretedOption*) parseFromData:(NSData*) data { return (PBUninterpretedOption*)[[[PBUninterpretedOption builder] mergeFromData:data] build]; } + (PBUninterpretedOption*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBUninterpretedOption*)[[[PBUninterpretedOption builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBUninterpretedOption*) parseFromInputStream:(NSInputStream*) input { return (PBUninterpretedOption*)[[[PBUninterpretedOption builder] mergeFromInputStream:input] build]; } + (PBUninterpretedOption*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBUninterpretedOption*)[[[PBUninterpretedOption builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBUninterpretedOption*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBUninterpretedOption*)[[[PBUninterpretedOption builder] mergeFromCodedInputStream:input] build]; } + (PBUninterpretedOption*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBUninterpretedOption*)[[[PBUninterpretedOption builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBUninterpretedOptionBuilder*) builder { return [[PBUninterpretedOptionBuilder alloc] init]; } + (PBUninterpretedOptionBuilder*) builderWithPrototype:(PBUninterpretedOption*) prototype { return [[PBUninterpretedOption builder] mergeFrom:prototype]; } - (PBUninterpretedOptionBuilder*) builder { return [PBUninterpretedOption builder]; } - (PBUninterpretedOptionBuilder*) toBuilder { return [PBUninterpretedOption builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.nameArray enumerateObjectsUsingBlock:^(PBUninterpretedOptionNamePart *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"name"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasIdentifierValue) { [output appendFormat:@"%@%@: %@\n", indent, @"identifierValue", self.identifierValue]; } if (self.hasPositiveIntValue) { [output appendFormat:@"%@%@: %@\n", indent, @"positiveIntValue", [NSNumber numberWithLongLong:self.positiveIntValue]]; } if (self.hasNegativeIntValue) { [output appendFormat:@"%@%@: %@\n", indent, @"negativeIntValue", [NSNumber numberWithLongLong:self.negativeIntValue]]; } if (self.hasDoubleValue) { [output appendFormat:@"%@%@: %@\n", indent, @"doubleValue", [NSNumber numberWithDouble:self.doubleValue]]; } if (self.hasStringValue) { [output appendFormat:@"%@%@: %@\n", indent, @"stringValue", self.stringValue]; } if (self.hasAggregateValue) { [output appendFormat:@"%@%@: %@\n", indent, @"aggregateValue", self.aggregateValue]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (PBUninterpretedOptionNamePart* element in self.nameArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"name"]; } if (self.hasIdentifierValue) { [dictionary setObject: self.identifierValue forKey: @"identifierValue"]; } if (self.hasPositiveIntValue) { [dictionary setObject: [NSNumber numberWithLongLong:self.positiveIntValue] forKey: @"positiveIntValue"]; } if (self.hasNegativeIntValue) { [dictionary setObject: [NSNumber numberWithLongLong:self.negativeIntValue] forKey: @"negativeIntValue"]; } if (self.hasDoubleValue) { [dictionary setObject: [NSNumber numberWithDouble:self.doubleValue] forKey: @"doubleValue"]; } if (self.hasStringValue) { [dictionary setObject: self.stringValue forKey: @"stringValue"]; } if (self.hasAggregateValue) { [dictionary setObject: self.aggregateValue forKey: @"aggregateValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBUninterpretedOption class]]) { return NO; } PBUninterpretedOption *otherMessage = other; return [self.nameArray isEqualToArray:otherMessage.nameArray] && self.hasIdentifierValue == otherMessage.hasIdentifierValue && (!self.hasIdentifierValue || [self.identifierValue isEqual:otherMessage.identifierValue]) && self.hasPositiveIntValue == otherMessage.hasPositiveIntValue && (!self.hasPositiveIntValue || self.positiveIntValue == otherMessage.positiveIntValue) && self.hasNegativeIntValue == otherMessage.hasNegativeIntValue && (!self.hasNegativeIntValue || self.negativeIntValue == otherMessage.negativeIntValue) && self.hasDoubleValue == otherMessage.hasDoubleValue && (!self.hasDoubleValue || self.doubleValue == otherMessage.doubleValue) && self.hasStringValue == otherMessage.hasStringValue && (!self.hasStringValue || [self.stringValue isEqual:otherMessage.stringValue]) && self.hasAggregateValue == otherMessage.hasAggregateValue && (!self.hasAggregateValue || [self.aggregateValue isEqual:otherMessage.aggregateValue]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.nameArray enumerateObjectsUsingBlock:^(PBUninterpretedOptionNamePart *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasIdentifierValue) { hashCode = hashCode * 31 + [self.identifierValue hash]; } if (self.hasPositiveIntValue) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.positiveIntValue] hash]; } if (self.hasNegativeIntValue) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.negativeIntValue] hash]; } if (self.hasDoubleValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.doubleValue] hash]; } if (self.hasStringValue) { hashCode = hashCode * 31 + [self.stringValue hash]; } if (self.hasAggregateValue) { hashCode = hashCode * 31 + [self.aggregateValue hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBUninterpretedOptionNamePart () @property (strong) NSString* namePart; @property BOOL isExtension; @end @implementation PBUninterpretedOptionNamePart - (BOOL) hasNamePart { return !!hasNamePart_; } - (void) setHasNamePart:(BOOL) _value_ { hasNamePart_ = !!_value_; } @synthesize namePart; - (BOOL) hasIsExtension { return !!hasIsExtension_; } - (void) setHasIsExtension:(BOOL) _value_ { hasIsExtension_ = !!_value_; } - (BOOL) isExtension { return !!isExtension_; } - (void) setIsExtension:(BOOL) _value_ { isExtension_ = !!_value_; } - (instancetype) init { if ((self = [super init])) { self.namePart = @""; self.isExtension = NO; } return self; } static PBUninterpretedOptionNamePart* defaultPBUninterpretedOptionNamePartInstance = nil; + (void) initialize { if (self == [PBUninterpretedOptionNamePart class]) { defaultPBUninterpretedOptionNamePartInstance = [[PBUninterpretedOptionNamePart alloc] init]; } } + (instancetype) defaultInstance { return defaultPBUninterpretedOptionNamePartInstance; } - (instancetype) defaultInstance { return defaultPBUninterpretedOptionNamePartInstance; } - (BOOL) isInitialized { if (!self.hasNamePart) { return NO; } if (!self.hasIsExtension) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasNamePart) { [output writeString:1 value:self.namePart]; } if (self.hasIsExtension) { [output writeBool:2 value:self.isExtension]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasNamePart) { size_ += computeStringSize(1, self.namePart); } if (self.hasIsExtension) { size_ += computeBoolSize(2, self.isExtension); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBUninterpretedOptionNamePart*) parseFromData:(NSData*) data { return (PBUninterpretedOptionNamePart*)[[[PBUninterpretedOptionNamePart builder] mergeFromData:data] build]; } + (PBUninterpretedOptionNamePart*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBUninterpretedOptionNamePart*)[[[PBUninterpretedOptionNamePart builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBUninterpretedOptionNamePart*) parseFromInputStream:(NSInputStream*) input { return (PBUninterpretedOptionNamePart*)[[[PBUninterpretedOptionNamePart builder] mergeFromInputStream:input] build]; } + (PBUninterpretedOptionNamePart*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBUninterpretedOptionNamePart*)[[[PBUninterpretedOptionNamePart builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBUninterpretedOptionNamePart*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBUninterpretedOptionNamePart*)[[[PBUninterpretedOptionNamePart builder] mergeFromCodedInputStream:input] build]; } + (PBUninterpretedOptionNamePart*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBUninterpretedOptionNamePart*)[[[PBUninterpretedOptionNamePart builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBUninterpretedOptionNamePartBuilder*) builder { return [[PBUninterpretedOptionNamePartBuilder alloc] init]; } + (PBUninterpretedOptionNamePartBuilder*) builderWithPrototype:(PBUninterpretedOptionNamePart*) prototype { return [[PBUninterpretedOptionNamePart builder] mergeFrom:prototype]; } - (PBUninterpretedOptionNamePartBuilder*) builder { return [PBUninterpretedOptionNamePart builder]; } - (PBUninterpretedOptionNamePartBuilder*) toBuilder { return [PBUninterpretedOptionNamePart builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasNamePart) { [output appendFormat:@"%@%@: %@\n", indent, @"namePart", self.namePart]; } if (self.hasIsExtension) { [output appendFormat:@"%@%@: %@\n", indent, @"isExtension", [NSNumber numberWithBool:self.isExtension]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasNamePart) { [dictionary setObject: self.namePart forKey: @"namePart"]; } if (self.hasIsExtension) { [dictionary setObject: [NSNumber numberWithBool:self.isExtension] forKey: @"isExtension"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBUninterpretedOptionNamePart class]]) { return NO; } PBUninterpretedOptionNamePart *otherMessage = other; return self.hasNamePart == otherMessage.hasNamePart && (!self.hasNamePart || [self.namePart isEqual:otherMessage.namePart]) && self.hasIsExtension == otherMessage.hasIsExtension && (!self.hasIsExtension || self.isExtension == otherMessage.isExtension) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasNamePart) { hashCode = hashCode * 31 + [self.namePart hash]; } if (self.hasIsExtension) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.isExtension] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBUninterpretedOptionNamePartBuilder() @property (strong) PBUninterpretedOptionNamePart* resultNamePart; @end @implementation PBUninterpretedOptionNamePartBuilder @synthesize resultNamePart; - (instancetype) init { if ((self = [super init])) { self.resultNamePart = [[PBUninterpretedOptionNamePart alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultNamePart; } - (PBUninterpretedOptionNamePartBuilder*) clear { self.resultNamePart = [[PBUninterpretedOptionNamePart alloc] init]; return self; } - (PBUninterpretedOptionNamePartBuilder*) clone { return [PBUninterpretedOptionNamePart builderWithPrototype:resultNamePart]; } - (PBUninterpretedOptionNamePart*) defaultInstance { return [PBUninterpretedOptionNamePart defaultInstance]; } - (PBUninterpretedOptionNamePart*) build { [self checkInitialized]; return [self buildPartial]; } - (PBUninterpretedOptionNamePart*) buildPartial { PBUninterpretedOptionNamePart* returnMe = resultNamePart; self.resultNamePart = nil; return returnMe; } - (PBUninterpretedOptionNamePartBuilder*) mergeFrom:(PBUninterpretedOptionNamePart*) other { if (other == [PBUninterpretedOptionNamePart defaultInstance]) { return self; } if (other.hasNamePart) { [self setNamePart:other.namePart]; } if (other.hasIsExtension) { [self setIsExtension:other.isExtension]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBUninterpretedOptionNamePartBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBUninterpretedOptionNamePartBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setNamePart:[input readString]]; break; } case 16: { [self setIsExtension:[input readBool]]; break; } } } } - (BOOL) hasNamePart { return resultNamePart.hasNamePart; } - (NSString*) namePart { return resultNamePart.namePart; } - (PBUninterpretedOptionNamePartBuilder*) setNamePart:(NSString*) value { resultNamePart.hasNamePart = YES; resultNamePart.namePart = value; return self; } - (PBUninterpretedOptionNamePartBuilder*) clearNamePart { resultNamePart.hasNamePart = NO; resultNamePart.namePart = @""; return self; } - (BOOL) hasIsExtension { return resultNamePart.hasIsExtension; } - (BOOL) isExtension { return resultNamePart.isExtension; } - (PBUninterpretedOptionNamePartBuilder*) setIsExtension:(BOOL) value { resultNamePart.hasIsExtension = YES; resultNamePart.isExtension = value; return self; } - (PBUninterpretedOptionNamePartBuilder*) clearIsExtension { resultNamePart.hasIsExtension = NO; resultNamePart.isExtension = NO; return self; } @end @interface PBUninterpretedOptionBuilder() @property (strong) PBUninterpretedOption* resultUninterpretedOption; @end @implementation PBUninterpretedOptionBuilder @synthesize resultUninterpretedOption; - (instancetype) init { if ((self = [super init])) { self.resultUninterpretedOption = [[PBUninterpretedOption alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultUninterpretedOption; } - (PBUninterpretedOptionBuilder*) clear { self.resultUninterpretedOption = [[PBUninterpretedOption alloc] init]; return self; } - (PBUninterpretedOptionBuilder*) clone { return [PBUninterpretedOption builderWithPrototype:resultUninterpretedOption]; } - (PBUninterpretedOption*) defaultInstance { return [PBUninterpretedOption defaultInstance]; } - (PBUninterpretedOption*) build { [self checkInitialized]; return [self buildPartial]; } - (PBUninterpretedOption*) buildPartial { PBUninterpretedOption* returnMe = resultUninterpretedOption; self.resultUninterpretedOption = nil; return returnMe; } - (PBUninterpretedOptionBuilder*) mergeFrom:(PBUninterpretedOption*) other { if (other == [PBUninterpretedOption defaultInstance]) { return self; } if (other.nameArray.count > 0) { if (resultUninterpretedOption.nameArray == nil) { resultUninterpretedOption.nameArray = [[NSMutableArray alloc] initWithArray:other.nameArray]; } else { [resultUninterpretedOption.nameArray addObjectsFromArray:other.nameArray]; } } if (other.hasIdentifierValue) { [self setIdentifierValue:other.identifierValue]; } if (other.hasPositiveIntValue) { [self setPositiveIntValue:other.positiveIntValue]; } if (other.hasNegativeIntValue) { [self setNegativeIntValue:other.negativeIntValue]; } if (other.hasDoubleValue) { [self setDoubleValue:other.doubleValue]; } if (other.hasStringValue) { [self setStringValue:other.stringValue]; } if (other.hasAggregateValue) { [self setAggregateValue:other.aggregateValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBUninterpretedOptionBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBUninterpretedOptionBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 18: { PBUninterpretedOptionNamePartBuilder* subBuilder = [PBUninterpretedOptionNamePart builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addName:[subBuilder buildPartial]]; break; } case 26: { [self setIdentifierValue:[input readString]]; break; } case 32: { [self setPositiveIntValue:[input readUInt64]]; break; } case 40: { [self setNegativeIntValue:[input readInt64]]; break; } case 49: { [self setDoubleValue:[input readDouble]]; break; } case 58: { [self setStringValue:[input readData]]; break; } case 66: { [self setAggregateValue:[input readString]]; break; } } } } - (NSMutableArray *)name { return resultUninterpretedOption.nameArray; } - (PBUninterpretedOptionNamePart*)nameAtIndex:(NSUInteger)index { return [resultUninterpretedOption nameAtIndex:index]; } - (PBUninterpretedOptionBuilder *)addName:(PBUninterpretedOptionNamePart*)value { if (resultUninterpretedOption.nameArray == nil) { resultUninterpretedOption.nameArray = [[NSMutableArray alloc]init]; } [resultUninterpretedOption.nameArray addObject:value]; return self; } - (PBUninterpretedOptionBuilder *)setNameArray:(NSArray *)array { resultUninterpretedOption.nameArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBUninterpretedOptionBuilder *)clearName { resultUninterpretedOption.nameArray = nil; return self; } - (BOOL) hasIdentifierValue { return resultUninterpretedOption.hasIdentifierValue; } - (NSString*) identifierValue { return resultUninterpretedOption.identifierValue; } - (PBUninterpretedOptionBuilder*) setIdentifierValue:(NSString*) value { resultUninterpretedOption.hasIdentifierValue = YES; resultUninterpretedOption.identifierValue = value; return self; } - (PBUninterpretedOptionBuilder*) clearIdentifierValue { resultUninterpretedOption.hasIdentifierValue = NO; resultUninterpretedOption.identifierValue = @""; return self; } - (BOOL) hasPositiveIntValue { return resultUninterpretedOption.hasPositiveIntValue; } - (UInt64) positiveIntValue { return resultUninterpretedOption.positiveIntValue; } - (PBUninterpretedOptionBuilder*) setPositiveIntValue:(UInt64) value { resultUninterpretedOption.hasPositiveIntValue = YES; resultUninterpretedOption.positiveIntValue = value; return self; } - (PBUninterpretedOptionBuilder*) clearPositiveIntValue { resultUninterpretedOption.hasPositiveIntValue = NO; resultUninterpretedOption.positiveIntValue = 0L; return self; } - (BOOL) hasNegativeIntValue { return resultUninterpretedOption.hasNegativeIntValue; } - (SInt64) negativeIntValue { return resultUninterpretedOption.negativeIntValue; } - (PBUninterpretedOptionBuilder*) setNegativeIntValue:(SInt64) value { resultUninterpretedOption.hasNegativeIntValue = YES; resultUninterpretedOption.negativeIntValue = value; return self; } - (PBUninterpretedOptionBuilder*) clearNegativeIntValue { resultUninterpretedOption.hasNegativeIntValue = NO; resultUninterpretedOption.negativeIntValue = 0L; return self; } - (BOOL) hasDoubleValue { return resultUninterpretedOption.hasDoubleValue; } - (Float64) doubleValue { return resultUninterpretedOption.doubleValue; } - (PBUninterpretedOptionBuilder*) setDoubleValue:(Float64) value { resultUninterpretedOption.hasDoubleValue = YES; resultUninterpretedOption.doubleValue = value; return self; } - (PBUninterpretedOptionBuilder*) clearDoubleValue { resultUninterpretedOption.hasDoubleValue = NO; resultUninterpretedOption.doubleValue = 0; return self; } - (BOOL) hasStringValue { return resultUninterpretedOption.hasStringValue; } - (NSData*) stringValue { return resultUninterpretedOption.stringValue; } - (PBUninterpretedOptionBuilder*) setStringValue:(NSData*) value { resultUninterpretedOption.hasStringValue = YES; resultUninterpretedOption.stringValue = value; return self; } - (PBUninterpretedOptionBuilder*) clearStringValue { resultUninterpretedOption.hasStringValue = NO; resultUninterpretedOption.stringValue = [NSData data]; return self; } - (BOOL) hasAggregateValue { return resultUninterpretedOption.hasAggregateValue; } - (NSString*) aggregateValue { return resultUninterpretedOption.aggregateValue; } - (PBUninterpretedOptionBuilder*) setAggregateValue:(NSString*) value { resultUninterpretedOption.hasAggregateValue = YES; resultUninterpretedOption.aggregateValue = value; return self; } - (PBUninterpretedOptionBuilder*) clearAggregateValue { resultUninterpretedOption.hasAggregateValue = NO; resultUninterpretedOption.aggregateValue = @""; return self; } @end @interface PBSourceCodeInfo () @property (strong) NSMutableArray * locationArray; @end @implementation PBSourceCodeInfo @synthesize locationArray; @dynamic location; - (instancetype) init { if ((self = [super init])) { } return self; } static PBSourceCodeInfo* defaultPBSourceCodeInfoInstance = nil; + (void) initialize { if (self == [PBSourceCodeInfo class]) { defaultPBSourceCodeInfoInstance = [[PBSourceCodeInfo alloc] init]; } } + (instancetype) defaultInstance { return defaultPBSourceCodeInfoInstance; } - (instancetype) defaultInstance { return defaultPBSourceCodeInfoInstance; } - (NSArray *)location { return locationArray; } - (PBSourceCodeInfoLocation*)locationAtIndex:(NSUInteger)index { return [locationArray objectAtIndex:index]; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.locationArray enumerateObjectsUsingBlock:^(PBSourceCodeInfoLocation *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.locationArray enumerateObjectsUsingBlock:^(PBSourceCodeInfoLocation *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBSourceCodeInfo*) parseFromData:(NSData*) data { return (PBSourceCodeInfo*)[[[PBSourceCodeInfo builder] mergeFromData:data] build]; } + (PBSourceCodeInfo*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBSourceCodeInfo*)[[[PBSourceCodeInfo builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBSourceCodeInfo*) parseFromInputStream:(NSInputStream*) input { return (PBSourceCodeInfo*)[[[PBSourceCodeInfo builder] mergeFromInputStream:input] build]; } + (PBSourceCodeInfo*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBSourceCodeInfo*)[[[PBSourceCodeInfo builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBSourceCodeInfo*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBSourceCodeInfo*)[[[PBSourceCodeInfo builder] mergeFromCodedInputStream:input] build]; } + (PBSourceCodeInfo*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBSourceCodeInfo*)[[[PBSourceCodeInfo builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBSourceCodeInfoBuilder*) builder { return [[PBSourceCodeInfoBuilder alloc] init]; } + (PBSourceCodeInfoBuilder*) builderWithPrototype:(PBSourceCodeInfo*) prototype { return [[PBSourceCodeInfo builder] mergeFrom:prototype]; } - (PBSourceCodeInfoBuilder*) builder { return [PBSourceCodeInfo builder]; } - (PBSourceCodeInfoBuilder*) toBuilder { return [PBSourceCodeInfo builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.locationArray enumerateObjectsUsingBlock:^(PBSourceCodeInfoLocation *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"location"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (PBSourceCodeInfoLocation* element in self.locationArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"location"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[PBSourceCodeInfo class]]) { return NO; } PBSourceCodeInfo *otherMessage = other; return [self.locationArray isEqualToArray:otherMessage.locationArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.locationArray enumerateObjectsUsingBlock:^(PBSourceCodeInfoLocation *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface PBSourceCodeInfoLocation () @property (strong) PBAppendableArray * pathArray; @property (strong) PBAppendableArray * spanArray; @property (strong) NSString* leadingComments; @property (strong) NSString* trailingComments; @end @implementation PBSourceCodeInfoLocation @synthesize pathArray; @dynamic path; @synthesize spanArray; @dynamic span; - (BOOL) hasLeadingComments { return !!hasLeadingComments_; } - (void) setHasLeadingComments:(BOOL) _value_ { hasLeadingComments_ = !!_value_; } @synthesize leadingComments; - (BOOL) hasTrailingComments { return !!hasTrailingComments_; } - (void) setHasTrailingComments:(BOOL) _value_ { hasTrailingComments_ = !!_value_; } @synthesize trailingComments; - (instancetype) init { if ((self = [super init])) { self.leadingComments = @""; self.trailingComments = @""; } return self; } static PBSourceCodeInfoLocation* defaultPBSourceCodeInfoLocationInstance = nil; + (void) initialize { if (self == [PBSourceCodeInfoLocation class]) { defaultPBSourceCodeInfoLocationInstance = [[PBSourceCodeInfoLocation alloc] init]; } } + (instancetype) defaultInstance { return defaultPBSourceCodeInfoLocationInstance; } - (instancetype) defaultInstance { return defaultPBSourceCodeInfoLocationInstance; } - (PBArray *)path { return pathArray; } - (SInt32)pathAtIndex:(NSUInteger)index { return [pathArray int32AtIndex:index]; } - (PBArray *)span { return spanArray; } - (SInt32)spanAtIndex:(NSUInteger)index { return [spanArray int32AtIndex:index]; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { const NSUInteger pathArrayCount = self.pathArray.count; if (pathArrayCount > 0) { const SInt32 *values = (const SInt32 *)self.pathArray.data; [output writeRawVarint32:10]; [output writeRawVarint32:pathMemoizedSerializedSize]; for (NSUInteger i = 0; i < pathArrayCount; ++i) { [output writeInt32NoTag:values[i]]; } } const NSUInteger spanArrayCount = self.spanArray.count; if (spanArrayCount > 0) { const SInt32 *values = (const SInt32 *)self.spanArray.data; [output writeRawVarint32:18]; [output writeRawVarint32:spanMemoizedSerializedSize]; for (NSUInteger i = 0; i < spanArrayCount; ++i) { [output writeInt32NoTag:values[i]]; } } if (self.hasLeadingComments) { [output writeString:3 value:self.leadingComments]; } if (self.hasTrailingComments) { [output writeString:4 value:self.trailingComments]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; { __block SInt32 dataSize = 0; const NSUInteger count = self.pathArray.count; const SInt32 *values = (const SInt32 *)self.pathArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeInt32SizeNoTag(values[i]); } size_ += dataSize; if (count > 0) { size_ += 1; size_ += computeInt32SizeNoTag(dataSize); } pathMemoizedSerializedSize = dataSize; } { __block SInt32 dataSize = 0; const NSUInteger count = self.spanArray.count; const SInt32 *values = (const SInt32 *)self.spanArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeInt32SizeNoTag(values[i]); } size_ += dataSize; if (count > 0) { size_ += 1; size_ += computeInt32SizeNoTag(dataSize); } spanMemoizedSerializedSize = dataSize; } if (self.hasLeadingComments) { size_ += computeStringSize(3, self.leadingComments); } if (self.hasTrailingComments) { size_ += computeStringSize(4, self.trailingComments); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (PBSourceCodeInfoLocation*) parseFromData:(NSData*) data { return (PBSourceCodeInfoLocation*)[[[PBSourceCodeInfoLocation builder] mergeFromData:data] build]; } + (PBSourceCodeInfoLocation*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBSourceCodeInfoLocation*)[[[PBSourceCodeInfoLocation builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (PBSourceCodeInfoLocation*) parseFromInputStream:(NSInputStream*) input { return (PBSourceCodeInfoLocation*)[[[PBSourceCodeInfoLocation builder] mergeFromInputStream:input] build]; } + (PBSourceCodeInfoLocation*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBSourceCodeInfoLocation*)[[[PBSourceCodeInfoLocation builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBSourceCodeInfoLocation*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (PBSourceCodeInfoLocation*)[[[PBSourceCodeInfoLocation builder] mergeFromCodedInputStream:input] build]; } + (PBSourceCodeInfoLocation*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (PBSourceCodeInfoLocation*)[[[PBSourceCodeInfoLocation builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (PBSourceCodeInfoLocationBuilder*) builder { return [[PBSourceCodeInfoLocationBuilder alloc] init]; } + (PBSourceCodeInfoLocationBuilder*) builderWithPrototype:(PBSourceCodeInfoLocation*) prototype { return [[PBSourceCodeInfoLocation builder] mergeFrom:prototype]; } - (PBSourceCodeInfoLocationBuilder*) builder { return [PBSourceCodeInfoLocation builder]; } - (PBSourceCodeInfoLocationBuilder*) toBuilder { return [PBSourceCodeInfoLocation builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.pathArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"path", obj]; }]; [self.spanArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"span", obj]; }]; if (self.hasLeadingComments) { [output appendFormat:@"%@%@: %@\n", indent, @"leadingComments", self.leadingComments]; } if (self.hasTrailingComments) { [output appendFormat:@"%@%@: %@\n", indent, @"trailingComments", self.trailingComments]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { NSMutableArray * pathArrayArray = [NSMutableArray new]; NSUInteger pathArrayCount=self.pathArray.count; for(int i=0;i 0) { if (resultLocation.pathArray == nil) { resultLocation.pathArray = [other.pathArray copy]; } else { [resultLocation.pathArray appendArray:other.pathArray]; } } if (other.spanArray.count > 0) { if (resultLocation.spanArray == nil) { resultLocation.spanArray = [other.spanArray copy]; } else { [resultLocation.spanArray appendArray:other.spanArray]; } } if (other.hasLeadingComments) { [self setLeadingComments:other.leadingComments]; } if (other.hasTrailingComments) { [self setTrailingComments:other.trailingComments]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBSourceCodeInfoLocationBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBSourceCodeInfoLocationBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { SInt32 length = [input readRawVarint32]; SInt32 limit = [input pushLimit:length]; if (resultLocation.pathArray == nil) { resultLocation.pathArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } while (input.bytesUntilLimit > 0) { [resultLocation.pathArray addInt32:[input readInt32]]; } [input popLimit:limit]; break; } case 18: { SInt32 length = [input readRawVarint32]; SInt32 limit = [input pushLimit:length]; if (resultLocation.spanArray == nil) { resultLocation.spanArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } while (input.bytesUntilLimit > 0) { [resultLocation.spanArray addInt32:[input readInt32]]; } [input popLimit:limit]; break; } case 26: { [self setLeadingComments:[input readString]]; break; } case 34: { [self setTrailingComments:[input readString]]; break; } } } } - (PBAppendableArray *)path { return resultLocation.pathArray; } - (SInt32)pathAtIndex:(NSUInteger)index { return [resultLocation pathAtIndex:index]; } - (PBSourceCodeInfoLocationBuilder *)addPath:(SInt32)value { if (resultLocation.pathArray == nil) { resultLocation.pathArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultLocation.pathArray addInt32:value]; return self; } - (PBSourceCodeInfoLocationBuilder *)setPathArray:(NSArray *)array { resultLocation.pathArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (PBSourceCodeInfoLocationBuilder *)setPathValues:(const SInt32 *)values count:(NSUInteger)count { resultLocation.pathArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (PBSourceCodeInfoLocationBuilder *)clearPath { resultLocation.pathArray = nil; return self; } - (PBAppendableArray *)span { return resultLocation.spanArray; } - (SInt32)spanAtIndex:(NSUInteger)index { return [resultLocation spanAtIndex:index]; } - (PBSourceCodeInfoLocationBuilder *)addSpan:(SInt32)value { if (resultLocation.spanArray == nil) { resultLocation.spanArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultLocation.spanArray addInt32:value]; return self; } - (PBSourceCodeInfoLocationBuilder *)setSpanArray:(NSArray *)array { resultLocation.spanArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (PBSourceCodeInfoLocationBuilder *)setSpanValues:(const SInt32 *)values count:(NSUInteger)count { resultLocation.spanArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (PBSourceCodeInfoLocationBuilder *)clearSpan { resultLocation.spanArray = nil; return self; } - (BOOL) hasLeadingComments { return resultLocation.hasLeadingComments; } - (NSString*) leadingComments { return resultLocation.leadingComments; } - (PBSourceCodeInfoLocationBuilder*) setLeadingComments:(NSString*) value { resultLocation.hasLeadingComments = YES; resultLocation.leadingComments = value; return self; } - (PBSourceCodeInfoLocationBuilder*) clearLeadingComments { resultLocation.hasLeadingComments = NO; resultLocation.leadingComments = @""; return self; } - (BOOL) hasTrailingComments { return resultLocation.hasTrailingComments; } - (NSString*) trailingComments { return resultLocation.trailingComments; } - (PBSourceCodeInfoLocationBuilder*) setTrailingComments:(NSString*) value { resultLocation.hasTrailingComments = YES; resultLocation.trailingComments = value; return self; } - (PBSourceCodeInfoLocationBuilder*) clearTrailingComments { resultLocation.hasTrailingComments = NO; resultLocation.trailingComments = @""; return self; } @end @interface PBSourceCodeInfoBuilder() @property (strong) PBSourceCodeInfo* resultSourceCodeInfo; @end @implementation PBSourceCodeInfoBuilder @synthesize resultSourceCodeInfo; - (instancetype) init { if ((self = [super init])) { self.resultSourceCodeInfo = [[PBSourceCodeInfo alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSourceCodeInfo; } - (PBSourceCodeInfoBuilder*) clear { self.resultSourceCodeInfo = [[PBSourceCodeInfo alloc] init]; return self; } - (PBSourceCodeInfoBuilder*) clone { return [PBSourceCodeInfo builderWithPrototype:resultSourceCodeInfo]; } - (PBSourceCodeInfo*) defaultInstance { return [PBSourceCodeInfo defaultInstance]; } - (PBSourceCodeInfo*) build { [self checkInitialized]; return [self buildPartial]; } - (PBSourceCodeInfo*) buildPartial { PBSourceCodeInfo* returnMe = resultSourceCodeInfo; self.resultSourceCodeInfo = nil; return returnMe; } - (PBSourceCodeInfoBuilder*) mergeFrom:(PBSourceCodeInfo*) other { if (other == [PBSourceCodeInfo defaultInstance]) { return self; } if (other.locationArray.count > 0) { if (resultSourceCodeInfo.locationArray == nil) { resultSourceCodeInfo.locationArray = [[NSMutableArray alloc] initWithArray:other.locationArray]; } else { [resultSourceCodeInfo.locationArray addObjectsFromArray:other.locationArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (PBSourceCodeInfoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (PBSourceCodeInfoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { PBSourceCodeInfoLocationBuilder* subBuilder = [PBSourceCodeInfoLocation builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addLocation:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)location { return resultSourceCodeInfo.locationArray; } - (PBSourceCodeInfoLocation*)locationAtIndex:(NSUInteger)index { return [resultSourceCodeInfo locationAtIndex:index]; } - (PBSourceCodeInfoBuilder *)addLocation:(PBSourceCodeInfoLocation*)value { if (resultSourceCodeInfo.locationArray == nil) { resultSourceCodeInfo.locationArray = [[NSMutableArray alloc]init]; } [resultSourceCodeInfo.locationArray addObject:value]; return self; } - (PBSourceCodeInfoBuilder *)setLocationArray:(NSArray *)array { resultSourceCodeInfo.locationArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (PBSourceCodeInfoBuilder *)clearLocation { resultSourceCodeInfo.locationArray = nil; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtendableMessage.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "GeneratedMessage.h" #import "ExtensionField.h" /** * Generated message classes for message types that contain extension ranges * subclass this. * *

This class implements type-safe accessors for extensions. They * implement all the same operations that you can do with normal fields -- * e.g. "has", "get", and "getCount" -- but for extensions. The extensions * are identified using instances of the class {@link GeneratedExtension}; * the protocol compiler generates a static instance of this class for every * extension in its input. Through the magic of generics, all is made * type-safe. * *

For example, imagine you have the {@code .proto} file: * *

 * option java_class = "MyProto";
 *
 * message Foo {
 *   extensions 1000 to max;
 * }
 *
 * extend Foo {
 *   optional int32 bar;
 * }
 * 
* *

Then you might write code like: * *

 * MyProto.Foo foo = getFoo();
 * int i = foo.getExtension(MyProto.bar);
 * 
* *

See also {@link ExtendableBuilder}. */ @interface PBExtendableMessage : PBGeneratedMessage { @private NSMutableDictionary* extensionMap; NSMutableDictionary* extensionRegistry; } @property (strong) NSMutableDictionary* extensionMap; @property (strong) NSMutableDictionary* extensionRegistry; - (BOOL) hasExtension:(id) extension; - (id) getExtension:(id) extension; //@protected - (BOOL) extensionsAreInitialized; - (SInt32) extensionsSerializedSize; - (void) writeExtensionsToCodedOutputStream:(PBCodedOutputStream*) output from:(SInt32) startInclusive to:(SInt32) endExclusive; - (void) writeExtensionDescriptionToMutableString:(NSMutableString*) output from:(SInt32) startInclusive to:(SInt32) endExclusive withIndent:(NSString*) indent; - (void) addExtensionDictionaryEntriesToMutableDictionary:(NSMutableDictionary*) output from:(int32_t) startInclusive to:(int32_t) endExclusive; - (BOOL) isEqualExtensionsInOther:(PBExtendableMessage*)otherMessage from:(SInt32) startInclusive to:(SInt32) endExclusive; - (NSUInteger) hashExtensionsFrom:(SInt32) startInclusive to:(SInt32) endExclusive; /* @internal */ - (void) ensureExtensionIsRegistered:(id) extension; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtendableMessage.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "ExtendableMessage.h" #import "ExtensionField.h" @implementation PBExtendableMessage @synthesize extensionMap; @synthesize extensionRegistry; - (BOOL) isInitialized:(id) object { if ([object isKindOfClass:[NSArray class]]) { for (id child in object) { if (![self isInitialized:child]) { return NO; } } } else if ([object conformsToProtocol:@protocol(PBMessage)]) { return [object isInitialized]; } return YES; } - (BOOL) extensionsAreInitialized { return [self isInitialized:extensionMap.allValues]; } - (id) getExtension:(id) extension { [self ensureExtensionIsRegistered:extension]; id value = [extensionMap objectForKey:@([extension fieldNumber])]; if (value != nil) { return value; } return [extension defaultValue]; } - (void) ensureExtensionIsRegistered:(id) extension { if ([extension extendedClass] != [self class]) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Trying to use an extension for another type" userInfo:nil]; } if (extensionRegistry == nil) { self.extensionRegistry = [NSMutableDictionary dictionary]; } [extensionRegistry setObject:extension forKey:@([extension fieldNumber])]; } - (BOOL) hasExtension:(id) extension { return nil != [extensionMap objectForKey:@([extension fieldNumber])]; } - (void) writeExtensionsToCodedOutputStream:(PBCodedOutputStream*) output from:(SInt32) startInclusive to:(SInt32) endExclusive { // man, i really wish Cocoa had a Sorted/TreeMap NSArray* sortedKeys = [extensionMap.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { SInt32 fieldNumber = (SInt32)[number integerValue]; if (fieldNumber >= startInclusive && fieldNumber < endExclusive) { id extension = [extensionRegistry objectForKey:number]; id value = [extensionMap objectForKey:number]; [extension writeValue:value includingTagToCodedOutputStream:output]; } } } - (void) writeExtensionDescriptionToMutableString:(NSMutableString*) output from:(SInt32) startInclusive to:(SInt32) endExclusive withIndent:(NSString*) indent { NSArray* sortedKeys = [extensionMap.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { SInt32 fieldNumber = (SInt32)[number integerValue]; if (fieldNumber >= startInclusive && fieldNumber < endExclusive) { id extension = [extensionRegistry objectForKey:number]; id value = [extensionMap objectForKey:number]; [extension writeDescriptionOf:value to:output withIndent:indent]; } } } - (void) addExtensionDictionaryEntriesToMutableDictionary:(NSMutableDictionary*) output from:(int32_t) startInclusive to:(int32_t) endExclusive { NSArray* sortedKeys = [extensionMap.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { int32_t fieldNumber = [number intValue]; if (fieldNumber >= startInclusive && fieldNumber < endExclusive) { id extension = [extensionRegistry objectForKey:number]; id value = [extensionMap objectForKey:number]; [extension addDictionaryEntriesOf:value to:output]; } } } - (BOOL) isEqualExtensionsInOther:(PBExtendableMessage*)otherMessage from:(SInt32) startInclusive to:(SInt32) endExclusive { NSArray* sortedKeys = [extensionMap.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { SInt32 fieldNumber = (SInt32)[number integerValue]; if (fieldNumber >= startInclusive && fieldNumber < endExclusive) { id value = [extensionMap objectForKey:number]; id otherValue = [otherMessage.extensionMap objectForKey:number]; if (![value isEqual:otherValue]) { return NO; } } } return YES; } - (NSUInteger) hashExtensionsFrom:(SInt32) startInclusive to:(SInt32) endExclusive { NSUInteger hashCode = 0; NSArray* sortedKeys = [extensionMap.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { SInt32 fieldNumber = (SInt32)[number integerValue]; if (fieldNumber >= startInclusive && fieldNumber < endExclusive) { id value = [extensionMap objectForKey:number]; hashCode = hashCode * 31 + (NSUInteger)[value hash]; } } return hashCode; } - (SInt32) extensionsSerializedSize { SInt32 size = 0; for (NSNumber* number in extensionMap) { id extension = [extensionRegistry objectForKey:number]; id value = [extensionMap objectForKey:number]; size += [extension computeSerializedSizeIncludingTag:value]; } return size; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtendableMessageBuilder.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "GeneratedMessageBuilder.h" #import "ExtensionField.h" @class PBExtendableMessage; /** * Generated message builders for message types that contain extension ranges * subclass this. * *

This class implements type-safe accessors for extensions. They * implement all the same operations that you can do with normal fields -- * e.g. "get", "set", and "add" -- but for extensions. The extensions are * identified using instances of the class {@link GeneratedExtension}; the * protocol compiler generates a static instance of this class for every * extension in its input. Through the magic of generics, all is made * type-safe. * *

For example, imagine you have the {@code .proto} file: * *

 * option java_class = "MyProto";
 *
 * message Foo {
 *   extensions 1000 to max;
 * }
 *
 * extend Foo {
 *   optional int32 bar;
 * }
 * 
* *

Then you might write code like: * *

 * MyProto.Foo foo =
 *   MyProto.Foo.newBuilder()
 *     .setExtension(MyProto.bar, 123)
 *     .build();
 * 
* *

See also {@link ExtendableMessage}. */ @interface PBExtendableMessageBuilder : PBGeneratedMessageBuilder { } - (id) getExtension:(id) extension; - (BOOL) hasExtension:(id) extension; - (PBExtendableMessageBuilder*) setExtension:(id) extension value:(id) value; - (PBExtendableMessageBuilder*) addExtension:(id) extension value:(id) value; - (PBExtendableMessageBuilder*) setExtension:(id) extension index:(SInt32) index value:(id) value; - (PBExtendableMessageBuilder*) clearExtension:(id) extension; /* @protected */ - (void) mergeExtensionFields:(PBExtendableMessage*) other; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtendableMessageBuilder.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "ExtendableMessageBuilder.h" #import "ExtendableMessage.h" #import "ExtensionRegistry.h" #import "WireFormat.h" @implementation PBExtendableMessageBuilder - (PBExtendableMessage*) internalGetResult { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } /** * Called by subclasses to parse an unknown field or an extension. * @return {@code YES} unless the tag is an end-group tag. */ - (BOOL) parseUnknownField:(PBCodedInputStream*) input unknownFields:(PBUnknownFieldSetBuilder*) unknownFields extensionRegistry:(PBExtensionRegistry*) extensionRegistry tag:(SInt32) tag { PBExtendableMessage* message = [self internalGetResult]; SInt32 wireType = PBWireFormatGetTagWireType(tag); SInt32 fieldNumber = PBWireFormatGetTagFieldNumber(tag); id extension = [extensionRegistry getExtension:[message class] fieldNumber:fieldNumber]; if (extension != nil) { if ([extension wireType] == wireType) { [extension mergeFromCodedInputStream:input unknownFields:unknownFields extensionRegistry:extensionRegistry builder:self tag:tag]; return YES; } } return [super parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]; } - (id) getExtension:(id) extension { return [[self internalGetResult] getExtension:extension]; } - (BOOL) hasExtension:(id) extension { return [[self internalGetResult] hasExtension:extension]; } - (PBExtendableMessageBuilder*) setExtension:(id) extension value:(id) value { PBExtendableMessage* message = [self internalGetResult]; [message ensureExtensionIsRegistered:extension]; if ([extension isRepeated]) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Must call addExtension() for repeated types." userInfo:nil]; } if (message.extensionMap == nil) { message.extensionMap = [NSMutableDictionary dictionary]; } [message.extensionMap setObject:value forKey:@([extension fieldNumber])]; return self; } - (PBExtendableMessageBuilder*) addExtension:(id) extension value:(id) value { PBExtendableMessage* message = [self internalGetResult]; [message ensureExtensionIsRegistered:extension]; if (![extension isRepeated]) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Must call setExtension() for singular types." userInfo:nil]; } if (message.extensionMap == nil) { message.extensionMap = [NSMutableDictionary dictionary]; } NSNumber* fieldNumber = @([extension fieldNumber]); NSMutableArray* list = [message.extensionMap objectForKey:fieldNumber]; if (list == nil) { list = [NSMutableArray array]; [message.extensionMap setObject:list forKey:fieldNumber]; } [list addObject:value]; return self; } - (PBExtendableMessageBuilder*) setExtension:(id) extension index:(SInt32) index value:(id) value { PBExtendableMessage* message = [self internalGetResult]; [message ensureExtensionIsRegistered:extension]; if (![extension isRepeated]) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Must call setExtension() for singular types." userInfo:nil]; } if (message.extensionMap == nil) { message.extensionMap = [NSMutableDictionary dictionary]; } NSNumber* fieldNumber = @([extension fieldNumber]); NSMutableArray* list = [message.extensionMap objectForKey:fieldNumber]; [list replaceObjectAtIndex:index withObject:value]; return self; } - (PBExtendableMessageBuilder*) clearExtension:(id) extension { PBExtendableMessage* message = [self internalGetResult]; [message ensureExtensionIsRegistered:extension]; [message.extensionMap removeObjectForKey:@([extension fieldNumber])]; return self; } - (void) mergeExtensionFields:(PBExtendableMessage*) other { PBExtendableMessage* thisMessage = [self internalGetResult]; if ([thisMessage class] != [other class]) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Cannot merge extensions from a different type" userInfo:nil]; } if (other.extensionMap.count > 0) { if (thisMessage.extensionMap == nil) { thisMessage.extensionMap = [NSMutableDictionary dictionary]; } NSDictionary* registry = other.extensionRegistry; for (NSNumber* fieldNumber in other.extensionMap) { id thisField = [registry objectForKey:fieldNumber]; id value = [other.extensionMap objectForKey:fieldNumber]; if ([thisField isRepeated]) { NSMutableArray* list = [thisMessage.extensionMap objectForKey:fieldNumber]; if (list == nil) { list = [NSMutableArray array]; [thisMessage.extensionMap setObject:list forKey:fieldNumber]; } [list addObjectsFromArray:value]; } else { [thisMessage.extensionMap setObject:value forKey:fieldNumber]; } } } } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtensionField.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "WireFormat.h" @class PBCodedInputStream; @class PBCodedOutputStream; @class PBExtendableMessageBuilder; @class PBExtensionRegistry; @class PBUnknownFieldSetBuilder; @protocol PBExtensionField - (SInt32) fieldNumber; - (PBWireFormat) wireType; - (BOOL) isRepeated; - (Class) extendedClass; - (instancetype) defaultValue; - (void) mergeFromCodedInputStream:(PBCodedInputStream*) input unknownFields:(PBUnknownFieldSetBuilder*) unknownFields extensionRegistry:(PBExtensionRegistry*) extensionRegistry builder:(PBExtendableMessageBuilder*) builder tag:(SInt32) tag; - (void) writeValue:(id) value includingTagToCodedOutputStream:(PBCodedOutputStream*) output; - (SInt32) computeSerializedSizeIncludingTag:(id) value; - (void) writeDescriptionOf:(id) value to:(NSMutableString*) output withIndent:(NSString*) indent; - (void) addDictionaryEntriesOf:(id) value to:(NSMutableDictionary*) dictionary; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtensionRegistry.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. /** * A table of known extensions, searchable by name or field number. When * parsing a protocol message that might have extensions, you must provide * an {@code ExtensionRegistry} in which you have registered any extensions * that you want to be able to parse. Otherwise, those extensions will just * be treated like unknown fields. * *

For example, if you had the {@code .proto} file: * *

 * option java_class = "MyProto";
 *
 * message Foo {
 *   extensions 1000 to max;
 * }
 *
 * extend Foo {
 *   optional int32 bar;
 * }
 * 
* * Then you might write code like: * *
 * ExtensionRegistry registry = ExtensionRegistry.newInstance();
 * registry.add(MyProto.bar);
 * MyProto.Foo message = MyProto.Foo.parseFrom(input, registry);
 * 
* *

Background: * *

You might wonder why this is necessary. Two alternatives might come to * mind. First, you might imagine a system where generated extensions are * automatically registered when their containing classes are loaded. This * is a popular technique, but is bad design; among other things, it creates a * situation where behavior can change depending on what classes happen to be * loaded. It also introduces a security vulnerability, because an * unprivileged class could cause its code to be called unexpectedly from a * privileged class by registering itself as an extension of the right type. * *

Another option you might consider is lazy parsing: do not parse an * extension until it is first requested, at which point the caller must * provide a type to use. This introduces a different set of problems. First, * it would require a mutex lock any time an extension was accessed, which * would be slow. Second, corrupt data would not be detected until first * access, at which point it would be much harder to deal with it. Third, it * could violate the expectation that message objects are immutable, since the * type provided could be any arbitrary message class. An unpriviledged user * could take advantage of this to inject a mutable object into a message * belonging to priviledged code and create mischief. * * @author Cyrus Najmabadi */ #import #import "ExtensionField.h" @interface PBExtensionRegistry : NSObject { @protected NSDictionary* classMap; } + (PBExtensionRegistry*) emptyRegistry; - (id) getExtension:(Class) clazz fieldNumber:(SInt32) fieldNumber; /* @protected */ - (instancetype) initWithClassMap:(NSDictionary*) classMap; - (id) keyForClass:(Class) clazz; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ExtensionRegistry.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "ExtensionRegistry.h" @interface PBExtensionRegistry() @property (strong) NSDictionary* classMap; @end @implementation PBExtensionRegistry @synthesize classMap; static PBExtensionRegistry* emptyRegistry = nil; + (void) initialize { if (self == [PBExtensionRegistry class]) { emptyRegistry = [[PBExtensionRegistry alloc] initWithClassMap:[NSDictionary dictionary]]; } } - (instancetype) initWithClassMap:(NSDictionary*) map_{ if ((self = [super init])) { self.classMap = map_; } return self; } - (id) keyForClass:(Class) clazz { return NSStringFromClass(clazz); } + (PBExtensionRegistry*) emptyRegistry { return emptyRegistry; } - (id) getExtension:(Class) clazz fieldNumber:(SInt32) fieldNumber { NSDictionary* extensionMap = [classMap objectForKey:[self keyForClass:clazz]]; return [extensionMap objectForKey:[NSNumber numberWithInteger:fieldNumber]]; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Field.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import @class PBArray; @class PBAppendableArray; @class PBCodedOutputStream; @interface PBField : NSObject { @protected PBAppendableArray * _varintArray; PBAppendableArray * _fixed32Array; PBAppendableArray * _fixed64Array; NSMutableArray * _lengthDelimitedArray; NSMutableArray * _groupArray; } @property (nonatomic,strong,readonly) PBArray * varintArray; @property (nonatomic,strong,readonly) PBArray * fixed32Array; @property (nonatomic,strong,readonly) PBArray * fixed64Array; @property (nonatomic,strong,readonly) NSArray * lengthDelimitedArray; @property (nonatomic,strong,readonly) NSArray * groupArray; + (PBField *)defaultInstance; - (SInt32)getSerializedSize:(SInt32)fieldNumber; - (SInt32)getSerializedSizeAsMessageSetExtension:(SInt32)fieldNumber; - (void)writeTo:(SInt32) fieldNumber output:(PBCodedOutputStream *)output; - (void)writeAsMessageSetExtensionTo:(SInt32)fieldNumber output:(PBCodedOutputStream *)output; - (void)writeDescriptionFor:(SInt32) fieldNumber to:(NSMutableString*) output withIndent:(NSString*) indent; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Field.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "Field.h" #import "CodedOutputStream.h" #import "PBArray.h" #import "UnknownFieldSet.h" #import "Utilities.h" @implementation PBField @synthesize varintArray = _varintArray; @synthesize fixed32Array = _fixed32Array; @synthesize fixed64Array = _fixed64Array; @synthesize lengthDelimitedArray = _lengthDelimitedArray; @synthesize groupArray = _groupArray; static PBField *sDefaultInstance = nil; + (void)initialize { if (self == [PBField class]) { sDefaultInstance = [[PBField alloc] init]; } } + (PBField *)defaultInstance { return sDefaultInstance; } - (SInt32)getSerializedSize:(SInt32)fieldNumber { SInt32 result = 0; const SInt64 *varintValues = (const SInt64 *)_varintArray.data; if (varintValues) { const NSUInteger count = _varintArray.count; for (UInt32 i = 0; i < count; ++i) { result += computeInt64Size(fieldNumber, varintValues[i]); } } const SInt32 *fixed32Values = (const SInt32 *)_fixed32Array.data; if (fixed32Values) { const NSUInteger count = _fixed32Array.count; for (UInt32 i = 0; i < count; ++i) { result += computeFixed32Size(fieldNumber, fixed32Values[i]); } } const SInt64 *fixed64Values = (const SInt64 *)_fixed64Array.data; if (fixed64Values) { const NSUInteger count = _fixed64Array.count; for (NSUInteger i = 0; i < count; ++i) { result += computeFixed64Size(fieldNumber, fixed64Values[i]); } } for (NSData *value in _lengthDelimitedArray) { result += computeDataSize(fieldNumber, value); } for (PBUnknownFieldSet *value in _groupArray) { result += computeUnknownGroupSize(fieldNumber, value); } return result; } - (SInt32)getSerializedSizeAsMessageSetExtension:(SInt32)fieldNumber { SInt32 result = 0; for (NSData *value in _lengthDelimitedArray) { result += computeRawMessageSetExtensionSize(fieldNumber, value); } return result; } - (void)writeTo:(SInt32)fieldNumber output:(PBCodedOutputStream *) output { const SInt64 *varintValues = (const SInt64 *)_varintArray.data; if (varintValues) { const NSUInteger count = _varintArray.count; for (NSUInteger i = 0; i < count; ++i) { [output writeInt64:fieldNumber value:varintValues[i]]; } } const SInt32 *fixed32Values = (const SInt32 *)_fixed32Array.data; if (fixed32Values) { const NSUInteger count = _fixed32Array.count; for (NSUInteger i = 0; i < count; ++i) { [output writeFixed32:fieldNumber value:fixed32Values[i]]; } } const SInt64 *fixed64Values = (const SInt64 *)_fixed64Array.data; if (fixed64Values) { const NSUInteger count = _fixed64Array.count; for (NSUInteger i = 0; i < count; ++i) { [output writeFixed64:fieldNumber value:fixed64Values[i]]; } } for (NSData *value in _lengthDelimitedArray) { [output writeData:fieldNumber value:value]; } for (PBUnknownFieldSet *value in _groupArray) { [output writeUnknownGroup:fieldNumber value:value]; } } - (void)writeDescriptionFor:(SInt32) fieldNumber to:(NSMutableString*) output withIndent:(NSString*) indent { [self.varintArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { }]; [self.varintArray enumerateObjectsUsingBlock:^(NSNumber* value, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%ld: %qi\n", indent, (long)fieldNumber, value.longLongValue]; }]; [self.fixed32Array enumerateObjectsUsingBlock:^(NSNumber* value, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%ld: %ld\n", indent, (long)fieldNumber, (long)value.integerValue]; }]; [self.fixed64Array enumerateObjectsUsingBlock:^(NSNumber* value, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%ld: %lld\n", indent, (long)fieldNumber, value.longLongValue]; }]; for (NSData* value in self.lengthDelimitedArray) { [output appendFormat:@"%@%ld: %@\n", indent, (long)fieldNumber, value]; } for (PBUnknownFieldSet* value in self.groupArray) { [output appendFormat:@"%@%ld: [\n", indent, (long)fieldNumber]; [value writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@]", indent]; } } - (void)writeAsMessageSetExtensionTo:(SInt32)fieldNumber output:(PBCodedOutputStream *) output { for (NSData *value in _lengthDelimitedArray) { [output writeRawMessageSetExtension:fieldNumber value:value]; } } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ForwardDeclarations.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. @protocol PBMessage; @protocol PBMessageBuilder; @protocol PBExtensionField; @class PBAbstractMessage; @class PBCodedInputStream; @class PBCodedOutputStream; @class PBConcreteExtensionField; @class PBExtendableMessageBuilder; @class PBExtendableMessage; @class PBExtensionRegistry; @class PBField; @class PBGeneratedMessage; @class PBGeneratedMessageBuilder; @class PBMutableExtensionRegistry; @class PBMutableField; @class PBUnknownFieldSet; @class PBUnknownFieldSetBuilder; ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/GeneratedMessage.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "AbstractMessage.h" /** * All generated protocol message classes extend this class. This class * implements most of the Message and Builder interfaces using Java reflection. * Users can ignore this class and pretend that generated messages implement * the Message interface directly. * * @author Cyrus Najmabadi */ @class PBExtensionRegistry; @class PBCodedInputStream; @protocol GeneratedMessageProtocol + (id) parseFromData:(NSData*) data; + (id) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*)extensionRegistry; + (id) parseFromInputStream:(NSInputStream*) input; + (id) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (id) parseFromCodedInputStream:(PBCodedInputStream*) input; + (id) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface PBGeneratedMessage : PBAbstractMessage { @private PBUnknownFieldSet* unknownFields; @protected SInt32 memoizedSerializedSize; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/GeneratedMessage.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "GeneratedMessage.h" #import "UnknownFieldSet.h" @interface PBGeneratedMessage () @property (strong) PBUnknownFieldSet* unknownFields; @end @implementation PBGeneratedMessage @synthesize unknownFields; - (instancetype) init { if ((self = [super init])) { self.unknownFields = [PBUnknownFieldSet defaultInstance]; memoizedSerializedSize = -1; } return self; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/GeneratedMessageBuilder.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "AbstractMessageBuilder.h" @class PBUnknownFieldSetBuilder; @interface PBGeneratedMessageBuilder : PBAbstractMessageBuilder { } /* @protected */ - (BOOL) parseUnknownField:(PBCodedInputStream*) input unknownFields:(PBUnknownFieldSetBuilder*) unknownFields extensionRegistry:(PBExtensionRegistry*) extensionRegistry tag:(SInt32) tag; - (void) checkInitialized; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/GeneratedMessageBuilder.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "GeneratedMessageBuilder.h" #import "GeneratedMessage.h" #import "Message.h" #import "MessageBuilder.h" #import "UnknownFieldSet.h" #import "UnknownFieldSetBuilder.h" @interface PBGeneratedMessage () @property (strong) PBUnknownFieldSet* unknownFields; @end @implementation PBGeneratedMessageBuilder /** * Get the message being built. We don't just pass this to the * constructor because it becomes null when build() is called. */ - (PBGeneratedMessage*) internalGetResult { @throw [NSException exceptionWithName:@"ImproperSubclassing" reason:@"" userInfo:nil]; } - (void) checkInitialized { PBGeneratedMessage* result = self.internalGetResult; if (result != nil && !result.isInitialized) { @throw [NSException exceptionWithName:@"UninitializedMessage" reason:@"" userInfo:nil]; } } - (PBUnknownFieldSet*) unknownFields { return self.internalGetResult.unknownFields; } - (id) setUnknownFields:(PBUnknownFieldSet*) unknownFields { self.internalGetResult.unknownFields = unknownFields; return self; } - (id) mergeUnknownFields:(PBUnknownFieldSet*) unknownFields { PBGeneratedMessage* result = self.internalGetResult; result.unknownFields = [[[PBUnknownFieldSet builderWithUnknownFields:result.unknownFields] mergeUnknownFields:unknownFields] build]; return self; } - (BOOL) isInitialized { return self.internalGetResult.isInitialized; } /** * Called by subclasses to parse an unknown field. * @return {@code YES} unless the tag is an end-group tag. */ - (BOOL) parseUnknownField:(PBCodedInputStream*) input unknownFields:(PBUnknownFieldSetBuilder*) unknownFields extensionRegistry:(PBExtensionRegistry*) extensionRegistry tag:(SInt32) tag { return [unknownFields mergeFieldFrom:tag input:input]; } - (void) checkInitializedParsed { PBGeneratedMessage* result = self.internalGetResult; if (result != nil && !result.isInitialized) { @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"" userInfo:nil]; } } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Message.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import @class PBCodedOutputStream; @class PBUnknownFieldSet; @protocol PBMessageBuilder; /** * Abstract interface implemented by Protocol Message objects. * * @author Cyrus Najmabadi */ @protocol PBMessage /** * Get an instance of the type with all fields set to their default values. * This may or may not be a singleton. This differs from the * {@code getDefaultInstance()} method of generated message classes in that * this method is an abstract method of the {@code Message} interface * whereas {@code getDefaultInstance()} is a static method of a specific * class. They return the same thing. */ - (id) defaultInstance; /** * Get the {@code UnknownFieldSet} */ - (PBUnknownFieldSet*) unknownFields; /** * Get the number of bytes required to encode this message. The result * is only computed on the first call and memoized after that. */ - (SInt32) serializedSize; /** * Returns true if all required fields in the message and all embedded * messages are set, false otherwise. */ - (BOOL) isInitialized; /** * Serializes the message and writes it to {@code output}. This does not * flush or close the stream. */ - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (void) writeToOutputStream:(NSOutputStream*) output; /** * Serializes the message to a {@code ByteString} and returns it. This is * just a trivial wrapper around * {@link #writeTo(CodedOutputStream)}. */ - (NSData*) data; /** * Constructs a new builder for a message of the same type as this message. */ - (id) builder; /** * Constructs a builder initialized with the current message. Use this to * derive a new message from the current one. */ - (id) toBuilder; /** * Returns a string description of the message. */ - (NSString*) description; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/MessageBuilder.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "Message.h" @class PBCodedInputStream; @class PBExtensionRegistry; /** * Abstract interface implemented by Protocol Message builders. */ @protocol PBMessageBuilder /** Resets all fields to their default values. */ - (id) clear; /** * Construct the final message. Once this is called, the Builder is no * longer valid, and calling any other method may throw a * NullPointerException. If you need to continue working with the builder * after calling {@code build()}, {@code clone()} it first. * @throws UninitializedMessageException The message is missing one or more * required fields (i.e. {@link #isInitialized()} returns false). * Use {@link #buildPartial()} to bypass this check. */ - (id) build; /** * Like {@link #build()}, but does not throw an exception if the message * is missing required fields. Instead, a partial message is returned. */ - (id) buildPartial; - (id) clone; /** * Returns true if all required fields in the message and all embedded * messages are set, false otherwise. */ - (BOOL) isInitialized; /** * Get the message's type's default instance. * See {@link Message#getDefaultInstanceForType()}. */ - (id) defaultInstance; - (PBUnknownFieldSet*) unknownFields; - (id) setUnknownFields:(PBUnknownFieldSet*) unknownFields; /** * Merge some unknown fields into the {@link UnknownFieldSet} for this * message. */ - (id) mergeUnknownFields:(PBUnknownFieldSet*) unknownFields; /** * Parses a message of this type from the input and merges it with this * message, as if using {@link Builder#mergeFrom(Message)}. * *

Warning: This does not verify that all required fields are present in * the input message. If you call {@link #build()} without setting all * required fields, it will throw an {@link UninitializedMessageException}, * which is a {@code RuntimeException} and thus might not be caught. There * are a few good ways to deal with this: *

    *
  • Call {@link #isInitialized()} to verify that all required fields * are set before building. *
  • Parse the message separately using one of the static * {@code parseFrom} methods, then use {@link #mergeFrom(Message)} * to merge it with this one. {@code parseFrom} will throw an * {@link InvalidProtocolBufferException} (an {@code IOException}) * if some required fields are missing. *
  • Use {@code buildPartial()} to build, which ignores missing * required fields. *
* *

Note: The caller should call * {@link CodedInputStream#checkLastTagWas(int)} after calling this to * verify that the last tag seen was the appropriate end-group tag, * or zero for EOF. */ - (id) mergeFromCodedInputStream:(PBCodedInputStream*) input; /** * Like {@link Builder#mergeFrom(CodedInputStream)}, but also * parses extensions. The extensions that you want to be able to parse * must be registered in {@code extensionRegistry}. Extensions not in * the registry will be treated as unknown fields. */ - (id) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; /** * Parse {@code data} as a message of this type and merge it with the * message being built. This is just a small wrapper around * {@link #mergeFrom(CodedInputStream)}. */ - (id) mergeFromData:(NSData*) data; /** * Parse {@code data} as a message of this type and merge it with the * message being built. This is just a small wrapper around * {@link #mergeFrom(CodedInputStream,ExtensionRegistry)}. */ - (id) mergeFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; /** * Parse a message of this type from {@code input} and merge it with the * message being built. This is just a small wrapper around * {@link #mergeFrom(CodedInputStream)}. Note that this method always * reads the entire input (unless it throws an exception). If you * want it to stop earlier, you will need to wrap your input in some * wrapper stream that limits reading. Despite usually reading the entire * input, this does not close the stream. */ - (id) mergeFromInputStream:(NSInputStream*) input; /** * Parse a message of this type from {@code input} and merge it with the * message being built. This is just a small wrapper around * {@link #mergeFrom(CodedInputStream,ExtensionRegistry)}. */ - (id) mergeFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/MutableExtensionRegistry.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "ExtensionRegistry.h" @interface PBMutableExtensionRegistry : PBExtensionRegistry { @private NSMutableDictionary* mutableClassMap; } + (PBMutableExtensionRegistry*) registry; - (void) addExtension:(id) extension; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/MutableExtensionRegistry.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "MutableExtensionRegistry.h" #import "ExtensionField.h" @interface PBMutableExtensionRegistry() @property (strong) NSMutableDictionary* mutableClassMap; @end @implementation PBMutableExtensionRegistry @synthesize mutableClassMap; - (instancetype) initWithClassMap:(NSMutableDictionary*) mutableClassMap_ { if ((self = [super initWithClassMap:mutableClassMap_])) { self.mutableClassMap = mutableClassMap_; } return self; } + (PBMutableExtensionRegistry*) registry { return [[PBMutableExtensionRegistry alloc] initWithClassMap:[NSMutableDictionary dictionary]]; } - (void) addExtension:(id) extension { if (extension == nil) { return; } Class extendedClass = [extension extendedClass]; id key = [self keyForClass:extendedClass]; NSMutableDictionary* extensionMap = [classMap objectForKey:key]; if (extensionMap == nil) { extensionMap = [NSMutableDictionary dictionary]; [mutableClassMap setObject:extensionMap forKey:key]; } [extensionMap setObject:extension forKey:[NSNumber numberWithInteger:[extension fieldNumber]]]; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/MutableField.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "Field.h" @class PBUnknownFieldSet; @interface PBMutableField : PBField + (PBMutableField *)field; - (PBMutableField *)mergeFromField:(PBField *)other; - (PBMutableField *)clear; - (PBMutableField *)addVarint:(SInt64)value; - (PBMutableField *)addFixed32:(SInt32)value; - (PBMutableField *)addFixed64:(SInt64)value; - (PBMutableField *)addLengthDelimited:(NSData *)value; - (PBMutableField *)addGroup:(PBUnknownFieldSet *)value; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/MutableField.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "MutableField.h" #import "Field.h" #import "PBArray.h" @implementation PBMutableField + (PBMutableField *)field { return [[PBMutableField alloc] init]; } - (PBMutableField *)clear { _varintArray = nil; _fixed32Array = nil; _fixed64Array = nil; _lengthDelimitedArray = nil; _groupArray = nil; return self; } - (PBMutableField *)mergeFromField:(PBField *)other { if (other.varintArray.count > 0) { if (_varintArray == nil) { _varintArray = [other.varintArray copy]; } else { [_varintArray appendArray:other.varintArray]; } } if (other.fixed32Array.count > 0) { if (_fixed32Array == nil) { _fixed32Array = [other.fixed32Array copy]; } else { [_fixed32Array appendArray:other.fixed32Array]; } } if (other.fixed64Array.count > 0) { if (_fixed64Array == nil) { _fixed64Array = [other.fixed64Array copy]; } else { [_fixed64Array appendArray:other.fixed64Array]; } } if (other.lengthDelimitedArray.count > 0) { if (_lengthDelimitedArray == nil) { _lengthDelimitedArray = [other.lengthDelimitedArray mutableCopy]; } else { [_lengthDelimitedArray addObjectsFromArray:other.lengthDelimitedArray]; } } if (other.groupArray.count > 0) { if (_groupArray == nil) { _groupArray = [other.groupArray mutableCopy]; } else { [_groupArray addObjectsFromArray:other.groupArray]; } } return self; } - (PBMutableField *)addVarint:(SInt64)value { if (_varintArray == nil) { _varintArray = [[PBAppendableArray alloc] initWithValueType:PBArrayValueTypeInt64]; } [_varintArray addInt64:value]; return self; } - (PBMutableField *)addFixed32:(SInt32)value { if (_fixed32Array == nil) { _fixed32Array = [[PBAppendableArray alloc] initWithValueType:PBArrayValueTypeInt32]; } [_fixed32Array addInt32:value]; return self; } - (PBMutableField *)addFixed64:(SInt64)value { if (_fixed64Array == nil) { _fixed64Array = [[PBAppendableArray alloc] initWithValueType:PBArrayValueTypeInt64]; } [_fixed64Array addInt64:value]; return self; } - (PBMutableField *)addLengthDelimited:(NSData *)value { if (_lengthDelimitedArray == nil) { _lengthDelimitedArray = [[NSMutableArray alloc] init]; } [_lengthDelimitedArray addObject:value]; return self; } - (PBMutableField *)addGroup:(PBUnknownFieldSet *)value { if (_groupArray == nil) { _groupArray = [[NSMutableArray alloc] init]; } [_groupArray addObject:value]; return self; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ObjectivecDescriptor.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" #import "Descriptor.pb.h" // @@protoc_insertion_point(imports) @class ObjectiveCFileOptions; @class ObjectiveCFileOptionsBuilder; @class PBDescriptorProto; @class PBDescriptorProtoBuilder; @class PBDescriptorProtoExtensionRange; @class PBDescriptorProtoExtensionRangeBuilder; @class PBEnumDescriptorProto; @class PBEnumDescriptorProtoBuilder; @class PBEnumOptions; @class PBEnumOptionsBuilder; @class PBEnumValueDescriptorProto; @class PBEnumValueDescriptorProtoBuilder; @class PBEnumValueOptions; @class PBEnumValueOptionsBuilder; @class PBFieldDescriptorProto; @class PBFieldDescriptorProtoBuilder; @class PBFieldOptions; @class PBFieldOptionsBuilder; @class PBFileDescriptorProto; @class PBFileDescriptorProtoBuilder; @class PBFileDescriptorSet; @class PBFileDescriptorSetBuilder; @class PBFileOptions; @class PBFileOptionsBuilder; @class PBMessageOptions; @class PBMessageOptionsBuilder; @class PBMethodDescriptorProto; @class PBMethodDescriptorProtoBuilder; @class PBMethodOptions; @class PBMethodOptionsBuilder; @class PBOneofDescriptorProto; @class PBOneofDescriptorProtoBuilder; @class PBServiceDescriptorProto; @class PBServiceDescriptorProtoBuilder; @class PBServiceOptions; @class PBServiceOptionsBuilder; @class PBSourceCodeInfo; @class PBSourceCodeInfoBuilder; @class PBSourceCodeInfoLocation; @class PBSourceCodeInfoLocationBuilder; @class PBUninterpretedOption; @class PBUninterpretedOptionBuilder; @class PBUninterpretedOptionNamePart; @class PBUninterpretedOptionNamePartBuilder; @interface ObjectivecDescriptorRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; + (id) objectivecFileOptions; @end #define ObjectiveCFileOptions_package @"package" #define ObjectiveCFileOptions_class_prefix @"classPrefix" #define ObjectiveCFileOptions_relax_camel_case @"relaxCamelCase" @interface ObjectiveCFileOptions : PBGeneratedMessage { @private BOOL hasRelaxCamelCase_:1; BOOL hasPackage_:1; BOOL hasClassPrefix_:1; BOOL relaxCamelCase_:1; NSString* package; NSString* classPrefix; } - (BOOL) hasPackage; - (BOOL) hasClassPrefix; - (BOOL) hasRelaxCamelCase; @property (readonly, strong) NSString* package; @property (readonly, strong) NSString* classPrefix; - (BOOL) relaxCamelCase; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (ObjectiveCFileOptionsBuilder*) builder; + (ObjectiveCFileOptionsBuilder*) builder; + (ObjectiveCFileOptionsBuilder*) builderWithPrototype:(ObjectiveCFileOptions*) prototype; - (ObjectiveCFileOptionsBuilder*) toBuilder; + (ObjectiveCFileOptions*) parseFromData:(NSData*) data; + (ObjectiveCFileOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ObjectiveCFileOptions*) parseFromInputStream:(NSInputStream*) input; + (ObjectiveCFileOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ObjectiveCFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ObjectiveCFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface ObjectiveCFileOptionsBuilder : PBGeneratedMessageBuilder { @private ObjectiveCFileOptions* resultObjectiveCfileOptions; } - (ObjectiveCFileOptions*) defaultInstance; - (ObjectiveCFileOptionsBuilder*) clear; - (ObjectiveCFileOptionsBuilder*) clone; - (ObjectiveCFileOptions*) build; - (ObjectiveCFileOptions*) buildPartial; - (ObjectiveCFileOptionsBuilder*) mergeFrom:(ObjectiveCFileOptions*) other; - (ObjectiveCFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (ObjectiveCFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasPackage; - (NSString*) package; - (ObjectiveCFileOptionsBuilder*) setPackage:(NSString*) value; - (ObjectiveCFileOptionsBuilder*) clearPackage; - (BOOL) hasClassPrefix; - (NSString*) classPrefix; - (ObjectiveCFileOptionsBuilder*) setClassPrefix:(NSString*) value; - (ObjectiveCFileOptionsBuilder*) clearClassPrefix; - (BOOL) hasRelaxCamelCase; - (BOOL) relaxCamelCase; - (ObjectiveCFileOptionsBuilder*) setRelaxCamelCase:(BOOL) value; - (ObjectiveCFileOptionsBuilder*) clearRelaxCamelCase; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ObjectivecDescriptor.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ObjectivecDescriptor.pb.h" // @@protoc_insertion_point(imports) @implementation ObjectivecDescriptorRoot static id ObjectivecDescriptorRoot_objectivecFileOptions = nil; static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [ObjectivecDescriptorRoot class]) { ObjectivecDescriptorRoot_objectivecFileOptions = [PBConcreteExtensionField extensionWithType:PBExtensionTypeMessage extendedClass:[PBFileOptions class] fieldNumber:1002 defaultValue:[ObjectiveCFileOptions defaultInstance] messageOrGroupClass:[ObjectiveCFileOptions class] isRepeated:NO isPacked:NO isMessageSetWireFormat:NO]; PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; [PBDescriptorRoot registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { [registry addExtension:ObjectivecDescriptorRoot_objectivecFileOptions]; } + (id) objectivecFileOptions { return ObjectivecDescriptorRoot_objectivecFileOptions; } @end @interface ObjectiveCFileOptions () @property (strong) NSString* package; @property (strong) NSString* classPrefix; @property BOOL relaxCamelCase; @end @implementation ObjectiveCFileOptions - (BOOL) hasPackage { return !!hasPackage_; } - (void) setHasPackage:(BOOL) _value_ { hasPackage_ = !!_value_; } @synthesize package; - (BOOL) hasClassPrefix { return !!hasClassPrefix_; } - (void) setHasClassPrefix:(BOOL) _value_ { hasClassPrefix_ = !!_value_; } @synthesize classPrefix; - (BOOL) hasRelaxCamelCase { return !!hasRelaxCamelCase_; } - (void) setHasRelaxCamelCase:(BOOL) _value_ { hasRelaxCamelCase_ = !!_value_; } - (BOOL) relaxCamelCase { return !!relaxCamelCase_; } - (void) setRelaxCamelCase:(BOOL) _value_ { relaxCamelCase_ = !!_value_; } - (instancetype) init { if ((self = [super init])) { self.package = @""; self.classPrefix = @""; self.relaxCamelCase = NO; } return self; } static ObjectiveCFileOptions* defaultObjectiveCFileOptionsInstance = nil; + (void) initialize { if (self == [ObjectiveCFileOptions class]) { defaultObjectiveCFileOptionsInstance = [[ObjectiveCFileOptions alloc] init]; } } + (instancetype) defaultInstance { return defaultObjectiveCFileOptionsInstance; } - (instancetype) defaultInstance { return defaultObjectiveCFileOptionsInstance; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasPackage) { [output writeString:1 value:self.package]; } if (self.hasClassPrefix) { [output writeString:2 value:self.classPrefix]; } if (self.hasRelaxCamelCase) { [output writeBool:3 value:self.relaxCamelCase]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasPackage) { size_ += computeStringSize(1, self.package); } if (self.hasClassPrefix) { size_ += computeStringSize(2, self.classPrefix); } if (self.hasRelaxCamelCase) { size_ += computeBoolSize(3, self.relaxCamelCase); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ObjectiveCFileOptions*) parseFromData:(NSData*) data { return (ObjectiveCFileOptions*)[[[ObjectiveCFileOptions builder] mergeFromData:data] build]; } + (ObjectiveCFileOptions*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ObjectiveCFileOptions*)[[[ObjectiveCFileOptions builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ObjectiveCFileOptions*) parseFromInputStream:(NSInputStream*) input { return (ObjectiveCFileOptions*)[[[ObjectiveCFileOptions builder] mergeFromInputStream:input] build]; } + (ObjectiveCFileOptions*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ObjectiveCFileOptions*)[[[ObjectiveCFileOptions builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ObjectiveCFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ObjectiveCFileOptions*)[[[ObjectiveCFileOptions builder] mergeFromCodedInputStream:input] build]; } + (ObjectiveCFileOptions*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ObjectiveCFileOptions*)[[[ObjectiveCFileOptions builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (ObjectiveCFileOptionsBuilder*) builder { return [[ObjectiveCFileOptionsBuilder alloc] init]; } + (ObjectiveCFileOptionsBuilder*) builderWithPrototype:(ObjectiveCFileOptions*) prototype { return [[ObjectiveCFileOptions builder] mergeFrom:prototype]; } - (ObjectiveCFileOptionsBuilder*) builder { return [ObjectiveCFileOptions builder]; } - (ObjectiveCFileOptionsBuilder*) toBuilder { return [ObjectiveCFileOptions builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasPackage) { [output appendFormat:@"%@%@: %@\n", indent, @"package", self.package]; } if (self.hasClassPrefix) { [output appendFormat:@"%@%@: %@\n", indent, @"classPrefix", self.classPrefix]; } if (self.hasRelaxCamelCase) { [output appendFormat:@"%@%@: %@\n", indent, @"relaxCamelCase", [NSNumber numberWithBool:self.relaxCamelCase]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasPackage) { [dictionary setObject: self.package forKey: @"package"]; } if (self.hasClassPrefix) { [dictionary setObject: self.classPrefix forKey: @"classPrefix"]; } if (self.hasRelaxCamelCase) { [dictionary setObject: [NSNumber numberWithBool:self.relaxCamelCase] forKey: @"relaxCamelCase"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[ObjectiveCFileOptions class]]) { return NO; } ObjectiveCFileOptions *otherMessage = other; return self.hasPackage == otherMessage.hasPackage && (!self.hasPackage || [self.package isEqual:otherMessage.package]) && self.hasClassPrefix == otherMessage.hasClassPrefix && (!self.hasClassPrefix || [self.classPrefix isEqual:otherMessage.classPrefix]) && self.hasRelaxCamelCase == otherMessage.hasRelaxCamelCase && (!self.hasRelaxCamelCase || self.relaxCamelCase == otherMessage.relaxCamelCase) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasPackage) { hashCode = hashCode * 31 + [self.package hash]; } if (self.hasClassPrefix) { hashCode = hashCode * 31 + [self.classPrefix hash]; } if (self.hasRelaxCamelCase) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.relaxCamelCase] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface ObjectiveCFileOptionsBuilder() @property (strong) ObjectiveCFileOptions* resultObjectiveCfileOptions; @end @implementation ObjectiveCFileOptionsBuilder @synthesize resultObjectiveCfileOptions; - (instancetype) init { if ((self = [super init])) { self.resultObjectiveCfileOptions = [[ObjectiveCFileOptions alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultObjectiveCfileOptions; } - (ObjectiveCFileOptionsBuilder*) clear { self.resultObjectiveCfileOptions = [[ObjectiveCFileOptions alloc] init]; return self; } - (ObjectiveCFileOptionsBuilder*) clone { return [ObjectiveCFileOptions builderWithPrototype:resultObjectiveCfileOptions]; } - (ObjectiveCFileOptions*) defaultInstance { return [ObjectiveCFileOptions defaultInstance]; } - (ObjectiveCFileOptions*) build { [self checkInitialized]; return [self buildPartial]; } - (ObjectiveCFileOptions*) buildPartial { ObjectiveCFileOptions* returnMe = resultObjectiveCfileOptions; self.resultObjectiveCfileOptions = nil; return returnMe; } - (ObjectiveCFileOptionsBuilder*) mergeFrom:(ObjectiveCFileOptions*) other { if (other == [ObjectiveCFileOptions defaultInstance]) { return self; } if (other.hasPackage) { [self setPackage:other.package]; } if (other.hasClassPrefix) { [self setClassPrefix:other.classPrefix]; } if (other.hasRelaxCamelCase) { [self setRelaxCamelCase:other.relaxCamelCase]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (ObjectiveCFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (ObjectiveCFileOptionsBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setPackage:[input readString]]; break; } case 18: { [self setClassPrefix:[input readString]]; break; } case 24: { [self setRelaxCamelCase:[input readBool]]; break; } } } } - (BOOL) hasPackage { return resultObjectiveCfileOptions.hasPackage; } - (NSString*) package { return resultObjectiveCfileOptions.package; } - (ObjectiveCFileOptionsBuilder*) setPackage:(NSString*) value { resultObjectiveCfileOptions.hasPackage = YES; resultObjectiveCfileOptions.package = value; return self; } - (ObjectiveCFileOptionsBuilder*) clearPackage { resultObjectiveCfileOptions.hasPackage = NO; resultObjectiveCfileOptions.package = @""; return self; } - (BOOL) hasClassPrefix { return resultObjectiveCfileOptions.hasClassPrefix; } - (NSString*) classPrefix { return resultObjectiveCfileOptions.classPrefix; } - (ObjectiveCFileOptionsBuilder*) setClassPrefix:(NSString*) value { resultObjectiveCfileOptions.hasClassPrefix = YES; resultObjectiveCfileOptions.classPrefix = value; return self; } - (ObjectiveCFileOptionsBuilder*) clearClassPrefix { resultObjectiveCfileOptions.hasClassPrefix = NO; resultObjectiveCfileOptions.classPrefix = @""; return self; } - (BOOL) hasRelaxCamelCase { return resultObjectiveCfileOptions.hasRelaxCamelCase; } - (BOOL) relaxCamelCase { return resultObjectiveCfileOptions.relaxCamelCase; } - (ObjectiveCFileOptionsBuilder*) setRelaxCamelCase:(BOOL) value { resultObjectiveCfileOptions.hasRelaxCamelCase = YES; resultObjectiveCfileOptions.relaxCamelCase = value; return self; } - (ObjectiveCFileOptionsBuilder*) clearRelaxCamelCase { resultObjectiveCfileOptions.hasRelaxCamelCase = NO; resultObjectiveCfileOptions.relaxCamelCase = NO; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/PBArray.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Author: Jon Parise #import extern NSString * const PBArrayTypeMismatchException; extern NSString * const PBArrayNumberExpectedException; extern NSString * const PBArrayAllocationFailureException; typedef enum _PBArrayValueType { PBArrayValueTypeBool, PBArrayValueTypeInt32, PBArrayValueTypeUInt32, PBArrayValueTypeInt64, PBArrayValueTypeUInt64, PBArrayValueTypeFloat, PBArrayValueTypeDouble, } PBArrayValueType; // PBArray is an immutable array class that's optimized for storing primitive // values. All values stored in an PBArray instance must have the same type // (PBArrayValueType). Object values (PBArrayValueTypeObject) are retained. @interface PBArray : NSObject { @protected PBArrayValueType _valueType; NSUInteger _capacity; NSUInteger _count; void * _data; } - (NSUInteger)count; - (BOOL)boolAtIndex:(NSUInteger)index; - (SInt32)int32AtIndex:(NSUInteger)index; - (SInt32)enumAtIndex:(NSUInteger)index; - (UInt32)uint32AtIndex:(NSUInteger)index; - (SInt64)int64AtIndex:(NSUInteger)index; - (UInt64)uint64AtIndex:(NSUInteger)index; - (Float32)floatAtIndex:(NSUInteger)index; - (Float64)doubleAtIndex:(NSUInteger)index; - (BOOL)isEqualToArray:(PBArray *)array; - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block; - (NSUInteger)indexOfObjectPassingTest:(BOOL (^)(id obj, NSUInteger idx, BOOL *stop))predicate; //This Methods automaticaly pack/unpack in NSNumber primitive values - (id)firstObject; - (id)lastObject; - (id)objectAtIndexedSubscript:(NSUInteger)idx; @property (nonatomic,assign,readonly) PBArrayValueType valueType; @property (nonatomic,assign,readonly) const void * data; @property (nonatomic,assign,readonly,getter=count) NSUInteger count; @end @interface PBArray (PBArrayExtended) - (instancetype)arrayByAppendingArray:(PBArray *)array; - (PBArray *)filteredArrayUsingPredicate:(NSPredicate *)predicate; @end @interface PBArray (PBArrayCreation) + (instancetype)arrayWithValueType:(PBArrayValueType)valueType; + (instancetype)arrayWithValues:(const void *)values count:(NSUInteger)count valueType:(PBArrayValueType)valueType; + (instancetype)arrayWithArray:(NSArray *)array valueType:(PBArrayValueType)valueType; - (instancetype)initWithValueType:(PBArrayValueType)valueType; - (instancetype)initWithValues:(const void *)values count:(NSUInteger)count valueType:(PBArrayValueType)valueType; - (instancetype)initWithArray:(NSArray *)array valueType:(PBArrayValueType)valueType; @end // PBAppendableArray extends PBArray with the ability to append new values to // the end of the array. @interface PBAppendableArray : PBArray - (void)addBool:(BOOL)value; - (void)addInt32:(SInt32)value; - (void)addUint32:(UInt32)value; - (void)addInt64:(SInt64)value; - (void)addUint64:(UInt64)value; - (void)addFloat:(Float32)value; - (void)addDouble:(Float64)value; - (void)addEnum:(SInt32)value; - (void)appendArray:(PBArray *)array; - (void)appendValues:(const void *)values count:(UInt32)count; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/PBArray.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. // // Author: Jon Parise #import "PBArray.h" NSString * const PBArrayTypeMismatchException = @"PBArrayTypeMismatchException"; NSString * const PBArrayNumberExpectedException = @"PBArrayNumberExpectedException"; NSString * const PBArrayAllocationFailureException = @"PBArrayAllocationFailureException"; #pragma mark NSNumber Setters typedef void (*PBArrayValueSetter)(NSNumber *number, void *value); static void PBArraySetBoolValue(NSNumber *number, void *value) { *((BOOL *)value) = [number charValue]; } static void PBArraySetInt32Value(NSNumber *number, void *value) { *((SInt32 *)value) = (SInt32)[number integerValue]; } static void PBArraySetUInt32Value(NSNumber *number, void *value) { *((UInt32 *)value) = (UInt32)[number unsignedIntegerValue]; } static void PBArraySetInt64Value(NSNumber *number, void *value) { *((SInt64 *)value) = (SInt64)[number longLongValue]; } static void PBArraySetUInt64Value(NSNumber *number, void *value) { *((UInt64 *)value) = (UInt64)[number unsignedLongLongValue]; } static void PBArraySetFloatValue(NSNumber *number, void *value) { *((Float32 *)value) = [number floatValue]; } static void PBArraySetDoubleValue(NSNumber *number, void *value) { *((Float64 *)value) = [number doubleValue]; } #pragma mark Array Value Types typedef struct _PBArrayValueTypeInfo { const size_t size; const PBArrayValueSetter setter; } PBArrayValueTypeInfo; static PBArrayValueTypeInfo PBValueTypes[] = { { sizeof(BOOL), PBArraySetBoolValue }, { sizeof(SInt32), PBArraySetInt32Value }, { sizeof(UInt32), PBArraySetUInt32Value }, { sizeof(SInt64), PBArraySetInt64Value }, { sizeof(UInt64), PBArraySetUInt64Value }, { sizeof(Float32), PBArraySetFloatValue }, { sizeof(Float64), PBArraySetDoubleValue }, }; #define PBArrayValueTypeSize(type) PBValueTypes[type].size #define PBArrayValueTypeSetter(type) PBValueTypes[type].setter #pragma mark Helper Macros #define PBArraySlot(index) (_data + (index * PBArrayValueTypeSize(_valueType))) #define PBArrayForEachObject(__data, __count, x) \ if (_valueType == PBArrayValueTypeObject) \ for (NSUInteger i = 0; i < __count; ++i) { id object = ((id *)__data)[i]; [object x]; } #define PBArrayValueTypeAssert(type) \ if (__builtin_expect(_valueType != type, 0)) \ [NSException raise:PBArrayTypeMismatchException \ format:@"array value type mismatch (expected '%s')", #type]; #define PBArrayValueRangeAssert(index) \ if (__builtin_expect(index >= _count, 0)) \ [NSException raise:NSRangeException format: @"index (%lu) beyond bounds (%lu)", (unsigned long)index, (unsigned long)_count]; #define PBArrayNumberAssert(value) \ if (__builtin_expect(![value isKindOfClass:[NSNumber class]], 0)) \ [NSException raise:PBArrayNumberExpectedException format:@"NSNumber expected (got '%@')", [value class]]; #define PBArrayAllocationAssert(p, size) \ if (__builtin_expect(p == NULL, 0)) \ [NSException raise:PBArrayAllocationFailureException format:@"failed to allocate %lu bytes", size]; #pragma mark - #pragma mark PBArray @implementation PBArray @synthesize valueType = _valueType; @dynamic data; - (instancetype)initWithCount:(NSUInteger)count valueType:(PBArrayValueType)valueType { if ((self = [super init])) { _valueType = valueType; _count = count; _capacity = count; if (_capacity) { _data = malloc(_capacity * PBArrayValueTypeSize(_valueType)); if (_data == NULL) { self = nil; } } } return self; } - (instancetype)copyWithZone:(NSZone *)zone { PBArray *copy = [[[self class] allocWithZone:zone] initWithCount:_count valueType:_valueType]; if (copy) { memcpy(copy->_data, _data, _count * PBArrayValueTypeSize(_valueType)); } return copy; } - (void)dealloc { if (_data) { free(_data); } } - (NSString *)description { return [NSString stringWithFormat:@"<%@ %p>{valueType = %d, count = %ld, capacity = %ld, data = %p}", [self class], self, _valueType, (long)_count, (long)_capacity, _data]; } - (NSUInteger)count { return _count; } - (const void *)data { return _data; } - (BOOL)boolAtIndex:(NSUInteger)index { PBArrayValueRangeAssert(index); PBArrayValueTypeAssert(PBArrayValueTypeBool); return ((BOOL *)_data)[index]; } - (SInt32)int32AtIndex:(NSUInteger)index { PBArrayValueRangeAssert((unsigned long)index); PBArrayValueTypeAssert(PBArrayValueTypeInt32); return ((SInt32 *)_data)[index]; } - (UInt32)uint32AtIndex:(NSUInteger)index { PBArrayValueRangeAssert((unsigned long)index); PBArrayValueTypeAssert(PBArrayValueTypeUInt32); return ((UInt32 *)_data)[index]; } - (SInt32)enumAtIndex:(NSUInteger)index { PBArrayValueRangeAssert(index); PBArrayValueTypeAssert(PBArrayValueTypeInt32); return ((SInt32 *)_data)[index]; } - (SInt64)int64AtIndex:(NSUInteger)index { PBArrayValueRangeAssert(index); PBArrayValueTypeAssert(PBArrayValueTypeInt64); return ((SInt64 *)_data)[index]; } - (UInt64)uint64AtIndex:(NSUInteger)index { PBArrayValueRangeAssert(index); PBArrayValueTypeAssert(PBArrayValueTypeUInt64); return ((UInt64 *)_data)[index]; } - (Float32)floatAtIndex:(NSUInteger)index { PBArrayValueRangeAssert(index); PBArrayValueTypeAssert(PBArrayValueTypeFloat); return ((Float32 *)_data)[index]; } - (Float64)doubleAtIndex:(NSUInteger)index { PBArrayValueRangeAssert(index); PBArrayValueTypeAssert(PBArrayValueTypeDouble); return ((Float64 *)_data)[index]; } - (BOOL)isEqualToArray:(PBArray *)array { if (self == array) { return YES; } else if (array->_count != _count) { return NO; } else { return memcmp(array->_data, _data, _count * PBArrayValueTypeSize(_valueType)) == 0; } } - (BOOL)isEqual:(id)object { BOOL equal = NO; if ([object isKindOfClass:[PBArray class]]) { equal = [self isEqualToArray:object]; } return equal; } -(id)firstObject { if (self.count>0) { return [self objectAtIndexedSubscript:0]; } return nil; } -(id)lastObject { if (self.count>0) { return [self objectAtIndexedSubscript:self.count - 1]; } return nil; } - (id)objectAtIndexedSubscript:(NSUInteger)idx { if (idx < self.count) { if (PBArrayValueTypeBool == _valueType) { return [NSNumber numberWithBool:[self boolAtIndex:idx]]; } else if (PBArrayValueTypeInt32 == _valueType) { return [NSNumber numberWithLong:[self int32AtIndex:idx]]; } else if (PBArrayValueTypeInt64 == _valueType) { return [NSNumber numberWithLongLong:[self int64AtIndex:idx]]; } else if (PBArrayValueTypeUInt32 == _valueType) { return [NSNumber numberWithUnsignedLong:[self uint32AtIndex:idx]]; } else if (PBArrayValueTypeUInt64 == _valueType) { return [NSNumber numberWithUnsignedLongLong:[self uint64AtIndex:idx]]; } else if (_valueType == PBArrayValueTypeFloat) { return [NSNumber numberWithFloat:[self floatAtIndex:idx]]; } else if (_valueType == PBArrayValueTypeDouble) { return [NSNumber numberWithDouble:[self doubleAtIndex:idx]]; } } return nil; } - (void)enumerateObjectsUsingBlock:(void (^)(id obj, NSUInteger idx, BOOL *stop))block { if (!block) return; BOOL stop = NO; for (NSInteger i = 0; i < self.count; i++) { block([self objectAtIndexedSubscript:i],i,&stop); if(stop){ break; } } } -(NSUInteger)indexOfObjectPassingTest:(BOOL (^)(id obj, NSUInteger, BOOL *stop))predicate { if (!predicate) return NSNotFound; __block BOOL bb; __block NSUInteger index; [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { bb = predicate(obj,idx,stop); if (bb) { index = idx; } }]; if (bb) { return index; } return NSNotFound; } @end @implementation PBArray (PBArrayExtended) -(PBArray *) filteredArrayUsingPredicate:(NSPredicate *)predicate { __block PBAppendableArray *newArray = [[PBAppendableArray alloc] initWithValueType:_valueType]; [self enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { BOOL result = [predicate evaluateWithObject:obj]; if (result) { if (PBArrayValueTypeBool == _valueType) { [newArray addBool:[(NSNumber *)obj boolValue]]; } else if (PBArrayValueTypeInt32 == _valueType) { [newArray addInt32:(SInt32)[(NSNumber *)obj longValue]]; } else if (PBArrayValueTypeInt64 == _valueType) { [newArray addInt64:[(NSNumber *)obj longLongValue]]; } else if (PBArrayValueTypeUInt32 == _valueType) { [newArray addUint32:(UInt32)[(NSNumber *)obj unsignedLongValue]]; } else if (PBArrayValueTypeUInt64 == _valueType) { [newArray addUint64:[(NSNumber *)obj unsignedLongLongValue]]; } else if (_valueType == PBArrayValueTypeFloat) { [newArray addFloat:[(NSNumber *)obj floatValue]]; } else if (_valueType == PBArrayValueTypeDouble) { [newArray addDouble:[(NSNumber *)obj doubleValue]]; } } }]; return newArray; } - (id)arrayByAppendingArray:(PBArray *)array { PBArrayValueTypeAssert(array.valueType); PBArray *result = [[[self class] alloc] initWithCount:_count + array.count valueType:_valueType]; if (result) { const size_t elementSize = PBArrayValueTypeSize(_valueType); const size_t originalSize = _count * elementSize; memcpy(result->_data, _data, originalSize); memcpy(result->_data + originalSize, array.data, array.count * elementSize); } return result; } @end @implementation PBArray (PBArrayCreation) + (instancetype)arrayWithValueType:(PBArrayValueType)valueType { return [[self alloc] initWithValueType:valueType]; } + (instancetype)arrayWithValues:(const void *)values count:(NSUInteger)count valueType:(PBArrayValueType)valueType { return [[self alloc] initWithValues:values count:count valueType:valueType]; } + (instancetype)arrayWithArray:(NSArray *)array valueType:(PBArrayValueType)valueType { return [[self alloc] initWithArray:array valueType:valueType]; } - (instancetype)initWithValueType:(PBArrayValueType)valueType { return [self initWithCount:0 valueType:valueType]; } - (instancetype)initWithValues:(const void *)values count:(NSUInteger)count valueType:(PBArrayValueType)valueType { if ((self = [self initWithCount:count valueType:valueType])) { memcpy(_data, values, count * PBArrayValueTypeSize(_valueType)); } return self; } - (instancetype)initWithArray:(NSArray *)array valueType:(PBArrayValueType)valueType { if ((self = [self initWithCount:[array count] valueType:valueType])) { const size_t elementSize = PBArrayValueTypeSize(valueType); size_t offset = 0; PBArrayValueSetter setter = PBArrayValueTypeSetter(valueType); for (id object in array) { PBArrayNumberAssert(object); setter((NSNumber *)object, _data + offset); offset += elementSize; } } return self; } @end #pragma mark - #pragma mark PBAppendableArray @implementation PBAppendableArray - (void)ensureAdditionalCapacity:(NSUInteger)additionalSlots { const NSUInteger requiredSlots = _count + additionalSlots; if (requiredSlots > _capacity) { // If we haven't allocated any capacity yet, simply reserve // enough capacity to cover the required number of slots. if (_capacity == 0) { _capacity = requiredSlots; } else { // Otherwise, continue to double our capacity until we // can accomodate the required number of slots. while (_capacity < requiredSlots) { _capacity *= 2; } } const size_t size = _capacity * PBArrayValueTypeSize(_valueType); _data = reallocf(_data, size); PBArrayAllocationAssert(_data, size); } } - (void)addBool:(BOOL)value { PBArrayValueTypeAssert(PBArrayValueTypeBool); [self ensureAdditionalCapacity:1]; *(BOOL *)PBArraySlot(_count) = value; _count++; } - (void)addInt32:(SInt32)value { PBArrayValueTypeAssert(PBArrayValueTypeInt32); [self ensureAdditionalCapacity:1]; *(SInt32 *)PBArraySlot(_count) = value; _count++; } - (void)addUint32:(UInt32)value { PBArrayValueTypeAssert(PBArrayValueTypeUInt32); [self ensureAdditionalCapacity:1]; *(UInt32 *)PBArraySlot(_count) = value; _count++; } - (void)addEnum:(SInt32)value { PBArrayValueTypeAssert(PBArrayValueTypeInt32); [self ensureAdditionalCapacity:1]; *(SInt32 *)PBArraySlot(_count) = value; _count++; } - (void)addInt64:(int64_t)value { PBArrayValueTypeAssert(PBArrayValueTypeInt64); [self ensureAdditionalCapacity:1]; *(SInt64 *)PBArraySlot(_count) = value; _count++; } - (void)addUint64:(uint64_t)value { PBArrayValueTypeAssert(PBArrayValueTypeUInt64); [self ensureAdditionalCapacity:1]; *(UInt64 *)PBArraySlot(_count) = value; _count++; } - (void)addFloat:(Float32)value { PBArrayValueTypeAssert(PBArrayValueTypeFloat); [self ensureAdditionalCapacity:1]; *(Float32 *)PBArraySlot(_count) = value; _count++; } - (void)addDouble:(Float64)value { PBArrayValueTypeAssert(PBArrayValueTypeDouble); [self ensureAdditionalCapacity:1]; *(Float64 *)PBArraySlot(_count) = value; _count++; } - (void)appendArray:(PBArray *)array { PBArrayValueTypeAssert(array.valueType); [self ensureAdditionalCapacity:array.count]; const size_t elementSize = PBArrayValueTypeSize(_valueType); memcpy(_data + (_count * elementSize), array.data, array.count * elementSize); _count += array.count; } - (void)appendValues:(const void *)values count:(UInt32)count { [self ensureAdditionalCapacity:count]; const size_t elementSize = PBArrayValueTypeSize(_valueType); memcpy(_data + (_count * elementSize), values, count * elementSize); _count += count; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/ProtocolBuffers.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import #import "Bootstrap.h" #import "AbstractMessage.h" #import "AbstractMessageBuilder.h" #import "CodedInputStream.h" #import "CodedOutputStream.h" #import "ConcreteExtensionField.h" #import "ExtendableMessage.h" #import "ExtendableMessageBuilder.h" #import "ExtensionField.h" #import "ExtensionRegistry.h" #import "Field.h" #import "GeneratedMessage.h" #import "GeneratedMessageBuilder.h" #import "Message.h" #import "MessageBuilder.h" #import "MutableExtensionRegistry.h" #import "MutableField.h" #import "PBArray.h" #import "UnknownFieldSet.h" #import "UnknownFieldSetBuilder.h" #import "Utilities.h" #import "WireFormat.h" #import "Descriptor.pb.h" #import "ObjectivecDescriptor.pb.h" ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/RingBuffer.h ================================================ #import @interface RingBuffer : NSObject { NSMutableData *buffer; SInt32 position; SInt32 tail; } @property (nonatomic, readonly) UInt32 freeSpace; - (instancetype)initWithData:(NSMutableData*)data; // Returns false if there is not enough free space in buffer - (BOOL)appendByte:(uint8_t)byte; // Returns number of bytes written - (SInt32)appendData:(const NSData*)value offset:(SInt32)offset length:(SInt32)length; // Returns number of bytes written - (SInt32)flushToOutputStream:(NSOutputStream*)stream; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/RingBuffer.m ================================================ #import "RingBuffer.h" @implementation RingBuffer - (instancetype)initWithData:(NSMutableData*)data { if ((self = [super init])) { buffer = data; } return self; } - (UInt32)freeSpace { return (UInt32)(position < tail ? tail - position : (buffer.length - position) + tail) - (tail ? 1 : 0); } - (BOOL)appendByte:(uint8_t)byte { if (self.freeSpace < 1) return NO; ((uint8_t*)buffer.mutableBytes)[position++] = byte; return YES; } - (SInt32)appendData:(const NSData*)value offset:(SInt32)offset length:(SInt32)length { SInt32 totalWritten = 0; const uint8_t *input = value.bytes; uint8_t *data = buffer.mutableBytes; if (position >= tail) { totalWritten = MIN((UInt32)buffer.length - position, length); memcpy(data + position, input + offset, totalWritten); position += totalWritten; if (totalWritten == length) return length; length -= totalWritten; offset += totalWritten; } UInt32 freeSpace = self.freeSpace; if (!freeSpace) return totalWritten; if (position == buffer.length) { position = 0; } // position < tail SInt32 written = MIN(freeSpace, length); memcpy(data + position, input + offset, written); position += written; totalWritten += written; return totalWritten; } - (SInt32)flushToOutputStream:(NSOutputStream*)stream { SInt32 totalWritten = 0; const uint8_t *data = buffer.bytes; if (tail > position) { SInt32 written = (SInt32)[stream write:data + tail maxLength:buffer.length - tail]; if (written <= 0) return totalWritten; totalWritten += written; tail += written; if (tail == buffer.length) { tail = 0; } } if (tail < position) { SInt32 written = (SInt32)[stream write:data + tail maxLength:position - tail]; if (written <= 0) return totalWritten; totalWritten += written; tail += written; } if (tail == position) { tail = position = 0; } if (position == buffer.length && tail > 0) { position = 0; } if (tail == buffer.length) { tail = 0; } return totalWritten; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/TextFormat.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import @interface PBTextFormat : NSObject { } + (SInt32) parseInt32:(NSString*) text; + (SInt32) parseUInt32:(NSString*) text; + (SInt64) parseInt64:(NSString*) text; + (SInt64) parseUInt64:(NSString*) text; + (NSData*) unescapeBytes:(NSString*) input; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/TextFormat.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "TextFormat.h" #import "Utilities.h" @implementation PBTextFormat BOOL allZeroes(NSString* string) { for (int i = 0; i < string.length; i++) { if ([string characterAtIndex:i] != '0') { return NO; } } return YES; } /** Is this an octal digit? */ BOOL isOctal(unichar c) { return '0' <= c && c <= '7'; } /** Is this an octal digit? */ BOOL isDecimal(unichar c) { return '0' <= c && c <= '9'; } /** Is this a hex digit? */ BOOL isHex(unichar c) { return isDecimal(c) || ('a' <= c && c <= 'f') || ('A' <= c && c <= 'F'); } + (SInt64) parseInteger:(NSString*) text isSigned:(BOOL) isSigned isLong:(BOOL) isLong { if (text.length == 0) { @throw [NSException exceptionWithName:@"NumberFormat" reason:@"Number was blank" userInfo:nil]; } if (isblank([text characterAtIndex:0])) { @throw [NSException exceptionWithName:@"NumberFormat" reason:@"Invalid character" userInfo:nil]; } if ([text hasPrefix:@"-"]) { if (!isSigned) { @throw [NSException exceptionWithName:@"NumberFormat" reason:@"Number must be positive" userInfo:nil]; } } // now call into the appropriate conversion utilities. SInt64 result; const char* in_string = text.UTF8String; char* out_string = NULL; errno = 0; if (isLong) { if (isSigned) { result = strtoll(in_string, &out_string, 0); } else { result = convertUInt64ToInt64(strtoull(in_string, &out_string, 0)); } } else { if (isSigned) { result = strtol(in_string, &out_string, 0); } else { result = convertUInt32ToInt32((SInt32)strtoul(in_string, &out_string, 0)); } } // from the man pages: // (Thus, i* tr is not `\0' but **endptr is `\0' on return, the entire // string was valid.) if (*in_string == 0 || *out_string != 0) { @throw [NSException exceptionWithName:@"NumberFormat" reason:@"IllegalNumber" userInfo:nil]; } if (errno == ERANGE) { @throw [NSException exceptionWithName:@"NumberFormat" reason:@"Number out of range" userInfo:nil]; } return result; } /** * Parse a 32-bit signed integer from the text. This function recognizes * the prefixes "0x" and "0" to signify hexidecimal and octal numbers, * respectively. */ + (SInt32) parseInt32:(NSString*) text { return (SInt32)[self parseInteger:text isSigned:YES isLong:NO]; } /** * Parse a 32-bit unsigned integer from the text. This function recognizes * the prefixes "0x" and "0" to signify hexidecimal and octal numbers, * respectively. The result is coerced to a (signed) {@code int} when returned. */ + (SInt32) parseUInt32:(NSString*) text { return (SInt32)[self parseInteger:text isSigned:NO isLong:NO]; } /** * Parse a 64-bit signed integer from the text. This function recognizes * the prefixes "0x" and "0" to signify hexidecimal and octal numbers, * respectively. */ + (SInt64) parseInt64:(NSString*) text { return [self parseInteger:text isSigned:YES isLong:YES]; } /** * Parse a 64-bit unsigned integer from the text. This function recognizes * the prefixes "0x" and "0" to signify hexidecimal and octal numbers, * respectively. The result is coerced to a (signed) {@code SInt32} when * returned. */ + (SInt64) parseUInt64:(NSString*) text { return [self parseInteger:text isSigned:NO isLong:YES]; } /** * Interpret a character as a digit (in any base up to 36) and return the * numeric value. This is like {@code Character.digit()} but we don't accept * non-ASCII digits. */ SInt32 digitValue(unichar c) { if ('0' <= c && c <= '9') { return c - '0'; } else if ('a' <= c && c <= 'z') { return c - 'a' + 10; } else { return c - 'A' + 10; } } /** * Un-escape a byte sequence as escaped using * {@link #escapeBytes(ByteString)}. Two-digit hex escapes (starting with * "\x") are also recognized. */ + (NSData*) unescapeBytes:(NSString*) input { NSMutableData* result = [NSMutableData dataWithLength:input.length]; SInt32 pos = 0; for (SInt32 i = 0; i < input.length; i++) { unichar c = [input characterAtIndex:i]; if (c == '\\') { if (i + 1 < input.length) { ++i; c = [input characterAtIndex:i]; if (isOctal(c)) { // Octal escape. SInt32 code = digitValue(c); if (i + 1 < input.length && isOctal([input characterAtIndex:(i + 1)])) { ++i; code = code * 8 + digitValue([input characterAtIndex:i]); } if (i + 1 < input.length && isOctal([input characterAtIndex:(i + 1)])) { ++i; code = code * 8 + digitValue([input characterAtIndex:i]); } ((int8_t*)result.mutableBytes)[pos++] = (int8_t)code; } else { switch (c) { case 'a' : ((int8_t*)result.mutableBytes)[pos++] = 0x07; break; case 'b' : ((int8_t*)result.mutableBytes)[pos++] = '\b'; break; case 'f' : ((int8_t*)result.mutableBytes)[pos++] = '\f'; break; case 'n' : ((int8_t*)result.mutableBytes)[pos++] = '\n'; break; case 'r' : ((int8_t*)result.mutableBytes)[pos++] = '\r'; break; case 't' : ((int8_t*)result.mutableBytes)[pos++] = '\t'; break; case 'v' : ((int8_t*)result.mutableBytes)[pos++] = 0x0b; break; case '\\': ((int8_t*)result.mutableBytes)[pos++] = '\\'; break; case '\'': ((int8_t*)result.mutableBytes)[pos++] = '\''; break; case '"' : ((int8_t*)result.mutableBytes)[pos++] = '\"'; break; case 'x': // hex escape { SInt32 code = 0; if (i + 1 < input.length && isHex([input characterAtIndex:(i + 1)])) { ++i; code = digitValue([input characterAtIndex:i]); } else { @throw [NSException exceptionWithName:@"InvalidEscape" reason:@"Invalid escape sequence: '\\x' with no digits" userInfo:nil]; } if (i + 1 < input.length && isHex([input characterAtIndex:(i + 1)])) { ++i; code = code * 16 + digitValue([input characterAtIndex:i]); } ((int8_t*)result.mutableBytes)[pos++] = (int8_t)code; break; } default: @throw [NSException exceptionWithName:@"InvalidEscape" reason:@"Invalid escape sequence" userInfo:nil]; } } } else { @throw [NSException exceptionWithName:@"InvalidEscape" reason:@"Invalid escape sequence: '\\' at end of string" userInfo:nil]; } } else { ((int8_t*)result.mutableBytes)[pos++] = (int8_t)c; } } [result setLength:pos]; return result; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/UnknownFieldSet.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import @class PBCodedOutputStream; @class PBField; @class PBUnknownFieldSetBuilder; @interface PBUnknownFieldSet : NSObject { @private NSDictionary* fields; } @property (readonly, strong) NSDictionary* fields; + (PBUnknownFieldSet*) defaultInstance; + (PBUnknownFieldSet*) setWithFields:(NSMutableDictionary*) fields; + (PBUnknownFieldSet*) parseFromData:(NSData*) data; + (PBUnknownFieldSetBuilder*) builder; + (PBUnknownFieldSetBuilder*) builderWithUnknownFields:(PBUnknownFieldSet*) other; - (void) writeAsMessageSetTo:(PBCodedOutputStream*) output; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (NSData*) data; - (SInt32) serializedSize; - (SInt32) serializedSizeAsMessageSet; - (BOOL) hasField:(SInt32) number; - (PBField*) getField:(SInt32) number; - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent; - (void) storeInDictionary: (NSMutableDictionary *) dic; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/UnknownFieldSet.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "UnknownFieldSet.h" #import "CodedInputStream.h" #import "CodedOutputStream.h" #import "Field.h" #import "UnknownFieldSetBuilder.h" @interface PBUnknownFieldSet() @property (strong) NSDictionary* fields; @end @implementation PBUnknownFieldSet static PBUnknownFieldSet* defaultInstance = nil; + (void) initialize { if (self == [PBUnknownFieldSet class]) { defaultInstance = [PBUnknownFieldSet setWithFields:[NSMutableDictionary dictionary]]; } } @synthesize fields; + (PBUnknownFieldSet*) defaultInstance { return defaultInstance; } - (instancetype) initWithFields:(NSMutableDictionary*) fields_ { if ((self = [super init])) { self.fields = fields_; } return self; } + (PBUnknownFieldSet*) setWithFields:(NSMutableDictionary*) fields { return [[PBUnknownFieldSet alloc] initWithFields:fields]; } - (BOOL) hasField:(SInt32) number { return [fields objectForKey:@(number)] != nil; } - (PBField*) getField:(SInt32) number { PBField* result = [fields objectForKey:@(number)]; return (result == nil) ? [PBField defaultInstance] : result; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { NSArray* sortedKeys = [fields.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { PBField* value = [fields objectForKey:number]; [value writeTo:(SInt32)number.integerValue output:output]; } } - (void) writeToOutputStream:(NSOutputStream*) output { PBCodedOutputStream* codedOutput = [PBCodedOutputStream streamWithOutputStream:output]; [self writeToCodedOutputStream:codedOutput]; [codedOutput flush]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString *)indent { NSArray* sortedKeys = [fields.allKeys sortedArrayUsingSelector:@selector(compare:)]; for (NSNumber* number in sortedKeys) { PBField* value = [fields objectForKey:number]; [value writeDescriptionFor:(SInt32)number.integerValue to:output withIndent:indent]; } } - (void) storeInDictionary: (NSMutableDictionary *) dic; { //TODO: Ignore unknown field sets for now :D } + (PBUnknownFieldSet*) parseFromCodedInputStream:(PBCodedInputStream*) input { return [[[PBUnknownFieldSet builder] mergeFromCodedInputStream:input] build]; } + (PBUnknownFieldSet*) parseFromData:(NSData*) data { return [[[PBUnknownFieldSet builder] mergeFromData:data] build]; } + (PBUnknownFieldSet*) parseFromInputStream:(NSInputStream*) input { return [[[PBUnknownFieldSet builder] mergeFromInputStream:input] build]; } + (PBUnknownFieldSetBuilder*) builder { return [[PBUnknownFieldSetBuilder alloc] init]; } + (PBUnknownFieldSetBuilder*) builderWithUnknownFields:(PBUnknownFieldSet*) copyFrom { return [[PBUnknownFieldSet builder] mergeUnknownFields:copyFrom]; } /** Get the number of bytes required to encode this set. */ - (SInt32) serializedSize { SInt32 result = 0; for (NSNumber* number in fields) { result += [[fields objectForKey:number] getSerializedSize:(SInt32)number.integerValue]; } return result; } /** * Serializes the set and writes it to {@code output} using * {@code MessageSet} wire format. */ - (void) writeAsMessageSetTo:(PBCodedOutputStream*) output { for (NSNumber* number in fields) { [[fields objectForKey:number] writeAsMessageSetExtensionTo:(SInt32)number.integerValue output:output]; } } /** * Get the number of bytes required to encode this set using * {@code MessageSet} wire format. */ - (SInt32) serializedSizeAsMessageSet { SInt32 result = 0; for (NSNumber* number in fields) { result += [[fields objectForKey:number] getSerializedSizeAsMessageSetExtension:(SInt32)number.integerValue]; } return result; } /** * Serializes the message to a {@code ByteString} and returns it. This is * just a trivial wrapper around {@link #writeTo(PBCodedOutputStream)}. */ - (NSData*) data { NSMutableData* data = [NSMutableData dataWithLength:self.serializedSize]; PBCodedOutputStream* output = [PBCodedOutputStream streamWithData:data]; [self writeToCodedOutputStream:output]; return data; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/UnknownFieldSetBuilder.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "MessageBuilder.h" @class PBField; @class PBMutableField; @interface PBUnknownFieldSetBuilder : NSObject { @private NSMutableDictionary* fields; // Optimization: We keep around a builder for the last field that was // modified so that we can efficiently add to it multiple times in a // row (important when parsing an unknown repeated field). SInt32 lastFieldNumber; PBMutableField* lastField; } + (PBUnknownFieldSetBuilder*) createBuilder:(PBUnknownFieldSet*) unknownFields; - (PBUnknownFieldSet*) build; - (PBUnknownFieldSetBuilder*) mergeUnknownFields:(PBUnknownFieldSet*) other; - (PBUnknownFieldSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (PBUnknownFieldSetBuilder*) mergeFromData:(NSData*) data; - (PBUnknownFieldSetBuilder*) mergeFromInputStream:(NSInputStream*) input; - (PBUnknownFieldSetBuilder*) mergeVarintField:(SInt32) number value:(SInt32) value; - (BOOL) mergeFieldFrom:(SInt32) tag input:(PBCodedInputStream*) input; - (PBUnknownFieldSetBuilder*) addField:(PBField*) field forNumber:(SInt32) number; - (PBUnknownFieldSetBuilder*) clear; - (PBUnknownFieldSetBuilder*) mergeField:(PBField*) field forNumber:(SInt32) number; @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/UnknownFieldSetBuilder.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "UnknownFieldSetBuilder.h" #import "CodedInputStream.h" #import "Field.h" #import "MutableField.h" #import "UnknownFieldSet.h" #import "WireFormat.h" @interface PBUnknownFieldSetBuilder () @property (strong) NSMutableDictionary* fields; @property SInt32 lastFieldNumber; @property (strong) PBMutableField* lastField; @end @implementation PBUnknownFieldSetBuilder @synthesize fields; @synthesize lastFieldNumber; @synthesize lastField; - (instancetype) init { if ((self = [super init])) { self.fields = [NSMutableDictionary dictionary]; } return self; } + (PBUnknownFieldSetBuilder*) createBuilder:(PBUnknownFieldSet*) unknownFields { PBUnknownFieldSetBuilder* builder = [[PBUnknownFieldSetBuilder alloc] init]; [builder mergeUnknownFields:unknownFields]; return builder; } /** * Add a field to the {@code PBUnknownFieldSet}. If a field with the same * number already exists, it is removed. */ - (PBUnknownFieldSetBuilder*) addField:(PBField*) field forNumber:(SInt32) number { if (number == 0) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"" userInfo:nil]; } if (lastField != nil && lastFieldNumber == number) { // Discard this. self.lastField = nil; lastFieldNumber = 0; } [fields setObject:field forKey:@(number)]; return self; } /** * Get a field builder for the given field number which includes any * values that already exist. */ - (PBMutableField*) getFieldBuilder:(SInt32) number { if (lastField != nil) { if (number == lastFieldNumber) { return lastField; } // Note: addField() will reset lastField and lastFieldNumber. [self addField:lastField forNumber:lastFieldNumber]; } if (number == 0) { return nil; } else { PBField* existing = [fields objectForKey:@(number)]; lastFieldNumber = number; self.lastField = [PBMutableField field]; if (existing != nil) { [lastField mergeFromField:existing]; } return lastField; } } - (PBUnknownFieldSet*) build { [self getFieldBuilder:0]; // Force lastField to be built. PBUnknownFieldSet* result; if (fields.count == 0) { result = [PBUnknownFieldSet defaultInstance]; } else { result = [PBUnknownFieldSet setWithFields:fields]; } self.fields = nil; return result; } - (PBUnknownFieldSet*) buildPartial { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } - (PBUnknownFieldSet*) clone { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } - (BOOL) isInitialized { return YES; } - (PBUnknownFieldSet*) defaultInstance { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } - (PBUnknownFieldSet*) unknownFields { return [self build]; } - (id) setUnknownFields:(PBUnknownFieldSet*) unknownFields { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } /** Check if the given field number is present in the set. */ - (BOOL) hasField:(SInt32) number { if (number == 0) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"" userInfo:nil]; } return number == lastFieldNumber || ([fields objectForKey:@(number)] != nil); } /** * Add a field to the {@code PBUnknownFieldSet}. If a field with the same * number already exists, the two are merged. */ - (PBUnknownFieldSetBuilder*) mergeField:(PBField*) field forNumber:(SInt32) number { if (number == 0) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"" userInfo:nil]; } if ([self hasField:number]) { [[self getFieldBuilder:number] mergeFromField:field]; } else { // Optimization: We could call getFieldBuilder(number).mergeFrom(field) // in this case, but that would create a copy of the PBField object. // We'd rather reuse the one passed to us, so call addField() instead. [self addField:field forNumber:number]; } return self; } - (PBUnknownFieldSetBuilder*) mergeUnknownFields:(PBUnknownFieldSet*) other { if (other != [PBUnknownFieldSet defaultInstance]) { for (NSNumber* number in other.fields) { PBField* field = [other.fields objectForKey:number]; [self mergeField:field forNumber:(SInt32)[number integerValue]]; } } return self; } - (PBUnknownFieldSetBuilder*) mergeFromData:(NSData*) data { PBCodedInputStream* input = [PBCodedInputStream streamWithData:data]; [self mergeFromCodedInputStream:input]; [input checkLastTagWas:0]; return self; } - (PBUnknownFieldSetBuilder*) mergeFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBCodedInputStream* input = [PBCodedInputStream streamWithData:data]; [self mergeFromCodedInputStream:input extensionRegistry:extensionRegistry]; [input checkLastTagWas:0]; return self; } - (PBUnknownFieldSetBuilder*) mergeFromInputStream:(NSInputStream*) input { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } - (PBUnknownFieldSetBuilder*) mergeFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } - (PBUnknownFieldSetBuilder*) mergeVarintField:(SInt32) number value:(SInt32) value { if (number == 0) { @throw [NSException exceptionWithName:@"IllegalArgument" reason:@"Zero is not a valid field number." userInfo:nil]; } [[self getFieldBuilder:number] addVarint:value]; return self; } /** * Parse a single field from {@code input} and merge it into this set. * @param tag The field's tag number, which was already parsed. * @return {@code NO} if the tag is an engroup tag. */ - (BOOL) mergeFieldFrom:(SInt32) tag input:(PBCodedInputStream*) input { SInt32 number = PBWireFormatGetTagFieldNumber(tag); switch (PBWireFormatGetTagWireType(tag)) { case PBWireFormatVarint: [[self getFieldBuilder:number] addVarint:[input readInt64]]; return YES; case PBWireFormatFixed64: [[self getFieldBuilder:number] addFixed64:[input readFixed64]]; return YES; case PBWireFormatLengthDelimited: [[self getFieldBuilder:number] addLengthDelimited:[input readData]]; return YES; case PBWireFormatStartGroup: { PBUnknownFieldSetBuilder* subBuilder = [PBUnknownFieldSet builder]; [input readUnknownGroup:number builder:subBuilder]; [[self getFieldBuilder:number] addGroup:[subBuilder build]]; return YES; } case PBWireFormatEndGroup: return NO; case PBWireFormatFixed32: [[self getFieldBuilder:number] addFixed32:[input readFixed32]]; return YES; default: @throw [NSException exceptionWithName:@"InvalidProtocolBuffer" reason:@"" userInfo:nil]; } } /** * Parse an entire message from {@code input} and merge its fields into * this set. */ - (PBUnknownFieldSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { while (YES) { SInt32 tag = [input readTag]; if (tag == 0 || ![self mergeFieldFrom:tag input:input]) { break; } } return self; } - (PBUnknownFieldSetBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { @throw [NSException exceptionWithName:@"UnsupportedMethod" reason:@"" userInfo:nil]; } - (PBUnknownFieldSetBuilder*) clear { self.fields = [NSMutableDictionary dictionary]; self.lastFieldNumber = 0; self.lastField = nil; return self; } @end ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Utilities.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "Message.h" SInt64 convertFloat64ToInt64(Float64 f); SInt32 convertFloat32ToInt32(Float32 f); Float64 convertInt64ToFloat64(SInt64 f); Float32 convertInt32ToFloat32(SInt32 f); UInt64 convertInt64ToUInt64(SInt64 i); SInt64 convertUInt64ToInt64(UInt64 u); UInt32 convertInt32ToUInt32(SInt32 i); SInt32 convertUInt32ToInt32(UInt32 u); SInt32 logicalRightShift32(SInt32 value, SInt32 spaces); SInt64 logicalRightShift64(SInt64 value, SInt32 spaces); /** * Decode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers * into values that can be efficiently encoded with varint. (Otherwise, * negative values must be sign-extended to 64 bits to be varint encoded, * thus always taking 10 bytes on the wire.) * * @param n An unsigned 32-bit integer, stored in a signed int. * @return A signed 32-bit integer. */ SInt32 decodeZigZag32(SInt32 n); /** * Decode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers * into values that can be efficiently encoded with varint. (Otherwise, * negative values must be sign-extended to 64 bits to be varint encoded, * thus always taking 10 bytes on the wire.) * * @param n An unsigned 64-bit integer, stored in a signed int. * @return A signed 64-bit integer. */ SInt64 decodeZigZag64(SInt64 n); /** * Encode a ZigZag-encoded 32-bit value. ZigZag encodes signed integers * into values that can be efficiently encoded with varint. (Otherwise, * negative values must be sign-extended to 64 bits to be varint encoded, * thus always taking 10 bytes on the wire.) * * @param n A signed 32-bit integer. * @return An unsigned 32-bit integer, stored in a signed int. */ SInt32 encodeZigZag32(SInt32 n); /** * Encode a ZigZag-encoded 64-bit value. ZigZag encodes signed integers * into values that can be efficiently encoded with varint. (Otherwise, * negative values must be sign-extended to 64 bits to be varint encoded, * thus always taking 10 bytes on the wire.) * * @param n A signed 64-bit integer. * @return An unsigned 64-bit integer, stored in a signed int. */ SInt64 encodeZigZag64(SInt64 n); /** * Compute the number of bytes that would be needed to encode a * {@code double} field, including tag. */ SInt32 computeDoubleSize(SInt32 fieldNumber, Float64 value); /** * Compute the number of bytes that would be needed to encode a * {@code float} field, including tag. */ SInt32 computeFloatSize(SInt32 fieldNumber, Float32 value); /** * Compute the number of bytes that would be needed to encode a * {@code uint64} field, including tag. */ SInt32 computeUInt64Size(SInt32 fieldNumber, SInt64 value); /** * Compute the number of bytes that would be needed to encode an * {@code int64} field, including tag. */ SInt32 computeInt64Size(SInt32 fieldNumber, SInt64 value); /** * Compute the number of bytes that would be needed to encode an * {@code int32} field, including tag. */ SInt32 computeInt32Size(SInt32 fieldNumber, SInt32 value); /** * Compute the number of bytes that would be needed to encode a * {@code fixed64} field, including tag. */ SInt32 computeFixed64Size(SInt32 fieldNumber, SInt64 value); /** * Compute the number of bytes that would be needed to encode a * {@code fixed32} field, including tag. */ SInt32 computeFixed32Size(SInt32 fieldNumber, SInt32 value); /** * Compute the number of bytes that would be needed to encode a * {@code bool} field, including tag. */ SInt32 computeBoolSize(SInt32 fieldNumber, BOOL value); /** * Compute the number of bytes that would be needed to encode a * {@code string} field, including tag. */ SInt32 computeStringSize(SInt32 fieldNumber, const NSString* value); /** * Compute the number of bytes that would be needed to encode a * {@code group} field, including tag. */ SInt32 computeGroupSize(SInt32 fieldNumber, const id value); /** * Compute the number of bytes that would be needed to encode a * {@code group} field represented by an {@code PBUnknownFieldSet}, including * tag. */ SInt32 computeUnknownGroupSize(SInt32 fieldNumber, const PBUnknownFieldSet* value); /** * Compute the number of bytes that would be needed to encode an * embedded message field, including tag. */ SInt32 computeMessageSize(SInt32 fieldNumber, const id value); /** * Compute the number of bytes that would be needed to encode a * {@code bytes} field, including tag. */ SInt32 computeDataSize(SInt32 fieldNumber, const NSData* value); /** * Compute the number of bytes that would be needed to encode a * {@code uint32} field, including tag. */ SInt32 computeUInt32Size(SInt32 fieldNumber, SInt32 value); /** * Compute the number of bytes that would be needed to encode an * {@code sfixed32} field, including tag. */ SInt32 computeSFixed32Size(SInt32 fieldNumber, SInt32 value); /** * Compute the number of bytes that would be needed to encode an * {@code sfixed64} field, including tag. */ SInt32 computeSFixed64Size(SInt32 fieldNumber, SInt64 value); /** * Compute the number of bytes that would be needed to encode an * {@code sint32} field, including tag. */ SInt32 computeSInt32Size(SInt32 fieldNumber, SInt32 value); /** * Compute the number of bytes that would be needed to encode an * {@code sint64} field, including tag. */ SInt32 computeSInt64Size(SInt32 fieldNumber, SInt64 value); /** Compute the number of bytes that would be needed to encode a tag. */ SInt32 computeTagSize(SInt32 fieldNumber); /** * Compute the number of bytes that would be needed to encode a * {@code double} field, including tag. */ SInt32 computeDoubleSizeNoTag(Float64 value); /** * Compute the number of bytes that would be needed to encode a * {@code float} field, including tag. */ SInt32 computeFloatSizeNoTag(Float32 value); /** * Compute the number of bytes that would be needed to encode a * {@code uint64} field, including tag. */ SInt32 computeUInt64SizeNoTag(SInt64 value); /** * Compute the number of bytes that would be needed to encode an * {@code int64} field, including tag. */ SInt32 computeInt64SizeNoTag(SInt64 value); /** * Compute the number of bytes that would be needed to encode an * {@code int32} field, including tag. */ SInt32 computeInt32SizeNoTag(SInt32 value); /** * Compute the number of bytes that would be needed to encode a * {@code fixed64} field, including tag. */ SInt32 computeFixed64SizeNoTag(SInt64 value); /** * Compute the number of bytes that would be needed to encode a * {@code fixed32} field, including tag. */ SInt32 computeFixed32SizeNoTag(SInt32 value); /** * Compute the number of bytes that would be needed to encode a * {@code bool} field, including tag. */ SInt32 computeBoolSizeNoTag(BOOL value); /** * Compute the number of bytes that would be needed to encode a * {@code string} field, including tag. */ SInt32 computeStringSizeNoTag(const NSString* value); /** * Compute the number of bytes that would be needed to encode a * {@code group} field, including tag. */ SInt32 computeGroupSizeNoTag(const id value); /** * Compute the number of bytes that would be needed to encode a * {@code group} field represented by an {@code PBUnknownFieldSet}, including * tag. */ SInt32 computeUnknownGroupSizeNoTag(const PBUnknownFieldSet* value); /** * Compute the number of bytes that would be needed to encode an * embedded message field, including tag. */ SInt32 computeMessageSizeNoTag(const id value); /** * Compute the number of bytes that would be needed to encode a * {@code bytes} field, including tag. */ SInt32 computeDataSizeNoTag(const NSData* value); /** * Compute the number of bytes that would be needed to encode a * {@code uint32} field, including tag. */ SInt32 computeUInt32SizeNoTag(SInt32 value); /** * Compute the number of bytes that would be needed to encode an * enum field, including tag. Caller is responsible for converting the * enum value to its numeric value. */ SInt32 computeEnumSizeNoTag(SInt32 value); /** * Compute the number of bytes that would be needed to encode an * {@code sfixed32} field, including tag. */ SInt32 computeSFixed32SizeNoTag(SInt32 value); /** * Compute the number of bytes that would be needed to encode an * {@code sfixed64} field, including tag. */ SInt32 computeSFixed64SizeNoTag(SInt64 value); /** * Compute the number of bytes that would be needed to encode an * {@code sint32} field, including tag. */ SInt32 computeSInt32SizeNoTag(SInt32 value); /** * Compute the number of bytes that would be needed to encode an * {@code sint64} field, including tag. */ SInt32 computeSInt64SizeNoTag(SInt64 value); /** * Compute the number of bytes that would be needed to encode a varint. * {@code value} is treated as unsigned, so it won't be sign-extended if * negative. */ SInt32 computeRawVarint32Size(SInt32 value); /** Compute the number of bytes that would be needed to encode a varint. */ SInt32 computeRawVarint64Size(SInt64 value); /** * Compute the number of bytes that would be needed to encode a * MessageSet extension to the stream. For historical reasons, * the wire format differs from normal fields. */ SInt32 computeMessageSetExtensionSize(SInt32 fieldNumber, const id value); /** * Compute the number of bytes that would be needed to encode an * unparsed MessageSet extension field to the stream. For * historical reasons, the wire format differs from normal fields. */ SInt32 computeRawMessageSetExtensionSize(SInt32 fieldNumber, const NSData* value); /** * Compute the number of bytes that would be needed to encode an * enum field, including tag. Caller is responsible for converting the * enum value to its numeric value. */ SInt32 computeEnumSize(SInt32 fieldNumber, SInt32 value); ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/Utilities.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "Utilities.h" #import "UnknownFieldSet.h" #import "WireFormat.h" const SInt32 LITTLE_ENDIAN_32_SIZE = 4; const SInt32 LITTLE_ENDIAN_64_SIZE = 8; SInt64 convertFloat64ToInt64(Float64 v) { union { Float64 f; SInt64 i; } u; u.f = v; return u.i; } SInt32 convertFloat32ToInt32(Float32 v) { union { Float32 f; SInt32 i; } u; u.f = v; return u.i; } Float64 convertInt64ToFloat64(SInt64 v) { union { Float64 f; SInt64 i; } u; u.i = v; return u.f; } Float32 convertInt32ToFloat32(SInt32 v) { union { Float32 f; SInt32 i; } u; u.i = v; return u.f; } UInt64 convertInt64ToUInt64(SInt64 v) { union { SInt64 i; UInt64 u; } u; u.i = v; return u.u; } SInt64 convertUInt64ToInt64(UInt64 v) { union { SInt64 i; UInt64 u; } u; u.u = v; return u.i; } UInt32 convertInt32ToUInt32(SInt32 v) { union { SInt32 i; UInt32 u; } u; u.i = v; return u.u; } SInt32 convertUInt32ToInt32(UInt32 v) { union { SInt32 i; UInt32 u; } u; u.u = v; return u.i; } SInt32 logicalRightShift32(SInt32 value, SInt32 spaces) { return convertUInt32ToInt32((convertInt32ToUInt32(value) >> spaces)); } SInt64 logicalRightShift64(SInt64 value, SInt32 spaces) { return convertUInt64ToInt64((convertInt64ToUInt64(value) >> spaces)); } SInt32 decodeZigZag32(SInt32 n) { return logicalRightShift32(n, 1) ^ -(n & 1); } SInt64 decodeZigZag64(SInt64 n) { return logicalRightShift64(n, 1) ^ -(n & 1); } SInt32 encodeZigZag32(SInt32 n) { // Note: the right-shift must be arithmetic return (n << 1) ^ (n >> 31); } SInt64 encodeZigZag64(SInt64 n) { // Note: the right-shift must be arithmetic return (n << 1) ^ (n >> 63); } SInt32 computeDoubleSizeNoTag(Float64 value) { return LITTLE_ENDIAN_64_SIZE; } SInt32 computeFloatSizeNoTag(Float32 value) { return LITTLE_ENDIAN_32_SIZE; } SInt32 computeUInt64SizeNoTag(SInt64 value) { return computeRawVarint64Size(value); } SInt32 computeInt64SizeNoTag(SInt64 value) { return computeRawVarint64Size(value); } SInt32 computeInt32SizeNoTag(SInt32 value) { if (value >= 0) { return computeRawVarint32Size(value); } else { // Must sign-extend. return 10; } } SInt32 computeFixed64SizeNoTag(SInt64 value) { return LITTLE_ENDIAN_64_SIZE; } SInt32 computeFixed32SizeNoTag(SInt32 value) { return LITTLE_ENDIAN_32_SIZE; } SInt32 computeBoolSizeNoTag(BOOL value) { return 1; } SInt32 computeStringSizeNoTag(const NSString* value) { const UInt32 length = (UInt32)[value lengthOfBytesUsingEncoding:NSUTF8StringEncoding]; return computeRawVarint32Size(length) + length; } SInt32 computeGroupSizeNoTag(const id value) { return [value serializedSize]; } SInt32 computeUnknownGroupSizeNoTag(const PBUnknownFieldSet* value) { return value.serializedSize; } SInt32 computeMessageSizeNoTag(const id value) { SInt32 size = [value serializedSize]; return computeRawVarint32Size(size) + size; } SInt32 computeDataSizeNoTag(const NSData* value) { return computeRawVarint32Size((UInt32)value.length) + (UInt32)value.length; } SInt32 computeUInt32SizeNoTag(SInt32 value) { return computeRawVarint32Size(value); } SInt32 computeEnumSizeNoTag(SInt32 value) { return computeRawVarint32Size(value); } SInt32 computeSFixed32SizeNoTag(SInt32 value) { return LITTLE_ENDIAN_32_SIZE; } SInt32 computeSFixed64SizeNoTag(SInt64 value) { return LITTLE_ENDIAN_64_SIZE; } SInt32 computeSInt32SizeNoTag(SInt32 value) { return computeRawVarint32Size(encodeZigZag32(value)); } SInt32 computeSInt64SizeNoTag(SInt64 value) { return computeRawVarint64Size(encodeZigZag64(value)); } SInt32 computeDoubleSize(SInt32 fieldNumber, Float64 value) { return computeTagSize(fieldNumber) + computeDoubleSizeNoTag(value); } SInt32 computeFloatSize(SInt32 fieldNumber, Float32 value) { return computeTagSize(fieldNumber) + computeFloatSizeNoTag(value); } SInt32 computeUInt64Size(SInt32 fieldNumber, SInt64 value) { return computeTagSize(fieldNumber) + computeUInt64SizeNoTag(value); } SInt32 computeInt64Size(SInt32 fieldNumber, SInt64 value) { return computeTagSize(fieldNumber) + computeInt64SizeNoTag(value); } SInt32 computeInt32Size(SInt32 fieldNumber, SInt32 value) { return computeTagSize(fieldNumber) + computeInt32SizeNoTag(value); } SInt32 computeFixed64Size(SInt32 fieldNumber, SInt64 value) { return computeTagSize(fieldNumber) + computeFixed64SizeNoTag(value); } SInt32 computeFixed32Size(SInt32 fieldNumber, SInt32 value) { return computeTagSize(fieldNumber) + computeFixed32SizeNoTag(value); } SInt32 computeBoolSize(SInt32 fieldNumber, BOOL value) { return computeTagSize(fieldNumber) + computeBoolSizeNoTag(value); } SInt32 computeStringSize(SInt32 fieldNumber, const NSString* value) { return computeTagSize(fieldNumber) + computeStringSizeNoTag(value); } SInt32 computeGroupSize(SInt32 fieldNumber, const id value) { return computeTagSize(fieldNumber) * 2 + computeGroupSizeNoTag(value); } SInt32 computeUnknownGroupSize(SInt32 fieldNumber, const PBUnknownFieldSet* value) { return computeTagSize(fieldNumber) * 2 + computeUnknownGroupSizeNoTag(value); } SInt32 computeMessageSize(SInt32 fieldNumber, const id value) { return computeTagSize(fieldNumber) + computeMessageSizeNoTag(value); } SInt32 computeDataSize(SInt32 fieldNumber, const NSData* value) { return computeTagSize(fieldNumber) + computeDataSizeNoTag(value); } SInt32 computeUInt32Size(SInt32 fieldNumber, SInt32 value) { return computeTagSize(fieldNumber) + computeUInt32SizeNoTag(value); } SInt32 computeEnumSize(SInt32 fieldNumber, SInt32 value) { return computeTagSize(fieldNumber) + computeEnumSizeNoTag(value); } SInt32 computeSFixed32Size(SInt32 fieldNumber, SInt32 value) { return computeTagSize(fieldNumber) + computeSFixed32SizeNoTag(value); } SInt32 computeSFixed64Size(SInt32 fieldNumber, SInt64 value) { return computeTagSize(fieldNumber) + computeSFixed64SizeNoTag(value); } SInt32 computeSInt32Size(SInt32 fieldNumber, SInt32 value) { return computeTagSize(fieldNumber) + computeSInt32SizeNoTag(value); } SInt32 computeTagSize(SInt32 fieldNumber) { return computeRawVarint32Size(PBWireFormatMakeTag(fieldNumber, 0)); } SInt32 computeSInt64Size(SInt32 fieldNumber, SInt64 value) { return computeTagSize(fieldNumber) + computeRawVarint64Size(encodeZigZag64(value)); } SInt32 computeRawVarint32Size(SInt32 value) { if ((value & (0xffffffff << 7)) == 0) return 1; if ((value & (0xffffffff << 14)) == 0) return 2; if ((value & (0xffffffff << 21)) == 0) return 3; if ((value & (0xffffffff << 28)) == 0) return 4; return 5; } SInt32 computeRawVarint64Size(SInt64 value) { if ((value & (0xffffffffffffffffL << 7)) == 0) return 1; if ((value & (0xffffffffffffffffL << 14)) == 0) return 2; if ((value & (0xffffffffffffffffL << 21)) == 0) return 3; if ((value & (0xffffffffffffffffL << 28)) == 0) return 4; if ((value & (0xffffffffffffffffL << 35)) == 0) return 5; if ((value & (0xffffffffffffffffL << 42)) == 0) return 6; if ((value & (0xffffffffffffffffL << 49)) == 0) return 7; if ((value & (0xffffffffffffffffL << 56)) == 0) return 8; if ((value & (0xffffffffffffffffL << 63)) == 0) return 9; return 10; } SInt32 computeMessageSetExtensionSize(SInt32 fieldNumber, const id value) { return computeTagSize(PBWireFormatMessageSetItem) * 2 + computeUInt32Size(PBWireFormatMessageSetTypeId, fieldNumber) + computeMessageSize(PBWireFormatMessageSetMessage, value); } SInt32 computeRawMessageSetExtensionSize(SInt32 fieldNumber, const NSData* value) { return computeTagSize(PBWireFormatMessageSetItem) * 2 + computeUInt32Size(PBWireFormatMessageSetTypeId, fieldNumber) + computeDataSize(PBWireFormatMessageSetMessage, value); } ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/WireFormat.h ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import typedef enum { PBWireFormatVarint = 0, PBWireFormatFixed64 = 1, PBWireFormatLengthDelimited = 2, PBWireFormatStartGroup = 3, PBWireFormatEndGroup = 4, PBWireFormatFixed32 = 5, PBWireFormatTagTypeBits = 3, PBWireFormatTagTypeMask = 7 /* = (1 << PBWireFormatTagTypeBits) - 1*/, PBWireFormatMessageSetItem = 1, PBWireFormatMessageSetTypeId = 2, PBWireFormatMessageSetMessage = 3 } PBWireFormat; SInt32 PBWireFormatMakeTag(SInt32 fieldNumber, SInt32 wireType); SInt32 PBWireFormatGetTagWireType(SInt32 tag); SInt32 PBWireFormatGetTagFieldNumber(SInt32 tag); #define PBWireFormatMessageSetItemTag (PBWireFormatMakeTag(PBWireFormatMessageSetItem, PBWireFormatStartGroup)) #define PBWireFormatMessageSetItemEndTag (PBWireFormatMakeTag(PBWireFormatMessageSetItem, PBWireFormatEndGroup)) #define PBWireFormatMessageSetTypeIdTag (PBWireFormatMakeTag(PBWireFormatMessageSetTypeId, PBWireFormatVarint)) #define PBWireFormatMessageSetMessageTag (PBWireFormatMakeTag(PBWireFormatMessageSetMessage, PBWireFormatLengthDelimited)) ================================================ FILE: GCDAsyncSocket/ProtobufBuffer/WireFormat.m ================================================ // Protocol Buffers for Objective C // // Copyright 2010 Booyah Inc. // Copyright 2008 Cyrus Najmabadi // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #import "WireFormat.h" #import "Utilities.h" SInt32 PBWireFormatMakeTag(SInt32 fieldNumber, SInt32 wireType) { return (fieldNumber << PBWireFormatTagTypeBits) | wireType; } SInt32 PBWireFormatGetTagWireType(SInt32 tag) { return tag & PBWireFormatTagTypeMask; } SInt32 PBWireFormatGetTagFieldNumber(SInt32 tag) { return logicalRightShift32(tag, PBWireFormatTagTypeBits); } ================================================ FILE: GCDAsyncSocket/ServerURLModel.h ================================================ // // ServerURLModel.h // GCDAsyncSocket // // Created by caokun on 16/7/8. // Copyright © 2016年 caokun. All rights reserved. // #import // 服务器地址类 @interface ServerURLModel : NSObject @property (strong, nonatomic) NSString *hostName; @property (strong, nonatomic) NSString *ip; @property (strong, nonatomic) NSString *port; @property (assign, nonatomic) UInt32 loadFactor; // 负载因子 @property (assign, nonatomic) UInt32 connectCount; // 连接数 @property (assign, nonatomic) UInt32 delay; // 延迟 - (instancetype)init; - (instancetype)initWithDictionary:(NSDictionary *)dic; @end ================================================ FILE: GCDAsyncSocket/ServerURLModel.m ================================================ // // ServerURLModel.m // GCDAsyncSocket // // Created by caokun on 16/7/8. // Copyright © 2016年 caokun. All rights reserved. // #import "ServerURLModel.h" @implementation ServerURLModel - (instancetype)init { if (self = [super init]) { self.hostName = nil; self.ip = nil; self.port = nil; self.loadFactor = 10000000; self.delay = 10000000; self.connectCount = 10000000; } return self; } - (instancetype)initWithDictionary:(NSDictionary *)dic { if (self = [super init]) { if (dic) { self.hostName = dic[@"hostName"]; self.ip = dic[@"ip"]; self.port = dic[@"port"]; self.loadFactor = 10000000; self.delay = 10000000; self.connectCount = 10000000; } } return self; } // encode 到 aCoder 中 - (void)encodeWithCoder:(NSCoder *)aCoder { [aCoder encodeObject:self.hostName forKey:@"hostName"]; [aCoder encodeObject:self.ip forKey:@"ip"]; [aCoder encodeObject:self.port forKey:@"port"]; } // 从 aDecoder 还原到类中 - (id)initWithCoder:(NSCoder *)aDecoder { if (self = [super init]) { self.hostName = [aDecoder decodeObjectForKey:@"hostName"]; self.ip = [aDecoder decodeObjectForKey:@"ip"]; self.port = [aDecoder decodeObjectForKey:@"port"]; } return self; } @end ================================================ FILE: GCDAsyncSocket/SocketManager.h ================================================ // // SocketManager.h // GCDAsyncSocket使用 // // Created by caokun on 16/7/1. // Copyright © 2016年 caokun. All rights reserved. // #import #import "GCDAsyncSocket.h" @protocol SocketManagerDelegate - (void)socket:(GCDAsyncSocket *)socket didReadData:(NSData *)data; - (void)socket:(GCDAsyncSocket *)socket didConnect:(NSString *)host port:(uint16_t)port; - (void)socketDidDisconnect:(GCDAsyncSocket *)socket; @end // socket 连接管理类 @interface SocketManager : NSObject @property (assign, nonatomic) BOOL isAutomatic; // 默认使用负载均衡 @property (weak, nonatomic) id delegate; + (SocketManager *)instance; // 可以使用单例,也可以 alloc 一个新的临时用 - (void)connectAutomatic:(void (^)())completion; // 负载均衡寻找服务器 - (void)connectWithIp:(NSString *)ip port:(UInt16)port; // 手动连接服务器 - (void)disConnect; - (void)send:(NSData *)data; - (BOOL)status; @end ================================================ FILE: GCDAsyncSocket/SocketManager.m ================================================ // // SocketManager.m // GCDAsyncSocket使用 // // Created by caokun on 16/7/1. // Copyright © 2016年 caokun. All rights reserved. // #import "SocketManager.h" #import "SpeedDectectManager.h" typedef void (^completionBlock)(); @interface SocketManager () @property (strong, nonatomic) GCDAsyncSocket *socket; @property (strong, nonatomic) dispatch_queue_t socketQueue; // 发数据的串行队列 @property (strong, nonatomic) dispatch_queue_t receiveQueue; // 收数据处理的串行队列 @property (strong, nonatomic) NSString *ip; @property (assign, nonatomic) UInt16 port; @property (assign, nonatomic) BOOL isConnecting; @property (strong, nonatomic) completionBlock completion; // 负载均衡结果回调 @end @implementation SocketManager static SocketManager *instance = nil; static NSTimeInterval TimeOut = -1; // 超时时间, 超时会关闭 socket + (SocketManager *)instance { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [[SocketManager alloc] init]; }); return instance; } - (instancetype)init { if (self = [super init]) { self.isAutomatic = true; self.isConnecting = false; [self resetSocket]; } return self; } - (dispatch_queue_t)socketQueue { if (_socketQueue == nil) { _socketQueue = dispatch_queue_create("com.sendSocket", DISPATCH_QUEUE_SERIAL); } return _socketQueue; } - (dispatch_queue_t)receiveQueue { if (_receiveQueue == nil) { _receiveQueue = dispatch_queue_create("com.receiveSocket", DISPATCH_QUEUE_SERIAL); } return _receiveQueue; } - (void)resetSocket { [self disConnect]; self.socket = [[GCDAsyncSocket alloc] initWithDelegate:self delegateQueue:self.socketQueue]; self.socket.IPv6Enabled = true; self.socket.IPv4Enabled = true; self.socket.IPv4PreferredOverIPv6 = false; // 4 优先 } // 负载均衡寻找服务器 - (void)connectAutomatic:(void (^)())completion { __weak typeof(self) ws = self; dispatch_async(self.socketQueue, ^{ ws.isAutomatic = true; [[SpeedDectectManager instance] startDectect:^(ServerURLModel *response, NSString *error) { ws.completion = completion; dispatch_async(self.socketQueue, ^{ if (response != nil) { NSLog(@"找到最快的服务器"); ws.isConnecting = true; ws.ip = response.ip; ws.port = (UInt16)[response.port intValue]; [ws connectWithIp:response.ip port:(UInt16)[response.port intValue]]; } }); }]; }); } - (void)connectWithIp:(NSString *)ip port:(UInt16)port { self.ip = ip; self.port = port; [self resetSocket]; NSError *error = nil; [self.socket connectToHost:self.ip onPort:self.port withTimeout:10 error:&error]; // 填写 地址,端口进行连接 if (error != nil) { NSLog(@"连接错误:%@", error); } } - (void)disConnect { [self.socket disconnect]; self.socket = nil; self.socketQueue = nil; } - (void)send:(NSData *)data { NSLog(@"socket send 发送数据"); // socket 的操作要在 self.socketQueue(socket 的代理队列)中才有效,不允许其他线程来设置本 socket dispatch_async(self.socketQueue, ^{ if (self.socket == nil || self.socket.isDisconnected) { if (self.isAutomatic) { // 自动重连 + 启用负载均衡 NSLog(@"启用负载均衡"); __weak typeof(self) ws = self; [self connectAutomatic:^{ NSLog(@"启用了负载均衡"); if (ws.socket != nil && ws.socket.isConnected) { NSLog(@"发送了数据"); [ws.socket readDataWithTimeout:TimeOut tag:100]; [ws.socket writeData:data withTimeout:TimeOut tag:100]; } else { NSLog(@"未发送数据"); } }]; return ; } else { NSLog(@"不启用负载均衡"); [self connectWithIp:self.ip port:self.port]; // 不启用负载 } } [self.socket readDataWithTimeout:TimeOut tag:100]; // 每次都要设置接收数据的时间, tag [self.socket writeData:data withTimeout:TimeOut tag:100]; // 再发送 }); } - (BOOL)status { if (self.socket != nil && self.socket.isConnected) { return true; } return false; } // 代理方法 - (void)socket:(GCDAsyncSocket *)sock didConnectToHost:(NSString *)host port:(uint16_t)port { NSLog(@"连接成功:%@, %d", host, port); dispatch_async(self.receiveQueue, ^{ if (self.delegate && [self.delegate respondsToSelector:@selector(socket:didConnect:port:)]) { [self.delegate socket:sock didConnect:host port:port]; } if (_isConnecting == true) { _isConnecting = false; if (self.completion) { self.completion(); self.completion = nil; } } }); } - (void)socketDidDisconnect:(GCDAsyncSocket *)sock withError:(NSError *)err { NSLog(@"断开连接socketDidDisconnect"); dispatch_async(self.receiveQueue, ^{ if (self.delegate && [self.delegate respondsToSelector:@selector(socketDidDisconnect:)]) { [self.delegate socketDidDisconnect:sock]; } self.socket = nil; self.socketQueue = nil; }); } - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag { dispatch_async(self.receiveQueue, ^{ // 防止 didReadData 被阻塞,用个其他队列里的线程去回调 block if (self.delegate && [self.delegate respondsToSelector:@selector(socket:didReadData:)]) { [self.delegate socket:sock didReadData:data]; } }); [self.socket readDataWithTimeout:TimeOut tag:100]; // 设置下次接收数据的时间, tag } @end ================================================ FILE: GCDAsyncSocket/SpeedDectectManager.h ================================================ // // SpeedDectectManager.h // GCDAsyncSocket // // Created by caokun on 16/7/8. // Copyright © 2016年 caokun. All rights reserved. // #import #import "ServerURLModel.h" typedef void (^serverURL)(ServerURLModel *response, NSString *error); typedef void (^serverURLs)(NSArray *response, NSString *error); // 测速服务类,客户端负载均衡 @interface SpeedDectectManager : NSObject + (SpeedDectectManager *)instance; - (void)startDectect:(serverURL)complete; // 寻找最快的服务器,默认缓存 300 秒 - (void)requestServiceListsWithCache:(serverURLs)complete; // 获取服务器列表,默认缓存1天 @end ================================================ FILE: GCDAsyncSocket/SpeedDectectManager.m ================================================ // // SpeedDectectManager.m // GCDAsyncSocket // // Created by caokun on 16/7/8. // Copyright © 2016年 caokun. All rights reserved. // #import "SpeedDectectManager.h" #import "AFNetworking/AFNetworking.h" #import "Common.pb.h" #import "GCDAsyncSocket.h" #define ServiceListsCacheKey @"ServiceListsCacheKey" // 服务器列表缓存 key #define ServiceListsStampKey @"ServiceListsStampKey" // 时间戳 #define FasterServiceCacheKey @"FasterServiceCacheKey" // 最快的服务器地址 key #define FasterServiceStampKey @"FasterServiceStampKey" // 时间戳 @interface SpeedDectectManager () @property (strong, nonatomic) NSMutableArray *socketArray; @property (strong, nonatomic) dispatch_queue_t socketQueue; @property (assign, nonatomic) UInt32 seq; @property (strong, nonatomic) NSArray *serverModels; @property (assign, nonatomic) NSInteger receiveCount; // 返回的测速包个数 @property (strong, nonatomic) serverURL completion; // 回调 block @property (strong, nonatomic) NSTimer *timer; // 超时定时器 @end @implementation SpeedDectectManager static SpeedDectectManager *instance = nil; + (SpeedDectectManager *)instance { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [[SpeedDectectManager alloc] init]; }); return instance; } - (instancetype)init { if (self = [super init]) { self.seq = 1000; } return self; } - (dispatch_queue_t)socketQueue { if (_socketQueue == nil) { _socketQueue = dispatch_queue_create("com.speedSocket", DISPATCH_QUEUE_CONCURRENT); } return _socketQueue; } - (UInt32)seq { _seq = _seq + 1; return _seq; } - (NSMutableArray *)socketArray { if (_socketArray == nil) { _socketArray = [[NSMutableArray alloc] init]; } return _socketArray; } // 开始测试服务器连接速度 - (void)startDectect:(serverURL)complete { NSData *obj = [[NSUserDefaults standardUserDefaults] objectForKey:FasterServiceCacheKey]; NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:FasterServiceStampKey]; NSDate *curDate = [NSDate dateWithTimeIntervalSinceNow:0]; NSTimeInterval seconds = 10000; // 相差的秒数 if (date != nil && curDate != nil) { seconds = ABS([date timeIntervalSinceDate:curDate]); } // 判断是否在 300 秒内, 使用缓存 if (obj != nil || date != nil || seconds < 300) { ServerURLModel *m = [NSKeyedUnarchiver unarchiveObjectWithData:obj]; complete(m, nil); return ; } // 超时不使用缓存 __weak typeof(self) ws = self; self.receiveCount = 0; self.completion = complete; // 获取服务器列表有缓存 [ws requestServiceListsWithCache:^(NSArray *response, NSString *error) { ws.serverModels = response; // 测试连接,由于后台漏掉 seq 字段,此处用 SocketManager 来区分返回的包,创建多个线程,每个线程一个 socket 异步请求 for (ServerURLModel *m in response) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ // 该段代码在不同的线程 GCDAsyncSocket *socket = [[GCDAsyncSocket alloc] initWithDelegate:ws delegateQueue:ws.socketQueue]; socket.IPv6Enabled = true; socket.IPv4Enabled = true; socket.IPv4PreferredOverIPv6 = false; NSError *error = nil; [socket connectToHost:m.ip onPort:(UInt16)[m.port intValue] withTimeout:10 error:&error]; if (error == nil) { [socket readDataWithTimeout:10 tag:100]; [socket writeData:[ws speedTest] withTimeout:10 tag:100]; // 发送测速包 } [ws.socketArray addObject:socket]; // 保证 socket 不 ARC 释放,导致断开 }); } // 测速包 4 秒超时 [self closeTimer]; __weak typeof(self) ws = self; dispatch_async(dispatch_get_main_queue(), ^{ ws.timer = [NSTimer scheduledTimerWithTimeInterval:4 target:ws selector:@selector(timeOut:) userInfo:nil repeats:false]; }); }]; } // 生成测速包 - (NSData *)speedTest { load_dector_msgBuilder *msg = [load_dector_msg builder]; [msg setReq:true]; [msg setSendTime:CACurrentMediaTime() * 1000]; // 时间戳 rpc_msg_rootBuilder *rootMsg = [rpc_msg_root builder]; [rootMsg setService:eum_rpc_serviceCommonService]; [rootMsg setMethod:eum_method_typeLoadDetector]; [rootMsg setBody:[[msg build] data]]; UInt32 s = self.seq; [rootMsg setSeq:s]; rpc_msg_root *root = [rootMsg build]; SInt32 length = [root serializedSize]; // 包头是 32 位的整型,表示包体长度 NSMutableData *data = [NSMutableData dataWithBytes:&length length:4]; [data appendData:[root data]]; // 追加包体 return data; } // socket 接收数据 - (void)socket:(GCDAsyncSocket *)sock didReadData:(NSData *)data withTag:(long)tag { // 此处有个风险,需保证测速包是一次性返回的,由于测速包是 17 个字节比较小,可以一次返回 if (data.length >= 4) { NSData *rootData = [data subdataWithRange:NSMakeRange(4, data.length - 4)]; rpc_msg_root *root = [rpc_msg_root parseFromData:rootData]; load_dector_msg *speed = [load_dector_msg parseFromData:root.body]; for (ServerURLModel *m in self.serverModels) { if ([m.ip isEqualToString:sock.connectedHost] && (uint16_t)[m.port intValue] == sock.connectedPort) { m.loadFactor = speed.loadFactor; m.connectCount = speed.connectCount; m.delay = CACurrentMediaTime() * 1000 - speed.sendTime; self.receiveCount += 1; break; } } // 测速包全部返回,计算最快服务器 if (self.receiveCount == self.serverModels.count) { [self calculate:self.serverModels]; [self closeTimer]; [self.socketArray removeAllObjects]; // 清空 socket 连接 return ; } } } - (void)closeTimer { __weak typeof(self) ws = self; dispatch_async(dispatch_get_main_queue(), ^{ if (ws.timer) { [ws.timer invalidate]; ws.timer = nil; } }); } - (void)timeOut:(NSTimer *)timer { [self calculate:self.serverModels]; [self closeTimer]; [self.socketArray removeAllObjects]; // 清空 socket 连接 } // 负载因子不超过平均数的10%,且延迟最小的服务器 - (void)calculate:(NSArray *)array { // 按延迟排序 NSArray *sorted = [array sortedArrayUsingComparator:^NSComparisonResult(id _Nonnull obj1, id _Nonnull obj2) { ServerURLModel *m1 = obj1; ServerURLModel *m2 = obj2; if (m1.delay > m2.delay) { return NSOrderedDescending; } else { return NSOrderedAscending; } }]; // 去掉超时的包 NSMutableArray *valuableArray = [[NSMutableArray alloc] init]; for (ServerURLModel *m in sorted) { if (m.loadFactor < 10000000) { // 超过 10000000 是超时的 [valuableArray addObject:m]; } } if (valuableArray.count == 0) { dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ self.completion(nil, @"no servers"); }); return ; } // 计算平均数, 找出不超过平均数 10% 的返回 CGFloat sum = 0; CGFloat ave = 0; for (ServerURLModel *m in valuableArray) { sum += m.loadFactor; } ave = sum / valuableArray.count * 1.1; for (ServerURLModel *m in valuableArray) { if (m.loadFactor < ave) { // 本地缓存 NSData *data = [NSKeyedArchiver archivedDataWithRootObject:m]; [[NSUserDefaults standardUserDefaults] setObject:data forKey:FasterServiceCacheKey]; [[NSUserDefaults standardUserDefaults] setObject:[NSDate dateWithTimeIntervalSinceNow:0] forKey:FasterServiceStampKey]; dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ NSLog(@"使用 %@", m.ip); self.completion(m, nil); // 返回最快的服务器 }); break; } } } // 获取服务器列表并缓存一天 - (void)requestServiceListsWithCache:(serverURLs)complete { NSData *obj = [[NSUserDefaults standardUserDefaults] objectForKey:ServiceListsCacheKey]; NSDate *date = [[NSUserDefaults standardUserDefaults] objectForKey:ServiceListsStampKey]; NSDate *curDate = [NSDate dateWithTimeIntervalSinceNow:0]; NSTimeInterval seconds = 24 * 3600; // 相差的秒数 if (date != nil && curDate != nil) { seconds = ABS([date timeIntervalSinceDate:curDate]); } // 判断是否超过一天 if (obj == nil || date == nil || seconds > 24 * 3600) { [self requestServiceLists:^(NSArray *response, NSString *error) { // 本地缓存 + 时间戳 NSData *data = [NSKeyedArchiver archivedDataWithRootObject:response]; [[NSUserDefaults standardUserDefaults] setObject:data forKey:ServiceListsCacheKey]; [[NSUserDefaults standardUserDefaults] setObject:[NSDate dateWithTimeIntervalSinceNow:0] forKey:ServiceListsStampKey]; complete(response, nil); }]; } else { // 读取缓存 NSArray *array = [NSKeyedUnarchiver unarchiveObjectWithData:obj]; complete(array, nil); } } // 获取服务器列表 // 用户名跟密码由于是公司的账号,还有一些公司内部的域名,不敢随便公布了 - (void)requestServiceLists:(serverURLs)complete { // 默认服务器列表 ServerURLModel *defaultModel = [[ServerURLModel alloc] init]; defaultModel.ip = @"127.0.0.1"; defaultModel.port = @"1234"; // 发起请求 AFHTTPSessionManager *manager = [[AFHTTPSessionManager alloc] initWithBaseURL:[[NSURL alloc] initWithString:@"https://www.baidu.com/"]]; manager.responseSerializer = [AFHTTPResponseSerializer serializer]; manager.responseSerializer.acceptableContentTypes = [NSSet setWithObject:@"text/html"]; NSDictionary *params = @{@"userName":@"用户名", @"service":@"T", @"api":@"sf"}; // get 请求 [manager GET:@"" parameters:params progress:nil success:^(NSURLSessionDataTask * _Nonnull task, id _Nullable responseObject) { // jsonString -> jsonData -> NSDictionary -> model NSString *jsonString = [[NSString alloc] initWithData:responseObject encoding:NSUTF8StringEncoding]; NSData *jsonData = [jsonString dataUsingEncoding:NSUTF8StringEncoding]; NSError *error = nil; NSDictionary *dic = [NSJSONSerialization JSONObjectWithData:jsonData options:NSJSONReadingMutableContainers error:&error]; if (error) { NSLog(@"json 解析失败"); complete(@[defaultModel], nil); } else { NSArray *responses = dic[@"response"]; NSMutableArray *array = [[NSMutableArray alloc] init]; for (NSDictionary *d in responses) { ServerURLModel *m = [[ServerURLModel alloc] initWithDictionary:d]; [array addObject:m]; } complete(array, nil); } } failure:^(NSURLSessionDataTask * _Nullable task, NSError * _Nonnull error) { NSLog(@"获取服务器列表失败"); complete(@[defaultModel], nil); }]; } @end ================================================ FILE: GCDAsyncSocket/TCPAPI.h ================================================ // // TCPAPI.h // GCDAsyncSocket使用 // // Created by caokun on 16/7/2. // Copyright © 2016年 caokun. All rights reserved. // #import typedef void (^TCPBlock)(id response, NSString *error); // TCP 请求接口类 @interface TCPAPI : NSObject + (TCPAPI *)instance; // 登录请求,网络恢复调用该接口实现自动登录,被踢,用户主动退出登录,不能自动登录 - (void)requestLogin:(NSString *)name password:(NSString *)psw completion:(TCPBlock)block; // 发送单个心跳包 - (void)sendHeart; // 开启心跳,登录时开启即可,其他情况自动开启或关闭 - (void)startHeartBeat; // 关闭心跳,退出时关闭,关闭后不会自动开启 - (void)closeHeartBeat; // 请求股票排行版数据 - (void)requestBlockWithcompletion:(TCPBlock)block; // 模拟收到踢人包 - (void)receiveKick; @end ================================================ FILE: GCDAsyncSocket/TCPAPI.m ================================================ // // TCPAPI.m // GCDAsyncSocket使用 // // Created by caokun on 16/7/2. // Copyright © 2016年 caokun. All rights reserved. // #import "TCPAPI.h" #import "Auth.pb.h" #import "Common.pb.h" #import "Report.pb.h" #import "SocketManager.h" #import "NetWorkManager.h" @interface TCPAPI () @property (strong, nonatomic) dispatch_queue_t APIQueue; @property (strong, nonatomic) dispatch_semaphore_t semaphore; // seq 同步信号 @property (strong, nonatomic) dispatch_semaphore_t loginSem; // 重登录同步信号 @property (assign, nonatomic) UInt32 seq; @property (strong, nonatomic) NSMutableDictionary *callbackBlock; // 保存请求回调 {seq: block}, 超时要踢掉 @property (strong, nonatomic) NSLock *dictionaryLock; @property (strong, nonatomic) NSMutableData *buffer; // 接收缓冲区 @property (strong, nonatomic) NSTimer *heartTimer; // 心跳 timer @property (assign, nonatomic) BOOL shouldHeart; // 是否要心跳 @property (assign, nonatomic) BOOL netWorkStatus; // 网络联通性 @property (assign, nonatomic) BOOL loginStatus; // 登录状态, 退出,被踢, socket断开,要设为 false @property (assign, nonatomic) BOOL autoLogin; // 自动登录,收到踢人包, 主动退出置为 false, 登录时 true @end @implementation TCPAPI static TCPAPI *instance = nil; + (TCPAPI *)instance { static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ instance = [[TCPAPI alloc] init]; }); return instance; } - (instancetype)init { if (self = [super init]) { [[NetWorkManager instance] startListen]; // 程序启动要开启网络状态监听 [SocketManager instance].delegate = self; // 创建 socket self.semaphore = dispatch_semaphore_create(1); self.APIQueue = dispatch_queue_create("com.api", DISPATCH_QUEUE_SERIAL); self.seq = 1000; self.dictionaryLock = [[NSLock alloc] init]; self.callbackBlock = [[NSMutableDictionary alloc] init]; self.buffer = [[NSMutableData alloc] init]; [self.buffer setLength:0]; self.netWorkStatus = true; // 首次运行认为有网络,因为 NetWorkManager 启动要时间,假如没网会超时返回 self.loginStatus = false; self.autoLogin = true; self.shouldHeart = true; // 默认开启心跳,应该要获取登录状态判断要不要心跳 if (self.shouldHeart) { [self startHeartBeat]; } else { [self closeHeartBeat]; } [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(netWorkStatusChanged:) name:NetWorkDidChangeNotification object:nil]; } return self; } - (void)dealloc { [[NSNotificationCenter defaultCenter] removeObserver:self]; self.semaphore = nil; self.APIQueue = nil; self.buffer = nil; } - (UInt32)seq { dispatch_semaphore_wait(self.semaphore, DISPATCH_TIME_FOREVER); _seq = _seq + 1; dispatch_semaphore_signal(self.semaphore); return _seq; } // ----------- tcp 打包,并发送, callback 回调 block ------------ - (void)send:(rpc_msg_rootBuilder *)rootMsg seq:(UInt32)s callback:(TCPBlock)block { // 无网络直接返回 if (self.netWorkStatus == false) { if (block) block(nil, @"无网络"); return ; } if (self.loginStatus == false && self.autoLogin == false) { if (block) block(nil, @"被踢不能自动登录"); return ; } // 如果不是登录包,不是心跳包, 并且没登录,可以自动登录,先自动登录,登录失败返回错误 if ((self.loginStatus == false || [[SocketManager instance] status] == false) && self.autoLogin == true && rootMsg != nil && rootMsg.service != eum_rpc_serviceCommonService && rootMsg.method != eum_method_typeClientLogin) { NSLog(@"进入自动登录"); self.loginSem = dispatch_semaphore_create(0); NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; NSString *name = [ud objectForKey:@"UserName"]; NSString *psw = [ud objectForKey:@"Password"]; if (name && psw) { [[SocketManager instance] disConnect]; // 再次断开 socket,保证没登录 [self createLoginAndSend:name password:psw completion:^(id response, NSString *error) { NSLog(@"自动登录返回"); self.loginStatus = error == nil ? true : false; self.autoLogin = self.loginStatus; // 重登录不解析 response,都是一样的 dispatch_semaphore_signal(self.loginSem); }]; } else { self.loginStatus = false; self.autoLogin = false; dispatch_semaphore_signal(self.loginSem); } // 等待重登录信号 NSLog(@"等待重登录信号"); dispatch_semaphore_wait(self.loginSem, DISPATCH_TIME_FOREVER); NSLog(@"通过重登录信号"); if (self.loginStatus == false) { if (block) block(nil, @"自动登录失败, 请重新登录"); // 收到自动登录失败的,应该弹框重登录 return ; } else { NSLog(@"自动登录成功"); } } // 打包 if (rootMsg == nil) { // 心跳包没 body SInt32 length = 0; NSMutableData *data = [NSMutableData dataWithBytes:&length length:4]; [[SocketManager instance] send:data]; return ; } rpc_msg_root *root = [rootMsg build]; // 包头是 32 位的整型,表示包体长度 SInt32 length = [root serializedSize]; NSMutableData *data = [NSMutableData dataWithBytes:&length length:4]; [data appendData:[root data]]; // 追加包体 if (block != nil) { // 保存回调 block 到字典里,接收时候用到 NSString *key = [NSString stringWithFormat:@"%u", s]; [_dictionaryLock lock]; [_callbackBlock setObject:block forKey:key]; [_dictionaryLock unlock]; // 5 秒超时, 找到 key 删除 dispatch_after(dispatch_time(DISPATCH_TIME_NOW, 5 * NSEC_PER_SEC), dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{ [self timerRemove:key]; }); } NSLog(@"通知 socket 发送数据"); [[SocketManager instance] send:data]; // 发送 } - (void)timerRemove:(NSString *)key { if (key) { [_dictionaryLock lock]; TCPBlock complete = [self.callbackBlock objectForKey:key]; if (complete != nil) { complete(nil, @"null"); } [_callbackBlock removeObjectForKey:key]; [_dictionaryLock unlock]; } } // ----------- tcp 拆包 ------------ // 上层调用者,同步队列回调该函数,所以不用加锁 - (void)socket:(GCDAsyncSocket *)socket didReadData:(NSData *)data { [_buffer appendData:data]; while (_buffer.length >= 4) { SInt32 length = 0; [_buffer getBytes:&length length:4]; // 读取长度 if (length == 0) { if (_buffer.length >= 4) { // 长度够不够心跳包 NSData *tmp = [_buffer subdataWithRange:NSMakeRange(4, _buffer.length - 4)]; [_buffer setLength:0]; // 清零 [_buffer appendData:tmp]; } else { [_buffer setLength:0]; } [self receive:nil]; // 分发数据包 } else { NSUInteger packageLength = 4 + length; if (packageLength <= _buffer.length) { // 长度判断 NSData *rootData = [_buffer subdataWithRange:NSMakeRange(4, length)]; rpc_msg_root *root = [rpc_msg_root parseFromData:rootData]; // 截取 NSData *tmp = [_buffer subdataWithRange:NSMakeRange(packageLength, _buffer.length - packageLength)]; [_buffer setLength:0]; // 清零 [_buffer appendData:tmp]; [self receive:root]; // 分发包 } else { break; } } } } // 收到包进行分发 - (void)receive:(rpc_msg_root *)root { if (root == nil) { NSLog(@"收到心跳包"); return ; } NSString *key = [NSString stringWithFormat:@"%u", root.seq]; [_dictionaryLock lock]; id obj = [self.callbackBlock objectForKey:key]; [self.callbackBlock removeObjectForKey:key]; [_dictionaryLock unlock]; TCPBlock complete = nil; if (obj != nil) { complete = (TCPBlock)obj; } if (complete == nil) { NSLog(@"被动接收的包/超时返回的包"); } else { NSLog(@"主动请求的包"); switch (root.method) { case eum_method_typeClientLoginRet: [self receiveLogin:root completion:complete]; break; case eum_method_typeReportBoardreportResult: [self receiveBlock:root completion:complete]; break; default: NSLog(@"收到未知包 %d", (int)root.method); break; } } } // 网络状态变化 - (void)netWorkStatusChanged:(NSNotification *)nofiy { dispatch_async(self.APIQueue, ^{ NSDictionary *info = nofiy.userInfo; if (info && info[@"status"]) { NSNumber *status = info[@"status"]; self.netWorkStatus = [status boolValue]; if (self.netWorkStatus) { [self tryOpenTimer]; } else { [self closeTimer]; // 网络断开,清空发送回调队列,登录状态为 false self.loginStatus = false; [self cleanSendQueue]; } } }); } // socket 状态变化 - (void)socket:(GCDAsyncSocket *)socket didConnect:(NSString *)host port:(uint16_t)port { [self tryOpenTimer]; } - (void)socketDidDisconnect:(GCDAsyncSocket *)socket { self.loginStatus = false; [self closeTimer]; [self.buffer setLength:0]; } // 清空发送队列 - (void)cleanSendQueue { [_dictionaryLock lock]; NSLog(@"清空发送队列"); for (NSString *key in self.callbackBlock) { TCPBlock complete = [self.callbackBlock objectForKey:key]; if (complete != nil) { complete(nil, @"null"); } } [self.callbackBlock removeAllObjects]; [_dictionaryLock unlock]; } // 开启心跳 - (void)startHeartBeat { self.shouldHeart = true; [self tryOpenTimer]; } // 关闭心跳 - (void)closeHeartBeat { self.shouldHeart = false; [self closeTimer]; } - (void)tryOpenTimer { // 有网,tcp登录了,并且调用层要打开心跳时,才开启心跳 if (self.netWorkStatus && [[SocketManager instance] status] && self.shouldHeart) { [self sendHeart]; [self closeTimer]; // timer 要在主线程中开启才有效 dispatch_async(dispatch_get_main_queue(), ^{ self.heartTimer = [NSTimer scheduledTimerWithTimeInterval:5 target:self selector:@selector(sendHeart) userInfo:nil repeats:true]; }); } } - (void)closeTimer { if (self.heartTimer != nil) { [self.heartTimer invalidate]; self.heartTimer = nil; } } - (void)sendHeart { [self send:nil seq:self.seq callback:nil]; } #pragma - mark 以下是请求 api // 登录请求包 - (void)requestLogin:(NSString *)name password:(NSString *)psw completion:(TCPBlock)block { dispatch_async(self.APIQueue, ^{ self.autoLogin = true; // 主动登录,设置自动登录 // 如果登录了,先下线 if ([[SocketManager instance] status] == true) { [[SocketManager instance] disConnect]; } // 保存用户名密码到文件,应该加密保存 NSUserDefaults *ud = [NSUserDefaults standardUserDefaults]; [ud setObject:name forKey:@"UserName"]; [ud setObject:psw forKey:@"Password"]; [self createLoginAndSend:name password:psw completion:block]; }); } // 创建并发送登录包 - (void)createLoginAndSend:(NSString *)name password:(NSString *)psw completion:(TCPBlock)block { client_login_msgBuilder *loginMsg = [client_login_msg builder]; // 二级包体 [loginMsg setName:name]; [loginMsg setPassword:psw]; [loginMsg setBios:@""]; [loginMsg setCpu:@""]; [loginMsg setMac:@""]; [loginMsg setHdd:@""]; [loginMsg setIp:@""]; [loginMsg setLtype:client_login_msglogin_typeTgMobile]; rpc_msg_rootBuilder *rootMsg = [rpc_msg_root builder]; // 一级包体 [rootMsg setService:eum_rpc_serviceCommonService]; [rootMsg setMethod:eum_method_typeClientLogin]; [rootMsg setBody:[[loginMsg build] data]]; UInt32 s = self.seq; [rootMsg setSeq:s]; [self send:rootMsg seq:s callback:block]; } // 登录返回包 - (void)receiveLogin:(rpc_msg_root *)root completion:(TCPBlock)block { client_login_result_msg *result = [client_login_result_msg parseFromData:root.body]; if ([result result]) { self.loginStatus = true; self.autoLogin = true; [self startHeartBeat]; NSMutableDictionary *dic = [[NSMutableDictionary alloc] init]; for (ext_key_info *info in result.ext) { [dic setObject:info.value forKey:info.key]; } if (block) block(dic, nil); } else { self.loginStatus = false; self.autoLogin = false; if (block) block(nil, @"登录失败"); } } // 请求股票名称 - (void)requestBlockWithcompletion:(TCPBlock)block { dispatch_async(self.APIQueue, ^{ s_board_report_data_msgBuilder *msg = [s_board_report_data_msg builder]; [msg setBlockCode:0]; [msg setBlockOffset:0]; [msg setCount:2]; [msg setIsAsc:false]; [msg setSortColum:colum_typeColRiseScope]; [msg setColumArrayArray:@[@(colum_typeColRiseScope)]]; rpc_msg_rootBuilder *rootMsg = [rpc_msg_root builder]; // 一级包体 [rootMsg setService:eum_rpc_serviceReportService]; [rootMsg setMethod:eum_method_typeReportBoardreportRequest]; [rootMsg setBody:[[msg build] data]]; UInt32 s = self.seq; [rootMsg setSeq:s]; [self send:rootMsg seq:s callback:block]; }); } // 请求股票名称收到 - (void)receiveBlock:(rpc_msg_root *)root completion:(TCPBlock)block { s_borad_report_result_msg *result = [s_borad_report_result_msg parseFromData:root.body]; if (result.datas) { NSMutableArray *array = [[NSMutableArray alloc] init]; for (s_borad_report_line_data *m in result.datas) { [array addObject:m.code]; for (s_board_report_colum_data_msg *m2 in m.columData) { [array addObject:[NSString stringWithFormat:@"%.2f", m2.value]]; } } if (block) block(array, nil); } else { if (block) block(nil, @"未找到数据"); } } // 收到踢人包 - (void)receiveKick { [[SocketManager instance] disConnect]; [self closeHeartBeat]; self.loginStatus = false; self.autoLogin = false; } @end ================================================ FILE: GCDAsyncSocket/ViewController.h ================================================ // // ViewController.h // GCDAsyncSocket // // Created by caokun on 16/7/5. // Copyright © 2016年 caokun. All rights reserved. // #import @interface ViewController : UIViewController @end ================================================ FILE: GCDAsyncSocket/ViewController.m ================================================ // // ViewController.m // GCDAsyncSocket使用 // // Created by caokun on 16/5/27. // Copyright © 2016年 caokun. All rights reserved. // #import "ViewController.h" #import "SocketManager.h" #import "TCPAPI.h" #import "NetWorkManager.h" #import "SpeedDectectManager.h" @interface ViewController () @end @implementation ViewController - (void)viewDidLoad { [super viewDidLoad]; } - (void)didReceiveMemoryWarning { [super didReceiveMemoryWarning]; } - (IBAction)connectButton:(id)sender { [[SocketManager instance] connectAutomatic:nil]; } - (IBAction)disconnectButton:(id)sender { [[SocketManager instance] disConnect]; } - (IBAction)heart:(id)sender { [[TCPAPI instance] sendHeart]; } - (IBAction)TCPLogin:(id)sender { // 此处 tcp 请求可以在其他线程,以0.3秒/次的速度请求,模拟网络断开或连上 // 用户名跟密码由于是公司的账号,不敢随便公布了 [[TCPAPI instance] requestLogin:@"用户名" password:@"密码" completion:^(id response, NSString *error) { if (error == nil) { NSDictionary *dic = (NSDictionary *)response; NSLog(@"%@", dic); } else { NSLog(@"登录失败"); } }]; } // 普通应用层请求 - (IBAction)requestTcp:(id)sender { [[TCPAPI instance] requestBlockWithcompletion:^(id response, NSString *error) { if (error == nil) { NSArray *array = (NSArray *)response; NSLog(@"%@", array); } else { NSLog(@"UI层:%@", error); } }]; } // 模拟 TCPAPI 类收到踢人包 - (IBAction)kick:(id)sender { [[TCPAPI instance] receiveKick]; } @end ================================================ FILE: GCDAsyncSocket/main.m ================================================ // // main.m // GCDAsyncSocket // // Created by caokun on 16/7/5. // Copyright © 2016年 caokun. All rights reserved. // #import #import "AppDelegate.h" int main(int argc, char * argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); } } ================================================ FILE: GCDAsyncSocket/src/Auth.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" #import "Common.pb.h" // @@protoc_insertion_point(imports) @class auth_ctx_msg; @class auth_ctx_msgBuilder; @class auth_kick_user_msg; @class auth_kick_user_msgBuilder; @class auth_user_info_rep_msg; @class auth_user_info_rep_msgBuilder; @class auth_user_info_req_msg; @class auth_user_info_req_msgBuilder; @class auth_user_offline_msg; @class auth_user_offline_msgBuilder; @class client_login_msg; @class client_login_msgBuilder; @class client_login_result_msg; @class client_login_result_msgBuilder; @class combo_private_msg; @class combo_private_msgBuilder; @class common_reply_error_msg; @class common_reply_error_msgBuilder; @class common_update_notice_msg; @class common_update_notice_msgBuilder; @class count_offset_selector; @class count_offset_selectorBuilder; @class data_selector; @class data_selectorBuilder; @class ext_key_info; @class ext_key_infoBuilder; @class load_dector_msg; @class load_dector_msgBuilder; @class notify_ack_msg; @class notify_ack_msgBuilder; @class push_notify_msg; @class push_notify_msgBuilder; @class rpc_msg_root; @class rpc_msg_rootBuilder; @class server_login_msg; @class server_login_msgBuilder; @class server_login_result_msg; @class server_login_result_msgBuilder; @class subcribe_msg; @class subcribe_msgBuilder; @class sync_notify_msg; @class sync_notify_msgBuilder; @class time_offset_selector; @class time_offset_selectorBuilder; @class time_range_selector; @class time_range_selectorBuilder; @interface AuthRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define auth_kick_user_msg_sid @"sid" #define auth_kick_user_msg_cid @"cid" #define auth_kick_user_msg_name @"name" @interface auth_kick_user_msg : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasSid_:1; BOOL hasCid_:1; NSString* name; UInt32 sid; UInt32 cid; } - (BOOL) hasSid; - (BOOL) hasCid; - (BOOL) hasName; @property (readonly) UInt32 sid; @property (readonly) UInt32 cid; @property (readonly, strong) NSString* name; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (auth_kick_user_msgBuilder*) builder; + (auth_kick_user_msgBuilder*) builder; + (auth_kick_user_msgBuilder*) builderWithPrototype:(auth_kick_user_msg*) prototype; - (auth_kick_user_msgBuilder*) toBuilder; + (auth_kick_user_msg*) parseFromData:(NSData*) data; + (auth_kick_user_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_kick_user_msg*) parseFromInputStream:(NSInputStream*) input; + (auth_kick_user_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_kick_user_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (auth_kick_user_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface auth_kick_user_msgBuilder : PBGeneratedMessageBuilder { @private auth_kick_user_msg* resultAuthKickUserMsg; } - (auth_kick_user_msg*) defaultInstance; - (auth_kick_user_msgBuilder*) clear; - (auth_kick_user_msgBuilder*) clone; - (auth_kick_user_msg*) build; - (auth_kick_user_msg*) buildPartial; - (auth_kick_user_msgBuilder*) mergeFrom:(auth_kick_user_msg*) other; - (auth_kick_user_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (auth_kick_user_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasSid; - (UInt32) sid; - (auth_kick_user_msgBuilder*) setSid:(UInt32) value; - (auth_kick_user_msgBuilder*) clearSid; - (BOOL) hasCid; - (UInt32) cid; - (auth_kick_user_msgBuilder*) setCid:(UInt32) value; - (auth_kick_user_msgBuilder*) clearCid; - (BOOL) hasName; - (NSString*) name; - (auth_kick_user_msgBuilder*) setName:(NSString*) value; - (auth_kick_user_msgBuilder*) clearName; @end #define auth_user_offline_msg_sid @"sid" #define auth_user_offline_msg_cid @"cid" #define auth_user_offline_msg_name @"name" #define auth_user_offline_msg_ltype @"ltype" @interface auth_user_offline_msg : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasSid_:1; BOOL hasCid_:1; BOOL hasLtype_:1; NSString* name; UInt32 sid; UInt32 cid; client_login_msglogin_type ltype; } - (BOOL) hasSid; - (BOOL) hasCid; - (BOOL) hasName; - (BOOL) hasLtype; @property (readonly) UInt32 sid; @property (readonly) UInt32 cid; @property (readonly, strong) NSString* name; @property (readonly) client_login_msglogin_type ltype; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (auth_user_offline_msgBuilder*) builder; + (auth_user_offline_msgBuilder*) builder; + (auth_user_offline_msgBuilder*) builderWithPrototype:(auth_user_offline_msg*) prototype; - (auth_user_offline_msgBuilder*) toBuilder; + (auth_user_offline_msg*) parseFromData:(NSData*) data; + (auth_user_offline_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_user_offline_msg*) parseFromInputStream:(NSInputStream*) input; + (auth_user_offline_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_user_offline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (auth_user_offline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface auth_user_offline_msgBuilder : PBGeneratedMessageBuilder { @private auth_user_offline_msg* resultAuthUserOfflineMsg; } - (auth_user_offline_msg*) defaultInstance; - (auth_user_offline_msgBuilder*) clear; - (auth_user_offline_msgBuilder*) clone; - (auth_user_offline_msg*) build; - (auth_user_offline_msg*) buildPartial; - (auth_user_offline_msgBuilder*) mergeFrom:(auth_user_offline_msg*) other; - (auth_user_offline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (auth_user_offline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasSid; - (UInt32) sid; - (auth_user_offline_msgBuilder*) setSid:(UInt32) value; - (auth_user_offline_msgBuilder*) clearSid; - (BOOL) hasCid; - (UInt32) cid; - (auth_user_offline_msgBuilder*) setCid:(UInt32) value; - (auth_user_offline_msgBuilder*) clearCid; - (BOOL) hasName; - (NSString*) name; - (auth_user_offline_msgBuilder*) setName:(NSString*) value; - (auth_user_offline_msgBuilder*) clearName; - (BOOL) hasLtype; - (client_login_msglogin_type) ltype; - (auth_user_offline_msgBuilder*) setLtype:(client_login_msglogin_type) value; - (auth_user_offline_msgBuilder*) clearLtype; @end #define auth_user_info_req_msg_ltype @"ltype" #define auth_user_info_req_msg_user_name @"userName" @interface auth_user_info_req_msg : PBGeneratedMessage { @private BOOL hasUserName_:1; BOOL hasLtype_:1; NSString* userName; client_login_msglogin_type ltype; } - (BOOL) hasLtype; - (BOOL) hasUserName; @property (readonly) client_login_msglogin_type ltype; @property (readonly, strong) NSString* userName; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (auth_user_info_req_msgBuilder*) builder; + (auth_user_info_req_msgBuilder*) builder; + (auth_user_info_req_msgBuilder*) builderWithPrototype:(auth_user_info_req_msg*) prototype; - (auth_user_info_req_msgBuilder*) toBuilder; + (auth_user_info_req_msg*) parseFromData:(NSData*) data; + (auth_user_info_req_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_user_info_req_msg*) parseFromInputStream:(NSInputStream*) input; + (auth_user_info_req_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_user_info_req_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (auth_user_info_req_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface auth_user_info_req_msgBuilder : PBGeneratedMessageBuilder { @private auth_user_info_req_msg* resultAuthUserInfoReqMsg; } - (auth_user_info_req_msg*) defaultInstance; - (auth_user_info_req_msgBuilder*) clear; - (auth_user_info_req_msgBuilder*) clone; - (auth_user_info_req_msg*) build; - (auth_user_info_req_msg*) buildPartial; - (auth_user_info_req_msgBuilder*) mergeFrom:(auth_user_info_req_msg*) other; - (auth_user_info_req_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (auth_user_info_req_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasLtype; - (client_login_msglogin_type) ltype; - (auth_user_info_req_msgBuilder*) setLtype:(client_login_msglogin_type) value; - (auth_user_info_req_msgBuilder*) clearLtype; - (BOOL) hasUserName; - (NSString*) userName; - (auth_user_info_req_msgBuilder*) setUserName:(NSString*) value; - (auth_user_info_req_msgBuilder*) clearUserName; @end #define auth_user_info_rep_msg_user_name @"userName" #define auth_user_info_rep_msg_product_name @"productName" #define auth_user_info_rep_msg_vaild_date @"vaildDate" #define auth_user_info_rep_msg_ext @"ext" @interface auth_user_info_rep_msg : PBGeneratedMessage { @private BOOL hasUserName_:1; BOOL hasProductName_:1; BOOL hasVaildDate_:1; NSString* userName; NSString* productName; NSString* vaildDate; NSMutableArray * extArray; } - (BOOL) hasUserName; - (BOOL) hasProductName; - (BOOL) hasVaildDate; @property (readonly, strong) NSString* userName; @property (readonly, strong) NSString* productName; @property (readonly, strong) NSString* vaildDate; @property (readonly, strong) NSArray * ext; - (ext_key_info*)extAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (auth_user_info_rep_msgBuilder*) builder; + (auth_user_info_rep_msgBuilder*) builder; + (auth_user_info_rep_msgBuilder*) builderWithPrototype:(auth_user_info_rep_msg*) prototype; - (auth_user_info_rep_msgBuilder*) toBuilder; + (auth_user_info_rep_msg*) parseFromData:(NSData*) data; + (auth_user_info_rep_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_user_info_rep_msg*) parseFromInputStream:(NSInputStream*) input; + (auth_user_info_rep_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_user_info_rep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (auth_user_info_rep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface auth_user_info_rep_msgBuilder : PBGeneratedMessageBuilder { @private auth_user_info_rep_msg* resultAuthUserInfoRepMsg; } - (auth_user_info_rep_msg*) defaultInstance; - (auth_user_info_rep_msgBuilder*) clear; - (auth_user_info_rep_msgBuilder*) clone; - (auth_user_info_rep_msg*) build; - (auth_user_info_rep_msg*) buildPartial; - (auth_user_info_rep_msgBuilder*) mergeFrom:(auth_user_info_rep_msg*) other; - (auth_user_info_rep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (auth_user_info_rep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUserName; - (NSString*) userName; - (auth_user_info_rep_msgBuilder*) setUserName:(NSString*) value; - (auth_user_info_rep_msgBuilder*) clearUserName; - (BOOL) hasProductName; - (NSString*) productName; - (auth_user_info_rep_msgBuilder*) setProductName:(NSString*) value; - (auth_user_info_rep_msgBuilder*) clearProductName; - (BOOL) hasVaildDate; - (NSString*) vaildDate; - (auth_user_info_rep_msgBuilder*) setVaildDate:(NSString*) value; - (auth_user_info_rep_msgBuilder*) clearVaildDate; - (NSMutableArray *)ext; - (ext_key_info*)extAtIndex:(NSUInteger)index; - (auth_user_info_rep_msgBuilder *)addExt:(ext_key_info*)value; - (auth_user_info_rep_msgBuilder *)setExtArray:(NSArray *)array; - (auth_user_info_rep_msgBuilder *)clearExt; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Auth.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Auth.pb.h" // @@protoc_insertion_point(imports) @implementation AuthRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [AuthRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; [CommonRoot registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end @interface auth_kick_user_msg () @property UInt32 sid; @property UInt32 cid; @property (strong) NSString* name; @end @implementation auth_kick_user_msg - (BOOL) hasSid { return !!hasSid_; } - (void) setHasSid:(BOOL) _value_ { hasSid_ = !!_value_; } @synthesize sid; - (BOOL) hasCid { return !!hasCid_; } - (void) setHasCid:(BOOL) _value_ { hasCid_ = !!_value_; } @synthesize cid; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (instancetype) init { if ((self = [super init])) { self.sid = 0; self.cid = 0; self.name = @""; } return self; } static auth_kick_user_msg* defaultauth_kick_user_msgInstance = nil; + (void) initialize { if (self == [auth_kick_user_msg class]) { defaultauth_kick_user_msgInstance = [[auth_kick_user_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultauth_kick_user_msgInstance; } - (instancetype) defaultInstance { return defaultauth_kick_user_msgInstance; } - (BOOL) isInitialized { if (!self.hasSid) { return NO; } if (!self.hasCid) { return NO; } if (!self.hasName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasSid) { [output writeUInt32:1 value:self.sid]; } if (self.hasCid) { [output writeUInt32:2 value:self.cid]; } if (self.hasName) { [output writeString:3 value:self.name]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasSid) { size_ += computeUInt32Size(1, self.sid); } if (self.hasCid) { size_ += computeUInt32Size(2, self.cid); } if (self.hasName) { size_ += computeStringSize(3, self.name); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (auth_kick_user_msg*) parseFromData:(NSData*) data { return (auth_kick_user_msg*)[[[auth_kick_user_msg builder] mergeFromData:data] build]; } + (auth_kick_user_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_kick_user_msg*)[[[auth_kick_user_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (auth_kick_user_msg*) parseFromInputStream:(NSInputStream*) input { return (auth_kick_user_msg*)[[[auth_kick_user_msg builder] mergeFromInputStream:input] build]; } + (auth_kick_user_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_kick_user_msg*)[[[auth_kick_user_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_kick_user_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (auth_kick_user_msg*)[[[auth_kick_user_msg builder] mergeFromCodedInputStream:input] build]; } + (auth_kick_user_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_kick_user_msg*)[[[auth_kick_user_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_kick_user_msgBuilder*) builder { return [[auth_kick_user_msgBuilder alloc] init]; } + (auth_kick_user_msgBuilder*) builderWithPrototype:(auth_kick_user_msg*) prototype { return [[auth_kick_user_msg builder] mergeFrom:prototype]; } - (auth_kick_user_msgBuilder*) builder { return [auth_kick_user_msg builder]; } - (auth_kick_user_msgBuilder*) toBuilder { return [auth_kick_user_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasSid) { [output appendFormat:@"%@%@: %@\n", indent, @"sid", [NSNumber numberWithInteger:self.sid]]; } if (self.hasCid) { [output appendFormat:@"%@%@: %@\n", indent, @"cid", [NSNumber numberWithInteger:self.cid]]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasSid) { [dictionary setObject: [NSNumber numberWithInteger:self.sid] forKey: @"sid"]; } if (self.hasCid) { [dictionary setObject: [NSNumber numberWithInteger:self.cid] forKey: @"cid"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[auth_kick_user_msg class]]) { return NO; } auth_kick_user_msg *otherMessage = other; return self.hasSid == otherMessage.hasSid && (!self.hasSid || self.sid == otherMessage.sid) && self.hasCid == otherMessage.hasCid && (!self.hasCid || self.cid == otherMessage.cid) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasSid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.sid] hash]; } if (self.hasCid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.cid] hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface auth_kick_user_msgBuilder() @property (strong) auth_kick_user_msg* resultAuthKickUserMsg; @end @implementation auth_kick_user_msgBuilder @synthesize resultAuthKickUserMsg; - (instancetype) init { if ((self = [super init])) { self.resultAuthKickUserMsg = [[auth_kick_user_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultAuthKickUserMsg; } - (auth_kick_user_msgBuilder*) clear { self.resultAuthKickUserMsg = [[auth_kick_user_msg alloc] init]; return self; } - (auth_kick_user_msgBuilder*) clone { return [auth_kick_user_msg builderWithPrototype:resultAuthKickUserMsg]; } - (auth_kick_user_msg*) defaultInstance { return [auth_kick_user_msg defaultInstance]; } - (auth_kick_user_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (auth_kick_user_msg*) buildPartial { auth_kick_user_msg* returnMe = resultAuthKickUserMsg; self.resultAuthKickUserMsg = nil; return returnMe; } - (auth_kick_user_msgBuilder*) mergeFrom:(auth_kick_user_msg*) other { if (other == [auth_kick_user_msg defaultInstance]) { return self; } if (other.hasSid) { [self setSid:other.sid]; } if (other.hasCid) { [self setCid:other.cid]; } if (other.hasName) { [self setName:other.name]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (auth_kick_user_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (auth_kick_user_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setSid:[input readUInt32]]; break; } case 16: { [self setCid:[input readUInt32]]; break; } case 26: { [self setName:[input readString]]; break; } } } } - (BOOL) hasSid { return resultAuthKickUserMsg.hasSid; } - (UInt32) sid { return resultAuthKickUserMsg.sid; } - (auth_kick_user_msgBuilder*) setSid:(UInt32) value { resultAuthKickUserMsg.hasSid = YES; resultAuthKickUserMsg.sid = value; return self; } - (auth_kick_user_msgBuilder*) clearSid { resultAuthKickUserMsg.hasSid = NO; resultAuthKickUserMsg.sid = 0; return self; } - (BOOL) hasCid { return resultAuthKickUserMsg.hasCid; } - (UInt32) cid { return resultAuthKickUserMsg.cid; } - (auth_kick_user_msgBuilder*) setCid:(UInt32) value { resultAuthKickUserMsg.hasCid = YES; resultAuthKickUserMsg.cid = value; return self; } - (auth_kick_user_msgBuilder*) clearCid { resultAuthKickUserMsg.hasCid = NO; resultAuthKickUserMsg.cid = 0; return self; } - (BOOL) hasName { return resultAuthKickUserMsg.hasName; } - (NSString*) name { return resultAuthKickUserMsg.name; } - (auth_kick_user_msgBuilder*) setName:(NSString*) value { resultAuthKickUserMsg.hasName = YES; resultAuthKickUserMsg.name = value; return self; } - (auth_kick_user_msgBuilder*) clearName { resultAuthKickUserMsg.hasName = NO; resultAuthKickUserMsg.name = @""; return self; } @end @interface auth_user_offline_msg () @property UInt32 sid; @property UInt32 cid; @property (strong) NSString* name; @property client_login_msglogin_type ltype; @end @implementation auth_user_offline_msg - (BOOL) hasSid { return !!hasSid_; } - (void) setHasSid:(BOOL) _value_ { hasSid_ = !!_value_; } @synthesize sid; - (BOOL) hasCid { return !!hasCid_; } - (void) setHasCid:(BOOL) _value_ { hasCid_ = !!_value_; } @synthesize cid; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasLtype { return !!hasLtype_; } - (void) setHasLtype:(BOOL) _value_ { hasLtype_ = !!_value_; } @synthesize ltype; - (instancetype) init { if ((self = [super init])) { self.sid = 0; self.cid = 0; self.name = @""; self.ltype = client_login_msglogin_typeIndexPc; } return self; } static auth_user_offline_msg* defaultauth_user_offline_msgInstance = nil; + (void) initialize { if (self == [auth_user_offline_msg class]) { defaultauth_user_offline_msgInstance = [[auth_user_offline_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultauth_user_offline_msgInstance; } - (instancetype) defaultInstance { return defaultauth_user_offline_msgInstance; } - (BOOL) isInitialized { if (!self.hasSid) { return NO; } if (!self.hasCid) { return NO; } if (!self.hasName) { return NO; } if (!self.hasLtype) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasSid) { [output writeUInt32:1 value:self.sid]; } if (self.hasCid) { [output writeUInt32:2 value:self.cid]; } if (self.hasName) { [output writeString:3 value:self.name]; } if (self.hasLtype) { [output writeEnum:4 value:self.ltype]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasSid) { size_ += computeUInt32Size(1, self.sid); } if (self.hasCid) { size_ += computeUInt32Size(2, self.cid); } if (self.hasName) { size_ += computeStringSize(3, self.name); } if (self.hasLtype) { size_ += computeEnumSize(4, self.ltype); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (auth_user_offline_msg*) parseFromData:(NSData*) data { return (auth_user_offline_msg*)[[[auth_user_offline_msg builder] mergeFromData:data] build]; } + (auth_user_offline_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_offline_msg*)[[[auth_user_offline_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (auth_user_offline_msg*) parseFromInputStream:(NSInputStream*) input { return (auth_user_offline_msg*)[[[auth_user_offline_msg builder] mergeFromInputStream:input] build]; } + (auth_user_offline_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_offline_msg*)[[[auth_user_offline_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_user_offline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (auth_user_offline_msg*)[[[auth_user_offline_msg builder] mergeFromCodedInputStream:input] build]; } + (auth_user_offline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_offline_msg*)[[[auth_user_offline_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_user_offline_msgBuilder*) builder { return [[auth_user_offline_msgBuilder alloc] init]; } + (auth_user_offline_msgBuilder*) builderWithPrototype:(auth_user_offline_msg*) prototype { return [[auth_user_offline_msg builder] mergeFrom:prototype]; } - (auth_user_offline_msgBuilder*) builder { return [auth_user_offline_msg builder]; } - (auth_user_offline_msgBuilder*) toBuilder { return [auth_user_offline_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasSid) { [output appendFormat:@"%@%@: %@\n", indent, @"sid", [NSNumber numberWithInteger:self.sid]]; } if (self.hasCid) { [output appendFormat:@"%@%@: %@\n", indent, @"cid", [NSNumber numberWithInteger:self.cid]]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasLtype) { [output appendFormat:@"%@%@: %@\n", indent, @"ltype", NSStringFromclient_login_msglogin_type(self.ltype)]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasSid) { [dictionary setObject: [NSNumber numberWithInteger:self.sid] forKey: @"sid"]; } if (self.hasCid) { [dictionary setObject: [NSNumber numberWithInteger:self.cid] forKey: @"cid"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasLtype) { [dictionary setObject: @(self.ltype) forKey: @"ltype"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[auth_user_offline_msg class]]) { return NO; } auth_user_offline_msg *otherMessage = other; return self.hasSid == otherMessage.hasSid && (!self.hasSid || self.sid == otherMessage.sid) && self.hasCid == otherMessage.hasCid && (!self.hasCid || self.cid == otherMessage.cid) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasLtype == otherMessage.hasLtype && (!self.hasLtype || self.ltype == otherMessage.ltype) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasSid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.sid] hash]; } if (self.hasCid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.cid] hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasLtype) { hashCode = hashCode * 31 + self.ltype; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface auth_user_offline_msgBuilder() @property (strong) auth_user_offline_msg* resultAuthUserOfflineMsg; @end @implementation auth_user_offline_msgBuilder @synthesize resultAuthUserOfflineMsg; - (instancetype) init { if ((self = [super init])) { self.resultAuthUserOfflineMsg = [[auth_user_offline_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultAuthUserOfflineMsg; } - (auth_user_offline_msgBuilder*) clear { self.resultAuthUserOfflineMsg = [[auth_user_offline_msg alloc] init]; return self; } - (auth_user_offline_msgBuilder*) clone { return [auth_user_offline_msg builderWithPrototype:resultAuthUserOfflineMsg]; } - (auth_user_offline_msg*) defaultInstance { return [auth_user_offline_msg defaultInstance]; } - (auth_user_offline_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (auth_user_offline_msg*) buildPartial { auth_user_offline_msg* returnMe = resultAuthUserOfflineMsg; self.resultAuthUserOfflineMsg = nil; return returnMe; } - (auth_user_offline_msgBuilder*) mergeFrom:(auth_user_offline_msg*) other { if (other == [auth_user_offline_msg defaultInstance]) { return self; } if (other.hasSid) { [self setSid:other.sid]; } if (other.hasCid) { [self setCid:other.cid]; } if (other.hasName) { [self setName:other.name]; } if (other.hasLtype) { [self setLtype:other.ltype]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (auth_user_offline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (auth_user_offline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setSid:[input readUInt32]]; break; } case 16: { [self setCid:[input readUInt32]]; break; } case 26: { [self setName:[input readString]]; break; } case 32: { client_login_msglogin_type value = (client_login_msglogin_type)[input readEnum]; if (client_login_msglogin_typeIsValidValue(value)) { [self setLtype:value]; } else { [unknownFields mergeVarintField:4 value:value]; } break; } } } } - (BOOL) hasSid { return resultAuthUserOfflineMsg.hasSid; } - (UInt32) sid { return resultAuthUserOfflineMsg.sid; } - (auth_user_offline_msgBuilder*) setSid:(UInt32) value { resultAuthUserOfflineMsg.hasSid = YES; resultAuthUserOfflineMsg.sid = value; return self; } - (auth_user_offline_msgBuilder*) clearSid { resultAuthUserOfflineMsg.hasSid = NO; resultAuthUserOfflineMsg.sid = 0; return self; } - (BOOL) hasCid { return resultAuthUserOfflineMsg.hasCid; } - (UInt32) cid { return resultAuthUserOfflineMsg.cid; } - (auth_user_offline_msgBuilder*) setCid:(UInt32) value { resultAuthUserOfflineMsg.hasCid = YES; resultAuthUserOfflineMsg.cid = value; return self; } - (auth_user_offline_msgBuilder*) clearCid { resultAuthUserOfflineMsg.hasCid = NO; resultAuthUserOfflineMsg.cid = 0; return self; } - (BOOL) hasName { return resultAuthUserOfflineMsg.hasName; } - (NSString*) name { return resultAuthUserOfflineMsg.name; } - (auth_user_offline_msgBuilder*) setName:(NSString*) value { resultAuthUserOfflineMsg.hasName = YES; resultAuthUserOfflineMsg.name = value; return self; } - (auth_user_offline_msgBuilder*) clearName { resultAuthUserOfflineMsg.hasName = NO; resultAuthUserOfflineMsg.name = @""; return self; } - (BOOL) hasLtype { return resultAuthUserOfflineMsg.hasLtype; } - (client_login_msglogin_type) ltype { return resultAuthUserOfflineMsg.ltype; } - (auth_user_offline_msgBuilder*) setLtype:(client_login_msglogin_type) value { resultAuthUserOfflineMsg.hasLtype = YES; resultAuthUserOfflineMsg.ltype = value; return self; } - (auth_user_offline_msgBuilder*) clearLtype { resultAuthUserOfflineMsg.hasLtype = NO; resultAuthUserOfflineMsg.ltype = client_login_msglogin_typeIndexPc; return self; } @end @interface auth_user_info_req_msg () @property client_login_msglogin_type ltype; @property (strong) NSString* userName; @end @implementation auth_user_info_req_msg - (BOOL) hasLtype { return !!hasLtype_; } - (void) setHasLtype:(BOOL) _value_ { hasLtype_ = !!_value_; } @synthesize ltype; - (BOOL) hasUserName { return !!hasUserName_; } - (void) setHasUserName:(BOOL) _value_ { hasUserName_ = !!_value_; } @synthesize userName; - (instancetype) init { if ((self = [super init])) { self.ltype = client_login_msglogin_typeIndexPc; self.userName = @""; } return self; } static auth_user_info_req_msg* defaultauth_user_info_req_msgInstance = nil; + (void) initialize { if (self == [auth_user_info_req_msg class]) { defaultauth_user_info_req_msgInstance = [[auth_user_info_req_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultauth_user_info_req_msgInstance; } - (instancetype) defaultInstance { return defaultauth_user_info_req_msgInstance; } - (BOOL) isInitialized { if (!self.hasLtype) { return NO; } if (!self.hasUserName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasLtype) { [output writeEnum:1 value:self.ltype]; } if (self.hasUserName) { [output writeString:2 value:self.userName]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasLtype) { size_ += computeEnumSize(1, self.ltype); } if (self.hasUserName) { size_ += computeStringSize(2, self.userName); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (auth_user_info_req_msg*) parseFromData:(NSData*) data { return (auth_user_info_req_msg*)[[[auth_user_info_req_msg builder] mergeFromData:data] build]; } + (auth_user_info_req_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_info_req_msg*)[[[auth_user_info_req_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (auth_user_info_req_msg*) parseFromInputStream:(NSInputStream*) input { return (auth_user_info_req_msg*)[[[auth_user_info_req_msg builder] mergeFromInputStream:input] build]; } + (auth_user_info_req_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_info_req_msg*)[[[auth_user_info_req_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_user_info_req_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (auth_user_info_req_msg*)[[[auth_user_info_req_msg builder] mergeFromCodedInputStream:input] build]; } + (auth_user_info_req_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_info_req_msg*)[[[auth_user_info_req_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_user_info_req_msgBuilder*) builder { return [[auth_user_info_req_msgBuilder alloc] init]; } + (auth_user_info_req_msgBuilder*) builderWithPrototype:(auth_user_info_req_msg*) prototype { return [[auth_user_info_req_msg builder] mergeFrom:prototype]; } - (auth_user_info_req_msgBuilder*) builder { return [auth_user_info_req_msg builder]; } - (auth_user_info_req_msgBuilder*) toBuilder { return [auth_user_info_req_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasLtype) { [output appendFormat:@"%@%@: %@\n", indent, @"ltype", NSStringFromclient_login_msglogin_type(self.ltype)]; } if (self.hasUserName) { [output appendFormat:@"%@%@: %@\n", indent, @"userName", self.userName]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasLtype) { [dictionary setObject: @(self.ltype) forKey: @"ltype"]; } if (self.hasUserName) { [dictionary setObject: self.userName forKey: @"userName"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[auth_user_info_req_msg class]]) { return NO; } auth_user_info_req_msg *otherMessage = other; return self.hasLtype == otherMessage.hasLtype && (!self.hasLtype || self.ltype == otherMessage.ltype) && self.hasUserName == otherMessage.hasUserName && (!self.hasUserName || [self.userName isEqual:otherMessage.userName]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasLtype) { hashCode = hashCode * 31 + self.ltype; } if (self.hasUserName) { hashCode = hashCode * 31 + [self.userName hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface auth_user_info_req_msgBuilder() @property (strong) auth_user_info_req_msg* resultAuthUserInfoReqMsg; @end @implementation auth_user_info_req_msgBuilder @synthesize resultAuthUserInfoReqMsg; - (instancetype) init { if ((self = [super init])) { self.resultAuthUserInfoReqMsg = [[auth_user_info_req_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultAuthUserInfoReqMsg; } - (auth_user_info_req_msgBuilder*) clear { self.resultAuthUserInfoReqMsg = [[auth_user_info_req_msg alloc] init]; return self; } - (auth_user_info_req_msgBuilder*) clone { return [auth_user_info_req_msg builderWithPrototype:resultAuthUserInfoReqMsg]; } - (auth_user_info_req_msg*) defaultInstance { return [auth_user_info_req_msg defaultInstance]; } - (auth_user_info_req_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (auth_user_info_req_msg*) buildPartial { auth_user_info_req_msg* returnMe = resultAuthUserInfoReqMsg; self.resultAuthUserInfoReqMsg = nil; return returnMe; } - (auth_user_info_req_msgBuilder*) mergeFrom:(auth_user_info_req_msg*) other { if (other == [auth_user_info_req_msg defaultInstance]) { return self; } if (other.hasLtype) { [self setLtype:other.ltype]; } if (other.hasUserName) { [self setUserName:other.userName]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (auth_user_info_req_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (auth_user_info_req_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { client_login_msglogin_type value = (client_login_msglogin_type)[input readEnum]; if (client_login_msglogin_typeIsValidValue(value)) { [self setLtype:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setUserName:[input readString]]; break; } } } } - (BOOL) hasLtype { return resultAuthUserInfoReqMsg.hasLtype; } - (client_login_msglogin_type) ltype { return resultAuthUserInfoReqMsg.ltype; } - (auth_user_info_req_msgBuilder*) setLtype:(client_login_msglogin_type) value { resultAuthUserInfoReqMsg.hasLtype = YES; resultAuthUserInfoReqMsg.ltype = value; return self; } - (auth_user_info_req_msgBuilder*) clearLtype { resultAuthUserInfoReqMsg.hasLtype = NO; resultAuthUserInfoReqMsg.ltype = client_login_msglogin_typeIndexPc; return self; } - (BOOL) hasUserName { return resultAuthUserInfoReqMsg.hasUserName; } - (NSString*) userName { return resultAuthUserInfoReqMsg.userName; } - (auth_user_info_req_msgBuilder*) setUserName:(NSString*) value { resultAuthUserInfoReqMsg.hasUserName = YES; resultAuthUserInfoReqMsg.userName = value; return self; } - (auth_user_info_req_msgBuilder*) clearUserName { resultAuthUserInfoReqMsg.hasUserName = NO; resultAuthUserInfoReqMsg.userName = @""; return self; } @end @interface auth_user_info_rep_msg () @property (strong) NSString* userName; @property (strong) NSString* productName; @property (strong) NSString* vaildDate; @property (strong) NSMutableArray * extArray; @end @implementation auth_user_info_rep_msg - (BOOL) hasUserName { return !!hasUserName_; } - (void) setHasUserName:(BOOL) _value_ { hasUserName_ = !!_value_; } @synthesize userName; - (BOOL) hasProductName { return !!hasProductName_; } - (void) setHasProductName:(BOOL) _value_ { hasProductName_ = !!_value_; } @synthesize productName; - (BOOL) hasVaildDate { return !!hasVaildDate_; } - (void) setHasVaildDate:(BOOL) _value_ { hasVaildDate_ = !!_value_; } @synthesize vaildDate; @synthesize extArray; @dynamic ext; - (instancetype) init { if ((self = [super init])) { self.userName = @""; self.productName = @""; self.vaildDate = @""; } return self; } static auth_user_info_rep_msg* defaultauth_user_info_rep_msgInstance = nil; + (void) initialize { if (self == [auth_user_info_rep_msg class]) { defaultauth_user_info_rep_msgInstance = [[auth_user_info_rep_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultauth_user_info_rep_msgInstance; } - (instancetype) defaultInstance { return defaultauth_user_info_rep_msgInstance; } - (NSArray *)ext { return extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [extArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasUserName) { return NO; } if (!self.hasProductName) { return NO; } if (!self.hasVaildDate) { return NO; } __block BOOL isInitext = YES; [self.ext enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitext = NO; *stop = YES; } }]; if (!isInitext) return isInitext; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUserName) { [output writeString:1 value:self.userName]; } if (self.hasProductName) { [output writeString:2 value:self.productName]; } if (self.hasVaildDate) { [output writeString:3 value:self.vaildDate]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output writeMessage:4 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUserName) { size_ += computeStringSize(1, self.userName); } if (self.hasProductName) { size_ += computeStringSize(2, self.productName); } if (self.hasVaildDate) { size_ += computeStringSize(3, self.vaildDate); } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(4, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (auth_user_info_rep_msg*) parseFromData:(NSData*) data { return (auth_user_info_rep_msg*)[[[auth_user_info_rep_msg builder] mergeFromData:data] build]; } + (auth_user_info_rep_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_info_rep_msg*)[[[auth_user_info_rep_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (auth_user_info_rep_msg*) parseFromInputStream:(NSInputStream*) input { return (auth_user_info_rep_msg*)[[[auth_user_info_rep_msg builder] mergeFromInputStream:input] build]; } + (auth_user_info_rep_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_info_rep_msg*)[[[auth_user_info_rep_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_user_info_rep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (auth_user_info_rep_msg*)[[[auth_user_info_rep_msg builder] mergeFromCodedInputStream:input] build]; } + (auth_user_info_rep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_user_info_rep_msg*)[[[auth_user_info_rep_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_user_info_rep_msgBuilder*) builder { return [[auth_user_info_rep_msgBuilder alloc] init]; } + (auth_user_info_rep_msgBuilder*) builderWithPrototype:(auth_user_info_rep_msg*) prototype { return [[auth_user_info_rep_msg builder] mergeFrom:prototype]; } - (auth_user_info_rep_msgBuilder*) builder { return [auth_user_info_rep_msg builder]; } - (auth_user_info_rep_msgBuilder*) toBuilder { return [auth_user_info_rep_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUserName) { [output appendFormat:@"%@%@: %@\n", indent, @"userName", self.userName]; } if (self.hasProductName) { [output appendFormat:@"%@%@: %@\n", indent, @"productName", self.productName]; } if (self.hasVaildDate) { [output appendFormat:@"%@%@: %@\n", indent, @"vaildDate", self.vaildDate]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"ext"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUserName) { [dictionary setObject: self.userName forKey: @"userName"]; } if (self.hasProductName) { [dictionary setObject: self.productName forKey: @"productName"]; } if (self.hasVaildDate) { [dictionary setObject: self.vaildDate forKey: @"vaildDate"]; } for (ext_key_info* element in self.extArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"ext"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[auth_user_info_rep_msg class]]) { return NO; } auth_user_info_rep_msg *otherMessage = other; return self.hasUserName == otherMessage.hasUserName && (!self.hasUserName || [self.userName isEqual:otherMessage.userName]) && self.hasProductName == otherMessage.hasProductName && (!self.hasProductName || [self.productName isEqual:otherMessage.productName]) && self.hasVaildDate == otherMessage.hasVaildDate && (!self.hasVaildDate || [self.vaildDate isEqual:otherMessage.vaildDate]) && [self.extArray isEqualToArray:otherMessage.extArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUserName) { hashCode = hashCode * 31 + [self.userName hash]; } if (self.hasProductName) { hashCode = hashCode * 31 + [self.productName hash]; } if (self.hasVaildDate) { hashCode = hashCode * 31 + [self.vaildDate hash]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface auth_user_info_rep_msgBuilder() @property (strong) auth_user_info_rep_msg* resultAuthUserInfoRepMsg; @end @implementation auth_user_info_rep_msgBuilder @synthesize resultAuthUserInfoRepMsg; - (instancetype) init { if ((self = [super init])) { self.resultAuthUserInfoRepMsg = [[auth_user_info_rep_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultAuthUserInfoRepMsg; } - (auth_user_info_rep_msgBuilder*) clear { self.resultAuthUserInfoRepMsg = [[auth_user_info_rep_msg alloc] init]; return self; } - (auth_user_info_rep_msgBuilder*) clone { return [auth_user_info_rep_msg builderWithPrototype:resultAuthUserInfoRepMsg]; } - (auth_user_info_rep_msg*) defaultInstance { return [auth_user_info_rep_msg defaultInstance]; } - (auth_user_info_rep_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (auth_user_info_rep_msg*) buildPartial { auth_user_info_rep_msg* returnMe = resultAuthUserInfoRepMsg; self.resultAuthUserInfoRepMsg = nil; return returnMe; } - (auth_user_info_rep_msgBuilder*) mergeFrom:(auth_user_info_rep_msg*) other { if (other == [auth_user_info_rep_msg defaultInstance]) { return self; } if (other.hasUserName) { [self setUserName:other.userName]; } if (other.hasProductName) { [self setProductName:other.productName]; } if (other.hasVaildDate) { [self setVaildDate:other.vaildDate]; } if (other.extArray.count > 0) { if (resultAuthUserInfoRepMsg.extArray == nil) { resultAuthUserInfoRepMsg.extArray = [[NSMutableArray alloc] initWithArray:other.extArray]; } else { [resultAuthUserInfoRepMsg.extArray addObjectsFromArray:other.extArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (auth_user_info_rep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (auth_user_info_rep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setUserName:[input readString]]; break; } case 18: { [self setProductName:[input readString]]; break; } case 26: { [self setVaildDate:[input readString]]; break; } case 34: { ext_key_infoBuilder* subBuilder = [ext_key_info builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExt:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasUserName { return resultAuthUserInfoRepMsg.hasUserName; } - (NSString*) userName { return resultAuthUserInfoRepMsg.userName; } - (auth_user_info_rep_msgBuilder*) setUserName:(NSString*) value { resultAuthUserInfoRepMsg.hasUserName = YES; resultAuthUserInfoRepMsg.userName = value; return self; } - (auth_user_info_rep_msgBuilder*) clearUserName { resultAuthUserInfoRepMsg.hasUserName = NO; resultAuthUserInfoRepMsg.userName = @""; return self; } - (BOOL) hasProductName { return resultAuthUserInfoRepMsg.hasProductName; } - (NSString*) productName { return resultAuthUserInfoRepMsg.productName; } - (auth_user_info_rep_msgBuilder*) setProductName:(NSString*) value { resultAuthUserInfoRepMsg.hasProductName = YES; resultAuthUserInfoRepMsg.productName = value; return self; } - (auth_user_info_rep_msgBuilder*) clearProductName { resultAuthUserInfoRepMsg.hasProductName = NO; resultAuthUserInfoRepMsg.productName = @""; return self; } - (BOOL) hasVaildDate { return resultAuthUserInfoRepMsg.hasVaildDate; } - (NSString*) vaildDate { return resultAuthUserInfoRepMsg.vaildDate; } - (auth_user_info_rep_msgBuilder*) setVaildDate:(NSString*) value { resultAuthUserInfoRepMsg.hasVaildDate = YES; resultAuthUserInfoRepMsg.vaildDate = value; return self; } - (auth_user_info_rep_msgBuilder*) clearVaildDate { resultAuthUserInfoRepMsg.hasVaildDate = NO; resultAuthUserInfoRepMsg.vaildDate = @""; return self; } - (NSMutableArray *)ext { return resultAuthUserInfoRepMsg.extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [resultAuthUserInfoRepMsg extAtIndex:index]; } - (auth_user_info_rep_msgBuilder *)addExt:(ext_key_info*)value { if (resultAuthUserInfoRepMsg.extArray == nil) { resultAuthUserInfoRepMsg.extArray = [[NSMutableArray alloc]init]; } [resultAuthUserInfoRepMsg.extArray addObject:value]; return self; } - (auth_user_info_rep_msgBuilder *)setExtArray:(NSArray *)array { resultAuthUserInfoRepMsg.extArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (auth_user_info_rep_msgBuilder *)clearExt { resultAuthUserInfoRepMsg.extArray = nil; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Common.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" // @@protoc_insertion_point(imports) @class auth_ctx_msg; @class auth_ctx_msgBuilder; @class client_login_msg; @class client_login_msgBuilder; @class client_login_result_msg; @class client_login_result_msgBuilder; @class combo_private_msg; @class combo_private_msgBuilder; @class common_reply_error_msg; @class common_reply_error_msgBuilder; @class common_update_notice_msg; @class common_update_notice_msgBuilder; @class count_offset_selector; @class count_offset_selectorBuilder; @class data_selector; @class data_selectorBuilder; @class ext_key_info; @class ext_key_infoBuilder; @class load_dector_msg; @class load_dector_msgBuilder; @class notify_ack_msg; @class notify_ack_msgBuilder; @class push_notify_msg; @class push_notify_msgBuilder; @class rpc_msg_root; @class rpc_msg_rootBuilder; @class server_login_msg; @class server_login_msgBuilder; @class server_login_result_msg; @class server_login_result_msgBuilder; @class subcribe_msg; @class subcribe_msgBuilder; @class sync_notify_msg; @class sync_notify_msgBuilder; @class time_offset_selector; @class time_offset_selectorBuilder; @class time_range_selector; @class time_range_selectorBuilder; typedef NS_ENUM(SInt32, eum_method_type) { eum_method_typeCommonErrorRep = 0, eum_method_typeLoadDetector = 1, eum_method_typeServerLogin = 2, eum_method_typeServerLoginRet = 3, eum_method_typeClientLogin = 4, eum_method_typeClientLoginRet = 5, eum_method_typeLoginConflict = 6, eum_method_typeIndexRequest = 7, eum_method_typeIndexResult = 8, eum_method_typeIndexComboResult = 9, eum_method_typeErrorFeedback = 10, eum_method_typeSubcribeTopic = 11, eum_method_typeUnsubcribeTopic = 12, eum_method_typePublicTopic = 13, eum_method_typeIndexDataRequest = 14, eum_method_typeIndexDataResult = 15, eum_method_typeRiseDropRequest = 16, eum_method_typeRiseDropResult = 17, eum_method_typeTgRStockPool = 18, eum_method_typeTgRMsgBox = 19, eum_method_typeReportReportRequest = 20, eum_method_typeReportReportResult = 21, eum_method_typeReportLargedealRequest = 22, eum_method_typeReportLargedealResult = 23, eum_method_typeReportMinuteRequest = 24, eum_method_typeReportMinuteResult = 25, eum_method_typeReportKlineRequest = 26, eum_method_typeReportKlineResult = 27, eum_method_typeReportSearchStockRequest = 28, eum_method_typeReportSearchStockResult = 29, eum_method_typeReportBoardreportRequest = 30, eum_method_typeReportBoardreportResult = 31, eum_method_typeReportBidDealRequest = 32, eum_method_typeReportBidDealResult = 33, eum_method_typeReportLastOpenDayRequest = 34, eum_method_typeReportLastOpenDayResult = 35, eum_method_typeReportBoardreportOptionalRequest = 36, eum_method_typeReportBoardreportOptionalResult = 37, eum_method_typeReportBoardreportTopRequest = 38, eum_method_typeReportBoardreportTopResult = 39, eum_method_typeWarningWarningConfigRequest = 40, eum_method_typeWarningWarningConfigResult = 41, eum_method_typeWarningWarningUserAllStockStatusRequest = 42, eum_method_typeWarningWarningUserAllStockStatusResult = 43, eum_method_typeWarningSetWarningConfigRequest = 44, eum_method_typeWarningSetWarningConfigResult = 45, eum_method_typeWarningDeleteUserStockWarningConfigRequest = 46, eum_method_typeWarningDeleteUserStockWarningConfigResult = 47, eum_method_typeReportIndexKeepRequest = 49, eum_method_typeReportIndexKeepResult = 50, eum_method_typeReportBlockRelationRequest = 51, eum_method_typeReportBlockRelationResult = 52, eum_method_typeWarningGetUserStockWarningRecordRequest = 53, eum_method_typeWarningGetUserStockWarningRecordResult = 54, eum_method_typeReportCodeNameRequest = 55, eum_method_typeReportCodeNameResult = 56, eum_method_typeEumSyncNotify = 1000, eum_method_typeEumPushNotify = 1001, eum_method_typeEumPushAck = 1002, eum_method_typeEumComboPrivateNotify = 1003, eum_method_typeEumAuthKickUser = 2000, eum_method_typeEumAuthUserOffline = 2001, eum_method_typeEumAuthUserInfoReq = 2002, eum_method_typeEumAuthUserInfoRep = 2003, eum_method_typeEumMethodEnd = 200000000, }; BOOL eum_method_typeIsValidValue(eum_method_type value); NSString *NSStringFromeum_method_type(eum_method_type value); typedef NS_ENUM(SInt32, eum_rpc_service) { eum_rpc_serviceCommonService = 1, eum_rpc_serviceReportService = 2, eum_rpc_serviceIndexService = 3, eum_rpc_serviceInvestmentService = 4, eum_rpc_serviceWarningService = 5, eum_rpc_serviceEumServiceEnd = 200000000, }; BOOL eum_rpc_serviceIsValidValue(eum_rpc_service value); NSString *NSStringFromeum_rpc_service(eum_rpc_service value); typedef NS_ENUM(SInt32, eum_nofity_type) { eum_nofity_typeTgStockInPoolNotify = 0, eum_nofity_typeTgStockOutPoolNotify = 1, eum_nofity_typeTgStockModifyTargetNofity = 2, eum_nofity_typeTgStockModifyStopNodify = 3, eum_nofity_typeTgStockBuyNodify = 4, eum_nofity_typeTgStockProfitSellNofity = 5, eum_nofity_typeTgStockStopLossNofity = 6, eum_nofity_typeTgFocusNews = 7, eum_nofity_typeTgTrailerAndNotice = 8, eum_nofity_typeCommonUpdateNotice = 9, eum_nofity_typeIndexStockWarningNotice = 10, eum_nofity_typeReportMarketStatusNotify = 11, }; BOOL eum_nofity_typeIsValidValue(eum_nofity_type value); NSString *NSStringFromeum_nofity_type(eum_nofity_type value); typedef NS_ENUM(SInt32, client_login_msglogin_type) { client_login_msglogin_typeIndexPc = 0, client_login_msglogin_typeIndexMobile = -1002, client_login_msglogin_typeTgPc = -1000, client_login_msglogin_typeTgMobile = -1001, }; BOOL client_login_msglogin_typeIsValidValue(client_login_msglogin_type value); NSString *NSStringFromclient_login_msglogin_type(client_login_msglogin_type value); @interface CommonRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define ext_key_info_key @"key" #define ext_key_info_value @"value" @interface ext_key_info : PBGeneratedMessage { @private BOOL hasKey_:1; BOOL hasValue_:1; NSString* key; NSString* value; } - (BOOL) hasKey; - (BOOL) hasValue; @property (readonly, strong) NSString* key; @property (readonly, strong) NSString* value; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (ext_key_infoBuilder*) builder; + (ext_key_infoBuilder*) builder; + (ext_key_infoBuilder*) builderWithPrototype:(ext_key_info*) prototype; - (ext_key_infoBuilder*) toBuilder; + (ext_key_info*) parseFromData:(NSData*) data; + (ext_key_info*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ext_key_info*) parseFromInputStream:(NSInputStream*) input; + (ext_key_info*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ext_key_info*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ext_key_info*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface ext_key_infoBuilder : PBGeneratedMessageBuilder { @private ext_key_info* resultExtKeyInfo; } - (ext_key_info*) defaultInstance; - (ext_key_infoBuilder*) clear; - (ext_key_infoBuilder*) clone; - (ext_key_info*) build; - (ext_key_info*) buildPartial; - (ext_key_infoBuilder*) mergeFrom:(ext_key_info*) other; - (ext_key_infoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (ext_key_infoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasKey; - (NSString*) key; - (ext_key_infoBuilder*) setKey:(NSString*) value; - (ext_key_infoBuilder*) clearKey; - (BOOL) hasValue; - (NSString*) value; - (ext_key_infoBuilder*) setValue:(NSString*) value; - (ext_key_infoBuilder*) clearValue; @end #define subcribe_msg_service_type @"serviceType" #define subcribe_msg_topic @"topic" @interface subcribe_msg : PBGeneratedMessage { @private BOOL hasTopic_:1; BOOL hasServiceType_:1; NSString* topic; eum_rpc_service serviceType; } - (BOOL) hasServiceType; - (BOOL) hasTopic; @property (readonly) eum_rpc_service serviceType; @property (readonly, strong) NSString* topic; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (subcribe_msgBuilder*) builder; + (subcribe_msgBuilder*) builder; + (subcribe_msgBuilder*) builderWithPrototype:(subcribe_msg*) prototype; - (subcribe_msgBuilder*) toBuilder; + (subcribe_msg*) parseFromData:(NSData*) data; + (subcribe_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (subcribe_msg*) parseFromInputStream:(NSInputStream*) input; + (subcribe_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (subcribe_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (subcribe_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface subcribe_msgBuilder : PBGeneratedMessageBuilder { @private subcribe_msg* resultSubcribeMsg; } - (subcribe_msg*) defaultInstance; - (subcribe_msgBuilder*) clear; - (subcribe_msgBuilder*) clone; - (subcribe_msg*) build; - (subcribe_msg*) buildPartial; - (subcribe_msgBuilder*) mergeFrom:(subcribe_msg*) other; - (subcribe_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (subcribe_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasServiceType; - (eum_rpc_service) serviceType; - (subcribe_msgBuilder*) setServiceType:(eum_rpc_service) value; - (subcribe_msgBuilder*) clearServiceType; - (BOOL) hasTopic; - (NSString*) topic; - (subcribe_msgBuilder*) setTopic:(NSString*) value; - (subcribe_msgBuilder*) clearTopic; @end #define sync_notify_msg_uid @"uid" #define sync_notify_msg_topic @"topic" #define sync_notify_msg_last_seq @"lastSeq" #define sync_notify_msg_ext_param @"extParam" @interface sync_notify_msg : PBGeneratedMessage { @private BOOL hasUid_:1; BOOL hasLastSeq_:1; BOOL hasTopic_:1; SInt64 uid; SInt64 lastSeq; NSString* topic; NSMutableArray * extParamArray; } - (BOOL) hasUid; - (BOOL) hasTopic; - (BOOL) hasLastSeq; @property (readonly) SInt64 uid; @property (readonly, strong) NSString* topic; @property (readonly) SInt64 lastSeq; @property (readonly, strong) NSArray * extParam; - (ext_key_info*)extParamAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (sync_notify_msgBuilder*) builder; + (sync_notify_msgBuilder*) builder; + (sync_notify_msgBuilder*) builderWithPrototype:(sync_notify_msg*) prototype; - (sync_notify_msgBuilder*) toBuilder; + (sync_notify_msg*) parseFromData:(NSData*) data; + (sync_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (sync_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (sync_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (sync_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (sync_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface sync_notify_msgBuilder : PBGeneratedMessageBuilder { @private sync_notify_msg* resultSyncNotifyMsg; } - (sync_notify_msg*) defaultInstance; - (sync_notify_msgBuilder*) clear; - (sync_notify_msgBuilder*) clone; - (sync_notify_msg*) build; - (sync_notify_msg*) buildPartial; - (sync_notify_msgBuilder*) mergeFrom:(sync_notify_msg*) other; - (sync_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (sync_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (SInt64) uid; - (sync_notify_msgBuilder*) setUid:(SInt64) value; - (sync_notify_msgBuilder*) clearUid; - (BOOL) hasTopic; - (NSString*) topic; - (sync_notify_msgBuilder*) setTopic:(NSString*) value; - (sync_notify_msgBuilder*) clearTopic; - (BOOL) hasLastSeq; - (SInt64) lastSeq; - (sync_notify_msgBuilder*) setLastSeq:(SInt64) value; - (sync_notify_msgBuilder*) clearLastSeq; - (NSMutableArray *)extParam; - (ext_key_info*)extParamAtIndex:(NSUInteger)index; - (sync_notify_msgBuilder *)addExtParam:(ext_key_info*)value; - (sync_notify_msgBuilder *)setExtParamArray:(NSArray *)array; - (sync_notify_msgBuilder *)clearExtParam; @end #define push_notify_msg_notify_type @"notifyType" #define push_notify_msg_msg_seq @"msgSeq" #define push_notify_msg_sub_msg @"subMsg" @interface push_notify_msg : PBGeneratedMessage { @private BOOL hasMsgSeq_:1; BOOL hasSubMsg_:1; BOOL hasNotifyType_:1; SInt64 msgSeq; NSData* subMsg; eum_nofity_type notifyType; } - (BOOL) hasNotifyType; - (BOOL) hasMsgSeq; - (BOOL) hasSubMsg; @property (readonly) eum_nofity_type notifyType; @property (readonly) SInt64 msgSeq; @property (readonly, strong) NSData* subMsg; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (push_notify_msgBuilder*) builder; + (push_notify_msgBuilder*) builder; + (push_notify_msgBuilder*) builderWithPrototype:(push_notify_msg*) prototype; - (push_notify_msgBuilder*) toBuilder; + (push_notify_msg*) parseFromData:(NSData*) data; + (push_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (push_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (push_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (push_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (push_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface push_notify_msgBuilder : PBGeneratedMessageBuilder { @private push_notify_msg* resultPushNotifyMsg; } - (push_notify_msg*) defaultInstance; - (push_notify_msgBuilder*) clear; - (push_notify_msgBuilder*) clone; - (push_notify_msg*) build; - (push_notify_msg*) buildPartial; - (push_notify_msgBuilder*) mergeFrom:(push_notify_msg*) other; - (push_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (push_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasNotifyType; - (eum_nofity_type) notifyType; - (push_notify_msgBuilder*) setNotifyType:(eum_nofity_type) value; - (push_notify_msgBuilder*) clearNotifyType; - (BOOL) hasMsgSeq; - (SInt64) msgSeq; - (push_notify_msgBuilder*) setMsgSeq:(SInt64) value; - (push_notify_msgBuilder*) clearMsgSeq; - (BOOL) hasSubMsg; - (NSData*) subMsg; - (push_notify_msgBuilder*) setSubMsg:(NSData*) value; - (push_notify_msgBuilder*) clearSubMsg; @end #define notify_ack_msg_topic @"topic" #define notify_ack_msg_msg_seq @"msgSeq" #define notify_ack_msg_uid @"uid" @interface notify_ack_msg : PBGeneratedMessage { @private BOOL hasMsgSeq_:1; BOOL hasUid_:1; BOOL hasTopic_:1; SInt64 msgSeq; SInt64 uid; NSString* topic; } - (BOOL) hasTopic; - (BOOL) hasMsgSeq; - (BOOL) hasUid; @property (readonly, strong) NSString* topic; @property (readonly) SInt64 msgSeq; @property (readonly) SInt64 uid; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (notify_ack_msgBuilder*) builder; + (notify_ack_msgBuilder*) builder; + (notify_ack_msgBuilder*) builderWithPrototype:(notify_ack_msg*) prototype; - (notify_ack_msgBuilder*) toBuilder; + (notify_ack_msg*) parseFromData:(NSData*) data; + (notify_ack_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (notify_ack_msg*) parseFromInputStream:(NSInputStream*) input; + (notify_ack_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (notify_ack_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (notify_ack_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface notify_ack_msgBuilder : PBGeneratedMessageBuilder { @private notify_ack_msg* resultNotifyAckMsg; } - (notify_ack_msg*) defaultInstance; - (notify_ack_msgBuilder*) clear; - (notify_ack_msgBuilder*) clone; - (notify_ack_msg*) build; - (notify_ack_msg*) buildPartial; - (notify_ack_msgBuilder*) mergeFrom:(notify_ack_msg*) other; - (notify_ack_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (notify_ack_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTopic; - (NSString*) topic; - (notify_ack_msgBuilder*) setTopic:(NSString*) value; - (notify_ack_msgBuilder*) clearTopic; - (BOOL) hasMsgSeq; - (SInt64) msgSeq; - (notify_ack_msgBuilder*) setMsgSeq:(SInt64) value; - (notify_ack_msgBuilder*) clearMsgSeq; - (BOOL) hasUid; - (SInt64) uid; - (notify_ack_msgBuilder*) setUid:(SInt64) value; - (notify_ack_msgBuilder*) clearUid; @end #define common_update_notice_msg_ext_param @"extParam" @interface common_update_notice_msg : PBGeneratedMessage { @private NSMutableArray * extParamArray; } @property (readonly, strong) NSArray * extParam; - (ext_key_info*)extParamAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (common_update_notice_msgBuilder*) builder; + (common_update_notice_msgBuilder*) builder; + (common_update_notice_msgBuilder*) builderWithPrototype:(common_update_notice_msg*) prototype; - (common_update_notice_msgBuilder*) toBuilder; + (common_update_notice_msg*) parseFromData:(NSData*) data; + (common_update_notice_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (common_update_notice_msg*) parseFromInputStream:(NSInputStream*) input; + (common_update_notice_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (common_update_notice_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (common_update_notice_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface common_update_notice_msgBuilder : PBGeneratedMessageBuilder { @private common_update_notice_msg* resultCommonUpdateNoticeMsg; } - (common_update_notice_msg*) defaultInstance; - (common_update_notice_msgBuilder*) clear; - (common_update_notice_msgBuilder*) clone; - (common_update_notice_msg*) build; - (common_update_notice_msg*) buildPartial; - (common_update_notice_msgBuilder*) mergeFrom:(common_update_notice_msg*) other; - (common_update_notice_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (common_update_notice_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)extParam; - (ext_key_info*)extParamAtIndex:(NSUInteger)index; - (common_update_notice_msgBuilder *)addExtParam:(ext_key_info*)value; - (common_update_notice_msgBuilder *)setExtParamArray:(NSArray *)array; - (common_update_notice_msgBuilder *)clearExtParam; @end #define combo_private_msg_ack_seq @"ackSeq" #define combo_private_msg_msgs @"msgs" @interface combo_private_msg : PBGeneratedMessage { @private BOOL hasAckSeq_:1; SInt64 ackSeq; NSMutableArray * msgsArray; } - (BOOL) hasAckSeq; @property (readonly) SInt64 ackSeq; @property (readonly, strong) NSArray * msgs; - (common_update_notice_msg*)msgsAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (combo_private_msgBuilder*) builder; + (combo_private_msgBuilder*) builder; + (combo_private_msgBuilder*) builderWithPrototype:(combo_private_msg*) prototype; - (combo_private_msgBuilder*) toBuilder; + (combo_private_msg*) parseFromData:(NSData*) data; + (combo_private_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (combo_private_msg*) parseFromInputStream:(NSInputStream*) input; + (combo_private_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (combo_private_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (combo_private_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface combo_private_msgBuilder : PBGeneratedMessageBuilder { @private combo_private_msg* resultComboPrivateMsg; } - (combo_private_msg*) defaultInstance; - (combo_private_msgBuilder*) clear; - (combo_private_msgBuilder*) clone; - (combo_private_msg*) build; - (combo_private_msg*) buildPartial; - (combo_private_msgBuilder*) mergeFrom:(combo_private_msg*) other; - (combo_private_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (combo_private_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasAckSeq; - (SInt64) ackSeq; - (combo_private_msgBuilder*) setAckSeq:(SInt64) value; - (combo_private_msgBuilder*) clearAckSeq; - (NSMutableArray *)msgs; - (common_update_notice_msg*)msgsAtIndex:(NSUInteger)index; - (combo_private_msgBuilder *)addMsgs:(common_update_notice_msg*)value; - (combo_private_msgBuilder *)setMsgsArray:(NSArray *)array; - (combo_private_msgBuilder *)clearMsgs; @end #define rpc_msg_root_service @"service" #define rpc_msg_root_method @"method" #define rpc_msg_root_body @"body" #define rpc_msg_root_seq @"seq" #define rpc_msg_root_sid @"sid" #define rpc_msg_root_cid @"cid" #define rpc_msg_root_pub_sub @"pubSub" #define rpc_msg_root_need_auth_ctx @"needAuthCtx" #define rpc_msg_root_ext @"ext" @interface rpc_msg_root : PBGeneratedMessage { @private BOOL hasNeedAuthCtx_:1; BOOL hasPubSub_:1; BOOL hasBody_:1; BOOL hasSeq_:1; BOOL hasSid_:1; BOOL hasCid_:1; BOOL hasService_:1; BOOL hasMethod_:1; BOOL needAuthCtx_:1; NSString* pubSub; NSData* body; UInt32 seq; UInt32 sid; UInt32 cid; eum_rpc_service service; eum_method_type method; NSMutableArray * extArray; } - (BOOL) hasService; - (BOOL) hasMethod; - (BOOL) hasBody; - (BOOL) hasSeq; - (BOOL) hasSid; - (BOOL) hasCid; - (BOOL) hasPubSub; - (BOOL) hasNeedAuthCtx; @property (readonly) eum_rpc_service service; @property (readonly) eum_method_type method; @property (readonly, strong) NSData* body; @property (readonly) UInt32 seq; @property (readonly) UInt32 sid; @property (readonly) UInt32 cid; @property (readonly, strong) NSString* pubSub; - (BOOL) needAuthCtx; @property (readonly, strong) NSArray * ext; - (ext_key_info*)extAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (rpc_msg_rootBuilder*) builder; + (rpc_msg_rootBuilder*) builder; + (rpc_msg_rootBuilder*) builderWithPrototype:(rpc_msg_root*) prototype; - (rpc_msg_rootBuilder*) toBuilder; + (rpc_msg_root*) parseFromData:(NSData*) data; + (rpc_msg_root*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (rpc_msg_root*) parseFromInputStream:(NSInputStream*) input; + (rpc_msg_root*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (rpc_msg_root*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (rpc_msg_root*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface rpc_msg_rootBuilder : PBGeneratedMessageBuilder { @private rpc_msg_root* resultRpcMsgRoot; } - (rpc_msg_root*) defaultInstance; - (rpc_msg_rootBuilder*) clear; - (rpc_msg_rootBuilder*) clone; - (rpc_msg_root*) build; - (rpc_msg_root*) buildPartial; - (rpc_msg_rootBuilder*) mergeFrom:(rpc_msg_root*) other; - (rpc_msg_rootBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (rpc_msg_rootBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasService; - (eum_rpc_service) service; - (rpc_msg_rootBuilder*) setService:(eum_rpc_service) value; - (rpc_msg_rootBuilder*) clearService; - (BOOL) hasMethod; - (eum_method_type) method; - (rpc_msg_rootBuilder*) setMethod:(eum_method_type) value; - (rpc_msg_rootBuilder*) clearMethod; - (BOOL) hasBody; - (NSData*) body; - (rpc_msg_rootBuilder*) setBody:(NSData*) value; - (rpc_msg_rootBuilder*) clearBody; - (BOOL) hasSeq; - (UInt32) seq; - (rpc_msg_rootBuilder*) setSeq:(UInt32) value; - (rpc_msg_rootBuilder*) clearSeq; - (BOOL) hasSid; - (UInt32) sid; - (rpc_msg_rootBuilder*) setSid:(UInt32) value; - (rpc_msg_rootBuilder*) clearSid; - (BOOL) hasCid; - (UInt32) cid; - (rpc_msg_rootBuilder*) setCid:(UInt32) value; - (rpc_msg_rootBuilder*) clearCid; - (BOOL) hasPubSub; - (NSString*) pubSub; - (rpc_msg_rootBuilder*) setPubSub:(NSString*) value; - (rpc_msg_rootBuilder*) clearPubSub; - (BOOL) hasNeedAuthCtx; - (BOOL) needAuthCtx; - (rpc_msg_rootBuilder*) setNeedAuthCtx:(BOOL) value; - (rpc_msg_rootBuilder*) clearNeedAuthCtx; - (NSMutableArray *)ext; - (ext_key_info*)extAtIndex:(NSUInteger)index; - (rpc_msg_rootBuilder *)addExt:(ext_key_info*)value; - (rpc_msg_rootBuilder *)setExtArray:(NSArray *)array; - (rpc_msg_rootBuilder *)clearExt; @end #define common_reply_error_msg_org_type @"orgType" #define common_reply_error_msg_error @"error" @interface common_reply_error_msg : PBGeneratedMessage { @private BOOL hasError_:1; BOOL hasOrgType_:1; NSString* error; eum_method_type orgType; } - (BOOL) hasOrgType; - (BOOL) hasError; @property (readonly) eum_method_type orgType; @property (readonly, strong) NSString* error; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (common_reply_error_msgBuilder*) builder; + (common_reply_error_msgBuilder*) builder; + (common_reply_error_msgBuilder*) builderWithPrototype:(common_reply_error_msg*) prototype; - (common_reply_error_msgBuilder*) toBuilder; + (common_reply_error_msg*) parseFromData:(NSData*) data; + (common_reply_error_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (common_reply_error_msg*) parseFromInputStream:(NSInputStream*) input; + (common_reply_error_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (common_reply_error_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (common_reply_error_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface common_reply_error_msgBuilder : PBGeneratedMessageBuilder { @private common_reply_error_msg* resultCommonReplyErrorMsg; } - (common_reply_error_msg*) defaultInstance; - (common_reply_error_msgBuilder*) clear; - (common_reply_error_msgBuilder*) clone; - (common_reply_error_msg*) build; - (common_reply_error_msg*) buildPartial; - (common_reply_error_msgBuilder*) mergeFrom:(common_reply_error_msg*) other; - (common_reply_error_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (common_reply_error_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasOrgType; - (eum_method_type) orgType; - (common_reply_error_msgBuilder*) setOrgType:(eum_method_type) value; - (common_reply_error_msgBuilder*) clearOrgType; - (BOOL) hasError; - (NSString*) error; - (common_reply_error_msgBuilder*) setError:(NSString*) value; - (common_reply_error_msgBuilder*) clearError; @end #define load_dector_msg_Req @"req" #define load_dector_msg_load_factor @"loadFactor" #define load_dector_msg_connect_count @"connectCount" #define load_dector_msg_send_time @"sendTime" @interface load_dector_msg : PBGeneratedMessage { @private BOOL hasReq_:1; BOOL hasLoadFactor_:1; BOOL hasConnectCount_:1; BOOL hasSendTime_:1; BOOL req_:1; UInt32 loadFactor; UInt32 connectCount; UInt32 sendTime; } - (BOOL) hasReq; - (BOOL) hasLoadFactor; - (BOOL) hasConnectCount; - (BOOL) hasSendTime; - (BOOL) req; @property (readonly) UInt32 loadFactor; @property (readonly) UInt32 connectCount; @property (readonly) UInt32 sendTime; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (load_dector_msgBuilder*) builder; + (load_dector_msgBuilder*) builder; + (load_dector_msgBuilder*) builderWithPrototype:(load_dector_msg*) prototype; - (load_dector_msgBuilder*) toBuilder; + (load_dector_msg*) parseFromData:(NSData*) data; + (load_dector_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (load_dector_msg*) parseFromInputStream:(NSInputStream*) input; + (load_dector_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (load_dector_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (load_dector_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface load_dector_msgBuilder : PBGeneratedMessageBuilder { @private load_dector_msg* resultLoadDectorMsg; } - (load_dector_msg*) defaultInstance; - (load_dector_msgBuilder*) clear; - (load_dector_msgBuilder*) clone; - (load_dector_msg*) build; - (load_dector_msg*) buildPartial; - (load_dector_msgBuilder*) mergeFrom:(load_dector_msg*) other; - (load_dector_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (load_dector_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasReq; - (BOOL) req; - (load_dector_msgBuilder*) setReq:(BOOL) value; - (load_dector_msgBuilder*) clearReq; - (BOOL) hasLoadFactor; - (UInt32) loadFactor; - (load_dector_msgBuilder*) setLoadFactor:(UInt32) value; - (load_dector_msgBuilder*) clearLoadFactor; - (BOOL) hasConnectCount; - (UInt32) connectCount; - (load_dector_msgBuilder*) setConnectCount:(UInt32) value; - (load_dector_msgBuilder*) clearConnectCount; - (BOOL) hasSendTime; - (UInt32) sendTime; - (load_dector_msgBuilder*) setSendTime:(UInt32) value; - (load_dector_msgBuilder*) clearSendTime; @end #define server_login_msg_name @"name" #define server_login_msg_password @"password" @interface server_login_msg : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasPassword_:1; NSString* name; NSString* password; } - (BOOL) hasName; - (BOOL) hasPassword; @property (readonly, strong) NSString* name; @property (readonly, strong) NSString* password; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (server_login_msgBuilder*) builder; + (server_login_msgBuilder*) builder; + (server_login_msgBuilder*) builderWithPrototype:(server_login_msg*) prototype; - (server_login_msgBuilder*) toBuilder; + (server_login_msg*) parseFromData:(NSData*) data; + (server_login_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (server_login_msg*) parseFromInputStream:(NSInputStream*) input; + (server_login_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (server_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (server_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface server_login_msgBuilder : PBGeneratedMessageBuilder { @private server_login_msg* resultServerLoginMsg; } - (server_login_msg*) defaultInstance; - (server_login_msgBuilder*) clear; - (server_login_msgBuilder*) clone; - (server_login_msg*) build; - (server_login_msg*) buildPartial; - (server_login_msgBuilder*) mergeFrom:(server_login_msg*) other; - (server_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (server_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (server_login_msgBuilder*) setName:(NSString*) value; - (server_login_msgBuilder*) clearName; - (BOOL) hasPassword; - (NSString*) password; - (server_login_msgBuilder*) setPassword:(NSString*) value; - (server_login_msgBuilder*) clearPassword; @end #define server_login_result_msg_result @"result" @interface server_login_result_msg : PBGeneratedMessage { @private BOOL hasResult_:1; BOOL result_:1; } - (BOOL) hasResult; - (BOOL) result; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (server_login_result_msgBuilder*) builder; + (server_login_result_msgBuilder*) builder; + (server_login_result_msgBuilder*) builderWithPrototype:(server_login_result_msg*) prototype; - (server_login_result_msgBuilder*) toBuilder; + (server_login_result_msg*) parseFromData:(NSData*) data; + (server_login_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (server_login_result_msg*) parseFromInputStream:(NSInputStream*) input; + (server_login_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (server_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (server_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface server_login_result_msgBuilder : PBGeneratedMessageBuilder { @private server_login_result_msg* resultServerLoginResultMsg; } - (server_login_result_msg*) defaultInstance; - (server_login_result_msgBuilder*) clear; - (server_login_result_msgBuilder*) clone; - (server_login_result_msg*) build; - (server_login_result_msg*) buildPartial; - (server_login_result_msgBuilder*) mergeFrom:(server_login_result_msg*) other; - (server_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (server_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasResult; - (BOOL) result; - (server_login_result_msgBuilder*) setResult:(BOOL) value; - (server_login_result_msgBuilder*) clearResult; @end #define client_login_msg_name @"name" #define client_login_msg_password @"password" #define client_login_msg_bios @"bios" #define client_login_msg_mac @"mac" #define client_login_msg_hdd @"hdd" #define client_login_msg_cpu @"cpu" #define client_login_msg_ip @"ip" #define client_login_msg_ltype @"ltype" #define client_login_msg_sid @"sid" #define client_login_msg_cid @"cid" @interface client_login_msg : PBGeneratedMessage { @private BOOL hasName_:1; BOOL hasPassword_:1; BOOL hasBios_:1; BOOL hasMac_:1; BOOL hasHdd_:1; BOOL hasCpu_:1; BOOL hasIp_:1; BOOL hasSid_:1; BOOL hasCid_:1; BOOL hasLtype_:1; NSString* name; NSString* password; NSString* bios; NSString* mac; NSString* hdd; NSString* cpu; NSString* ip; UInt32 sid; UInt32 cid; client_login_msglogin_type ltype; } - (BOOL) hasName; - (BOOL) hasPassword; - (BOOL) hasBios; - (BOOL) hasMac; - (BOOL) hasHdd; - (BOOL) hasCpu; - (BOOL) hasIp; - (BOOL) hasLtype; - (BOOL) hasSid; - (BOOL) hasCid; @property (readonly, strong) NSString* name; @property (readonly, strong) NSString* password; @property (readonly, strong) NSString* bios; @property (readonly, strong) NSString* mac; @property (readonly, strong) NSString* hdd; @property (readonly, strong) NSString* cpu; @property (readonly, strong) NSString* ip; @property (readonly) client_login_msglogin_type ltype; @property (readonly) UInt32 sid; @property (readonly) UInt32 cid; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (client_login_msgBuilder*) builder; + (client_login_msgBuilder*) builder; + (client_login_msgBuilder*) builderWithPrototype:(client_login_msg*) prototype; - (client_login_msgBuilder*) toBuilder; + (client_login_msg*) parseFromData:(NSData*) data; + (client_login_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_login_msg*) parseFromInputStream:(NSInputStream*) input; + (client_login_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (client_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface client_login_msgBuilder : PBGeneratedMessageBuilder { @private client_login_msg* resultClientLoginMsg; } - (client_login_msg*) defaultInstance; - (client_login_msgBuilder*) clear; - (client_login_msgBuilder*) clone; - (client_login_msg*) build; - (client_login_msg*) buildPartial; - (client_login_msgBuilder*) mergeFrom:(client_login_msg*) other; - (client_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (client_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (NSString*) name; - (client_login_msgBuilder*) setName:(NSString*) value; - (client_login_msgBuilder*) clearName; - (BOOL) hasPassword; - (NSString*) password; - (client_login_msgBuilder*) setPassword:(NSString*) value; - (client_login_msgBuilder*) clearPassword; - (BOOL) hasBios; - (NSString*) bios; - (client_login_msgBuilder*) setBios:(NSString*) value; - (client_login_msgBuilder*) clearBios; - (BOOL) hasMac; - (NSString*) mac; - (client_login_msgBuilder*) setMac:(NSString*) value; - (client_login_msgBuilder*) clearMac; - (BOOL) hasHdd; - (NSString*) hdd; - (client_login_msgBuilder*) setHdd:(NSString*) value; - (client_login_msgBuilder*) clearHdd; - (BOOL) hasCpu; - (NSString*) cpu; - (client_login_msgBuilder*) setCpu:(NSString*) value; - (client_login_msgBuilder*) clearCpu; - (BOOL) hasIp; - (NSString*) ip; - (client_login_msgBuilder*) setIp:(NSString*) value; - (client_login_msgBuilder*) clearIp; - (BOOL) hasLtype; - (client_login_msglogin_type) ltype; - (client_login_msgBuilder*) setLtype:(client_login_msglogin_type) value; - (client_login_msgBuilder*) clearLtype; - (BOOL) hasSid; - (UInt32) sid; - (client_login_msgBuilder*) setSid:(UInt32) value; - (client_login_msgBuilder*) clearSid; - (BOOL) hasCid; - (UInt32) cid; - (client_login_msgBuilder*) setCid:(UInt32) value; - (client_login_msgBuilder*) clearCid; @end #define auth_ctx_msg_auth_services @"authServices" #define auth_ctx_msg_topics @"topics" #define auth_ctx_msg_ext @"ext" @interface auth_ctx_msg : PBGeneratedMessage { @private NSMutableArray * topicsArray; NSMutableArray * extArray; PBAppendableArray * authServicesArray; } @property (readonly, strong) PBArray * authServices; @property (readonly, strong) NSArray * topics; @property (readonly, strong) NSArray * ext; - (eum_rpc_service)authServicesAtIndex:(NSUInteger)index; - (subcribe_msg*)topicsAtIndex:(NSUInteger)index; - (ext_key_info*)extAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (auth_ctx_msgBuilder*) builder; + (auth_ctx_msgBuilder*) builder; + (auth_ctx_msgBuilder*) builderWithPrototype:(auth_ctx_msg*) prototype; - (auth_ctx_msgBuilder*) toBuilder; + (auth_ctx_msg*) parseFromData:(NSData*) data; + (auth_ctx_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_ctx_msg*) parseFromInputStream:(NSInputStream*) input; + (auth_ctx_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (auth_ctx_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (auth_ctx_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface auth_ctx_msgBuilder : PBGeneratedMessageBuilder { @private auth_ctx_msg* resultAuthCtxMsg; } - (auth_ctx_msg*) defaultInstance; - (auth_ctx_msgBuilder*) clear; - (auth_ctx_msgBuilder*) clone; - (auth_ctx_msg*) build; - (auth_ctx_msg*) buildPartial; - (auth_ctx_msgBuilder*) mergeFrom:(auth_ctx_msg*) other; - (auth_ctx_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (auth_ctx_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (PBAppendableArray *)authServices; - (eum_rpc_service)authServicesAtIndex:(NSUInteger)index; - (auth_ctx_msgBuilder *)addAuthServices:(eum_rpc_service)value; - (auth_ctx_msgBuilder *)setAuthServicesArray:(NSArray *)array; - (auth_ctx_msgBuilder *)setAuthServicesValues:(const eum_rpc_service *)values count:(NSUInteger)count; - (auth_ctx_msgBuilder *)clearAuthServices; - (NSMutableArray *)topics; - (subcribe_msg*)topicsAtIndex:(NSUInteger)index; - (auth_ctx_msgBuilder *)addTopics:(subcribe_msg*)value; - (auth_ctx_msgBuilder *)setTopicsArray:(NSArray *)array; - (auth_ctx_msgBuilder *)clearTopics; - (NSMutableArray *)ext; - (ext_key_info*)extAtIndex:(NSUInteger)index; - (auth_ctx_msgBuilder *)addExt:(ext_key_info*)value; - (auth_ctx_msgBuilder *)setExtArray:(NSArray *)array; - (auth_ctx_msgBuilder *)clearExt; @end #define client_login_result_msg_result @"result" #define client_login_result_msg_msg @"msg" #define client_login_result_msg_ext @"ext" #define client_login_result_msg_ltype @"ltype" #define client_login_result_msg_sid @"sid" #define client_login_result_msg_cid @"cid" #define client_login_result_msg_auths @"auths" @interface client_login_result_msg : PBGeneratedMessage { @private BOOL hasResult_:1; BOOL hasLtype_:1; BOOL hasMsg_:1; BOOL hasAuths_:1; BOOL hasSid_:1; BOOL hasCid_:1; BOOL result_:1; SInt32 ltype; NSString* msg; auth_ctx_msg* auths; UInt32 sid; UInt32 cid; NSMutableArray * extArray; } - (BOOL) hasResult; - (BOOL) hasMsg; - (BOOL) hasLtype; - (BOOL) hasSid; - (BOOL) hasCid; - (BOOL) hasAuths; - (BOOL) result; @property (readonly, strong) NSString* msg; @property (readonly, strong) NSArray * ext; @property (readonly) SInt32 ltype; @property (readonly) UInt32 sid; @property (readonly) UInt32 cid; @property (readonly, strong) auth_ctx_msg* auths; - (ext_key_info*)extAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (client_login_result_msgBuilder*) builder; + (client_login_result_msgBuilder*) builder; + (client_login_result_msgBuilder*) builderWithPrototype:(client_login_result_msg*) prototype; - (client_login_result_msgBuilder*) toBuilder; + (client_login_result_msg*) parseFromData:(NSData*) data; + (client_login_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_login_result_msg*) parseFromInputStream:(NSInputStream*) input; + (client_login_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (client_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface client_login_result_msgBuilder : PBGeneratedMessageBuilder { @private client_login_result_msg* resultClientLoginResultMsg; } - (client_login_result_msg*) defaultInstance; - (client_login_result_msgBuilder*) clear; - (client_login_result_msgBuilder*) clone; - (client_login_result_msg*) build; - (client_login_result_msg*) buildPartial; - (client_login_result_msgBuilder*) mergeFrom:(client_login_result_msg*) other; - (client_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (client_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasResult; - (BOOL) result; - (client_login_result_msgBuilder*) setResult:(BOOL) value; - (client_login_result_msgBuilder*) clearResult; - (BOOL) hasMsg; - (NSString*) msg; - (client_login_result_msgBuilder*) setMsg:(NSString*) value; - (client_login_result_msgBuilder*) clearMsg; - (NSMutableArray *)ext; - (ext_key_info*)extAtIndex:(NSUInteger)index; - (client_login_result_msgBuilder *)addExt:(ext_key_info*)value; - (client_login_result_msgBuilder *)setExtArray:(NSArray *)array; - (client_login_result_msgBuilder *)clearExt; - (BOOL) hasLtype; - (SInt32) ltype; - (client_login_result_msgBuilder*) setLtype:(SInt32) value; - (client_login_result_msgBuilder*) clearLtype; - (BOOL) hasSid; - (UInt32) sid; - (client_login_result_msgBuilder*) setSid:(UInt32) value; - (client_login_result_msgBuilder*) clearSid; - (BOOL) hasCid; - (UInt32) cid; - (client_login_result_msgBuilder*) setCid:(UInt32) value; - (client_login_result_msgBuilder*) clearCid; - (BOOL) hasAuths; - (auth_ctx_msg*) auths; - (client_login_result_msgBuilder*) setAuths:(auth_ctx_msg*) value; - (client_login_result_msgBuilder*) setAuthsBuilder:(auth_ctx_msgBuilder*) builderForValue; - (client_login_result_msgBuilder*) mergeAuths:(auth_ctx_msg*) value; - (client_login_result_msgBuilder*) clearAuths; @end #define time_range_selector_begin @"begin" #define time_range_selector_end @"end" @interface time_range_selector : PBGeneratedMessage { @private BOOL hasBegin_:1; BOOL hasEnd_:1; UInt32 begin; UInt32 end; } - (BOOL) hasBegin; - (BOOL) hasEnd; @property (readonly) UInt32 begin; @property (readonly) UInt32 end; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (time_range_selectorBuilder*) builder; + (time_range_selectorBuilder*) builder; + (time_range_selectorBuilder*) builderWithPrototype:(time_range_selector*) prototype; - (time_range_selectorBuilder*) toBuilder; + (time_range_selector*) parseFromData:(NSData*) data; + (time_range_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (time_range_selector*) parseFromInputStream:(NSInputStream*) input; + (time_range_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (time_range_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (time_range_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface time_range_selectorBuilder : PBGeneratedMessageBuilder { @private time_range_selector* resultTimeRangeSelector; } - (time_range_selector*) defaultInstance; - (time_range_selectorBuilder*) clear; - (time_range_selectorBuilder*) clone; - (time_range_selector*) build; - (time_range_selector*) buildPartial; - (time_range_selectorBuilder*) mergeFrom:(time_range_selector*) other; - (time_range_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (time_range_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasBegin; - (UInt32) begin; - (time_range_selectorBuilder*) setBegin:(UInt32) value; - (time_range_selectorBuilder*) clearBegin; - (BOOL) hasEnd; - (UInt32) end; - (time_range_selectorBuilder*) setEnd:(UInt32) value; - (time_range_selectorBuilder*) clearEnd; @end #define count_offset_selector_offset @"offset" #define count_offset_selector_count @"count" @interface count_offset_selector : PBGeneratedMessage { @private BOOL hasCount_:1; BOOL hasOffset_:1; SInt32 count; UInt32 offset; } - (BOOL) hasOffset; - (BOOL) hasCount; @property (readonly) UInt32 offset; @property (readonly) SInt32 count; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (count_offset_selectorBuilder*) builder; + (count_offset_selectorBuilder*) builder; + (count_offset_selectorBuilder*) builderWithPrototype:(count_offset_selector*) prototype; - (count_offset_selectorBuilder*) toBuilder; + (count_offset_selector*) parseFromData:(NSData*) data; + (count_offset_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (count_offset_selector*) parseFromInputStream:(NSInputStream*) input; + (count_offset_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (count_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (count_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface count_offset_selectorBuilder : PBGeneratedMessageBuilder { @private count_offset_selector* resultCountOffsetSelector; } - (count_offset_selector*) defaultInstance; - (count_offset_selectorBuilder*) clear; - (count_offset_selectorBuilder*) clone; - (count_offset_selector*) build; - (count_offset_selector*) buildPartial; - (count_offset_selectorBuilder*) mergeFrom:(count_offset_selector*) other; - (count_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (count_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasOffset; - (UInt32) offset; - (count_offset_selectorBuilder*) setOffset:(UInt32) value; - (count_offset_selectorBuilder*) clearOffset; - (BOOL) hasCount; - (SInt32) count; - (count_offset_selectorBuilder*) setCount:(SInt32) value; - (count_offset_selectorBuilder*) clearCount; @end #define time_offset_selector_origin_time @"originTime" #define time_offset_selector_count @"count" @interface time_offset_selector : PBGeneratedMessage { @private BOOL hasCount_:1; BOOL hasOriginTime_:1; SInt32 count; UInt32 originTime; } - (BOOL) hasOriginTime; - (BOOL) hasCount; @property (readonly) UInt32 originTime; @property (readonly) SInt32 count; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (time_offset_selectorBuilder*) builder; + (time_offset_selectorBuilder*) builder; + (time_offset_selectorBuilder*) builderWithPrototype:(time_offset_selector*) prototype; - (time_offset_selectorBuilder*) toBuilder; + (time_offset_selector*) parseFromData:(NSData*) data; + (time_offset_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (time_offset_selector*) parseFromInputStream:(NSInputStream*) input; + (time_offset_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (time_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (time_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface time_offset_selectorBuilder : PBGeneratedMessageBuilder { @private time_offset_selector* resultTimeOffsetSelector; } - (time_offset_selector*) defaultInstance; - (time_offset_selectorBuilder*) clear; - (time_offset_selectorBuilder*) clone; - (time_offset_selector*) build; - (time_offset_selector*) buildPartial; - (time_offset_selectorBuilder*) mergeFrom:(time_offset_selector*) other; - (time_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (time_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasOriginTime; - (UInt32) originTime; - (time_offset_selectorBuilder*) setOriginTime:(UInt32) value; - (time_offset_selectorBuilder*) clearOriginTime; - (BOOL) hasCount; - (SInt32) count; - (time_offset_selectorBuilder*) setCount:(SInt32) value; - (time_offset_selectorBuilder*) clearCount; @end #define data_selector_selector_type @"selectorType" #define data_selector_selector @"selector" @interface data_selector : PBGeneratedMessage { @private BOOL hasSelector_:1; BOOL hasSelectorType_:1; NSData* selector; UInt32 selectorType; } - (BOOL) hasSelectorType; - (BOOL) hasSelector; @property (readonly) UInt32 selectorType; @property (readonly, strong) NSData* selector; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (data_selectorBuilder*) builder; + (data_selectorBuilder*) builder; + (data_selectorBuilder*) builderWithPrototype:(data_selector*) prototype; - (data_selectorBuilder*) toBuilder; + (data_selector*) parseFromData:(NSData*) data; + (data_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (data_selector*) parseFromInputStream:(NSInputStream*) input; + (data_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (data_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (data_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface data_selectorBuilder : PBGeneratedMessageBuilder { @private data_selector* resultDataSelector; } - (data_selector*) defaultInstance; - (data_selectorBuilder*) clear; - (data_selectorBuilder*) clone; - (data_selector*) build; - (data_selector*) buildPartial; - (data_selectorBuilder*) mergeFrom:(data_selector*) other; - (data_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (data_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasSelectorType; - (UInt32) selectorType; - (data_selectorBuilder*) setSelectorType:(UInt32) value; - (data_selectorBuilder*) clearSelectorType; - (BOOL) hasSelector; - (NSData*) selector; - (data_selectorBuilder*) setSelector:(NSData*) value; - (data_selectorBuilder*) clearSelector; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Common.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Common.pb.h" // @@protoc_insertion_point(imports) @implementation CommonRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [CommonRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end BOOL eum_method_typeIsValidValue(eum_method_type value) { switch (value) { case eum_method_typeCommonErrorRep: case eum_method_typeLoadDetector: case eum_method_typeServerLogin: case eum_method_typeServerLoginRet: case eum_method_typeClientLogin: case eum_method_typeClientLoginRet: case eum_method_typeLoginConflict: case eum_method_typeIndexRequest: case eum_method_typeIndexResult: case eum_method_typeIndexComboResult: case eum_method_typeErrorFeedback: case eum_method_typeSubcribeTopic: case eum_method_typeUnsubcribeTopic: case eum_method_typePublicTopic: case eum_method_typeIndexDataRequest: case eum_method_typeIndexDataResult: case eum_method_typeRiseDropRequest: case eum_method_typeRiseDropResult: case eum_method_typeTgRStockPool: case eum_method_typeTgRMsgBox: case eum_method_typeReportReportRequest: case eum_method_typeReportReportResult: case eum_method_typeReportLargedealRequest: case eum_method_typeReportLargedealResult: case eum_method_typeReportMinuteRequest: case eum_method_typeReportMinuteResult: case eum_method_typeReportKlineRequest: case eum_method_typeReportKlineResult: case eum_method_typeReportSearchStockRequest: case eum_method_typeReportSearchStockResult: case eum_method_typeReportBoardreportRequest: case eum_method_typeReportBoardreportResult: case eum_method_typeReportBidDealRequest: case eum_method_typeReportBidDealResult: case eum_method_typeReportLastOpenDayRequest: case eum_method_typeReportLastOpenDayResult: case eum_method_typeReportBoardreportOptionalRequest: case eum_method_typeReportBoardreportOptionalResult: case eum_method_typeReportBoardreportTopRequest: case eum_method_typeReportBoardreportTopResult: case eum_method_typeWarningWarningConfigRequest: case eum_method_typeWarningWarningConfigResult: case eum_method_typeWarningWarningUserAllStockStatusRequest: case eum_method_typeWarningWarningUserAllStockStatusResult: case eum_method_typeWarningSetWarningConfigRequest: case eum_method_typeWarningSetWarningConfigResult: case eum_method_typeWarningDeleteUserStockWarningConfigRequest: case eum_method_typeWarningDeleteUserStockWarningConfigResult: case eum_method_typeReportIndexKeepRequest: case eum_method_typeReportIndexKeepResult: case eum_method_typeReportBlockRelationRequest: case eum_method_typeReportBlockRelationResult: case eum_method_typeWarningGetUserStockWarningRecordRequest: case eum_method_typeWarningGetUserStockWarningRecordResult: case eum_method_typeReportCodeNameRequest: case eum_method_typeReportCodeNameResult: case eum_method_typeEumSyncNotify: case eum_method_typeEumPushNotify: case eum_method_typeEumPushAck: case eum_method_typeEumComboPrivateNotify: case eum_method_typeEumAuthKickUser: case eum_method_typeEumAuthUserOffline: case eum_method_typeEumAuthUserInfoReq: case eum_method_typeEumAuthUserInfoRep: case eum_method_typeEumMethodEnd: return YES; default: return NO; } } NSString *NSStringFromeum_method_type(eum_method_type value) { switch (value) { case eum_method_typeCommonErrorRep: return @"eum_method_typeCommonErrorRep"; case eum_method_typeLoadDetector: return @"eum_method_typeLoadDetector"; case eum_method_typeServerLogin: return @"eum_method_typeServerLogin"; case eum_method_typeServerLoginRet: return @"eum_method_typeServerLoginRet"; case eum_method_typeClientLogin: return @"eum_method_typeClientLogin"; case eum_method_typeClientLoginRet: return @"eum_method_typeClientLoginRet"; case eum_method_typeLoginConflict: return @"eum_method_typeLoginConflict"; case eum_method_typeIndexRequest: return @"eum_method_typeIndexRequest"; case eum_method_typeIndexResult: return @"eum_method_typeIndexResult"; case eum_method_typeIndexComboResult: return @"eum_method_typeIndexComboResult"; case eum_method_typeErrorFeedback: return @"eum_method_typeErrorFeedback"; case eum_method_typeSubcribeTopic: return @"eum_method_typeSubcribeTopic"; case eum_method_typeUnsubcribeTopic: return @"eum_method_typeUnsubcribeTopic"; case eum_method_typePublicTopic: return @"eum_method_typePublicTopic"; case eum_method_typeIndexDataRequest: return @"eum_method_typeIndexDataRequest"; case eum_method_typeIndexDataResult: return @"eum_method_typeIndexDataResult"; case eum_method_typeRiseDropRequest: return @"eum_method_typeRiseDropRequest"; case eum_method_typeRiseDropResult: return @"eum_method_typeRiseDropResult"; case eum_method_typeTgRStockPool: return @"eum_method_typeTgRStockPool"; case eum_method_typeTgRMsgBox: return @"eum_method_typeTgRMsgBox"; case eum_method_typeReportReportRequest: return @"eum_method_typeReportReportRequest"; case eum_method_typeReportReportResult: return @"eum_method_typeReportReportResult"; case eum_method_typeReportLargedealRequest: return @"eum_method_typeReportLargedealRequest"; case eum_method_typeReportLargedealResult: return @"eum_method_typeReportLargedealResult"; case eum_method_typeReportMinuteRequest: return @"eum_method_typeReportMinuteRequest"; case eum_method_typeReportMinuteResult: return @"eum_method_typeReportMinuteResult"; case eum_method_typeReportKlineRequest: return @"eum_method_typeReportKlineRequest"; case eum_method_typeReportKlineResult: return @"eum_method_typeReportKlineResult"; case eum_method_typeReportSearchStockRequest: return @"eum_method_typeReportSearchStockRequest"; case eum_method_typeReportSearchStockResult: return @"eum_method_typeReportSearchStockResult"; case eum_method_typeReportBoardreportRequest: return @"eum_method_typeReportBoardreportRequest"; case eum_method_typeReportBoardreportResult: return @"eum_method_typeReportBoardreportResult"; case eum_method_typeReportBidDealRequest: return @"eum_method_typeReportBidDealRequest"; case eum_method_typeReportBidDealResult: return @"eum_method_typeReportBidDealResult"; case eum_method_typeReportLastOpenDayRequest: return @"eum_method_typeReportLastOpenDayRequest"; case eum_method_typeReportLastOpenDayResult: return @"eum_method_typeReportLastOpenDayResult"; case eum_method_typeReportBoardreportOptionalRequest: return @"eum_method_typeReportBoardreportOptionalRequest"; case eum_method_typeReportBoardreportOptionalResult: return @"eum_method_typeReportBoardreportOptionalResult"; case eum_method_typeReportBoardreportTopRequest: return @"eum_method_typeReportBoardreportTopRequest"; case eum_method_typeReportBoardreportTopResult: return @"eum_method_typeReportBoardreportTopResult"; case eum_method_typeWarningWarningConfigRequest: return @"eum_method_typeWarningWarningConfigRequest"; case eum_method_typeWarningWarningConfigResult: return @"eum_method_typeWarningWarningConfigResult"; case eum_method_typeWarningWarningUserAllStockStatusRequest: return @"eum_method_typeWarningWarningUserAllStockStatusRequest"; case eum_method_typeWarningWarningUserAllStockStatusResult: return @"eum_method_typeWarningWarningUserAllStockStatusResult"; case eum_method_typeWarningSetWarningConfigRequest: return @"eum_method_typeWarningSetWarningConfigRequest"; case eum_method_typeWarningSetWarningConfigResult: return @"eum_method_typeWarningSetWarningConfigResult"; case eum_method_typeWarningDeleteUserStockWarningConfigRequest: return @"eum_method_typeWarningDeleteUserStockWarningConfigRequest"; case eum_method_typeWarningDeleteUserStockWarningConfigResult: return @"eum_method_typeWarningDeleteUserStockWarningConfigResult"; case eum_method_typeReportIndexKeepRequest: return @"eum_method_typeReportIndexKeepRequest"; case eum_method_typeReportIndexKeepResult: return @"eum_method_typeReportIndexKeepResult"; case eum_method_typeReportBlockRelationRequest: return @"eum_method_typeReportBlockRelationRequest"; case eum_method_typeReportBlockRelationResult: return @"eum_method_typeReportBlockRelationResult"; case eum_method_typeWarningGetUserStockWarningRecordRequest: return @"eum_method_typeWarningGetUserStockWarningRecordRequest"; case eum_method_typeWarningGetUserStockWarningRecordResult: return @"eum_method_typeWarningGetUserStockWarningRecordResult"; case eum_method_typeReportCodeNameRequest: return @"eum_method_typeReportCodeNameRequest"; case eum_method_typeReportCodeNameResult: return @"eum_method_typeReportCodeNameResult"; case eum_method_typeEumSyncNotify: return @"eum_method_typeEumSyncNotify"; case eum_method_typeEumPushNotify: return @"eum_method_typeEumPushNotify"; case eum_method_typeEumPushAck: return @"eum_method_typeEumPushAck"; case eum_method_typeEumComboPrivateNotify: return @"eum_method_typeEumComboPrivateNotify"; case eum_method_typeEumAuthKickUser: return @"eum_method_typeEumAuthKickUser"; case eum_method_typeEumAuthUserOffline: return @"eum_method_typeEumAuthUserOffline"; case eum_method_typeEumAuthUserInfoReq: return @"eum_method_typeEumAuthUserInfoReq"; case eum_method_typeEumAuthUserInfoRep: return @"eum_method_typeEumAuthUserInfoRep"; case eum_method_typeEumMethodEnd: return @"eum_method_typeEumMethodEnd"; default: return nil; } } BOOL eum_rpc_serviceIsValidValue(eum_rpc_service value) { switch (value) { case eum_rpc_serviceCommonService: case eum_rpc_serviceReportService: case eum_rpc_serviceIndexService: case eum_rpc_serviceInvestmentService: case eum_rpc_serviceWarningService: case eum_rpc_serviceEumServiceEnd: return YES; default: return NO; } } NSString *NSStringFromeum_rpc_service(eum_rpc_service value) { switch (value) { case eum_rpc_serviceCommonService: return @"eum_rpc_serviceCommonService"; case eum_rpc_serviceReportService: return @"eum_rpc_serviceReportService"; case eum_rpc_serviceIndexService: return @"eum_rpc_serviceIndexService"; case eum_rpc_serviceInvestmentService: return @"eum_rpc_serviceInvestmentService"; case eum_rpc_serviceWarningService: return @"eum_rpc_serviceWarningService"; case eum_rpc_serviceEumServiceEnd: return @"eum_rpc_serviceEumServiceEnd"; default: return nil; } } BOOL eum_nofity_typeIsValidValue(eum_nofity_type value) { switch (value) { case eum_nofity_typeTgStockInPoolNotify: case eum_nofity_typeTgStockOutPoolNotify: case eum_nofity_typeTgStockModifyTargetNofity: case eum_nofity_typeTgStockModifyStopNodify: case eum_nofity_typeTgStockBuyNodify: case eum_nofity_typeTgStockProfitSellNofity: case eum_nofity_typeTgStockStopLossNofity: case eum_nofity_typeTgFocusNews: case eum_nofity_typeTgTrailerAndNotice: case eum_nofity_typeCommonUpdateNotice: case eum_nofity_typeIndexStockWarningNotice: case eum_nofity_typeReportMarketStatusNotify: return YES; default: return NO; } } NSString *NSStringFromeum_nofity_type(eum_nofity_type value) { switch (value) { case eum_nofity_typeTgStockInPoolNotify: return @"eum_nofity_typeTgStockInPoolNotify"; case eum_nofity_typeTgStockOutPoolNotify: return @"eum_nofity_typeTgStockOutPoolNotify"; case eum_nofity_typeTgStockModifyTargetNofity: return @"eum_nofity_typeTgStockModifyTargetNofity"; case eum_nofity_typeTgStockModifyStopNodify: return @"eum_nofity_typeTgStockModifyStopNodify"; case eum_nofity_typeTgStockBuyNodify: return @"eum_nofity_typeTgStockBuyNodify"; case eum_nofity_typeTgStockProfitSellNofity: return @"eum_nofity_typeTgStockProfitSellNofity"; case eum_nofity_typeTgStockStopLossNofity: return @"eum_nofity_typeTgStockStopLossNofity"; case eum_nofity_typeTgFocusNews: return @"eum_nofity_typeTgFocusNews"; case eum_nofity_typeTgTrailerAndNotice: return @"eum_nofity_typeTgTrailerAndNotice"; case eum_nofity_typeCommonUpdateNotice: return @"eum_nofity_typeCommonUpdateNotice"; case eum_nofity_typeIndexStockWarningNotice: return @"eum_nofity_typeIndexStockWarningNotice"; case eum_nofity_typeReportMarketStatusNotify: return @"eum_nofity_typeReportMarketStatusNotify"; default: return nil; } } @interface ext_key_info () @property (strong) NSString* key; @property (strong) NSString* value; @end @implementation ext_key_info - (BOOL) hasKey { return !!hasKey_; } - (void) setHasKey:(BOOL) _value_ { hasKey_ = !!_value_; } @synthesize key; - (BOOL) hasValue { return !!hasValue_; } - (void) setHasValue:(BOOL) _value_ { hasValue_ = !!_value_; } @synthesize value; - (instancetype) init { if ((self = [super init])) { self.key = @""; self.value = @""; } return self; } static ext_key_info* defaultext_key_infoInstance = nil; + (void) initialize { if (self == [ext_key_info class]) { defaultext_key_infoInstance = [[ext_key_info alloc] init]; } } + (instancetype) defaultInstance { return defaultext_key_infoInstance; } - (instancetype) defaultInstance { return defaultext_key_infoInstance; } - (BOOL) isInitialized { if (!self.hasKey) { return NO; } if (!self.hasValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasKey) { [output writeString:1 value:self.key]; } if (self.hasValue) { [output writeString:2 value:self.value]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasKey) { size_ += computeStringSize(1, self.key); } if (self.hasValue) { size_ += computeStringSize(2, self.value); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ext_key_info*) parseFromData:(NSData*) data { return (ext_key_info*)[[[ext_key_info builder] mergeFromData:data] build]; } + (ext_key_info*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ext_key_info*)[[[ext_key_info builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ext_key_info*) parseFromInputStream:(NSInputStream*) input { return (ext_key_info*)[[[ext_key_info builder] mergeFromInputStream:input] build]; } + (ext_key_info*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ext_key_info*)[[[ext_key_info builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ext_key_info*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ext_key_info*)[[[ext_key_info builder] mergeFromCodedInputStream:input] build]; } + (ext_key_info*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ext_key_info*)[[[ext_key_info builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (ext_key_infoBuilder*) builder { return [[ext_key_infoBuilder alloc] init]; } + (ext_key_infoBuilder*) builderWithPrototype:(ext_key_info*) prototype { return [[ext_key_info builder] mergeFrom:prototype]; } - (ext_key_infoBuilder*) builder { return [ext_key_info builder]; } - (ext_key_infoBuilder*) toBuilder { return [ext_key_info builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasKey) { [output appendFormat:@"%@%@: %@\n", indent, @"key", self.key]; } if (self.hasValue) { [output appendFormat:@"%@%@: %@\n", indent, @"value", self.value]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasKey) { [dictionary setObject: self.key forKey: @"key"]; } if (self.hasValue) { [dictionary setObject: self.value forKey: @"value"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[ext_key_info class]]) { return NO; } ext_key_info *otherMessage = other; return self.hasKey == otherMessage.hasKey && (!self.hasKey || [self.key isEqual:otherMessage.key]) && self.hasValue == otherMessage.hasValue && (!self.hasValue || [self.value isEqual:otherMessage.value]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasKey) { hashCode = hashCode * 31 + [self.key hash]; } if (self.hasValue) { hashCode = hashCode * 31 + [self.value hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface ext_key_infoBuilder() @property (strong) ext_key_info* resultExtKeyInfo; @end @implementation ext_key_infoBuilder @synthesize resultExtKeyInfo; - (instancetype) init { if ((self = [super init])) { self.resultExtKeyInfo = [[ext_key_info alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultExtKeyInfo; } - (ext_key_infoBuilder*) clear { self.resultExtKeyInfo = [[ext_key_info alloc] init]; return self; } - (ext_key_infoBuilder*) clone { return [ext_key_info builderWithPrototype:resultExtKeyInfo]; } - (ext_key_info*) defaultInstance { return [ext_key_info defaultInstance]; } - (ext_key_info*) build { [self checkInitialized]; return [self buildPartial]; } - (ext_key_info*) buildPartial { ext_key_info* returnMe = resultExtKeyInfo; self.resultExtKeyInfo = nil; return returnMe; } - (ext_key_infoBuilder*) mergeFrom:(ext_key_info*) other { if (other == [ext_key_info defaultInstance]) { return self; } if (other.hasKey) { [self setKey:other.key]; } if (other.hasValue) { [self setValue:other.value]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (ext_key_infoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (ext_key_infoBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setKey:[input readString]]; break; } case 18: { [self setValue:[input readString]]; break; } } } } - (BOOL) hasKey { return resultExtKeyInfo.hasKey; } - (NSString*) key { return resultExtKeyInfo.key; } - (ext_key_infoBuilder*) setKey:(NSString*) value { resultExtKeyInfo.hasKey = YES; resultExtKeyInfo.key = value; return self; } - (ext_key_infoBuilder*) clearKey { resultExtKeyInfo.hasKey = NO; resultExtKeyInfo.key = @""; return self; } - (BOOL) hasValue { return resultExtKeyInfo.hasValue; } - (NSString*) value { return resultExtKeyInfo.value; } - (ext_key_infoBuilder*) setValue:(NSString*) value { resultExtKeyInfo.hasValue = YES; resultExtKeyInfo.value = value; return self; } - (ext_key_infoBuilder*) clearValue { resultExtKeyInfo.hasValue = NO; resultExtKeyInfo.value = @""; return self; } @end @interface subcribe_msg () @property eum_rpc_service serviceType; @property (strong) NSString* topic; @end @implementation subcribe_msg - (BOOL) hasServiceType { return !!hasServiceType_; } - (void) setHasServiceType:(BOOL) _value_ { hasServiceType_ = !!_value_; } @synthesize serviceType; - (BOOL) hasTopic { return !!hasTopic_; } - (void) setHasTopic:(BOOL) _value_ { hasTopic_ = !!_value_; } @synthesize topic; - (instancetype) init { if ((self = [super init])) { self.serviceType = eum_rpc_serviceCommonService; self.topic = @""; } return self; } static subcribe_msg* defaultsubcribe_msgInstance = nil; + (void) initialize { if (self == [subcribe_msg class]) { defaultsubcribe_msgInstance = [[subcribe_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultsubcribe_msgInstance; } - (instancetype) defaultInstance { return defaultsubcribe_msgInstance; } - (BOOL) isInitialized { if (!self.hasServiceType) { return NO; } if (!self.hasTopic) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasServiceType) { [output writeEnum:1 value:self.serviceType]; } if (self.hasTopic) { [output writeString:2 value:self.topic]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasServiceType) { size_ += computeEnumSize(1, self.serviceType); } if (self.hasTopic) { size_ += computeStringSize(2, self.topic); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (subcribe_msg*) parseFromData:(NSData*) data { return (subcribe_msg*)[[[subcribe_msg builder] mergeFromData:data] build]; } + (subcribe_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (subcribe_msg*)[[[subcribe_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (subcribe_msg*) parseFromInputStream:(NSInputStream*) input { return (subcribe_msg*)[[[subcribe_msg builder] mergeFromInputStream:input] build]; } + (subcribe_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (subcribe_msg*)[[[subcribe_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (subcribe_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (subcribe_msg*)[[[subcribe_msg builder] mergeFromCodedInputStream:input] build]; } + (subcribe_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (subcribe_msg*)[[[subcribe_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (subcribe_msgBuilder*) builder { return [[subcribe_msgBuilder alloc] init]; } + (subcribe_msgBuilder*) builderWithPrototype:(subcribe_msg*) prototype { return [[subcribe_msg builder] mergeFrom:prototype]; } - (subcribe_msgBuilder*) builder { return [subcribe_msg builder]; } - (subcribe_msgBuilder*) toBuilder { return [subcribe_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasServiceType) { [output appendFormat:@"%@%@: %@\n", indent, @"serviceType", NSStringFromeum_rpc_service(self.serviceType)]; } if (self.hasTopic) { [output appendFormat:@"%@%@: %@\n", indent, @"topic", self.topic]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasServiceType) { [dictionary setObject: @(self.serviceType) forKey: @"serviceType"]; } if (self.hasTopic) { [dictionary setObject: self.topic forKey: @"topic"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[subcribe_msg class]]) { return NO; } subcribe_msg *otherMessage = other; return self.hasServiceType == otherMessage.hasServiceType && (!self.hasServiceType || self.serviceType == otherMessage.serviceType) && self.hasTopic == otherMessage.hasTopic && (!self.hasTopic || [self.topic isEqual:otherMessage.topic]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasServiceType) { hashCode = hashCode * 31 + self.serviceType; } if (self.hasTopic) { hashCode = hashCode * 31 + [self.topic hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface subcribe_msgBuilder() @property (strong) subcribe_msg* resultSubcribeMsg; @end @implementation subcribe_msgBuilder @synthesize resultSubcribeMsg; - (instancetype) init { if ((self = [super init])) { self.resultSubcribeMsg = [[subcribe_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSubcribeMsg; } - (subcribe_msgBuilder*) clear { self.resultSubcribeMsg = [[subcribe_msg alloc] init]; return self; } - (subcribe_msgBuilder*) clone { return [subcribe_msg builderWithPrototype:resultSubcribeMsg]; } - (subcribe_msg*) defaultInstance { return [subcribe_msg defaultInstance]; } - (subcribe_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (subcribe_msg*) buildPartial { subcribe_msg* returnMe = resultSubcribeMsg; self.resultSubcribeMsg = nil; return returnMe; } - (subcribe_msgBuilder*) mergeFrom:(subcribe_msg*) other { if (other == [subcribe_msg defaultInstance]) { return self; } if (other.hasServiceType) { [self setServiceType:other.serviceType]; } if (other.hasTopic) { [self setTopic:other.topic]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (subcribe_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (subcribe_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { eum_rpc_service value = (eum_rpc_service)[input readEnum]; if (eum_rpc_serviceIsValidValue(value)) { [self setServiceType:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setTopic:[input readString]]; break; } } } } - (BOOL) hasServiceType { return resultSubcribeMsg.hasServiceType; } - (eum_rpc_service) serviceType { return resultSubcribeMsg.serviceType; } - (subcribe_msgBuilder*) setServiceType:(eum_rpc_service) value { resultSubcribeMsg.hasServiceType = YES; resultSubcribeMsg.serviceType = value; return self; } - (subcribe_msgBuilder*) clearServiceType { resultSubcribeMsg.hasServiceType = NO; resultSubcribeMsg.serviceType = eum_rpc_serviceCommonService; return self; } - (BOOL) hasTopic { return resultSubcribeMsg.hasTopic; } - (NSString*) topic { return resultSubcribeMsg.topic; } - (subcribe_msgBuilder*) setTopic:(NSString*) value { resultSubcribeMsg.hasTopic = YES; resultSubcribeMsg.topic = value; return self; } - (subcribe_msgBuilder*) clearTopic { resultSubcribeMsg.hasTopic = NO; resultSubcribeMsg.topic = @""; return self; } @end @interface sync_notify_msg () @property SInt64 uid; @property (strong) NSString* topic; @property SInt64 lastSeq; @property (strong) NSMutableArray * extParamArray; @end @implementation sync_notify_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (BOOL) hasTopic { return !!hasTopic_; } - (void) setHasTopic:(BOOL) _value_ { hasTopic_ = !!_value_; } @synthesize topic; - (BOOL) hasLastSeq { return !!hasLastSeq_; } - (void) setHasLastSeq:(BOOL) _value_ { hasLastSeq_ = !!_value_; } @synthesize lastSeq; @synthesize extParamArray; @dynamic extParam; - (instancetype) init { if ((self = [super init])) { self.uid = 0L; self.topic = @""; self.lastSeq = 0L; } return self; } static sync_notify_msg* defaultsync_notify_msgInstance = nil; + (void) initialize { if (self == [sync_notify_msg class]) { defaultsync_notify_msgInstance = [[sync_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultsync_notify_msgInstance; } - (instancetype) defaultInstance { return defaultsync_notify_msgInstance; } - (NSArray *)extParam { return extParamArray; } - (ext_key_info*)extParamAtIndex:(NSUInteger)index { return [extParamArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } if (!self.hasTopic) { return NO; } __block BOOL isInitextParam = YES; [self.extParam enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitextParam = NO; *stop = YES; } }]; if (!isInitextParam) return isInitextParam; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeInt64:1 value:self.uid]; } if (self.hasTopic) { [output writeString:2 value:self.topic]; } if (self.hasLastSeq) { [output writeInt64:3 value:self.lastSeq]; } [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output writeMessage:4 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeInt64Size(1, self.uid); } if (self.hasTopic) { size_ += computeStringSize(2, self.topic); } if (self.hasLastSeq) { size_ += computeInt64Size(3, self.lastSeq); } [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(4, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (sync_notify_msg*) parseFromData:(NSData*) data { return (sync_notify_msg*)[[[sync_notify_msg builder] mergeFromData:data] build]; } + (sync_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sync_notify_msg*)[[[sync_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (sync_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (sync_notify_msg*)[[[sync_notify_msg builder] mergeFromInputStream:input] build]; } + (sync_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sync_notify_msg*)[[[sync_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (sync_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (sync_notify_msg*)[[[sync_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (sync_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sync_notify_msg*)[[[sync_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (sync_notify_msgBuilder*) builder { return [[sync_notify_msgBuilder alloc] init]; } + (sync_notify_msgBuilder*) builderWithPrototype:(sync_notify_msg*) prototype { return [[sync_notify_msg builder] mergeFrom:prototype]; } - (sync_notify_msgBuilder*) builder { return [sync_notify_msg builder]; } - (sync_notify_msgBuilder*) toBuilder { return [sync_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithLongLong:self.uid]]; } if (self.hasTopic) { [output appendFormat:@"%@%@: %@\n", indent, @"topic", self.topic]; } if (self.hasLastSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"lastSeq", [NSNumber numberWithLongLong:self.lastSeq]]; } [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"extParam"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithLongLong:self.uid] forKey: @"uid"]; } if (self.hasTopic) { [dictionary setObject: self.topic forKey: @"topic"]; } if (self.hasLastSeq) { [dictionary setObject: [NSNumber numberWithLongLong:self.lastSeq] forKey: @"lastSeq"]; } for (ext_key_info* element in self.extParamArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"extParam"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[sync_notify_msg class]]) { return NO; } sync_notify_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && self.hasTopic == otherMessage.hasTopic && (!self.hasTopic || [self.topic isEqual:otherMessage.topic]) && self.hasLastSeq == otherMessage.hasLastSeq && (!self.hasLastSeq || self.lastSeq == otherMessage.lastSeq) && [self.extParamArray isEqualToArray:otherMessage.extParamArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.uid] hash]; } if (self.hasTopic) { hashCode = hashCode * 31 + [self.topic hash]; } if (self.hasLastSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.lastSeq] hash]; } [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface sync_notify_msgBuilder() @property (strong) sync_notify_msg* resultSyncNotifyMsg; @end @implementation sync_notify_msgBuilder @synthesize resultSyncNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultSyncNotifyMsg = [[sync_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSyncNotifyMsg; } - (sync_notify_msgBuilder*) clear { self.resultSyncNotifyMsg = [[sync_notify_msg alloc] init]; return self; } - (sync_notify_msgBuilder*) clone { return [sync_notify_msg builderWithPrototype:resultSyncNotifyMsg]; } - (sync_notify_msg*) defaultInstance { return [sync_notify_msg defaultInstance]; } - (sync_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (sync_notify_msg*) buildPartial { sync_notify_msg* returnMe = resultSyncNotifyMsg; self.resultSyncNotifyMsg = nil; return returnMe; } - (sync_notify_msgBuilder*) mergeFrom:(sync_notify_msg*) other { if (other == [sync_notify_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.hasTopic) { [self setTopic:other.topic]; } if (other.hasLastSeq) { [self setLastSeq:other.lastSeq]; } if (other.extParamArray.count > 0) { if (resultSyncNotifyMsg.extParamArray == nil) { resultSyncNotifyMsg.extParamArray = [[NSMutableArray alloc] initWithArray:other.extParamArray]; } else { [resultSyncNotifyMsg.extParamArray addObjectsFromArray:other.extParamArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (sync_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (sync_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readInt64]]; break; } case 18: { [self setTopic:[input readString]]; break; } case 24: { [self setLastSeq:[input readInt64]]; break; } case 34: { ext_key_infoBuilder* subBuilder = [ext_key_info builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExtParam:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasUid { return resultSyncNotifyMsg.hasUid; } - (SInt64) uid { return resultSyncNotifyMsg.uid; } - (sync_notify_msgBuilder*) setUid:(SInt64) value { resultSyncNotifyMsg.hasUid = YES; resultSyncNotifyMsg.uid = value; return self; } - (sync_notify_msgBuilder*) clearUid { resultSyncNotifyMsg.hasUid = NO; resultSyncNotifyMsg.uid = 0L; return self; } - (BOOL) hasTopic { return resultSyncNotifyMsg.hasTopic; } - (NSString*) topic { return resultSyncNotifyMsg.topic; } - (sync_notify_msgBuilder*) setTopic:(NSString*) value { resultSyncNotifyMsg.hasTopic = YES; resultSyncNotifyMsg.topic = value; return self; } - (sync_notify_msgBuilder*) clearTopic { resultSyncNotifyMsg.hasTopic = NO; resultSyncNotifyMsg.topic = @""; return self; } - (BOOL) hasLastSeq { return resultSyncNotifyMsg.hasLastSeq; } - (SInt64) lastSeq { return resultSyncNotifyMsg.lastSeq; } - (sync_notify_msgBuilder*) setLastSeq:(SInt64) value { resultSyncNotifyMsg.hasLastSeq = YES; resultSyncNotifyMsg.lastSeq = value; return self; } - (sync_notify_msgBuilder*) clearLastSeq { resultSyncNotifyMsg.hasLastSeq = NO; resultSyncNotifyMsg.lastSeq = 0L; return self; } - (NSMutableArray *)extParam { return resultSyncNotifyMsg.extParamArray; } - (ext_key_info*)extParamAtIndex:(NSUInteger)index { return [resultSyncNotifyMsg extParamAtIndex:index]; } - (sync_notify_msgBuilder *)addExtParam:(ext_key_info*)value { if (resultSyncNotifyMsg.extParamArray == nil) { resultSyncNotifyMsg.extParamArray = [[NSMutableArray alloc]init]; } [resultSyncNotifyMsg.extParamArray addObject:value]; return self; } - (sync_notify_msgBuilder *)setExtParamArray:(NSArray *)array { resultSyncNotifyMsg.extParamArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (sync_notify_msgBuilder *)clearExtParam { resultSyncNotifyMsg.extParamArray = nil; return self; } @end @interface push_notify_msg () @property eum_nofity_type notifyType; @property SInt64 msgSeq; @property (strong) NSData* subMsg; @end @implementation push_notify_msg - (BOOL) hasNotifyType { return !!hasNotifyType_; } - (void) setHasNotifyType:(BOOL) _value_ { hasNotifyType_ = !!_value_; } @synthesize notifyType; - (BOOL) hasMsgSeq { return !!hasMsgSeq_; } - (void) setHasMsgSeq:(BOOL) _value_ { hasMsgSeq_ = !!_value_; } @synthesize msgSeq; - (BOOL) hasSubMsg { return !!hasSubMsg_; } - (void) setHasSubMsg:(BOOL) _value_ { hasSubMsg_ = !!_value_; } @synthesize subMsg; - (instancetype) init { if ((self = [super init])) { self.notifyType = eum_nofity_typeTgStockInPoolNotify; self.msgSeq = 0L; self.subMsg = [NSData data]; } return self; } static push_notify_msg* defaultpush_notify_msgInstance = nil; + (void) initialize { if (self == [push_notify_msg class]) { defaultpush_notify_msgInstance = [[push_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultpush_notify_msgInstance; } - (instancetype) defaultInstance { return defaultpush_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasNotifyType) { return NO; } if (!self.hasMsgSeq) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasNotifyType) { [output writeEnum:1 value:self.notifyType]; } if (self.hasMsgSeq) { [output writeInt64:2 value:self.msgSeq]; } if (self.hasSubMsg) { [output writeData:3 value:self.subMsg]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasNotifyType) { size_ += computeEnumSize(1, self.notifyType); } if (self.hasMsgSeq) { size_ += computeInt64Size(2, self.msgSeq); } if (self.hasSubMsg) { size_ += computeDataSize(3, self.subMsg); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (push_notify_msg*) parseFromData:(NSData*) data { return (push_notify_msg*)[[[push_notify_msg builder] mergeFromData:data] build]; } + (push_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (push_notify_msg*)[[[push_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (push_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (push_notify_msg*)[[[push_notify_msg builder] mergeFromInputStream:input] build]; } + (push_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (push_notify_msg*)[[[push_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (push_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (push_notify_msg*)[[[push_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (push_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (push_notify_msg*)[[[push_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (push_notify_msgBuilder*) builder { return [[push_notify_msgBuilder alloc] init]; } + (push_notify_msgBuilder*) builderWithPrototype:(push_notify_msg*) prototype { return [[push_notify_msg builder] mergeFrom:prototype]; } - (push_notify_msgBuilder*) builder { return [push_notify_msg builder]; } - (push_notify_msgBuilder*) toBuilder { return [push_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasNotifyType) { [output appendFormat:@"%@%@: %@\n", indent, @"notifyType", NSStringFromeum_nofity_type(self.notifyType)]; } if (self.hasMsgSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"msgSeq", [NSNumber numberWithLongLong:self.msgSeq]]; } if (self.hasSubMsg) { [output appendFormat:@"%@%@: %@\n", indent, @"subMsg", self.subMsg]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasNotifyType) { [dictionary setObject: @(self.notifyType) forKey: @"notifyType"]; } if (self.hasMsgSeq) { [dictionary setObject: [NSNumber numberWithLongLong:self.msgSeq] forKey: @"msgSeq"]; } if (self.hasSubMsg) { [dictionary setObject: self.subMsg forKey: @"subMsg"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[push_notify_msg class]]) { return NO; } push_notify_msg *otherMessage = other; return self.hasNotifyType == otherMessage.hasNotifyType && (!self.hasNotifyType || self.notifyType == otherMessage.notifyType) && self.hasMsgSeq == otherMessage.hasMsgSeq && (!self.hasMsgSeq || self.msgSeq == otherMessage.msgSeq) && self.hasSubMsg == otherMessage.hasSubMsg && (!self.hasSubMsg || [self.subMsg isEqual:otherMessage.subMsg]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasNotifyType) { hashCode = hashCode * 31 + self.notifyType; } if (self.hasMsgSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.msgSeq] hash]; } if (self.hasSubMsg) { hashCode = hashCode * 31 + [self.subMsg hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface push_notify_msgBuilder() @property (strong) push_notify_msg* resultPushNotifyMsg; @end @implementation push_notify_msgBuilder @synthesize resultPushNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultPushNotifyMsg = [[push_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultPushNotifyMsg; } - (push_notify_msgBuilder*) clear { self.resultPushNotifyMsg = [[push_notify_msg alloc] init]; return self; } - (push_notify_msgBuilder*) clone { return [push_notify_msg builderWithPrototype:resultPushNotifyMsg]; } - (push_notify_msg*) defaultInstance { return [push_notify_msg defaultInstance]; } - (push_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (push_notify_msg*) buildPartial { push_notify_msg* returnMe = resultPushNotifyMsg; self.resultPushNotifyMsg = nil; return returnMe; } - (push_notify_msgBuilder*) mergeFrom:(push_notify_msg*) other { if (other == [push_notify_msg defaultInstance]) { return self; } if (other.hasNotifyType) { [self setNotifyType:other.notifyType]; } if (other.hasMsgSeq) { [self setMsgSeq:other.msgSeq]; } if (other.hasSubMsg) { [self setSubMsg:other.subMsg]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (push_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (push_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { eum_nofity_type value = (eum_nofity_type)[input readEnum]; if (eum_nofity_typeIsValidValue(value)) { [self setNotifyType:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 16: { [self setMsgSeq:[input readInt64]]; break; } case 26: { [self setSubMsg:[input readData]]; break; } } } } - (BOOL) hasNotifyType { return resultPushNotifyMsg.hasNotifyType; } - (eum_nofity_type) notifyType { return resultPushNotifyMsg.notifyType; } - (push_notify_msgBuilder*) setNotifyType:(eum_nofity_type) value { resultPushNotifyMsg.hasNotifyType = YES; resultPushNotifyMsg.notifyType = value; return self; } - (push_notify_msgBuilder*) clearNotifyType { resultPushNotifyMsg.hasNotifyType = NO; resultPushNotifyMsg.notifyType = eum_nofity_typeTgStockInPoolNotify; return self; } - (BOOL) hasMsgSeq { return resultPushNotifyMsg.hasMsgSeq; } - (SInt64) msgSeq { return resultPushNotifyMsg.msgSeq; } - (push_notify_msgBuilder*) setMsgSeq:(SInt64) value { resultPushNotifyMsg.hasMsgSeq = YES; resultPushNotifyMsg.msgSeq = value; return self; } - (push_notify_msgBuilder*) clearMsgSeq { resultPushNotifyMsg.hasMsgSeq = NO; resultPushNotifyMsg.msgSeq = 0L; return self; } - (BOOL) hasSubMsg { return resultPushNotifyMsg.hasSubMsg; } - (NSData*) subMsg { return resultPushNotifyMsg.subMsg; } - (push_notify_msgBuilder*) setSubMsg:(NSData*) value { resultPushNotifyMsg.hasSubMsg = YES; resultPushNotifyMsg.subMsg = value; return self; } - (push_notify_msgBuilder*) clearSubMsg { resultPushNotifyMsg.hasSubMsg = NO; resultPushNotifyMsg.subMsg = [NSData data]; return self; } @end @interface notify_ack_msg () @property (strong) NSString* topic; @property SInt64 msgSeq; @property SInt64 uid; @end @implementation notify_ack_msg - (BOOL) hasTopic { return !!hasTopic_; } - (void) setHasTopic:(BOOL) _value_ { hasTopic_ = !!_value_; } @synthesize topic; - (BOOL) hasMsgSeq { return !!hasMsgSeq_; } - (void) setHasMsgSeq:(BOOL) _value_ { hasMsgSeq_ = !!_value_; } @synthesize msgSeq; - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (instancetype) init { if ((self = [super init])) { self.topic = @""; self.msgSeq = 0L; self.uid = 0L; } return self; } static notify_ack_msg* defaultnotify_ack_msgInstance = nil; + (void) initialize { if (self == [notify_ack_msg class]) { defaultnotify_ack_msgInstance = [[notify_ack_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultnotify_ack_msgInstance; } - (instancetype) defaultInstance { return defaultnotify_ack_msgInstance; } - (BOOL) isInitialized { if (!self.hasTopic) { return NO; } if (!self.hasMsgSeq) { return NO; } if (!self.hasUid) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTopic) { [output writeString:1 value:self.topic]; } if (self.hasMsgSeq) { [output writeInt64:2 value:self.msgSeq]; } if (self.hasUid) { [output writeInt64:3 value:self.uid]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTopic) { size_ += computeStringSize(1, self.topic); } if (self.hasMsgSeq) { size_ += computeInt64Size(2, self.msgSeq); } if (self.hasUid) { size_ += computeInt64Size(3, self.uid); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (notify_ack_msg*) parseFromData:(NSData*) data { return (notify_ack_msg*)[[[notify_ack_msg builder] mergeFromData:data] build]; } + (notify_ack_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (notify_ack_msg*)[[[notify_ack_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (notify_ack_msg*) parseFromInputStream:(NSInputStream*) input { return (notify_ack_msg*)[[[notify_ack_msg builder] mergeFromInputStream:input] build]; } + (notify_ack_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (notify_ack_msg*)[[[notify_ack_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (notify_ack_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (notify_ack_msg*)[[[notify_ack_msg builder] mergeFromCodedInputStream:input] build]; } + (notify_ack_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (notify_ack_msg*)[[[notify_ack_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (notify_ack_msgBuilder*) builder { return [[notify_ack_msgBuilder alloc] init]; } + (notify_ack_msgBuilder*) builderWithPrototype:(notify_ack_msg*) prototype { return [[notify_ack_msg builder] mergeFrom:prototype]; } - (notify_ack_msgBuilder*) builder { return [notify_ack_msg builder]; } - (notify_ack_msgBuilder*) toBuilder { return [notify_ack_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTopic) { [output appendFormat:@"%@%@: %@\n", indent, @"topic", self.topic]; } if (self.hasMsgSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"msgSeq", [NSNumber numberWithLongLong:self.msgSeq]]; } if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithLongLong:self.uid]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTopic) { [dictionary setObject: self.topic forKey: @"topic"]; } if (self.hasMsgSeq) { [dictionary setObject: [NSNumber numberWithLongLong:self.msgSeq] forKey: @"msgSeq"]; } if (self.hasUid) { [dictionary setObject: [NSNumber numberWithLongLong:self.uid] forKey: @"uid"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[notify_ack_msg class]]) { return NO; } notify_ack_msg *otherMessage = other; return self.hasTopic == otherMessage.hasTopic && (!self.hasTopic || [self.topic isEqual:otherMessage.topic]) && self.hasMsgSeq == otherMessage.hasMsgSeq && (!self.hasMsgSeq || self.msgSeq == otherMessage.msgSeq) && self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTopic) { hashCode = hashCode * 31 + [self.topic hash]; } if (self.hasMsgSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.msgSeq] hash]; } if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.uid] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface notify_ack_msgBuilder() @property (strong) notify_ack_msg* resultNotifyAckMsg; @end @implementation notify_ack_msgBuilder @synthesize resultNotifyAckMsg; - (instancetype) init { if ((self = [super init])) { self.resultNotifyAckMsg = [[notify_ack_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultNotifyAckMsg; } - (notify_ack_msgBuilder*) clear { self.resultNotifyAckMsg = [[notify_ack_msg alloc] init]; return self; } - (notify_ack_msgBuilder*) clone { return [notify_ack_msg builderWithPrototype:resultNotifyAckMsg]; } - (notify_ack_msg*) defaultInstance { return [notify_ack_msg defaultInstance]; } - (notify_ack_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (notify_ack_msg*) buildPartial { notify_ack_msg* returnMe = resultNotifyAckMsg; self.resultNotifyAckMsg = nil; return returnMe; } - (notify_ack_msgBuilder*) mergeFrom:(notify_ack_msg*) other { if (other == [notify_ack_msg defaultInstance]) { return self; } if (other.hasTopic) { [self setTopic:other.topic]; } if (other.hasMsgSeq) { [self setMsgSeq:other.msgSeq]; } if (other.hasUid) { [self setUid:other.uid]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (notify_ack_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (notify_ack_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setTopic:[input readString]]; break; } case 16: { [self setMsgSeq:[input readInt64]]; break; } case 24: { [self setUid:[input readInt64]]; break; } } } } - (BOOL) hasTopic { return resultNotifyAckMsg.hasTopic; } - (NSString*) topic { return resultNotifyAckMsg.topic; } - (notify_ack_msgBuilder*) setTopic:(NSString*) value { resultNotifyAckMsg.hasTopic = YES; resultNotifyAckMsg.topic = value; return self; } - (notify_ack_msgBuilder*) clearTopic { resultNotifyAckMsg.hasTopic = NO; resultNotifyAckMsg.topic = @""; return self; } - (BOOL) hasMsgSeq { return resultNotifyAckMsg.hasMsgSeq; } - (SInt64) msgSeq { return resultNotifyAckMsg.msgSeq; } - (notify_ack_msgBuilder*) setMsgSeq:(SInt64) value { resultNotifyAckMsg.hasMsgSeq = YES; resultNotifyAckMsg.msgSeq = value; return self; } - (notify_ack_msgBuilder*) clearMsgSeq { resultNotifyAckMsg.hasMsgSeq = NO; resultNotifyAckMsg.msgSeq = 0L; return self; } - (BOOL) hasUid { return resultNotifyAckMsg.hasUid; } - (SInt64) uid { return resultNotifyAckMsg.uid; } - (notify_ack_msgBuilder*) setUid:(SInt64) value { resultNotifyAckMsg.hasUid = YES; resultNotifyAckMsg.uid = value; return self; } - (notify_ack_msgBuilder*) clearUid { resultNotifyAckMsg.hasUid = NO; resultNotifyAckMsg.uid = 0L; return self; } @end @interface common_update_notice_msg () @property (strong) NSMutableArray * extParamArray; @end @implementation common_update_notice_msg @synthesize extParamArray; @dynamic extParam; - (instancetype) init { if ((self = [super init])) { } return self; } static common_update_notice_msg* defaultcommon_update_notice_msgInstance = nil; + (void) initialize { if (self == [common_update_notice_msg class]) { defaultcommon_update_notice_msgInstance = [[common_update_notice_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultcommon_update_notice_msgInstance; } - (instancetype) defaultInstance { return defaultcommon_update_notice_msgInstance; } - (NSArray *)extParam { return extParamArray; } - (ext_key_info*)extParamAtIndex:(NSUInteger)index { return [extParamArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitextParam = YES; [self.extParam enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitextParam = NO; *stop = YES; } }]; if (!isInitextParam) return isInitextParam; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (common_update_notice_msg*) parseFromData:(NSData*) data { return (common_update_notice_msg*)[[[common_update_notice_msg builder] mergeFromData:data] build]; } + (common_update_notice_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (common_update_notice_msg*)[[[common_update_notice_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (common_update_notice_msg*) parseFromInputStream:(NSInputStream*) input { return (common_update_notice_msg*)[[[common_update_notice_msg builder] mergeFromInputStream:input] build]; } + (common_update_notice_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (common_update_notice_msg*)[[[common_update_notice_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (common_update_notice_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (common_update_notice_msg*)[[[common_update_notice_msg builder] mergeFromCodedInputStream:input] build]; } + (common_update_notice_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (common_update_notice_msg*)[[[common_update_notice_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (common_update_notice_msgBuilder*) builder { return [[common_update_notice_msgBuilder alloc] init]; } + (common_update_notice_msgBuilder*) builderWithPrototype:(common_update_notice_msg*) prototype { return [[common_update_notice_msg builder] mergeFrom:prototype]; } - (common_update_notice_msgBuilder*) builder { return [common_update_notice_msg builder]; } - (common_update_notice_msgBuilder*) toBuilder { return [common_update_notice_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"extParam"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (ext_key_info* element in self.extParamArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"extParam"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[common_update_notice_msg class]]) { return NO; } common_update_notice_msg *otherMessage = other; return [self.extParamArray isEqualToArray:otherMessage.extParamArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.extParamArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface common_update_notice_msgBuilder() @property (strong) common_update_notice_msg* resultCommonUpdateNoticeMsg; @end @implementation common_update_notice_msgBuilder @synthesize resultCommonUpdateNoticeMsg; - (instancetype) init { if ((self = [super init])) { self.resultCommonUpdateNoticeMsg = [[common_update_notice_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultCommonUpdateNoticeMsg; } - (common_update_notice_msgBuilder*) clear { self.resultCommonUpdateNoticeMsg = [[common_update_notice_msg alloc] init]; return self; } - (common_update_notice_msgBuilder*) clone { return [common_update_notice_msg builderWithPrototype:resultCommonUpdateNoticeMsg]; } - (common_update_notice_msg*) defaultInstance { return [common_update_notice_msg defaultInstance]; } - (common_update_notice_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (common_update_notice_msg*) buildPartial { common_update_notice_msg* returnMe = resultCommonUpdateNoticeMsg; self.resultCommonUpdateNoticeMsg = nil; return returnMe; } - (common_update_notice_msgBuilder*) mergeFrom:(common_update_notice_msg*) other { if (other == [common_update_notice_msg defaultInstance]) { return self; } if (other.extParamArray.count > 0) { if (resultCommonUpdateNoticeMsg.extParamArray == nil) { resultCommonUpdateNoticeMsg.extParamArray = [[NSMutableArray alloc] initWithArray:other.extParamArray]; } else { [resultCommonUpdateNoticeMsg.extParamArray addObjectsFromArray:other.extParamArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (common_update_notice_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (common_update_notice_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { ext_key_infoBuilder* subBuilder = [ext_key_info builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExtParam:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)extParam { return resultCommonUpdateNoticeMsg.extParamArray; } - (ext_key_info*)extParamAtIndex:(NSUInteger)index { return [resultCommonUpdateNoticeMsg extParamAtIndex:index]; } - (common_update_notice_msgBuilder *)addExtParam:(ext_key_info*)value { if (resultCommonUpdateNoticeMsg.extParamArray == nil) { resultCommonUpdateNoticeMsg.extParamArray = [[NSMutableArray alloc]init]; } [resultCommonUpdateNoticeMsg.extParamArray addObject:value]; return self; } - (common_update_notice_msgBuilder *)setExtParamArray:(NSArray *)array { resultCommonUpdateNoticeMsg.extParamArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (common_update_notice_msgBuilder *)clearExtParam { resultCommonUpdateNoticeMsg.extParamArray = nil; return self; } @end @interface combo_private_msg () @property SInt64 ackSeq; @property (strong) NSMutableArray * msgsArray; @end @implementation combo_private_msg - (BOOL) hasAckSeq { return !!hasAckSeq_; } - (void) setHasAckSeq:(BOOL) _value_ { hasAckSeq_ = !!_value_; } @synthesize ackSeq; @synthesize msgsArray; @dynamic msgs; - (instancetype) init { if ((self = [super init])) { self.ackSeq = 0L; } return self; } static combo_private_msg* defaultcombo_private_msgInstance = nil; + (void) initialize { if (self == [combo_private_msg class]) { defaultcombo_private_msgInstance = [[combo_private_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultcombo_private_msgInstance; } - (instancetype) defaultInstance { return defaultcombo_private_msgInstance; } - (NSArray *)msgs { return msgsArray; } - (common_update_notice_msg*)msgsAtIndex:(NSUInteger)index { return [msgsArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasAckSeq) { return NO; } __block BOOL isInitmsgs = YES; [self.msgs enumerateObjectsUsingBlock:^(common_update_notice_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitmsgs = NO; *stop = YES; } }]; if (!isInitmsgs) return isInitmsgs; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasAckSeq) { [output writeInt64:1 value:self.ackSeq]; } [self.msgsArray enumerateObjectsUsingBlock:^(common_update_notice_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasAckSeq) { size_ += computeInt64Size(1, self.ackSeq); } [self.msgsArray enumerateObjectsUsingBlock:^(common_update_notice_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (combo_private_msg*) parseFromData:(NSData*) data { return (combo_private_msg*)[[[combo_private_msg builder] mergeFromData:data] build]; } + (combo_private_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (combo_private_msg*)[[[combo_private_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (combo_private_msg*) parseFromInputStream:(NSInputStream*) input { return (combo_private_msg*)[[[combo_private_msg builder] mergeFromInputStream:input] build]; } + (combo_private_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (combo_private_msg*)[[[combo_private_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (combo_private_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (combo_private_msg*)[[[combo_private_msg builder] mergeFromCodedInputStream:input] build]; } + (combo_private_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (combo_private_msg*)[[[combo_private_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (combo_private_msgBuilder*) builder { return [[combo_private_msgBuilder alloc] init]; } + (combo_private_msgBuilder*) builderWithPrototype:(combo_private_msg*) prototype { return [[combo_private_msg builder] mergeFrom:prototype]; } - (combo_private_msgBuilder*) builder { return [combo_private_msg builder]; } - (combo_private_msgBuilder*) toBuilder { return [combo_private_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasAckSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"ackSeq", [NSNumber numberWithLongLong:self.ackSeq]]; } [self.msgsArray enumerateObjectsUsingBlock:^(common_update_notice_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"msgs"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasAckSeq) { [dictionary setObject: [NSNumber numberWithLongLong:self.ackSeq] forKey: @"ackSeq"]; } for (common_update_notice_msg* element in self.msgsArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"msgs"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[combo_private_msg class]]) { return NO; } combo_private_msg *otherMessage = other; return self.hasAckSeq == otherMessage.hasAckSeq && (!self.hasAckSeq || self.ackSeq == otherMessage.ackSeq) && [self.msgsArray isEqualToArray:otherMessage.msgsArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasAckSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.ackSeq] hash]; } [self.msgsArray enumerateObjectsUsingBlock:^(common_update_notice_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface combo_private_msgBuilder() @property (strong) combo_private_msg* resultComboPrivateMsg; @end @implementation combo_private_msgBuilder @synthesize resultComboPrivateMsg; - (instancetype) init { if ((self = [super init])) { self.resultComboPrivateMsg = [[combo_private_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultComboPrivateMsg; } - (combo_private_msgBuilder*) clear { self.resultComboPrivateMsg = [[combo_private_msg alloc] init]; return self; } - (combo_private_msgBuilder*) clone { return [combo_private_msg builderWithPrototype:resultComboPrivateMsg]; } - (combo_private_msg*) defaultInstance { return [combo_private_msg defaultInstance]; } - (combo_private_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (combo_private_msg*) buildPartial { combo_private_msg* returnMe = resultComboPrivateMsg; self.resultComboPrivateMsg = nil; return returnMe; } - (combo_private_msgBuilder*) mergeFrom:(combo_private_msg*) other { if (other == [combo_private_msg defaultInstance]) { return self; } if (other.hasAckSeq) { [self setAckSeq:other.ackSeq]; } if (other.msgsArray.count > 0) { if (resultComboPrivateMsg.msgsArray == nil) { resultComboPrivateMsg.msgsArray = [[NSMutableArray alloc] initWithArray:other.msgsArray]; } else { [resultComboPrivateMsg.msgsArray addObjectsFromArray:other.msgsArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (combo_private_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (combo_private_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setAckSeq:[input readInt64]]; break; } case 18: { common_update_notice_msgBuilder* subBuilder = [common_update_notice_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addMsgs:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasAckSeq { return resultComboPrivateMsg.hasAckSeq; } - (SInt64) ackSeq { return resultComboPrivateMsg.ackSeq; } - (combo_private_msgBuilder*) setAckSeq:(SInt64) value { resultComboPrivateMsg.hasAckSeq = YES; resultComboPrivateMsg.ackSeq = value; return self; } - (combo_private_msgBuilder*) clearAckSeq { resultComboPrivateMsg.hasAckSeq = NO; resultComboPrivateMsg.ackSeq = 0L; return self; } - (NSMutableArray *)msgs { return resultComboPrivateMsg.msgsArray; } - (common_update_notice_msg*)msgsAtIndex:(NSUInteger)index { return [resultComboPrivateMsg msgsAtIndex:index]; } - (combo_private_msgBuilder *)addMsgs:(common_update_notice_msg*)value { if (resultComboPrivateMsg.msgsArray == nil) { resultComboPrivateMsg.msgsArray = [[NSMutableArray alloc]init]; } [resultComboPrivateMsg.msgsArray addObject:value]; return self; } - (combo_private_msgBuilder *)setMsgsArray:(NSArray *)array { resultComboPrivateMsg.msgsArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (combo_private_msgBuilder *)clearMsgs { resultComboPrivateMsg.msgsArray = nil; return self; } @end @interface rpc_msg_root () @property eum_rpc_service service; @property eum_method_type method; @property (strong) NSData* body; @property UInt32 seq; @property UInt32 sid; @property UInt32 cid; @property (strong) NSString* pubSub; @property BOOL needAuthCtx; @property (strong) NSMutableArray * extArray; @end @implementation rpc_msg_root - (BOOL) hasService { return !!hasService_; } - (void) setHasService:(BOOL) _value_ { hasService_ = !!_value_; } @synthesize service; - (BOOL) hasMethod { return !!hasMethod_; } - (void) setHasMethod:(BOOL) _value_ { hasMethod_ = !!_value_; } @synthesize method; - (BOOL) hasBody { return !!hasBody_; } - (void) setHasBody:(BOOL) _value_ { hasBody_ = !!_value_; } @synthesize body; - (BOOL) hasSeq { return !!hasSeq_; } - (void) setHasSeq:(BOOL) _value_ { hasSeq_ = !!_value_; } @synthesize seq; - (BOOL) hasSid { return !!hasSid_; } - (void) setHasSid:(BOOL) _value_ { hasSid_ = !!_value_; } @synthesize sid; - (BOOL) hasCid { return !!hasCid_; } - (void) setHasCid:(BOOL) _value_ { hasCid_ = !!_value_; } @synthesize cid; - (BOOL) hasPubSub { return !!hasPubSub_; } - (void) setHasPubSub:(BOOL) _value_ { hasPubSub_ = !!_value_; } @synthesize pubSub; - (BOOL) hasNeedAuthCtx { return !!hasNeedAuthCtx_; } - (void) setHasNeedAuthCtx:(BOOL) _value_ { hasNeedAuthCtx_ = !!_value_; } - (BOOL) needAuthCtx { return !!needAuthCtx_; } - (void) setNeedAuthCtx:(BOOL) _value_ { needAuthCtx_ = !!_value_; } @synthesize extArray; @dynamic ext; - (instancetype) init { if ((self = [super init])) { self.service = eum_rpc_serviceCommonService; self.method = eum_method_typeCommonErrorRep; self.body = [NSData data]; self.seq = 0; self.sid = 0; self.cid = 0; self.pubSub = @""; self.needAuthCtx = NO; } return self; } static rpc_msg_root* defaultrpc_msg_rootInstance = nil; + (void) initialize { if (self == [rpc_msg_root class]) { defaultrpc_msg_rootInstance = [[rpc_msg_root alloc] init]; } } + (instancetype) defaultInstance { return defaultrpc_msg_rootInstance; } - (instancetype) defaultInstance { return defaultrpc_msg_rootInstance; } - (NSArray *)ext { return extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [extArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasService) { return NO; } if (!self.hasMethod) { return NO; } __block BOOL isInitext = YES; [self.ext enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitext = NO; *stop = YES; } }]; if (!isInitext) return isInitext; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasService) { [output writeEnum:1 value:self.service]; } if (self.hasMethod) { [output writeEnum:2 value:self.method]; } if (self.hasBody) { [output writeData:3 value:self.body]; } if (self.hasSeq) { [output writeUInt32:4 value:self.seq]; } if (self.hasSid) { [output writeUInt32:5 value:self.sid]; } if (self.hasCid) { [output writeUInt32:6 value:self.cid]; } if (self.hasPubSub) { [output writeString:7 value:self.pubSub]; } if (self.hasNeedAuthCtx) { [output writeBool:8 value:self.needAuthCtx]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output writeMessage:9 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasService) { size_ += computeEnumSize(1, self.service); } if (self.hasMethod) { size_ += computeEnumSize(2, self.method); } if (self.hasBody) { size_ += computeDataSize(3, self.body); } if (self.hasSeq) { size_ += computeUInt32Size(4, self.seq); } if (self.hasSid) { size_ += computeUInt32Size(5, self.sid); } if (self.hasCid) { size_ += computeUInt32Size(6, self.cid); } if (self.hasPubSub) { size_ += computeStringSize(7, self.pubSub); } if (self.hasNeedAuthCtx) { size_ += computeBoolSize(8, self.needAuthCtx); } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(9, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (rpc_msg_root*) parseFromData:(NSData*) data { return (rpc_msg_root*)[[[rpc_msg_root builder] mergeFromData:data] build]; } + (rpc_msg_root*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rpc_msg_root*)[[[rpc_msg_root builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (rpc_msg_root*) parseFromInputStream:(NSInputStream*) input { return (rpc_msg_root*)[[[rpc_msg_root builder] mergeFromInputStream:input] build]; } + (rpc_msg_root*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rpc_msg_root*)[[[rpc_msg_root builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (rpc_msg_root*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (rpc_msg_root*)[[[rpc_msg_root builder] mergeFromCodedInputStream:input] build]; } + (rpc_msg_root*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rpc_msg_root*)[[[rpc_msg_root builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (rpc_msg_rootBuilder*) builder { return [[rpc_msg_rootBuilder alloc] init]; } + (rpc_msg_rootBuilder*) builderWithPrototype:(rpc_msg_root*) prototype { return [[rpc_msg_root builder] mergeFrom:prototype]; } - (rpc_msg_rootBuilder*) builder { return [rpc_msg_root builder]; } - (rpc_msg_rootBuilder*) toBuilder { return [rpc_msg_root builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasService) { [output appendFormat:@"%@%@: %@\n", indent, @"service", NSStringFromeum_rpc_service(self.service)]; } if (self.hasMethod) { [output appendFormat:@"%@%@: %@\n", indent, @"method", NSStringFromeum_method_type(self.method)]; } if (self.hasBody) { [output appendFormat:@"%@%@: %@\n", indent, @"body", self.body]; } if (self.hasSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"seq", [NSNumber numberWithInteger:self.seq]]; } if (self.hasSid) { [output appendFormat:@"%@%@: %@\n", indent, @"sid", [NSNumber numberWithInteger:self.sid]]; } if (self.hasCid) { [output appendFormat:@"%@%@: %@\n", indent, @"cid", [NSNumber numberWithInteger:self.cid]]; } if (self.hasPubSub) { [output appendFormat:@"%@%@: %@\n", indent, @"pubSub", self.pubSub]; } if (self.hasNeedAuthCtx) { [output appendFormat:@"%@%@: %@\n", indent, @"needAuthCtx", [NSNumber numberWithBool:self.needAuthCtx]]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"ext"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasService) { [dictionary setObject: @(self.service) forKey: @"service"]; } if (self.hasMethod) { [dictionary setObject: @(self.method) forKey: @"method"]; } if (self.hasBody) { [dictionary setObject: self.body forKey: @"body"]; } if (self.hasSeq) { [dictionary setObject: [NSNumber numberWithInteger:self.seq] forKey: @"seq"]; } if (self.hasSid) { [dictionary setObject: [NSNumber numberWithInteger:self.sid] forKey: @"sid"]; } if (self.hasCid) { [dictionary setObject: [NSNumber numberWithInteger:self.cid] forKey: @"cid"]; } if (self.hasPubSub) { [dictionary setObject: self.pubSub forKey: @"pubSub"]; } if (self.hasNeedAuthCtx) { [dictionary setObject: [NSNumber numberWithBool:self.needAuthCtx] forKey: @"needAuthCtx"]; } for (ext_key_info* element in self.extArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"ext"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[rpc_msg_root class]]) { return NO; } rpc_msg_root *otherMessage = other; return self.hasService == otherMessage.hasService && (!self.hasService || self.service == otherMessage.service) && self.hasMethod == otherMessage.hasMethod && (!self.hasMethod || self.method == otherMessage.method) && self.hasBody == otherMessage.hasBody && (!self.hasBody || [self.body isEqual:otherMessage.body]) && self.hasSeq == otherMessage.hasSeq && (!self.hasSeq || self.seq == otherMessage.seq) && self.hasSid == otherMessage.hasSid && (!self.hasSid || self.sid == otherMessage.sid) && self.hasCid == otherMessage.hasCid && (!self.hasCid || self.cid == otherMessage.cid) && self.hasPubSub == otherMessage.hasPubSub && (!self.hasPubSub || [self.pubSub isEqual:otherMessage.pubSub]) && self.hasNeedAuthCtx == otherMessage.hasNeedAuthCtx && (!self.hasNeedAuthCtx || self.needAuthCtx == otherMessage.needAuthCtx) && [self.extArray isEqualToArray:otherMessage.extArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasService) { hashCode = hashCode * 31 + self.service; } if (self.hasMethod) { hashCode = hashCode * 31 + self.method; } if (self.hasBody) { hashCode = hashCode * 31 + [self.body hash]; } if (self.hasSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.seq] hash]; } if (self.hasSid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.sid] hash]; } if (self.hasCid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.cid] hash]; } if (self.hasPubSub) { hashCode = hashCode * 31 + [self.pubSub hash]; } if (self.hasNeedAuthCtx) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.needAuthCtx] hash]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface rpc_msg_rootBuilder() @property (strong) rpc_msg_root* resultRpcMsgRoot; @end @implementation rpc_msg_rootBuilder @synthesize resultRpcMsgRoot; - (instancetype) init { if ((self = [super init])) { self.resultRpcMsgRoot = [[rpc_msg_root alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultRpcMsgRoot; } - (rpc_msg_rootBuilder*) clear { self.resultRpcMsgRoot = [[rpc_msg_root alloc] init]; return self; } - (rpc_msg_rootBuilder*) clone { return [rpc_msg_root builderWithPrototype:resultRpcMsgRoot]; } - (rpc_msg_root*) defaultInstance { return [rpc_msg_root defaultInstance]; } - (rpc_msg_root*) build { [self checkInitialized]; return [self buildPartial]; } - (rpc_msg_root*) buildPartial { rpc_msg_root* returnMe = resultRpcMsgRoot; self.resultRpcMsgRoot = nil; return returnMe; } - (rpc_msg_rootBuilder*) mergeFrom:(rpc_msg_root*) other { if (other == [rpc_msg_root defaultInstance]) { return self; } if (other.hasService) { [self setService:other.service]; } if (other.hasMethod) { [self setMethod:other.method]; } if (other.hasBody) { [self setBody:other.body]; } if (other.hasSeq) { [self setSeq:other.seq]; } if (other.hasSid) { [self setSid:other.sid]; } if (other.hasCid) { [self setCid:other.cid]; } if (other.hasPubSub) { [self setPubSub:other.pubSub]; } if (other.hasNeedAuthCtx) { [self setNeedAuthCtx:other.needAuthCtx]; } if (other.extArray.count > 0) { if (resultRpcMsgRoot.extArray == nil) { resultRpcMsgRoot.extArray = [[NSMutableArray alloc] initWithArray:other.extArray]; } else { [resultRpcMsgRoot.extArray addObjectsFromArray:other.extArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (rpc_msg_rootBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (rpc_msg_rootBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { eum_rpc_service value = (eum_rpc_service)[input readEnum]; if (eum_rpc_serviceIsValidValue(value)) { [self setService:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 16: { eum_method_type value = (eum_method_type)[input readEnum]; if (eum_method_typeIsValidValue(value)) { [self setMethod:value]; } else { [unknownFields mergeVarintField:2 value:value]; } break; } case 26: { [self setBody:[input readData]]; break; } case 32: { [self setSeq:[input readUInt32]]; break; } case 40: { [self setSid:[input readUInt32]]; break; } case 48: { [self setCid:[input readUInt32]]; break; } case 58: { [self setPubSub:[input readString]]; break; } case 64: { [self setNeedAuthCtx:[input readBool]]; break; } case 74: { ext_key_infoBuilder* subBuilder = [ext_key_info builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExt:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasService { return resultRpcMsgRoot.hasService; } - (eum_rpc_service) service { return resultRpcMsgRoot.service; } - (rpc_msg_rootBuilder*) setService:(eum_rpc_service) value { resultRpcMsgRoot.hasService = YES; resultRpcMsgRoot.service = value; return self; } - (rpc_msg_rootBuilder*) clearService { resultRpcMsgRoot.hasService = NO; resultRpcMsgRoot.service = eum_rpc_serviceCommonService; return self; } - (BOOL) hasMethod { return resultRpcMsgRoot.hasMethod; } - (eum_method_type) method { return resultRpcMsgRoot.method; } - (rpc_msg_rootBuilder*) setMethod:(eum_method_type) value { resultRpcMsgRoot.hasMethod = YES; resultRpcMsgRoot.method = value; return self; } - (rpc_msg_rootBuilder*) clearMethod { resultRpcMsgRoot.hasMethod = NO; resultRpcMsgRoot.method = eum_method_typeCommonErrorRep; return self; } - (BOOL) hasBody { return resultRpcMsgRoot.hasBody; } - (NSData*) body { return resultRpcMsgRoot.body; } - (rpc_msg_rootBuilder*) setBody:(NSData*) value { resultRpcMsgRoot.hasBody = YES; resultRpcMsgRoot.body = value; return self; } - (rpc_msg_rootBuilder*) clearBody { resultRpcMsgRoot.hasBody = NO; resultRpcMsgRoot.body = [NSData data]; return self; } - (BOOL) hasSeq { return resultRpcMsgRoot.hasSeq; } - (UInt32) seq { return resultRpcMsgRoot.seq; } - (rpc_msg_rootBuilder*) setSeq:(UInt32) value { resultRpcMsgRoot.hasSeq = YES; resultRpcMsgRoot.seq = value; return self; } - (rpc_msg_rootBuilder*) clearSeq { resultRpcMsgRoot.hasSeq = NO; resultRpcMsgRoot.seq = 0; return self; } - (BOOL) hasSid { return resultRpcMsgRoot.hasSid; } - (UInt32) sid { return resultRpcMsgRoot.sid; } - (rpc_msg_rootBuilder*) setSid:(UInt32) value { resultRpcMsgRoot.hasSid = YES; resultRpcMsgRoot.sid = value; return self; } - (rpc_msg_rootBuilder*) clearSid { resultRpcMsgRoot.hasSid = NO; resultRpcMsgRoot.sid = 0; return self; } - (BOOL) hasCid { return resultRpcMsgRoot.hasCid; } - (UInt32) cid { return resultRpcMsgRoot.cid; } - (rpc_msg_rootBuilder*) setCid:(UInt32) value { resultRpcMsgRoot.hasCid = YES; resultRpcMsgRoot.cid = value; return self; } - (rpc_msg_rootBuilder*) clearCid { resultRpcMsgRoot.hasCid = NO; resultRpcMsgRoot.cid = 0; return self; } - (BOOL) hasPubSub { return resultRpcMsgRoot.hasPubSub; } - (NSString*) pubSub { return resultRpcMsgRoot.pubSub; } - (rpc_msg_rootBuilder*) setPubSub:(NSString*) value { resultRpcMsgRoot.hasPubSub = YES; resultRpcMsgRoot.pubSub = value; return self; } - (rpc_msg_rootBuilder*) clearPubSub { resultRpcMsgRoot.hasPubSub = NO; resultRpcMsgRoot.pubSub = @""; return self; } - (BOOL) hasNeedAuthCtx { return resultRpcMsgRoot.hasNeedAuthCtx; } - (BOOL) needAuthCtx { return resultRpcMsgRoot.needAuthCtx; } - (rpc_msg_rootBuilder*) setNeedAuthCtx:(BOOL) value { resultRpcMsgRoot.hasNeedAuthCtx = YES; resultRpcMsgRoot.needAuthCtx = value; return self; } - (rpc_msg_rootBuilder*) clearNeedAuthCtx { resultRpcMsgRoot.hasNeedAuthCtx = NO; resultRpcMsgRoot.needAuthCtx = NO; return self; } - (NSMutableArray *)ext { return resultRpcMsgRoot.extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [resultRpcMsgRoot extAtIndex:index]; } - (rpc_msg_rootBuilder *)addExt:(ext_key_info*)value { if (resultRpcMsgRoot.extArray == nil) { resultRpcMsgRoot.extArray = [[NSMutableArray alloc]init]; } [resultRpcMsgRoot.extArray addObject:value]; return self; } - (rpc_msg_rootBuilder *)setExtArray:(NSArray *)array { resultRpcMsgRoot.extArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (rpc_msg_rootBuilder *)clearExt { resultRpcMsgRoot.extArray = nil; return self; } @end @interface common_reply_error_msg () @property eum_method_type orgType; @property (strong) NSString* error; @end @implementation common_reply_error_msg - (BOOL) hasOrgType { return !!hasOrgType_; } - (void) setHasOrgType:(BOOL) _value_ { hasOrgType_ = !!_value_; } @synthesize orgType; - (BOOL) hasError { return !!hasError_; } - (void) setHasError:(BOOL) _value_ { hasError_ = !!_value_; } @synthesize error; - (instancetype) init { if ((self = [super init])) { self.orgType = eum_method_typeCommonErrorRep; self.error = @""; } return self; } static common_reply_error_msg* defaultcommon_reply_error_msgInstance = nil; + (void) initialize { if (self == [common_reply_error_msg class]) { defaultcommon_reply_error_msgInstance = [[common_reply_error_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultcommon_reply_error_msgInstance; } - (instancetype) defaultInstance { return defaultcommon_reply_error_msgInstance; } - (BOOL) isInitialized { if (!self.hasOrgType) { return NO; } if (!self.hasError) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasOrgType) { [output writeEnum:1 value:self.orgType]; } if (self.hasError) { [output writeString:2 value:self.error]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasOrgType) { size_ += computeEnumSize(1, self.orgType); } if (self.hasError) { size_ += computeStringSize(2, self.error); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (common_reply_error_msg*) parseFromData:(NSData*) data { return (common_reply_error_msg*)[[[common_reply_error_msg builder] mergeFromData:data] build]; } + (common_reply_error_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (common_reply_error_msg*)[[[common_reply_error_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (common_reply_error_msg*) parseFromInputStream:(NSInputStream*) input { return (common_reply_error_msg*)[[[common_reply_error_msg builder] mergeFromInputStream:input] build]; } + (common_reply_error_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (common_reply_error_msg*)[[[common_reply_error_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (common_reply_error_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (common_reply_error_msg*)[[[common_reply_error_msg builder] mergeFromCodedInputStream:input] build]; } + (common_reply_error_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (common_reply_error_msg*)[[[common_reply_error_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (common_reply_error_msgBuilder*) builder { return [[common_reply_error_msgBuilder alloc] init]; } + (common_reply_error_msgBuilder*) builderWithPrototype:(common_reply_error_msg*) prototype { return [[common_reply_error_msg builder] mergeFrom:prototype]; } - (common_reply_error_msgBuilder*) builder { return [common_reply_error_msg builder]; } - (common_reply_error_msgBuilder*) toBuilder { return [common_reply_error_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasOrgType) { [output appendFormat:@"%@%@: %@\n", indent, @"orgType", NSStringFromeum_method_type(self.orgType)]; } if (self.hasError) { [output appendFormat:@"%@%@: %@\n", indent, @"error", self.error]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasOrgType) { [dictionary setObject: @(self.orgType) forKey: @"orgType"]; } if (self.hasError) { [dictionary setObject: self.error forKey: @"error"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[common_reply_error_msg class]]) { return NO; } common_reply_error_msg *otherMessage = other; return self.hasOrgType == otherMessage.hasOrgType && (!self.hasOrgType || self.orgType == otherMessage.orgType) && self.hasError == otherMessage.hasError && (!self.hasError || [self.error isEqual:otherMessage.error]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasOrgType) { hashCode = hashCode * 31 + self.orgType; } if (self.hasError) { hashCode = hashCode * 31 + [self.error hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface common_reply_error_msgBuilder() @property (strong) common_reply_error_msg* resultCommonReplyErrorMsg; @end @implementation common_reply_error_msgBuilder @synthesize resultCommonReplyErrorMsg; - (instancetype) init { if ((self = [super init])) { self.resultCommonReplyErrorMsg = [[common_reply_error_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultCommonReplyErrorMsg; } - (common_reply_error_msgBuilder*) clear { self.resultCommonReplyErrorMsg = [[common_reply_error_msg alloc] init]; return self; } - (common_reply_error_msgBuilder*) clone { return [common_reply_error_msg builderWithPrototype:resultCommonReplyErrorMsg]; } - (common_reply_error_msg*) defaultInstance { return [common_reply_error_msg defaultInstance]; } - (common_reply_error_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (common_reply_error_msg*) buildPartial { common_reply_error_msg* returnMe = resultCommonReplyErrorMsg; self.resultCommonReplyErrorMsg = nil; return returnMe; } - (common_reply_error_msgBuilder*) mergeFrom:(common_reply_error_msg*) other { if (other == [common_reply_error_msg defaultInstance]) { return self; } if (other.hasOrgType) { [self setOrgType:other.orgType]; } if (other.hasError) { [self setError:other.error]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (common_reply_error_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (common_reply_error_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { eum_method_type value = (eum_method_type)[input readEnum]; if (eum_method_typeIsValidValue(value)) { [self setOrgType:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setError:[input readString]]; break; } } } } - (BOOL) hasOrgType { return resultCommonReplyErrorMsg.hasOrgType; } - (eum_method_type) orgType { return resultCommonReplyErrorMsg.orgType; } - (common_reply_error_msgBuilder*) setOrgType:(eum_method_type) value { resultCommonReplyErrorMsg.hasOrgType = YES; resultCommonReplyErrorMsg.orgType = value; return self; } - (common_reply_error_msgBuilder*) clearOrgType { resultCommonReplyErrorMsg.hasOrgType = NO; resultCommonReplyErrorMsg.orgType = eum_method_typeCommonErrorRep; return self; } - (BOOL) hasError { return resultCommonReplyErrorMsg.hasError; } - (NSString*) error { return resultCommonReplyErrorMsg.error; } - (common_reply_error_msgBuilder*) setError:(NSString*) value { resultCommonReplyErrorMsg.hasError = YES; resultCommonReplyErrorMsg.error = value; return self; } - (common_reply_error_msgBuilder*) clearError { resultCommonReplyErrorMsg.hasError = NO; resultCommonReplyErrorMsg.error = @""; return self; } @end @interface load_dector_msg () @property BOOL req; @property UInt32 loadFactor; @property UInt32 connectCount; @property UInt32 sendTime; @end @implementation load_dector_msg - (BOOL) hasReq { return !!hasReq_; } - (void) setHasReq:(BOOL) _value_ { hasReq_ = !!_value_; } - (BOOL) req { return !!req_; } - (void) setReq:(BOOL) _value_ { req_ = !!_value_; } - (BOOL) hasLoadFactor { return !!hasLoadFactor_; } - (void) setHasLoadFactor:(BOOL) _value_ { hasLoadFactor_ = !!_value_; } @synthesize loadFactor; - (BOOL) hasConnectCount { return !!hasConnectCount_; } - (void) setHasConnectCount:(BOOL) _value_ { hasConnectCount_ = !!_value_; } @synthesize connectCount; - (BOOL) hasSendTime { return !!hasSendTime_; } - (void) setHasSendTime:(BOOL) _value_ { hasSendTime_ = !!_value_; } @synthesize sendTime; - (instancetype) init { if ((self = [super init])) { self.req = NO; self.loadFactor = 0; self.connectCount = 0; self.sendTime = 0; } return self; } static load_dector_msg* defaultload_dector_msgInstance = nil; + (void) initialize { if (self == [load_dector_msg class]) { defaultload_dector_msgInstance = [[load_dector_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultload_dector_msgInstance; } - (instancetype) defaultInstance { return defaultload_dector_msgInstance; } - (BOOL) isInitialized { if (!self.hasReq) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasReq) { [output writeBool:1 value:self.req]; } if (self.hasLoadFactor) { [output writeUInt32:2 value:self.loadFactor]; } if (self.hasConnectCount) { [output writeUInt32:3 value:self.connectCount]; } if (self.hasSendTime) { [output writeUInt32:4 value:self.sendTime]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasReq) { size_ += computeBoolSize(1, self.req); } if (self.hasLoadFactor) { size_ += computeUInt32Size(2, self.loadFactor); } if (self.hasConnectCount) { size_ += computeUInt32Size(3, self.connectCount); } if (self.hasSendTime) { size_ += computeUInt32Size(4, self.sendTime); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (load_dector_msg*) parseFromData:(NSData*) data { return (load_dector_msg*)[[[load_dector_msg builder] mergeFromData:data] build]; } + (load_dector_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (load_dector_msg*)[[[load_dector_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (load_dector_msg*) parseFromInputStream:(NSInputStream*) input { return (load_dector_msg*)[[[load_dector_msg builder] mergeFromInputStream:input] build]; } + (load_dector_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (load_dector_msg*)[[[load_dector_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (load_dector_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (load_dector_msg*)[[[load_dector_msg builder] mergeFromCodedInputStream:input] build]; } + (load_dector_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (load_dector_msg*)[[[load_dector_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (load_dector_msgBuilder*) builder { return [[load_dector_msgBuilder alloc] init]; } + (load_dector_msgBuilder*) builderWithPrototype:(load_dector_msg*) prototype { return [[load_dector_msg builder] mergeFrom:prototype]; } - (load_dector_msgBuilder*) builder { return [load_dector_msg builder]; } - (load_dector_msgBuilder*) toBuilder { return [load_dector_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasReq) { [output appendFormat:@"%@%@: %@\n", indent, @"req", [NSNumber numberWithBool:self.req]]; } if (self.hasLoadFactor) { [output appendFormat:@"%@%@: %@\n", indent, @"loadFactor", [NSNumber numberWithInteger:self.loadFactor]]; } if (self.hasConnectCount) { [output appendFormat:@"%@%@: %@\n", indent, @"connectCount", [NSNumber numberWithInteger:self.connectCount]]; } if (self.hasSendTime) { [output appendFormat:@"%@%@: %@\n", indent, @"sendTime", [NSNumber numberWithInteger:self.sendTime]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasReq) { [dictionary setObject: [NSNumber numberWithBool:self.req] forKey: @"req"]; } if (self.hasLoadFactor) { [dictionary setObject: [NSNumber numberWithInteger:self.loadFactor] forKey: @"loadFactor"]; } if (self.hasConnectCount) { [dictionary setObject: [NSNumber numberWithInteger:self.connectCount] forKey: @"connectCount"]; } if (self.hasSendTime) { [dictionary setObject: [NSNumber numberWithInteger:self.sendTime] forKey: @"sendTime"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[load_dector_msg class]]) { return NO; } load_dector_msg *otherMessage = other; return self.hasReq == otherMessage.hasReq && (!self.hasReq || self.req == otherMessage.req) && self.hasLoadFactor == otherMessage.hasLoadFactor && (!self.hasLoadFactor || self.loadFactor == otherMessage.loadFactor) && self.hasConnectCount == otherMessage.hasConnectCount && (!self.hasConnectCount || self.connectCount == otherMessage.connectCount) && self.hasSendTime == otherMessage.hasSendTime && (!self.hasSendTime || self.sendTime == otherMessage.sendTime) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasReq) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.req] hash]; } if (self.hasLoadFactor) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.loadFactor] hash]; } if (self.hasConnectCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.connectCount] hash]; } if (self.hasSendTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.sendTime] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface load_dector_msgBuilder() @property (strong) load_dector_msg* resultLoadDectorMsg; @end @implementation load_dector_msgBuilder @synthesize resultLoadDectorMsg; - (instancetype) init { if ((self = [super init])) { self.resultLoadDectorMsg = [[load_dector_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultLoadDectorMsg; } - (load_dector_msgBuilder*) clear { self.resultLoadDectorMsg = [[load_dector_msg alloc] init]; return self; } - (load_dector_msgBuilder*) clone { return [load_dector_msg builderWithPrototype:resultLoadDectorMsg]; } - (load_dector_msg*) defaultInstance { return [load_dector_msg defaultInstance]; } - (load_dector_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (load_dector_msg*) buildPartial { load_dector_msg* returnMe = resultLoadDectorMsg; self.resultLoadDectorMsg = nil; return returnMe; } - (load_dector_msgBuilder*) mergeFrom:(load_dector_msg*) other { if (other == [load_dector_msg defaultInstance]) { return self; } if (other.hasReq) { [self setReq:other.req]; } if (other.hasLoadFactor) { [self setLoadFactor:other.loadFactor]; } if (other.hasConnectCount) { [self setConnectCount:other.connectCount]; } if (other.hasSendTime) { [self setSendTime:other.sendTime]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (load_dector_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (load_dector_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setReq:[input readBool]]; break; } case 16: { [self setLoadFactor:[input readUInt32]]; break; } case 24: { [self setConnectCount:[input readUInt32]]; break; } case 32: { [self setSendTime:[input readUInt32]]; break; } } } } - (BOOL) hasReq { return resultLoadDectorMsg.hasReq; } - (BOOL) req { return resultLoadDectorMsg.req; } - (load_dector_msgBuilder*) setReq:(BOOL) value { resultLoadDectorMsg.hasReq = YES; resultLoadDectorMsg.req = value; return self; } - (load_dector_msgBuilder*) clearReq { resultLoadDectorMsg.hasReq = NO; resultLoadDectorMsg.req = NO; return self; } - (BOOL) hasLoadFactor { return resultLoadDectorMsg.hasLoadFactor; } - (UInt32) loadFactor { return resultLoadDectorMsg.loadFactor; } - (load_dector_msgBuilder*) setLoadFactor:(UInt32) value { resultLoadDectorMsg.hasLoadFactor = YES; resultLoadDectorMsg.loadFactor = value; return self; } - (load_dector_msgBuilder*) clearLoadFactor { resultLoadDectorMsg.hasLoadFactor = NO; resultLoadDectorMsg.loadFactor = 0; return self; } - (BOOL) hasConnectCount { return resultLoadDectorMsg.hasConnectCount; } - (UInt32) connectCount { return resultLoadDectorMsg.connectCount; } - (load_dector_msgBuilder*) setConnectCount:(UInt32) value { resultLoadDectorMsg.hasConnectCount = YES; resultLoadDectorMsg.connectCount = value; return self; } - (load_dector_msgBuilder*) clearConnectCount { resultLoadDectorMsg.hasConnectCount = NO; resultLoadDectorMsg.connectCount = 0; return self; } - (BOOL) hasSendTime { return resultLoadDectorMsg.hasSendTime; } - (UInt32) sendTime { return resultLoadDectorMsg.sendTime; } - (load_dector_msgBuilder*) setSendTime:(UInt32) value { resultLoadDectorMsg.hasSendTime = YES; resultLoadDectorMsg.sendTime = value; return self; } - (load_dector_msgBuilder*) clearSendTime { resultLoadDectorMsg.hasSendTime = NO; resultLoadDectorMsg.sendTime = 0; return self; } @end @interface server_login_msg () @property (strong) NSString* name; @property (strong) NSString* password; @end @implementation server_login_msg - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasPassword { return !!hasPassword_; } - (void) setHasPassword:(BOOL) _value_ { hasPassword_ = !!_value_; } @synthesize password; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.password = @""; } return self; } static server_login_msg* defaultserver_login_msgInstance = nil; + (void) initialize { if (self == [server_login_msg class]) { defaultserver_login_msgInstance = [[server_login_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultserver_login_msgInstance; } - (instancetype) defaultInstance { return defaultserver_login_msgInstance; } - (BOOL) isInitialized { if (!self.hasName) { return NO; } if (!self.hasPassword) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } if (self.hasPassword) { [output writeString:2 value:self.password]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } if (self.hasPassword) { size_ += computeStringSize(2, self.password); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (server_login_msg*) parseFromData:(NSData*) data { return (server_login_msg*)[[[server_login_msg builder] mergeFromData:data] build]; } + (server_login_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (server_login_msg*)[[[server_login_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (server_login_msg*) parseFromInputStream:(NSInputStream*) input { return (server_login_msg*)[[[server_login_msg builder] mergeFromInputStream:input] build]; } + (server_login_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (server_login_msg*)[[[server_login_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (server_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (server_login_msg*)[[[server_login_msg builder] mergeFromCodedInputStream:input] build]; } + (server_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (server_login_msg*)[[[server_login_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (server_login_msgBuilder*) builder { return [[server_login_msgBuilder alloc] init]; } + (server_login_msgBuilder*) builderWithPrototype:(server_login_msg*) prototype { return [[server_login_msg builder] mergeFrom:prototype]; } - (server_login_msgBuilder*) builder { return [server_login_msg builder]; } - (server_login_msgBuilder*) toBuilder { return [server_login_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasPassword) { [output appendFormat:@"%@%@: %@\n", indent, @"password", self.password]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasPassword) { [dictionary setObject: self.password forKey: @"password"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[server_login_msg class]]) { return NO; } server_login_msg *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasPassword == otherMessage.hasPassword && (!self.hasPassword || [self.password isEqual:otherMessage.password]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasPassword) { hashCode = hashCode * 31 + [self.password hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface server_login_msgBuilder() @property (strong) server_login_msg* resultServerLoginMsg; @end @implementation server_login_msgBuilder @synthesize resultServerLoginMsg; - (instancetype) init { if ((self = [super init])) { self.resultServerLoginMsg = [[server_login_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultServerLoginMsg; } - (server_login_msgBuilder*) clear { self.resultServerLoginMsg = [[server_login_msg alloc] init]; return self; } - (server_login_msgBuilder*) clone { return [server_login_msg builderWithPrototype:resultServerLoginMsg]; } - (server_login_msg*) defaultInstance { return [server_login_msg defaultInstance]; } - (server_login_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (server_login_msg*) buildPartial { server_login_msg* returnMe = resultServerLoginMsg; self.resultServerLoginMsg = nil; return returnMe; } - (server_login_msgBuilder*) mergeFrom:(server_login_msg*) other { if (other == [server_login_msg defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasPassword) { [self setPassword:other.password]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (server_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (server_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { [self setPassword:[input readString]]; break; } } } } - (BOOL) hasName { return resultServerLoginMsg.hasName; } - (NSString*) name { return resultServerLoginMsg.name; } - (server_login_msgBuilder*) setName:(NSString*) value { resultServerLoginMsg.hasName = YES; resultServerLoginMsg.name = value; return self; } - (server_login_msgBuilder*) clearName { resultServerLoginMsg.hasName = NO; resultServerLoginMsg.name = @""; return self; } - (BOOL) hasPassword { return resultServerLoginMsg.hasPassword; } - (NSString*) password { return resultServerLoginMsg.password; } - (server_login_msgBuilder*) setPassword:(NSString*) value { resultServerLoginMsg.hasPassword = YES; resultServerLoginMsg.password = value; return self; } - (server_login_msgBuilder*) clearPassword { resultServerLoginMsg.hasPassword = NO; resultServerLoginMsg.password = @""; return self; } @end @interface server_login_result_msg () @property BOOL result; @end @implementation server_login_result_msg - (BOOL) hasResult { return !!hasResult_; } - (void) setHasResult:(BOOL) _value_ { hasResult_ = !!_value_; } - (BOOL) result { return !!result_; } - (void) setResult:(BOOL) _value_ { result_ = !!_value_; } - (instancetype) init { if ((self = [super init])) { self.result = NO; } return self; } static server_login_result_msg* defaultserver_login_result_msgInstance = nil; + (void) initialize { if (self == [server_login_result_msg class]) { defaultserver_login_result_msgInstance = [[server_login_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultserver_login_result_msgInstance; } - (instancetype) defaultInstance { return defaultserver_login_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasResult) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasResult) { [output writeBool:1 value:self.result]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasResult) { size_ += computeBoolSize(1, self.result); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (server_login_result_msg*) parseFromData:(NSData*) data { return (server_login_result_msg*)[[[server_login_result_msg builder] mergeFromData:data] build]; } + (server_login_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (server_login_result_msg*)[[[server_login_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (server_login_result_msg*) parseFromInputStream:(NSInputStream*) input { return (server_login_result_msg*)[[[server_login_result_msg builder] mergeFromInputStream:input] build]; } + (server_login_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (server_login_result_msg*)[[[server_login_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (server_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (server_login_result_msg*)[[[server_login_result_msg builder] mergeFromCodedInputStream:input] build]; } + (server_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (server_login_result_msg*)[[[server_login_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (server_login_result_msgBuilder*) builder { return [[server_login_result_msgBuilder alloc] init]; } + (server_login_result_msgBuilder*) builderWithPrototype:(server_login_result_msg*) prototype { return [[server_login_result_msg builder] mergeFrom:prototype]; } - (server_login_result_msgBuilder*) builder { return [server_login_result_msg builder]; } - (server_login_result_msgBuilder*) toBuilder { return [server_login_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasResult) { [output appendFormat:@"%@%@: %@\n", indent, @"result", [NSNumber numberWithBool:self.result]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasResult) { [dictionary setObject: [NSNumber numberWithBool:self.result] forKey: @"result"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[server_login_result_msg class]]) { return NO; } server_login_result_msg *otherMessage = other; return self.hasResult == otherMessage.hasResult && (!self.hasResult || self.result == otherMessage.result) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasResult) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.result] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface server_login_result_msgBuilder() @property (strong) server_login_result_msg* resultServerLoginResultMsg; @end @implementation server_login_result_msgBuilder @synthesize resultServerLoginResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultServerLoginResultMsg = [[server_login_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultServerLoginResultMsg; } - (server_login_result_msgBuilder*) clear { self.resultServerLoginResultMsg = [[server_login_result_msg alloc] init]; return self; } - (server_login_result_msgBuilder*) clone { return [server_login_result_msg builderWithPrototype:resultServerLoginResultMsg]; } - (server_login_result_msg*) defaultInstance { return [server_login_result_msg defaultInstance]; } - (server_login_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (server_login_result_msg*) buildPartial { server_login_result_msg* returnMe = resultServerLoginResultMsg; self.resultServerLoginResultMsg = nil; return returnMe; } - (server_login_result_msgBuilder*) mergeFrom:(server_login_result_msg*) other { if (other == [server_login_result_msg defaultInstance]) { return self; } if (other.hasResult) { [self setResult:other.result]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (server_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (server_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setResult:[input readBool]]; break; } } } } - (BOOL) hasResult { return resultServerLoginResultMsg.hasResult; } - (BOOL) result { return resultServerLoginResultMsg.result; } - (server_login_result_msgBuilder*) setResult:(BOOL) value { resultServerLoginResultMsg.hasResult = YES; resultServerLoginResultMsg.result = value; return self; } - (server_login_result_msgBuilder*) clearResult { resultServerLoginResultMsg.hasResult = NO; resultServerLoginResultMsg.result = NO; return self; } @end @interface client_login_msg () @property (strong) NSString* name; @property (strong) NSString* password; @property (strong) NSString* bios; @property (strong) NSString* mac; @property (strong) NSString* hdd; @property (strong) NSString* cpu; @property (strong) NSString* ip; @property client_login_msglogin_type ltype; @property UInt32 sid; @property UInt32 cid; @end @implementation client_login_msg - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasPassword { return !!hasPassword_; } - (void) setHasPassword:(BOOL) _value_ { hasPassword_ = !!_value_; } @synthesize password; - (BOOL) hasBios { return !!hasBios_; } - (void) setHasBios:(BOOL) _value_ { hasBios_ = !!_value_; } @synthesize bios; - (BOOL) hasMac { return !!hasMac_; } - (void) setHasMac:(BOOL) _value_ { hasMac_ = !!_value_; } @synthesize mac; - (BOOL) hasHdd { return !!hasHdd_; } - (void) setHasHdd:(BOOL) _value_ { hasHdd_ = !!_value_; } @synthesize hdd; - (BOOL) hasCpu { return !!hasCpu_; } - (void) setHasCpu:(BOOL) _value_ { hasCpu_ = !!_value_; } @synthesize cpu; - (BOOL) hasIp { return !!hasIp_; } - (void) setHasIp:(BOOL) _value_ { hasIp_ = !!_value_; } @synthesize ip; - (BOOL) hasLtype { return !!hasLtype_; } - (void) setHasLtype:(BOOL) _value_ { hasLtype_ = !!_value_; } @synthesize ltype; - (BOOL) hasSid { return !!hasSid_; } - (void) setHasSid:(BOOL) _value_ { hasSid_ = !!_value_; } @synthesize sid; - (BOOL) hasCid { return !!hasCid_; } - (void) setHasCid:(BOOL) _value_ { hasCid_ = !!_value_; } @synthesize cid; - (instancetype) init { if ((self = [super init])) { self.name = @""; self.password = @""; self.bios = @""; self.mac = @""; self.hdd = @""; self.cpu = @""; self.ip = @""; self.ltype = client_login_msglogin_typeIndexPc; self.sid = 0; self.cid = 0; } return self; } static client_login_msg* defaultclient_login_msgInstance = nil; + (void) initialize { if (self == [client_login_msg class]) { defaultclient_login_msgInstance = [[client_login_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultclient_login_msgInstance; } - (instancetype) defaultInstance { return defaultclient_login_msgInstance; } - (BOOL) isInitialized { if (!self.hasName) { return NO; } if (!self.hasPassword) { return NO; } if (!self.hasBios) { return NO; } if (!self.hasMac) { return NO; } if (!self.hasHdd) { return NO; } if (!self.hasCpu) { return NO; } if (!self.hasIp) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeString:1 value:self.name]; } if (self.hasPassword) { [output writeString:2 value:self.password]; } if (self.hasBios) { [output writeString:3 value:self.bios]; } if (self.hasMac) { [output writeString:4 value:self.mac]; } if (self.hasHdd) { [output writeString:5 value:self.hdd]; } if (self.hasCpu) { [output writeString:6 value:self.cpu]; } if (self.hasIp) { [output writeString:7 value:self.ip]; } if (self.hasLtype) { [output writeEnum:8 value:self.ltype]; } if (self.hasSid) { [output writeUInt32:9 value:self.sid]; } if (self.hasCid) { [output writeUInt32:10 value:self.cid]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeStringSize(1, self.name); } if (self.hasPassword) { size_ += computeStringSize(2, self.password); } if (self.hasBios) { size_ += computeStringSize(3, self.bios); } if (self.hasMac) { size_ += computeStringSize(4, self.mac); } if (self.hasHdd) { size_ += computeStringSize(5, self.hdd); } if (self.hasCpu) { size_ += computeStringSize(6, self.cpu); } if (self.hasIp) { size_ += computeStringSize(7, self.ip); } if (self.hasLtype) { size_ += computeEnumSize(8, self.ltype); } if (self.hasSid) { size_ += computeUInt32Size(9, self.sid); } if (self.hasCid) { size_ += computeUInt32Size(10, self.cid); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (client_login_msg*) parseFromData:(NSData*) data { return (client_login_msg*)[[[client_login_msg builder] mergeFromData:data] build]; } + (client_login_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_login_msg*)[[[client_login_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (client_login_msg*) parseFromInputStream:(NSInputStream*) input { return (client_login_msg*)[[[client_login_msg builder] mergeFromInputStream:input] build]; } + (client_login_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_login_msg*)[[[client_login_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (client_login_msg*)[[[client_login_msg builder] mergeFromCodedInputStream:input] build]; } + (client_login_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_login_msg*)[[[client_login_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_login_msgBuilder*) builder { return [[client_login_msgBuilder alloc] init]; } + (client_login_msgBuilder*) builderWithPrototype:(client_login_msg*) prototype { return [[client_login_msg builder] mergeFrom:prototype]; } - (client_login_msgBuilder*) builder { return [client_login_msg builder]; } - (client_login_msgBuilder*) toBuilder { return [client_login_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasPassword) { [output appendFormat:@"%@%@: %@\n", indent, @"password", self.password]; } if (self.hasBios) { [output appendFormat:@"%@%@: %@\n", indent, @"bios", self.bios]; } if (self.hasMac) { [output appendFormat:@"%@%@: %@\n", indent, @"mac", self.mac]; } if (self.hasHdd) { [output appendFormat:@"%@%@: %@\n", indent, @"hdd", self.hdd]; } if (self.hasCpu) { [output appendFormat:@"%@%@: %@\n", indent, @"cpu", self.cpu]; } if (self.hasIp) { [output appendFormat:@"%@%@: %@\n", indent, @"ip", self.ip]; } if (self.hasLtype) { [output appendFormat:@"%@%@: %@\n", indent, @"ltype", NSStringFromclient_login_msglogin_type(self.ltype)]; } if (self.hasSid) { [output appendFormat:@"%@%@: %@\n", indent, @"sid", [NSNumber numberWithInteger:self.sid]]; } if (self.hasCid) { [output appendFormat:@"%@%@: %@\n", indent, @"cid", [NSNumber numberWithInteger:self.cid]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasPassword) { [dictionary setObject: self.password forKey: @"password"]; } if (self.hasBios) { [dictionary setObject: self.bios forKey: @"bios"]; } if (self.hasMac) { [dictionary setObject: self.mac forKey: @"mac"]; } if (self.hasHdd) { [dictionary setObject: self.hdd forKey: @"hdd"]; } if (self.hasCpu) { [dictionary setObject: self.cpu forKey: @"cpu"]; } if (self.hasIp) { [dictionary setObject: self.ip forKey: @"ip"]; } if (self.hasLtype) { [dictionary setObject: @(self.ltype) forKey: @"ltype"]; } if (self.hasSid) { [dictionary setObject: [NSNumber numberWithInteger:self.sid] forKey: @"sid"]; } if (self.hasCid) { [dictionary setObject: [NSNumber numberWithInteger:self.cid] forKey: @"cid"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[client_login_msg class]]) { return NO; } client_login_msg *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasPassword == otherMessage.hasPassword && (!self.hasPassword || [self.password isEqual:otherMessage.password]) && self.hasBios == otherMessage.hasBios && (!self.hasBios || [self.bios isEqual:otherMessage.bios]) && self.hasMac == otherMessage.hasMac && (!self.hasMac || [self.mac isEqual:otherMessage.mac]) && self.hasHdd == otherMessage.hasHdd && (!self.hasHdd || [self.hdd isEqual:otherMessage.hdd]) && self.hasCpu == otherMessage.hasCpu && (!self.hasCpu || [self.cpu isEqual:otherMessage.cpu]) && self.hasIp == otherMessage.hasIp && (!self.hasIp || [self.ip isEqual:otherMessage.ip]) && self.hasLtype == otherMessage.hasLtype && (!self.hasLtype || self.ltype == otherMessage.ltype) && self.hasSid == otherMessage.hasSid && (!self.hasSid || self.sid == otherMessage.sid) && self.hasCid == otherMessage.hasCid && (!self.hasCid || self.cid == otherMessage.cid) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasPassword) { hashCode = hashCode * 31 + [self.password hash]; } if (self.hasBios) { hashCode = hashCode * 31 + [self.bios hash]; } if (self.hasMac) { hashCode = hashCode * 31 + [self.mac hash]; } if (self.hasHdd) { hashCode = hashCode * 31 + [self.hdd hash]; } if (self.hasCpu) { hashCode = hashCode * 31 + [self.cpu hash]; } if (self.hasIp) { hashCode = hashCode * 31 + [self.ip hash]; } if (self.hasLtype) { hashCode = hashCode * 31 + self.ltype; } if (self.hasSid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.sid] hash]; } if (self.hasCid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.cid] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end BOOL client_login_msglogin_typeIsValidValue(client_login_msglogin_type value) { switch (value) { case client_login_msglogin_typeIndexPc: case client_login_msglogin_typeIndexMobile: case client_login_msglogin_typeTgPc: case client_login_msglogin_typeTgMobile: return YES; default: return NO; } } NSString *NSStringFromclient_login_msglogin_type(client_login_msglogin_type value) { switch (value) { case client_login_msglogin_typeIndexPc: return @"client_login_msglogin_typeIndexPc"; case client_login_msglogin_typeIndexMobile: return @"client_login_msglogin_typeIndexMobile"; case client_login_msglogin_typeTgPc: return @"client_login_msglogin_typeTgPc"; case client_login_msglogin_typeTgMobile: return @"client_login_msglogin_typeTgMobile"; default: return nil; } } @interface client_login_msgBuilder() @property (strong) client_login_msg* resultClientLoginMsg; @end @implementation client_login_msgBuilder @synthesize resultClientLoginMsg; - (instancetype) init { if ((self = [super init])) { self.resultClientLoginMsg = [[client_login_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultClientLoginMsg; } - (client_login_msgBuilder*) clear { self.resultClientLoginMsg = [[client_login_msg alloc] init]; return self; } - (client_login_msgBuilder*) clone { return [client_login_msg builderWithPrototype:resultClientLoginMsg]; } - (client_login_msg*) defaultInstance { return [client_login_msg defaultInstance]; } - (client_login_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (client_login_msg*) buildPartial { client_login_msg* returnMe = resultClientLoginMsg; self.resultClientLoginMsg = nil; return returnMe; } - (client_login_msgBuilder*) mergeFrom:(client_login_msg*) other { if (other == [client_login_msg defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasPassword) { [self setPassword:other.password]; } if (other.hasBios) { [self setBios:other.bios]; } if (other.hasMac) { [self setMac:other.mac]; } if (other.hasHdd) { [self setHdd:other.hdd]; } if (other.hasCpu) { [self setCpu:other.cpu]; } if (other.hasIp) { [self setIp:other.ip]; } if (other.hasLtype) { [self setLtype:other.ltype]; } if (other.hasSid) { [self setSid:other.sid]; } if (other.hasCid) { [self setCid:other.cid]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (client_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (client_login_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setName:[input readString]]; break; } case 18: { [self setPassword:[input readString]]; break; } case 26: { [self setBios:[input readString]]; break; } case 34: { [self setMac:[input readString]]; break; } case 42: { [self setHdd:[input readString]]; break; } case 50: { [self setCpu:[input readString]]; break; } case 58: { [self setIp:[input readString]]; break; } case 64: { client_login_msglogin_type value = (client_login_msglogin_type)[input readEnum]; if (client_login_msglogin_typeIsValidValue(value)) { [self setLtype:value]; } else { [unknownFields mergeVarintField:8 value:value]; } break; } case 72: { [self setSid:[input readUInt32]]; break; } case 80: { [self setCid:[input readUInt32]]; break; } } } } - (BOOL) hasName { return resultClientLoginMsg.hasName; } - (NSString*) name { return resultClientLoginMsg.name; } - (client_login_msgBuilder*) setName:(NSString*) value { resultClientLoginMsg.hasName = YES; resultClientLoginMsg.name = value; return self; } - (client_login_msgBuilder*) clearName { resultClientLoginMsg.hasName = NO; resultClientLoginMsg.name = @""; return self; } - (BOOL) hasPassword { return resultClientLoginMsg.hasPassword; } - (NSString*) password { return resultClientLoginMsg.password; } - (client_login_msgBuilder*) setPassword:(NSString*) value { resultClientLoginMsg.hasPassword = YES; resultClientLoginMsg.password = value; return self; } - (client_login_msgBuilder*) clearPassword { resultClientLoginMsg.hasPassword = NO; resultClientLoginMsg.password = @""; return self; } - (BOOL) hasBios { return resultClientLoginMsg.hasBios; } - (NSString*) bios { return resultClientLoginMsg.bios; } - (client_login_msgBuilder*) setBios:(NSString*) value { resultClientLoginMsg.hasBios = YES; resultClientLoginMsg.bios = value; return self; } - (client_login_msgBuilder*) clearBios { resultClientLoginMsg.hasBios = NO; resultClientLoginMsg.bios = @""; return self; } - (BOOL) hasMac { return resultClientLoginMsg.hasMac; } - (NSString*) mac { return resultClientLoginMsg.mac; } - (client_login_msgBuilder*) setMac:(NSString*) value { resultClientLoginMsg.hasMac = YES; resultClientLoginMsg.mac = value; return self; } - (client_login_msgBuilder*) clearMac { resultClientLoginMsg.hasMac = NO; resultClientLoginMsg.mac = @""; return self; } - (BOOL) hasHdd { return resultClientLoginMsg.hasHdd; } - (NSString*) hdd { return resultClientLoginMsg.hdd; } - (client_login_msgBuilder*) setHdd:(NSString*) value { resultClientLoginMsg.hasHdd = YES; resultClientLoginMsg.hdd = value; return self; } - (client_login_msgBuilder*) clearHdd { resultClientLoginMsg.hasHdd = NO; resultClientLoginMsg.hdd = @""; return self; } - (BOOL) hasCpu { return resultClientLoginMsg.hasCpu; } - (NSString*) cpu { return resultClientLoginMsg.cpu; } - (client_login_msgBuilder*) setCpu:(NSString*) value { resultClientLoginMsg.hasCpu = YES; resultClientLoginMsg.cpu = value; return self; } - (client_login_msgBuilder*) clearCpu { resultClientLoginMsg.hasCpu = NO; resultClientLoginMsg.cpu = @""; return self; } - (BOOL) hasIp { return resultClientLoginMsg.hasIp; } - (NSString*) ip { return resultClientLoginMsg.ip; } - (client_login_msgBuilder*) setIp:(NSString*) value { resultClientLoginMsg.hasIp = YES; resultClientLoginMsg.ip = value; return self; } - (client_login_msgBuilder*) clearIp { resultClientLoginMsg.hasIp = NO; resultClientLoginMsg.ip = @""; return self; } - (BOOL) hasLtype { return resultClientLoginMsg.hasLtype; } - (client_login_msglogin_type) ltype { return resultClientLoginMsg.ltype; } - (client_login_msgBuilder*) setLtype:(client_login_msglogin_type) value { resultClientLoginMsg.hasLtype = YES; resultClientLoginMsg.ltype = value; return self; } - (client_login_msgBuilder*) clearLtype { resultClientLoginMsg.hasLtype = NO; resultClientLoginMsg.ltype = client_login_msglogin_typeIndexPc; return self; } - (BOOL) hasSid { return resultClientLoginMsg.hasSid; } - (UInt32) sid { return resultClientLoginMsg.sid; } - (client_login_msgBuilder*) setSid:(UInt32) value { resultClientLoginMsg.hasSid = YES; resultClientLoginMsg.sid = value; return self; } - (client_login_msgBuilder*) clearSid { resultClientLoginMsg.hasSid = NO; resultClientLoginMsg.sid = 0; return self; } - (BOOL) hasCid { return resultClientLoginMsg.hasCid; } - (UInt32) cid { return resultClientLoginMsg.cid; } - (client_login_msgBuilder*) setCid:(UInt32) value { resultClientLoginMsg.hasCid = YES; resultClientLoginMsg.cid = value; return self; } - (client_login_msgBuilder*) clearCid { resultClientLoginMsg.hasCid = NO; resultClientLoginMsg.cid = 0; return self; } @end @interface auth_ctx_msg () @property (strong) PBAppendableArray * authServicesArray; @property (strong) NSMutableArray * topicsArray; @property (strong) NSMutableArray * extArray; @end @implementation auth_ctx_msg @synthesize authServicesArray; @dynamic authServices; @synthesize topicsArray; @dynamic topics; @synthesize extArray; @dynamic ext; - (instancetype) init { if ((self = [super init])) { } return self; } static auth_ctx_msg* defaultauth_ctx_msgInstance = nil; + (void) initialize { if (self == [auth_ctx_msg class]) { defaultauth_ctx_msgInstance = [[auth_ctx_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultauth_ctx_msgInstance; } - (instancetype) defaultInstance { return defaultauth_ctx_msgInstance; } - (PBArray *)authServices { return authServicesArray; } - (eum_rpc_service)authServicesAtIndex:(NSUInteger)index { return (eum_rpc_service)[authServicesArray enumAtIndex:index]; } - (NSArray *)topics { return topicsArray; } - (subcribe_msg*)topicsAtIndex:(NSUInteger)index { return [topicsArray objectAtIndex:index]; } - (NSArray *)ext { return extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [extArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInittopics = YES; [self.topics enumerateObjectsUsingBlock:^(subcribe_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInittopics = NO; *stop = YES; } }]; if (!isInittopics) return isInittopics; __block BOOL isInitext = YES; [self.ext enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitext = NO; *stop = YES; } }]; if (!isInitext) return isInitext; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { const NSUInteger authServicesArrayCount = self.authServicesArray.count; const eum_rpc_service *authServicesArrayValues = (const eum_rpc_service *)self.authServicesArray.data; for (NSUInteger i = 0; i < authServicesArrayCount; ++i) { [output writeEnum:1 value:authServicesArrayValues[i]]; } [self.topicsArray enumerateObjectsUsingBlock:^(subcribe_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output writeMessage:3 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; { SInt32 dataSize = 0; const NSUInteger count = self.authServicesArray.count; const eum_rpc_service *values = (const eum_rpc_service *)self.authServicesArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeEnumSizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } [self.topicsArray enumerateObjectsUsingBlock:^(subcribe_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(3, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (auth_ctx_msg*) parseFromData:(NSData*) data { return (auth_ctx_msg*)[[[auth_ctx_msg builder] mergeFromData:data] build]; } + (auth_ctx_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_ctx_msg*)[[[auth_ctx_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (auth_ctx_msg*) parseFromInputStream:(NSInputStream*) input { return (auth_ctx_msg*)[[[auth_ctx_msg builder] mergeFromInputStream:input] build]; } + (auth_ctx_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_ctx_msg*)[[[auth_ctx_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_ctx_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (auth_ctx_msg*)[[[auth_ctx_msg builder] mergeFromCodedInputStream:input] build]; } + (auth_ctx_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (auth_ctx_msg*)[[[auth_ctx_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (auth_ctx_msgBuilder*) builder { return [[auth_ctx_msgBuilder alloc] init]; } + (auth_ctx_msgBuilder*) builderWithPrototype:(auth_ctx_msg*) prototype { return [[auth_ctx_msg builder] mergeFrom:prototype]; } - (auth_ctx_msgBuilder*) builder { return [auth_ctx_msg builder]; } - (auth_ctx_msgBuilder*) toBuilder { return [auth_ctx_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.authServicesArray enumerateObjectsUsingBlock:^(id element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"authServices", NSStringFromeum_rpc_service([(NSNumber *)element intValue])]; }]; [self.topicsArray enumerateObjectsUsingBlock:^(subcribe_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"topics"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"ext"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { const NSUInteger authServicesArrayCount = self.authServicesArray.count; if (authServicesArrayCount > 0) { const eum_rpc_service *authServicesArrayValues = (const eum_rpc_service *)self.authServicesArray.data; NSMutableArray * authServicesArrayArray = [NSMutableArray new]; for (NSUInteger i = 0; i < authServicesArrayCount; ++i) { [authServicesArrayArray addObject: @(authServicesArrayValues[i])]; } [dictionary setObject: authServicesArrayArray forKey: @"authServices"]; } for (subcribe_msg* element in self.topicsArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"topics"]; } for (ext_key_info* element in self.extArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"ext"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[auth_ctx_msg class]]) { return NO; } auth_ctx_msg *otherMessage = other; return [self.authServicesArray isEqualToArray:otherMessage.authServicesArray] && [self.topicsArray isEqualToArray:otherMessage.topicsArray] && [self.extArray isEqualToArray:otherMessage.extArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.authServicesArray enumerateObjectsUsingBlock:^(NSNumber* element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + element.longValue; }]; [self.topicsArray enumerateObjectsUsingBlock:^(subcribe_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface auth_ctx_msgBuilder() @property (strong) auth_ctx_msg* resultAuthCtxMsg; @end @implementation auth_ctx_msgBuilder @synthesize resultAuthCtxMsg; - (instancetype) init { if ((self = [super init])) { self.resultAuthCtxMsg = [[auth_ctx_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultAuthCtxMsg; } - (auth_ctx_msgBuilder*) clear { self.resultAuthCtxMsg = [[auth_ctx_msg alloc] init]; return self; } - (auth_ctx_msgBuilder*) clone { return [auth_ctx_msg builderWithPrototype:resultAuthCtxMsg]; } - (auth_ctx_msg*) defaultInstance { return [auth_ctx_msg defaultInstance]; } - (auth_ctx_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (auth_ctx_msg*) buildPartial { auth_ctx_msg* returnMe = resultAuthCtxMsg; self.resultAuthCtxMsg = nil; return returnMe; } - (auth_ctx_msgBuilder*) mergeFrom:(auth_ctx_msg*) other { if (other == [auth_ctx_msg defaultInstance]) { return self; } if (other.authServicesArray.count > 0) { if (resultAuthCtxMsg.authServicesArray == nil) { resultAuthCtxMsg.authServicesArray = [other.authServicesArray copy]; } else { [resultAuthCtxMsg.authServicesArray appendArray:other.authServicesArray]; } } if (other.topicsArray.count > 0) { if (resultAuthCtxMsg.topicsArray == nil) { resultAuthCtxMsg.topicsArray = [[NSMutableArray alloc] initWithArray:other.topicsArray]; } else { [resultAuthCtxMsg.topicsArray addObjectsFromArray:other.topicsArray]; } } if (other.extArray.count > 0) { if (resultAuthCtxMsg.extArray == nil) { resultAuthCtxMsg.extArray = [[NSMutableArray alloc] initWithArray:other.extArray]; } else { [resultAuthCtxMsg.extArray addObjectsFromArray:other.extArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (auth_ctx_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (auth_ctx_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { eum_rpc_service value = (eum_rpc_service)[input readEnum]; if (eum_rpc_serviceIsValidValue(value)) { [self addAuthServices:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { subcribe_msgBuilder* subBuilder = [subcribe_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addTopics:[subBuilder buildPartial]]; break; } case 26: { ext_key_infoBuilder* subBuilder = [ext_key_info builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExt:[subBuilder buildPartial]]; break; } } } } - (PBAppendableArray *)authServices { return resultAuthCtxMsg.authServicesArray; } - (eum_rpc_service)authServicesAtIndex:(NSUInteger)index { return [resultAuthCtxMsg authServicesAtIndex:index]; } - (auth_ctx_msgBuilder *)addAuthServices:(eum_rpc_service)value { if (resultAuthCtxMsg.authServicesArray == nil) { resultAuthCtxMsg.authServicesArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultAuthCtxMsg.authServicesArray addEnum:value]; return self; } - (auth_ctx_msgBuilder *)setAuthServicesArray:(NSArray *)array { resultAuthCtxMsg.authServicesArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (auth_ctx_msgBuilder *)setAuthServicesValues:(const eum_rpc_service *)values count:(NSUInteger)count { resultAuthCtxMsg.authServicesArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (auth_ctx_msgBuilder *)clearAuthServices { resultAuthCtxMsg.authServicesArray = nil; return self; } - (NSMutableArray *)topics { return resultAuthCtxMsg.topicsArray; } - (subcribe_msg*)topicsAtIndex:(NSUInteger)index { return [resultAuthCtxMsg topicsAtIndex:index]; } - (auth_ctx_msgBuilder *)addTopics:(subcribe_msg*)value { if (resultAuthCtxMsg.topicsArray == nil) { resultAuthCtxMsg.topicsArray = [[NSMutableArray alloc]init]; } [resultAuthCtxMsg.topicsArray addObject:value]; return self; } - (auth_ctx_msgBuilder *)setTopicsArray:(NSArray *)array { resultAuthCtxMsg.topicsArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (auth_ctx_msgBuilder *)clearTopics { resultAuthCtxMsg.topicsArray = nil; return self; } - (NSMutableArray *)ext { return resultAuthCtxMsg.extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [resultAuthCtxMsg extAtIndex:index]; } - (auth_ctx_msgBuilder *)addExt:(ext_key_info*)value { if (resultAuthCtxMsg.extArray == nil) { resultAuthCtxMsg.extArray = [[NSMutableArray alloc]init]; } [resultAuthCtxMsg.extArray addObject:value]; return self; } - (auth_ctx_msgBuilder *)setExtArray:(NSArray *)array { resultAuthCtxMsg.extArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (auth_ctx_msgBuilder *)clearExt { resultAuthCtxMsg.extArray = nil; return self; } @end @interface client_login_result_msg () @property BOOL result; @property (strong) NSString* msg; @property (strong) NSMutableArray * extArray; @property SInt32 ltype; @property UInt32 sid; @property UInt32 cid; @property (strong) auth_ctx_msg* auths; @end @implementation client_login_result_msg - (BOOL) hasResult { return !!hasResult_; } - (void) setHasResult:(BOOL) _value_ { hasResult_ = !!_value_; } - (BOOL) result { return !!result_; } - (void) setResult:(BOOL) _value_ { result_ = !!_value_; } - (BOOL) hasMsg { return !!hasMsg_; } - (void) setHasMsg:(BOOL) _value_ { hasMsg_ = !!_value_; } @synthesize msg; @synthesize extArray; @dynamic ext; - (BOOL) hasLtype { return !!hasLtype_; } - (void) setHasLtype:(BOOL) _value_ { hasLtype_ = !!_value_; } @synthesize ltype; - (BOOL) hasSid { return !!hasSid_; } - (void) setHasSid:(BOOL) _value_ { hasSid_ = !!_value_; } @synthesize sid; - (BOOL) hasCid { return !!hasCid_; } - (void) setHasCid:(BOOL) _value_ { hasCid_ = !!_value_; } @synthesize cid; - (BOOL) hasAuths { return !!hasAuths_; } - (void) setHasAuths:(BOOL) _value_ { hasAuths_ = !!_value_; } @synthesize auths; - (instancetype) init { if ((self = [super init])) { self.result = NO; self.msg = @""; self.ltype = 0; self.sid = 0; self.cid = 0; self.auths = [auth_ctx_msg defaultInstance]; } return self; } static client_login_result_msg* defaultclient_login_result_msgInstance = nil; + (void) initialize { if (self == [client_login_result_msg class]) { defaultclient_login_result_msgInstance = [[client_login_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultclient_login_result_msgInstance; } - (instancetype) defaultInstance { return defaultclient_login_result_msgInstance; } - (NSArray *)ext { return extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [extArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasResult) { return NO; } __block BOOL isInitext = YES; [self.ext enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitext = NO; *stop = YES; } }]; if (!isInitext) return isInitext; if (self.hasAuths) { if (!self.auths.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasResult) { [output writeBool:1 value:self.result]; } if (self.hasMsg) { [output writeString:2 value:self.msg]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output writeMessage:3 value:element]; }]; if (self.hasLtype) { [output writeInt32:4 value:self.ltype]; } if (self.hasSid) { [output writeUInt32:5 value:self.sid]; } if (self.hasCid) { [output writeUInt32:6 value:self.cid]; } if (self.hasAuths) { [output writeMessage:7 value:self.auths]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasResult) { size_ += computeBoolSize(1, self.result); } if (self.hasMsg) { size_ += computeStringSize(2, self.msg); } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(3, element); }]; if (self.hasLtype) { size_ += computeInt32Size(4, self.ltype); } if (self.hasSid) { size_ += computeUInt32Size(5, self.sid); } if (self.hasCid) { size_ += computeUInt32Size(6, self.cid); } if (self.hasAuths) { size_ += computeMessageSize(7, self.auths); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (client_login_result_msg*) parseFromData:(NSData*) data { return (client_login_result_msg*)[[[client_login_result_msg builder] mergeFromData:data] build]; } + (client_login_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_login_result_msg*)[[[client_login_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (client_login_result_msg*) parseFromInputStream:(NSInputStream*) input { return (client_login_result_msg*)[[[client_login_result_msg builder] mergeFromInputStream:input] build]; } + (client_login_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_login_result_msg*)[[[client_login_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (client_login_result_msg*)[[[client_login_result_msg builder] mergeFromCodedInputStream:input] build]; } + (client_login_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_login_result_msg*)[[[client_login_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_login_result_msgBuilder*) builder { return [[client_login_result_msgBuilder alloc] init]; } + (client_login_result_msgBuilder*) builderWithPrototype:(client_login_result_msg*) prototype { return [[client_login_result_msg builder] mergeFrom:prototype]; } - (client_login_result_msgBuilder*) builder { return [client_login_result_msg builder]; } - (client_login_result_msgBuilder*) toBuilder { return [client_login_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasResult) { [output appendFormat:@"%@%@: %@\n", indent, @"result", [NSNumber numberWithBool:self.result]]; } if (self.hasMsg) { [output appendFormat:@"%@%@: %@\n", indent, @"msg", self.msg]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"ext"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasLtype) { [output appendFormat:@"%@%@: %@\n", indent, @"ltype", [NSNumber numberWithInteger:self.ltype]]; } if (self.hasSid) { [output appendFormat:@"%@%@: %@\n", indent, @"sid", [NSNumber numberWithInteger:self.sid]]; } if (self.hasCid) { [output appendFormat:@"%@%@: %@\n", indent, @"cid", [NSNumber numberWithInteger:self.cid]]; } if (self.hasAuths) { [output appendFormat:@"%@%@ {\n", indent, @"auths"]; [self.auths writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasResult) { [dictionary setObject: [NSNumber numberWithBool:self.result] forKey: @"result"]; } if (self.hasMsg) { [dictionary setObject: self.msg forKey: @"msg"]; } for (ext_key_info* element in self.extArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"ext"]; } if (self.hasLtype) { [dictionary setObject: [NSNumber numberWithInteger:self.ltype] forKey: @"ltype"]; } if (self.hasSid) { [dictionary setObject: [NSNumber numberWithInteger:self.sid] forKey: @"sid"]; } if (self.hasCid) { [dictionary setObject: [NSNumber numberWithInteger:self.cid] forKey: @"cid"]; } if (self.hasAuths) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.auths storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"auths"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[client_login_result_msg class]]) { return NO; } client_login_result_msg *otherMessage = other; return self.hasResult == otherMessage.hasResult && (!self.hasResult || self.result == otherMessage.result) && self.hasMsg == otherMessage.hasMsg && (!self.hasMsg || [self.msg isEqual:otherMessage.msg]) && [self.extArray isEqualToArray:otherMessage.extArray] && self.hasLtype == otherMessage.hasLtype && (!self.hasLtype || self.ltype == otherMessage.ltype) && self.hasSid == otherMessage.hasSid && (!self.hasSid || self.sid == otherMessage.sid) && self.hasCid == otherMessage.hasCid && (!self.hasCid || self.cid == otherMessage.cid) && self.hasAuths == otherMessage.hasAuths && (!self.hasAuths || [self.auths isEqual:otherMessage.auths]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasResult) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.result] hash]; } if (self.hasMsg) { hashCode = hashCode * 31 + [self.msg hash]; } [self.extArray enumerateObjectsUsingBlock:^(ext_key_info *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasLtype) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.ltype] hash]; } if (self.hasSid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.sid] hash]; } if (self.hasCid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.cid] hash]; } if (self.hasAuths) { hashCode = hashCode * 31 + [self.auths hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface client_login_result_msgBuilder() @property (strong) client_login_result_msg* resultClientLoginResultMsg; @end @implementation client_login_result_msgBuilder @synthesize resultClientLoginResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultClientLoginResultMsg = [[client_login_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultClientLoginResultMsg; } - (client_login_result_msgBuilder*) clear { self.resultClientLoginResultMsg = [[client_login_result_msg alloc] init]; return self; } - (client_login_result_msgBuilder*) clone { return [client_login_result_msg builderWithPrototype:resultClientLoginResultMsg]; } - (client_login_result_msg*) defaultInstance { return [client_login_result_msg defaultInstance]; } - (client_login_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (client_login_result_msg*) buildPartial { client_login_result_msg* returnMe = resultClientLoginResultMsg; self.resultClientLoginResultMsg = nil; return returnMe; } - (client_login_result_msgBuilder*) mergeFrom:(client_login_result_msg*) other { if (other == [client_login_result_msg defaultInstance]) { return self; } if (other.hasResult) { [self setResult:other.result]; } if (other.hasMsg) { [self setMsg:other.msg]; } if (other.extArray.count > 0) { if (resultClientLoginResultMsg.extArray == nil) { resultClientLoginResultMsg.extArray = [[NSMutableArray alloc] initWithArray:other.extArray]; } else { [resultClientLoginResultMsg.extArray addObjectsFromArray:other.extArray]; } } if (other.hasLtype) { [self setLtype:other.ltype]; } if (other.hasSid) { [self setSid:other.sid]; } if (other.hasCid) { [self setCid:other.cid]; } if (other.hasAuths) { [self mergeAuths:other.auths]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (client_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (client_login_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setResult:[input readBool]]; break; } case 18: { [self setMsg:[input readString]]; break; } case 26: { ext_key_infoBuilder* subBuilder = [ext_key_info builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addExt:[subBuilder buildPartial]]; break; } case 32: { [self setLtype:[input readInt32]]; break; } case 40: { [self setSid:[input readUInt32]]; break; } case 48: { [self setCid:[input readUInt32]]; break; } case 58: { auth_ctx_msgBuilder* subBuilder = [auth_ctx_msg builder]; if (self.hasAuths) { [subBuilder mergeFrom:self.auths]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setAuths:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasResult { return resultClientLoginResultMsg.hasResult; } - (BOOL) result { return resultClientLoginResultMsg.result; } - (client_login_result_msgBuilder*) setResult:(BOOL) value { resultClientLoginResultMsg.hasResult = YES; resultClientLoginResultMsg.result = value; return self; } - (client_login_result_msgBuilder*) clearResult { resultClientLoginResultMsg.hasResult = NO; resultClientLoginResultMsg.result = NO; return self; } - (BOOL) hasMsg { return resultClientLoginResultMsg.hasMsg; } - (NSString*) msg { return resultClientLoginResultMsg.msg; } - (client_login_result_msgBuilder*) setMsg:(NSString*) value { resultClientLoginResultMsg.hasMsg = YES; resultClientLoginResultMsg.msg = value; return self; } - (client_login_result_msgBuilder*) clearMsg { resultClientLoginResultMsg.hasMsg = NO; resultClientLoginResultMsg.msg = @""; return self; } - (NSMutableArray *)ext { return resultClientLoginResultMsg.extArray; } - (ext_key_info*)extAtIndex:(NSUInteger)index { return [resultClientLoginResultMsg extAtIndex:index]; } - (client_login_result_msgBuilder *)addExt:(ext_key_info*)value { if (resultClientLoginResultMsg.extArray == nil) { resultClientLoginResultMsg.extArray = [[NSMutableArray alloc]init]; } [resultClientLoginResultMsg.extArray addObject:value]; return self; } - (client_login_result_msgBuilder *)setExtArray:(NSArray *)array { resultClientLoginResultMsg.extArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (client_login_result_msgBuilder *)clearExt { resultClientLoginResultMsg.extArray = nil; return self; } - (BOOL) hasLtype { return resultClientLoginResultMsg.hasLtype; } - (SInt32) ltype { return resultClientLoginResultMsg.ltype; } - (client_login_result_msgBuilder*) setLtype:(SInt32) value { resultClientLoginResultMsg.hasLtype = YES; resultClientLoginResultMsg.ltype = value; return self; } - (client_login_result_msgBuilder*) clearLtype { resultClientLoginResultMsg.hasLtype = NO; resultClientLoginResultMsg.ltype = 0; return self; } - (BOOL) hasSid { return resultClientLoginResultMsg.hasSid; } - (UInt32) sid { return resultClientLoginResultMsg.sid; } - (client_login_result_msgBuilder*) setSid:(UInt32) value { resultClientLoginResultMsg.hasSid = YES; resultClientLoginResultMsg.sid = value; return self; } - (client_login_result_msgBuilder*) clearSid { resultClientLoginResultMsg.hasSid = NO; resultClientLoginResultMsg.sid = 0; return self; } - (BOOL) hasCid { return resultClientLoginResultMsg.hasCid; } - (UInt32) cid { return resultClientLoginResultMsg.cid; } - (client_login_result_msgBuilder*) setCid:(UInt32) value { resultClientLoginResultMsg.hasCid = YES; resultClientLoginResultMsg.cid = value; return self; } - (client_login_result_msgBuilder*) clearCid { resultClientLoginResultMsg.hasCid = NO; resultClientLoginResultMsg.cid = 0; return self; } - (BOOL) hasAuths { return resultClientLoginResultMsg.hasAuths; } - (auth_ctx_msg*) auths { return resultClientLoginResultMsg.auths; } - (client_login_result_msgBuilder*) setAuths:(auth_ctx_msg*) value { resultClientLoginResultMsg.hasAuths = YES; resultClientLoginResultMsg.auths = value; return self; } - (client_login_result_msgBuilder*) setAuthsBuilder:(auth_ctx_msgBuilder*) builderForValue { return [self setAuths:[builderForValue build]]; } - (client_login_result_msgBuilder*) mergeAuths:(auth_ctx_msg*) value { if (resultClientLoginResultMsg.hasAuths && resultClientLoginResultMsg.auths != [auth_ctx_msg defaultInstance]) { resultClientLoginResultMsg.auths = [[[auth_ctx_msg builderWithPrototype:resultClientLoginResultMsg.auths] mergeFrom:value] buildPartial]; } else { resultClientLoginResultMsg.auths = value; } resultClientLoginResultMsg.hasAuths = YES; return self; } - (client_login_result_msgBuilder*) clearAuths { resultClientLoginResultMsg.hasAuths = NO; resultClientLoginResultMsg.auths = [auth_ctx_msg defaultInstance]; return self; } @end @interface time_range_selector () @property UInt32 begin; @property UInt32 end; @end @implementation time_range_selector - (BOOL) hasBegin { return !!hasBegin_; } - (void) setHasBegin:(BOOL) _value_ { hasBegin_ = !!_value_; } @synthesize begin; - (BOOL) hasEnd { return !!hasEnd_; } - (void) setHasEnd:(BOOL) _value_ { hasEnd_ = !!_value_; } @synthesize end; - (instancetype) init { if ((self = [super init])) { self.begin = 0; self.end = 0; } return self; } static time_range_selector* defaulttime_range_selectorInstance = nil; + (void) initialize { if (self == [time_range_selector class]) { defaulttime_range_selectorInstance = [[time_range_selector alloc] init]; } } + (instancetype) defaultInstance { return defaulttime_range_selectorInstance; } - (instancetype) defaultInstance { return defaulttime_range_selectorInstance; } - (BOOL) isInitialized { if (!self.hasBegin) { return NO; } if (!self.hasEnd) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasBegin) { [output writeUInt32:1 value:self.begin]; } if (self.hasEnd) { [output writeUInt32:2 value:self.end]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasBegin) { size_ += computeUInt32Size(1, self.begin); } if (self.hasEnd) { size_ += computeUInt32Size(2, self.end); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (time_range_selector*) parseFromData:(NSData*) data { return (time_range_selector*)[[[time_range_selector builder] mergeFromData:data] build]; } + (time_range_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (time_range_selector*)[[[time_range_selector builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (time_range_selector*) parseFromInputStream:(NSInputStream*) input { return (time_range_selector*)[[[time_range_selector builder] mergeFromInputStream:input] build]; } + (time_range_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (time_range_selector*)[[[time_range_selector builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (time_range_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (time_range_selector*)[[[time_range_selector builder] mergeFromCodedInputStream:input] build]; } + (time_range_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (time_range_selector*)[[[time_range_selector builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (time_range_selectorBuilder*) builder { return [[time_range_selectorBuilder alloc] init]; } + (time_range_selectorBuilder*) builderWithPrototype:(time_range_selector*) prototype { return [[time_range_selector builder] mergeFrom:prototype]; } - (time_range_selectorBuilder*) builder { return [time_range_selector builder]; } - (time_range_selectorBuilder*) toBuilder { return [time_range_selector builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasBegin) { [output appendFormat:@"%@%@: %@\n", indent, @"begin", [NSNumber numberWithInteger:self.begin]]; } if (self.hasEnd) { [output appendFormat:@"%@%@: %@\n", indent, @"end", [NSNumber numberWithInteger:self.end]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasBegin) { [dictionary setObject: [NSNumber numberWithInteger:self.begin] forKey: @"begin"]; } if (self.hasEnd) { [dictionary setObject: [NSNumber numberWithInteger:self.end] forKey: @"end"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[time_range_selector class]]) { return NO; } time_range_selector *otherMessage = other; return self.hasBegin == otherMessage.hasBegin && (!self.hasBegin || self.begin == otherMessage.begin) && self.hasEnd == otherMessage.hasEnd && (!self.hasEnd || self.end == otherMessage.end) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasBegin) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.begin] hash]; } if (self.hasEnd) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.end] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface time_range_selectorBuilder() @property (strong) time_range_selector* resultTimeRangeSelector; @end @implementation time_range_selectorBuilder @synthesize resultTimeRangeSelector; - (instancetype) init { if ((self = [super init])) { self.resultTimeRangeSelector = [[time_range_selector alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTimeRangeSelector; } - (time_range_selectorBuilder*) clear { self.resultTimeRangeSelector = [[time_range_selector alloc] init]; return self; } - (time_range_selectorBuilder*) clone { return [time_range_selector builderWithPrototype:resultTimeRangeSelector]; } - (time_range_selector*) defaultInstance { return [time_range_selector defaultInstance]; } - (time_range_selector*) build { [self checkInitialized]; return [self buildPartial]; } - (time_range_selector*) buildPartial { time_range_selector* returnMe = resultTimeRangeSelector; self.resultTimeRangeSelector = nil; return returnMe; } - (time_range_selectorBuilder*) mergeFrom:(time_range_selector*) other { if (other == [time_range_selector defaultInstance]) { return self; } if (other.hasBegin) { [self setBegin:other.begin]; } if (other.hasEnd) { [self setEnd:other.end]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (time_range_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (time_range_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setBegin:[input readUInt32]]; break; } case 16: { [self setEnd:[input readUInt32]]; break; } } } } - (BOOL) hasBegin { return resultTimeRangeSelector.hasBegin; } - (UInt32) begin { return resultTimeRangeSelector.begin; } - (time_range_selectorBuilder*) setBegin:(UInt32) value { resultTimeRangeSelector.hasBegin = YES; resultTimeRangeSelector.begin = value; return self; } - (time_range_selectorBuilder*) clearBegin { resultTimeRangeSelector.hasBegin = NO; resultTimeRangeSelector.begin = 0; return self; } - (BOOL) hasEnd { return resultTimeRangeSelector.hasEnd; } - (UInt32) end { return resultTimeRangeSelector.end; } - (time_range_selectorBuilder*) setEnd:(UInt32) value { resultTimeRangeSelector.hasEnd = YES; resultTimeRangeSelector.end = value; return self; } - (time_range_selectorBuilder*) clearEnd { resultTimeRangeSelector.hasEnd = NO; resultTimeRangeSelector.end = 0; return self; } @end @interface count_offset_selector () @property UInt32 offset; @property SInt32 count; @end @implementation count_offset_selector - (BOOL) hasOffset { return !!hasOffset_; } - (void) setHasOffset:(BOOL) _value_ { hasOffset_ = !!_value_; } @synthesize offset; - (BOOL) hasCount { return !!hasCount_; } - (void) setHasCount:(BOOL) _value_ { hasCount_ = !!_value_; } @synthesize count; - (instancetype) init { if ((self = [super init])) { self.offset = 0; self.count = 0; } return self; } static count_offset_selector* defaultcount_offset_selectorInstance = nil; + (void) initialize { if (self == [count_offset_selector class]) { defaultcount_offset_selectorInstance = [[count_offset_selector alloc] init]; } } + (instancetype) defaultInstance { return defaultcount_offset_selectorInstance; } - (instancetype) defaultInstance { return defaultcount_offset_selectorInstance; } - (BOOL) isInitialized { if (!self.hasOffset) { return NO; } if (!self.hasCount) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasOffset) { [output writeUInt32:1 value:self.offset]; } if (self.hasCount) { [output writeInt32:2 value:self.count]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasOffset) { size_ += computeUInt32Size(1, self.offset); } if (self.hasCount) { size_ += computeInt32Size(2, self.count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (count_offset_selector*) parseFromData:(NSData*) data { return (count_offset_selector*)[[[count_offset_selector builder] mergeFromData:data] build]; } + (count_offset_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (count_offset_selector*)[[[count_offset_selector builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (count_offset_selector*) parseFromInputStream:(NSInputStream*) input { return (count_offset_selector*)[[[count_offset_selector builder] mergeFromInputStream:input] build]; } + (count_offset_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (count_offset_selector*)[[[count_offset_selector builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (count_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (count_offset_selector*)[[[count_offset_selector builder] mergeFromCodedInputStream:input] build]; } + (count_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (count_offset_selector*)[[[count_offset_selector builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (count_offset_selectorBuilder*) builder { return [[count_offset_selectorBuilder alloc] init]; } + (count_offset_selectorBuilder*) builderWithPrototype:(count_offset_selector*) prototype { return [[count_offset_selector builder] mergeFrom:prototype]; } - (count_offset_selectorBuilder*) builder { return [count_offset_selector builder]; } - (count_offset_selectorBuilder*) toBuilder { return [count_offset_selector builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasOffset) { [output appendFormat:@"%@%@: %@\n", indent, @"offset", [NSNumber numberWithInteger:self.offset]]; } if (self.hasCount) { [output appendFormat:@"%@%@: %@\n", indent, @"count", [NSNumber numberWithInteger:self.count]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasOffset) { [dictionary setObject: [NSNumber numberWithInteger:self.offset] forKey: @"offset"]; } if (self.hasCount) { [dictionary setObject: [NSNumber numberWithInteger:self.count] forKey: @"count"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[count_offset_selector class]]) { return NO; } count_offset_selector *otherMessage = other; return self.hasOffset == otherMessage.hasOffset && (!self.hasOffset || self.offset == otherMessage.offset) && self.hasCount == otherMessage.hasCount && (!self.hasCount || self.count == otherMessage.count) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasOffset) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.offset] hash]; } if (self.hasCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.count] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface count_offset_selectorBuilder() @property (strong) count_offset_selector* resultCountOffsetSelector; @end @implementation count_offset_selectorBuilder @synthesize resultCountOffsetSelector; - (instancetype) init { if ((self = [super init])) { self.resultCountOffsetSelector = [[count_offset_selector alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultCountOffsetSelector; } - (count_offset_selectorBuilder*) clear { self.resultCountOffsetSelector = [[count_offset_selector alloc] init]; return self; } - (count_offset_selectorBuilder*) clone { return [count_offset_selector builderWithPrototype:resultCountOffsetSelector]; } - (count_offset_selector*) defaultInstance { return [count_offset_selector defaultInstance]; } - (count_offset_selector*) build { [self checkInitialized]; return [self buildPartial]; } - (count_offset_selector*) buildPartial { count_offset_selector* returnMe = resultCountOffsetSelector; self.resultCountOffsetSelector = nil; return returnMe; } - (count_offset_selectorBuilder*) mergeFrom:(count_offset_selector*) other { if (other == [count_offset_selector defaultInstance]) { return self; } if (other.hasOffset) { [self setOffset:other.offset]; } if (other.hasCount) { [self setCount:other.count]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (count_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (count_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setOffset:[input readUInt32]]; break; } case 16: { [self setCount:[input readInt32]]; break; } } } } - (BOOL) hasOffset { return resultCountOffsetSelector.hasOffset; } - (UInt32) offset { return resultCountOffsetSelector.offset; } - (count_offset_selectorBuilder*) setOffset:(UInt32) value { resultCountOffsetSelector.hasOffset = YES; resultCountOffsetSelector.offset = value; return self; } - (count_offset_selectorBuilder*) clearOffset { resultCountOffsetSelector.hasOffset = NO; resultCountOffsetSelector.offset = 0; return self; } - (BOOL) hasCount { return resultCountOffsetSelector.hasCount; } - (SInt32) count { return resultCountOffsetSelector.count; } - (count_offset_selectorBuilder*) setCount:(SInt32) value { resultCountOffsetSelector.hasCount = YES; resultCountOffsetSelector.count = value; return self; } - (count_offset_selectorBuilder*) clearCount { resultCountOffsetSelector.hasCount = NO; resultCountOffsetSelector.count = 0; return self; } @end @interface time_offset_selector () @property UInt32 originTime; @property SInt32 count; @end @implementation time_offset_selector - (BOOL) hasOriginTime { return !!hasOriginTime_; } - (void) setHasOriginTime:(BOOL) _value_ { hasOriginTime_ = !!_value_; } @synthesize originTime; - (BOOL) hasCount { return !!hasCount_; } - (void) setHasCount:(BOOL) _value_ { hasCount_ = !!_value_; } @synthesize count; - (instancetype) init { if ((self = [super init])) { self.originTime = 0; self.count = 0; } return self; } static time_offset_selector* defaulttime_offset_selectorInstance = nil; + (void) initialize { if (self == [time_offset_selector class]) { defaulttime_offset_selectorInstance = [[time_offset_selector alloc] init]; } } + (instancetype) defaultInstance { return defaulttime_offset_selectorInstance; } - (instancetype) defaultInstance { return defaulttime_offset_selectorInstance; } - (BOOL) isInitialized { if (!self.hasOriginTime) { return NO; } if (!self.hasCount) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasOriginTime) { [output writeUInt32:1 value:self.originTime]; } if (self.hasCount) { [output writeInt32:2 value:self.count]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasOriginTime) { size_ += computeUInt32Size(1, self.originTime); } if (self.hasCount) { size_ += computeInt32Size(2, self.count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (time_offset_selector*) parseFromData:(NSData*) data { return (time_offset_selector*)[[[time_offset_selector builder] mergeFromData:data] build]; } + (time_offset_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (time_offset_selector*)[[[time_offset_selector builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (time_offset_selector*) parseFromInputStream:(NSInputStream*) input { return (time_offset_selector*)[[[time_offset_selector builder] mergeFromInputStream:input] build]; } + (time_offset_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (time_offset_selector*)[[[time_offset_selector builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (time_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (time_offset_selector*)[[[time_offset_selector builder] mergeFromCodedInputStream:input] build]; } + (time_offset_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (time_offset_selector*)[[[time_offset_selector builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (time_offset_selectorBuilder*) builder { return [[time_offset_selectorBuilder alloc] init]; } + (time_offset_selectorBuilder*) builderWithPrototype:(time_offset_selector*) prototype { return [[time_offset_selector builder] mergeFrom:prototype]; } - (time_offset_selectorBuilder*) builder { return [time_offset_selector builder]; } - (time_offset_selectorBuilder*) toBuilder { return [time_offset_selector builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasOriginTime) { [output appendFormat:@"%@%@: %@\n", indent, @"originTime", [NSNumber numberWithInteger:self.originTime]]; } if (self.hasCount) { [output appendFormat:@"%@%@: %@\n", indent, @"count", [NSNumber numberWithInteger:self.count]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasOriginTime) { [dictionary setObject: [NSNumber numberWithInteger:self.originTime] forKey: @"originTime"]; } if (self.hasCount) { [dictionary setObject: [NSNumber numberWithInteger:self.count] forKey: @"count"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[time_offset_selector class]]) { return NO; } time_offset_selector *otherMessage = other; return self.hasOriginTime == otherMessage.hasOriginTime && (!self.hasOriginTime || self.originTime == otherMessage.originTime) && self.hasCount == otherMessage.hasCount && (!self.hasCount || self.count == otherMessage.count) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasOriginTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.originTime] hash]; } if (self.hasCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.count] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface time_offset_selectorBuilder() @property (strong) time_offset_selector* resultTimeOffsetSelector; @end @implementation time_offset_selectorBuilder @synthesize resultTimeOffsetSelector; - (instancetype) init { if ((self = [super init])) { self.resultTimeOffsetSelector = [[time_offset_selector alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTimeOffsetSelector; } - (time_offset_selectorBuilder*) clear { self.resultTimeOffsetSelector = [[time_offset_selector alloc] init]; return self; } - (time_offset_selectorBuilder*) clone { return [time_offset_selector builderWithPrototype:resultTimeOffsetSelector]; } - (time_offset_selector*) defaultInstance { return [time_offset_selector defaultInstance]; } - (time_offset_selector*) build { [self checkInitialized]; return [self buildPartial]; } - (time_offset_selector*) buildPartial { time_offset_selector* returnMe = resultTimeOffsetSelector; self.resultTimeOffsetSelector = nil; return returnMe; } - (time_offset_selectorBuilder*) mergeFrom:(time_offset_selector*) other { if (other == [time_offset_selector defaultInstance]) { return self; } if (other.hasOriginTime) { [self setOriginTime:other.originTime]; } if (other.hasCount) { [self setCount:other.count]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (time_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (time_offset_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setOriginTime:[input readUInt32]]; break; } case 16: { [self setCount:[input readInt32]]; break; } } } } - (BOOL) hasOriginTime { return resultTimeOffsetSelector.hasOriginTime; } - (UInt32) originTime { return resultTimeOffsetSelector.originTime; } - (time_offset_selectorBuilder*) setOriginTime:(UInt32) value { resultTimeOffsetSelector.hasOriginTime = YES; resultTimeOffsetSelector.originTime = value; return self; } - (time_offset_selectorBuilder*) clearOriginTime { resultTimeOffsetSelector.hasOriginTime = NO; resultTimeOffsetSelector.originTime = 0; return self; } - (BOOL) hasCount { return resultTimeOffsetSelector.hasCount; } - (SInt32) count { return resultTimeOffsetSelector.count; } - (time_offset_selectorBuilder*) setCount:(SInt32) value { resultTimeOffsetSelector.hasCount = YES; resultTimeOffsetSelector.count = value; return self; } - (time_offset_selectorBuilder*) clearCount { resultTimeOffsetSelector.hasCount = NO; resultTimeOffsetSelector.count = 0; return self; } @end @interface data_selector () @property UInt32 selectorType; @property (strong) NSData* selector; @end @implementation data_selector - (BOOL) hasSelectorType { return !!hasSelectorType_; } - (void) setHasSelectorType:(BOOL) _value_ { hasSelectorType_ = !!_value_; } @synthesize selectorType; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (instancetype) init { if ((self = [super init])) { self.selectorType = 0; self.selector = [NSData data]; } return self; } static data_selector* defaultdata_selectorInstance = nil; + (void) initialize { if (self == [data_selector class]) { defaultdata_selectorInstance = [[data_selector alloc] init]; } } + (instancetype) defaultInstance { return defaultdata_selectorInstance; } - (instancetype) defaultInstance { return defaultdata_selectorInstance; } - (BOOL) isInitialized { if (!self.hasSelectorType) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasSelectorType) { [output writeUInt32:1 value:self.selectorType]; } if (self.hasSelector) { [output writeData:2 value:self.selector]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasSelectorType) { size_ += computeUInt32Size(1, self.selectorType); } if (self.hasSelector) { size_ += computeDataSize(2, self.selector); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (data_selector*) parseFromData:(NSData*) data { return (data_selector*)[[[data_selector builder] mergeFromData:data] build]; } + (data_selector*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (data_selector*)[[[data_selector builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (data_selector*) parseFromInputStream:(NSInputStream*) input { return (data_selector*)[[[data_selector builder] mergeFromInputStream:input] build]; } + (data_selector*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (data_selector*)[[[data_selector builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (data_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (data_selector*)[[[data_selector builder] mergeFromCodedInputStream:input] build]; } + (data_selector*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (data_selector*)[[[data_selector builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (data_selectorBuilder*) builder { return [[data_selectorBuilder alloc] init]; } + (data_selectorBuilder*) builderWithPrototype:(data_selector*) prototype { return [[data_selector builder] mergeFrom:prototype]; } - (data_selectorBuilder*) builder { return [data_selector builder]; } - (data_selectorBuilder*) toBuilder { return [data_selector builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasSelectorType) { [output appendFormat:@"%@%@: %@\n", indent, @"selectorType", [NSNumber numberWithInteger:self.selectorType]]; } if (self.hasSelector) { [output appendFormat:@"%@%@: %@\n", indent, @"selector", self.selector]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasSelectorType) { [dictionary setObject: [NSNumber numberWithInteger:self.selectorType] forKey: @"selectorType"]; } if (self.hasSelector) { [dictionary setObject: self.selector forKey: @"selector"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[data_selector class]]) { return NO; } data_selector *otherMessage = other; return self.hasSelectorType == otherMessage.hasSelectorType && (!self.hasSelectorType || self.selectorType == otherMessage.selectorType) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasSelectorType) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.selectorType] hash]; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface data_selectorBuilder() @property (strong) data_selector* resultDataSelector; @end @implementation data_selectorBuilder @synthesize resultDataSelector; - (instancetype) init { if ((self = [super init])) { self.resultDataSelector = [[data_selector alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultDataSelector; } - (data_selectorBuilder*) clear { self.resultDataSelector = [[data_selector alloc] init]; return self; } - (data_selectorBuilder*) clone { return [data_selector builderWithPrototype:resultDataSelector]; } - (data_selector*) defaultInstance { return [data_selector defaultInstance]; } - (data_selector*) build { [self checkInitialized]; return [self buildPartial]; } - (data_selector*) buildPartial { data_selector* returnMe = resultDataSelector; self.resultDataSelector = nil; return returnMe; } - (data_selectorBuilder*) mergeFrom:(data_selector*) other { if (other == [data_selector defaultInstance]) { return self; } if (other.hasSelectorType) { [self setSelectorType:other.selectorType]; } if (other.hasSelector) { [self setSelector:other.selector]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (data_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (data_selectorBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setSelectorType:[input readUInt32]]; break; } case 18: { [self setSelector:[input readData]]; break; } } } } - (BOOL) hasSelectorType { return resultDataSelector.hasSelectorType; } - (UInt32) selectorType { return resultDataSelector.selectorType; } - (data_selectorBuilder*) setSelectorType:(UInt32) value { resultDataSelector.hasSelectorType = YES; resultDataSelector.selectorType = value; return self; } - (data_selectorBuilder*) clearSelectorType { resultDataSelector.hasSelectorType = NO; resultDataSelector.selectorType = 0; return self; } - (BOOL) hasSelector { return resultDataSelector.hasSelector; } - (NSData*) selector { return resultDataSelector.selector; } - (data_selectorBuilder*) setSelector:(NSData*) value { resultDataSelector.hasSelector = YES; resultDataSelector.selector = value; return self; } - (data_selectorBuilder*) clearSelector { resultDataSelector.hasSelector = NO; resultDataSelector.selector = [NSData data]; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Index.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" #import "Common.pb.h" // @@protoc_insertion_point(imports) @class auth_ctx_msg; @class auth_ctx_msgBuilder; @class bljj; @class bljjBuilder; @class bljj_array; @class bljj_arrayBuilder; @class client_index_combo_result_msg; @class client_index_combo_result_msgBuilder; @class client_login_msg; @class client_login_msgBuilder; @class client_login_result_msg; @class client_login_result_msgBuilder; @class client_request_index_msg; @class client_request_index_msgBuilder; @class client_request_index_result_msg; @class client_request_index_result_msgBuilder; @class client_request_rise_drop_msg; @class client_request_rise_drop_msgBuilder; @class combo_private_msg; @class combo_private_msgBuilder; @class common_reply_error_msg; @class common_reply_error_msgBuilder; @class common_update_notice_msg; @class common_update_notice_msgBuilder; @class count_offset_selector; @class count_offset_selectorBuilder; @class data_selector; @class data_selectorBuilder; @class error_feedback_msg; @class error_feedback_msgBuilder; @class ext_key_info; @class ext_key_infoBuilder; @class hhjvol; @class hhjvolBuilder; @class hhjvol_array; @class hhjvol_arrayBuilder; @class hyxd; @class hyxdBuilder; @class hyxd_array; @class hyxd_arrayBuilder; @class index_data_msg; @class index_data_msgBuilder; @class index_data_result_msg; @class index_data_result_msgBuilder; @class kline_tj_data; @class kline_tj_dataBuilder; @class kline_tj_data_array; @class kline_tj_data_arrayBuilder; @class ldzj; @class ldzjBuilder; @class ldzj_array; @class ldzj_arrayBuilder; @class load_dector_msg; @class load_dector_msgBuilder; @class ma; @class maBuilder; @class ma_array; @class ma_arrayBuilder; @class ma_param; @class ma_paramBuilder; @class minute_tj_data; @class minute_tj_dataBuilder; @class minute_tj_data_array; @class minute_tj_data_arrayBuilder; @class notify_ack_msg; @class notify_ack_msgBuilder; @class push_notify_msg; @class push_notify_msgBuilder; @class qlft; @class qlftBuilder; @class qlft_array; @class qlft_arrayBuilder; @class rise_drop_data; @class rise_drop_dataBuilder; @class rise_drop_result_msg; @class rise_drop_result_msgBuilder; @class rpc_msg_root; @class rpc_msg_rootBuilder; @class server_login_msg; @class server_login_msgBuilder; @class server_login_result_msg; @class server_login_result_msgBuilder; @class sstp; @class sstpBuilder; @class sstp_array; @class sstp_arrayBuilder; @class subcribe_msg; @class subcribe_msgBuilder; @class sync_notify_msg; @class sync_notify_msgBuilder; @class time_offset_selector; @class time_offset_selectorBuilder; @class time_range_selector; @class time_range_selectorBuilder; @class tj_draw_value; @class tj_draw_valueBuilder; @class xdjw; @class xdjwBuilder; @class xdjw_array; @class xdjw_arrayBuilder; @class zcc; @class zccBuilder; @class zcc_array; @class zcc_arrayBuilder; @class zljme; @class zljmeBuilder; @class zljme_array; @class zljme_arrayBuilder; @class zlkp; @class zlkpBuilder; @class zlkp_array; @class zlkp_arrayBuilder; @class zlzj; @class zlzjBuilder; @class zlzj_array; @class zlzj_arrayBuilder; @class zlzt; @class zlztBuilder; @class zlzt_array; @class zlzt_arrayBuilder; @class zlzz; @class zlzzBuilder; @class zlzz_array; @class zlzz_arrayBuilder; typedef NS_ENUM(SInt32, enum_index) { enum_indexBeginIndexEnum = -1, enum_indexIndexCombo = 0, enum_indexIndex3Bws = 1, enum_indexIndexBdmr = 2, enum_indexIndexBljc = 3, enum_indexIndexCtx = 4, enum_indexIndexDkgz = 5, enum_indexIndexJdd = 6, enum_indexIndexDadi = 7, enum_indexIndexZhongdi = 8, enum_indexIndexXiaodi = 9, enum_indexIndexDzct = 10, enum_indexIndexGkgz = 11, enum_indexIndexHyfg = 12, enum_indexIndexKongpan = 13, enum_indexIndexQlcj = 14, enum_indexIndexSgcx = 15, enum_indexIndexSscd = 16, enum_indexIndexSshd = 17, enum_indexIndexSstp = 18, enum_indexIndexSstpy = 19, enum_indexIndexYyz = 20, enum_indexIndexZlcxg = 21, enum_indexIndexKongpanJiaCangBDian = 22, enum_indexIndexSstd = 23, enum_indexIndexZtgz = 24, enum_indexIndexKDfp = 25, enum_indexIndexKpjc = 26, enum_indexIndexZlzz = 27, enum_indexIndexZlzt = 28, enum_indexIndexZlzj = 29, enum_indexIndexXdjw = 30, enum_indexIndexZljme = 31, enum_indexIndexHighValue = 32, enum_indexFtIndexZlzz = 33, enum_indexFtIndexBljj = 34, enum_indexFtIndexZltj = 35, enum_indexFtIndexMinZltj = 36, enum_indexFtIndexGftj = 37, enum_indexFtIndexMinGftj = 38, enum_indexFtIndexShtj = 39, enum_indexFtIndexMinShtj = 40, enum_indexFtIndexQlft = 41, enum_indexFtIndexLdzj = 42, enum_indexFtIndexSstp = 43, enum_indexFtIndexZlkp = 44, enum_indexFtIndexZljme = 45, enum_indexFtIndexHhjvol = 46, enum_indexFtIndexZcc = 47, enum_indexFtIndexXdjw = 48, enum_indexFtIndexHyxd = 49, enum_indexFtIndexMa = 50, enum_indexEndIndexEnum = 51, }; BOOL enum_indexIsValidValue(enum_index value); NSString *NSStringFromenum_index(enum_index value); typedef NS_ENUM(SInt32, index_data_type) { index_data_typeCycleBegin = -1, index_data_typeIndexCycle1Min = 0, index_data_typeIndexCycle3Min = 1, index_data_typeIndexCycle5Min = 2, index_data_typeIndexCycle10Min = 3, index_data_typeIndexCycle15Min = 4, index_data_typeIndexCycle20Min = 5, index_data_typeIndexCycle30Min = 6, index_data_typeIndexCycle60Min = 7, index_data_typeIndexCycleDay = 8, index_data_typeIndexCycleWeek = 9, index_data_typeIndexCycleMonth = 10, index_data_typeIndexCycleQuarter = 11, index_data_typeIndexCycleYear = 12, index_data_typeCycleEnd = 10000, }; BOOL index_data_typeIsValidValue(index_data_type value); NSString *NSStringFromindex_data_type(index_data_type value); @interface IndexRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define client_request_index_msg_name @"name" @interface client_request_index_msg : PBGeneratedMessage { @private BOOL hasName_:1; enum_index name; } - (BOOL) hasName; @property (readonly) enum_index name; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (client_request_index_msgBuilder*) builder; + (client_request_index_msgBuilder*) builder; + (client_request_index_msgBuilder*) builderWithPrototype:(client_request_index_msg*) prototype; - (client_request_index_msgBuilder*) toBuilder; + (client_request_index_msg*) parseFromData:(NSData*) data; + (client_request_index_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_request_index_msg*) parseFromInputStream:(NSInputStream*) input; + (client_request_index_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_request_index_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (client_request_index_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface client_request_index_msgBuilder : PBGeneratedMessageBuilder { @private client_request_index_msg* resultClientRequestIndexMsg; } - (client_request_index_msg*) defaultInstance; - (client_request_index_msgBuilder*) clear; - (client_request_index_msgBuilder*) clone; - (client_request_index_msg*) build; - (client_request_index_msg*) buildPartial; - (client_request_index_msgBuilder*) mergeFrom:(client_request_index_msg*) other; - (client_request_index_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (client_request_index_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (enum_index) name; - (client_request_index_msgBuilder*) setName:(enum_index) value; - (client_request_index_msgBuilder*) clearName; @end #define client_request_index_result_msg_name @"name" #define client_request_index_result_msg_stock_code @"stockCode" @interface client_request_index_result_msg : PBGeneratedMessage { @private BOOL hasName_:1; enum_index name; NSMutableArray * stockCodeArray; } - (BOOL) hasName; @property (readonly) enum_index name; @property (readonly, strong) NSArray * stockCode; - (NSString*)stockCodeAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (client_request_index_result_msgBuilder*) builder; + (client_request_index_result_msgBuilder*) builder; + (client_request_index_result_msgBuilder*) builderWithPrototype:(client_request_index_result_msg*) prototype; - (client_request_index_result_msgBuilder*) toBuilder; + (client_request_index_result_msg*) parseFromData:(NSData*) data; + (client_request_index_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_request_index_result_msg*) parseFromInputStream:(NSInputStream*) input; + (client_request_index_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_request_index_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (client_request_index_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface client_request_index_result_msgBuilder : PBGeneratedMessageBuilder { @private client_request_index_result_msg* resultClientRequestIndexResultMsg; } - (client_request_index_result_msg*) defaultInstance; - (client_request_index_result_msgBuilder*) clear; - (client_request_index_result_msgBuilder*) clone; - (client_request_index_result_msg*) build; - (client_request_index_result_msg*) buildPartial; - (client_request_index_result_msgBuilder*) mergeFrom:(client_request_index_result_msg*) other; - (client_request_index_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (client_request_index_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (enum_index) name; - (client_request_index_result_msgBuilder*) setName:(enum_index) value; - (client_request_index_result_msgBuilder*) clearName; - (NSMutableArray *)stockCode; - (NSString*)stockCodeAtIndex:(NSUInteger)index; - (client_request_index_result_msgBuilder *)addStockCode:(NSString*)value; - (client_request_index_result_msgBuilder *)setStockCodeArray:(NSArray *)array; - (client_request_index_result_msgBuilder *)clearStockCode; @end #define client_index_combo_result_msg_index_node @"indexNode" @interface client_index_combo_result_msg : PBGeneratedMessage { @private NSMutableArray * indexNodeArray; } @property (readonly, strong) NSArray * indexNode; - (client_request_index_result_msg*)indexNodeAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (client_index_combo_result_msgBuilder*) builder; + (client_index_combo_result_msgBuilder*) builder; + (client_index_combo_result_msgBuilder*) builderWithPrototype:(client_index_combo_result_msg*) prototype; - (client_index_combo_result_msgBuilder*) toBuilder; + (client_index_combo_result_msg*) parseFromData:(NSData*) data; + (client_index_combo_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_index_combo_result_msg*) parseFromInputStream:(NSInputStream*) input; + (client_index_combo_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_index_combo_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (client_index_combo_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface client_index_combo_result_msgBuilder : PBGeneratedMessageBuilder { @private client_index_combo_result_msg* resultClientIndexComboResultMsg; } - (client_index_combo_result_msg*) defaultInstance; - (client_index_combo_result_msgBuilder*) clear; - (client_index_combo_result_msgBuilder*) clone; - (client_index_combo_result_msg*) build; - (client_index_combo_result_msg*) buildPartial; - (client_index_combo_result_msgBuilder*) mergeFrom:(client_index_combo_result_msg*) other; - (client_index_combo_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (client_index_combo_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexNode; - (client_request_index_result_msg*)indexNodeAtIndex:(NSUInteger)index; - (client_index_combo_result_msgBuilder *)addIndexNode:(client_request_index_result_msg*)value; - (client_index_combo_result_msgBuilder *)setIndexNodeArray:(NSArray *)array; - (client_index_combo_result_msgBuilder *)clearIndexNode; @end #define error_feedback_msg_msg @"msg" @interface error_feedback_msg : PBGeneratedMessage { @private BOOL hasMsg_:1; NSString* msg; } - (BOOL) hasMsg; @property (readonly, strong) NSString* msg; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (error_feedback_msgBuilder*) builder; + (error_feedback_msgBuilder*) builder; + (error_feedback_msgBuilder*) builderWithPrototype:(error_feedback_msg*) prototype; - (error_feedback_msgBuilder*) toBuilder; + (error_feedback_msg*) parseFromData:(NSData*) data; + (error_feedback_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (error_feedback_msg*) parseFromInputStream:(NSInputStream*) input; + (error_feedback_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (error_feedback_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (error_feedback_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface error_feedback_msgBuilder : PBGeneratedMessageBuilder { @private error_feedback_msg* resultErrorFeedbackMsg; } - (error_feedback_msg*) defaultInstance; - (error_feedback_msgBuilder*) clear; - (error_feedback_msgBuilder*) clone; - (error_feedback_msg*) build; - (error_feedback_msg*) buildPartial; - (error_feedback_msgBuilder*) mergeFrom:(error_feedback_msg*) other; - (error_feedback_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (error_feedback_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasMsg; - (NSString*) msg; - (error_feedback_msgBuilder*) setMsg:(NSString*) value; - (error_feedback_msgBuilder*) clearMsg; @end #define index_data_msg_name @"name" #define index_data_msg_stock_code @"stockCode" #define index_data_msg_cycle_type @"cycleType" #define index_data_msg_selector @"selector" #define index_data_msg_index_param @"indexParam" @interface index_data_msg : PBGeneratedMessage { @private BOOL hasStockCode_:1; BOOL hasSelector_:1; BOOL hasIndexParam_:1; BOOL hasName_:1; BOOL hasCycleType_:1; NSString* stockCode; data_selector* selector; NSData* indexParam; enum_index name; index_data_type cycleType; } - (BOOL) hasName; - (BOOL) hasStockCode; - (BOOL) hasCycleType; - (BOOL) hasSelector; - (BOOL) hasIndexParam; @property (readonly) enum_index name; @property (readonly, strong) NSString* stockCode; @property (readonly) index_data_type cycleType; @property (readonly, strong) data_selector* selector; @property (readonly, strong) NSData* indexParam; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (index_data_msgBuilder*) builder; + (index_data_msgBuilder*) builder; + (index_data_msgBuilder*) builderWithPrototype:(index_data_msg*) prototype; - (index_data_msgBuilder*) toBuilder; + (index_data_msg*) parseFromData:(NSData*) data; + (index_data_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (index_data_msg*) parseFromInputStream:(NSInputStream*) input; + (index_data_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (index_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (index_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface index_data_msgBuilder : PBGeneratedMessageBuilder { @private index_data_msg* resultIndexDataMsg; } - (index_data_msg*) defaultInstance; - (index_data_msgBuilder*) clear; - (index_data_msgBuilder*) clone; - (index_data_msg*) build; - (index_data_msg*) buildPartial; - (index_data_msgBuilder*) mergeFrom:(index_data_msg*) other; - (index_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (index_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (enum_index) name; - (index_data_msgBuilder*) setName:(enum_index) value; - (index_data_msgBuilder*) clearName; - (BOOL) hasStockCode; - (NSString*) stockCode; - (index_data_msgBuilder*) setStockCode:(NSString*) value; - (index_data_msgBuilder*) clearStockCode; - (BOOL) hasCycleType; - (index_data_type) cycleType; - (index_data_msgBuilder*) setCycleType:(index_data_type) value; - (index_data_msgBuilder*) clearCycleType; - (BOOL) hasSelector; - (data_selector*) selector; - (index_data_msgBuilder*) setSelector:(data_selector*) value; - (index_data_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue; - (index_data_msgBuilder*) mergeSelector:(data_selector*) value; - (index_data_msgBuilder*) clearSelector; - (BOOL) hasIndexParam; - (NSData*) indexParam; - (index_data_msgBuilder*) setIndexParam:(NSData*) value; - (index_data_msgBuilder*) clearIndexParam; @end #define zlzz_time @"time" #define zlzz_zlzz_value @"zlzzValue" @interface zlzz : PBGeneratedMessage { @private BOOL hasZlzzValue_:1; BOOL hasTime_:1; Float64 zlzzValue; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasZlzzValue; @property (readonly) UInt32 time; @property (readonly) Float64 zlzzValue; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlzzBuilder*) builder; + (zlzzBuilder*) builder; + (zlzzBuilder*) builderWithPrototype:(zlzz*) prototype; - (zlzzBuilder*) toBuilder; + (zlzz*) parseFromData:(NSData*) data; + (zlzz*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzz*) parseFromInputStream:(NSInputStream*) input; + (zlzz*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzz*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlzz*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlzzBuilder : PBGeneratedMessageBuilder { @private zlzz* resultZlzz; } - (zlzz*) defaultInstance; - (zlzzBuilder*) clear; - (zlzzBuilder*) clone; - (zlzz*) build; - (zlzz*) buildPartial; - (zlzzBuilder*) mergeFrom:(zlzz*) other; - (zlzzBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlzzBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (zlzzBuilder*) setTime:(UInt32) value; - (zlzzBuilder*) clearTime; - (BOOL) hasZlzzValue; - (Float64) zlzzValue; - (zlzzBuilder*) setZlzzValue:(Float64) value; - (zlzzBuilder*) clearZlzzValue; @end #define zlzz_array_index_data @"indexData" @interface zlzz_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (zlzz*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlzz_arrayBuilder*) builder; + (zlzz_arrayBuilder*) builder; + (zlzz_arrayBuilder*) builderWithPrototype:(zlzz_array*) prototype; - (zlzz_arrayBuilder*) toBuilder; + (zlzz_array*) parseFromData:(NSData*) data; + (zlzz_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzz_array*) parseFromInputStream:(NSInputStream*) input; + (zlzz_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzz_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlzz_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlzz_arrayBuilder : PBGeneratedMessageBuilder { @private zlzz_array* resultZlzzArray; } - (zlzz_array*) defaultInstance; - (zlzz_arrayBuilder*) clear; - (zlzz_arrayBuilder*) clone; - (zlzz_array*) build; - (zlzz_array*) buildPartial; - (zlzz_arrayBuilder*) mergeFrom:(zlzz_array*) other; - (zlzz_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlzz_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (zlzz*)indexDataAtIndex:(NSUInteger)index; - (zlzz_arrayBuilder *)addIndexData:(zlzz*)value; - (zlzz_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (zlzz_arrayBuilder *)clearIndexData; @end #define zlzt_time @"time" #define zlzt_duan_xian_shang_gong @"duanXianShangGong" #define zlzt_zhong_xian_qiang_shi @"zhongXianQiangShi" #define zlzt_zhong_xian_kong_pan @"zhongXianKongPan" #define zlzt_duan_xian_chao_die @"duanXianChaoDie" #define zlzt_zhong_xian_chao_die @"zhongXianChaoDie" @interface zlzt : PBGeneratedMessage { @private BOOL hasDuanXianShangGong_:1; BOOL hasZhongXianQiangShi_:1; BOOL hasZhongXianKongPan_:1; BOOL hasDuanXianChaoDie_:1; BOOL hasZhongXianChaoDie_:1; BOOL hasTime_:1; Float64 duanXianShangGong; Float64 zhongXianQiangShi; Float64 zhongXianKongPan; Float64 duanXianChaoDie; Float64 zhongXianChaoDie; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasDuanXianShangGong; - (BOOL) hasZhongXianQiangShi; - (BOOL) hasZhongXianKongPan; - (BOOL) hasDuanXianChaoDie; - (BOOL) hasZhongXianChaoDie; @property (readonly) UInt32 time; @property (readonly) Float64 duanXianShangGong; @property (readonly) Float64 zhongXianQiangShi; @property (readonly) Float64 zhongXianKongPan; @property (readonly) Float64 duanXianChaoDie; @property (readonly) Float64 zhongXianChaoDie; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlztBuilder*) builder; + (zlztBuilder*) builder; + (zlztBuilder*) builderWithPrototype:(zlzt*) prototype; - (zlztBuilder*) toBuilder; + (zlzt*) parseFromData:(NSData*) data; + (zlzt*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzt*) parseFromInputStream:(NSInputStream*) input; + (zlzt*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzt*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlzt*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlztBuilder : PBGeneratedMessageBuilder { @private zlzt* resultZlzt; } - (zlzt*) defaultInstance; - (zlztBuilder*) clear; - (zlztBuilder*) clone; - (zlzt*) build; - (zlzt*) buildPartial; - (zlztBuilder*) mergeFrom:(zlzt*) other; - (zlztBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlztBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (zlztBuilder*) setTime:(UInt32) value; - (zlztBuilder*) clearTime; - (BOOL) hasDuanXianShangGong; - (Float64) duanXianShangGong; - (zlztBuilder*) setDuanXianShangGong:(Float64) value; - (zlztBuilder*) clearDuanXianShangGong; - (BOOL) hasZhongXianQiangShi; - (Float64) zhongXianQiangShi; - (zlztBuilder*) setZhongXianQiangShi:(Float64) value; - (zlztBuilder*) clearZhongXianQiangShi; - (BOOL) hasZhongXianKongPan; - (Float64) zhongXianKongPan; - (zlztBuilder*) setZhongXianKongPan:(Float64) value; - (zlztBuilder*) clearZhongXianKongPan; - (BOOL) hasDuanXianChaoDie; - (Float64) duanXianChaoDie; - (zlztBuilder*) setDuanXianChaoDie:(Float64) value; - (zlztBuilder*) clearDuanXianChaoDie; - (BOOL) hasZhongXianChaoDie; - (Float64) zhongXianChaoDie; - (zlztBuilder*) setZhongXianChaoDie:(Float64) value; - (zlztBuilder*) clearZhongXianChaoDie; @end #define zlzt_array_index_data @"indexData" @interface zlzt_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (zlzt*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlzt_arrayBuilder*) builder; + (zlzt_arrayBuilder*) builder; + (zlzt_arrayBuilder*) builderWithPrototype:(zlzt_array*) prototype; - (zlzt_arrayBuilder*) toBuilder; + (zlzt_array*) parseFromData:(NSData*) data; + (zlzt_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzt_array*) parseFromInputStream:(NSInputStream*) input; + (zlzt_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzt_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlzt_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlzt_arrayBuilder : PBGeneratedMessageBuilder { @private zlzt_array* resultZlztArray; } - (zlzt_array*) defaultInstance; - (zlzt_arrayBuilder*) clear; - (zlzt_arrayBuilder*) clone; - (zlzt_array*) build; - (zlzt_array*) buildPartial; - (zlzt_arrayBuilder*) mergeFrom:(zlzt_array*) other; - (zlzt_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlzt_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (zlzt*)indexDataAtIndex:(NSUInteger)index; - (zlzt_arrayBuilder *)addIndexData:(zlzt*)value; - (zlzt_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (zlzt_arrayBuilder *)clearIndexData; @end #define bljj_time @"time" #define bljj_XYS0 @"xys0" #define bljj_XYSHSL @"xyshsl" #define bljj_CYS13 @"cys13" @interface bljj : PBGeneratedMessage { @private BOOL hasXys0_:1; BOOL hasXyshsl_:1; BOOL hasCys13_:1; BOOL hasTime_:1; Float64 xys0; Float64 xyshsl; Float64 cys13; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasXys0; - (BOOL) hasXyshsl; - (BOOL) hasCys13; @property (readonly) UInt32 time; @property (readonly) Float64 xys0; @property (readonly) Float64 xyshsl; @property (readonly) Float64 cys13; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (bljjBuilder*) builder; + (bljjBuilder*) builder; + (bljjBuilder*) builderWithPrototype:(bljj*) prototype; - (bljjBuilder*) toBuilder; + (bljj*) parseFromData:(NSData*) data; + (bljj*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (bljj*) parseFromInputStream:(NSInputStream*) input; + (bljj*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (bljj*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (bljj*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface bljjBuilder : PBGeneratedMessageBuilder { @private bljj* resultBljj; } - (bljj*) defaultInstance; - (bljjBuilder*) clear; - (bljjBuilder*) clone; - (bljj*) build; - (bljj*) buildPartial; - (bljjBuilder*) mergeFrom:(bljj*) other; - (bljjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (bljjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (bljjBuilder*) setTime:(UInt32) value; - (bljjBuilder*) clearTime; - (BOOL) hasXys0; - (Float64) xys0; - (bljjBuilder*) setXys0:(Float64) value; - (bljjBuilder*) clearXys0; - (BOOL) hasXyshsl; - (Float64) xyshsl; - (bljjBuilder*) setXyshsl:(Float64) value; - (bljjBuilder*) clearXyshsl; - (BOOL) hasCys13; - (Float64) cys13; - (bljjBuilder*) setCys13:(Float64) value; - (bljjBuilder*) clearCys13; @end #define bljj_array_index_data @"indexData" @interface bljj_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (bljj*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (bljj_arrayBuilder*) builder; + (bljj_arrayBuilder*) builder; + (bljj_arrayBuilder*) builderWithPrototype:(bljj_array*) prototype; - (bljj_arrayBuilder*) toBuilder; + (bljj_array*) parseFromData:(NSData*) data; + (bljj_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (bljj_array*) parseFromInputStream:(NSInputStream*) input; + (bljj_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (bljj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (bljj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface bljj_arrayBuilder : PBGeneratedMessageBuilder { @private bljj_array* resultBljjArray; } - (bljj_array*) defaultInstance; - (bljj_arrayBuilder*) clear; - (bljj_arrayBuilder*) clone; - (bljj_array*) build; - (bljj_array*) buildPartial; - (bljj_arrayBuilder*) mergeFrom:(bljj_array*) other; - (bljj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (bljj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (bljj*)indexDataAtIndex:(NSUInteger)index; - (bljj_arrayBuilder *)addIndexData:(bljj*)value; - (bljj_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (bljj_arrayBuilder *)clearIndexData; @end #define minute_tj_data_time @"time" #define minute_tj_data_tj_value @"tjValue" @interface minute_tj_data : PBGeneratedMessage { @private BOOL hasTjValue_:1; BOOL hasTime_:1; Float64 tjValue; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasTjValue; @property (readonly) UInt32 time; @property (readonly) Float64 tjValue; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (minute_tj_dataBuilder*) builder; + (minute_tj_dataBuilder*) builder; + (minute_tj_dataBuilder*) builderWithPrototype:(minute_tj_data*) prototype; - (minute_tj_dataBuilder*) toBuilder; + (minute_tj_data*) parseFromData:(NSData*) data; + (minute_tj_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (minute_tj_data*) parseFromInputStream:(NSInputStream*) input; + (minute_tj_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (minute_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (minute_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface minute_tj_dataBuilder : PBGeneratedMessageBuilder { @private minute_tj_data* resultMinuteTjData; } - (minute_tj_data*) defaultInstance; - (minute_tj_dataBuilder*) clear; - (minute_tj_dataBuilder*) clone; - (minute_tj_data*) build; - (minute_tj_data*) buildPartial; - (minute_tj_dataBuilder*) mergeFrom:(minute_tj_data*) other; - (minute_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (minute_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (minute_tj_dataBuilder*) setTime:(UInt32) value; - (minute_tj_dataBuilder*) clearTime; - (BOOL) hasTjValue; - (Float64) tjValue; - (minute_tj_dataBuilder*) setTjValue:(Float64) value; - (minute_tj_dataBuilder*) clearTjValue; @end #define minute_tj_data_array_index_data @"indexData" @interface minute_tj_data_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (minute_tj_data*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (minute_tj_data_arrayBuilder*) builder; + (minute_tj_data_arrayBuilder*) builder; + (minute_tj_data_arrayBuilder*) builderWithPrototype:(minute_tj_data_array*) prototype; - (minute_tj_data_arrayBuilder*) toBuilder; + (minute_tj_data_array*) parseFromData:(NSData*) data; + (minute_tj_data_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (minute_tj_data_array*) parseFromInputStream:(NSInputStream*) input; + (minute_tj_data_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (minute_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (minute_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface minute_tj_data_arrayBuilder : PBGeneratedMessageBuilder { @private minute_tj_data_array* resultMinuteTjDataArray; } - (minute_tj_data_array*) defaultInstance; - (minute_tj_data_arrayBuilder*) clear; - (minute_tj_data_arrayBuilder*) clone; - (minute_tj_data_array*) build; - (minute_tj_data_array*) buildPartial; - (minute_tj_data_arrayBuilder*) mergeFrom:(minute_tj_data_array*) other; - (minute_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (minute_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (minute_tj_data*)indexDataAtIndex:(NSUInteger)index; - (minute_tj_data_arrayBuilder *)addIndexData:(minute_tj_data*)value; - (minute_tj_data_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (minute_tj_data_arrayBuilder *)clearIndexData; @end #define tj_draw_value_p1 @"p1" #define tj_draw_value_p2 @"p2" #define tj_draw_value_empty @"empty" #define tj_draw_value_diff @"diff" @interface tj_draw_value : PBGeneratedMessage { @private BOOL hasEmpty_:1; BOOL hasP1_:1; BOOL hasP2_:1; BOOL hasDiff_:1; BOOL empty_:1; Float64 p1; Float64 p2; UInt32 diff; } - (BOOL) hasP1; - (BOOL) hasP2; - (BOOL) hasEmpty; - (BOOL) hasDiff; @property (readonly) Float64 p1; @property (readonly) Float64 p2; - (BOOL) empty; @property (readonly) UInt32 diff; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tj_draw_valueBuilder*) builder; + (tj_draw_valueBuilder*) builder; + (tj_draw_valueBuilder*) builderWithPrototype:(tj_draw_value*) prototype; - (tj_draw_valueBuilder*) toBuilder; + (tj_draw_value*) parseFromData:(NSData*) data; + (tj_draw_value*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tj_draw_value*) parseFromInputStream:(NSInputStream*) input; + (tj_draw_value*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tj_draw_value*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tj_draw_value*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tj_draw_valueBuilder : PBGeneratedMessageBuilder { @private tj_draw_value* resultTjDrawValue; } - (tj_draw_value*) defaultInstance; - (tj_draw_valueBuilder*) clear; - (tj_draw_valueBuilder*) clone; - (tj_draw_value*) build; - (tj_draw_value*) buildPartial; - (tj_draw_valueBuilder*) mergeFrom:(tj_draw_value*) other; - (tj_draw_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tj_draw_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasP1; - (Float64) p1; - (tj_draw_valueBuilder*) setP1:(Float64) value; - (tj_draw_valueBuilder*) clearP1; - (BOOL) hasP2; - (Float64) p2; - (tj_draw_valueBuilder*) setP2:(Float64) value; - (tj_draw_valueBuilder*) clearP2; - (BOOL) hasEmpty; - (BOOL) empty; - (tj_draw_valueBuilder*) setEmpty:(BOOL) value; - (tj_draw_valueBuilder*) clearEmpty; - (BOOL) hasDiff; - (UInt32) diff; - (tj_draw_valueBuilder*) setDiff:(UInt32) value; - (tj_draw_valueBuilder*) clearDiff; @end #define kline_tj_data_time @"time" #define kline_tj_data_BUY @"buy" #define kline_tj_data_SEL @"sel" #define kline_tj_data_JME @"jme" #define kline_tj_data_JB @"jb" #define kline_tj_data_draw_value @"drawValue" #define kline_tj_data_TJ_VALUE @"tjValue" @interface kline_tj_data : PBGeneratedMessage { @private BOOL hasBuy_:1; BOOL hasSel_:1; BOOL hasJme_:1; BOOL hasJb_:1; BOOL hasTjValue_:1; BOOL hasTime_:1; Float64 buy; Float64 sel; Float64 jme; Float64 jb; Float64 tjValue; UInt32 time; NSMutableArray * drawValueArray; } - (BOOL) hasTime; - (BOOL) hasBuy; - (BOOL) hasSel; - (BOOL) hasJme; - (BOOL) hasJb; - (BOOL) hasTjValue; @property (readonly) UInt32 time; @property (readonly) Float64 buy; @property (readonly) Float64 sel; @property (readonly) Float64 jme; @property (readonly) Float64 jb; @property (readonly, strong) NSArray * drawValue; @property (readonly) Float64 tjValue; - (tj_draw_value*)drawValueAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (kline_tj_dataBuilder*) builder; + (kline_tj_dataBuilder*) builder; + (kline_tj_dataBuilder*) builderWithPrototype:(kline_tj_data*) prototype; - (kline_tj_dataBuilder*) toBuilder; + (kline_tj_data*) parseFromData:(NSData*) data; + (kline_tj_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (kline_tj_data*) parseFromInputStream:(NSInputStream*) input; + (kline_tj_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (kline_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (kline_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface kline_tj_dataBuilder : PBGeneratedMessageBuilder { @private kline_tj_data* resultKlineTjData; } - (kline_tj_data*) defaultInstance; - (kline_tj_dataBuilder*) clear; - (kline_tj_dataBuilder*) clone; - (kline_tj_data*) build; - (kline_tj_data*) buildPartial; - (kline_tj_dataBuilder*) mergeFrom:(kline_tj_data*) other; - (kline_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (kline_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (kline_tj_dataBuilder*) setTime:(UInt32) value; - (kline_tj_dataBuilder*) clearTime; - (BOOL) hasBuy; - (Float64) buy; - (kline_tj_dataBuilder*) setBuy:(Float64) value; - (kline_tj_dataBuilder*) clearBuy; - (BOOL) hasSel; - (Float64) sel; - (kline_tj_dataBuilder*) setSel:(Float64) value; - (kline_tj_dataBuilder*) clearSel; - (BOOL) hasJme; - (Float64) jme; - (kline_tj_dataBuilder*) setJme:(Float64) value; - (kline_tj_dataBuilder*) clearJme; - (BOOL) hasJb; - (Float64) jb; - (kline_tj_dataBuilder*) setJb:(Float64) value; - (kline_tj_dataBuilder*) clearJb; - (NSMutableArray *)drawValue; - (tj_draw_value*)drawValueAtIndex:(NSUInteger)index; - (kline_tj_dataBuilder *)addDrawValue:(tj_draw_value*)value; - (kline_tj_dataBuilder *)setDrawValueArray:(NSArray *)array; - (kline_tj_dataBuilder *)clearDrawValue; - (BOOL) hasTjValue; - (Float64) tjValue; - (kline_tj_dataBuilder*) setTjValue:(Float64) value; - (kline_tj_dataBuilder*) clearTjValue; @end #define kline_tj_data_array_index_data @"indexData" @interface kline_tj_data_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (kline_tj_data*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (kline_tj_data_arrayBuilder*) builder; + (kline_tj_data_arrayBuilder*) builder; + (kline_tj_data_arrayBuilder*) builderWithPrototype:(kline_tj_data_array*) prototype; - (kline_tj_data_arrayBuilder*) toBuilder; + (kline_tj_data_array*) parseFromData:(NSData*) data; + (kline_tj_data_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (kline_tj_data_array*) parseFromInputStream:(NSInputStream*) input; + (kline_tj_data_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (kline_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (kline_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface kline_tj_data_arrayBuilder : PBGeneratedMessageBuilder { @private kline_tj_data_array* resultKlineTjDataArray; } - (kline_tj_data_array*) defaultInstance; - (kline_tj_data_arrayBuilder*) clear; - (kline_tj_data_arrayBuilder*) clone; - (kline_tj_data_array*) build; - (kline_tj_data_array*) buildPartial; - (kline_tj_data_arrayBuilder*) mergeFrom:(kline_tj_data_array*) other; - (kline_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (kline_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (kline_tj_data*)indexDataAtIndex:(NSUInteger)index; - (kline_tj_data_arrayBuilder *)addIndexData:(kline_tj_data*)value; - (kline_tj_data_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (kline_tj_data_arrayBuilder *)clearIndexData; @end #define sstp_time @"time" #define sstp_shang @"shang" #define sstp_ci_shang @"ciShang" #define sstp_ci_xia @"ciXia" #define sstp_xia @"xia" @interface sstp : PBGeneratedMessage { @private BOOL hasShang_:1; BOOL hasCiShang_:1; BOOL hasCiXia_:1; BOOL hasXia_:1; BOOL hasTime_:1; Float64 shang; Float64 ciShang; Float64 ciXia; Float64 xia; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasShang; - (BOOL) hasCiShang; - (BOOL) hasCiXia; - (BOOL) hasXia; @property (readonly) UInt32 time; @property (readonly) Float64 shang; @property (readonly) Float64 ciShang; @property (readonly) Float64 ciXia; @property (readonly) Float64 xia; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (sstpBuilder*) builder; + (sstpBuilder*) builder; + (sstpBuilder*) builderWithPrototype:(sstp*) prototype; - (sstpBuilder*) toBuilder; + (sstp*) parseFromData:(NSData*) data; + (sstp*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (sstp*) parseFromInputStream:(NSInputStream*) input; + (sstp*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (sstp*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (sstp*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface sstpBuilder : PBGeneratedMessageBuilder { @private sstp* resultSstp; } - (sstp*) defaultInstance; - (sstpBuilder*) clear; - (sstpBuilder*) clone; - (sstp*) build; - (sstp*) buildPartial; - (sstpBuilder*) mergeFrom:(sstp*) other; - (sstpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (sstpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (sstpBuilder*) setTime:(UInt32) value; - (sstpBuilder*) clearTime; - (BOOL) hasShang; - (Float64) shang; - (sstpBuilder*) setShang:(Float64) value; - (sstpBuilder*) clearShang; - (BOOL) hasCiShang; - (Float64) ciShang; - (sstpBuilder*) setCiShang:(Float64) value; - (sstpBuilder*) clearCiShang; - (BOOL) hasCiXia; - (Float64) ciXia; - (sstpBuilder*) setCiXia:(Float64) value; - (sstpBuilder*) clearCiXia; - (BOOL) hasXia; - (Float64) xia; - (sstpBuilder*) setXia:(Float64) value; - (sstpBuilder*) clearXia; @end #define sstp_array_index_data @"indexData" @interface sstp_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (sstp*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (sstp_arrayBuilder*) builder; + (sstp_arrayBuilder*) builder; + (sstp_arrayBuilder*) builderWithPrototype:(sstp_array*) prototype; - (sstp_arrayBuilder*) toBuilder; + (sstp_array*) parseFromData:(NSData*) data; + (sstp_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (sstp_array*) parseFromInputStream:(NSInputStream*) input; + (sstp_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (sstp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (sstp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface sstp_arrayBuilder : PBGeneratedMessageBuilder { @private sstp_array* resultSstpArray; } - (sstp_array*) defaultInstance; - (sstp_arrayBuilder*) clear; - (sstp_arrayBuilder*) clone; - (sstp_array*) build; - (sstp_array*) buildPartial; - (sstp_arrayBuilder*) mergeFrom:(sstp_array*) other; - (sstp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (sstp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (sstp*)indexDataAtIndex:(NSUInteger)index; - (sstp_arrayBuilder *)addIndexData:(sstp*)value; - (sstp_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (sstp_arrayBuilder *)clearIndexData; @end #define qlft_time @"time" #define qlft_zhong_xian_qiang_ruo @"zhongXianQiangRuo" #define qlft_me @"me" @interface qlft : PBGeneratedMessage { @private BOOL hasZhongXianQiangRuo_:1; BOOL hasMe_:1; BOOL hasTime_:1; Float64 zhongXianQiangRuo; Float64 me; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasZhongXianQiangRuo; - (BOOL) hasMe; @property (readonly) UInt32 time; @property (readonly) Float64 zhongXianQiangRuo; @property (readonly) Float64 me; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (qlftBuilder*) builder; + (qlftBuilder*) builder; + (qlftBuilder*) builderWithPrototype:(qlft*) prototype; - (qlftBuilder*) toBuilder; + (qlft*) parseFromData:(NSData*) data; + (qlft*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (qlft*) parseFromInputStream:(NSInputStream*) input; + (qlft*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (qlft*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (qlft*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface qlftBuilder : PBGeneratedMessageBuilder { @private qlft* resultQlft; } - (qlft*) defaultInstance; - (qlftBuilder*) clear; - (qlftBuilder*) clone; - (qlft*) build; - (qlft*) buildPartial; - (qlftBuilder*) mergeFrom:(qlft*) other; - (qlftBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (qlftBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (qlftBuilder*) setTime:(UInt32) value; - (qlftBuilder*) clearTime; - (BOOL) hasZhongXianQiangRuo; - (Float64) zhongXianQiangRuo; - (qlftBuilder*) setZhongXianQiangRuo:(Float64) value; - (qlftBuilder*) clearZhongXianQiangRuo; - (BOOL) hasMe; - (Float64) me; - (qlftBuilder*) setMe:(Float64) value; - (qlftBuilder*) clearMe; @end #define qlft_array_index_data @"indexData" @interface qlft_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (qlft*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (qlft_arrayBuilder*) builder; + (qlft_arrayBuilder*) builder; + (qlft_arrayBuilder*) builderWithPrototype:(qlft_array*) prototype; - (qlft_arrayBuilder*) toBuilder; + (qlft_array*) parseFromData:(NSData*) data; + (qlft_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (qlft_array*) parseFromInputStream:(NSInputStream*) input; + (qlft_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (qlft_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (qlft_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface qlft_arrayBuilder : PBGeneratedMessageBuilder { @private qlft_array* resultQlftArray; } - (qlft_array*) defaultInstance; - (qlft_arrayBuilder*) clear; - (qlft_arrayBuilder*) clone; - (qlft_array*) build; - (qlft_array*) buildPartial; - (qlft_arrayBuilder*) mergeFrom:(qlft_array*) other; - (qlft_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (qlft_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (qlft*)indexDataAtIndex:(NSUInteger)index; - (qlft_arrayBuilder *)addIndexData:(qlft*)value; - (qlft_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (qlft_arrayBuilder *)clearIndexData; @end #define ldzj_time @"time" #define ldzj_ldzj_value @"ldzjValue" @interface ldzj : PBGeneratedMessage { @private BOOL hasLdzjValue_:1; BOOL hasTime_:1; Float64 ldzjValue; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasLdzjValue; @property (readonly) UInt32 time; @property (readonly) Float64 ldzjValue; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (ldzjBuilder*) builder; + (ldzjBuilder*) builder; + (ldzjBuilder*) builderWithPrototype:(ldzj*) prototype; - (ldzjBuilder*) toBuilder; + (ldzj*) parseFromData:(NSData*) data; + (ldzj*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ldzj*) parseFromInputStream:(NSInputStream*) input; + (ldzj*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ldzj*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ldzj*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface ldzjBuilder : PBGeneratedMessageBuilder { @private ldzj* resultLdzj; } - (ldzj*) defaultInstance; - (ldzjBuilder*) clear; - (ldzjBuilder*) clone; - (ldzj*) build; - (ldzj*) buildPartial; - (ldzjBuilder*) mergeFrom:(ldzj*) other; - (ldzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (ldzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (ldzjBuilder*) setTime:(UInt32) value; - (ldzjBuilder*) clearTime; - (BOOL) hasLdzjValue; - (Float64) ldzjValue; - (ldzjBuilder*) setLdzjValue:(Float64) value; - (ldzjBuilder*) clearLdzjValue; @end #define ldzj_array_index_data @"indexData" @interface ldzj_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (ldzj*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (ldzj_arrayBuilder*) builder; + (ldzj_arrayBuilder*) builder; + (ldzj_arrayBuilder*) builderWithPrototype:(ldzj_array*) prototype; - (ldzj_arrayBuilder*) toBuilder; + (ldzj_array*) parseFromData:(NSData*) data; + (ldzj_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ldzj_array*) parseFromInputStream:(NSInputStream*) input; + (ldzj_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ldzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ldzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface ldzj_arrayBuilder : PBGeneratedMessageBuilder { @private ldzj_array* resultLdzjArray; } - (ldzj_array*) defaultInstance; - (ldzj_arrayBuilder*) clear; - (ldzj_arrayBuilder*) clone; - (ldzj_array*) build; - (ldzj_array*) buildPartial; - (ldzj_arrayBuilder*) mergeFrom:(ldzj_array*) other; - (ldzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (ldzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (ldzj*)indexDataAtIndex:(NSUInteger)index; - (ldzj_arrayBuilder *)addIndexData:(ldzj*)value; - (ldzj_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (ldzj_arrayBuilder *)clearIndexData; @end #define zlkp_time @"time" #define zlkp_kong_pan_cheng_du @"kongPanChengDu" #define zlkp_gao_kong_pan @"gaoKongPan" @interface zlkp : PBGeneratedMessage { @private BOOL hasKongPanChengDu_:1; BOOL hasGaoKongPan_:1; BOOL hasTime_:1; Float64 kongPanChengDu; Float64 gaoKongPan; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasKongPanChengDu; - (BOOL) hasGaoKongPan; @property (readonly) UInt32 time; @property (readonly) Float64 kongPanChengDu; @property (readonly) Float64 gaoKongPan; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlkpBuilder*) builder; + (zlkpBuilder*) builder; + (zlkpBuilder*) builderWithPrototype:(zlkp*) prototype; - (zlkpBuilder*) toBuilder; + (zlkp*) parseFromData:(NSData*) data; + (zlkp*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlkp*) parseFromInputStream:(NSInputStream*) input; + (zlkp*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlkp*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlkp*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlkpBuilder : PBGeneratedMessageBuilder { @private zlkp* resultZlkp; } - (zlkp*) defaultInstance; - (zlkpBuilder*) clear; - (zlkpBuilder*) clone; - (zlkp*) build; - (zlkp*) buildPartial; - (zlkpBuilder*) mergeFrom:(zlkp*) other; - (zlkpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlkpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (zlkpBuilder*) setTime:(UInt32) value; - (zlkpBuilder*) clearTime; - (BOOL) hasKongPanChengDu; - (Float64) kongPanChengDu; - (zlkpBuilder*) setKongPanChengDu:(Float64) value; - (zlkpBuilder*) clearKongPanChengDu; - (BOOL) hasGaoKongPan; - (Float64) gaoKongPan; - (zlkpBuilder*) setGaoKongPan:(Float64) value; - (zlkpBuilder*) clearGaoKongPan; @end #define zlkp_array_index_data @"indexData" @interface zlkp_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (zlkp*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlkp_arrayBuilder*) builder; + (zlkp_arrayBuilder*) builder; + (zlkp_arrayBuilder*) builderWithPrototype:(zlkp_array*) prototype; - (zlkp_arrayBuilder*) toBuilder; + (zlkp_array*) parseFromData:(NSData*) data; + (zlkp_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlkp_array*) parseFromInputStream:(NSInputStream*) input; + (zlkp_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlkp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlkp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlkp_arrayBuilder : PBGeneratedMessageBuilder { @private zlkp_array* resultZlkpArray; } - (zlkp_array*) defaultInstance; - (zlkp_arrayBuilder*) clear; - (zlkp_arrayBuilder*) clone; - (zlkp_array*) build; - (zlkp_array*) buildPartial; - (zlkp_arrayBuilder*) mergeFrom:(zlkp_array*) other; - (zlkp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlkp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (zlkp*)indexDataAtIndex:(NSUInteger)index; - (zlkp_arrayBuilder *)addIndexData:(zlkp*)value; - (zlkp_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (zlkp_arrayBuilder *)clearIndexData; @end #define zlzj_time @"time" #define zlzj_jz @"jz" #define zlzj_mmbl @"mmbl" @interface zlzj : PBGeneratedMessage { @private BOOL hasJz_:1; BOOL hasMmbl_:1; BOOL hasTime_:1; Float64 jz; Float64 mmbl; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasJz; - (BOOL) hasMmbl; @property (readonly) UInt32 time; @property (readonly) Float64 jz; @property (readonly) Float64 mmbl; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlzjBuilder*) builder; + (zlzjBuilder*) builder; + (zlzjBuilder*) builderWithPrototype:(zlzj*) prototype; - (zlzjBuilder*) toBuilder; + (zlzj*) parseFromData:(NSData*) data; + (zlzj*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzj*) parseFromInputStream:(NSInputStream*) input; + (zlzj*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzj*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlzj*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlzjBuilder : PBGeneratedMessageBuilder { @private zlzj* resultZlzj; } - (zlzj*) defaultInstance; - (zlzjBuilder*) clear; - (zlzjBuilder*) clone; - (zlzj*) build; - (zlzj*) buildPartial; - (zlzjBuilder*) mergeFrom:(zlzj*) other; - (zlzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (zlzjBuilder*) setTime:(UInt32) value; - (zlzjBuilder*) clearTime; - (BOOL) hasJz; - (Float64) jz; - (zlzjBuilder*) setJz:(Float64) value; - (zlzjBuilder*) clearJz; - (BOOL) hasMmbl; - (Float64) mmbl; - (zlzjBuilder*) setMmbl:(Float64) value; - (zlzjBuilder*) clearMmbl; @end #define zlzj_array_index_data @"indexData" @interface zlzj_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (zlzj*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zlzj_arrayBuilder*) builder; + (zlzj_arrayBuilder*) builder; + (zlzj_arrayBuilder*) builderWithPrototype:(zlzj_array*) prototype; - (zlzj_arrayBuilder*) toBuilder; + (zlzj_array*) parseFromData:(NSData*) data; + (zlzj_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzj_array*) parseFromInputStream:(NSInputStream*) input; + (zlzj_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zlzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zlzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zlzj_arrayBuilder : PBGeneratedMessageBuilder { @private zlzj_array* resultZlzjArray; } - (zlzj_array*) defaultInstance; - (zlzj_arrayBuilder*) clear; - (zlzj_arrayBuilder*) clone; - (zlzj_array*) build; - (zlzj_array*) buildPartial; - (zlzj_arrayBuilder*) mergeFrom:(zlzj_array*) other; - (zlzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zlzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (zlzj*)indexDataAtIndex:(NSUInteger)index; - (zlzj_arrayBuilder *)addIndexData:(zlzj*)value; - (zlzj_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (zlzj_arrayBuilder *)clearIndexData; @end #define zljme_time @"time" #define zljme_zljme_value @"zljmeValue" @interface zljme : PBGeneratedMessage { @private BOOL hasZljmeValue_:1; BOOL hasTime_:1; Float64 zljmeValue; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasZljmeValue; @property (readonly) UInt32 time; @property (readonly) Float64 zljmeValue; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zljmeBuilder*) builder; + (zljmeBuilder*) builder; + (zljmeBuilder*) builderWithPrototype:(zljme*) prototype; - (zljmeBuilder*) toBuilder; + (zljme*) parseFromData:(NSData*) data; + (zljme*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zljme*) parseFromInputStream:(NSInputStream*) input; + (zljme*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zljme*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zljme*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zljmeBuilder : PBGeneratedMessageBuilder { @private zljme* resultZljme; } - (zljme*) defaultInstance; - (zljmeBuilder*) clear; - (zljmeBuilder*) clone; - (zljme*) build; - (zljme*) buildPartial; - (zljmeBuilder*) mergeFrom:(zljme*) other; - (zljmeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zljmeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (zljmeBuilder*) setTime:(UInt32) value; - (zljmeBuilder*) clearTime; - (BOOL) hasZljmeValue; - (Float64) zljmeValue; - (zljmeBuilder*) setZljmeValue:(Float64) value; - (zljmeBuilder*) clearZljmeValue; @end #define zljme_array_index_data @"indexData" @interface zljme_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (zljme*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zljme_arrayBuilder*) builder; + (zljme_arrayBuilder*) builder; + (zljme_arrayBuilder*) builderWithPrototype:(zljme_array*) prototype; - (zljme_arrayBuilder*) toBuilder; + (zljme_array*) parseFromData:(NSData*) data; + (zljme_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zljme_array*) parseFromInputStream:(NSInputStream*) input; + (zljme_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zljme_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zljme_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zljme_arrayBuilder : PBGeneratedMessageBuilder { @private zljme_array* resultZljmeArray; } - (zljme_array*) defaultInstance; - (zljme_arrayBuilder*) clear; - (zljme_arrayBuilder*) clone; - (zljme_array*) build; - (zljme_array*) buildPartial; - (zljme_arrayBuilder*) mergeFrom:(zljme_array*) other; - (zljme_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zljme_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (zljme*)indexDataAtIndex:(NSUInteger)index; - (zljme_arrayBuilder *)addIndexData:(zljme*)value; - (zljme_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (zljme_arrayBuilder *)clearIndexData; @end #define hhjvol_time @"time" #define hhjvol_ma1_value @"ma1Value" #define hhjvol_ma2_value @"ma2Value" #define hhjvol_ma3_value @"ma3Value" #define hhjvol_xuni_value @"xuniValue" #define hhjvol_vol_value @"volValue" @interface hhjvol : PBGeneratedMessage { @private BOOL hasMa1Value_:1; BOOL hasMa2Value_:1; BOOL hasMa3Value_:1; BOOL hasXuniValue_:1; BOOL hasVolValue_:1; BOOL hasTime_:1; Float64 ma1Value; Float64 ma2Value; Float64 ma3Value; Float64 xuniValue; Float64 volValue; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasMa1Value; - (BOOL) hasMa2Value; - (BOOL) hasMa3Value; - (BOOL) hasXuniValue; - (BOOL) hasVolValue; @property (readonly) UInt32 time; @property (readonly) Float64 ma1Value; @property (readonly) Float64 ma2Value; @property (readonly) Float64 ma3Value; @property (readonly) Float64 xuniValue; @property (readonly) Float64 volValue; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (hhjvolBuilder*) builder; + (hhjvolBuilder*) builder; + (hhjvolBuilder*) builderWithPrototype:(hhjvol*) prototype; - (hhjvolBuilder*) toBuilder; + (hhjvol*) parseFromData:(NSData*) data; + (hhjvol*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hhjvol*) parseFromInputStream:(NSInputStream*) input; + (hhjvol*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hhjvol*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (hhjvol*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface hhjvolBuilder : PBGeneratedMessageBuilder { @private hhjvol* resultHhjvol; } - (hhjvol*) defaultInstance; - (hhjvolBuilder*) clear; - (hhjvolBuilder*) clone; - (hhjvol*) build; - (hhjvol*) buildPartial; - (hhjvolBuilder*) mergeFrom:(hhjvol*) other; - (hhjvolBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (hhjvolBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (hhjvolBuilder*) setTime:(UInt32) value; - (hhjvolBuilder*) clearTime; - (BOOL) hasMa1Value; - (Float64) ma1Value; - (hhjvolBuilder*) setMa1Value:(Float64) value; - (hhjvolBuilder*) clearMa1Value; - (BOOL) hasMa2Value; - (Float64) ma2Value; - (hhjvolBuilder*) setMa2Value:(Float64) value; - (hhjvolBuilder*) clearMa2Value; - (BOOL) hasMa3Value; - (Float64) ma3Value; - (hhjvolBuilder*) setMa3Value:(Float64) value; - (hhjvolBuilder*) clearMa3Value; - (BOOL) hasXuniValue; - (Float64) xuniValue; - (hhjvolBuilder*) setXuniValue:(Float64) value; - (hhjvolBuilder*) clearXuniValue; - (BOOL) hasVolValue; - (Float64) volValue; - (hhjvolBuilder*) setVolValue:(Float64) value; - (hhjvolBuilder*) clearVolValue; @end #define hhjvol_array_index_data @"indexData" @interface hhjvol_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (hhjvol*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (hhjvol_arrayBuilder*) builder; + (hhjvol_arrayBuilder*) builder; + (hhjvol_arrayBuilder*) builderWithPrototype:(hhjvol_array*) prototype; - (hhjvol_arrayBuilder*) toBuilder; + (hhjvol_array*) parseFromData:(NSData*) data; + (hhjvol_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hhjvol_array*) parseFromInputStream:(NSInputStream*) input; + (hhjvol_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hhjvol_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (hhjvol_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface hhjvol_arrayBuilder : PBGeneratedMessageBuilder { @private hhjvol_array* resultHhjvolArray; } - (hhjvol_array*) defaultInstance; - (hhjvol_arrayBuilder*) clear; - (hhjvol_arrayBuilder*) clone; - (hhjvol_array*) build; - (hhjvol_array*) buildPartial; - (hhjvol_arrayBuilder*) mergeFrom:(hhjvol_array*) other; - (hhjvol_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (hhjvol_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (hhjvol*)indexDataAtIndex:(NSUInteger)index; - (hhjvol_arrayBuilder *)addIndexData:(hhjvol*)value; - (hhjvol_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (hhjvol_arrayBuilder *)clearIndexData; @end #define xdjw_time @"time" #define xdjw_pjgj @"pjgj" #define xdjw_hs300 @"hs300" @interface xdjw : PBGeneratedMessage { @private BOOL hasPjgj_:1; BOOL hasHs300_:1; BOOL hasTime_:1; Float64 pjgj; Float64 hs300; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasPjgj; - (BOOL) hasHs300; @property (readonly) UInt32 time; @property (readonly) Float64 pjgj; @property (readonly) Float64 hs300; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (xdjwBuilder*) builder; + (xdjwBuilder*) builder; + (xdjwBuilder*) builderWithPrototype:(xdjw*) prototype; - (xdjwBuilder*) toBuilder; + (xdjw*) parseFromData:(NSData*) data; + (xdjw*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (xdjw*) parseFromInputStream:(NSInputStream*) input; + (xdjw*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (xdjw*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (xdjw*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface xdjwBuilder : PBGeneratedMessageBuilder { @private xdjw* resultXdjw; } - (xdjw*) defaultInstance; - (xdjwBuilder*) clear; - (xdjwBuilder*) clone; - (xdjw*) build; - (xdjw*) buildPartial; - (xdjwBuilder*) mergeFrom:(xdjw*) other; - (xdjwBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (xdjwBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (xdjwBuilder*) setTime:(UInt32) value; - (xdjwBuilder*) clearTime; - (BOOL) hasPjgj; - (Float64) pjgj; - (xdjwBuilder*) setPjgj:(Float64) value; - (xdjwBuilder*) clearPjgj; - (BOOL) hasHs300; - (Float64) hs300; - (xdjwBuilder*) setHs300:(Float64) value; - (xdjwBuilder*) clearHs300; @end #define xdjw_array_index_data @"indexData" @interface xdjw_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (xdjw*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (xdjw_arrayBuilder*) builder; + (xdjw_arrayBuilder*) builder; + (xdjw_arrayBuilder*) builderWithPrototype:(xdjw_array*) prototype; - (xdjw_arrayBuilder*) toBuilder; + (xdjw_array*) parseFromData:(NSData*) data; + (xdjw_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (xdjw_array*) parseFromInputStream:(NSInputStream*) input; + (xdjw_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (xdjw_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (xdjw_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface xdjw_arrayBuilder : PBGeneratedMessageBuilder { @private xdjw_array* resultXdjwArray; } - (xdjw_array*) defaultInstance; - (xdjw_arrayBuilder*) clear; - (xdjw_arrayBuilder*) clone; - (xdjw_array*) build; - (xdjw_array*) buildPartial; - (xdjw_arrayBuilder*) mergeFrom:(xdjw_array*) other; - (xdjw_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (xdjw_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (xdjw*)indexDataAtIndex:(NSUInteger)index; - (xdjw_arrayBuilder *)addIndexData:(xdjw*)value; - (xdjw_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (xdjw_arrayBuilder *)clearIndexData; @end #define zcc_time @"time" #define zcc_keep_sell @"keepSell" #define zcc_keep_buy @"keepBuy" @interface zcc : PBGeneratedMessage { @private BOOL hasKeepSell_:1; BOOL hasKeepBuy_:1; BOOL hasTime_:1; Float64 keepSell; Float64 keepBuy; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasKeepSell; - (BOOL) hasKeepBuy; @property (readonly) UInt32 time; @property (readonly) Float64 keepSell; @property (readonly) Float64 keepBuy; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zccBuilder*) builder; + (zccBuilder*) builder; + (zccBuilder*) builderWithPrototype:(zcc*) prototype; - (zccBuilder*) toBuilder; + (zcc*) parseFromData:(NSData*) data; + (zcc*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zcc*) parseFromInputStream:(NSInputStream*) input; + (zcc*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zcc*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zcc*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zccBuilder : PBGeneratedMessageBuilder { @private zcc* resultZcc; } - (zcc*) defaultInstance; - (zccBuilder*) clear; - (zccBuilder*) clone; - (zcc*) build; - (zcc*) buildPartial; - (zccBuilder*) mergeFrom:(zcc*) other; - (zccBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zccBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (zccBuilder*) setTime:(UInt32) value; - (zccBuilder*) clearTime; - (BOOL) hasKeepSell; - (Float64) keepSell; - (zccBuilder*) setKeepSell:(Float64) value; - (zccBuilder*) clearKeepSell; - (BOOL) hasKeepBuy; - (Float64) keepBuy; - (zccBuilder*) setKeepBuy:(Float64) value; - (zccBuilder*) clearKeepBuy; @end #define zcc_array_index_data @"indexData" @interface zcc_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (zcc*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (zcc_arrayBuilder*) builder; + (zcc_arrayBuilder*) builder; + (zcc_arrayBuilder*) builderWithPrototype:(zcc_array*) prototype; - (zcc_arrayBuilder*) toBuilder; + (zcc_array*) parseFromData:(NSData*) data; + (zcc_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zcc_array*) parseFromInputStream:(NSInputStream*) input; + (zcc_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (zcc_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (zcc_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface zcc_arrayBuilder : PBGeneratedMessageBuilder { @private zcc_array* resultZccArray; } - (zcc_array*) defaultInstance; - (zcc_arrayBuilder*) clear; - (zcc_arrayBuilder*) clone; - (zcc_array*) build; - (zcc_array*) buildPartial; - (zcc_arrayBuilder*) mergeFrom:(zcc_array*) other; - (zcc_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (zcc_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (zcc*)indexDataAtIndex:(NSUInteger)index; - (zcc_arrayBuilder *)addIndexData:(zcc*)value; - (zcc_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (zcc_arrayBuilder *)clearIndexData; @end #define hyxd_time @"time" #define hyxd_MX @"mx" #define hyxd_NX @"nx" #define hyxd_SSRGL @"ssrgl" #define hyxd_J @"j" @interface hyxd : PBGeneratedMessage { @private BOOL hasTime_:1; BOOL hasMx_:1; BOOL hasNx_:1; BOOL hasSsrgl_:1; BOOL hasJ_:1; UInt32 time; UInt32 mx; UInt32 nx; UInt32 ssrgl; UInt32 j; } - (BOOL) hasTime; - (BOOL) hasMx; - (BOOL) hasNx; - (BOOL) hasSsrgl; - (BOOL) hasJ; @property (readonly) UInt32 time; @property (readonly) UInt32 mx; @property (readonly) UInt32 nx; @property (readonly) UInt32 ssrgl; @property (readonly) UInt32 j; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (hyxdBuilder*) builder; + (hyxdBuilder*) builder; + (hyxdBuilder*) builderWithPrototype:(hyxd*) prototype; - (hyxdBuilder*) toBuilder; + (hyxd*) parseFromData:(NSData*) data; + (hyxd*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hyxd*) parseFromInputStream:(NSInputStream*) input; + (hyxd*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hyxd*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (hyxd*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface hyxdBuilder : PBGeneratedMessageBuilder { @private hyxd* resultHyxd; } - (hyxd*) defaultInstance; - (hyxdBuilder*) clear; - (hyxdBuilder*) clone; - (hyxd*) build; - (hyxd*) buildPartial; - (hyxdBuilder*) mergeFrom:(hyxd*) other; - (hyxdBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (hyxdBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (hyxdBuilder*) setTime:(UInt32) value; - (hyxdBuilder*) clearTime; - (BOOL) hasMx; - (UInt32) mx; - (hyxdBuilder*) setMx:(UInt32) value; - (hyxdBuilder*) clearMx; - (BOOL) hasNx; - (UInt32) nx; - (hyxdBuilder*) setNx:(UInt32) value; - (hyxdBuilder*) clearNx; - (BOOL) hasSsrgl; - (UInt32) ssrgl; - (hyxdBuilder*) setSsrgl:(UInt32) value; - (hyxdBuilder*) clearSsrgl; - (BOOL) hasJ; - (UInt32) j; - (hyxdBuilder*) setJ:(UInt32) value; - (hyxdBuilder*) clearJ; @end #define hyxd_array_index_data @"indexData" @interface hyxd_array : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (hyxd*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (hyxd_arrayBuilder*) builder; + (hyxd_arrayBuilder*) builder; + (hyxd_arrayBuilder*) builderWithPrototype:(hyxd_array*) prototype; - (hyxd_arrayBuilder*) toBuilder; + (hyxd_array*) parseFromData:(NSData*) data; + (hyxd_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hyxd_array*) parseFromInputStream:(NSInputStream*) input; + (hyxd_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (hyxd_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (hyxd_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface hyxd_arrayBuilder : PBGeneratedMessageBuilder { @private hyxd_array* resultHyxdArray; } - (hyxd_array*) defaultInstance; - (hyxd_arrayBuilder*) clear; - (hyxd_arrayBuilder*) clone; - (hyxd_array*) build; - (hyxd_array*) buildPartial; - (hyxd_arrayBuilder*) mergeFrom:(hyxd_array*) other; - (hyxd_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (hyxd_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (hyxd*)indexDataAtIndex:(NSUInteger)index; - (hyxd_arrayBuilder *)addIndexData:(hyxd*)value; - (hyxd_arrayBuilder *)setIndexDataArray:(NSArray *)array; - (hyxd_arrayBuilder *)clearIndexData; @end #define ma_param_count @"count" @interface ma_param : PBGeneratedMessage { @private PBAppendableArray * countArray; } @property (readonly, strong) PBArray * count; - (UInt32)countAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (ma_paramBuilder*) builder; + (ma_paramBuilder*) builder; + (ma_paramBuilder*) builderWithPrototype:(ma_param*) prototype; - (ma_paramBuilder*) toBuilder; + (ma_param*) parseFromData:(NSData*) data; + (ma_param*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ma_param*) parseFromInputStream:(NSInputStream*) input; + (ma_param*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ma_param*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ma_param*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface ma_paramBuilder : PBGeneratedMessageBuilder { @private ma_param* resultMaParam; } - (ma_param*) defaultInstance; - (ma_paramBuilder*) clear; - (ma_paramBuilder*) clone; - (ma_param*) build; - (ma_param*) buildPartial; - (ma_paramBuilder*) mergeFrom:(ma_param*) other; - (ma_paramBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (ma_paramBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (PBAppendableArray *)count; - (UInt32)countAtIndex:(NSUInteger)index; - (ma_paramBuilder *)addCount:(UInt32)value; - (ma_paramBuilder *)setCountArray:(NSArray *)array; - (ma_paramBuilder *)setCountValues:(const UInt32 *)values count:(NSUInteger)count; - (ma_paramBuilder *)clearCount; @end #define ma_time @"time" #define ma_ma_value @"maValue" @interface ma : PBGeneratedMessage { @private BOOL hasTime_:1; UInt32 time; PBAppendableArray * maValueArray; } - (BOOL) hasTime; @property (readonly) UInt32 time; @property (readonly, strong) PBArray * maValue; - (Float64)maValueAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (maBuilder*) builder; + (maBuilder*) builder; + (maBuilder*) builderWithPrototype:(ma*) prototype; - (maBuilder*) toBuilder; + (ma*) parseFromData:(NSData*) data; + (ma*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ma*) parseFromInputStream:(NSInputStream*) input; + (ma*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ma*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ma*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface maBuilder : PBGeneratedMessageBuilder { @private ma* resultMa; } - (ma*) defaultInstance; - (maBuilder*) clear; - (maBuilder*) clone; - (ma*) build; - (ma*) buildPartial; - (maBuilder*) mergeFrom:(ma*) other; - (maBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (maBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (maBuilder*) setTime:(UInt32) value; - (maBuilder*) clearTime; - (PBAppendableArray *)maValue; - (Float64)maValueAtIndex:(NSUInteger)index; - (maBuilder *)addMaValue:(Float64)value; - (maBuilder *)setMaValueArray:(NSArray *)array; - (maBuilder *)setMaValueValues:(const Float64 *)values count:(NSUInteger)count; - (maBuilder *)clearMaValue; @end #define ma_array_ma_data @"maData" @interface ma_array : PBGeneratedMessage { @private NSMutableArray * maDataArray; } @property (readonly, strong) NSArray * maData; - (ma*)maDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (ma_arrayBuilder*) builder; + (ma_arrayBuilder*) builder; + (ma_arrayBuilder*) builderWithPrototype:(ma_array*) prototype; - (ma_arrayBuilder*) toBuilder; + (ma_array*) parseFromData:(NSData*) data; + (ma_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ma_array*) parseFromInputStream:(NSInputStream*) input; + (ma_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (ma_array*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (ma_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface ma_arrayBuilder : PBGeneratedMessageBuilder { @private ma_array* resultMaArray; } - (ma_array*) defaultInstance; - (ma_arrayBuilder*) clear; - (ma_arrayBuilder*) clone; - (ma_array*) build; - (ma_array*) buildPartial; - (ma_arrayBuilder*) mergeFrom:(ma_array*) other; - (ma_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (ma_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)maData; - (ma*)maDataAtIndex:(NSUInteger)index; - (ma_arrayBuilder *)addMaData:(ma*)value; - (ma_arrayBuilder *)setMaDataArray:(NSArray *)array; - (ma_arrayBuilder *)clearMaData; @end #define index_data_result_msg_name @"name" #define index_data_result_msg_stock_code @"stockCode" #define index_data_result_msg_cycle_type @"cycleType" #define index_data_result_msg_body @"body" @interface index_data_result_msg : PBGeneratedMessage { @private BOOL hasStockCode_:1; BOOL hasBody_:1; BOOL hasName_:1; BOOL hasCycleType_:1; NSString* stockCode; NSData* body; enum_index name; index_data_type cycleType; } - (BOOL) hasName; - (BOOL) hasStockCode; - (BOOL) hasCycleType; - (BOOL) hasBody; @property (readonly) enum_index name; @property (readonly, strong) NSString* stockCode; @property (readonly) index_data_type cycleType; @property (readonly, strong) NSData* body; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (index_data_result_msgBuilder*) builder; + (index_data_result_msgBuilder*) builder; + (index_data_result_msgBuilder*) builderWithPrototype:(index_data_result_msg*) prototype; - (index_data_result_msgBuilder*) toBuilder; + (index_data_result_msg*) parseFromData:(NSData*) data; + (index_data_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (index_data_result_msg*) parseFromInputStream:(NSInputStream*) input; + (index_data_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (index_data_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (index_data_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface index_data_result_msgBuilder : PBGeneratedMessageBuilder { @private index_data_result_msg* resultIndexDataResultMsg; } - (index_data_result_msg*) defaultInstance; - (index_data_result_msgBuilder*) clear; - (index_data_result_msgBuilder*) clone; - (index_data_result_msg*) build; - (index_data_result_msg*) buildPartial; - (index_data_result_msgBuilder*) mergeFrom:(index_data_result_msg*) other; - (index_data_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (index_data_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasName; - (enum_index) name; - (index_data_result_msgBuilder*) setName:(enum_index) value; - (index_data_result_msgBuilder*) clearName; - (BOOL) hasStockCode; - (NSString*) stockCode; - (index_data_result_msgBuilder*) setStockCode:(NSString*) value; - (index_data_result_msgBuilder*) clearStockCode; - (BOOL) hasCycleType; - (index_data_type) cycleType; - (index_data_result_msgBuilder*) setCycleType:(index_data_type) value; - (index_data_result_msgBuilder*) clearCycleType; - (BOOL) hasBody; - (NSData*) body; - (index_data_result_msgBuilder*) setBody:(NSData*) value; - (index_data_result_msgBuilder*) clearBody; @end #define client_request_rise_drop_msg_begin @"begin" #define client_request_rise_drop_msg_end @"end" #define client_request_rise_drop_msg_selector @"selector" @interface client_request_rise_drop_msg : PBGeneratedMessage { @private BOOL hasSelector_:1; BOOL hasBegin_:1; BOOL hasEnd_:1; data_selector* selector; UInt32 begin; UInt32 end; } - (BOOL) hasBegin; - (BOOL) hasEnd; - (BOOL) hasSelector; @property (readonly) UInt32 begin; @property (readonly) UInt32 end; @property (readonly, strong) data_selector* selector; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (client_request_rise_drop_msgBuilder*) builder; + (client_request_rise_drop_msgBuilder*) builder; + (client_request_rise_drop_msgBuilder*) builderWithPrototype:(client_request_rise_drop_msg*) prototype; - (client_request_rise_drop_msgBuilder*) toBuilder; + (client_request_rise_drop_msg*) parseFromData:(NSData*) data; + (client_request_rise_drop_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_request_rise_drop_msg*) parseFromInputStream:(NSInputStream*) input; + (client_request_rise_drop_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (client_request_rise_drop_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (client_request_rise_drop_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface client_request_rise_drop_msgBuilder : PBGeneratedMessageBuilder { @private client_request_rise_drop_msg* resultClientRequestRiseDropMsg; } - (client_request_rise_drop_msg*) defaultInstance; - (client_request_rise_drop_msgBuilder*) clear; - (client_request_rise_drop_msgBuilder*) clone; - (client_request_rise_drop_msg*) build; - (client_request_rise_drop_msg*) buildPartial; - (client_request_rise_drop_msgBuilder*) mergeFrom:(client_request_rise_drop_msg*) other; - (client_request_rise_drop_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (client_request_rise_drop_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasBegin; - (UInt32) begin; - (client_request_rise_drop_msgBuilder*) setBegin:(UInt32) value; - (client_request_rise_drop_msgBuilder*) clearBegin; - (BOOL) hasEnd; - (UInt32) end; - (client_request_rise_drop_msgBuilder*) setEnd:(UInt32) value; - (client_request_rise_drop_msgBuilder*) clearEnd; - (BOOL) hasSelector; - (data_selector*) selector; - (client_request_rise_drop_msgBuilder*) setSelector:(data_selector*) value; - (client_request_rise_drop_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue; - (client_request_rise_drop_msgBuilder*) mergeSelector:(data_selector*) value; - (client_request_rise_drop_msgBuilder*) clearSelector; @end #define rise_drop_data_time @"time" #define rise_drop_data_SZA_rise_count @"szaRiseCount" #define rise_drop_data_SZA_drop_count @"szaDropCount" #define rise_drop_data_SZA_unchange_count @"szaUnchangeCount" #define rise_drop_data_SHA_rise_count @"shaRiseCount" #define rise_drop_data_SHA_drop_count @"shaDropCount" #define rise_drop_data_SHA_unchange_count @"shaUnchangeCount" #define rise_drop_data_GEM_rise_count @"gemRiseCount" #define rise_drop_data_GEM_drop_count @"gemDropCount" #define rise_drop_data_GEM_unchange_count @"gemUnchangeCount" @interface rise_drop_data : PBGeneratedMessage { @private BOOL hasTime_:1; BOOL hasSzaRiseCount_:1; BOOL hasSzaDropCount_:1; BOOL hasSzaUnchangeCount_:1; BOOL hasShaRiseCount_:1; BOOL hasShaDropCount_:1; BOOL hasShaUnchangeCount_:1; BOOL hasGemRiseCount_:1; BOOL hasGemDropCount_:1; BOOL hasGemUnchangeCount_:1; UInt32 time; UInt32 szaRiseCount; UInt32 szaDropCount; UInt32 szaUnchangeCount; UInt32 shaRiseCount; UInt32 shaDropCount; UInt32 shaUnchangeCount; UInt32 gemRiseCount; UInt32 gemDropCount; UInt32 gemUnchangeCount; } - (BOOL) hasTime; - (BOOL) hasSzaRiseCount; - (BOOL) hasSzaDropCount; - (BOOL) hasSzaUnchangeCount; - (BOOL) hasShaRiseCount; - (BOOL) hasShaDropCount; - (BOOL) hasShaUnchangeCount; - (BOOL) hasGemRiseCount; - (BOOL) hasGemDropCount; - (BOOL) hasGemUnchangeCount; @property (readonly) UInt32 time; @property (readonly) UInt32 szaRiseCount; @property (readonly) UInt32 szaDropCount; @property (readonly) UInt32 szaUnchangeCount; @property (readonly) UInt32 shaRiseCount; @property (readonly) UInt32 shaDropCount; @property (readonly) UInt32 shaUnchangeCount; @property (readonly) UInt32 gemRiseCount; @property (readonly) UInt32 gemDropCount; @property (readonly) UInt32 gemUnchangeCount; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (rise_drop_dataBuilder*) builder; + (rise_drop_dataBuilder*) builder; + (rise_drop_dataBuilder*) builderWithPrototype:(rise_drop_data*) prototype; - (rise_drop_dataBuilder*) toBuilder; + (rise_drop_data*) parseFromData:(NSData*) data; + (rise_drop_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (rise_drop_data*) parseFromInputStream:(NSInputStream*) input; + (rise_drop_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (rise_drop_data*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (rise_drop_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface rise_drop_dataBuilder : PBGeneratedMessageBuilder { @private rise_drop_data* resultRiseDropData; } - (rise_drop_data*) defaultInstance; - (rise_drop_dataBuilder*) clear; - (rise_drop_dataBuilder*) clone; - (rise_drop_data*) build; - (rise_drop_data*) buildPartial; - (rise_drop_dataBuilder*) mergeFrom:(rise_drop_data*) other; - (rise_drop_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (rise_drop_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (rise_drop_dataBuilder*) setTime:(UInt32) value; - (rise_drop_dataBuilder*) clearTime; - (BOOL) hasSzaRiseCount; - (UInt32) szaRiseCount; - (rise_drop_dataBuilder*) setSzaRiseCount:(UInt32) value; - (rise_drop_dataBuilder*) clearSzaRiseCount; - (BOOL) hasSzaDropCount; - (UInt32) szaDropCount; - (rise_drop_dataBuilder*) setSzaDropCount:(UInt32) value; - (rise_drop_dataBuilder*) clearSzaDropCount; - (BOOL) hasSzaUnchangeCount; - (UInt32) szaUnchangeCount; - (rise_drop_dataBuilder*) setSzaUnchangeCount:(UInt32) value; - (rise_drop_dataBuilder*) clearSzaUnchangeCount; - (BOOL) hasShaRiseCount; - (UInt32) shaRiseCount; - (rise_drop_dataBuilder*) setShaRiseCount:(UInt32) value; - (rise_drop_dataBuilder*) clearShaRiseCount; - (BOOL) hasShaDropCount; - (UInt32) shaDropCount; - (rise_drop_dataBuilder*) setShaDropCount:(UInt32) value; - (rise_drop_dataBuilder*) clearShaDropCount; - (BOOL) hasShaUnchangeCount; - (UInt32) shaUnchangeCount; - (rise_drop_dataBuilder*) setShaUnchangeCount:(UInt32) value; - (rise_drop_dataBuilder*) clearShaUnchangeCount; - (BOOL) hasGemRiseCount; - (UInt32) gemRiseCount; - (rise_drop_dataBuilder*) setGemRiseCount:(UInt32) value; - (rise_drop_dataBuilder*) clearGemRiseCount; - (BOOL) hasGemDropCount; - (UInt32) gemDropCount; - (rise_drop_dataBuilder*) setGemDropCount:(UInt32) value; - (rise_drop_dataBuilder*) clearGemDropCount; - (BOOL) hasGemUnchangeCount; - (UInt32) gemUnchangeCount; - (rise_drop_dataBuilder*) setGemUnchangeCount:(UInt32) value; - (rise_drop_dataBuilder*) clearGemUnchangeCount; @end #define rise_drop_result_msg_index_data @"indexData" @interface rise_drop_result_msg : PBGeneratedMessage { @private NSMutableArray * indexDataArray; } @property (readonly, strong) NSArray * indexData; - (rise_drop_data*)indexDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (rise_drop_result_msgBuilder*) builder; + (rise_drop_result_msgBuilder*) builder; + (rise_drop_result_msgBuilder*) builderWithPrototype:(rise_drop_result_msg*) prototype; - (rise_drop_result_msgBuilder*) toBuilder; + (rise_drop_result_msg*) parseFromData:(NSData*) data; + (rise_drop_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (rise_drop_result_msg*) parseFromInputStream:(NSInputStream*) input; + (rise_drop_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (rise_drop_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (rise_drop_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface rise_drop_result_msgBuilder : PBGeneratedMessageBuilder { @private rise_drop_result_msg* resultRiseDropResultMsg; } - (rise_drop_result_msg*) defaultInstance; - (rise_drop_result_msgBuilder*) clear; - (rise_drop_result_msgBuilder*) clone; - (rise_drop_result_msg*) build; - (rise_drop_result_msg*) buildPartial; - (rise_drop_result_msgBuilder*) mergeFrom:(rise_drop_result_msg*) other; - (rise_drop_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (rise_drop_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)indexData; - (rise_drop_data*)indexDataAtIndex:(NSUInteger)index; - (rise_drop_result_msgBuilder *)addIndexData:(rise_drop_data*)value; - (rise_drop_result_msgBuilder *)setIndexDataArray:(NSArray *)array; - (rise_drop_result_msgBuilder *)clearIndexData; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Index.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Index.pb.h" // @@protoc_insertion_point(imports) @implementation IndexRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [IndexRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; [CommonRoot registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end BOOL enum_indexIsValidValue(enum_index value) { switch (value) { case enum_indexBeginIndexEnum: case enum_indexIndexCombo: case enum_indexIndex3Bws: case enum_indexIndexBdmr: case enum_indexIndexBljc: case enum_indexIndexCtx: case enum_indexIndexDkgz: case enum_indexIndexJdd: case enum_indexIndexDadi: case enum_indexIndexZhongdi: case enum_indexIndexXiaodi: case enum_indexIndexDzct: case enum_indexIndexGkgz: case enum_indexIndexHyfg: case enum_indexIndexKongpan: case enum_indexIndexQlcj: case enum_indexIndexSgcx: case enum_indexIndexSscd: case enum_indexIndexSshd: case enum_indexIndexSstp: case enum_indexIndexSstpy: case enum_indexIndexYyz: case enum_indexIndexZlcxg: case enum_indexIndexKongpanJiaCangBDian: case enum_indexIndexSstd: case enum_indexIndexZtgz: case enum_indexIndexKDfp: case enum_indexIndexKpjc: case enum_indexIndexZlzz: case enum_indexIndexZlzt: case enum_indexIndexZlzj: case enum_indexIndexXdjw: case enum_indexIndexZljme: case enum_indexIndexHighValue: case enum_indexFtIndexZlzz: case enum_indexFtIndexBljj: case enum_indexFtIndexZltj: case enum_indexFtIndexMinZltj: case enum_indexFtIndexGftj: case enum_indexFtIndexMinGftj: case enum_indexFtIndexShtj: case enum_indexFtIndexMinShtj: case enum_indexFtIndexQlft: case enum_indexFtIndexLdzj: case enum_indexFtIndexSstp: case enum_indexFtIndexZlkp: case enum_indexFtIndexZljme: case enum_indexFtIndexHhjvol: case enum_indexFtIndexZcc: case enum_indexFtIndexXdjw: case enum_indexFtIndexHyxd: case enum_indexFtIndexMa: case enum_indexEndIndexEnum: return YES; default: return NO; } } NSString *NSStringFromenum_index(enum_index value) { switch (value) { case enum_indexBeginIndexEnum: return @"enum_indexBeginIndexEnum"; case enum_indexIndexCombo: return @"enum_indexIndexCombo"; case enum_indexIndex3Bws: return @"enum_indexIndex3Bws"; case enum_indexIndexBdmr: return @"enum_indexIndexBdmr"; case enum_indexIndexBljc: return @"enum_indexIndexBljc"; case enum_indexIndexCtx: return @"enum_indexIndexCtx"; case enum_indexIndexDkgz: return @"enum_indexIndexDkgz"; case enum_indexIndexJdd: return @"enum_indexIndexJdd"; case enum_indexIndexDadi: return @"enum_indexIndexDadi"; case enum_indexIndexZhongdi: return @"enum_indexIndexZhongdi"; case enum_indexIndexXiaodi: return @"enum_indexIndexXiaodi"; case enum_indexIndexDzct: return @"enum_indexIndexDzct"; case enum_indexIndexGkgz: return @"enum_indexIndexGkgz"; case enum_indexIndexHyfg: return @"enum_indexIndexHyfg"; case enum_indexIndexKongpan: return @"enum_indexIndexKongpan"; case enum_indexIndexQlcj: return @"enum_indexIndexQlcj"; case enum_indexIndexSgcx: return @"enum_indexIndexSgcx"; case enum_indexIndexSscd: return @"enum_indexIndexSscd"; case enum_indexIndexSshd: return @"enum_indexIndexSshd"; case enum_indexIndexSstp: return @"enum_indexIndexSstp"; case enum_indexIndexSstpy: return @"enum_indexIndexSstpy"; case enum_indexIndexYyz: return @"enum_indexIndexYyz"; case enum_indexIndexZlcxg: return @"enum_indexIndexZlcxg"; case enum_indexIndexKongpanJiaCangBDian: return @"enum_indexIndexKongpanJiaCangBDian"; case enum_indexIndexSstd: return @"enum_indexIndexSstd"; case enum_indexIndexZtgz: return @"enum_indexIndexZtgz"; case enum_indexIndexKDfp: return @"enum_indexIndexKDfp"; case enum_indexIndexKpjc: return @"enum_indexIndexKpjc"; case enum_indexIndexZlzz: return @"enum_indexIndexZlzz"; case enum_indexIndexZlzt: return @"enum_indexIndexZlzt"; case enum_indexIndexZlzj: return @"enum_indexIndexZlzj"; case enum_indexIndexXdjw: return @"enum_indexIndexXdjw"; case enum_indexIndexZljme: return @"enum_indexIndexZljme"; case enum_indexIndexHighValue: return @"enum_indexIndexHighValue"; case enum_indexFtIndexZlzz: return @"enum_indexFtIndexZlzz"; case enum_indexFtIndexBljj: return @"enum_indexFtIndexBljj"; case enum_indexFtIndexZltj: return @"enum_indexFtIndexZltj"; case enum_indexFtIndexMinZltj: return @"enum_indexFtIndexMinZltj"; case enum_indexFtIndexGftj: return @"enum_indexFtIndexGftj"; case enum_indexFtIndexMinGftj: return @"enum_indexFtIndexMinGftj"; case enum_indexFtIndexShtj: return @"enum_indexFtIndexShtj"; case enum_indexFtIndexMinShtj: return @"enum_indexFtIndexMinShtj"; case enum_indexFtIndexQlft: return @"enum_indexFtIndexQlft"; case enum_indexFtIndexLdzj: return @"enum_indexFtIndexLdzj"; case enum_indexFtIndexSstp: return @"enum_indexFtIndexSstp"; case enum_indexFtIndexZlkp: return @"enum_indexFtIndexZlkp"; case enum_indexFtIndexZljme: return @"enum_indexFtIndexZljme"; case enum_indexFtIndexHhjvol: return @"enum_indexFtIndexHhjvol"; case enum_indexFtIndexZcc: return @"enum_indexFtIndexZcc"; case enum_indexFtIndexXdjw: return @"enum_indexFtIndexXdjw"; case enum_indexFtIndexHyxd: return @"enum_indexFtIndexHyxd"; case enum_indexFtIndexMa: return @"enum_indexFtIndexMa"; case enum_indexEndIndexEnum: return @"enum_indexEndIndexEnum"; default: return nil; } } BOOL index_data_typeIsValidValue(index_data_type value) { switch (value) { case index_data_typeCycleBegin: case index_data_typeIndexCycle1Min: case index_data_typeIndexCycle3Min: case index_data_typeIndexCycle5Min: case index_data_typeIndexCycle10Min: case index_data_typeIndexCycle15Min: case index_data_typeIndexCycle20Min: case index_data_typeIndexCycle30Min: case index_data_typeIndexCycle60Min: case index_data_typeIndexCycleDay: case index_data_typeIndexCycleWeek: case index_data_typeIndexCycleMonth: case index_data_typeIndexCycleQuarter: case index_data_typeIndexCycleYear: case index_data_typeCycleEnd: return YES; default: return NO; } } NSString *NSStringFromindex_data_type(index_data_type value) { switch (value) { case index_data_typeCycleBegin: return @"index_data_typeCycleBegin"; case index_data_typeIndexCycle1Min: return @"index_data_typeIndexCycle1Min"; case index_data_typeIndexCycle3Min: return @"index_data_typeIndexCycle3Min"; case index_data_typeIndexCycle5Min: return @"index_data_typeIndexCycle5Min"; case index_data_typeIndexCycle10Min: return @"index_data_typeIndexCycle10Min"; case index_data_typeIndexCycle15Min: return @"index_data_typeIndexCycle15Min"; case index_data_typeIndexCycle20Min: return @"index_data_typeIndexCycle20Min"; case index_data_typeIndexCycle30Min: return @"index_data_typeIndexCycle30Min"; case index_data_typeIndexCycle60Min: return @"index_data_typeIndexCycle60Min"; case index_data_typeIndexCycleDay: return @"index_data_typeIndexCycleDay"; case index_data_typeIndexCycleWeek: return @"index_data_typeIndexCycleWeek"; case index_data_typeIndexCycleMonth: return @"index_data_typeIndexCycleMonth"; case index_data_typeIndexCycleQuarter: return @"index_data_typeIndexCycleQuarter"; case index_data_typeIndexCycleYear: return @"index_data_typeIndexCycleYear"; case index_data_typeCycleEnd: return @"index_data_typeCycleEnd"; default: return nil; } } @interface client_request_index_msg () @property enum_index name; @end @implementation client_request_index_msg - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (instancetype) init { if ((self = [super init])) { self.name = enum_indexBeginIndexEnum; } return self; } static client_request_index_msg* defaultclient_request_index_msgInstance = nil; + (void) initialize { if (self == [client_request_index_msg class]) { defaultclient_request_index_msgInstance = [[client_request_index_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultclient_request_index_msgInstance; } - (instancetype) defaultInstance { return defaultclient_request_index_msgInstance; } - (BOOL) isInitialized { if (!self.hasName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeEnum:1 value:self.name]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeEnumSize(1, self.name); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (client_request_index_msg*) parseFromData:(NSData*) data { return (client_request_index_msg*)[[[client_request_index_msg builder] mergeFromData:data] build]; } + (client_request_index_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_index_msg*)[[[client_request_index_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (client_request_index_msg*) parseFromInputStream:(NSInputStream*) input { return (client_request_index_msg*)[[[client_request_index_msg builder] mergeFromInputStream:input] build]; } + (client_request_index_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_index_msg*)[[[client_request_index_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_request_index_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (client_request_index_msg*)[[[client_request_index_msg builder] mergeFromCodedInputStream:input] build]; } + (client_request_index_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_index_msg*)[[[client_request_index_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_request_index_msgBuilder*) builder { return [[client_request_index_msgBuilder alloc] init]; } + (client_request_index_msgBuilder*) builderWithPrototype:(client_request_index_msg*) prototype { return [[client_request_index_msg builder] mergeFrom:prototype]; } - (client_request_index_msgBuilder*) builder { return [client_request_index_msg builder]; } - (client_request_index_msgBuilder*) toBuilder { return [client_request_index_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", NSStringFromenum_index(self.name)]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: @(self.name) forKey: @"name"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[client_request_index_msg class]]) { return NO; } client_request_index_msg *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || self.name == otherMessage.name) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + self.name; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface client_request_index_msgBuilder() @property (strong) client_request_index_msg* resultClientRequestIndexMsg; @end @implementation client_request_index_msgBuilder @synthesize resultClientRequestIndexMsg; - (instancetype) init { if ((self = [super init])) { self.resultClientRequestIndexMsg = [[client_request_index_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultClientRequestIndexMsg; } - (client_request_index_msgBuilder*) clear { self.resultClientRequestIndexMsg = [[client_request_index_msg alloc] init]; return self; } - (client_request_index_msgBuilder*) clone { return [client_request_index_msg builderWithPrototype:resultClientRequestIndexMsg]; } - (client_request_index_msg*) defaultInstance { return [client_request_index_msg defaultInstance]; } - (client_request_index_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (client_request_index_msg*) buildPartial { client_request_index_msg* returnMe = resultClientRequestIndexMsg; self.resultClientRequestIndexMsg = nil; return returnMe; } - (client_request_index_msgBuilder*) mergeFrom:(client_request_index_msg*) other { if (other == [client_request_index_msg defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (client_request_index_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (client_request_index_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { enum_index value = (enum_index)[input readEnum]; if (enum_indexIsValidValue(value)) { [self setName:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } } } } - (BOOL) hasName { return resultClientRequestIndexMsg.hasName; } - (enum_index) name { return resultClientRequestIndexMsg.name; } - (client_request_index_msgBuilder*) setName:(enum_index) value { resultClientRequestIndexMsg.hasName = YES; resultClientRequestIndexMsg.name = value; return self; } - (client_request_index_msgBuilder*) clearName { resultClientRequestIndexMsg.hasName = NO; resultClientRequestIndexMsg.name = enum_indexBeginIndexEnum; return self; } @end @interface client_request_index_result_msg () @property enum_index name; @property (strong) NSMutableArray * stockCodeArray; @end @implementation client_request_index_result_msg - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize stockCodeArray; @dynamic stockCode; - (instancetype) init { if ((self = [super init])) { self.name = enum_indexBeginIndexEnum; } return self; } static client_request_index_result_msg* defaultclient_request_index_result_msgInstance = nil; + (void) initialize { if (self == [client_request_index_result_msg class]) { defaultclient_request_index_result_msgInstance = [[client_request_index_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultclient_request_index_result_msgInstance; } - (instancetype) defaultInstance { return defaultclient_request_index_result_msgInstance; } - (NSArray *)stockCode { return stockCodeArray; } - (NSString*)stockCodeAtIndex:(NSUInteger)index { return [stockCodeArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeEnum:1 value:self.name]; } [self.stockCodeArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { [output writeString:2 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeEnumSize(1, self.name); } { __block SInt32 dataSize = 0; const NSUInteger count = self.stockCodeArray.count; [self.stockCodeArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { dataSize += computeStringSizeNoTag(element); }]; size_ += dataSize; size_ += (SInt32)(1 * count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (client_request_index_result_msg*) parseFromData:(NSData*) data { return (client_request_index_result_msg*)[[[client_request_index_result_msg builder] mergeFromData:data] build]; } + (client_request_index_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_index_result_msg*)[[[client_request_index_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (client_request_index_result_msg*) parseFromInputStream:(NSInputStream*) input { return (client_request_index_result_msg*)[[[client_request_index_result_msg builder] mergeFromInputStream:input] build]; } + (client_request_index_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_index_result_msg*)[[[client_request_index_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_request_index_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (client_request_index_result_msg*)[[[client_request_index_result_msg builder] mergeFromCodedInputStream:input] build]; } + (client_request_index_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_index_result_msg*)[[[client_request_index_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_request_index_result_msgBuilder*) builder { return [[client_request_index_result_msgBuilder alloc] init]; } + (client_request_index_result_msgBuilder*) builderWithPrototype:(client_request_index_result_msg*) prototype { return [[client_request_index_result_msg builder] mergeFrom:prototype]; } - (client_request_index_result_msgBuilder*) builder { return [client_request_index_result_msg builder]; } - (client_request_index_result_msgBuilder*) toBuilder { return [client_request_index_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", NSStringFromenum_index(self.name)]; } [self.stockCodeArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", obj]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: @(self.name) forKey: @"name"]; } [dictionary setObject:self.stockCode forKey: @"stockCode"]; [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[client_request_index_result_msg class]]) { return NO; } client_request_index_result_msg *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || self.name == otherMessage.name) && [self.stockCodeArray isEqualToArray:otherMessage.stockCodeArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + self.name; } [self.stockCodeArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface client_request_index_result_msgBuilder() @property (strong) client_request_index_result_msg* resultClientRequestIndexResultMsg; @end @implementation client_request_index_result_msgBuilder @synthesize resultClientRequestIndexResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultClientRequestIndexResultMsg = [[client_request_index_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultClientRequestIndexResultMsg; } - (client_request_index_result_msgBuilder*) clear { self.resultClientRequestIndexResultMsg = [[client_request_index_result_msg alloc] init]; return self; } - (client_request_index_result_msgBuilder*) clone { return [client_request_index_result_msg builderWithPrototype:resultClientRequestIndexResultMsg]; } - (client_request_index_result_msg*) defaultInstance { return [client_request_index_result_msg defaultInstance]; } - (client_request_index_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (client_request_index_result_msg*) buildPartial { client_request_index_result_msg* returnMe = resultClientRequestIndexResultMsg; self.resultClientRequestIndexResultMsg = nil; return returnMe; } - (client_request_index_result_msgBuilder*) mergeFrom:(client_request_index_result_msg*) other { if (other == [client_request_index_result_msg defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.stockCodeArray.count > 0) { if (resultClientRequestIndexResultMsg.stockCodeArray == nil) { resultClientRequestIndexResultMsg.stockCodeArray = [[NSMutableArray alloc] initWithArray:other.stockCodeArray]; } else { [resultClientRequestIndexResultMsg.stockCodeArray addObjectsFromArray:other.stockCodeArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (client_request_index_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (client_request_index_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { enum_index value = (enum_index)[input readEnum]; if (enum_indexIsValidValue(value)) { [self setName:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self addStockCode:[input readString]]; break; } } } } - (BOOL) hasName { return resultClientRequestIndexResultMsg.hasName; } - (enum_index) name { return resultClientRequestIndexResultMsg.name; } - (client_request_index_result_msgBuilder*) setName:(enum_index) value { resultClientRequestIndexResultMsg.hasName = YES; resultClientRequestIndexResultMsg.name = value; return self; } - (client_request_index_result_msgBuilder*) clearName { resultClientRequestIndexResultMsg.hasName = NO; resultClientRequestIndexResultMsg.name = enum_indexBeginIndexEnum; return self; } - (NSMutableArray *)stockCode { return resultClientRequestIndexResultMsg.stockCodeArray; } - (NSString*)stockCodeAtIndex:(NSUInteger)index { return [resultClientRequestIndexResultMsg stockCodeAtIndex:index]; } - (client_request_index_result_msgBuilder *)addStockCode:(NSString*)value { if (resultClientRequestIndexResultMsg.stockCodeArray == nil) { resultClientRequestIndexResultMsg.stockCodeArray = [[NSMutableArray alloc]init]; } [resultClientRequestIndexResultMsg.stockCodeArray addObject:value]; return self; } - (client_request_index_result_msgBuilder *)setStockCodeArray:(NSArray *)array { resultClientRequestIndexResultMsg.stockCodeArray = [[NSMutableArray alloc] initWithArray:array]; return self; } - (client_request_index_result_msgBuilder *)clearStockCode { resultClientRequestIndexResultMsg.stockCodeArray = nil; return self; } @end @interface client_index_combo_result_msg () @property (strong) NSMutableArray * indexNodeArray; @end @implementation client_index_combo_result_msg @synthesize indexNodeArray; @dynamic indexNode; - (instancetype) init { if ((self = [super init])) { } return self; } static client_index_combo_result_msg* defaultclient_index_combo_result_msgInstance = nil; + (void) initialize { if (self == [client_index_combo_result_msg class]) { defaultclient_index_combo_result_msgInstance = [[client_index_combo_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultclient_index_combo_result_msgInstance; } - (instancetype) defaultInstance { return defaultclient_index_combo_result_msgInstance; } - (NSArray *)indexNode { return indexNodeArray; } - (client_request_index_result_msg*)indexNodeAtIndex:(NSUInteger)index { return [indexNodeArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexNode = YES; [self.indexNode enumerateObjectsUsingBlock:^(client_request_index_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexNode = NO; *stop = YES; } }]; if (!isInitindexNode) return isInitindexNode; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexNodeArray enumerateObjectsUsingBlock:^(client_request_index_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexNodeArray enumerateObjectsUsingBlock:^(client_request_index_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (client_index_combo_result_msg*) parseFromData:(NSData*) data { return (client_index_combo_result_msg*)[[[client_index_combo_result_msg builder] mergeFromData:data] build]; } + (client_index_combo_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_index_combo_result_msg*)[[[client_index_combo_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (client_index_combo_result_msg*) parseFromInputStream:(NSInputStream*) input { return (client_index_combo_result_msg*)[[[client_index_combo_result_msg builder] mergeFromInputStream:input] build]; } + (client_index_combo_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_index_combo_result_msg*)[[[client_index_combo_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_index_combo_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (client_index_combo_result_msg*)[[[client_index_combo_result_msg builder] mergeFromCodedInputStream:input] build]; } + (client_index_combo_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_index_combo_result_msg*)[[[client_index_combo_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_index_combo_result_msgBuilder*) builder { return [[client_index_combo_result_msgBuilder alloc] init]; } + (client_index_combo_result_msgBuilder*) builderWithPrototype:(client_index_combo_result_msg*) prototype { return [[client_index_combo_result_msg builder] mergeFrom:prototype]; } - (client_index_combo_result_msgBuilder*) builder { return [client_index_combo_result_msg builder]; } - (client_index_combo_result_msgBuilder*) toBuilder { return [client_index_combo_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexNodeArray enumerateObjectsUsingBlock:^(client_request_index_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexNode"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (client_request_index_result_msg* element in self.indexNodeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexNode"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[client_index_combo_result_msg class]]) { return NO; } client_index_combo_result_msg *otherMessage = other; return [self.indexNodeArray isEqualToArray:otherMessage.indexNodeArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexNodeArray enumerateObjectsUsingBlock:^(client_request_index_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface client_index_combo_result_msgBuilder() @property (strong) client_index_combo_result_msg* resultClientIndexComboResultMsg; @end @implementation client_index_combo_result_msgBuilder @synthesize resultClientIndexComboResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultClientIndexComboResultMsg = [[client_index_combo_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultClientIndexComboResultMsg; } - (client_index_combo_result_msgBuilder*) clear { self.resultClientIndexComboResultMsg = [[client_index_combo_result_msg alloc] init]; return self; } - (client_index_combo_result_msgBuilder*) clone { return [client_index_combo_result_msg builderWithPrototype:resultClientIndexComboResultMsg]; } - (client_index_combo_result_msg*) defaultInstance { return [client_index_combo_result_msg defaultInstance]; } - (client_index_combo_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (client_index_combo_result_msg*) buildPartial { client_index_combo_result_msg* returnMe = resultClientIndexComboResultMsg; self.resultClientIndexComboResultMsg = nil; return returnMe; } - (client_index_combo_result_msgBuilder*) mergeFrom:(client_index_combo_result_msg*) other { if (other == [client_index_combo_result_msg defaultInstance]) { return self; } if (other.indexNodeArray.count > 0) { if (resultClientIndexComboResultMsg.indexNodeArray == nil) { resultClientIndexComboResultMsg.indexNodeArray = [[NSMutableArray alloc] initWithArray:other.indexNodeArray]; } else { [resultClientIndexComboResultMsg.indexNodeArray addObjectsFromArray:other.indexNodeArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (client_index_combo_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (client_index_combo_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { client_request_index_result_msgBuilder* subBuilder = [client_request_index_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexNode:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexNode { return resultClientIndexComboResultMsg.indexNodeArray; } - (client_request_index_result_msg*)indexNodeAtIndex:(NSUInteger)index { return [resultClientIndexComboResultMsg indexNodeAtIndex:index]; } - (client_index_combo_result_msgBuilder *)addIndexNode:(client_request_index_result_msg*)value { if (resultClientIndexComboResultMsg.indexNodeArray == nil) { resultClientIndexComboResultMsg.indexNodeArray = [[NSMutableArray alloc]init]; } [resultClientIndexComboResultMsg.indexNodeArray addObject:value]; return self; } - (client_index_combo_result_msgBuilder *)setIndexNodeArray:(NSArray *)array { resultClientIndexComboResultMsg.indexNodeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (client_index_combo_result_msgBuilder *)clearIndexNode { resultClientIndexComboResultMsg.indexNodeArray = nil; return self; } @end @interface error_feedback_msg () @property (strong) NSString* msg; @end @implementation error_feedback_msg - (BOOL) hasMsg { return !!hasMsg_; } - (void) setHasMsg:(BOOL) _value_ { hasMsg_ = !!_value_; } @synthesize msg; - (instancetype) init { if ((self = [super init])) { self.msg = @""; } return self; } static error_feedback_msg* defaulterror_feedback_msgInstance = nil; + (void) initialize { if (self == [error_feedback_msg class]) { defaulterror_feedback_msgInstance = [[error_feedback_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulterror_feedback_msgInstance; } - (instancetype) defaultInstance { return defaulterror_feedback_msgInstance; } - (BOOL) isInitialized { if (!self.hasMsg) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasMsg) { [output writeString:1 value:self.msg]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasMsg) { size_ += computeStringSize(1, self.msg); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (error_feedback_msg*) parseFromData:(NSData*) data { return (error_feedback_msg*)[[[error_feedback_msg builder] mergeFromData:data] build]; } + (error_feedback_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (error_feedback_msg*)[[[error_feedback_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (error_feedback_msg*) parseFromInputStream:(NSInputStream*) input { return (error_feedback_msg*)[[[error_feedback_msg builder] mergeFromInputStream:input] build]; } + (error_feedback_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (error_feedback_msg*)[[[error_feedback_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (error_feedback_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (error_feedback_msg*)[[[error_feedback_msg builder] mergeFromCodedInputStream:input] build]; } + (error_feedback_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (error_feedback_msg*)[[[error_feedback_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (error_feedback_msgBuilder*) builder { return [[error_feedback_msgBuilder alloc] init]; } + (error_feedback_msgBuilder*) builderWithPrototype:(error_feedback_msg*) prototype { return [[error_feedback_msg builder] mergeFrom:prototype]; } - (error_feedback_msgBuilder*) builder { return [error_feedback_msg builder]; } - (error_feedback_msgBuilder*) toBuilder { return [error_feedback_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasMsg) { [output appendFormat:@"%@%@: %@\n", indent, @"msg", self.msg]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasMsg) { [dictionary setObject: self.msg forKey: @"msg"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[error_feedback_msg class]]) { return NO; } error_feedback_msg *otherMessage = other; return self.hasMsg == otherMessage.hasMsg && (!self.hasMsg || [self.msg isEqual:otherMessage.msg]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasMsg) { hashCode = hashCode * 31 + [self.msg hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface error_feedback_msgBuilder() @property (strong) error_feedback_msg* resultErrorFeedbackMsg; @end @implementation error_feedback_msgBuilder @synthesize resultErrorFeedbackMsg; - (instancetype) init { if ((self = [super init])) { self.resultErrorFeedbackMsg = [[error_feedback_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultErrorFeedbackMsg; } - (error_feedback_msgBuilder*) clear { self.resultErrorFeedbackMsg = [[error_feedback_msg alloc] init]; return self; } - (error_feedback_msgBuilder*) clone { return [error_feedback_msg builderWithPrototype:resultErrorFeedbackMsg]; } - (error_feedback_msg*) defaultInstance { return [error_feedback_msg defaultInstance]; } - (error_feedback_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (error_feedback_msg*) buildPartial { error_feedback_msg* returnMe = resultErrorFeedbackMsg; self.resultErrorFeedbackMsg = nil; return returnMe; } - (error_feedback_msgBuilder*) mergeFrom:(error_feedback_msg*) other { if (other == [error_feedback_msg defaultInstance]) { return self; } if (other.hasMsg) { [self setMsg:other.msg]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (error_feedback_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (error_feedback_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setMsg:[input readString]]; break; } } } } - (BOOL) hasMsg { return resultErrorFeedbackMsg.hasMsg; } - (NSString*) msg { return resultErrorFeedbackMsg.msg; } - (error_feedback_msgBuilder*) setMsg:(NSString*) value { resultErrorFeedbackMsg.hasMsg = YES; resultErrorFeedbackMsg.msg = value; return self; } - (error_feedback_msgBuilder*) clearMsg { resultErrorFeedbackMsg.hasMsg = NO; resultErrorFeedbackMsg.msg = @""; return self; } @end @interface index_data_msg () @property enum_index name; @property (strong) NSString* stockCode; @property index_data_type cycleType; @property (strong) data_selector* selector; @property (strong) NSData* indexParam; @end @implementation index_data_msg - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasStockCode { return !!hasStockCode_; } - (void) setHasStockCode:(BOOL) _value_ { hasStockCode_ = !!_value_; } @synthesize stockCode; - (BOOL) hasCycleType { return !!hasCycleType_; } - (void) setHasCycleType:(BOOL) _value_ { hasCycleType_ = !!_value_; } @synthesize cycleType; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (BOOL) hasIndexParam { return !!hasIndexParam_; } - (void) setHasIndexParam:(BOOL) _value_ { hasIndexParam_ = !!_value_; } @synthesize indexParam; - (instancetype) init { if ((self = [super init])) { self.name = enum_indexBeginIndexEnum; self.stockCode = @""; self.cycleType = index_data_typeCycleBegin; self.selector = [data_selector defaultInstance]; self.indexParam = [NSData data]; } return self; } static index_data_msg* defaultindex_data_msgInstance = nil; + (void) initialize { if (self == [index_data_msg class]) { defaultindex_data_msgInstance = [[index_data_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultindex_data_msgInstance; } - (instancetype) defaultInstance { return defaultindex_data_msgInstance; } - (BOOL) isInitialized { if (!self.hasName) { return NO; } if (!self.hasStockCode) { return NO; } if (!self.hasCycleType) { return NO; } if (!self.hasSelector) { return NO; } if (!self.selector.isInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeEnum:1 value:self.name]; } if (self.hasStockCode) { [output writeString:2 value:self.stockCode]; } if (self.hasCycleType) { [output writeEnum:3 value:self.cycleType]; } if (self.hasSelector) { [output writeMessage:4 value:self.selector]; } if (self.hasIndexParam) { [output writeData:5 value:self.indexParam]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeEnumSize(1, self.name); } if (self.hasStockCode) { size_ += computeStringSize(2, self.stockCode); } if (self.hasCycleType) { size_ += computeEnumSize(3, self.cycleType); } if (self.hasSelector) { size_ += computeMessageSize(4, self.selector); } if (self.hasIndexParam) { size_ += computeDataSize(5, self.indexParam); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (index_data_msg*) parseFromData:(NSData*) data { return (index_data_msg*)[[[index_data_msg builder] mergeFromData:data] build]; } + (index_data_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (index_data_msg*)[[[index_data_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (index_data_msg*) parseFromInputStream:(NSInputStream*) input { return (index_data_msg*)[[[index_data_msg builder] mergeFromInputStream:input] build]; } + (index_data_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (index_data_msg*)[[[index_data_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (index_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (index_data_msg*)[[[index_data_msg builder] mergeFromCodedInputStream:input] build]; } + (index_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (index_data_msg*)[[[index_data_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (index_data_msgBuilder*) builder { return [[index_data_msgBuilder alloc] init]; } + (index_data_msgBuilder*) builderWithPrototype:(index_data_msg*) prototype { return [[index_data_msg builder] mergeFrom:prototype]; } - (index_data_msgBuilder*) builder { return [index_data_msg builder]; } - (index_data_msgBuilder*) toBuilder { return [index_data_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", NSStringFromenum_index(self.name)]; } if (self.hasStockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", self.stockCode]; } if (self.hasCycleType) { [output appendFormat:@"%@%@: %@\n", indent, @"cycleType", NSStringFromindex_data_type(self.cycleType)]; } if (self.hasSelector) { [output appendFormat:@"%@%@ {\n", indent, @"selector"]; [self.selector writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } if (self.hasIndexParam) { [output appendFormat:@"%@%@: %@\n", indent, @"indexParam", self.indexParam]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: @(self.name) forKey: @"name"]; } if (self.hasStockCode) { [dictionary setObject: self.stockCode forKey: @"stockCode"]; } if (self.hasCycleType) { [dictionary setObject: @(self.cycleType) forKey: @"cycleType"]; } if (self.hasSelector) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.selector storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"selector"]; } if (self.hasIndexParam) { [dictionary setObject: self.indexParam forKey: @"indexParam"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[index_data_msg class]]) { return NO; } index_data_msg *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || self.name == otherMessage.name) && self.hasStockCode == otherMessage.hasStockCode && (!self.hasStockCode || [self.stockCode isEqual:otherMessage.stockCode]) && self.hasCycleType == otherMessage.hasCycleType && (!self.hasCycleType || self.cycleType == otherMessage.cycleType) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && self.hasIndexParam == otherMessage.hasIndexParam && (!self.hasIndexParam || [self.indexParam isEqual:otherMessage.indexParam]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + self.name; } if (self.hasStockCode) { hashCode = hashCode * 31 + [self.stockCode hash]; } if (self.hasCycleType) { hashCode = hashCode * 31 + self.cycleType; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } if (self.hasIndexParam) { hashCode = hashCode * 31 + [self.indexParam hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface index_data_msgBuilder() @property (strong) index_data_msg* resultIndexDataMsg; @end @implementation index_data_msgBuilder @synthesize resultIndexDataMsg; - (instancetype) init { if ((self = [super init])) { self.resultIndexDataMsg = [[index_data_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultIndexDataMsg; } - (index_data_msgBuilder*) clear { self.resultIndexDataMsg = [[index_data_msg alloc] init]; return self; } - (index_data_msgBuilder*) clone { return [index_data_msg builderWithPrototype:resultIndexDataMsg]; } - (index_data_msg*) defaultInstance { return [index_data_msg defaultInstance]; } - (index_data_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (index_data_msg*) buildPartial { index_data_msg* returnMe = resultIndexDataMsg; self.resultIndexDataMsg = nil; return returnMe; } - (index_data_msgBuilder*) mergeFrom:(index_data_msg*) other { if (other == [index_data_msg defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasStockCode) { [self setStockCode:other.stockCode]; } if (other.hasCycleType) { [self setCycleType:other.cycleType]; } if (other.hasSelector) { [self mergeSelector:other.selector]; } if (other.hasIndexParam) { [self setIndexParam:other.indexParam]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (index_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (index_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { enum_index value = (enum_index)[input readEnum]; if (enum_indexIsValidValue(value)) { [self setName:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setStockCode:[input readString]]; break; } case 24: { index_data_type value = (index_data_type)[input readEnum]; if (index_data_typeIsValidValue(value)) { [self setCycleType:value]; } else { [unknownFields mergeVarintField:3 value:value]; } break; } case 34: { data_selectorBuilder* subBuilder = [data_selector builder]; if (self.hasSelector) { [subBuilder mergeFrom:self.selector]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSelector:[subBuilder buildPartial]]; break; } case 42: { [self setIndexParam:[input readData]]; break; } } } } - (BOOL) hasName { return resultIndexDataMsg.hasName; } - (enum_index) name { return resultIndexDataMsg.name; } - (index_data_msgBuilder*) setName:(enum_index) value { resultIndexDataMsg.hasName = YES; resultIndexDataMsg.name = value; return self; } - (index_data_msgBuilder*) clearName { resultIndexDataMsg.hasName = NO; resultIndexDataMsg.name = enum_indexBeginIndexEnum; return self; } - (BOOL) hasStockCode { return resultIndexDataMsg.hasStockCode; } - (NSString*) stockCode { return resultIndexDataMsg.stockCode; } - (index_data_msgBuilder*) setStockCode:(NSString*) value { resultIndexDataMsg.hasStockCode = YES; resultIndexDataMsg.stockCode = value; return self; } - (index_data_msgBuilder*) clearStockCode { resultIndexDataMsg.hasStockCode = NO; resultIndexDataMsg.stockCode = @""; return self; } - (BOOL) hasCycleType { return resultIndexDataMsg.hasCycleType; } - (index_data_type) cycleType { return resultIndexDataMsg.cycleType; } - (index_data_msgBuilder*) setCycleType:(index_data_type) value { resultIndexDataMsg.hasCycleType = YES; resultIndexDataMsg.cycleType = value; return self; } - (index_data_msgBuilder*) clearCycleType { resultIndexDataMsg.hasCycleType = NO; resultIndexDataMsg.cycleType = index_data_typeCycleBegin; return self; } - (BOOL) hasSelector { return resultIndexDataMsg.hasSelector; } - (data_selector*) selector { return resultIndexDataMsg.selector; } - (index_data_msgBuilder*) setSelector:(data_selector*) value { resultIndexDataMsg.hasSelector = YES; resultIndexDataMsg.selector = value; return self; } - (index_data_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue { return [self setSelector:[builderForValue build]]; } - (index_data_msgBuilder*) mergeSelector:(data_selector*) value { if (resultIndexDataMsg.hasSelector && resultIndexDataMsg.selector != [data_selector defaultInstance]) { resultIndexDataMsg.selector = [[[data_selector builderWithPrototype:resultIndexDataMsg.selector] mergeFrom:value] buildPartial]; } else { resultIndexDataMsg.selector = value; } resultIndexDataMsg.hasSelector = YES; return self; } - (index_data_msgBuilder*) clearSelector { resultIndexDataMsg.hasSelector = NO; resultIndexDataMsg.selector = [data_selector defaultInstance]; return self; } - (BOOL) hasIndexParam { return resultIndexDataMsg.hasIndexParam; } - (NSData*) indexParam { return resultIndexDataMsg.indexParam; } - (index_data_msgBuilder*) setIndexParam:(NSData*) value { resultIndexDataMsg.hasIndexParam = YES; resultIndexDataMsg.indexParam = value; return self; } - (index_data_msgBuilder*) clearIndexParam { resultIndexDataMsg.hasIndexParam = NO; resultIndexDataMsg.indexParam = [NSData data]; return self; } @end @interface zlzz () @property UInt32 time; @property Float64 zlzzValue; @end @implementation zlzz - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasZlzzValue { return !!hasZlzzValue_; } - (void) setHasZlzzValue:(BOOL) _value_ { hasZlzzValue_ = !!_value_; } @synthesize zlzzValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.zlzzValue = 0; } return self; } static zlzz* defaultzlzzInstance = nil; + (void) initialize { if (self == [zlzz class]) { defaultzlzzInstance = [[zlzz alloc] init]; } } + (instancetype) defaultInstance { return defaultzlzzInstance; } - (instancetype) defaultInstance { return defaultzlzzInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasZlzzValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasZlzzValue) { [output writeDouble:3 value:self.zlzzValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasZlzzValue) { size_ += computeDoubleSize(3, self.zlzzValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlzz*) parseFromData:(NSData*) data { return (zlzz*)[[[zlzz builder] mergeFromData:data] build]; } + (zlzz*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzz*)[[[zlzz builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlzz*) parseFromInputStream:(NSInputStream*) input { return (zlzz*)[[[zlzz builder] mergeFromInputStream:input] build]; } + (zlzz*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzz*)[[[zlzz builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzz*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlzz*)[[[zlzz builder] mergeFromCodedInputStream:input] build]; } + (zlzz*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzz*)[[[zlzz builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzzBuilder*) builder { return [[zlzzBuilder alloc] init]; } + (zlzzBuilder*) builderWithPrototype:(zlzz*) prototype { return [[zlzz builder] mergeFrom:prototype]; } - (zlzzBuilder*) builder { return [zlzz builder]; } - (zlzzBuilder*) toBuilder { return [zlzz builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasZlzzValue) { [output appendFormat:@"%@%@: %@\n", indent, @"zlzzValue", [NSNumber numberWithDouble:self.zlzzValue]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasZlzzValue) { [dictionary setObject: [NSNumber numberWithDouble:self.zlzzValue] forKey: @"zlzzValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlzz class]]) { return NO; } zlzz *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasZlzzValue == otherMessage.hasZlzzValue && (!self.hasZlzzValue || self.zlzzValue == otherMessage.zlzzValue) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasZlzzValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zlzzValue] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlzzBuilder() @property (strong) zlzz* resultZlzz; @end @implementation zlzzBuilder @synthesize resultZlzz; - (instancetype) init { if ((self = [super init])) { self.resultZlzz = [[zlzz alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlzz; } - (zlzzBuilder*) clear { self.resultZlzz = [[zlzz alloc] init]; return self; } - (zlzzBuilder*) clone { return [zlzz builderWithPrototype:resultZlzz]; } - (zlzz*) defaultInstance { return [zlzz defaultInstance]; } - (zlzz*) build { [self checkInitialized]; return [self buildPartial]; } - (zlzz*) buildPartial { zlzz* returnMe = resultZlzz; self.resultZlzz = nil; return returnMe; } - (zlzzBuilder*) mergeFrom:(zlzz*) other { if (other == [zlzz defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasZlzzValue) { [self setZlzzValue:other.zlzzValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlzzBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlzzBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 25: { [self setZlzzValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultZlzz.hasTime; } - (UInt32) time { return resultZlzz.time; } - (zlzzBuilder*) setTime:(UInt32) value { resultZlzz.hasTime = YES; resultZlzz.time = value; return self; } - (zlzzBuilder*) clearTime { resultZlzz.hasTime = NO; resultZlzz.time = 0; return self; } - (BOOL) hasZlzzValue { return resultZlzz.hasZlzzValue; } - (Float64) zlzzValue { return resultZlzz.zlzzValue; } - (zlzzBuilder*) setZlzzValue:(Float64) value { resultZlzz.hasZlzzValue = YES; resultZlzz.zlzzValue = value; return self; } - (zlzzBuilder*) clearZlzzValue { resultZlzz.hasZlzzValue = NO; resultZlzz.zlzzValue = 0; return self; } @end @interface zlzz_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation zlzz_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static zlzz_array* defaultzlzz_arrayInstance = nil; + (void) initialize { if (self == [zlzz_array class]) { defaultzlzz_arrayInstance = [[zlzz_array alloc] init]; } } + (instancetype) defaultInstance { return defaultzlzz_arrayInstance; } - (instancetype) defaultInstance { return defaultzlzz_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (zlzz*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(zlzz *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(zlzz *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(zlzz *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlzz_array*) parseFromData:(NSData*) data { return (zlzz_array*)[[[zlzz_array builder] mergeFromData:data] build]; } + (zlzz_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzz_array*)[[[zlzz_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlzz_array*) parseFromInputStream:(NSInputStream*) input { return (zlzz_array*)[[[zlzz_array builder] mergeFromInputStream:input] build]; } + (zlzz_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzz_array*)[[[zlzz_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzz_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlzz_array*)[[[zlzz_array builder] mergeFromCodedInputStream:input] build]; } + (zlzz_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzz_array*)[[[zlzz_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzz_arrayBuilder*) builder { return [[zlzz_arrayBuilder alloc] init]; } + (zlzz_arrayBuilder*) builderWithPrototype:(zlzz_array*) prototype { return [[zlzz_array builder] mergeFrom:prototype]; } - (zlzz_arrayBuilder*) builder { return [zlzz_array builder]; } - (zlzz_arrayBuilder*) toBuilder { return [zlzz_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(zlzz *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (zlzz* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlzz_array class]]) { return NO; } zlzz_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(zlzz *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlzz_arrayBuilder() @property (strong) zlzz_array* resultZlzzArray; @end @implementation zlzz_arrayBuilder @synthesize resultZlzzArray; - (instancetype) init { if ((self = [super init])) { self.resultZlzzArray = [[zlzz_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlzzArray; } - (zlzz_arrayBuilder*) clear { self.resultZlzzArray = [[zlzz_array alloc] init]; return self; } - (zlzz_arrayBuilder*) clone { return [zlzz_array builderWithPrototype:resultZlzzArray]; } - (zlzz_array*) defaultInstance { return [zlzz_array defaultInstance]; } - (zlzz_array*) build { [self checkInitialized]; return [self buildPartial]; } - (zlzz_array*) buildPartial { zlzz_array* returnMe = resultZlzzArray; self.resultZlzzArray = nil; return returnMe; } - (zlzz_arrayBuilder*) mergeFrom:(zlzz_array*) other { if (other == [zlzz_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultZlzzArray.indexDataArray == nil) { resultZlzzArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultZlzzArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlzz_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlzz_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { zlzzBuilder* subBuilder = [zlzz builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultZlzzArray.indexDataArray; } - (zlzz*)indexDataAtIndex:(NSUInteger)index { return [resultZlzzArray indexDataAtIndex:index]; } - (zlzz_arrayBuilder *)addIndexData:(zlzz*)value { if (resultZlzzArray.indexDataArray == nil) { resultZlzzArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultZlzzArray.indexDataArray addObject:value]; return self; } - (zlzz_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultZlzzArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (zlzz_arrayBuilder *)clearIndexData { resultZlzzArray.indexDataArray = nil; return self; } @end @interface zlzt () @property UInt32 time; @property Float64 duanXianShangGong; @property Float64 zhongXianQiangShi; @property Float64 zhongXianKongPan; @property Float64 duanXianChaoDie; @property Float64 zhongXianChaoDie; @end @implementation zlzt - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasDuanXianShangGong { return !!hasDuanXianShangGong_; } - (void) setHasDuanXianShangGong:(BOOL) _value_ { hasDuanXianShangGong_ = !!_value_; } @synthesize duanXianShangGong; - (BOOL) hasZhongXianQiangShi { return !!hasZhongXianQiangShi_; } - (void) setHasZhongXianQiangShi:(BOOL) _value_ { hasZhongXianQiangShi_ = !!_value_; } @synthesize zhongXianQiangShi; - (BOOL) hasZhongXianKongPan { return !!hasZhongXianKongPan_; } - (void) setHasZhongXianKongPan:(BOOL) _value_ { hasZhongXianKongPan_ = !!_value_; } @synthesize zhongXianKongPan; - (BOOL) hasDuanXianChaoDie { return !!hasDuanXianChaoDie_; } - (void) setHasDuanXianChaoDie:(BOOL) _value_ { hasDuanXianChaoDie_ = !!_value_; } @synthesize duanXianChaoDie; - (BOOL) hasZhongXianChaoDie { return !!hasZhongXianChaoDie_; } - (void) setHasZhongXianChaoDie:(BOOL) _value_ { hasZhongXianChaoDie_ = !!_value_; } @synthesize zhongXianChaoDie; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.duanXianShangGong = 0; self.zhongXianQiangShi = 0; self.zhongXianKongPan = 0; self.duanXianChaoDie = 0; self.zhongXianChaoDie = 0; } return self; } static zlzt* defaultzlztInstance = nil; + (void) initialize { if (self == [zlzt class]) { defaultzlztInstance = [[zlzt alloc] init]; } } + (instancetype) defaultInstance { return defaultzlztInstance; } - (instancetype) defaultInstance { return defaultzlztInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasDuanXianShangGong) { return NO; } if (!self.hasZhongXianQiangShi) { return NO; } if (!self.hasZhongXianKongPan) { return NO; } if (!self.hasDuanXianChaoDie) { return NO; } if (!self.hasZhongXianChaoDie) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasDuanXianShangGong) { [output writeDouble:2 value:self.duanXianShangGong]; } if (self.hasZhongXianQiangShi) { [output writeDouble:3 value:self.zhongXianQiangShi]; } if (self.hasZhongXianKongPan) { [output writeDouble:4 value:self.zhongXianKongPan]; } if (self.hasDuanXianChaoDie) { [output writeDouble:5 value:self.duanXianChaoDie]; } if (self.hasZhongXianChaoDie) { [output writeDouble:6 value:self.zhongXianChaoDie]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasDuanXianShangGong) { size_ += computeDoubleSize(2, self.duanXianShangGong); } if (self.hasZhongXianQiangShi) { size_ += computeDoubleSize(3, self.zhongXianQiangShi); } if (self.hasZhongXianKongPan) { size_ += computeDoubleSize(4, self.zhongXianKongPan); } if (self.hasDuanXianChaoDie) { size_ += computeDoubleSize(5, self.duanXianChaoDie); } if (self.hasZhongXianChaoDie) { size_ += computeDoubleSize(6, self.zhongXianChaoDie); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlzt*) parseFromData:(NSData*) data { return (zlzt*)[[[zlzt builder] mergeFromData:data] build]; } + (zlzt*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzt*)[[[zlzt builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlzt*) parseFromInputStream:(NSInputStream*) input { return (zlzt*)[[[zlzt builder] mergeFromInputStream:input] build]; } + (zlzt*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzt*)[[[zlzt builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzt*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlzt*)[[[zlzt builder] mergeFromCodedInputStream:input] build]; } + (zlzt*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzt*)[[[zlzt builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlztBuilder*) builder { return [[zlztBuilder alloc] init]; } + (zlztBuilder*) builderWithPrototype:(zlzt*) prototype { return [[zlzt builder] mergeFrom:prototype]; } - (zlztBuilder*) builder { return [zlzt builder]; } - (zlztBuilder*) toBuilder { return [zlzt builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasDuanXianShangGong) { [output appendFormat:@"%@%@: %@\n", indent, @"duanXianShangGong", [NSNumber numberWithDouble:self.duanXianShangGong]]; } if (self.hasZhongXianQiangShi) { [output appendFormat:@"%@%@: %@\n", indent, @"zhongXianQiangShi", [NSNumber numberWithDouble:self.zhongXianQiangShi]]; } if (self.hasZhongXianKongPan) { [output appendFormat:@"%@%@: %@\n", indent, @"zhongXianKongPan", [NSNumber numberWithDouble:self.zhongXianKongPan]]; } if (self.hasDuanXianChaoDie) { [output appendFormat:@"%@%@: %@\n", indent, @"duanXianChaoDie", [NSNumber numberWithDouble:self.duanXianChaoDie]]; } if (self.hasZhongXianChaoDie) { [output appendFormat:@"%@%@: %@\n", indent, @"zhongXianChaoDie", [NSNumber numberWithDouble:self.zhongXianChaoDie]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasDuanXianShangGong) { [dictionary setObject: [NSNumber numberWithDouble:self.duanXianShangGong] forKey: @"duanXianShangGong"]; } if (self.hasZhongXianQiangShi) { [dictionary setObject: [NSNumber numberWithDouble:self.zhongXianQiangShi] forKey: @"zhongXianQiangShi"]; } if (self.hasZhongXianKongPan) { [dictionary setObject: [NSNumber numberWithDouble:self.zhongXianKongPan] forKey: @"zhongXianKongPan"]; } if (self.hasDuanXianChaoDie) { [dictionary setObject: [NSNumber numberWithDouble:self.duanXianChaoDie] forKey: @"duanXianChaoDie"]; } if (self.hasZhongXianChaoDie) { [dictionary setObject: [NSNumber numberWithDouble:self.zhongXianChaoDie] forKey: @"zhongXianChaoDie"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlzt class]]) { return NO; } zlzt *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasDuanXianShangGong == otherMessage.hasDuanXianShangGong && (!self.hasDuanXianShangGong || self.duanXianShangGong == otherMessage.duanXianShangGong) && self.hasZhongXianQiangShi == otherMessage.hasZhongXianQiangShi && (!self.hasZhongXianQiangShi || self.zhongXianQiangShi == otherMessage.zhongXianQiangShi) && self.hasZhongXianKongPan == otherMessage.hasZhongXianKongPan && (!self.hasZhongXianKongPan || self.zhongXianKongPan == otherMessage.zhongXianKongPan) && self.hasDuanXianChaoDie == otherMessage.hasDuanXianChaoDie && (!self.hasDuanXianChaoDie || self.duanXianChaoDie == otherMessage.duanXianChaoDie) && self.hasZhongXianChaoDie == otherMessage.hasZhongXianChaoDie && (!self.hasZhongXianChaoDie || self.zhongXianChaoDie == otherMessage.zhongXianChaoDie) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasDuanXianShangGong) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.duanXianShangGong] hash]; } if (self.hasZhongXianQiangShi) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zhongXianQiangShi] hash]; } if (self.hasZhongXianKongPan) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zhongXianKongPan] hash]; } if (self.hasDuanXianChaoDie) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.duanXianChaoDie] hash]; } if (self.hasZhongXianChaoDie) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zhongXianChaoDie] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlztBuilder() @property (strong) zlzt* resultZlzt; @end @implementation zlztBuilder @synthesize resultZlzt; - (instancetype) init { if ((self = [super init])) { self.resultZlzt = [[zlzt alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlzt; } - (zlztBuilder*) clear { self.resultZlzt = [[zlzt alloc] init]; return self; } - (zlztBuilder*) clone { return [zlzt builderWithPrototype:resultZlzt]; } - (zlzt*) defaultInstance { return [zlzt defaultInstance]; } - (zlzt*) build { [self checkInitialized]; return [self buildPartial]; } - (zlzt*) buildPartial { zlzt* returnMe = resultZlzt; self.resultZlzt = nil; return returnMe; } - (zlztBuilder*) mergeFrom:(zlzt*) other { if (other == [zlzt defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasDuanXianShangGong) { [self setDuanXianShangGong:other.duanXianShangGong]; } if (other.hasZhongXianQiangShi) { [self setZhongXianQiangShi:other.zhongXianQiangShi]; } if (other.hasZhongXianKongPan) { [self setZhongXianKongPan:other.zhongXianKongPan]; } if (other.hasDuanXianChaoDie) { [self setDuanXianChaoDie:other.duanXianChaoDie]; } if (other.hasZhongXianChaoDie) { [self setZhongXianChaoDie:other.zhongXianChaoDie]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlztBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlztBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setDuanXianShangGong:[input readDouble]]; break; } case 25: { [self setZhongXianQiangShi:[input readDouble]]; break; } case 33: { [self setZhongXianKongPan:[input readDouble]]; break; } case 41: { [self setDuanXianChaoDie:[input readDouble]]; break; } case 49: { [self setZhongXianChaoDie:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultZlzt.hasTime; } - (UInt32) time { return resultZlzt.time; } - (zlztBuilder*) setTime:(UInt32) value { resultZlzt.hasTime = YES; resultZlzt.time = value; return self; } - (zlztBuilder*) clearTime { resultZlzt.hasTime = NO; resultZlzt.time = 0; return self; } - (BOOL) hasDuanXianShangGong { return resultZlzt.hasDuanXianShangGong; } - (Float64) duanXianShangGong { return resultZlzt.duanXianShangGong; } - (zlztBuilder*) setDuanXianShangGong:(Float64) value { resultZlzt.hasDuanXianShangGong = YES; resultZlzt.duanXianShangGong = value; return self; } - (zlztBuilder*) clearDuanXianShangGong { resultZlzt.hasDuanXianShangGong = NO; resultZlzt.duanXianShangGong = 0; return self; } - (BOOL) hasZhongXianQiangShi { return resultZlzt.hasZhongXianQiangShi; } - (Float64) zhongXianQiangShi { return resultZlzt.zhongXianQiangShi; } - (zlztBuilder*) setZhongXianQiangShi:(Float64) value { resultZlzt.hasZhongXianQiangShi = YES; resultZlzt.zhongXianQiangShi = value; return self; } - (zlztBuilder*) clearZhongXianQiangShi { resultZlzt.hasZhongXianQiangShi = NO; resultZlzt.zhongXianQiangShi = 0; return self; } - (BOOL) hasZhongXianKongPan { return resultZlzt.hasZhongXianKongPan; } - (Float64) zhongXianKongPan { return resultZlzt.zhongXianKongPan; } - (zlztBuilder*) setZhongXianKongPan:(Float64) value { resultZlzt.hasZhongXianKongPan = YES; resultZlzt.zhongXianKongPan = value; return self; } - (zlztBuilder*) clearZhongXianKongPan { resultZlzt.hasZhongXianKongPan = NO; resultZlzt.zhongXianKongPan = 0; return self; } - (BOOL) hasDuanXianChaoDie { return resultZlzt.hasDuanXianChaoDie; } - (Float64) duanXianChaoDie { return resultZlzt.duanXianChaoDie; } - (zlztBuilder*) setDuanXianChaoDie:(Float64) value { resultZlzt.hasDuanXianChaoDie = YES; resultZlzt.duanXianChaoDie = value; return self; } - (zlztBuilder*) clearDuanXianChaoDie { resultZlzt.hasDuanXianChaoDie = NO; resultZlzt.duanXianChaoDie = 0; return self; } - (BOOL) hasZhongXianChaoDie { return resultZlzt.hasZhongXianChaoDie; } - (Float64) zhongXianChaoDie { return resultZlzt.zhongXianChaoDie; } - (zlztBuilder*) setZhongXianChaoDie:(Float64) value { resultZlzt.hasZhongXianChaoDie = YES; resultZlzt.zhongXianChaoDie = value; return self; } - (zlztBuilder*) clearZhongXianChaoDie { resultZlzt.hasZhongXianChaoDie = NO; resultZlzt.zhongXianChaoDie = 0; return self; } @end @interface zlzt_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation zlzt_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static zlzt_array* defaultzlzt_arrayInstance = nil; + (void) initialize { if (self == [zlzt_array class]) { defaultzlzt_arrayInstance = [[zlzt_array alloc] init]; } } + (instancetype) defaultInstance { return defaultzlzt_arrayInstance; } - (instancetype) defaultInstance { return defaultzlzt_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (zlzt*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(zlzt *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(zlzt *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(zlzt *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlzt_array*) parseFromData:(NSData*) data { return (zlzt_array*)[[[zlzt_array builder] mergeFromData:data] build]; } + (zlzt_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzt_array*)[[[zlzt_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlzt_array*) parseFromInputStream:(NSInputStream*) input { return (zlzt_array*)[[[zlzt_array builder] mergeFromInputStream:input] build]; } + (zlzt_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzt_array*)[[[zlzt_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzt_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlzt_array*)[[[zlzt_array builder] mergeFromCodedInputStream:input] build]; } + (zlzt_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzt_array*)[[[zlzt_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzt_arrayBuilder*) builder { return [[zlzt_arrayBuilder alloc] init]; } + (zlzt_arrayBuilder*) builderWithPrototype:(zlzt_array*) prototype { return [[zlzt_array builder] mergeFrom:prototype]; } - (zlzt_arrayBuilder*) builder { return [zlzt_array builder]; } - (zlzt_arrayBuilder*) toBuilder { return [zlzt_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(zlzt *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (zlzt* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlzt_array class]]) { return NO; } zlzt_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(zlzt *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlzt_arrayBuilder() @property (strong) zlzt_array* resultZlztArray; @end @implementation zlzt_arrayBuilder @synthesize resultZlztArray; - (instancetype) init { if ((self = [super init])) { self.resultZlztArray = [[zlzt_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlztArray; } - (zlzt_arrayBuilder*) clear { self.resultZlztArray = [[zlzt_array alloc] init]; return self; } - (zlzt_arrayBuilder*) clone { return [zlzt_array builderWithPrototype:resultZlztArray]; } - (zlzt_array*) defaultInstance { return [zlzt_array defaultInstance]; } - (zlzt_array*) build { [self checkInitialized]; return [self buildPartial]; } - (zlzt_array*) buildPartial { zlzt_array* returnMe = resultZlztArray; self.resultZlztArray = nil; return returnMe; } - (zlzt_arrayBuilder*) mergeFrom:(zlzt_array*) other { if (other == [zlzt_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultZlztArray.indexDataArray == nil) { resultZlztArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultZlztArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlzt_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlzt_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { zlztBuilder* subBuilder = [zlzt builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultZlztArray.indexDataArray; } - (zlzt*)indexDataAtIndex:(NSUInteger)index { return [resultZlztArray indexDataAtIndex:index]; } - (zlzt_arrayBuilder *)addIndexData:(zlzt*)value { if (resultZlztArray.indexDataArray == nil) { resultZlztArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultZlztArray.indexDataArray addObject:value]; return self; } - (zlzt_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultZlztArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (zlzt_arrayBuilder *)clearIndexData { resultZlztArray.indexDataArray = nil; return self; } @end @interface bljj () @property UInt32 time; @property Float64 xys0; @property Float64 xyshsl; @property Float64 cys13; @end @implementation bljj - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasXys0 { return !!hasXys0_; } - (void) setHasXys0:(BOOL) _value_ { hasXys0_ = !!_value_; } @synthesize xys0; - (BOOL) hasXyshsl { return !!hasXyshsl_; } - (void) setHasXyshsl:(BOOL) _value_ { hasXyshsl_ = !!_value_; } @synthesize xyshsl; - (BOOL) hasCys13 { return !!hasCys13_; } - (void) setHasCys13:(BOOL) _value_ { hasCys13_ = !!_value_; } @synthesize cys13; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.xys0 = 0; self.xyshsl = 0; self.cys13 = 0; } return self; } static bljj* defaultbljjInstance = nil; + (void) initialize { if (self == [bljj class]) { defaultbljjInstance = [[bljj alloc] init]; } } + (instancetype) defaultInstance { return defaultbljjInstance; } - (instancetype) defaultInstance { return defaultbljjInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasXys0) { return NO; } if (!self.hasXyshsl) { return NO; } if (!self.hasCys13) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasXys0) { [output writeDouble:2 value:self.xys0]; } if (self.hasXyshsl) { [output writeDouble:3 value:self.xyshsl]; } if (self.hasCys13) { [output writeDouble:4 value:self.cys13]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasXys0) { size_ += computeDoubleSize(2, self.xys0); } if (self.hasXyshsl) { size_ += computeDoubleSize(3, self.xyshsl); } if (self.hasCys13) { size_ += computeDoubleSize(4, self.cys13); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (bljj*) parseFromData:(NSData*) data { return (bljj*)[[[bljj builder] mergeFromData:data] build]; } + (bljj*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (bljj*)[[[bljj builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (bljj*) parseFromInputStream:(NSInputStream*) input { return (bljj*)[[[bljj builder] mergeFromInputStream:input] build]; } + (bljj*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (bljj*)[[[bljj builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (bljj*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (bljj*)[[[bljj builder] mergeFromCodedInputStream:input] build]; } + (bljj*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (bljj*)[[[bljj builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (bljjBuilder*) builder { return [[bljjBuilder alloc] init]; } + (bljjBuilder*) builderWithPrototype:(bljj*) prototype { return [[bljj builder] mergeFrom:prototype]; } - (bljjBuilder*) builder { return [bljj builder]; } - (bljjBuilder*) toBuilder { return [bljj builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasXys0) { [output appendFormat:@"%@%@: %@\n", indent, @"xys0", [NSNumber numberWithDouble:self.xys0]]; } if (self.hasXyshsl) { [output appendFormat:@"%@%@: %@\n", indent, @"xyshsl", [NSNumber numberWithDouble:self.xyshsl]]; } if (self.hasCys13) { [output appendFormat:@"%@%@: %@\n", indent, @"cys13", [NSNumber numberWithDouble:self.cys13]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasXys0) { [dictionary setObject: [NSNumber numberWithDouble:self.xys0] forKey: @"xys0"]; } if (self.hasXyshsl) { [dictionary setObject: [NSNumber numberWithDouble:self.xyshsl] forKey: @"xyshsl"]; } if (self.hasCys13) { [dictionary setObject: [NSNumber numberWithDouble:self.cys13] forKey: @"cys13"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[bljj class]]) { return NO; } bljj *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasXys0 == otherMessage.hasXys0 && (!self.hasXys0 || self.xys0 == otherMessage.xys0) && self.hasXyshsl == otherMessage.hasXyshsl && (!self.hasXyshsl || self.xyshsl == otherMessage.xyshsl) && self.hasCys13 == otherMessage.hasCys13 && (!self.hasCys13 || self.cys13 == otherMessage.cys13) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasXys0) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.xys0] hash]; } if (self.hasXyshsl) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.xyshsl] hash]; } if (self.hasCys13) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.cys13] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface bljjBuilder() @property (strong) bljj* resultBljj; @end @implementation bljjBuilder @synthesize resultBljj; - (instancetype) init { if ((self = [super init])) { self.resultBljj = [[bljj alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultBljj; } - (bljjBuilder*) clear { self.resultBljj = [[bljj alloc] init]; return self; } - (bljjBuilder*) clone { return [bljj builderWithPrototype:resultBljj]; } - (bljj*) defaultInstance { return [bljj defaultInstance]; } - (bljj*) build { [self checkInitialized]; return [self buildPartial]; } - (bljj*) buildPartial { bljj* returnMe = resultBljj; self.resultBljj = nil; return returnMe; } - (bljjBuilder*) mergeFrom:(bljj*) other { if (other == [bljj defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasXys0) { [self setXys0:other.xys0]; } if (other.hasXyshsl) { [self setXyshsl:other.xyshsl]; } if (other.hasCys13) { [self setCys13:other.cys13]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (bljjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (bljjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setXys0:[input readDouble]]; break; } case 25: { [self setXyshsl:[input readDouble]]; break; } case 33: { [self setCys13:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultBljj.hasTime; } - (UInt32) time { return resultBljj.time; } - (bljjBuilder*) setTime:(UInt32) value { resultBljj.hasTime = YES; resultBljj.time = value; return self; } - (bljjBuilder*) clearTime { resultBljj.hasTime = NO; resultBljj.time = 0; return self; } - (BOOL) hasXys0 { return resultBljj.hasXys0; } - (Float64) xys0 { return resultBljj.xys0; } - (bljjBuilder*) setXys0:(Float64) value { resultBljj.hasXys0 = YES; resultBljj.xys0 = value; return self; } - (bljjBuilder*) clearXys0 { resultBljj.hasXys0 = NO; resultBljj.xys0 = 0; return self; } - (BOOL) hasXyshsl { return resultBljj.hasXyshsl; } - (Float64) xyshsl { return resultBljj.xyshsl; } - (bljjBuilder*) setXyshsl:(Float64) value { resultBljj.hasXyshsl = YES; resultBljj.xyshsl = value; return self; } - (bljjBuilder*) clearXyshsl { resultBljj.hasXyshsl = NO; resultBljj.xyshsl = 0; return self; } - (BOOL) hasCys13 { return resultBljj.hasCys13; } - (Float64) cys13 { return resultBljj.cys13; } - (bljjBuilder*) setCys13:(Float64) value { resultBljj.hasCys13 = YES; resultBljj.cys13 = value; return self; } - (bljjBuilder*) clearCys13 { resultBljj.hasCys13 = NO; resultBljj.cys13 = 0; return self; } @end @interface bljj_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation bljj_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static bljj_array* defaultbljj_arrayInstance = nil; + (void) initialize { if (self == [bljj_array class]) { defaultbljj_arrayInstance = [[bljj_array alloc] init]; } } + (instancetype) defaultInstance { return defaultbljj_arrayInstance; } - (instancetype) defaultInstance { return defaultbljj_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (bljj*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(bljj *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(bljj *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(bljj *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (bljj_array*) parseFromData:(NSData*) data { return (bljj_array*)[[[bljj_array builder] mergeFromData:data] build]; } + (bljj_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (bljj_array*)[[[bljj_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (bljj_array*) parseFromInputStream:(NSInputStream*) input { return (bljj_array*)[[[bljj_array builder] mergeFromInputStream:input] build]; } + (bljj_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (bljj_array*)[[[bljj_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (bljj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (bljj_array*)[[[bljj_array builder] mergeFromCodedInputStream:input] build]; } + (bljj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (bljj_array*)[[[bljj_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (bljj_arrayBuilder*) builder { return [[bljj_arrayBuilder alloc] init]; } + (bljj_arrayBuilder*) builderWithPrototype:(bljj_array*) prototype { return [[bljj_array builder] mergeFrom:prototype]; } - (bljj_arrayBuilder*) builder { return [bljj_array builder]; } - (bljj_arrayBuilder*) toBuilder { return [bljj_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(bljj *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (bljj* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[bljj_array class]]) { return NO; } bljj_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(bljj *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface bljj_arrayBuilder() @property (strong) bljj_array* resultBljjArray; @end @implementation bljj_arrayBuilder @synthesize resultBljjArray; - (instancetype) init { if ((self = [super init])) { self.resultBljjArray = [[bljj_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultBljjArray; } - (bljj_arrayBuilder*) clear { self.resultBljjArray = [[bljj_array alloc] init]; return self; } - (bljj_arrayBuilder*) clone { return [bljj_array builderWithPrototype:resultBljjArray]; } - (bljj_array*) defaultInstance { return [bljj_array defaultInstance]; } - (bljj_array*) build { [self checkInitialized]; return [self buildPartial]; } - (bljj_array*) buildPartial { bljj_array* returnMe = resultBljjArray; self.resultBljjArray = nil; return returnMe; } - (bljj_arrayBuilder*) mergeFrom:(bljj_array*) other { if (other == [bljj_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultBljjArray.indexDataArray == nil) { resultBljjArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultBljjArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (bljj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (bljj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { bljjBuilder* subBuilder = [bljj builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultBljjArray.indexDataArray; } - (bljj*)indexDataAtIndex:(NSUInteger)index { return [resultBljjArray indexDataAtIndex:index]; } - (bljj_arrayBuilder *)addIndexData:(bljj*)value { if (resultBljjArray.indexDataArray == nil) { resultBljjArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultBljjArray.indexDataArray addObject:value]; return self; } - (bljj_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultBljjArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (bljj_arrayBuilder *)clearIndexData { resultBljjArray.indexDataArray = nil; return self; } @end @interface minute_tj_data () @property UInt32 time; @property Float64 tjValue; @end @implementation minute_tj_data - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasTjValue { return !!hasTjValue_; } - (void) setHasTjValue:(BOOL) _value_ { hasTjValue_ = !!_value_; } @synthesize tjValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.tjValue = 0; } return self; } static minute_tj_data* defaultminute_tj_dataInstance = nil; + (void) initialize { if (self == [minute_tj_data class]) { defaultminute_tj_dataInstance = [[minute_tj_data alloc] init]; } } + (instancetype) defaultInstance { return defaultminute_tj_dataInstance; } - (instancetype) defaultInstance { return defaultminute_tj_dataInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasTjValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasTjValue) { [output writeDouble:2 value:self.tjValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasTjValue) { size_ += computeDoubleSize(2, self.tjValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (minute_tj_data*) parseFromData:(NSData*) data { return (minute_tj_data*)[[[minute_tj_data builder] mergeFromData:data] build]; } + (minute_tj_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (minute_tj_data*)[[[minute_tj_data builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (minute_tj_data*) parseFromInputStream:(NSInputStream*) input { return (minute_tj_data*)[[[minute_tj_data builder] mergeFromInputStream:input] build]; } + (minute_tj_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (minute_tj_data*)[[[minute_tj_data builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (minute_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (minute_tj_data*)[[[minute_tj_data builder] mergeFromCodedInputStream:input] build]; } + (minute_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (minute_tj_data*)[[[minute_tj_data builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (minute_tj_dataBuilder*) builder { return [[minute_tj_dataBuilder alloc] init]; } + (minute_tj_dataBuilder*) builderWithPrototype:(minute_tj_data*) prototype { return [[minute_tj_data builder] mergeFrom:prototype]; } - (minute_tj_dataBuilder*) builder { return [minute_tj_data builder]; } - (minute_tj_dataBuilder*) toBuilder { return [minute_tj_data builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasTjValue) { [output appendFormat:@"%@%@: %@\n", indent, @"tjValue", [NSNumber numberWithDouble:self.tjValue]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasTjValue) { [dictionary setObject: [NSNumber numberWithDouble:self.tjValue] forKey: @"tjValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[minute_tj_data class]]) { return NO; } minute_tj_data *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasTjValue == otherMessage.hasTjValue && (!self.hasTjValue || self.tjValue == otherMessage.tjValue) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasTjValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.tjValue] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface minute_tj_dataBuilder() @property (strong) minute_tj_data* resultMinuteTjData; @end @implementation minute_tj_dataBuilder @synthesize resultMinuteTjData; - (instancetype) init { if ((self = [super init])) { self.resultMinuteTjData = [[minute_tj_data alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultMinuteTjData; } - (minute_tj_dataBuilder*) clear { self.resultMinuteTjData = [[minute_tj_data alloc] init]; return self; } - (minute_tj_dataBuilder*) clone { return [minute_tj_data builderWithPrototype:resultMinuteTjData]; } - (minute_tj_data*) defaultInstance { return [minute_tj_data defaultInstance]; } - (minute_tj_data*) build { [self checkInitialized]; return [self buildPartial]; } - (minute_tj_data*) buildPartial { minute_tj_data* returnMe = resultMinuteTjData; self.resultMinuteTjData = nil; return returnMe; } - (minute_tj_dataBuilder*) mergeFrom:(minute_tj_data*) other { if (other == [minute_tj_data defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasTjValue) { [self setTjValue:other.tjValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (minute_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (minute_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setTjValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultMinuteTjData.hasTime; } - (UInt32) time { return resultMinuteTjData.time; } - (minute_tj_dataBuilder*) setTime:(UInt32) value { resultMinuteTjData.hasTime = YES; resultMinuteTjData.time = value; return self; } - (minute_tj_dataBuilder*) clearTime { resultMinuteTjData.hasTime = NO; resultMinuteTjData.time = 0; return self; } - (BOOL) hasTjValue { return resultMinuteTjData.hasTjValue; } - (Float64) tjValue { return resultMinuteTjData.tjValue; } - (minute_tj_dataBuilder*) setTjValue:(Float64) value { resultMinuteTjData.hasTjValue = YES; resultMinuteTjData.tjValue = value; return self; } - (minute_tj_dataBuilder*) clearTjValue { resultMinuteTjData.hasTjValue = NO; resultMinuteTjData.tjValue = 0; return self; } @end @interface minute_tj_data_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation minute_tj_data_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static minute_tj_data_array* defaultminute_tj_data_arrayInstance = nil; + (void) initialize { if (self == [minute_tj_data_array class]) { defaultminute_tj_data_arrayInstance = [[minute_tj_data_array alloc] init]; } } + (instancetype) defaultInstance { return defaultminute_tj_data_arrayInstance; } - (instancetype) defaultInstance { return defaultminute_tj_data_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (minute_tj_data*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(minute_tj_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(minute_tj_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(minute_tj_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (minute_tj_data_array*) parseFromData:(NSData*) data { return (minute_tj_data_array*)[[[minute_tj_data_array builder] mergeFromData:data] build]; } + (minute_tj_data_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (minute_tj_data_array*)[[[minute_tj_data_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (minute_tj_data_array*) parseFromInputStream:(NSInputStream*) input { return (minute_tj_data_array*)[[[minute_tj_data_array builder] mergeFromInputStream:input] build]; } + (minute_tj_data_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (minute_tj_data_array*)[[[minute_tj_data_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (minute_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (minute_tj_data_array*)[[[minute_tj_data_array builder] mergeFromCodedInputStream:input] build]; } + (minute_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (minute_tj_data_array*)[[[minute_tj_data_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (minute_tj_data_arrayBuilder*) builder { return [[minute_tj_data_arrayBuilder alloc] init]; } + (minute_tj_data_arrayBuilder*) builderWithPrototype:(minute_tj_data_array*) prototype { return [[minute_tj_data_array builder] mergeFrom:prototype]; } - (minute_tj_data_arrayBuilder*) builder { return [minute_tj_data_array builder]; } - (minute_tj_data_arrayBuilder*) toBuilder { return [minute_tj_data_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(minute_tj_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (minute_tj_data* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[minute_tj_data_array class]]) { return NO; } minute_tj_data_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(minute_tj_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface minute_tj_data_arrayBuilder() @property (strong) minute_tj_data_array* resultMinuteTjDataArray; @end @implementation minute_tj_data_arrayBuilder @synthesize resultMinuteTjDataArray; - (instancetype) init { if ((self = [super init])) { self.resultMinuteTjDataArray = [[minute_tj_data_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultMinuteTjDataArray; } - (minute_tj_data_arrayBuilder*) clear { self.resultMinuteTjDataArray = [[minute_tj_data_array alloc] init]; return self; } - (minute_tj_data_arrayBuilder*) clone { return [minute_tj_data_array builderWithPrototype:resultMinuteTjDataArray]; } - (minute_tj_data_array*) defaultInstance { return [minute_tj_data_array defaultInstance]; } - (minute_tj_data_array*) build { [self checkInitialized]; return [self buildPartial]; } - (minute_tj_data_array*) buildPartial { minute_tj_data_array* returnMe = resultMinuteTjDataArray; self.resultMinuteTjDataArray = nil; return returnMe; } - (minute_tj_data_arrayBuilder*) mergeFrom:(minute_tj_data_array*) other { if (other == [minute_tj_data_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultMinuteTjDataArray.indexDataArray == nil) { resultMinuteTjDataArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultMinuteTjDataArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (minute_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (minute_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { minute_tj_dataBuilder* subBuilder = [minute_tj_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultMinuteTjDataArray.indexDataArray; } - (minute_tj_data*)indexDataAtIndex:(NSUInteger)index { return [resultMinuteTjDataArray indexDataAtIndex:index]; } - (minute_tj_data_arrayBuilder *)addIndexData:(minute_tj_data*)value { if (resultMinuteTjDataArray.indexDataArray == nil) { resultMinuteTjDataArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultMinuteTjDataArray.indexDataArray addObject:value]; return self; } - (minute_tj_data_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultMinuteTjDataArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (minute_tj_data_arrayBuilder *)clearIndexData { resultMinuteTjDataArray.indexDataArray = nil; return self; } @end @interface tj_draw_value () @property Float64 p1; @property Float64 p2; @property BOOL empty; @property UInt32 diff; @end @implementation tj_draw_value - (BOOL) hasP1 { return !!hasP1_; } - (void) setHasP1:(BOOL) _value_ { hasP1_ = !!_value_; } @synthesize p1; - (BOOL) hasP2 { return !!hasP2_; } - (void) setHasP2:(BOOL) _value_ { hasP2_ = !!_value_; } @synthesize p2; - (BOOL) hasEmpty { return !!hasEmpty_; } - (void) setHasEmpty:(BOOL) _value_ { hasEmpty_ = !!_value_; } - (BOOL) empty { return !!empty_; } - (void) setEmpty:(BOOL) _value_ { empty_ = !!_value_; } - (BOOL) hasDiff { return !!hasDiff_; } - (void) setHasDiff:(BOOL) _value_ { hasDiff_ = !!_value_; } @synthesize diff; - (instancetype) init { if ((self = [super init])) { self.p1 = 0; self.p2 = 0; self.empty = NO; self.diff = 0; } return self; } static tj_draw_value* defaulttj_draw_valueInstance = nil; + (void) initialize { if (self == [tj_draw_value class]) { defaulttj_draw_valueInstance = [[tj_draw_value alloc] init]; } } + (instancetype) defaultInstance { return defaulttj_draw_valueInstance; } - (instancetype) defaultInstance { return defaulttj_draw_valueInstance; } - (BOOL) isInitialized { if (!self.hasP1) { return NO; } if (!self.hasP2) { return NO; } if (!self.hasEmpty) { return NO; } if (!self.hasDiff) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasP1) { [output writeDouble:1 value:self.p1]; } if (self.hasP2) { [output writeDouble:2 value:self.p2]; } if (self.hasEmpty) { [output writeBool:3 value:self.empty]; } if (self.hasDiff) { [output writeUInt32:4 value:self.diff]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasP1) { size_ += computeDoubleSize(1, self.p1); } if (self.hasP2) { size_ += computeDoubleSize(2, self.p2); } if (self.hasEmpty) { size_ += computeBoolSize(3, self.empty); } if (self.hasDiff) { size_ += computeUInt32Size(4, self.diff); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tj_draw_value*) parseFromData:(NSData*) data { return (tj_draw_value*)[[[tj_draw_value builder] mergeFromData:data] build]; } + (tj_draw_value*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tj_draw_value*)[[[tj_draw_value builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tj_draw_value*) parseFromInputStream:(NSInputStream*) input { return (tj_draw_value*)[[[tj_draw_value builder] mergeFromInputStream:input] build]; } + (tj_draw_value*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tj_draw_value*)[[[tj_draw_value builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tj_draw_value*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tj_draw_value*)[[[tj_draw_value builder] mergeFromCodedInputStream:input] build]; } + (tj_draw_value*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tj_draw_value*)[[[tj_draw_value builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tj_draw_valueBuilder*) builder { return [[tj_draw_valueBuilder alloc] init]; } + (tj_draw_valueBuilder*) builderWithPrototype:(tj_draw_value*) prototype { return [[tj_draw_value builder] mergeFrom:prototype]; } - (tj_draw_valueBuilder*) builder { return [tj_draw_value builder]; } - (tj_draw_valueBuilder*) toBuilder { return [tj_draw_value builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasP1) { [output appendFormat:@"%@%@: %@\n", indent, @"p1", [NSNumber numberWithDouble:self.p1]]; } if (self.hasP2) { [output appendFormat:@"%@%@: %@\n", indent, @"p2", [NSNumber numberWithDouble:self.p2]]; } if (self.hasEmpty) { [output appendFormat:@"%@%@: %@\n", indent, @"empty", [NSNumber numberWithBool:self.empty]]; } if (self.hasDiff) { [output appendFormat:@"%@%@: %@\n", indent, @"diff", [NSNumber numberWithInteger:self.diff]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasP1) { [dictionary setObject: [NSNumber numberWithDouble:self.p1] forKey: @"p1"]; } if (self.hasP2) { [dictionary setObject: [NSNumber numberWithDouble:self.p2] forKey: @"p2"]; } if (self.hasEmpty) { [dictionary setObject: [NSNumber numberWithBool:self.empty] forKey: @"empty"]; } if (self.hasDiff) { [dictionary setObject: [NSNumber numberWithInteger:self.diff] forKey: @"diff"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tj_draw_value class]]) { return NO; } tj_draw_value *otherMessage = other; return self.hasP1 == otherMessage.hasP1 && (!self.hasP1 || self.p1 == otherMessage.p1) && self.hasP2 == otherMessage.hasP2 && (!self.hasP2 || self.p2 == otherMessage.p2) && self.hasEmpty == otherMessage.hasEmpty && (!self.hasEmpty || self.empty == otherMessage.empty) && self.hasDiff == otherMessage.hasDiff && (!self.hasDiff || self.diff == otherMessage.diff) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasP1) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.p1] hash]; } if (self.hasP2) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.p2] hash]; } if (self.hasEmpty) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.empty] hash]; } if (self.hasDiff) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.diff] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tj_draw_valueBuilder() @property (strong) tj_draw_value* resultTjDrawValue; @end @implementation tj_draw_valueBuilder @synthesize resultTjDrawValue; - (instancetype) init { if ((self = [super init])) { self.resultTjDrawValue = [[tj_draw_value alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTjDrawValue; } - (tj_draw_valueBuilder*) clear { self.resultTjDrawValue = [[tj_draw_value alloc] init]; return self; } - (tj_draw_valueBuilder*) clone { return [tj_draw_value builderWithPrototype:resultTjDrawValue]; } - (tj_draw_value*) defaultInstance { return [tj_draw_value defaultInstance]; } - (tj_draw_value*) build { [self checkInitialized]; return [self buildPartial]; } - (tj_draw_value*) buildPartial { tj_draw_value* returnMe = resultTjDrawValue; self.resultTjDrawValue = nil; return returnMe; } - (tj_draw_valueBuilder*) mergeFrom:(tj_draw_value*) other { if (other == [tj_draw_value defaultInstance]) { return self; } if (other.hasP1) { [self setP1:other.p1]; } if (other.hasP2) { [self setP2:other.p2]; } if (other.hasEmpty) { [self setEmpty:other.empty]; } if (other.hasDiff) { [self setDiff:other.diff]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tj_draw_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tj_draw_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 9: { [self setP1:[input readDouble]]; break; } case 17: { [self setP2:[input readDouble]]; break; } case 24: { [self setEmpty:[input readBool]]; break; } case 32: { [self setDiff:[input readUInt32]]; break; } } } } - (BOOL) hasP1 { return resultTjDrawValue.hasP1; } - (Float64) p1 { return resultTjDrawValue.p1; } - (tj_draw_valueBuilder*) setP1:(Float64) value { resultTjDrawValue.hasP1 = YES; resultTjDrawValue.p1 = value; return self; } - (tj_draw_valueBuilder*) clearP1 { resultTjDrawValue.hasP1 = NO; resultTjDrawValue.p1 = 0; return self; } - (BOOL) hasP2 { return resultTjDrawValue.hasP2; } - (Float64) p2 { return resultTjDrawValue.p2; } - (tj_draw_valueBuilder*) setP2:(Float64) value { resultTjDrawValue.hasP2 = YES; resultTjDrawValue.p2 = value; return self; } - (tj_draw_valueBuilder*) clearP2 { resultTjDrawValue.hasP2 = NO; resultTjDrawValue.p2 = 0; return self; } - (BOOL) hasEmpty { return resultTjDrawValue.hasEmpty; } - (BOOL) empty { return resultTjDrawValue.empty; } - (tj_draw_valueBuilder*) setEmpty:(BOOL) value { resultTjDrawValue.hasEmpty = YES; resultTjDrawValue.empty = value; return self; } - (tj_draw_valueBuilder*) clearEmpty { resultTjDrawValue.hasEmpty = NO; resultTjDrawValue.empty = NO; return self; } - (BOOL) hasDiff { return resultTjDrawValue.hasDiff; } - (UInt32) diff { return resultTjDrawValue.diff; } - (tj_draw_valueBuilder*) setDiff:(UInt32) value { resultTjDrawValue.hasDiff = YES; resultTjDrawValue.diff = value; return self; } - (tj_draw_valueBuilder*) clearDiff { resultTjDrawValue.hasDiff = NO; resultTjDrawValue.diff = 0; return self; } @end @interface kline_tj_data () @property UInt32 time; @property Float64 buy; @property Float64 sel; @property Float64 jme; @property Float64 jb; @property (strong) NSMutableArray * drawValueArray; @property Float64 tjValue; @end @implementation kline_tj_data - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasBuy { return !!hasBuy_; } - (void) setHasBuy:(BOOL) _value_ { hasBuy_ = !!_value_; } @synthesize buy; - (BOOL) hasSel { return !!hasSel_; } - (void) setHasSel:(BOOL) _value_ { hasSel_ = !!_value_; } @synthesize sel; - (BOOL) hasJme { return !!hasJme_; } - (void) setHasJme:(BOOL) _value_ { hasJme_ = !!_value_; } @synthesize jme; - (BOOL) hasJb { return !!hasJb_; } - (void) setHasJb:(BOOL) _value_ { hasJb_ = !!_value_; } @synthesize jb; @synthesize drawValueArray; @dynamic drawValue; - (BOOL) hasTjValue { return !!hasTjValue_; } - (void) setHasTjValue:(BOOL) _value_ { hasTjValue_ = !!_value_; } @synthesize tjValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.buy = 0; self.sel = 0; self.jme = 0; self.jb = 0; self.tjValue = 0; } return self; } static kline_tj_data* defaultkline_tj_dataInstance = nil; + (void) initialize { if (self == [kline_tj_data class]) { defaultkline_tj_dataInstance = [[kline_tj_data alloc] init]; } } + (instancetype) defaultInstance { return defaultkline_tj_dataInstance; } - (instancetype) defaultInstance { return defaultkline_tj_dataInstance; } - (NSArray *)drawValue { return drawValueArray; } - (tj_draw_value*)drawValueAtIndex:(NSUInteger)index { return [drawValueArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasBuy) { return NO; } if (!self.hasSel) { return NO; } if (!self.hasJme) { return NO; } if (!self.hasJb) { return NO; } if (!self.hasTjValue) { return NO; } __block BOOL isInitdrawValue = YES; [self.drawValue enumerateObjectsUsingBlock:^(tj_draw_value *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdrawValue = NO; *stop = YES; } }]; if (!isInitdrawValue) return isInitdrawValue; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasBuy) { [output writeDouble:2 value:self.buy]; } if (self.hasSel) { [output writeDouble:3 value:self.sel]; } if (self.hasJme) { [output writeDouble:4 value:self.jme]; } if (self.hasJb) { [output writeDouble:5 value:self.jb]; } [self.drawValueArray enumerateObjectsUsingBlock:^(tj_draw_value *element, NSUInteger idx, BOOL *stop) { [output writeMessage:6 value:element]; }]; if (self.hasTjValue) { [output writeDouble:7 value:self.tjValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasBuy) { size_ += computeDoubleSize(2, self.buy); } if (self.hasSel) { size_ += computeDoubleSize(3, self.sel); } if (self.hasJme) { size_ += computeDoubleSize(4, self.jme); } if (self.hasJb) { size_ += computeDoubleSize(5, self.jb); } [self.drawValueArray enumerateObjectsUsingBlock:^(tj_draw_value *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(6, element); }]; if (self.hasTjValue) { size_ += computeDoubleSize(7, self.tjValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (kline_tj_data*) parseFromData:(NSData*) data { return (kline_tj_data*)[[[kline_tj_data builder] mergeFromData:data] build]; } + (kline_tj_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (kline_tj_data*)[[[kline_tj_data builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (kline_tj_data*) parseFromInputStream:(NSInputStream*) input { return (kline_tj_data*)[[[kline_tj_data builder] mergeFromInputStream:input] build]; } + (kline_tj_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (kline_tj_data*)[[[kline_tj_data builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (kline_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (kline_tj_data*)[[[kline_tj_data builder] mergeFromCodedInputStream:input] build]; } + (kline_tj_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (kline_tj_data*)[[[kline_tj_data builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (kline_tj_dataBuilder*) builder { return [[kline_tj_dataBuilder alloc] init]; } + (kline_tj_dataBuilder*) builderWithPrototype:(kline_tj_data*) prototype { return [[kline_tj_data builder] mergeFrom:prototype]; } - (kline_tj_dataBuilder*) builder { return [kline_tj_data builder]; } - (kline_tj_dataBuilder*) toBuilder { return [kline_tj_data builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasBuy) { [output appendFormat:@"%@%@: %@\n", indent, @"buy", [NSNumber numberWithDouble:self.buy]]; } if (self.hasSel) { [output appendFormat:@"%@%@: %@\n", indent, @"sel", [NSNumber numberWithDouble:self.sel]]; } if (self.hasJme) { [output appendFormat:@"%@%@: %@\n", indent, @"jme", [NSNumber numberWithDouble:self.jme]]; } if (self.hasJb) { [output appendFormat:@"%@%@: %@\n", indent, @"jb", [NSNumber numberWithDouble:self.jb]]; } [self.drawValueArray enumerateObjectsUsingBlock:^(tj_draw_value *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"drawValue"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasTjValue) { [output appendFormat:@"%@%@: %@\n", indent, @"tjValue", [NSNumber numberWithDouble:self.tjValue]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasBuy) { [dictionary setObject: [NSNumber numberWithDouble:self.buy] forKey: @"buy"]; } if (self.hasSel) { [dictionary setObject: [NSNumber numberWithDouble:self.sel] forKey: @"sel"]; } if (self.hasJme) { [dictionary setObject: [NSNumber numberWithDouble:self.jme] forKey: @"jme"]; } if (self.hasJb) { [dictionary setObject: [NSNumber numberWithDouble:self.jb] forKey: @"jb"]; } for (tj_draw_value* element in self.drawValueArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"drawValue"]; } if (self.hasTjValue) { [dictionary setObject: [NSNumber numberWithDouble:self.tjValue] forKey: @"tjValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[kline_tj_data class]]) { return NO; } kline_tj_data *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasBuy == otherMessage.hasBuy && (!self.hasBuy || self.buy == otherMessage.buy) && self.hasSel == otherMessage.hasSel && (!self.hasSel || self.sel == otherMessage.sel) && self.hasJme == otherMessage.hasJme && (!self.hasJme || self.jme == otherMessage.jme) && self.hasJb == otherMessage.hasJb && (!self.hasJb || self.jb == otherMessage.jb) && [self.drawValueArray isEqualToArray:otherMessage.drawValueArray] && self.hasTjValue == otherMessage.hasTjValue && (!self.hasTjValue || self.tjValue == otherMessage.tjValue) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasBuy) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.buy] hash]; } if (self.hasSel) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.sel] hash]; } if (self.hasJme) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.jme] hash]; } if (self.hasJb) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.jb] hash]; } [self.drawValueArray enumerateObjectsUsingBlock:^(tj_draw_value *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasTjValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.tjValue] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface kline_tj_dataBuilder() @property (strong) kline_tj_data* resultKlineTjData; @end @implementation kline_tj_dataBuilder @synthesize resultKlineTjData; - (instancetype) init { if ((self = [super init])) { self.resultKlineTjData = [[kline_tj_data alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultKlineTjData; } - (kline_tj_dataBuilder*) clear { self.resultKlineTjData = [[kline_tj_data alloc] init]; return self; } - (kline_tj_dataBuilder*) clone { return [kline_tj_data builderWithPrototype:resultKlineTjData]; } - (kline_tj_data*) defaultInstance { return [kline_tj_data defaultInstance]; } - (kline_tj_data*) build { [self checkInitialized]; return [self buildPartial]; } - (kline_tj_data*) buildPartial { kline_tj_data* returnMe = resultKlineTjData; self.resultKlineTjData = nil; return returnMe; } - (kline_tj_dataBuilder*) mergeFrom:(kline_tj_data*) other { if (other == [kline_tj_data defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasBuy) { [self setBuy:other.buy]; } if (other.hasSel) { [self setSel:other.sel]; } if (other.hasJme) { [self setJme:other.jme]; } if (other.hasJb) { [self setJb:other.jb]; } if (other.drawValueArray.count > 0) { if (resultKlineTjData.drawValueArray == nil) { resultKlineTjData.drawValueArray = [[NSMutableArray alloc] initWithArray:other.drawValueArray]; } else { [resultKlineTjData.drawValueArray addObjectsFromArray:other.drawValueArray]; } } if (other.hasTjValue) { [self setTjValue:other.tjValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (kline_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (kline_tj_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setBuy:[input readDouble]]; break; } case 25: { [self setSel:[input readDouble]]; break; } case 33: { [self setJme:[input readDouble]]; break; } case 41: { [self setJb:[input readDouble]]; break; } case 50: { tj_draw_valueBuilder* subBuilder = [tj_draw_value builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDrawValue:[subBuilder buildPartial]]; break; } case 57: { [self setTjValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultKlineTjData.hasTime; } - (UInt32) time { return resultKlineTjData.time; } - (kline_tj_dataBuilder*) setTime:(UInt32) value { resultKlineTjData.hasTime = YES; resultKlineTjData.time = value; return self; } - (kline_tj_dataBuilder*) clearTime { resultKlineTjData.hasTime = NO; resultKlineTjData.time = 0; return self; } - (BOOL) hasBuy { return resultKlineTjData.hasBuy; } - (Float64) buy { return resultKlineTjData.buy; } - (kline_tj_dataBuilder*) setBuy:(Float64) value { resultKlineTjData.hasBuy = YES; resultKlineTjData.buy = value; return self; } - (kline_tj_dataBuilder*) clearBuy { resultKlineTjData.hasBuy = NO; resultKlineTjData.buy = 0; return self; } - (BOOL) hasSel { return resultKlineTjData.hasSel; } - (Float64) sel { return resultKlineTjData.sel; } - (kline_tj_dataBuilder*) setSel:(Float64) value { resultKlineTjData.hasSel = YES; resultKlineTjData.sel = value; return self; } - (kline_tj_dataBuilder*) clearSel { resultKlineTjData.hasSel = NO; resultKlineTjData.sel = 0; return self; } - (BOOL) hasJme { return resultKlineTjData.hasJme; } - (Float64) jme { return resultKlineTjData.jme; } - (kline_tj_dataBuilder*) setJme:(Float64) value { resultKlineTjData.hasJme = YES; resultKlineTjData.jme = value; return self; } - (kline_tj_dataBuilder*) clearJme { resultKlineTjData.hasJme = NO; resultKlineTjData.jme = 0; return self; } - (BOOL) hasJb { return resultKlineTjData.hasJb; } - (Float64) jb { return resultKlineTjData.jb; } - (kline_tj_dataBuilder*) setJb:(Float64) value { resultKlineTjData.hasJb = YES; resultKlineTjData.jb = value; return self; } - (kline_tj_dataBuilder*) clearJb { resultKlineTjData.hasJb = NO; resultKlineTjData.jb = 0; return self; } - (NSMutableArray *)drawValue { return resultKlineTjData.drawValueArray; } - (tj_draw_value*)drawValueAtIndex:(NSUInteger)index { return [resultKlineTjData drawValueAtIndex:index]; } - (kline_tj_dataBuilder *)addDrawValue:(tj_draw_value*)value { if (resultKlineTjData.drawValueArray == nil) { resultKlineTjData.drawValueArray = [[NSMutableArray alloc]init]; } [resultKlineTjData.drawValueArray addObject:value]; return self; } - (kline_tj_dataBuilder *)setDrawValueArray:(NSArray *)array { resultKlineTjData.drawValueArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (kline_tj_dataBuilder *)clearDrawValue { resultKlineTjData.drawValueArray = nil; return self; } - (BOOL) hasTjValue { return resultKlineTjData.hasTjValue; } - (Float64) tjValue { return resultKlineTjData.tjValue; } - (kline_tj_dataBuilder*) setTjValue:(Float64) value { resultKlineTjData.hasTjValue = YES; resultKlineTjData.tjValue = value; return self; } - (kline_tj_dataBuilder*) clearTjValue { resultKlineTjData.hasTjValue = NO; resultKlineTjData.tjValue = 0; return self; } @end @interface kline_tj_data_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation kline_tj_data_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static kline_tj_data_array* defaultkline_tj_data_arrayInstance = nil; + (void) initialize { if (self == [kline_tj_data_array class]) { defaultkline_tj_data_arrayInstance = [[kline_tj_data_array alloc] init]; } } + (instancetype) defaultInstance { return defaultkline_tj_data_arrayInstance; } - (instancetype) defaultInstance { return defaultkline_tj_data_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (kline_tj_data*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(kline_tj_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(kline_tj_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(kline_tj_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (kline_tj_data_array*) parseFromData:(NSData*) data { return (kline_tj_data_array*)[[[kline_tj_data_array builder] mergeFromData:data] build]; } + (kline_tj_data_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (kline_tj_data_array*)[[[kline_tj_data_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (kline_tj_data_array*) parseFromInputStream:(NSInputStream*) input { return (kline_tj_data_array*)[[[kline_tj_data_array builder] mergeFromInputStream:input] build]; } + (kline_tj_data_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (kline_tj_data_array*)[[[kline_tj_data_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (kline_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (kline_tj_data_array*)[[[kline_tj_data_array builder] mergeFromCodedInputStream:input] build]; } + (kline_tj_data_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (kline_tj_data_array*)[[[kline_tj_data_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (kline_tj_data_arrayBuilder*) builder { return [[kline_tj_data_arrayBuilder alloc] init]; } + (kline_tj_data_arrayBuilder*) builderWithPrototype:(kline_tj_data_array*) prototype { return [[kline_tj_data_array builder] mergeFrom:prototype]; } - (kline_tj_data_arrayBuilder*) builder { return [kline_tj_data_array builder]; } - (kline_tj_data_arrayBuilder*) toBuilder { return [kline_tj_data_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(kline_tj_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (kline_tj_data* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[kline_tj_data_array class]]) { return NO; } kline_tj_data_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(kline_tj_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface kline_tj_data_arrayBuilder() @property (strong) kline_tj_data_array* resultKlineTjDataArray; @end @implementation kline_tj_data_arrayBuilder @synthesize resultKlineTjDataArray; - (instancetype) init { if ((self = [super init])) { self.resultKlineTjDataArray = [[kline_tj_data_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultKlineTjDataArray; } - (kline_tj_data_arrayBuilder*) clear { self.resultKlineTjDataArray = [[kline_tj_data_array alloc] init]; return self; } - (kline_tj_data_arrayBuilder*) clone { return [kline_tj_data_array builderWithPrototype:resultKlineTjDataArray]; } - (kline_tj_data_array*) defaultInstance { return [kline_tj_data_array defaultInstance]; } - (kline_tj_data_array*) build { [self checkInitialized]; return [self buildPartial]; } - (kline_tj_data_array*) buildPartial { kline_tj_data_array* returnMe = resultKlineTjDataArray; self.resultKlineTjDataArray = nil; return returnMe; } - (kline_tj_data_arrayBuilder*) mergeFrom:(kline_tj_data_array*) other { if (other == [kline_tj_data_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultKlineTjDataArray.indexDataArray == nil) { resultKlineTjDataArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultKlineTjDataArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (kline_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (kline_tj_data_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { kline_tj_dataBuilder* subBuilder = [kline_tj_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultKlineTjDataArray.indexDataArray; } - (kline_tj_data*)indexDataAtIndex:(NSUInteger)index { return [resultKlineTjDataArray indexDataAtIndex:index]; } - (kline_tj_data_arrayBuilder *)addIndexData:(kline_tj_data*)value { if (resultKlineTjDataArray.indexDataArray == nil) { resultKlineTjDataArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultKlineTjDataArray.indexDataArray addObject:value]; return self; } - (kline_tj_data_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultKlineTjDataArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (kline_tj_data_arrayBuilder *)clearIndexData { resultKlineTjDataArray.indexDataArray = nil; return self; } @end @interface sstp () @property UInt32 time; @property Float64 shang; @property Float64 ciShang; @property Float64 ciXia; @property Float64 xia; @end @implementation sstp - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasShang { return !!hasShang_; } - (void) setHasShang:(BOOL) _value_ { hasShang_ = !!_value_; } @synthesize shang; - (BOOL) hasCiShang { return !!hasCiShang_; } - (void) setHasCiShang:(BOOL) _value_ { hasCiShang_ = !!_value_; } @synthesize ciShang; - (BOOL) hasCiXia { return !!hasCiXia_; } - (void) setHasCiXia:(BOOL) _value_ { hasCiXia_ = !!_value_; } @synthesize ciXia; - (BOOL) hasXia { return !!hasXia_; } - (void) setHasXia:(BOOL) _value_ { hasXia_ = !!_value_; } @synthesize xia; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.shang = 0; self.ciShang = 0; self.ciXia = 0; self.xia = 0; } return self; } static sstp* defaultsstpInstance = nil; + (void) initialize { if (self == [sstp class]) { defaultsstpInstance = [[sstp alloc] init]; } } + (instancetype) defaultInstance { return defaultsstpInstance; } - (instancetype) defaultInstance { return defaultsstpInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasShang) { return NO; } if (!self.hasCiShang) { return NO; } if (!self.hasCiXia) { return NO; } if (!self.hasXia) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasShang) { [output writeDouble:2 value:self.shang]; } if (self.hasCiShang) { [output writeDouble:3 value:self.ciShang]; } if (self.hasCiXia) { [output writeDouble:4 value:self.ciXia]; } if (self.hasXia) { [output writeDouble:5 value:self.xia]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasShang) { size_ += computeDoubleSize(2, self.shang); } if (self.hasCiShang) { size_ += computeDoubleSize(3, self.ciShang); } if (self.hasCiXia) { size_ += computeDoubleSize(4, self.ciXia); } if (self.hasXia) { size_ += computeDoubleSize(5, self.xia); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (sstp*) parseFromData:(NSData*) data { return (sstp*)[[[sstp builder] mergeFromData:data] build]; } + (sstp*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sstp*)[[[sstp builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (sstp*) parseFromInputStream:(NSInputStream*) input { return (sstp*)[[[sstp builder] mergeFromInputStream:input] build]; } + (sstp*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sstp*)[[[sstp builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (sstp*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (sstp*)[[[sstp builder] mergeFromCodedInputStream:input] build]; } + (sstp*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sstp*)[[[sstp builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (sstpBuilder*) builder { return [[sstpBuilder alloc] init]; } + (sstpBuilder*) builderWithPrototype:(sstp*) prototype { return [[sstp builder] mergeFrom:prototype]; } - (sstpBuilder*) builder { return [sstp builder]; } - (sstpBuilder*) toBuilder { return [sstp builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasShang) { [output appendFormat:@"%@%@: %@\n", indent, @"shang", [NSNumber numberWithDouble:self.shang]]; } if (self.hasCiShang) { [output appendFormat:@"%@%@: %@\n", indent, @"ciShang", [NSNumber numberWithDouble:self.ciShang]]; } if (self.hasCiXia) { [output appendFormat:@"%@%@: %@\n", indent, @"ciXia", [NSNumber numberWithDouble:self.ciXia]]; } if (self.hasXia) { [output appendFormat:@"%@%@: %@\n", indent, @"xia", [NSNumber numberWithDouble:self.xia]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasShang) { [dictionary setObject: [NSNumber numberWithDouble:self.shang] forKey: @"shang"]; } if (self.hasCiShang) { [dictionary setObject: [NSNumber numberWithDouble:self.ciShang] forKey: @"ciShang"]; } if (self.hasCiXia) { [dictionary setObject: [NSNumber numberWithDouble:self.ciXia] forKey: @"ciXia"]; } if (self.hasXia) { [dictionary setObject: [NSNumber numberWithDouble:self.xia] forKey: @"xia"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[sstp class]]) { return NO; } sstp *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasShang == otherMessage.hasShang && (!self.hasShang || self.shang == otherMessage.shang) && self.hasCiShang == otherMessage.hasCiShang && (!self.hasCiShang || self.ciShang == otherMessage.ciShang) && self.hasCiXia == otherMessage.hasCiXia && (!self.hasCiXia || self.ciXia == otherMessage.ciXia) && self.hasXia == otherMessage.hasXia && (!self.hasXia || self.xia == otherMessage.xia) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasShang) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.shang] hash]; } if (self.hasCiShang) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.ciShang] hash]; } if (self.hasCiXia) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.ciXia] hash]; } if (self.hasXia) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.xia] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface sstpBuilder() @property (strong) sstp* resultSstp; @end @implementation sstpBuilder @synthesize resultSstp; - (instancetype) init { if ((self = [super init])) { self.resultSstp = [[sstp alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSstp; } - (sstpBuilder*) clear { self.resultSstp = [[sstp alloc] init]; return self; } - (sstpBuilder*) clone { return [sstp builderWithPrototype:resultSstp]; } - (sstp*) defaultInstance { return [sstp defaultInstance]; } - (sstp*) build { [self checkInitialized]; return [self buildPartial]; } - (sstp*) buildPartial { sstp* returnMe = resultSstp; self.resultSstp = nil; return returnMe; } - (sstpBuilder*) mergeFrom:(sstp*) other { if (other == [sstp defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasShang) { [self setShang:other.shang]; } if (other.hasCiShang) { [self setCiShang:other.ciShang]; } if (other.hasCiXia) { [self setCiXia:other.ciXia]; } if (other.hasXia) { [self setXia:other.xia]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (sstpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (sstpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setShang:[input readDouble]]; break; } case 25: { [self setCiShang:[input readDouble]]; break; } case 33: { [self setCiXia:[input readDouble]]; break; } case 41: { [self setXia:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultSstp.hasTime; } - (UInt32) time { return resultSstp.time; } - (sstpBuilder*) setTime:(UInt32) value { resultSstp.hasTime = YES; resultSstp.time = value; return self; } - (sstpBuilder*) clearTime { resultSstp.hasTime = NO; resultSstp.time = 0; return self; } - (BOOL) hasShang { return resultSstp.hasShang; } - (Float64) shang { return resultSstp.shang; } - (sstpBuilder*) setShang:(Float64) value { resultSstp.hasShang = YES; resultSstp.shang = value; return self; } - (sstpBuilder*) clearShang { resultSstp.hasShang = NO; resultSstp.shang = 0; return self; } - (BOOL) hasCiShang { return resultSstp.hasCiShang; } - (Float64) ciShang { return resultSstp.ciShang; } - (sstpBuilder*) setCiShang:(Float64) value { resultSstp.hasCiShang = YES; resultSstp.ciShang = value; return self; } - (sstpBuilder*) clearCiShang { resultSstp.hasCiShang = NO; resultSstp.ciShang = 0; return self; } - (BOOL) hasCiXia { return resultSstp.hasCiXia; } - (Float64) ciXia { return resultSstp.ciXia; } - (sstpBuilder*) setCiXia:(Float64) value { resultSstp.hasCiXia = YES; resultSstp.ciXia = value; return self; } - (sstpBuilder*) clearCiXia { resultSstp.hasCiXia = NO; resultSstp.ciXia = 0; return self; } - (BOOL) hasXia { return resultSstp.hasXia; } - (Float64) xia { return resultSstp.xia; } - (sstpBuilder*) setXia:(Float64) value { resultSstp.hasXia = YES; resultSstp.xia = value; return self; } - (sstpBuilder*) clearXia { resultSstp.hasXia = NO; resultSstp.xia = 0; return self; } @end @interface sstp_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation sstp_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static sstp_array* defaultsstp_arrayInstance = nil; + (void) initialize { if (self == [sstp_array class]) { defaultsstp_arrayInstance = [[sstp_array alloc] init]; } } + (instancetype) defaultInstance { return defaultsstp_arrayInstance; } - (instancetype) defaultInstance { return defaultsstp_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (sstp*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(sstp *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(sstp *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(sstp *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (sstp_array*) parseFromData:(NSData*) data { return (sstp_array*)[[[sstp_array builder] mergeFromData:data] build]; } + (sstp_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sstp_array*)[[[sstp_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (sstp_array*) parseFromInputStream:(NSInputStream*) input { return (sstp_array*)[[[sstp_array builder] mergeFromInputStream:input] build]; } + (sstp_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sstp_array*)[[[sstp_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (sstp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (sstp_array*)[[[sstp_array builder] mergeFromCodedInputStream:input] build]; } + (sstp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (sstp_array*)[[[sstp_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (sstp_arrayBuilder*) builder { return [[sstp_arrayBuilder alloc] init]; } + (sstp_arrayBuilder*) builderWithPrototype:(sstp_array*) prototype { return [[sstp_array builder] mergeFrom:prototype]; } - (sstp_arrayBuilder*) builder { return [sstp_array builder]; } - (sstp_arrayBuilder*) toBuilder { return [sstp_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(sstp *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (sstp* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[sstp_array class]]) { return NO; } sstp_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(sstp *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface sstp_arrayBuilder() @property (strong) sstp_array* resultSstpArray; @end @implementation sstp_arrayBuilder @synthesize resultSstpArray; - (instancetype) init { if ((self = [super init])) { self.resultSstpArray = [[sstp_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSstpArray; } - (sstp_arrayBuilder*) clear { self.resultSstpArray = [[sstp_array alloc] init]; return self; } - (sstp_arrayBuilder*) clone { return [sstp_array builderWithPrototype:resultSstpArray]; } - (sstp_array*) defaultInstance { return [sstp_array defaultInstance]; } - (sstp_array*) build { [self checkInitialized]; return [self buildPartial]; } - (sstp_array*) buildPartial { sstp_array* returnMe = resultSstpArray; self.resultSstpArray = nil; return returnMe; } - (sstp_arrayBuilder*) mergeFrom:(sstp_array*) other { if (other == [sstp_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultSstpArray.indexDataArray == nil) { resultSstpArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultSstpArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (sstp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (sstp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { sstpBuilder* subBuilder = [sstp builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultSstpArray.indexDataArray; } - (sstp*)indexDataAtIndex:(NSUInteger)index { return [resultSstpArray indexDataAtIndex:index]; } - (sstp_arrayBuilder *)addIndexData:(sstp*)value { if (resultSstpArray.indexDataArray == nil) { resultSstpArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultSstpArray.indexDataArray addObject:value]; return self; } - (sstp_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultSstpArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (sstp_arrayBuilder *)clearIndexData { resultSstpArray.indexDataArray = nil; return self; } @end @interface qlft () @property UInt32 time; @property Float64 zhongXianQiangRuo; @property Float64 me; @end @implementation qlft - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasZhongXianQiangRuo { return !!hasZhongXianQiangRuo_; } - (void) setHasZhongXianQiangRuo:(BOOL) _value_ { hasZhongXianQiangRuo_ = !!_value_; } @synthesize zhongXianQiangRuo; - (BOOL) hasMe { return !!hasMe_; } - (void) setHasMe:(BOOL) _value_ { hasMe_ = !!_value_; } @synthesize me; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.zhongXianQiangRuo = 0; self.me = 0; } return self; } static qlft* defaultqlftInstance = nil; + (void) initialize { if (self == [qlft class]) { defaultqlftInstance = [[qlft alloc] init]; } } + (instancetype) defaultInstance { return defaultqlftInstance; } - (instancetype) defaultInstance { return defaultqlftInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasZhongXianQiangRuo) { return NO; } if (!self.hasMe) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasZhongXianQiangRuo) { [output writeDouble:2 value:self.zhongXianQiangRuo]; } if (self.hasMe) { [output writeDouble:3 value:self.me]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasZhongXianQiangRuo) { size_ += computeDoubleSize(2, self.zhongXianQiangRuo); } if (self.hasMe) { size_ += computeDoubleSize(3, self.me); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (qlft*) parseFromData:(NSData*) data { return (qlft*)[[[qlft builder] mergeFromData:data] build]; } + (qlft*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (qlft*)[[[qlft builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (qlft*) parseFromInputStream:(NSInputStream*) input { return (qlft*)[[[qlft builder] mergeFromInputStream:input] build]; } + (qlft*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (qlft*)[[[qlft builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (qlft*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (qlft*)[[[qlft builder] mergeFromCodedInputStream:input] build]; } + (qlft*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (qlft*)[[[qlft builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (qlftBuilder*) builder { return [[qlftBuilder alloc] init]; } + (qlftBuilder*) builderWithPrototype:(qlft*) prototype { return [[qlft builder] mergeFrom:prototype]; } - (qlftBuilder*) builder { return [qlft builder]; } - (qlftBuilder*) toBuilder { return [qlft builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasZhongXianQiangRuo) { [output appendFormat:@"%@%@: %@\n", indent, @"zhongXianQiangRuo", [NSNumber numberWithDouble:self.zhongXianQiangRuo]]; } if (self.hasMe) { [output appendFormat:@"%@%@: %@\n", indent, @"me", [NSNumber numberWithDouble:self.me]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasZhongXianQiangRuo) { [dictionary setObject: [NSNumber numberWithDouble:self.zhongXianQiangRuo] forKey: @"zhongXianQiangRuo"]; } if (self.hasMe) { [dictionary setObject: [NSNumber numberWithDouble:self.me] forKey: @"me"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[qlft class]]) { return NO; } qlft *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasZhongXianQiangRuo == otherMessage.hasZhongXianQiangRuo && (!self.hasZhongXianQiangRuo || self.zhongXianQiangRuo == otherMessage.zhongXianQiangRuo) && self.hasMe == otherMessage.hasMe && (!self.hasMe || self.me == otherMessage.me) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasZhongXianQiangRuo) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zhongXianQiangRuo] hash]; } if (self.hasMe) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.me] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface qlftBuilder() @property (strong) qlft* resultQlft; @end @implementation qlftBuilder @synthesize resultQlft; - (instancetype) init { if ((self = [super init])) { self.resultQlft = [[qlft alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultQlft; } - (qlftBuilder*) clear { self.resultQlft = [[qlft alloc] init]; return self; } - (qlftBuilder*) clone { return [qlft builderWithPrototype:resultQlft]; } - (qlft*) defaultInstance { return [qlft defaultInstance]; } - (qlft*) build { [self checkInitialized]; return [self buildPartial]; } - (qlft*) buildPartial { qlft* returnMe = resultQlft; self.resultQlft = nil; return returnMe; } - (qlftBuilder*) mergeFrom:(qlft*) other { if (other == [qlft defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasZhongXianQiangRuo) { [self setZhongXianQiangRuo:other.zhongXianQiangRuo]; } if (other.hasMe) { [self setMe:other.me]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (qlftBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (qlftBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setZhongXianQiangRuo:[input readDouble]]; break; } case 25: { [self setMe:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultQlft.hasTime; } - (UInt32) time { return resultQlft.time; } - (qlftBuilder*) setTime:(UInt32) value { resultQlft.hasTime = YES; resultQlft.time = value; return self; } - (qlftBuilder*) clearTime { resultQlft.hasTime = NO; resultQlft.time = 0; return self; } - (BOOL) hasZhongXianQiangRuo { return resultQlft.hasZhongXianQiangRuo; } - (Float64) zhongXianQiangRuo { return resultQlft.zhongXianQiangRuo; } - (qlftBuilder*) setZhongXianQiangRuo:(Float64) value { resultQlft.hasZhongXianQiangRuo = YES; resultQlft.zhongXianQiangRuo = value; return self; } - (qlftBuilder*) clearZhongXianQiangRuo { resultQlft.hasZhongXianQiangRuo = NO; resultQlft.zhongXianQiangRuo = 0; return self; } - (BOOL) hasMe { return resultQlft.hasMe; } - (Float64) me { return resultQlft.me; } - (qlftBuilder*) setMe:(Float64) value { resultQlft.hasMe = YES; resultQlft.me = value; return self; } - (qlftBuilder*) clearMe { resultQlft.hasMe = NO; resultQlft.me = 0; return self; } @end @interface qlft_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation qlft_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static qlft_array* defaultqlft_arrayInstance = nil; + (void) initialize { if (self == [qlft_array class]) { defaultqlft_arrayInstance = [[qlft_array alloc] init]; } } + (instancetype) defaultInstance { return defaultqlft_arrayInstance; } - (instancetype) defaultInstance { return defaultqlft_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (qlft*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(qlft *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(qlft *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(qlft *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (qlft_array*) parseFromData:(NSData*) data { return (qlft_array*)[[[qlft_array builder] mergeFromData:data] build]; } + (qlft_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (qlft_array*)[[[qlft_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (qlft_array*) parseFromInputStream:(NSInputStream*) input { return (qlft_array*)[[[qlft_array builder] mergeFromInputStream:input] build]; } + (qlft_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (qlft_array*)[[[qlft_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (qlft_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (qlft_array*)[[[qlft_array builder] mergeFromCodedInputStream:input] build]; } + (qlft_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (qlft_array*)[[[qlft_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (qlft_arrayBuilder*) builder { return [[qlft_arrayBuilder alloc] init]; } + (qlft_arrayBuilder*) builderWithPrototype:(qlft_array*) prototype { return [[qlft_array builder] mergeFrom:prototype]; } - (qlft_arrayBuilder*) builder { return [qlft_array builder]; } - (qlft_arrayBuilder*) toBuilder { return [qlft_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(qlft *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (qlft* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[qlft_array class]]) { return NO; } qlft_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(qlft *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface qlft_arrayBuilder() @property (strong) qlft_array* resultQlftArray; @end @implementation qlft_arrayBuilder @synthesize resultQlftArray; - (instancetype) init { if ((self = [super init])) { self.resultQlftArray = [[qlft_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultQlftArray; } - (qlft_arrayBuilder*) clear { self.resultQlftArray = [[qlft_array alloc] init]; return self; } - (qlft_arrayBuilder*) clone { return [qlft_array builderWithPrototype:resultQlftArray]; } - (qlft_array*) defaultInstance { return [qlft_array defaultInstance]; } - (qlft_array*) build { [self checkInitialized]; return [self buildPartial]; } - (qlft_array*) buildPartial { qlft_array* returnMe = resultQlftArray; self.resultQlftArray = nil; return returnMe; } - (qlft_arrayBuilder*) mergeFrom:(qlft_array*) other { if (other == [qlft_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultQlftArray.indexDataArray == nil) { resultQlftArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultQlftArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (qlft_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (qlft_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { qlftBuilder* subBuilder = [qlft builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultQlftArray.indexDataArray; } - (qlft*)indexDataAtIndex:(NSUInteger)index { return [resultQlftArray indexDataAtIndex:index]; } - (qlft_arrayBuilder *)addIndexData:(qlft*)value { if (resultQlftArray.indexDataArray == nil) { resultQlftArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultQlftArray.indexDataArray addObject:value]; return self; } - (qlft_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultQlftArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (qlft_arrayBuilder *)clearIndexData { resultQlftArray.indexDataArray = nil; return self; } @end @interface ldzj () @property UInt32 time; @property Float64 ldzjValue; @end @implementation ldzj - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasLdzjValue { return !!hasLdzjValue_; } - (void) setHasLdzjValue:(BOOL) _value_ { hasLdzjValue_ = !!_value_; } @synthesize ldzjValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.ldzjValue = 0; } return self; } static ldzj* defaultldzjInstance = nil; + (void) initialize { if (self == [ldzj class]) { defaultldzjInstance = [[ldzj alloc] init]; } } + (instancetype) defaultInstance { return defaultldzjInstance; } - (instancetype) defaultInstance { return defaultldzjInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasLdzjValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasLdzjValue) { [output writeDouble:2 value:self.ldzjValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasLdzjValue) { size_ += computeDoubleSize(2, self.ldzjValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ldzj*) parseFromData:(NSData*) data { return (ldzj*)[[[ldzj builder] mergeFromData:data] build]; } + (ldzj*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ldzj*)[[[ldzj builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ldzj*) parseFromInputStream:(NSInputStream*) input { return (ldzj*)[[[ldzj builder] mergeFromInputStream:input] build]; } + (ldzj*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ldzj*)[[[ldzj builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ldzj*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ldzj*)[[[ldzj builder] mergeFromCodedInputStream:input] build]; } + (ldzj*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ldzj*)[[[ldzj builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (ldzjBuilder*) builder { return [[ldzjBuilder alloc] init]; } + (ldzjBuilder*) builderWithPrototype:(ldzj*) prototype { return [[ldzj builder] mergeFrom:prototype]; } - (ldzjBuilder*) builder { return [ldzj builder]; } - (ldzjBuilder*) toBuilder { return [ldzj builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasLdzjValue) { [output appendFormat:@"%@%@: %@\n", indent, @"ldzjValue", [NSNumber numberWithDouble:self.ldzjValue]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasLdzjValue) { [dictionary setObject: [NSNumber numberWithDouble:self.ldzjValue] forKey: @"ldzjValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[ldzj class]]) { return NO; } ldzj *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasLdzjValue == otherMessage.hasLdzjValue && (!self.hasLdzjValue || self.ldzjValue == otherMessage.ldzjValue) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasLdzjValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.ldzjValue] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface ldzjBuilder() @property (strong) ldzj* resultLdzj; @end @implementation ldzjBuilder @synthesize resultLdzj; - (instancetype) init { if ((self = [super init])) { self.resultLdzj = [[ldzj alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultLdzj; } - (ldzjBuilder*) clear { self.resultLdzj = [[ldzj alloc] init]; return self; } - (ldzjBuilder*) clone { return [ldzj builderWithPrototype:resultLdzj]; } - (ldzj*) defaultInstance { return [ldzj defaultInstance]; } - (ldzj*) build { [self checkInitialized]; return [self buildPartial]; } - (ldzj*) buildPartial { ldzj* returnMe = resultLdzj; self.resultLdzj = nil; return returnMe; } - (ldzjBuilder*) mergeFrom:(ldzj*) other { if (other == [ldzj defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasLdzjValue) { [self setLdzjValue:other.ldzjValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (ldzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (ldzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setLdzjValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultLdzj.hasTime; } - (UInt32) time { return resultLdzj.time; } - (ldzjBuilder*) setTime:(UInt32) value { resultLdzj.hasTime = YES; resultLdzj.time = value; return self; } - (ldzjBuilder*) clearTime { resultLdzj.hasTime = NO; resultLdzj.time = 0; return self; } - (BOOL) hasLdzjValue { return resultLdzj.hasLdzjValue; } - (Float64) ldzjValue { return resultLdzj.ldzjValue; } - (ldzjBuilder*) setLdzjValue:(Float64) value { resultLdzj.hasLdzjValue = YES; resultLdzj.ldzjValue = value; return self; } - (ldzjBuilder*) clearLdzjValue { resultLdzj.hasLdzjValue = NO; resultLdzj.ldzjValue = 0; return self; } @end @interface ldzj_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation ldzj_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static ldzj_array* defaultldzj_arrayInstance = nil; + (void) initialize { if (self == [ldzj_array class]) { defaultldzj_arrayInstance = [[ldzj_array alloc] init]; } } + (instancetype) defaultInstance { return defaultldzj_arrayInstance; } - (instancetype) defaultInstance { return defaultldzj_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (ldzj*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(ldzj *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(ldzj *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(ldzj *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ldzj_array*) parseFromData:(NSData*) data { return (ldzj_array*)[[[ldzj_array builder] mergeFromData:data] build]; } + (ldzj_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ldzj_array*)[[[ldzj_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ldzj_array*) parseFromInputStream:(NSInputStream*) input { return (ldzj_array*)[[[ldzj_array builder] mergeFromInputStream:input] build]; } + (ldzj_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ldzj_array*)[[[ldzj_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ldzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ldzj_array*)[[[ldzj_array builder] mergeFromCodedInputStream:input] build]; } + (ldzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ldzj_array*)[[[ldzj_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (ldzj_arrayBuilder*) builder { return [[ldzj_arrayBuilder alloc] init]; } + (ldzj_arrayBuilder*) builderWithPrototype:(ldzj_array*) prototype { return [[ldzj_array builder] mergeFrom:prototype]; } - (ldzj_arrayBuilder*) builder { return [ldzj_array builder]; } - (ldzj_arrayBuilder*) toBuilder { return [ldzj_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(ldzj *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (ldzj* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[ldzj_array class]]) { return NO; } ldzj_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(ldzj *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface ldzj_arrayBuilder() @property (strong) ldzj_array* resultLdzjArray; @end @implementation ldzj_arrayBuilder @synthesize resultLdzjArray; - (instancetype) init { if ((self = [super init])) { self.resultLdzjArray = [[ldzj_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultLdzjArray; } - (ldzj_arrayBuilder*) clear { self.resultLdzjArray = [[ldzj_array alloc] init]; return self; } - (ldzj_arrayBuilder*) clone { return [ldzj_array builderWithPrototype:resultLdzjArray]; } - (ldzj_array*) defaultInstance { return [ldzj_array defaultInstance]; } - (ldzj_array*) build { [self checkInitialized]; return [self buildPartial]; } - (ldzj_array*) buildPartial { ldzj_array* returnMe = resultLdzjArray; self.resultLdzjArray = nil; return returnMe; } - (ldzj_arrayBuilder*) mergeFrom:(ldzj_array*) other { if (other == [ldzj_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultLdzjArray.indexDataArray == nil) { resultLdzjArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultLdzjArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (ldzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (ldzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { ldzjBuilder* subBuilder = [ldzj builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultLdzjArray.indexDataArray; } - (ldzj*)indexDataAtIndex:(NSUInteger)index { return [resultLdzjArray indexDataAtIndex:index]; } - (ldzj_arrayBuilder *)addIndexData:(ldzj*)value { if (resultLdzjArray.indexDataArray == nil) { resultLdzjArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultLdzjArray.indexDataArray addObject:value]; return self; } - (ldzj_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultLdzjArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (ldzj_arrayBuilder *)clearIndexData { resultLdzjArray.indexDataArray = nil; return self; } @end @interface zlkp () @property UInt32 time; @property Float64 kongPanChengDu; @property Float64 gaoKongPan; @end @implementation zlkp - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasKongPanChengDu { return !!hasKongPanChengDu_; } - (void) setHasKongPanChengDu:(BOOL) _value_ { hasKongPanChengDu_ = !!_value_; } @synthesize kongPanChengDu; - (BOOL) hasGaoKongPan { return !!hasGaoKongPan_; } - (void) setHasGaoKongPan:(BOOL) _value_ { hasGaoKongPan_ = !!_value_; } @synthesize gaoKongPan; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.kongPanChengDu = 0; self.gaoKongPan = 0; } return self; } static zlkp* defaultzlkpInstance = nil; + (void) initialize { if (self == [zlkp class]) { defaultzlkpInstance = [[zlkp alloc] init]; } } + (instancetype) defaultInstance { return defaultzlkpInstance; } - (instancetype) defaultInstance { return defaultzlkpInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasKongPanChengDu) { return NO; } if (!self.hasGaoKongPan) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasKongPanChengDu) { [output writeDouble:2 value:self.kongPanChengDu]; } if (self.hasGaoKongPan) { [output writeDouble:3 value:self.gaoKongPan]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasKongPanChengDu) { size_ += computeDoubleSize(2, self.kongPanChengDu); } if (self.hasGaoKongPan) { size_ += computeDoubleSize(3, self.gaoKongPan); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlkp*) parseFromData:(NSData*) data { return (zlkp*)[[[zlkp builder] mergeFromData:data] build]; } + (zlkp*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlkp*)[[[zlkp builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlkp*) parseFromInputStream:(NSInputStream*) input { return (zlkp*)[[[zlkp builder] mergeFromInputStream:input] build]; } + (zlkp*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlkp*)[[[zlkp builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlkp*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlkp*)[[[zlkp builder] mergeFromCodedInputStream:input] build]; } + (zlkp*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlkp*)[[[zlkp builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlkpBuilder*) builder { return [[zlkpBuilder alloc] init]; } + (zlkpBuilder*) builderWithPrototype:(zlkp*) prototype { return [[zlkp builder] mergeFrom:prototype]; } - (zlkpBuilder*) builder { return [zlkp builder]; } - (zlkpBuilder*) toBuilder { return [zlkp builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasKongPanChengDu) { [output appendFormat:@"%@%@: %@\n", indent, @"kongPanChengDu", [NSNumber numberWithDouble:self.kongPanChengDu]]; } if (self.hasGaoKongPan) { [output appendFormat:@"%@%@: %@\n", indent, @"gaoKongPan", [NSNumber numberWithDouble:self.gaoKongPan]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasKongPanChengDu) { [dictionary setObject: [NSNumber numberWithDouble:self.kongPanChengDu] forKey: @"kongPanChengDu"]; } if (self.hasGaoKongPan) { [dictionary setObject: [NSNumber numberWithDouble:self.gaoKongPan] forKey: @"gaoKongPan"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlkp class]]) { return NO; } zlkp *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasKongPanChengDu == otherMessage.hasKongPanChengDu && (!self.hasKongPanChengDu || self.kongPanChengDu == otherMessage.kongPanChengDu) && self.hasGaoKongPan == otherMessage.hasGaoKongPan && (!self.hasGaoKongPan || self.gaoKongPan == otherMessage.gaoKongPan) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasKongPanChengDu) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.kongPanChengDu] hash]; } if (self.hasGaoKongPan) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.gaoKongPan] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlkpBuilder() @property (strong) zlkp* resultZlkp; @end @implementation zlkpBuilder @synthesize resultZlkp; - (instancetype) init { if ((self = [super init])) { self.resultZlkp = [[zlkp alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlkp; } - (zlkpBuilder*) clear { self.resultZlkp = [[zlkp alloc] init]; return self; } - (zlkpBuilder*) clone { return [zlkp builderWithPrototype:resultZlkp]; } - (zlkp*) defaultInstance { return [zlkp defaultInstance]; } - (zlkp*) build { [self checkInitialized]; return [self buildPartial]; } - (zlkp*) buildPartial { zlkp* returnMe = resultZlkp; self.resultZlkp = nil; return returnMe; } - (zlkpBuilder*) mergeFrom:(zlkp*) other { if (other == [zlkp defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasKongPanChengDu) { [self setKongPanChengDu:other.kongPanChengDu]; } if (other.hasGaoKongPan) { [self setGaoKongPan:other.gaoKongPan]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlkpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlkpBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setKongPanChengDu:[input readDouble]]; break; } case 25: { [self setGaoKongPan:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultZlkp.hasTime; } - (UInt32) time { return resultZlkp.time; } - (zlkpBuilder*) setTime:(UInt32) value { resultZlkp.hasTime = YES; resultZlkp.time = value; return self; } - (zlkpBuilder*) clearTime { resultZlkp.hasTime = NO; resultZlkp.time = 0; return self; } - (BOOL) hasKongPanChengDu { return resultZlkp.hasKongPanChengDu; } - (Float64) kongPanChengDu { return resultZlkp.kongPanChengDu; } - (zlkpBuilder*) setKongPanChengDu:(Float64) value { resultZlkp.hasKongPanChengDu = YES; resultZlkp.kongPanChengDu = value; return self; } - (zlkpBuilder*) clearKongPanChengDu { resultZlkp.hasKongPanChengDu = NO; resultZlkp.kongPanChengDu = 0; return self; } - (BOOL) hasGaoKongPan { return resultZlkp.hasGaoKongPan; } - (Float64) gaoKongPan { return resultZlkp.gaoKongPan; } - (zlkpBuilder*) setGaoKongPan:(Float64) value { resultZlkp.hasGaoKongPan = YES; resultZlkp.gaoKongPan = value; return self; } - (zlkpBuilder*) clearGaoKongPan { resultZlkp.hasGaoKongPan = NO; resultZlkp.gaoKongPan = 0; return self; } @end @interface zlkp_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation zlkp_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static zlkp_array* defaultzlkp_arrayInstance = nil; + (void) initialize { if (self == [zlkp_array class]) { defaultzlkp_arrayInstance = [[zlkp_array alloc] init]; } } + (instancetype) defaultInstance { return defaultzlkp_arrayInstance; } - (instancetype) defaultInstance { return defaultzlkp_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (zlkp*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(zlkp *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(zlkp *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(zlkp *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlkp_array*) parseFromData:(NSData*) data { return (zlkp_array*)[[[zlkp_array builder] mergeFromData:data] build]; } + (zlkp_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlkp_array*)[[[zlkp_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlkp_array*) parseFromInputStream:(NSInputStream*) input { return (zlkp_array*)[[[zlkp_array builder] mergeFromInputStream:input] build]; } + (zlkp_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlkp_array*)[[[zlkp_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlkp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlkp_array*)[[[zlkp_array builder] mergeFromCodedInputStream:input] build]; } + (zlkp_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlkp_array*)[[[zlkp_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlkp_arrayBuilder*) builder { return [[zlkp_arrayBuilder alloc] init]; } + (zlkp_arrayBuilder*) builderWithPrototype:(zlkp_array*) prototype { return [[zlkp_array builder] mergeFrom:prototype]; } - (zlkp_arrayBuilder*) builder { return [zlkp_array builder]; } - (zlkp_arrayBuilder*) toBuilder { return [zlkp_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(zlkp *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (zlkp* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlkp_array class]]) { return NO; } zlkp_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(zlkp *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlkp_arrayBuilder() @property (strong) zlkp_array* resultZlkpArray; @end @implementation zlkp_arrayBuilder @synthesize resultZlkpArray; - (instancetype) init { if ((self = [super init])) { self.resultZlkpArray = [[zlkp_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlkpArray; } - (zlkp_arrayBuilder*) clear { self.resultZlkpArray = [[zlkp_array alloc] init]; return self; } - (zlkp_arrayBuilder*) clone { return [zlkp_array builderWithPrototype:resultZlkpArray]; } - (zlkp_array*) defaultInstance { return [zlkp_array defaultInstance]; } - (zlkp_array*) build { [self checkInitialized]; return [self buildPartial]; } - (zlkp_array*) buildPartial { zlkp_array* returnMe = resultZlkpArray; self.resultZlkpArray = nil; return returnMe; } - (zlkp_arrayBuilder*) mergeFrom:(zlkp_array*) other { if (other == [zlkp_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultZlkpArray.indexDataArray == nil) { resultZlkpArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultZlkpArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlkp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlkp_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { zlkpBuilder* subBuilder = [zlkp builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultZlkpArray.indexDataArray; } - (zlkp*)indexDataAtIndex:(NSUInteger)index { return [resultZlkpArray indexDataAtIndex:index]; } - (zlkp_arrayBuilder *)addIndexData:(zlkp*)value { if (resultZlkpArray.indexDataArray == nil) { resultZlkpArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultZlkpArray.indexDataArray addObject:value]; return self; } - (zlkp_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultZlkpArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (zlkp_arrayBuilder *)clearIndexData { resultZlkpArray.indexDataArray = nil; return self; } @end @interface zlzj () @property UInt32 time; @property Float64 jz; @property Float64 mmbl; @end @implementation zlzj - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasJz { return !!hasJz_; } - (void) setHasJz:(BOOL) _value_ { hasJz_ = !!_value_; } @synthesize jz; - (BOOL) hasMmbl { return !!hasMmbl_; } - (void) setHasMmbl:(BOOL) _value_ { hasMmbl_ = !!_value_; } @synthesize mmbl; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.jz = 0; self.mmbl = 0; } return self; } static zlzj* defaultzlzjInstance = nil; + (void) initialize { if (self == [zlzj class]) { defaultzlzjInstance = [[zlzj alloc] init]; } } + (instancetype) defaultInstance { return defaultzlzjInstance; } - (instancetype) defaultInstance { return defaultzlzjInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasJz) { return NO; } if (!self.hasMmbl) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasJz) { [output writeDouble:2 value:self.jz]; } if (self.hasMmbl) { [output writeDouble:3 value:self.mmbl]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasJz) { size_ += computeDoubleSize(2, self.jz); } if (self.hasMmbl) { size_ += computeDoubleSize(3, self.mmbl); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlzj*) parseFromData:(NSData*) data { return (zlzj*)[[[zlzj builder] mergeFromData:data] build]; } + (zlzj*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzj*)[[[zlzj builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlzj*) parseFromInputStream:(NSInputStream*) input { return (zlzj*)[[[zlzj builder] mergeFromInputStream:input] build]; } + (zlzj*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzj*)[[[zlzj builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzj*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlzj*)[[[zlzj builder] mergeFromCodedInputStream:input] build]; } + (zlzj*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzj*)[[[zlzj builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzjBuilder*) builder { return [[zlzjBuilder alloc] init]; } + (zlzjBuilder*) builderWithPrototype:(zlzj*) prototype { return [[zlzj builder] mergeFrom:prototype]; } - (zlzjBuilder*) builder { return [zlzj builder]; } - (zlzjBuilder*) toBuilder { return [zlzj builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasJz) { [output appendFormat:@"%@%@: %@\n", indent, @"jz", [NSNumber numberWithDouble:self.jz]]; } if (self.hasMmbl) { [output appendFormat:@"%@%@: %@\n", indent, @"mmbl", [NSNumber numberWithDouble:self.mmbl]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasJz) { [dictionary setObject: [NSNumber numberWithDouble:self.jz] forKey: @"jz"]; } if (self.hasMmbl) { [dictionary setObject: [NSNumber numberWithDouble:self.mmbl] forKey: @"mmbl"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlzj class]]) { return NO; } zlzj *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasJz == otherMessage.hasJz && (!self.hasJz || self.jz == otherMessage.jz) && self.hasMmbl == otherMessage.hasMmbl && (!self.hasMmbl || self.mmbl == otherMessage.mmbl) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasJz) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.jz] hash]; } if (self.hasMmbl) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.mmbl] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlzjBuilder() @property (strong) zlzj* resultZlzj; @end @implementation zlzjBuilder @synthesize resultZlzj; - (instancetype) init { if ((self = [super init])) { self.resultZlzj = [[zlzj alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlzj; } - (zlzjBuilder*) clear { self.resultZlzj = [[zlzj alloc] init]; return self; } - (zlzjBuilder*) clone { return [zlzj builderWithPrototype:resultZlzj]; } - (zlzj*) defaultInstance { return [zlzj defaultInstance]; } - (zlzj*) build { [self checkInitialized]; return [self buildPartial]; } - (zlzj*) buildPartial { zlzj* returnMe = resultZlzj; self.resultZlzj = nil; return returnMe; } - (zlzjBuilder*) mergeFrom:(zlzj*) other { if (other == [zlzj defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasJz) { [self setJz:other.jz]; } if (other.hasMmbl) { [self setMmbl:other.mmbl]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlzjBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setJz:[input readDouble]]; break; } case 25: { [self setMmbl:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultZlzj.hasTime; } - (UInt32) time { return resultZlzj.time; } - (zlzjBuilder*) setTime:(UInt32) value { resultZlzj.hasTime = YES; resultZlzj.time = value; return self; } - (zlzjBuilder*) clearTime { resultZlzj.hasTime = NO; resultZlzj.time = 0; return self; } - (BOOL) hasJz { return resultZlzj.hasJz; } - (Float64) jz { return resultZlzj.jz; } - (zlzjBuilder*) setJz:(Float64) value { resultZlzj.hasJz = YES; resultZlzj.jz = value; return self; } - (zlzjBuilder*) clearJz { resultZlzj.hasJz = NO; resultZlzj.jz = 0; return self; } - (BOOL) hasMmbl { return resultZlzj.hasMmbl; } - (Float64) mmbl { return resultZlzj.mmbl; } - (zlzjBuilder*) setMmbl:(Float64) value { resultZlzj.hasMmbl = YES; resultZlzj.mmbl = value; return self; } - (zlzjBuilder*) clearMmbl { resultZlzj.hasMmbl = NO; resultZlzj.mmbl = 0; return self; } @end @interface zlzj_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation zlzj_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static zlzj_array* defaultzlzj_arrayInstance = nil; + (void) initialize { if (self == [zlzj_array class]) { defaultzlzj_arrayInstance = [[zlzj_array alloc] init]; } } + (instancetype) defaultInstance { return defaultzlzj_arrayInstance; } - (instancetype) defaultInstance { return defaultzlzj_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (zlzj*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(zlzj *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(zlzj *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(zlzj *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zlzj_array*) parseFromData:(NSData*) data { return (zlzj_array*)[[[zlzj_array builder] mergeFromData:data] build]; } + (zlzj_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzj_array*)[[[zlzj_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zlzj_array*) parseFromInputStream:(NSInputStream*) input { return (zlzj_array*)[[[zlzj_array builder] mergeFromInputStream:input] build]; } + (zlzj_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzj_array*)[[[zlzj_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zlzj_array*)[[[zlzj_array builder] mergeFromCodedInputStream:input] build]; } + (zlzj_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zlzj_array*)[[[zlzj_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zlzj_arrayBuilder*) builder { return [[zlzj_arrayBuilder alloc] init]; } + (zlzj_arrayBuilder*) builderWithPrototype:(zlzj_array*) prototype { return [[zlzj_array builder] mergeFrom:prototype]; } - (zlzj_arrayBuilder*) builder { return [zlzj_array builder]; } - (zlzj_arrayBuilder*) toBuilder { return [zlzj_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(zlzj *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (zlzj* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zlzj_array class]]) { return NO; } zlzj_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(zlzj *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zlzj_arrayBuilder() @property (strong) zlzj_array* resultZlzjArray; @end @implementation zlzj_arrayBuilder @synthesize resultZlzjArray; - (instancetype) init { if ((self = [super init])) { self.resultZlzjArray = [[zlzj_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZlzjArray; } - (zlzj_arrayBuilder*) clear { self.resultZlzjArray = [[zlzj_array alloc] init]; return self; } - (zlzj_arrayBuilder*) clone { return [zlzj_array builderWithPrototype:resultZlzjArray]; } - (zlzj_array*) defaultInstance { return [zlzj_array defaultInstance]; } - (zlzj_array*) build { [self checkInitialized]; return [self buildPartial]; } - (zlzj_array*) buildPartial { zlzj_array* returnMe = resultZlzjArray; self.resultZlzjArray = nil; return returnMe; } - (zlzj_arrayBuilder*) mergeFrom:(zlzj_array*) other { if (other == [zlzj_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultZlzjArray.indexDataArray == nil) { resultZlzjArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultZlzjArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (zlzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zlzj_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { zlzjBuilder* subBuilder = [zlzj builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultZlzjArray.indexDataArray; } - (zlzj*)indexDataAtIndex:(NSUInteger)index { return [resultZlzjArray indexDataAtIndex:index]; } - (zlzj_arrayBuilder *)addIndexData:(zlzj*)value { if (resultZlzjArray.indexDataArray == nil) { resultZlzjArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultZlzjArray.indexDataArray addObject:value]; return self; } - (zlzj_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultZlzjArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (zlzj_arrayBuilder *)clearIndexData { resultZlzjArray.indexDataArray = nil; return self; } @end @interface zljme () @property UInt32 time; @property Float64 zljmeValue; @end @implementation zljme - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasZljmeValue { return !!hasZljmeValue_; } - (void) setHasZljmeValue:(BOOL) _value_ { hasZljmeValue_ = !!_value_; } @synthesize zljmeValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.zljmeValue = 0; } return self; } static zljme* defaultzljmeInstance = nil; + (void) initialize { if (self == [zljme class]) { defaultzljmeInstance = [[zljme alloc] init]; } } + (instancetype) defaultInstance { return defaultzljmeInstance; } - (instancetype) defaultInstance { return defaultzljmeInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasZljmeValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasZljmeValue) { [output writeDouble:2 value:self.zljmeValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasZljmeValue) { size_ += computeDoubleSize(2, self.zljmeValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zljme*) parseFromData:(NSData*) data { return (zljme*)[[[zljme builder] mergeFromData:data] build]; } + (zljme*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zljme*)[[[zljme builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zljme*) parseFromInputStream:(NSInputStream*) input { return (zljme*)[[[zljme builder] mergeFromInputStream:input] build]; } + (zljme*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zljme*)[[[zljme builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zljme*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zljme*)[[[zljme builder] mergeFromCodedInputStream:input] build]; } + (zljme*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zljme*)[[[zljme builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zljmeBuilder*) builder { return [[zljmeBuilder alloc] init]; } + (zljmeBuilder*) builderWithPrototype:(zljme*) prototype { return [[zljme builder] mergeFrom:prototype]; } - (zljmeBuilder*) builder { return [zljme builder]; } - (zljmeBuilder*) toBuilder { return [zljme builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasZljmeValue) { [output appendFormat:@"%@%@: %@\n", indent, @"zljmeValue", [NSNumber numberWithDouble:self.zljmeValue]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasZljmeValue) { [dictionary setObject: [NSNumber numberWithDouble:self.zljmeValue] forKey: @"zljmeValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zljme class]]) { return NO; } zljme *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasZljmeValue == otherMessage.hasZljmeValue && (!self.hasZljmeValue || self.zljmeValue == otherMessage.zljmeValue) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasZljmeValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zljmeValue] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zljmeBuilder() @property (strong) zljme* resultZljme; @end @implementation zljmeBuilder @synthesize resultZljme; - (instancetype) init { if ((self = [super init])) { self.resultZljme = [[zljme alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZljme; } - (zljmeBuilder*) clear { self.resultZljme = [[zljme alloc] init]; return self; } - (zljmeBuilder*) clone { return [zljme builderWithPrototype:resultZljme]; } - (zljme*) defaultInstance { return [zljme defaultInstance]; } - (zljme*) build { [self checkInitialized]; return [self buildPartial]; } - (zljme*) buildPartial { zljme* returnMe = resultZljme; self.resultZljme = nil; return returnMe; } - (zljmeBuilder*) mergeFrom:(zljme*) other { if (other == [zljme defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasZljmeValue) { [self setZljmeValue:other.zljmeValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (zljmeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zljmeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setZljmeValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultZljme.hasTime; } - (UInt32) time { return resultZljme.time; } - (zljmeBuilder*) setTime:(UInt32) value { resultZljme.hasTime = YES; resultZljme.time = value; return self; } - (zljmeBuilder*) clearTime { resultZljme.hasTime = NO; resultZljme.time = 0; return self; } - (BOOL) hasZljmeValue { return resultZljme.hasZljmeValue; } - (Float64) zljmeValue { return resultZljme.zljmeValue; } - (zljmeBuilder*) setZljmeValue:(Float64) value { resultZljme.hasZljmeValue = YES; resultZljme.zljmeValue = value; return self; } - (zljmeBuilder*) clearZljmeValue { resultZljme.hasZljmeValue = NO; resultZljme.zljmeValue = 0; return self; } @end @interface zljme_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation zljme_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static zljme_array* defaultzljme_arrayInstance = nil; + (void) initialize { if (self == [zljme_array class]) { defaultzljme_arrayInstance = [[zljme_array alloc] init]; } } + (instancetype) defaultInstance { return defaultzljme_arrayInstance; } - (instancetype) defaultInstance { return defaultzljme_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (zljme*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(zljme *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(zljme *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(zljme *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zljme_array*) parseFromData:(NSData*) data { return (zljme_array*)[[[zljme_array builder] mergeFromData:data] build]; } + (zljme_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zljme_array*)[[[zljme_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zljme_array*) parseFromInputStream:(NSInputStream*) input { return (zljme_array*)[[[zljme_array builder] mergeFromInputStream:input] build]; } + (zljme_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zljme_array*)[[[zljme_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zljme_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zljme_array*)[[[zljme_array builder] mergeFromCodedInputStream:input] build]; } + (zljme_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zljme_array*)[[[zljme_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zljme_arrayBuilder*) builder { return [[zljme_arrayBuilder alloc] init]; } + (zljme_arrayBuilder*) builderWithPrototype:(zljme_array*) prototype { return [[zljme_array builder] mergeFrom:prototype]; } - (zljme_arrayBuilder*) builder { return [zljme_array builder]; } - (zljme_arrayBuilder*) toBuilder { return [zljme_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(zljme *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (zljme* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zljme_array class]]) { return NO; } zljme_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(zljme *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zljme_arrayBuilder() @property (strong) zljme_array* resultZljmeArray; @end @implementation zljme_arrayBuilder @synthesize resultZljmeArray; - (instancetype) init { if ((self = [super init])) { self.resultZljmeArray = [[zljme_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZljmeArray; } - (zljme_arrayBuilder*) clear { self.resultZljmeArray = [[zljme_array alloc] init]; return self; } - (zljme_arrayBuilder*) clone { return [zljme_array builderWithPrototype:resultZljmeArray]; } - (zljme_array*) defaultInstance { return [zljme_array defaultInstance]; } - (zljme_array*) build { [self checkInitialized]; return [self buildPartial]; } - (zljme_array*) buildPartial { zljme_array* returnMe = resultZljmeArray; self.resultZljmeArray = nil; return returnMe; } - (zljme_arrayBuilder*) mergeFrom:(zljme_array*) other { if (other == [zljme_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultZljmeArray.indexDataArray == nil) { resultZljmeArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultZljmeArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (zljme_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zljme_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { zljmeBuilder* subBuilder = [zljme builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultZljmeArray.indexDataArray; } - (zljme*)indexDataAtIndex:(NSUInteger)index { return [resultZljmeArray indexDataAtIndex:index]; } - (zljme_arrayBuilder *)addIndexData:(zljme*)value { if (resultZljmeArray.indexDataArray == nil) { resultZljmeArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultZljmeArray.indexDataArray addObject:value]; return self; } - (zljme_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultZljmeArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (zljme_arrayBuilder *)clearIndexData { resultZljmeArray.indexDataArray = nil; return self; } @end @interface hhjvol () @property UInt32 time; @property Float64 ma1Value; @property Float64 ma2Value; @property Float64 ma3Value; @property Float64 xuniValue; @property Float64 volValue; @end @implementation hhjvol - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasMa1Value { return !!hasMa1Value_; } - (void) setHasMa1Value:(BOOL) _value_ { hasMa1Value_ = !!_value_; } @synthesize ma1Value; - (BOOL) hasMa2Value { return !!hasMa2Value_; } - (void) setHasMa2Value:(BOOL) _value_ { hasMa2Value_ = !!_value_; } @synthesize ma2Value; - (BOOL) hasMa3Value { return !!hasMa3Value_; } - (void) setHasMa3Value:(BOOL) _value_ { hasMa3Value_ = !!_value_; } @synthesize ma3Value; - (BOOL) hasXuniValue { return !!hasXuniValue_; } - (void) setHasXuniValue:(BOOL) _value_ { hasXuniValue_ = !!_value_; } @synthesize xuniValue; - (BOOL) hasVolValue { return !!hasVolValue_; } - (void) setHasVolValue:(BOOL) _value_ { hasVolValue_ = !!_value_; } @synthesize volValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.ma1Value = 0; self.ma2Value = 0; self.ma3Value = 0; self.xuniValue = 0; self.volValue = 0; } return self; } static hhjvol* defaulthhjvolInstance = nil; + (void) initialize { if (self == [hhjvol class]) { defaulthhjvolInstance = [[hhjvol alloc] init]; } } + (instancetype) defaultInstance { return defaulthhjvolInstance; } - (instancetype) defaultInstance { return defaulthhjvolInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasMa1Value) { return NO; } if (!self.hasMa2Value) { return NO; } if (!self.hasMa3Value) { return NO; } if (!self.hasXuniValue) { return NO; } if (!self.hasVolValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasMa1Value) { [output writeDouble:2 value:self.ma1Value]; } if (self.hasMa2Value) { [output writeDouble:3 value:self.ma2Value]; } if (self.hasMa3Value) { [output writeDouble:4 value:self.ma3Value]; } if (self.hasXuniValue) { [output writeDouble:5 value:self.xuniValue]; } if (self.hasVolValue) { [output writeDouble:6 value:self.volValue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasMa1Value) { size_ += computeDoubleSize(2, self.ma1Value); } if (self.hasMa2Value) { size_ += computeDoubleSize(3, self.ma2Value); } if (self.hasMa3Value) { size_ += computeDoubleSize(4, self.ma3Value); } if (self.hasXuniValue) { size_ += computeDoubleSize(5, self.xuniValue); } if (self.hasVolValue) { size_ += computeDoubleSize(6, self.volValue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (hhjvol*) parseFromData:(NSData*) data { return (hhjvol*)[[[hhjvol builder] mergeFromData:data] build]; } + (hhjvol*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hhjvol*)[[[hhjvol builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (hhjvol*) parseFromInputStream:(NSInputStream*) input { return (hhjvol*)[[[hhjvol builder] mergeFromInputStream:input] build]; } + (hhjvol*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hhjvol*)[[[hhjvol builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (hhjvol*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (hhjvol*)[[[hhjvol builder] mergeFromCodedInputStream:input] build]; } + (hhjvol*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hhjvol*)[[[hhjvol builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (hhjvolBuilder*) builder { return [[hhjvolBuilder alloc] init]; } + (hhjvolBuilder*) builderWithPrototype:(hhjvol*) prototype { return [[hhjvol builder] mergeFrom:prototype]; } - (hhjvolBuilder*) builder { return [hhjvol builder]; } - (hhjvolBuilder*) toBuilder { return [hhjvol builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasMa1Value) { [output appendFormat:@"%@%@: %@\n", indent, @"ma1Value", [NSNumber numberWithDouble:self.ma1Value]]; } if (self.hasMa2Value) { [output appendFormat:@"%@%@: %@\n", indent, @"ma2Value", [NSNumber numberWithDouble:self.ma2Value]]; } if (self.hasMa3Value) { [output appendFormat:@"%@%@: %@\n", indent, @"ma3Value", [NSNumber numberWithDouble:self.ma3Value]]; } if (self.hasXuniValue) { [output appendFormat:@"%@%@: %@\n", indent, @"xuniValue", [NSNumber numberWithDouble:self.xuniValue]]; } if (self.hasVolValue) { [output appendFormat:@"%@%@: %@\n", indent, @"volValue", [NSNumber numberWithDouble:self.volValue]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasMa1Value) { [dictionary setObject: [NSNumber numberWithDouble:self.ma1Value] forKey: @"ma1Value"]; } if (self.hasMa2Value) { [dictionary setObject: [NSNumber numberWithDouble:self.ma2Value] forKey: @"ma2Value"]; } if (self.hasMa3Value) { [dictionary setObject: [NSNumber numberWithDouble:self.ma3Value] forKey: @"ma3Value"]; } if (self.hasXuniValue) { [dictionary setObject: [NSNumber numberWithDouble:self.xuniValue] forKey: @"xuniValue"]; } if (self.hasVolValue) { [dictionary setObject: [NSNumber numberWithDouble:self.volValue] forKey: @"volValue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[hhjvol class]]) { return NO; } hhjvol *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasMa1Value == otherMessage.hasMa1Value && (!self.hasMa1Value || self.ma1Value == otherMessage.ma1Value) && self.hasMa2Value == otherMessage.hasMa2Value && (!self.hasMa2Value || self.ma2Value == otherMessage.ma2Value) && self.hasMa3Value == otherMessage.hasMa3Value && (!self.hasMa3Value || self.ma3Value == otherMessage.ma3Value) && self.hasXuniValue == otherMessage.hasXuniValue && (!self.hasXuniValue || self.xuniValue == otherMessage.xuniValue) && self.hasVolValue == otherMessage.hasVolValue && (!self.hasVolValue || self.volValue == otherMessage.volValue) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasMa1Value) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.ma1Value] hash]; } if (self.hasMa2Value) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.ma2Value] hash]; } if (self.hasMa3Value) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.ma3Value] hash]; } if (self.hasXuniValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.xuniValue] hash]; } if (self.hasVolValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.volValue] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface hhjvolBuilder() @property (strong) hhjvol* resultHhjvol; @end @implementation hhjvolBuilder @synthesize resultHhjvol; - (instancetype) init { if ((self = [super init])) { self.resultHhjvol = [[hhjvol alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultHhjvol; } - (hhjvolBuilder*) clear { self.resultHhjvol = [[hhjvol alloc] init]; return self; } - (hhjvolBuilder*) clone { return [hhjvol builderWithPrototype:resultHhjvol]; } - (hhjvol*) defaultInstance { return [hhjvol defaultInstance]; } - (hhjvol*) build { [self checkInitialized]; return [self buildPartial]; } - (hhjvol*) buildPartial { hhjvol* returnMe = resultHhjvol; self.resultHhjvol = nil; return returnMe; } - (hhjvolBuilder*) mergeFrom:(hhjvol*) other { if (other == [hhjvol defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasMa1Value) { [self setMa1Value:other.ma1Value]; } if (other.hasMa2Value) { [self setMa2Value:other.ma2Value]; } if (other.hasMa3Value) { [self setMa3Value:other.ma3Value]; } if (other.hasXuniValue) { [self setXuniValue:other.xuniValue]; } if (other.hasVolValue) { [self setVolValue:other.volValue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (hhjvolBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (hhjvolBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setMa1Value:[input readDouble]]; break; } case 25: { [self setMa2Value:[input readDouble]]; break; } case 33: { [self setMa3Value:[input readDouble]]; break; } case 41: { [self setXuniValue:[input readDouble]]; break; } case 49: { [self setVolValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultHhjvol.hasTime; } - (UInt32) time { return resultHhjvol.time; } - (hhjvolBuilder*) setTime:(UInt32) value { resultHhjvol.hasTime = YES; resultHhjvol.time = value; return self; } - (hhjvolBuilder*) clearTime { resultHhjvol.hasTime = NO; resultHhjvol.time = 0; return self; } - (BOOL) hasMa1Value { return resultHhjvol.hasMa1Value; } - (Float64) ma1Value { return resultHhjvol.ma1Value; } - (hhjvolBuilder*) setMa1Value:(Float64) value { resultHhjvol.hasMa1Value = YES; resultHhjvol.ma1Value = value; return self; } - (hhjvolBuilder*) clearMa1Value { resultHhjvol.hasMa1Value = NO; resultHhjvol.ma1Value = 0; return self; } - (BOOL) hasMa2Value { return resultHhjvol.hasMa2Value; } - (Float64) ma2Value { return resultHhjvol.ma2Value; } - (hhjvolBuilder*) setMa2Value:(Float64) value { resultHhjvol.hasMa2Value = YES; resultHhjvol.ma2Value = value; return self; } - (hhjvolBuilder*) clearMa2Value { resultHhjvol.hasMa2Value = NO; resultHhjvol.ma2Value = 0; return self; } - (BOOL) hasMa3Value { return resultHhjvol.hasMa3Value; } - (Float64) ma3Value { return resultHhjvol.ma3Value; } - (hhjvolBuilder*) setMa3Value:(Float64) value { resultHhjvol.hasMa3Value = YES; resultHhjvol.ma3Value = value; return self; } - (hhjvolBuilder*) clearMa3Value { resultHhjvol.hasMa3Value = NO; resultHhjvol.ma3Value = 0; return self; } - (BOOL) hasXuniValue { return resultHhjvol.hasXuniValue; } - (Float64) xuniValue { return resultHhjvol.xuniValue; } - (hhjvolBuilder*) setXuniValue:(Float64) value { resultHhjvol.hasXuniValue = YES; resultHhjvol.xuniValue = value; return self; } - (hhjvolBuilder*) clearXuniValue { resultHhjvol.hasXuniValue = NO; resultHhjvol.xuniValue = 0; return self; } - (BOOL) hasVolValue { return resultHhjvol.hasVolValue; } - (Float64) volValue { return resultHhjvol.volValue; } - (hhjvolBuilder*) setVolValue:(Float64) value { resultHhjvol.hasVolValue = YES; resultHhjvol.volValue = value; return self; } - (hhjvolBuilder*) clearVolValue { resultHhjvol.hasVolValue = NO; resultHhjvol.volValue = 0; return self; } @end @interface hhjvol_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation hhjvol_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static hhjvol_array* defaulthhjvol_arrayInstance = nil; + (void) initialize { if (self == [hhjvol_array class]) { defaulthhjvol_arrayInstance = [[hhjvol_array alloc] init]; } } + (instancetype) defaultInstance { return defaulthhjvol_arrayInstance; } - (instancetype) defaultInstance { return defaulthhjvol_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (hhjvol*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(hhjvol *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(hhjvol *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(hhjvol *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (hhjvol_array*) parseFromData:(NSData*) data { return (hhjvol_array*)[[[hhjvol_array builder] mergeFromData:data] build]; } + (hhjvol_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hhjvol_array*)[[[hhjvol_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (hhjvol_array*) parseFromInputStream:(NSInputStream*) input { return (hhjvol_array*)[[[hhjvol_array builder] mergeFromInputStream:input] build]; } + (hhjvol_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hhjvol_array*)[[[hhjvol_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (hhjvol_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (hhjvol_array*)[[[hhjvol_array builder] mergeFromCodedInputStream:input] build]; } + (hhjvol_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hhjvol_array*)[[[hhjvol_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (hhjvol_arrayBuilder*) builder { return [[hhjvol_arrayBuilder alloc] init]; } + (hhjvol_arrayBuilder*) builderWithPrototype:(hhjvol_array*) prototype { return [[hhjvol_array builder] mergeFrom:prototype]; } - (hhjvol_arrayBuilder*) builder { return [hhjvol_array builder]; } - (hhjvol_arrayBuilder*) toBuilder { return [hhjvol_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(hhjvol *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (hhjvol* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[hhjvol_array class]]) { return NO; } hhjvol_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(hhjvol *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface hhjvol_arrayBuilder() @property (strong) hhjvol_array* resultHhjvolArray; @end @implementation hhjvol_arrayBuilder @synthesize resultHhjvolArray; - (instancetype) init { if ((self = [super init])) { self.resultHhjvolArray = [[hhjvol_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultHhjvolArray; } - (hhjvol_arrayBuilder*) clear { self.resultHhjvolArray = [[hhjvol_array alloc] init]; return self; } - (hhjvol_arrayBuilder*) clone { return [hhjvol_array builderWithPrototype:resultHhjvolArray]; } - (hhjvol_array*) defaultInstance { return [hhjvol_array defaultInstance]; } - (hhjvol_array*) build { [self checkInitialized]; return [self buildPartial]; } - (hhjvol_array*) buildPartial { hhjvol_array* returnMe = resultHhjvolArray; self.resultHhjvolArray = nil; return returnMe; } - (hhjvol_arrayBuilder*) mergeFrom:(hhjvol_array*) other { if (other == [hhjvol_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultHhjvolArray.indexDataArray == nil) { resultHhjvolArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultHhjvolArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (hhjvol_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (hhjvol_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { hhjvolBuilder* subBuilder = [hhjvol builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultHhjvolArray.indexDataArray; } - (hhjvol*)indexDataAtIndex:(NSUInteger)index { return [resultHhjvolArray indexDataAtIndex:index]; } - (hhjvol_arrayBuilder *)addIndexData:(hhjvol*)value { if (resultHhjvolArray.indexDataArray == nil) { resultHhjvolArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultHhjvolArray.indexDataArray addObject:value]; return self; } - (hhjvol_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultHhjvolArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (hhjvol_arrayBuilder *)clearIndexData { resultHhjvolArray.indexDataArray = nil; return self; } @end @interface xdjw () @property UInt32 time; @property Float64 pjgj; @property Float64 hs300; @end @implementation xdjw - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasPjgj { return !!hasPjgj_; } - (void) setHasPjgj:(BOOL) _value_ { hasPjgj_ = !!_value_; } @synthesize pjgj; - (BOOL) hasHs300 { return !!hasHs300_; } - (void) setHasHs300:(BOOL) _value_ { hasHs300_ = !!_value_; } @synthesize hs300; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.pjgj = 0; self.hs300 = 0; } return self; } static xdjw* defaultxdjwInstance = nil; + (void) initialize { if (self == [xdjw class]) { defaultxdjwInstance = [[xdjw alloc] init]; } } + (instancetype) defaultInstance { return defaultxdjwInstance; } - (instancetype) defaultInstance { return defaultxdjwInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasPjgj) { return NO; } if (!self.hasHs300) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasPjgj) { [output writeDouble:2 value:self.pjgj]; } if (self.hasHs300) { [output writeDouble:3 value:self.hs300]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasPjgj) { size_ += computeDoubleSize(2, self.pjgj); } if (self.hasHs300) { size_ += computeDoubleSize(3, self.hs300); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (xdjw*) parseFromData:(NSData*) data { return (xdjw*)[[[xdjw builder] mergeFromData:data] build]; } + (xdjw*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (xdjw*)[[[xdjw builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (xdjw*) parseFromInputStream:(NSInputStream*) input { return (xdjw*)[[[xdjw builder] mergeFromInputStream:input] build]; } + (xdjw*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (xdjw*)[[[xdjw builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (xdjw*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (xdjw*)[[[xdjw builder] mergeFromCodedInputStream:input] build]; } + (xdjw*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (xdjw*)[[[xdjw builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (xdjwBuilder*) builder { return [[xdjwBuilder alloc] init]; } + (xdjwBuilder*) builderWithPrototype:(xdjw*) prototype { return [[xdjw builder] mergeFrom:prototype]; } - (xdjwBuilder*) builder { return [xdjw builder]; } - (xdjwBuilder*) toBuilder { return [xdjw builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasPjgj) { [output appendFormat:@"%@%@: %@\n", indent, @"pjgj", [NSNumber numberWithDouble:self.pjgj]]; } if (self.hasHs300) { [output appendFormat:@"%@%@: %@\n", indent, @"hs300", [NSNumber numberWithDouble:self.hs300]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasPjgj) { [dictionary setObject: [NSNumber numberWithDouble:self.pjgj] forKey: @"pjgj"]; } if (self.hasHs300) { [dictionary setObject: [NSNumber numberWithDouble:self.hs300] forKey: @"hs300"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[xdjw class]]) { return NO; } xdjw *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasPjgj == otherMessage.hasPjgj && (!self.hasPjgj || self.pjgj == otherMessage.pjgj) && self.hasHs300 == otherMessage.hasHs300 && (!self.hasHs300 || self.hs300 == otherMessage.hs300) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasPjgj) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.pjgj] hash]; } if (self.hasHs300) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.hs300] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface xdjwBuilder() @property (strong) xdjw* resultXdjw; @end @implementation xdjwBuilder @synthesize resultXdjw; - (instancetype) init { if ((self = [super init])) { self.resultXdjw = [[xdjw alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultXdjw; } - (xdjwBuilder*) clear { self.resultXdjw = [[xdjw alloc] init]; return self; } - (xdjwBuilder*) clone { return [xdjw builderWithPrototype:resultXdjw]; } - (xdjw*) defaultInstance { return [xdjw defaultInstance]; } - (xdjw*) build { [self checkInitialized]; return [self buildPartial]; } - (xdjw*) buildPartial { xdjw* returnMe = resultXdjw; self.resultXdjw = nil; return returnMe; } - (xdjwBuilder*) mergeFrom:(xdjw*) other { if (other == [xdjw defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasPjgj) { [self setPjgj:other.pjgj]; } if (other.hasHs300) { [self setHs300:other.hs300]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (xdjwBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (xdjwBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setPjgj:[input readDouble]]; break; } case 25: { [self setHs300:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultXdjw.hasTime; } - (UInt32) time { return resultXdjw.time; } - (xdjwBuilder*) setTime:(UInt32) value { resultXdjw.hasTime = YES; resultXdjw.time = value; return self; } - (xdjwBuilder*) clearTime { resultXdjw.hasTime = NO; resultXdjw.time = 0; return self; } - (BOOL) hasPjgj { return resultXdjw.hasPjgj; } - (Float64) pjgj { return resultXdjw.pjgj; } - (xdjwBuilder*) setPjgj:(Float64) value { resultXdjw.hasPjgj = YES; resultXdjw.pjgj = value; return self; } - (xdjwBuilder*) clearPjgj { resultXdjw.hasPjgj = NO; resultXdjw.pjgj = 0; return self; } - (BOOL) hasHs300 { return resultXdjw.hasHs300; } - (Float64) hs300 { return resultXdjw.hs300; } - (xdjwBuilder*) setHs300:(Float64) value { resultXdjw.hasHs300 = YES; resultXdjw.hs300 = value; return self; } - (xdjwBuilder*) clearHs300 { resultXdjw.hasHs300 = NO; resultXdjw.hs300 = 0; return self; } @end @interface xdjw_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation xdjw_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static xdjw_array* defaultxdjw_arrayInstance = nil; + (void) initialize { if (self == [xdjw_array class]) { defaultxdjw_arrayInstance = [[xdjw_array alloc] init]; } } + (instancetype) defaultInstance { return defaultxdjw_arrayInstance; } - (instancetype) defaultInstance { return defaultxdjw_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (xdjw*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(xdjw *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(xdjw *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(xdjw *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (xdjw_array*) parseFromData:(NSData*) data { return (xdjw_array*)[[[xdjw_array builder] mergeFromData:data] build]; } + (xdjw_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (xdjw_array*)[[[xdjw_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (xdjw_array*) parseFromInputStream:(NSInputStream*) input { return (xdjw_array*)[[[xdjw_array builder] mergeFromInputStream:input] build]; } + (xdjw_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (xdjw_array*)[[[xdjw_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (xdjw_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (xdjw_array*)[[[xdjw_array builder] mergeFromCodedInputStream:input] build]; } + (xdjw_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (xdjw_array*)[[[xdjw_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (xdjw_arrayBuilder*) builder { return [[xdjw_arrayBuilder alloc] init]; } + (xdjw_arrayBuilder*) builderWithPrototype:(xdjw_array*) prototype { return [[xdjw_array builder] mergeFrom:prototype]; } - (xdjw_arrayBuilder*) builder { return [xdjw_array builder]; } - (xdjw_arrayBuilder*) toBuilder { return [xdjw_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(xdjw *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (xdjw* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[xdjw_array class]]) { return NO; } xdjw_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(xdjw *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface xdjw_arrayBuilder() @property (strong) xdjw_array* resultXdjwArray; @end @implementation xdjw_arrayBuilder @synthesize resultXdjwArray; - (instancetype) init { if ((self = [super init])) { self.resultXdjwArray = [[xdjw_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultXdjwArray; } - (xdjw_arrayBuilder*) clear { self.resultXdjwArray = [[xdjw_array alloc] init]; return self; } - (xdjw_arrayBuilder*) clone { return [xdjw_array builderWithPrototype:resultXdjwArray]; } - (xdjw_array*) defaultInstance { return [xdjw_array defaultInstance]; } - (xdjw_array*) build { [self checkInitialized]; return [self buildPartial]; } - (xdjw_array*) buildPartial { xdjw_array* returnMe = resultXdjwArray; self.resultXdjwArray = nil; return returnMe; } - (xdjw_arrayBuilder*) mergeFrom:(xdjw_array*) other { if (other == [xdjw_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultXdjwArray.indexDataArray == nil) { resultXdjwArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultXdjwArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (xdjw_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (xdjw_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { xdjwBuilder* subBuilder = [xdjw builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultXdjwArray.indexDataArray; } - (xdjw*)indexDataAtIndex:(NSUInteger)index { return [resultXdjwArray indexDataAtIndex:index]; } - (xdjw_arrayBuilder *)addIndexData:(xdjw*)value { if (resultXdjwArray.indexDataArray == nil) { resultXdjwArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultXdjwArray.indexDataArray addObject:value]; return self; } - (xdjw_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultXdjwArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (xdjw_arrayBuilder *)clearIndexData { resultXdjwArray.indexDataArray = nil; return self; } @end @interface zcc () @property UInt32 time; @property Float64 keepSell; @property Float64 keepBuy; @end @implementation zcc - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasKeepSell { return !!hasKeepSell_; } - (void) setHasKeepSell:(BOOL) _value_ { hasKeepSell_ = !!_value_; } @synthesize keepSell; - (BOOL) hasKeepBuy { return !!hasKeepBuy_; } - (void) setHasKeepBuy:(BOOL) _value_ { hasKeepBuy_ = !!_value_; } @synthesize keepBuy; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.keepSell = 0; self.keepBuy = 0; } return self; } static zcc* defaultzccInstance = nil; + (void) initialize { if (self == [zcc class]) { defaultzccInstance = [[zcc alloc] init]; } } + (instancetype) defaultInstance { return defaultzccInstance; } - (instancetype) defaultInstance { return defaultzccInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasKeepSell) { return NO; } if (!self.hasKeepBuy) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasKeepSell) { [output writeDouble:2 value:self.keepSell]; } if (self.hasKeepBuy) { [output writeDouble:3 value:self.keepBuy]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasKeepSell) { size_ += computeDoubleSize(2, self.keepSell); } if (self.hasKeepBuy) { size_ += computeDoubleSize(3, self.keepBuy); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zcc*) parseFromData:(NSData*) data { return (zcc*)[[[zcc builder] mergeFromData:data] build]; } + (zcc*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zcc*)[[[zcc builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zcc*) parseFromInputStream:(NSInputStream*) input { return (zcc*)[[[zcc builder] mergeFromInputStream:input] build]; } + (zcc*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zcc*)[[[zcc builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zcc*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zcc*)[[[zcc builder] mergeFromCodedInputStream:input] build]; } + (zcc*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zcc*)[[[zcc builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zccBuilder*) builder { return [[zccBuilder alloc] init]; } + (zccBuilder*) builderWithPrototype:(zcc*) prototype { return [[zcc builder] mergeFrom:prototype]; } - (zccBuilder*) builder { return [zcc builder]; } - (zccBuilder*) toBuilder { return [zcc builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasKeepSell) { [output appendFormat:@"%@%@: %@\n", indent, @"keepSell", [NSNumber numberWithDouble:self.keepSell]]; } if (self.hasKeepBuy) { [output appendFormat:@"%@%@: %@\n", indent, @"keepBuy", [NSNumber numberWithDouble:self.keepBuy]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasKeepSell) { [dictionary setObject: [NSNumber numberWithDouble:self.keepSell] forKey: @"keepSell"]; } if (self.hasKeepBuy) { [dictionary setObject: [NSNumber numberWithDouble:self.keepBuy] forKey: @"keepBuy"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zcc class]]) { return NO; } zcc *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasKeepSell == otherMessage.hasKeepSell && (!self.hasKeepSell || self.keepSell == otherMessage.keepSell) && self.hasKeepBuy == otherMessage.hasKeepBuy && (!self.hasKeepBuy || self.keepBuy == otherMessage.keepBuy) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasKeepSell) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.keepSell] hash]; } if (self.hasKeepBuy) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.keepBuy] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zccBuilder() @property (strong) zcc* resultZcc; @end @implementation zccBuilder @synthesize resultZcc; - (instancetype) init { if ((self = [super init])) { self.resultZcc = [[zcc alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZcc; } - (zccBuilder*) clear { self.resultZcc = [[zcc alloc] init]; return self; } - (zccBuilder*) clone { return [zcc builderWithPrototype:resultZcc]; } - (zcc*) defaultInstance { return [zcc defaultInstance]; } - (zcc*) build { [self checkInitialized]; return [self buildPartial]; } - (zcc*) buildPartial { zcc* returnMe = resultZcc; self.resultZcc = nil; return returnMe; } - (zccBuilder*) mergeFrom:(zcc*) other { if (other == [zcc defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasKeepSell) { [self setKeepSell:other.keepSell]; } if (other.hasKeepBuy) { [self setKeepBuy:other.keepBuy]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (zccBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zccBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setKeepSell:[input readDouble]]; break; } case 25: { [self setKeepBuy:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultZcc.hasTime; } - (UInt32) time { return resultZcc.time; } - (zccBuilder*) setTime:(UInt32) value { resultZcc.hasTime = YES; resultZcc.time = value; return self; } - (zccBuilder*) clearTime { resultZcc.hasTime = NO; resultZcc.time = 0; return self; } - (BOOL) hasKeepSell { return resultZcc.hasKeepSell; } - (Float64) keepSell { return resultZcc.keepSell; } - (zccBuilder*) setKeepSell:(Float64) value { resultZcc.hasKeepSell = YES; resultZcc.keepSell = value; return self; } - (zccBuilder*) clearKeepSell { resultZcc.hasKeepSell = NO; resultZcc.keepSell = 0; return self; } - (BOOL) hasKeepBuy { return resultZcc.hasKeepBuy; } - (Float64) keepBuy { return resultZcc.keepBuy; } - (zccBuilder*) setKeepBuy:(Float64) value { resultZcc.hasKeepBuy = YES; resultZcc.keepBuy = value; return self; } - (zccBuilder*) clearKeepBuy { resultZcc.hasKeepBuy = NO; resultZcc.keepBuy = 0; return self; } @end @interface zcc_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation zcc_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static zcc_array* defaultzcc_arrayInstance = nil; + (void) initialize { if (self == [zcc_array class]) { defaultzcc_arrayInstance = [[zcc_array alloc] init]; } } + (instancetype) defaultInstance { return defaultzcc_arrayInstance; } - (instancetype) defaultInstance { return defaultzcc_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (zcc*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(zcc *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(zcc *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(zcc *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (zcc_array*) parseFromData:(NSData*) data { return (zcc_array*)[[[zcc_array builder] mergeFromData:data] build]; } + (zcc_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zcc_array*)[[[zcc_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (zcc_array*) parseFromInputStream:(NSInputStream*) input { return (zcc_array*)[[[zcc_array builder] mergeFromInputStream:input] build]; } + (zcc_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zcc_array*)[[[zcc_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (zcc_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (zcc_array*)[[[zcc_array builder] mergeFromCodedInputStream:input] build]; } + (zcc_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (zcc_array*)[[[zcc_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (zcc_arrayBuilder*) builder { return [[zcc_arrayBuilder alloc] init]; } + (zcc_arrayBuilder*) builderWithPrototype:(zcc_array*) prototype { return [[zcc_array builder] mergeFrom:prototype]; } - (zcc_arrayBuilder*) builder { return [zcc_array builder]; } - (zcc_arrayBuilder*) toBuilder { return [zcc_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(zcc *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (zcc* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[zcc_array class]]) { return NO; } zcc_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(zcc *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface zcc_arrayBuilder() @property (strong) zcc_array* resultZccArray; @end @implementation zcc_arrayBuilder @synthesize resultZccArray; - (instancetype) init { if ((self = [super init])) { self.resultZccArray = [[zcc_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultZccArray; } - (zcc_arrayBuilder*) clear { self.resultZccArray = [[zcc_array alloc] init]; return self; } - (zcc_arrayBuilder*) clone { return [zcc_array builderWithPrototype:resultZccArray]; } - (zcc_array*) defaultInstance { return [zcc_array defaultInstance]; } - (zcc_array*) build { [self checkInitialized]; return [self buildPartial]; } - (zcc_array*) buildPartial { zcc_array* returnMe = resultZccArray; self.resultZccArray = nil; return returnMe; } - (zcc_arrayBuilder*) mergeFrom:(zcc_array*) other { if (other == [zcc_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultZccArray.indexDataArray == nil) { resultZccArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultZccArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (zcc_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (zcc_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { zccBuilder* subBuilder = [zcc builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultZccArray.indexDataArray; } - (zcc*)indexDataAtIndex:(NSUInteger)index { return [resultZccArray indexDataAtIndex:index]; } - (zcc_arrayBuilder *)addIndexData:(zcc*)value { if (resultZccArray.indexDataArray == nil) { resultZccArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultZccArray.indexDataArray addObject:value]; return self; } - (zcc_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultZccArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (zcc_arrayBuilder *)clearIndexData { resultZccArray.indexDataArray = nil; return self; } @end @interface hyxd () @property UInt32 time; @property UInt32 mx; @property UInt32 nx; @property UInt32 ssrgl; @property UInt32 j; @end @implementation hyxd - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasMx { return !!hasMx_; } - (void) setHasMx:(BOOL) _value_ { hasMx_ = !!_value_; } @synthesize mx; - (BOOL) hasNx { return !!hasNx_; } - (void) setHasNx:(BOOL) _value_ { hasNx_ = !!_value_; } @synthesize nx; - (BOOL) hasSsrgl { return !!hasSsrgl_; } - (void) setHasSsrgl:(BOOL) _value_ { hasSsrgl_ = !!_value_; } @synthesize ssrgl; - (BOOL) hasJ { return !!hasJ_; } - (void) setHasJ:(BOOL) _value_ { hasJ_ = !!_value_; } @synthesize j; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.mx = 0; self.nx = 0; self.ssrgl = 0; self.j = 0; } return self; } static hyxd* defaulthyxdInstance = nil; + (void) initialize { if (self == [hyxd class]) { defaulthyxdInstance = [[hyxd alloc] init]; } } + (instancetype) defaultInstance { return defaulthyxdInstance; } - (instancetype) defaultInstance { return defaulthyxdInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasMx) { return NO; } if (!self.hasNx) { return NO; } if (!self.hasSsrgl) { return NO; } if (!self.hasJ) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasMx) { [output writeUInt32:2 value:self.mx]; } if (self.hasNx) { [output writeUInt32:3 value:self.nx]; } if (self.hasSsrgl) { [output writeUInt32:4 value:self.ssrgl]; } if (self.hasJ) { [output writeUInt32:5 value:self.j]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasMx) { size_ += computeUInt32Size(2, self.mx); } if (self.hasNx) { size_ += computeUInt32Size(3, self.nx); } if (self.hasSsrgl) { size_ += computeUInt32Size(4, self.ssrgl); } if (self.hasJ) { size_ += computeUInt32Size(5, self.j); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (hyxd*) parseFromData:(NSData*) data { return (hyxd*)[[[hyxd builder] mergeFromData:data] build]; } + (hyxd*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hyxd*)[[[hyxd builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (hyxd*) parseFromInputStream:(NSInputStream*) input { return (hyxd*)[[[hyxd builder] mergeFromInputStream:input] build]; } + (hyxd*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hyxd*)[[[hyxd builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (hyxd*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (hyxd*)[[[hyxd builder] mergeFromCodedInputStream:input] build]; } + (hyxd*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hyxd*)[[[hyxd builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (hyxdBuilder*) builder { return [[hyxdBuilder alloc] init]; } + (hyxdBuilder*) builderWithPrototype:(hyxd*) prototype { return [[hyxd builder] mergeFrom:prototype]; } - (hyxdBuilder*) builder { return [hyxd builder]; } - (hyxdBuilder*) toBuilder { return [hyxd builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasMx) { [output appendFormat:@"%@%@: %@\n", indent, @"mx", [NSNumber numberWithInteger:self.mx]]; } if (self.hasNx) { [output appendFormat:@"%@%@: %@\n", indent, @"nx", [NSNumber numberWithInteger:self.nx]]; } if (self.hasSsrgl) { [output appendFormat:@"%@%@: %@\n", indent, @"ssrgl", [NSNumber numberWithInteger:self.ssrgl]]; } if (self.hasJ) { [output appendFormat:@"%@%@: %@\n", indent, @"j", [NSNumber numberWithInteger:self.j]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasMx) { [dictionary setObject: [NSNumber numberWithInteger:self.mx] forKey: @"mx"]; } if (self.hasNx) { [dictionary setObject: [NSNumber numberWithInteger:self.nx] forKey: @"nx"]; } if (self.hasSsrgl) { [dictionary setObject: [NSNumber numberWithInteger:self.ssrgl] forKey: @"ssrgl"]; } if (self.hasJ) { [dictionary setObject: [NSNumber numberWithInteger:self.j] forKey: @"j"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[hyxd class]]) { return NO; } hyxd *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasMx == otherMessage.hasMx && (!self.hasMx || self.mx == otherMessage.mx) && self.hasNx == otherMessage.hasNx && (!self.hasNx || self.nx == otherMessage.nx) && self.hasSsrgl == otherMessage.hasSsrgl && (!self.hasSsrgl || self.ssrgl == otherMessage.ssrgl) && self.hasJ == otherMessage.hasJ && (!self.hasJ || self.j == otherMessage.j) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasMx) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.mx] hash]; } if (self.hasNx) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.nx] hash]; } if (self.hasSsrgl) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.ssrgl] hash]; } if (self.hasJ) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.j] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface hyxdBuilder() @property (strong) hyxd* resultHyxd; @end @implementation hyxdBuilder @synthesize resultHyxd; - (instancetype) init { if ((self = [super init])) { self.resultHyxd = [[hyxd alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultHyxd; } - (hyxdBuilder*) clear { self.resultHyxd = [[hyxd alloc] init]; return self; } - (hyxdBuilder*) clone { return [hyxd builderWithPrototype:resultHyxd]; } - (hyxd*) defaultInstance { return [hyxd defaultInstance]; } - (hyxd*) build { [self checkInitialized]; return [self buildPartial]; } - (hyxd*) buildPartial { hyxd* returnMe = resultHyxd; self.resultHyxd = nil; return returnMe; } - (hyxdBuilder*) mergeFrom:(hyxd*) other { if (other == [hyxd defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasMx) { [self setMx:other.mx]; } if (other.hasNx) { [self setNx:other.nx]; } if (other.hasSsrgl) { [self setSsrgl:other.ssrgl]; } if (other.hasJ) { [self setJ:other.j]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (hyxdBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (hyxdBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 16: { [self setMx:[input readUInt32]]; break; } case 24: { [self setNx:[input readUInt32]]; break; } case 32: { [self setSsrgl:[input readUInt32]]; break; } case 40: { [self setJ:[input readUInt32]]; break; } } } } - (BOOL) hasTime { return resultHyxd.hasTime; } - (UInt32) time { return resultHyxd.time; } - (hyxdBuilder*) setTime:(UInt32) value { resultHyxd.hasTime = YES; resultHyxd.time = value; return self; } - (hyxdBuilder*) clearTime { resultHyxd.hasTime = NO; resultHyxd.time = 0; return self; } - (BOOL) hasMx { return resultHyxd.hasMx; } - (UInt32) mx { return resultHyxd.mx; } - (hyxdBuilder*) setMx:(UInt32) value { resultHyxd.hasMx = YES; resultHyxd.mx = value; return self; } - (hyxdBuilder*) clearMx { resultHyxd.hasMx = NO; resultHyxd.mx = 0; return self; } - (BOOL) hasNx { return resultHyxd.hasNx; } - (UInt32) nx { return resultHyxd.nx; } - (hyxdBuilder*) setNx:(UInt32) value { resultHyxd.hasNx = YES; resultHyxd.nx = value; return self; } - (hyxdBuilder*) clearNx { resultHyxd.hasNx = NO; resultHyxd.nx = 0; return self; } - (BOOL) hasSsrgl { return resultHyxd.hasSsrgl; } - (UInt32) ssrgl { return resultHyxd.ssrgl; } - (hyxdBuilder*) setSsrgl:(UInt32) value { resultHyxd.hasSsrgl = YES; resultHyxd.ssrgl = value; return self; } - (hyxdBuilder*) clearSsrgl { resultHyxd.hasSsrgl = NO; resultHyxd.ssrgl = 0; return self; } - (BOOL) hasJ { return resultHyxd.hasJ; } - (UInt32) j { return resultHyxd.j; } - (hyxdBuilder*) setJ:(UInt32) value { resultHyxd.hasJ = YES; resultHyxd.j = value; return self; } - (hyxdBuilder*) clearJ { resultHyxd.hasJ = NO; resultHyxd.j = 0; return self; } @end @interface hyxd_array () @property (strong) NSMutableArray * indexDataArray; @end @implementation hyxd_array @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static hyxd_array* defaulthyxd_arrayInstance = nil; + (void) initialize { if (self == [hyxd_array class]) { defaulthyxd_arrayInstance = [[hyxd_array alloc] init]; } } + (instancetype) defaultInstance { return defaulthyxd_arrayInstance; } - (instancetype) defaultInstance { return defaulthyxd_arrayInstance; } - (NSArray *)indexData { return indexDataArray; } - (hyxd*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(hyxd *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(hyxd *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(hyxd *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (hyxd_array*) parseFromData:(NSData*) data { return (hyxd_array*)[[[hyxd_array builder] mergeFromData:data] build]; } + (hyxd_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hyxd_array*)[[[hyxd_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (hyxd_array*) parseFromInputStream:(NSInputStream*) input { return (hyxd_array*)[[[hyxd_array builder] mergeFromInputStream:input] build]; } + (hyxd_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hyxd_array*)[[[hyxd_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (hyxd_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (hyxd_array*)[[[hyxd_array builder] mergeFromCodedInputStream:input] build]; } + (hyxd_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (hyxd_array*)[[[hyxd_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (hyxd_arrayBuilder*) builder { return [[hyxd_arrayBuilder alloc] init]; } + (hyxd_arrayBuilder*) builderWithPrototype:(hyxd_array*) prototype { return [[hyxd_array builder] mergeFrom:prototype]; } - (hyxd_arrayBuilder*) builder { return [hyxd_array builder]; } - (hyxd_arrayBuilder*) toBuilder { return [hyxd_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(hyxd *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (hyxd* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[hyxd_array class]]) { return NO; } hyxd_array *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(hyxd *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface hyxd_arrayBuilder() @property (strong) hyxd_array* resultHyxdArray; @end @implementation hyxd_arrayBuilder @synthesize resultHyxdArray; - (instancetype) init { if ((self = [super init])) { self.resultHyxdArray = [[hyxd_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultHyxdArray; } - (hyxd_arrayBuilder*) clear { self.resultHyxdArray = [[hyxd_array alloc] init]; return self; } - (hyxd_arrayBuilder*) clone { return [hyxd_array builderWithPrototype:resultHyxdArray]; } - (hyxd_array*) defaultInstance { return [hyxd_array defaultInstance]; } - (hyxd_array*) build { [self checkInitialized]; return [self buildPartial]; } - (hyxd_array*) buildPartial { hyxd_array* returnMe = resultHyxdArray; self.resultHyxdArray = nil; return returnMe; } - (hyxd_arrayBuilder*) mergeFrom:(hyxd_array*) other { if (other == [hyxd_array defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultHyxdArray.indexDataArray == nil) { resultHyxdArray.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultHyxdArray.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (hyxd_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (hyxd_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { hyxdBuilder* subBuilder = [hyxd builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultHyxdArray.indexDataArray; } - (hyxd*)indexDataAtIndex:(NSUInteger)index { return [resultHyxdArray indexDataAtIndex:index]; } - (hyxd_arrayBuilder *)addIndexData:(hyxd*)value { if (resultHyxdArray.indexDataArray == nil) { resultHyxdArray.indexDataArray = [[NSMutableArray alloc]init]; } [resultHyxdArray.indexDataArray addObject:value]; return self; } - (hyxd_arrayBuilder *)setIndexDataArray:(NSArray *)array { resultHyxdArray.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (hyxd_arrayBuilder *)clearIndexData { resultHyxdArray.indexDataArray = nil; return self; } @end @interface ma_param () @property (strong) PBAppendableArray * countArray; @end @implementation ma_param @synthesize countArray; @dynamic count; - (instancetype) init { if ((self = [super init])) { } return self; } static ma_param* defaultma_paramInstance = nil; + (void) initialize { if (self == [ma_param class]) { defaultma_paramInstance = [[ma_param alloc] init]; } } + (instancetype) defaultInstance { return defaultma_paramInstance; } - (instancetype) defaultInstance { return defaultma_paramInstance; } - (PBArray *)count { return countArray; } - (UInt32)countAtIndex:(NSUInteger)index { return [countArray uint32AtIndex:index]; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { const NSUInteger countArrayCount = self.countArray.count; if (countArrayCount > 0) { const UInt32 *values = (const UInt32 *)self.countArray.data; for (NSUInteger i = 0; i < countArrayCount; ++i) { [output writeUInt32:1 value:values[i]]; } } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; { __block SInt32 dataSize = 0; const NSUInteger count = self.countArray.count; const UInt32 *values = (const UInt32 *)self.countArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeUInt32SizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ma_param*) parseFromData:(NSData*) data { return (ma_param*)[[[ma_param builder] mergeFromData:data] build]; } + (ma_param*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma_param*)[[[ma_param builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ma_param*) parseFromInputStream:(NSInputStream*) input { return (ma_param*)[[[ma_param builder] mergeFromInputStream:input] build]; } + (ma_param*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma_param*)[[[ma_param builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ma_param*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ma_param*)[[[ma_param builder] mergeFromCodedInputStream:input] build]; } + (ma_param*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma_param*)[[[ma_param builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (ma_paramBuilder*) builder { return [[ma_paramBuilder alloc] init]; } + (ma_paramBuilder*) builderWithPrototype:(ma_param*) prototype { return [[ma_param builder] mergeFrom:prototype]; } - (ma_paramBuilder*) builder { return [ma_param builder]; } - (ma_paramBuilder*) toBuilder { return [ma_param builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.countArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"count", obj]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { NSMutableArray * countArrayArray = [NSMutableArray new]; NSUInteger countArrayCount=self.countArray.count; for(int i=0;i 0) { if (resultMaParam.countArray == nil) { resultMaParam.countArray = [other.countArray copy]; } else { [resultMaParam.countArray appendArray:other.countArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (ma_paramBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (ma_paramBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self addCount:[input readUInt32]]; break; } } } } - (PBAppendableArray *)count { return resultMaParam.countArray; } - (UInt32)countAtIndex:(NSUInteger)index { return [resultMaParam countAtIndex:index]; } - (ma_paramBuilder *)addCount:(UInt32)value { if (resultMaParam.countArray == nil) { resultMaParam.countArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeUInt32]; } [resultMaParam.countArray addUint32:value]; return self; } - (ma_paramBuilder *)setCountArray:(NSArray *)array { resultMaParam.countArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeUInt32]; return self; } - (ma_paramBuilder *)setCountValues:(const UInt32 *)values count:(NSUInteger)count { resultMaParam.countArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeUInt32]; return self; } - (ma_paramBuilder *)clearCount { resultMaParam.countArray = nil; return self; } @end @interface ma () @property UInt32 time; @property (strong) PBAppendableArray * maValueArray; @end @implementation ma - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; @synthesize maValueArray; @dynamic maValue; - (instancetype) init { if ((self = [super init])) { self.time = 0; } return self; } static ma* defaultmaInstance = nil; + (void) initialize { if (self == [ma class]) { defaultmaInstance = [[ma alloc] init]; } } + (instancetype) defaultInstance { return defaultmaInstance; } - (instancetype) defaultInstance { return defaultmaInstance; } - (PBArray *)maValue { return maValueArray; } - (Float64)maValueAtIndex:(NSUInteger)index { return [maValueArray doubleAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } const NSUInteger maValueArrayCount = self.maValueArray.count; if (maValueArrayCount > 0) { const Float64 *values = (const Float64 *)self.maValueArray.data; for (NSUInteger i = 0; i < maValueArrayCount; ++i) { [output writeDouble:2 value:values[i]]; } } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } { __block SInt32 dataSize = 0; const NSUInteger count = self.maValueArray.count; dataSize = (SInt32)(8 * count); size_ += dataSize; size_ += (SInt32)(1 * count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ma*) parseFromData:(NSData*) data { return (ma*)[[[ma builder] mergeFromData:data] build]; } + (ma*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma*)[[[ma builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ma*) parseFromInputStream:(NSInputStream*) input { return (ma*)[[[ma builder] mergeFromInputStream:input] build]; } + (ma*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma*)[[[ma builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ma*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ma*)[[[ma builder] mergeFromCodedInputStream:input] build]; } + (ma*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma*)[[[ma builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (maBuilder*) builder { return [[maBuilder alloc] init]; } + (maBuilder*) builderWithPrototype:(ma*) prototype { return [[ma builder] mergeFrom:prototype]; } - (maBuilder*) builder { return [ma builder]; } - (maBuilder*) toBuilder { return [ma builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } [self.maValueArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"maValue", obj]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } NSMutableArray * maValueArrayArray = [NSMutableArray new]; NSUInteger maValueArrayCount=self.maValueArray.count; for(int i=0;i 0) { if (resultMa.maValueArray == nil) { resultMa.maValueArray = [other.maValueArray copy]; } else { [resultMa.maValueArray appendArray:other.maValueArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (maBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (maBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self addMaValue:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultMa.hasTime; } - (UInt32) time { return resultMa.time; } - (maBuilder*) setTime:(UInt32) value { resultMa.hasTime = YES; resultMa.time = value; return self; } - (maBuilder*) clearTime { resultMa.hasTime = NO; resultMa.time = 0; return self; } - (PBAppendableArray *)maValue { return resultMa.maValueArray; } - (Float64)maValueAtIndex:(NSUInteger)index { return [resultMa maValueAtIndex:index]; } - (maBuilder *)addMaValue:(Float64)value { if (resultMa.maValueArray == nil) { resultMa.maValueArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeDouble]; } [resultMa.maValueArray addDouble:value]; return self; } - (maBuilder *)setMaValueArray:(NSArray *)array { resultMa.maValueArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeDouble]; return self; } - (maBuilder *)setMaValueValues:(const Float64 *)values count:(NSUInteger)count { resultMa.maValueArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeDouble]; return self; } - (maBuilder *)clearMaValue { resultMa.maValueArray = nil; return self; } @end @interface ma_array () @property (strong) NSMutableArray * maDataArray; @end @implementation ma_array @synthesize maDataArray; @dynamic maData; - (instancetype) init { if ((self = [super init])) { } return self; } static ma_array* defaultma_arrayInstance = nil; + (void) initialize { if (self == [ma_array class]) { defaultma_arrayInstance = [[ma_array alloc] init]; } } + (instancetype) defaultInstance { return defaultma_arrayInstance; } - (instancetype) defaultInstance { return defaultma_arrayInstance; } - (NSArray *)maData { return maDataArray; } - (ma*)maDataAtIndex:(NSUInteger)index { return [maDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitmaData = YES; [self.maData enumerateObjectsUsingBlock:^(ma *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitmaData = NO; *stop = YES; } }]; if (!isInitmaData) return isInitmaData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.maDataArray enumerateObjectsUsingBlock:^(ma *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.maDataArray enumerateObjectsUsingBlock:^(ma *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (ma_array*) parseFromData:(NSData*) data { return (ma_array*)[[[ma_array builder] mergeFromData:data] build]; } + (ma_array*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma_array*)[[[ma_array builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (ma_array*) parseFromInputStream:(NSInputStream*) input { return (ma_array*)[[[ma_array builder] mergeFromInputStream:input] build]; } + (ma_array*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma_array*)[[[ma_array builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (ma_array*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (ma_array*)[[[ma_array builder] mergeFromCodedInputStream:input] build]; } + (ma_array*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (ma_array*)[[[ma_array builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (ma_arrayBuilder*) builder { return [[ma_arrayBuilder alloc] init]; } + (ma_arrayBuilder*) builderWithPrototype:(ma_array*) prototype { return [[ma_array builder] mergeFrom:prototype]; } - (ma_arrayBuilder*) builder { return [ma_array builder]; } - (ma_arrayBuilder*) toBuilder { return [ma_array builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.maDataArray enumerateObjectsUsingBlock:^(ma *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"maData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (ma* element in self.maDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"maData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[ma_array class]]) { return NO; } ma_array *otherMessage = other; return [self.maDataArray isEqualToArray:otherMessage.maDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.maDataArray enumerateObjectsUsingBlock:^(ma *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface ma_arrayBuilder() @property (strong) ma_array* resultMaArray; @end @implementation ma_arrayBuilder @synthesize resultMaArray; - (instancetype) init { if ((self = [super init])) { self.resultMaArray = [[ma_array alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultMaArray; } - (ma_arrayBuilder*) clear { self.resultMaArray = [[ma_array alloc] init]; return self; } - (ma_arrayBuilder*) clone { return [ma_array builderWithPrototype:resultMaArray]; } - (ma_array*) defaultInstance { return [ma_array defaultInstance]; } - (ma_array*) build { [self checkInitialized]; return [self buildPartial]; } - (ma_array*) buildPartial { ma_array* returnMe = resultMaArray; self.resultMaArray = nil; return returnMe; } - (ma_arrayBuilder*) mergeFrom:(ma_array*) other { if (other == [ma_array defaultInstance]) { return self; } if (other.maDataArray.count > 0) { if (resultMaArray.maDataArray == nil) { resultMaArray.maDataArray = [[NSMutableArray alloc] initWithArray:other.maDataArray]; } else { [resultMaArray.maDataArray addObjectsFromArray:other.maDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (ma_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (ma_arrayBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { maBuilder* subBuilder = [ma builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addMaData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)maData { return resultMaArray.maDataArray; } - (ma*)maDataAtIndex:(NSUInteger)index { return [resultMaArray maDataAtIndex:index]; } - (ma_arrayBuilder *)addMaData:(ma*)value { if (resultMaArray.maDataArray == nil) { resultMaArray.maDataArray = [[NSMutableArray alloc]init]; } [resultMaArray.maDataArray addObject:value]; return self; } - (ma_arrayBuilder *)setMaDataArray:(NSArray *)array { resultMaArray.maDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (ma_arrayBuilder *)clearMaData { resultMaArray.maDataArray = nil; return self; } @end @interface index_data_result_msg () @property enum_index name; @property (strong) NSString* stockCode; @property index_data_type cycleType; @property (strong) NSData* body; @end @implementation index_data_result_msg - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasStockCode { return !!hasStockCode_; } - (void) setHasStockCode:(BOOL) _value_ { hasStockCode_ = !!_value_; } @synthesize stockCode; - (BOOL) hasCycleType { return !!hasCycleType_; } - (void) setHasCycleType:(BOOL) _value_ { hasCycleType_ = !!_value_; } @synthesize cycleType; - (BOOL) hasBody { return !!hasBody_; } - (void) setHasBody:(BOOL) _value_ { hasBody_ = !!_value_; } @synthesize body; - (instancetype) init { if ((self = [super init])) { self.name = enum_indexBeginIndexEnum; self.stockCode = @""; self.cycleType = index_data_typeCycleBegin; self.body = [NSData data]; } return self; } static index_data_result_msg* defaultindex_data_result_msgInstance = nil; + (void) initialize { if (self == [index_data_result_msg class]) { defaultindex_data_result_msgInstance = [[index_data_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultindex_data_result_msgInstance; } - (instancetype) defaultInstance { return defaultindex_data_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasName) { return NO; } if (!self.hasStockCode) { return NO; } if (!self.hasCycleType) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasName) { [output writeEnum:1 value:self.name]; } if (self.hasStockCode) { [output writeString:2 value:self.stockCode]; } if (self.hasCycleType) { [output writeEnum:3 value:self.cycleType]; } if (self.hasBody) { [output writeData:4 value:self.body]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasName) { size_ += computeEnumSize(1, self.name); } if (self.hasStockCode) { size_ += computeStringSize(2, self.stockCode); } if (self.hasCycleType) { size_ += computeEnumSize(3, self.cycleType); } if (self.hasBody) { size_ += computeDataSize(4, self.body); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (index_data_result_msg*) parseFromData:(NSData*) data { return (index_data_result_msg*)[[[index_data_result_msg builder] mergeFromData:data] build]; } + (index_data_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (index_data_result_msg*)[[[index_data_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (index_data_result_msg*) parseFromInputStream:(NSInputStream*) input { return (index_data_result_msg*)[[[index_data_result_msg builder] mergeFromInputStream:input] build]; } + (index_data_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (index_data_result_msg*)[[[index_data_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (index_data_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (index_data_result_msg*)[[[index_data_result_msg builder] mergeFromCodedInputStream:input] build]; } + (index_data_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (index_data_result_msg*)[[[index_data_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (index_data_result_msgBuilder*) builder { return [[index_data_result_msgBuilder alloc] init]; } + (index_data_result_msgBuilder*) builderWithPrototype:(index_data_result_msg*) prototype { return [[index_data_result_msg builder] mergeFrom:prototype]; } - (index_data_result_msgBuilder*) builder { return [index_data_result_msg builder]; } - (index_data_result_msgBuilder*) toBuilder { return [index_data_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", NSStringFromenum_index(self.name)]; } if (self.hasStockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", self.stockCode]; } if (self.hasCycleType) { [output appendFormat:@"%@%@: %@\n", indent, @"cycleType", NSStringFromindex_data_type(self.cycleType)]; } if (self.hasBody) { [output appendFormat:@"%@%@: %@\n", indent, @"body", self.body]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasName) { [dictionary setObject: @(self.name) forKey: @"name"]; } if (self.hasStockCode) { [dictionary setObject: self.stockCode forKey: @"stockCode"]; } if (self.hasCycleType) { [dictionary setObject: @(self.cycleType) forKey: @"cycleType"]; } if (self.hasBody) { [dictionary setObject: self.body forKey: @"body"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[index_data_result_msg class]]) { return NO; } index_data_result_msg *otherMessage = other; return self.hasName == otherMessage.hasName && (!self.hasName || self.name == otherMessage.name) && self.hasStockCode == otherMessage.hasStockCode && (!self.hasStockCode || [self.stockCode isEqual:otherMessage.stockCode]) && self.hasCycleType == otherMessage.hasCycleType && (!self.hasCycleType || self.cycleType == otherMessage.cycleType) && self.hasBody == otherMessage.hasBody && (!self.hasBody || [self.body isEqual:otherMessage.body]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasName) { hashCode = hashCode * 31 + self.name; } if (self.hasStockCode) { hashCode = hashCode * 31 + [self.stockCode hash]; } if (self.hasCycleType) { hashCode = hashCode * 31 + self.cycleType; } if (self.hasBody) { hashCode = hashCode * 31 + [self.body hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface index_data_result_msgBuilder() @property (strong) index_data_result_msg* resultIndexDataResultMsg; @end @implementation index_data_result_msgBuilder @synthesize resultIndexDataResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultIndexDataResultMsg = [[index_data_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultIndexDataResultMsg; } - (index_data_result_msgBuilder*) clear { self.resultIndexDataResultMsg = [[index_data_result_msg alloc] init]; return self; } - (index_data_result_msgBuilder*) clone { return [index_data_result_msg builderWithPrototype:resultIndexDataResultMsg]; } - (index_data_result_msg*) defaultInstance { return [index_data_result_msg defaultInstance]; } - (index_data_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (index_data_result_msg*) buildPartial { index_data_result_msg* returnMe = resultIndexDataResultMsg; self.resultIndexDataResultMsg = nil; return returnMe; } - (index_data_result_msgBuilder*) mergeFrom:(index_data_result_msg*) other { if (other == [index_data_result_msg defaultInstance]) { return self; } if (other.hasName) { [self setName:other.name]; } if (other.hasStockCode) { [self setStockCode:other.stockCode]; } if (other.hasCycleType) { [self setCycleType:other.cycleType]; } if (other.hasBody) { [self setBody:other.body]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (index_data_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (index_data_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { enum_index value = (enum_index)[input readEnum]; if (enum_indexIsValidValue(value)) { [self setName:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setStockCode:[input readString]]; break; } case 24: { index_data_type value = (index_data_type)[input readEnum]; if (index_data_typeIsValidValue(value)) { [self setCycleType:value]; } else { [unknownFields mergeVarintField:3 value:value]; } break; } case 34: { [self setBody:[input readData]]; break; } } } } - (BOOL) hasName { return resultIndexDataResultMsg.hasName; } - (enum_index) name { return resultIndexDataResultMsg.name; } - (index_data_result_msgBuilder*) setName:(enum_index) value { resultIndexDataResultMsg.hasName = YES; resultIndexDataResultMsg.name = value; return self; } - (index_data_result_msgBuilder*) clearName { resultIndexDataResultMsg.hasName = NO; resultIndexDataResultMsg.name = enum_indexBeginIndexEnum; return self; } - (BOOL) hasStockCode { return resultIndexDataResultMsg.hasStockCode; } - (NSString*) stockCode { return resultIndexDataResultMsg.stockCode; } - (index_data_result_msgBuilder*) setStockCode:(NSString*) value { resultIndexDataResultMsg.hasStockCode = YES; resultIndexDataResultMsg.stockCode = value; return self; } - (index_data_result_msgBuilder*) clearStockCode { resultIndexDataResultMsg.hasStockCode = NO; resultIndexDataResultMsg.stockCode = @""; return self; } - (BOOL) hasCycleType { return resultIndexDataResultMsg.hasCycleType; } - (index_data_type) cycleType { return resultIndexDataResultMsg.cycleType; } - (index_data_result_msgBuilder*) setCycleType:(index_data_type) value { resultIndexDataResultMsg.hasCycleType = YES; resultIndexDataResultMsg.cycleType = value; return self; } - (index_data_result_msgBuilder*) clearCycleType { resultIndexDataResultMsg.hasCycleType = NO; resultIndexDataResultMsg.cycleType = index_data_typeCycleBegin; return self; } - (BOOL) hasBody { return resultIndexDataResultMsg.hasBody; } - (NSData*) body { return resultIndexDataResultMsg.body; } - (index_data_result_msgBuilder*) setBody:(NSData*) value { resultIndexDataResultMsg.hasBody = YES; resultIndexDataResultMsg.body = value; return self; } - (index_data_result_msgBuilder*) clearBody { resultIndexDataResultMsg.hasBody = NO; resultIndexDataResultMsg.body = [NSData data]; return self; } @end @interface client_request_rise_drop_msg () @property UInt32 begin; @property UInt32 end; @property (strong) data_selector* selector; @end @implementation client_request_rise_drop_msg - (BOOL) hasBegin { return !!hasBegin_; } - (void) setHasBegin:(BOOL) _value_ { hasBegin_ = !!_value_; } @synthesize begin; - (BOOL) hasEnd { return !!hasEnd_; } - (void) setHasEnd:(BOOL) _value_ { hasEnd_ = !!_value_; } @synthesize end; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (instancetype) init { if ((self = [super init])) { self.begin = 0; self.end = 0; self.selector = [data_selector defaultInstance]; } return self; } static client_request_rise_drop_msg* defaultclient_request_rise_drop_msgInstance = nil; + (void) initialize { if (self == [client_request_rise_drop_msg class]) { defaultclient_request_rise_drop_msgInstance = [[client_request_rise_drop_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultclient_request_rise_drop_msgInstance; } - (instancetype) defaultInstance { return defaultclient_request_rise_drop_msgInstance; } - (BOOL) isInitialized { if (!self.hasBegin) { return NO; } if (!self.hasEnd) { return NO; } if (self.hasSelector) { if (!self.selector.isInitialized) { return NO; } } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasBegin) { [output writeUInt32:1 value:self.begin]; } if (self.hasEnd) { [output writeUInt32:2 value:self.end]; } if (self.hasSelector) { [output writeMessage:4 value:self.selector]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasBegin) { size_ += computeUInt32Size(1, self.begin); } if (self.hasEnd) { size_ += computeUInt32Size(2, self.end); } if (self.hasSelector) { size_ += computeMessageSize(4, self.selector); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (client_request_rise_drop_msg*) parseFromData:(NSData*) data { return (client_request_rise_drop_msg*)[[[client_request_rise_drop_msg builder] mergeFromData:data] build]; } + (client_request_rise_drop_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_rise_drop_msg*)[[[client_request_rise_drop_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (client_request_rise_drop_msg*) parseFromInputStream:(NSInputStream*) input { return (client_request_rise_drop_msg*)[[[client_request_rise_drop_msg builder] mergeFromInputStream:input] build]; } + (client_request_rise_drop_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_rise_drop_msg*)[[[client_request_rise_drop_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_request_rise_drop_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (client_request_rise_drop_msg*)[[[client_request_rise_drop_msg builder] mergeFromCodedInputStream:input] build]; } + (client_request_rise_drop_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (client_request_rise_drop_msg*)[[[client_request_rise_drop_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (client_request_rise_drop_msgBuilder*) builder { return [[client_request_rise_drop_msgBuilder alloc] init]; } + (client_request_rise_drop_msgBuilder*) builderWithPrototype:(client_request_rise_drop_msg*) prototype { return [[client_request_rise_drop_msg builder] mergeFrom:prototype]; } - (client_request_rise_drop_msgBuilder*) builder { return [client_request_rise_drop_msg builder]; } - (client_request_rise_drop_msgBuilder*) toBuilder { return [client_request_rise_drop_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasBegin) { [output appendFormat:@"%@%@: %@\n", indent, @"begin", [NSNumber numberWithInteger:self.begin]]; } if (self.hasEnd) { [output appendFormat:@"%@%@: %@\n", indent, @"end", [NSNumber numberWithInteger:self.end]]; } if (self.hasSelector) { [output appendFormat:@"%@%@ {\n", indent, @"selector"]; [self.selector writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasBegin) { [dictionary setObject: [NSNumber numberWithInteger:self.begin] forKey: @"begin"]; } if (self.hasEnd) { [dictionary setObject: [NSNumber numberWithInteger:self.end] forKey: @"end"]; } if (self.hasSelector) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.selector storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"selector"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[client_request_rise_drop_msg class]]) { return NO; } client_request_rise_drop_msg *otherMessage = other; return self.hasBegin == otherMessage.hasBegin && (!self.hasBegin || self.begin == otherMessage.begin) && self.hasEnd == otherMessage.hasEnd && (!self.hasEnd || self.end == otherMessage.end) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasBegin) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.begin] hash]; } if (self.hasEnd) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.end] hash]; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface client_request_rise_drop_msgBuilder() @property (strong) client_request_rise_drop_msg* resultClientRequestRiseDropMsg; @end @implementation client_request_rise_drop_msgBuilder @synthesize resultClientRequestRiseDropMsg; - (instancetype) init { if ((self = [super init])) { self.resultClientRequestRiseDropMsg = [[client_request_rise_drop_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultClientRequestRiseDropMsg; } - (client_request_rise_drop_msgBuilder*) clear { self.resultClientRequestRiseDropMsg = [[client_request_rise_drop_msg alloc] init]; return self; } - (client_request_rise_drop_msgBuilder*) clone { return [client_request_rise_drop_msg builderWithPrototype:resultClientRequestRiseDropMsg]; } - (client_request_rise_drop_msg*) defaultInstance { return [client_request_rise_drop_msg defaultInstance]; } - (client_request_rise_drop_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (client_request_rise_drop_msg*) buildPartial { client_request_rise_drop_msg* returnMe = resultClientRequestRiseDropMsg; self.resultClientRequestRiseDropMsg = nil; return returnMe; } - (client_request_rise_drop_msgBuilder*) mergeFrom:(client_request_rise_drop_msg*) other { if (other == [client_request_rise_drop_msg defaultInstance]) { return self; } if (other.hasBegin) { [self setBegin:other.begin]; } if (other.hasEnd) { [self setEnd:other.end]; } if (other.hasSelector) { [self mergeSelector:other.selector]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (client_request_rise_drop_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (client_request_rise_drop_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setBegin:[input readUInt32]]; break; } case 16: { [self setEnd:[input readUInt32]]; break; } case 34: { data_selectorBuilder* subBuilder = [data_selector builder]; if (self.hasSelector) { [subBuilder mergeFrom:self.selector]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSelector:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasBegin { return resultClientRequestRiseDropMsg.hasBegin; } - (UInt32) begin { return resultClientRequestRiseDropMsg.begin; } - (client_request_rise_drop_msgBuilder*) setBegin:(UInt32) value { resultClientRequestRiseDropMsg.hasBegin = YES; resultClientRequestRiseDropMsg.begin = value; return self; } - (client_request_rise_drop_msgBuilder*) clearBegin { resultClientRequestRiseDropMsg.hasBegin = NO; resultClientRequestRiseDropMsg.begin = 0; return self; } - (BOOL) hasEnd { return resultClientRequestRiseDropMsg.hasEnd; } - (UInt32) end { return resultClientRequestRiseDropMsg.end; } - (client_request_rise_drop_msgBuilder*) setEnd:(UInt32) value { resultClientRequestRiseDropMsg.hasEnd = YES; resultClientRequestRiseDropMsg.end = value; return self; } - (client_request_rise_drop_msgBuilder*) clearEnd { resultClientRequestRiseDropMsg.hasEnd = NO; resultClientRequestRiseDropMsg.end = 0; return self; } - (BOOL) hasSelector { return resultClientRequestRiseDropMsg.hasSelector; } - (data_selector*) selector { return resultClientRequestRiseDropMsg.selector; } - (client_request_rise_drop_msgBuilder*) setSelector:(data_selector*) value { resultClientRequestRiseDropMsg.hasSelector = YES; resultClientRequestRiseDropMsg.selector = value; return self; } - (client_request_rise_drop_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue { return [self setSelector:[builderForValue build]]; } - (client_request_rise_drop_msgBuilder*) mergeSelector:(data_selector*) value { if (resultClientRequestRiseDropMsg.hasSelector && resultClientRequestRiseDropMsg.selector != [data_selector defaultInstance]) { resultClientRequestRiseDropMsg.selector = [[[data_selector builderWithPrototype:resultClientRequestRiseDropMsg.selector] mergeFrom:value] buildPartial]; } else { resultClientRequestRiseDropMsg.selector = value; } resultClientRequestRiseDropMsg.hasSelector = YES; return self; } - (client_request_rise_drop_msgBuilder*) clearSelector { resultClientRequestRiseDropMsg.hasSelector = NO; resultClientRequestRiseDropMsg.selector = [data_selector defaultInstance]; return self; } @end @interface rise_drop_data () @property UInt32 time; @property UInt32 szaRiseCount; @property UInt32 szaDropCount; @property UInt32 szaUnchangeCount; @property UInt32 shaRiseCount; @property UInt32 shaDropCount; @property UInt32 shaUnchangeCount; @property UInt32 gemRiseCount; @property UInt32 gemDropCount; @property UInt32 gemUnchangeCount; @end @implementation rise_drop_data - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasSzaRiseCount { return !!hasSzaRiseCount_; } - (void) setHasSzaRiseCount:(BOOL) _value_ { hasSzaRiseCount_ = !!_value_; } @synthesize szaRiseCount; - (BOOL) hasSzaDropCount { return !!hasSzaDropCount_; } - (void) setHasSzaDropCount:(BOOL) _value_ { hasSzaDropCount_ = !!_value_; } @synthesize szaDropCount; - (BOOL) hasSzaUnchangeCount { return !!hasSzaUnchangeCount_; } - (void) setHasSzaUnchangeCount:(BOOL) _value_ { hasSzaUnchangeCount_ = !!_value_; } @synthesize szaUnchangeCount; - (BOOL) hasShaRiseCount { return !!hasShaRiseCount_; } - (void) setHasShaRiseCount:(BOOL) _value_ { hasShaRiseCount_ = !!_value_; } @synthesize shaRiseCount; - (BOOL) hasShaDropCount { return !!hasShaDropCount_; } - (void) setHasShaDropCount:(BOOL) _value_ { hasShaDropCount_ = !!_value_; } @synthesize shaDropCount; - (BOOL) hasShaUnchangeCount { return !!hasShaUnchangeCount_; } - (void) setHasShaUnchangeCount:(BOOL) _value_ { hasShaUnchangeCount_ = !!_value_; } @synthesize shaUnchangeCount; - (BOOL) hasGemRiseCount { return !!hasGemRiseCount_; } - (void) setHasGemRiseCount:(BOOL) _value_ { hasGemRiseCount_ = !!_value_; } @synthesize gemRiseCount; - (BOOL) hasGemDropCount { return !!hasGemDropCount_; } - (void) setHasGemDropCount:(BOOL) _value_ { hasGemDropCount_ = !!_value_; } @synthesize gemDropCount; - (BOOL) hasGemUnchangeCount { return !!hasGemUnchangeCount_; } - (void) setHasGemUnchangeCount:(BOOL) _value_ { hasGemUnchangeCount_ = !!_value_; } @synthesize gemUnchangeCount; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.szaRiseCount = 0; self.szaDropCount = 0; self.szaUnchangeCount = 0; self.shaRiseCount = 0; self.shaDropCount = 0; self.shaUnchangeCount = 0; self.gemRiseCount = 0; self.gemDropCount = 0; self.gemUnchangeCount = 0; } return self; } static rise_drop_data* defaultrise_drop_dataInstance = nil; + (void) initialize { if (self == [rise_drop_data class]) { defaultrise_drop_dataInstance = [[rise_drop_data alloc] init]; } } + (instancetype) defaultInstance { return defaultrise_drop_dataInstance; } - (instancetype) defaultInstance { return defaultrise_drop_dataInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasSzaRiseCount) { return NO; } if (!self.hasSzaDropCount) { return NO; } if (!self.hasSzaUnchangeCount) { return NO; } if (!self.hasShaRiseCount) { return NO; } if (!self.hasShaDropCount) { return NO; } if (!self.hasShaUnchangeCount) { return NO; } if (!self.hasGemRiseCount) { return NO; } if (!self.hasGemDropCount) { return NO; } if (!self.hasGemUnchangeCount) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasSzaRiseCount) { [output writeUInt32:2 value:self.szaRiseCount]; } if (self.hasSzaDropCount) { [output writeUInt32:3 value:self.szaDropCount]; } if (self.hasSzaUnchangeCount) { [output writeUInt32:4 value:self.szaUnchangeCount]; } if (self.hasShaRiseCount) { [output writeUInt32:5 value:self.shaRiseCount]; } if (self.hasShaDropCount) { [output writeUInt32:6 value:self.shaDropCount]; } if (self.hasShaUnchangeCount) { [output writeUInt32:7 value:self.shaUnchangeCount]; } if (self.hasGemRiseCount) { [output writeUInt32:8 value:self.gemRiseCount]; } if (self.hasGemDropCount) { [output writeUInt32:9 value:self.gemDropCount]; } if (self.hasGemUnchangeCount) { [output writeUInt32:10 value:self.gemUnchangeCount]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasSzaRiseCount) { size_ += computeUInt32Size(2, self.szaRiseCount); } if (self.hasSzaDropCount) { size_ += computeUInt32Size(3, self.szaDropCount); } if (self.hasSzaUnchangeCount) { size_ += computeUInt32Size(4, self.szaUnchangeCount); } if (self.hasShaRiseCount) { size_ += computeUInt32Size(5, self.shaRiseCount); } if (self.hasShaDropCount) { size_ += computeUInt32Size(6, self.shaDropCount); } if (self.hasShaUnchangeCount) { size_ += computeUInt32Size(7, self.shaUnchangeCount); } if (self.hasGemRiseCount) { size_ += computeUInt32Size(8, self.gemRiseCount); } if (self.hasGemDropCount) { size_ += computeUInt32Size(9, self.gemDropCount); } if (self.hasGemUnchangeCount) { size_ += computeUInt32Size(10, self.gemUnchangeCount); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (rise_drop_data*) parseFromData:(NSData*) data { return (rise_drop_data*)[[[rise_drop_data builder] mergeFromData:data] build]; } + (rise_drop_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rise_drop_data*)[[[rise_drop_data builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (rise_drop_data*) parseFromInputStream:(NSInputStream*) input { return (rise_drop_data*)[[[rise_drop_data builder] mergeFromInputStream:input] build]; } + (rise_drop_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rise_drop_data*)[[[rise_drop_data builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (rise_drop_data*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (rise_drop_data*)[[[rise_drop_data builder] mergeFromCodedInputStream:input] build]; } + (rise_drop_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rise_drop_data*)[[[rise_drop_data builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (rise_drop_dataBuilder*) builder { return [[rise_drop_dataBuilder alloc] init]; } + (rise_drop_dataBuilder*) builderWithPrototype:(rise_drop_data*) prototype { return [[rise_drop_data builder] mergeFrom:prototype]; } - (rise_drop_dataBuilder*) builder { return [rise_drop_data builder]; } - (rise_drop_dataBuilder*) toBuilder { return [rise_drop_data builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasSzaRiseCount) { [output appendFormat:@"%@%@: %@\n", indent, @"szaRiseCount", [NSNumber numberWithInteger:self.szaRiseCount]]; } if (self.hasSzaDropCount) { [output appendFormat:@"%@%@: %@\n", indent, @"szaDropCount", [NSNumber numberWithInteger:self.szaDropCount]]; } if (self.hasSzaUnchangeCount) { [output appendFormat:@"%@%@: %@\n", indent, @"szaUnchangeCount", [NSNumber numberWithInteger:self.szaUnchangeCount]]; } if (self.hasShaRiseCount) { [output appendFormat:@"%@%@: %@\n", indent, @"shaRiseCount", [NSNumber numberWithInteger:self.shaRiseCount]]; } if (self.hasShaDropCount) { [output appendFormat:@"%@%@: %@\n", indent, @"shaDropCount", [NSNumber numberWithInteger:self.shaDropCount]]; } if (self.hasShaUnchangeCount) { [output appendFormat:@"%@%@: %@\n", indent, @"shaUnchangeCount", [NSNumber numberWithInteger:self.shaUnchangeCount]]; } if (self.hasGemRiseCount) { [output appendFormat:@"%@%@: %@\n", indent, @"gemRiseCount", [NSNumber numberWithInteger:self.gemRiseCount]]; } if (self.hasGemDropCount) { [output appendFormat:@"%@%@: %@\n", indent, @"gemDropCount", [NSNumber numberWithInteger:self.gemDropCount]]; } if (self.hasGemUnchangeCount) { [output appendFormat:@"%@%@: %@\n", indent, @"gemUnchangeCount", [NSNumber numberWithInteger:self.gemUnchangeCount]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasSzaRiseCount) { [dictionary setObject: [NSNumber numberWithInteger:self.szaRiseCount] forKey: @"szaRiseCount"]; } if (self.hasSzaDropCount) { [dictionary setObject: [NSNumber numberWithInteger:self.szaDropCount] forKey: @"szaDropCount"]; } if (self.hasSzaUnchangeCount) { [dictionary setObject: [NSNumber numberWithInteger:self.szaUnchangeCount] forKey: @"szaUnchangeCount"]; } if (self.hasShaRiseCount) { [dictionary setObject: [NSNumber numberWithInteger:self.shaRiseCount] forKey: @"shaRiseCount"]; } if (self.hasShaDropCount) { [dictionary setObject: [NSNumber numberWithInteger:self.shaDropCount] forKey: @"shaDropCount"]; } if (self.hasShaUnchangeCount) { [dictionary setObject: [NSNumber numberWithInteger:self.shaUnchangeCount] forKey: @"shaUnchangeCount"]; } if (self.hasGemRiseCount) { [dictionary setObject: [NSNumber numberWithInteger:self.gemRiseCount] forKey: @"gemRiseCount"]; } if (self.hasGemDropCount) { [dictionary setObject: [NSNumber numberWithInteger:self.gemDropCount] forKey: @"gemDropCount"]; } if (self.hasGemUnchangeCount) { [dictionary setObject: [NSNumber numberWithInteger:self.gemUnchangeCount] forKey: @"gemUnchangeCount"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[rise_drop_data class]]) { return NO; } rise_drop_data *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasSzaRiseCount == otherMessage.hasSzaRiseCount && (!self.hasSzaRiseCount || self.szaRiseCount == otherMessage.szaRiseCount) && self.hasSzaDropCount == otherMessage.hasSzaDropCount && (!self.hasSzaDropCount || self.szaDropCount == otherMessage.szaDropCount) && self.hasSzaUnchangeCount == otherMessage.hasSzaUnchangeCount && (!self.hasSzaUnchangeCount || self.szaUnchangeCount == otherMessage.szaUnchangeCount) && self.hasShaRiseCount == otherMessage.hasShaRiseCount && (!self.hasShaRiseCount || self.shaRiseCount == otherMessage.shaRiseCount) && self.hasShaDropCount == otherMessage.hasShaDropCount && (!self.hasShaDropCount || self.shaDropCount == otherMessage.shaDropCount) && self.hasShaUnchangeCount == otherMessage.hasShaUnchangeCount && (!self.hasShaUnchangeCount || self.shaUnchangeCount == otherMessage.shaUnchangeCount) && self.hasGemRiseCount == otherMessage.hasGemRiseCount && (!self.hasGemRiseCount || self.gemRiseCount == otherMessage.gemRiseCount) && self.hasGemDropCount == otherMessage.hasGemDropCount && (!self.hasGemDropCount || self.gemDropCount == otherMessage.gemDropCount) && self.hasGemUnchangeCount == otherMessage.hasGemUnchangeCount && (!self.hasGemUnchangeCount || self.gemUnchangeCount == otherMessage.gemUnchangeCount) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasSzaRiseCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.szaRiseCount] hash]; } if (self.hasSzaDropCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.szaDropCount] hash]; } if (self.hasSzaUnchangeCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.szaUnchangeCount] hash]; } if (self.hasShaRiseCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.shaRiseCount] hash]; } if (self.hasShaDropCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.shaDropCount] hash]; } if (self.hasShaUnchangeCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.shaUnchangeCount] hash]; } if (self.hasGemRiseCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.gemRiseCount] hash]; } if (self.hasGemDropCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.gemDropCount] hash]; } if (self.hasGemUnchangeCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.gemUnchangeCount] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface rise_drop_dataBuilder() @property (strong) rise_drop_data* resultRiseDropData; @end @implementation rise_drop_dataBuilder @synthesize resultRiseDropData; - (instancetype) init { if ((self = [super init])) { self.resultRiseDropData = [[rise_drop_data alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultRiseDropData; } - (rise_drop_dataBuilder*) clear { self.resultRiseDropData = [[rise_drop_data alloc] init]; return self; } - (rise_drop_dataBuilder*) clone { return [rise_drop_data builderWithPrototype:resultRiseDropData]; } - (rise_drop_data*) defaultInstance { return [rise_drop_data defaultInstance]; } - (rise_drop_data*) build { [self checkInitialized]; return [self buildPartial]; } - (rise_drop_data*) buildPartial { rise_drop_data* returnMe = resultRiseDropData; self.resultRiseDropData = nil; return returnMe; } - (rise_drop_dataBuilder*) mergeFrom:(rise_drop_data*) other { if (other == [rise_drop_data defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasSzaRiseCount) { [self setSzaRiseCount:other.szaRiseCount]; } if (other.hasSzaDropCount) { [self setSzaDropCount:other.szaDropCount]; } if (other.hasSzaUnchangeCount) { [self setSzaUnchangeCount:other.szaUnchangeCount]; } if (other.hasShaRiseCount) { [self setShaRiseCount:other.shaRiseCount]; } if (other.hasShaDropCount) { [self setShaDropCount:other.shaDropCount]; } if (other.hasShaUnchangeCount) { [self setShaUnchangeCount:other.shaUnchangeCount]; } if (other.hasGemRiseCount) { [self setGemRiseCount:other.gemRiseCount]; } if (other.hasGemDropCount) { [self setGemDropCount:other.gemDropCount]; } if (other.hasGemUnchangeCount) { [self setGemUnchangeCount:other.gemUnchangeCount]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (rise_drop_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (rise_drop_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 16: { [self setSzaRiseCount:[input readUInt32]]; break; } case 24: { [self setSzaDropCount:[input readUInt32]]; break; } case 32: { [self setSzaUnchangeCount:[input readUInt32]]; break; } case 40: { [self setShaRiseCount:[input readUInt32]]; break; } case 48: { [self setShaDropCount:[input readUInt32]]; break; } case 56: { [self setShaUnchangeCount:[input readUInt32]]; break; } case 64: { [self setGemRiseCount:[input readUInt32]]; break; } case 72: { [self setGemDropCount:[input readUInt32]]; break; } case 80: { [self setGemUnchangeCount:[input readUInt32]]; break; } } } } - (BOOL) hasTime { return resultRiseDropData.hasTime; } - (UInt32) time { return resultRiseDropData.time; } - (rise_drop_dataBuilder*) setTime:(UInt32) value { resultRiseDropData.hasTime = YES; resultRiseDropData.time = value; return self; } - (rise_drop_dataBuilder*) clearTime { resultRiseDropData.hasTime = NO; resultRiseDropData.time = 0; return self; } - (BOOL) hasSzaRiseCount { return resultRiseDropData.hasSzaRiseCount; } - (UInt32) szaRiseCount { return resultRiseDropData.szaRiseCount; } - (rise_drop_dataBuilder*) setSzaRiseCount:(UInt32) value { resultRiseDropData.hasSzaRiseCount = YES; resultRiseDropData.szaRiseCount = value; return self; } - (rise_drop_dataBuilder*) clearSzaRiseCount { resultRiseDropData.hasSzaRiseCount = NO; resultRiseDropData.szaRiseCount = 0; return self; } - (BOOL) hasSzaDropCount { return resultRiseDropData.hasSzaDropCount; } - (UInt32) szaDropCount { return resultRiseDropData.szaDropCount; } - (rise_drop_dataBuilder*) setSzaDropCount:(UInt32) value { resultRiseDropData.hasSzaDropCount = YES; resultRiseDropData.szaDropCount = value; return self; } - (rise_drop_dataBuilder*) clearSzaDropCount { resultRiseDropData.hasSzaDropCount = NO; resultRiseDropData.szaDropCount = 0; return self; } - (BOOL) hasSzaUnchangeCount { return resultRiseDropData.hasSzaUnchangeCount; } - (UInt32) szaUnchangeCount { return resultRiseDropData.szaUnchangeCount; } - (rise_drop_dataBuilder*) setSzaUnchangeCount:(UInt32) value { resultRiseDropData.hasSzaUnchangeCount = YES; resultRiseDropData.szaUnchangeCount = value; return self; } - (rise_drop_dataBuilder*) clearSzaUnchangeCount { resultRiseDropData.hasSzaUnchangeCount = NO; resultRiseDropData.szaUnchangeCount = 0; return self; } - (BOOL) hasShaRiseCount { return resultRiseDropData.hasShaRiseCount; } - (UInt32) shaRiseCount { return resultRiseDropData.shaRiseCount; } - (rise_drop_dataBuilder*) setShaRiseCount:(UInt32) value { resultRiseDropData.hasShaRiseCount = YES; resultRiseDropData.shaRiseCount = value; return self; } - (rise_drop_dataBuilder*) clearShaRiseCount { resultRiseDropData.hasShaRiseCount = NO; resultRiseDropData.shaRiseCount = 0; return self; } - (BOOL) hasShaDropCount { return resultRiseDropData.hasShaDropCount; } - (UInt32) shaDropCount { return resultRiseDropData.shaDropCount; } - (rise_drop_dataBuilder*) setShaDropCount:(UInt32) value { resultRiseDropData.hasShaDropCount = YES; resultRiseDropData.shaDropCount = value; return self; } - (rise_drop_dataBuilder*) clearShaDropCount { resultRiseDropData.hasShaDropCount = NO; resultRiseDropData.shaDropCount = 0; return self; } - (BOOL) hasShaUnchangeCount { return resultRiseDropData.hasShaUnchangeCount; } - (UInt32) shaUnchangeCount { return resultRiseDropData.shaUnchangeCount; } - (rise_drop_dataBuilder*) setShaUnchangeCount:(UInt32) value { resultRiseDropData.hasShaUnchangeCount = YES; resultRiseDropData.shaUnchangeCount = value; return self; } - (rise_drop_dataBuilder*) clearShaUnchangeCount { resultRiseDropData.hasShaUnchangeCount = NO; resultRiseDropData.shaUnchangeCount = 0; return self; } - (BOOL) hasGemRiseCount { return resultRiseDropData.hasGemRiseCount; } - (UInt32) gemRiseCount { return resultRiseDropData.gemRiseCount; } - (rise_drop_dataBuilder*) setGemRiseCount:(UInt32) value { resultRiseDropData.hasGemRiseCount = YES; resultRiseDropData.gemRiseCount = value; return self; } - (rise_drop_dataBuilder*) clearGemRiseCount { resultRiseDropData.hasGemRiseCount = NO; resultRiseDropData.gemRiseCount = 0; return self; } - (BOOL) hasGemDropCount { return resultRiseDropData.hasGemDropCount; } - (UInt32) gemDropCount { return resultRiseDropData.gemDropCount; } - (rise_drop_dataBuilder*) setGemDropCount:(UInt32) value { resultRiseDropData.hasGemDropCount = YES; resultRiseDropData.gemDropCount = value; return self; } - (rise_drop_dataBuilder*) clearGemDropCount { resultRiseDropData.hasGemDropCount = NO; resultRiseDropData.gemDropCount = 0; return self; } - (BOOL) hasGemUnchangeCount { return resultRiseDropData.hasGemUnchangeCount; } - (UInt32) gemUnchangeCount { return resultRiseDropData.gemUnchangeCount; } - (rise_drop_dataBuilder*) setGemUnchangeCount:(UInt32) value { resultRiseDropData.hasGemUnchangeCount = YES; resultRiseDropData.gemUnchangeCount = value; return self; } - (rise_drop_dataBuilder*) clearGemUnchangeCount { resultRiseDropData.hasGemUnchangeCount = NO; resultRiseDropData.gemUnchangeCount = 0; return self; } @end @interface rise_drop_result_msg () @property (strong) NSMutableArray * indexDataArray; @end @implementation rise_drop_result_msg @synthesize indexDataArray; @dynamic indexData; - (instancetype) init { if ((self = [super init])) { } return self; } static rise_drop_result_msg* defaultrise_drop_result_msgInstance = nil; + (void) initialize { if (self == [rise_drop_result_msg class]) { defaultrise_drop_result_msgInstance = [[rise_drop_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultrise_drop_result_msgInstance; } - (instancetype) defaultInstance { return defaultrise_drop_result_msgInstance; } - (NSArray *)indexData { return indexDataArray; } - (rise_drop_data*)indexDataAtIndex:(NSUInteger)index { return [indexDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitindexData = YES; [self.indexData enumerateObjectsUsingBlock:^(rise_drop_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitindexData = NO; *stop = YES; } }]; if (!isInitindexData) return isInitindexData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.indexDataArray enumerateObjectsUsingBlock:^(rise_drop_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.indexDataArray enumerateObjectsUsingBlock:^(rise_drop_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (rise_drop_result_msg*) parseFromData:(NSData*) data { return (rise_drop_result_msg*)[[[rise_drop_result_msg builder] mergeFromData:data] build]; } + (rise_drop_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rise_drop_result_msg*)[[[rise_drop_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (rise_drop_result_msg*) parseFromInputStream:(NSInputStream*) input { return (rise_drop_result_msg*)[[[rise_drop_result_msg builder] mergeFromInputStream:input] build]; } + (rise_drop_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rise_drop_result_msg*)[[[rise_drop_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (rise_drop_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (rise_drop_result_msg*)[[[rise_drop_result_msg builder] mergeFromCodedInputStream:input] build]; } + (rise_drop_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (rise_drop_result_msg*)[[[rise_drop_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (rise_drop_result_msgBuilder*) builder { return [[rise_drop_result_msgBuilder alloc] init]; } + (rise_drop_result_msgBuilder*) builderWithPrototype:(rise_drop_result_msg*) prototype { return [[rise_drop_result_msg builder] mergeFrom:prototype]; } - (rise_drop_result_msgBuilder*) builder { return [rise_drop_result_msg builder]; } - (rise_drop_result_msgBuilder*) toBuilder { return [rise_drop_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.indexDataArray enumerateObjectsUsingBlock:^(rise_drop_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"indexData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (rise_drop_data* element in self.indexDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"indexData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[rise_drop_result_msg class]]) { return NO; } rise_drop_result_msg *otherMessage = other; return [self.indexDataArray isEqualToArray:otherMessage.indexDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.indexDataArray enumerateObjectsUsingBlock:^(rise_drop_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface rise_drop_result_msgBuilder() @property (strong) rise_drop_result_msg* resultRiseDropResultMsg; @end @implementation rise_drop_result_msgBuilder @synthesize resultRiseDropResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultRiseDropResultMsg = [[rise_drop_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultRiseDropResultMsg; } - (rise_drop_result_msgBuilder*) clear { self.resultRiseDropResultMsg = [[rise_drop_result_msg alloc] init]; return self; } - (rise_drop_result_msgBuilder*) clone { return [rise_drop_result_msg builderWithPrototype:resultRiseDropResultMsg]; } - (rise_drop_result_msg*) defaultInstance { return [rise_drop_result_msg defaultInstance]; } - (rise_drop_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (rise_drop_result_msg*) buildPartial { rise_drop_result_msg* returnMe = resultRiseDropResultMsg; self.resultRiseDropResultMsg = nil; return returnMe; } - (rise_drop_result_msgBuilder*) mergeFrom:(rise_drop_result_msg*) other { if (other == [rise_drop_result_msg defaultInstance]) { return self; } if (other.indexDataArray.count > 0) { if (resultRiseDropResultMsg.indexDataArray == nil) { resultRiseDropResultMsg.indexDataArray = [[NSMutableArray alloc] initWithArray:other.indexDataArray]; } else { [resultRiseDropResultMsg.indexDataArray addObjectsFromArray:other.indexDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (rise_drop_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (rise_drop_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { rise_drop_dataBuilder* subBuilder = [rise_drop_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addIndexData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)indexData { return resultRiseDropResultMsg.indexDataArray; } - (rise_drop_data*)indexDataAtIndex:(NSUInteger)index { return [resultRiseDropResultMsg indexDataAtIndex:index]; } - (rise_drop_result_msgBuilder *)addIndexData:(rise_drop_data*)value { if (resultRiseDropResultMsg.indexDataArray == nil) { resultRiseDropResultMsg.indexDataArray = [[NSMutableArray alloc]init]; } [resultRiseDropResultMsg.indexDataArray addObject:value]; return self; } - (rise_drop_result_msgBuilder *)setIndexDataArray:(NSArray *)array { resultRiseDropResultMsg.indexDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (rise_drop_result_msgBuilder *)clearIndexData { resultRiseDropResultMsg.indexDataArray = nil; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Investment.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" #import "Common.pb.h" // @@protoc_insertion_point(imports) @class auth_ctx_msg; @class auth_ctx_msgBuilder; @class client_login_msg; @class client_login_msgBuilder; @class client_login_result_msg; @class client_login_result_msgBuilder; @class combo_private_msg; @class combo_private_msgBuilder; @class common_reply_error_msg; @class common_reply_error_msgBuilder; @class common_update_notice_msg; @class common_update_notice_msgBuilder; @class count_offset_selector; @class count_offset_selectorBuilder; @class data_selector; @class data_selectorBuilder; @class ext_key_info; @class ext_key_infoBuilder; @class load_dector_msg; @class load_dector_msgBuilder; @class notify_ack_msg; @class notify_ack_msgBuilder; @class push_notify_msg; @class push_notify_msgBuilder; @class rpc_msg_root; @class rpc_msg_rootBuilder; @class server_login_msg; @class server_login_msgBuilder; @class server_login_result_msg; @class server_login_result_msgBuilder; @class subcribe_msg; @class subcribe_msgBuilder; @class sync_notify_msg; @class sync_notify_msgBuilder; @class tg_focus_news_notify_msg; @class tg_focus_news_notify_msgBuilder; @class tg_msg_box_combo_msg; @class tg_msg_box_combo_msgBuilder; @class tg_msg_box_combo_msgtg_msg_node; @class tg_msg_box_combo_msgtg_msg_nodeBuilder; @class tg_req_msg_box_msg; @class tg_req_msg_box_msgBuilder; @class tg_req_stock_pool_msg; @class tg_req_stock_pool_msgBuilder; @class tg_stock_att; @class tg_stock_attBuilder; @class tg_stock_buy_notify_msg; @class tg_stock_buy_notify_msgBuilder; @class tg_stock_in_pool_notify_msg; @class tg_stock_in_pool_notify_msgBuilder; @class tg_stock_new_stop_notify_msg; @class tg_stock_new_stop_notify_msgBuilder; @class tg_stock_new_target_notify_msg; @class tg_stock_new_target_notify_msgBuilder; @class tg_stock_out_pool_notify_msg; @class tg_stock_out_pool_notify_msgBuilder; @class tg_stock_pool_msg; @class tg_stock_pool_msgBuilder; @class tg_stock_profit_notify_msg; @class tg_stock_profit_notify_msgBuilder; @class tg_stock_stop_notify_msg; @class tg_stock_stop_notify_msgBuilder; @class tg_trailer_notify_msg; @class tg_trailer_notify_msgBuilder; @class time_offset_selector; @class time_offset_selectorBuilder; @class time_range_selector; @class time_range_selectorBuilder; typedef NS_ENUM(SInt32, tg_investment_period_type) { tg_investment_period_typeTgInvestmentPeriodTypeNull = 0, tg_investment_period_typeTgShortPeriod = 1, tg_investment_period_typeTgMidPeriod = 2, tg_investment_period_typeTgLongPeriod = 3, }; BOOL tg_investment_period_typeIsValidValue(tg_investment_period_type value); NSString *NSStringFromtg_investment_period_type(tg_investment_period_type value); typedef NS_ENUM(SInt32, tg_stock_investment_state) { tg_stock_investment_stateTgStockInvestmentStateNull = 0, tg_stock_investment_stateTgInPool = 1, tg_stock_investment_stateTgAutoBuy = 2, tg_stock_investment_stateTgManualBuy = 3, tg_stock_investment_stateTgHold = 4, tg_stock_investment_stateTgOutPool = 5, tg_stock_investment_stateTgModifyProfit = 6, tg_stock_investment_stateTgModifyStop = 7, tg_stock_investment_stateTgAutoProfit = 8, tg_stock_investment_stateTgAutoStop = 9, tg_stock_investment_stateTgManuallyProfit = 10, tg_stock_investment_stateTgManuallyStop = 11, }; BOOL tg_stock_investment_stateIsValidValue(tg_stock_investment_state value); NSString *NSStringFromtg_stock_investment_state(tg_stock_investment_state value); @interface InvestmentRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define tg_stock_att_code @"code" #define tg_stock_att_date @"date" #define tg_stock_att_low_buy_pirce @"lowBuyPirce" #define tg_stock_att_high_buy_price @"highBuyPrice" #define tg_stock_att_target_price @"targetPrice" #define tg_stock_att_stop_price @"stopPrice" #define tg_stock_att_inv_type @"invType" #define tg_stock_att_buy_state @"buyState" #define tg_stock_att_current_buy_price @"currentBuyPrice" #define tg_stock_att_current_sell_price @"currentSellPrice" @interface tg_stock_att : PBGeneratedMessage { @private BOOL hasLowBuyPirce_:1; BOOL hasHighBuyPrice_:1; BOOL hasTargetPrice_:1; BOOL hasStopPrice_:1; BOOL hasCurrentBuyPrice_:1; BOOL hasCurrentSellPrice_:1; BOOL hasDate_:1; BOOL hasCode_:1; BOOL hasInvType_:1; BOOL hasBuyState_:1; Float32 lowBuyPirce; Float32 highBuyPrice; Float32 targetPrice; Float32 stopPrice; Float32 currentBuyPrice; Float32 currentSellPrice; SInt64 date; NSString* code; tg_investment_period_type invType; tg_stock_investment_state buyState; } - (BOOL) hasCode; - (BOOL) hasDate; - (BOOL) hasLowBuyPirce; - (BOOL) hasHighBuyPrice; - (BOOL) hasTargetPrice; - (BOOL) hasStopPrice; - (BOOL) hasInvType; - (BOOL) hasBuyState; - (BOOL) hasCurrentBuyPrice; - (BOOL) hasCurrentSellPrice; @property (readonly, strong) NSString* code; @property (readonly) SInt64 date; @property (readonly) Float32 lowBuyPirce; @property (readonly) Float32 highBuyPrice; @property (readonly) Float32 targetPrice; @property (readonly) Float32 stopPrice; @property (readonly) tg_investment_period_type invType; @property (readonly) tg_stock_investment_state buyState; @property (readonly) Float32 currentBuyPrice; @property (readonly) Float32 currentSellPrice; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_attBuilder*) builder; + (tg_stock_attBuilder*) builder; + (tg_stock_attBuilder*) builderWithPrototype:(tg_stock_att*) prototype; - (tg_stock_attBuilder*) toBuilder; + (tg_stock_att*) parseFromData:(NSData*) data; + (tg_stock_att*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_att*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_att*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_att*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_att*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_attBuilder : PBGeneratedMessageBuilder { @private tg_stock_att* resultTgStockAtt; } - (tg_stock_att*) defaultInstance; - (tg_stock_attBuilder*) clear; - (tg_stock_attBuilder*) clone; - (tg_stock_att*) build; - (tg_stock_att*) buildPartial; - (tg_stock_attBuilder*) mergeFrom:(tg_stock_att*) other; - (tg_stock_attBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_attBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_attBuilder*) setCode:(NSString*) value; - (tg_stock_attBuilder*) clearCode; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_attBuilder*) setDate:(SInt64) value; - (tg_stock_attBuilder*) clearDate; - (BOOL) hasLowBuyPirce; - (Float32) lowBuyPirce; - (tg_stock_attBuilder*) setLowBuyPirce:(Float32) value; - (tg_stock_attBuilder*) clearLowBuyPirce; - (BOOL) hasHighBuyPrice; - (Float32) highBuyPrice; - (tg_stock_attBuilder*) setHighBuyPrice:(Float32) value; - (tg_stock_attBuilder*) clearHighBuyPrice; - (BOOL) hasTargetPrice; - (Float32) targetPrice; - (tg_stock_attBuilder*) setTargetPrice:(Float32) value; - (tg_stock_attBuilder*) clearTargetPrice; - (BOOL) hasStopPrice; - (Float32) stopPrice; - (tg_stock_attBuilder*) setStopPrice:(Float32) value; - (tg_stock_attBuilder*) clearStopPrice; - (BOOL) hasInvType; - (tg_investment_period_type) invType; - (tg_stock_attBuilder*) setInvType:(tg_investment_period_type) value; - (tg_stock_attBuilder*) clearInvType; - (BOOL) hasBuyState; - (tg_stock_investment_state) buyState; - (tg_stock_attBuilder*) setBuyState:(tg_stock_investment_state) value; - (tg_stock_attBuilder*) clearBuyState; - (BOOL) hasCurrentBuyPrice; - (Float32) currentBuyPrice; - (tg_stock_attBuilder*) setCurrentBuyPrice:(Float32) value; - (tg_stock_attBuilder*) clearCurrentBuyPrice; - (BOOL) hasCurrentSellPrice; - (Float32) currentSellPrice; - (tg_stock_attBuilder*) setCurrentSellPrice:(Float32) value; - (tg_stock_attBuilder*) clearCurrentSellPrice; @end #define tg_req_stock_pool_msg_version_id @"versionId" #define tg_req_stock_pool_msg_pid @"pid" @interface tg_req_stock_pool_msg : PBGeneratedMessage { @private BOOL hasVersionId_:1; BOOL hasPid_:1; SInt64 versionId; SInt32 pid; } - (BOOL) hasVersionId; - (BOOL) hasPid; @property (readonly) SInt64 versionId; @property (readonly) SInt32 pid; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_req_stock_pool_msgBuilder*) builder; + (tg_req_stock_pool_msgBuilder*) builder; + (tg_req_stock_pool_msgBuilder*) builderWithPrototype:(tg_req_stock_pool_msg*) prototype; - (tg_req_stock_pool_msgBuilder*) toBuilder; + (tg_req_stock_pool_msg*) parseFromData:(NSData*) data; + (tg_req_stock_pool_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_req_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_req_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_req_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_req_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_req_stock_pool_msgBuilder : PBGeneratedMessageBuilder { @private tg_req_stock_pool_msg* resultTgReqStockPoolMsg; } - (tg_req_stock_pool_msg*) defaultInstance; - (tg_req_stock_pool_msgBuilder*) clear; - (tg_req_stock_pool_msgBuilder*) clone; - (tg_req_stock_pool_msg*) build; - (tg_req_stock_pool_msg*) buildPartial; - (tg_req_stock_pool_msgBuilder*) mergeFrom:(tg_req_stock_pool_msg*) other; - (tg_req_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_req_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasVersionId; - (SInt64) versionId; - (tg_req_stock_pool_msgBuilder*) setVersionId:(SInt64) value; - (tg_req_stock_pool_msgBuilder*) clearVersionId; - (BOOL) hasPid; - (SInt32) pid; - (tg_req_stock_pool_msgBuilder*) setPid:(SInt32) value; - (tg_req_stock_pool_msgBuilder*) clearPid; @end #define tg_stock_pool_msg_version_id @"versionId" #define tg_stock_pool_msg_stocks @"stocks" #define tg_stock_pool_msg_position @"position" @interface tg_stock_pool_msg : PBGeneratedMessage { @private BOOL hasPosition_:1; BOOL hasVersionId_:1; Float64 position; SInt64 versionId; NSMutableArray * stocksArray; } - (BOOL) hasVersionId; - (BOOL) hasPosition; @property (readonly) SInt64 versionId; @property (readonly, strong) NSArray * stocks; @property (readonly) Float64 position; - (tg_stock_att*)stocksAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_pool_msgBuilder*) builder; + (tg_stock_pool_msgBuilder*) builder; + (tg_stock_pool_msgBuilder*) builderWithPrototype:(tg_stock_pool_msg*) prototype; - (tg_stock_pool_msgBuilder*) toBuilder; + (tg_stock_pool_msg*) parseFromData:(NSData*) data; + (tg_stock_pool_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_pool_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_pool_msg* resultTgStockPoolMsg; } - (tg_stock_pool_msg*) defaultInstance; - (tg_stock_pool_msgBuilder*) clear; - (tg_stock_pool_msgBuilder*) clone; - (tg_stock_pool_msg*) build; - (tg_stock_pool_msg*) buildPartial; - (tg_stock_pool_msgBuilder*) mergeFrom:(tg_stock_pool_msg*) other; - (tg_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasVersionId; - (SInt64) versionId; - (tg_stock_pool_msgBuilder*) setVersionId:(SInt64) value; - (tg_stock_pool_msgBuilder*) clearVersionId; - (NSMutableArray *)stocks; - (tg_stock_att*)stocksAtIndex:(NSUInteger)index; - (tg_stock_pool_msgBuilder *)addStocks:(tg_stock_att*)value; - (tg_stock_pool_msgBuilder *)setStocksArray:(NSArray *)array; - (tg_stock_pool_msgBuilder *)clearStocks; - (BOOL) hasPosition; - (Float64) position; - (tg_stock_pool_msgBuilder*) setPosition:(Float64) value; - (tg_stock_pool_msgBuilder*) clearPosition; @end #define tg_stock_in_pool_notify_msg_date @"date" #define tg_stock_in_pool_notify_msg_code @"code" #define tg_stock_in_pool_notify_msg_name @"name" #define tg_stock_in_pool_notify_msg_low_price @"lowPrice" #define tg_stock_in_pool_notify_msg_high_price @"highPrice" #define tg_stock_in_pool_notify_msg_target_price @"targetPrice" #define tg_stock_in_pool_notify_msg_stop_price @"stopPrice" @interface tg_stock_in_pool_notify_msg : PBGeneratedMessage { @private BOOL hasLowPrice_:1; BOOL hasHighPrice_:1; BOOL hasTargetPrice_:1; BOOL hasStopPrice_:1; BOOL hasDate_:1; BOOL hasCode_:1; BOOL hasName_:1; Float32 lowPrice; Float32 highPrice; Float32 targetPrice; Float32 stopPrice; SInt64 date; NSString* code; NSString* name; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasName; - (BOOL) hasLowPrice; - (BOOL) hasHighPrice; - (BOOL) hasTargetPrice; - (BOOL) hasStopPrice; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly) Float32 lowPrice; @property (readonly) Float32 highPrice; @property (readonly) Float32 targetPrice; @property (readonly) Float32 stopPrice; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_in_pool_notify_msgBuilder*) builder; + (tg_stock_in_pool_notify_msgBuilder*) builder; + (tg_stock_in_pool_notify_msgBuilder*) builderWithPrototype:(tg_stock_in_pool_notify_msg*) prototype; - (tg_stock_in_pool_notify_msgBuilder*) toBuilder; + (tg_stock_in_pool_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_in_pool_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_in_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_in_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_in_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_in_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_in_pool_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_in_pool_notify_msg* resultTgStockInPoolNotifyMsg; } - (tg_stock_in_pool_notify_msg*) defaultInstance; - (tg_stock_in_pool_notify_msgBuilder*) clear; - (tg_stock_in_pool_notify_msgBuilder*) clone; - (tg_stock_in_pool_notify_msg*) build; - (tg_stock_in_pool_notify_msg*) buildPartial; - (tg_stock_in_pool_notify_msgBuilder*) mergeFrom:(tg_stock_in_pool_notify_msg*) other; - (tg_stock_in_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_in_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_in_pool_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_in_pool_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_in_pool_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_in_pool_notify_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (tg_stock_in_pool_notify_msgBuilder*) setName:(NSString*) value; - (tg_stock_in_pool_notify_msgBuilder*) clearName; - (BOOL) hasLowPrice; - (Float32) lowPrice; - (tg_stock_in_pool_notify_msgBuilder*) setLowPrice:(Float32) value; - (tg_stock_in_pool_notify_msgBuilder*) clearLowPrice; - (BOOL) hasHighPrice; - (Float32) highPrice; - (tg_stock_in_pool_notify_msgBuilder*) setHighPrice:(Float32) value; - (tg_stock_in_pool_notify_msgBuilder*) clearHighPrice; - (BOOL) hasTargetPrice; - (Float32) targetPrice; - (tg_stock_in_pool_notify_msgBuilder*) setTargetPrice:(Float32) value; - (tg_stock_in_pool_notify_msgBuilder*) clearTargetPrice; - (BOOL) hasStopPrice; - (Float32) stopPrice; - (tg_stock_in_pool_notify_msgBuilder*) setStopPrice:(Float32) value; - (tg_stock_in_pool_notify_msgBuilder*) clearStopPrice; @end #define tg_stock_buy_notify_msg_date @"date" #define tg_stock_buy_notify_msg_code @"code" #define tg_stock_buy_notify_msg_name @"name" #define tg_stock_buy_notify_msg_buy_price @"buyPrice" #define tg_stock_buy_notify_msg_target_price @"targetPrice" #define tg_stock_buy_notify_msg_stop_price @"stopPrice" #define tg_stock_buy_notify_msg_auto_buy @"autoBuy" @interface tg_stock_buy_notify_msg : PBGeneratedMessage { @private BOOL hasAutoBuy_:1; BOOL hasBuyPrice_:1; BOOL hasTargetPrice_:1; BOOL hasStopPrice_:1; BOOL hasDate_:1; BOOL hasCode_:1; BOOL hasName_:1; BOOL autoBuy_:1; Float32 buyPrice; Float32 targetPrice; Float32 stopPrice; SInt64 date; NSString* code; NSString* name; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasName; - (BOOL) hasBuyPrice; - (BOOL) hasTargetPrice; - (BOOL) hasStopPrice; - (BOOL) hasAutoBuy; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly) Float32 buyPrice; @property (readonly) Float32 targetPrice; @property (readonly) Float32 stopPrice; - (BOOL) autoBuy; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_buy_notify_msgBuilder*) builder; + (tg_stock_buy_notify_msgBuilder*) builder; + (tg_stock_buy_notify_msgBuilder*) builderWithPrototype:(tg_stock_buy_notify_msg*) prototype; - (tg_stock_buy_notify_msgBuilder*) toBuilder; + (tg_stock_buy_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_buy_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_buy_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_buy_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_buy_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_buy_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_buy_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_buy_notify_msg* resultTgStockBuyNotifyMsg; } - (tg_stock_buy_notify_msg*) defaultInstance; - (tg_stock_buy_notify_msgBuilder*) clear; - (tg_stock_buy_notify_msgBuilder*) clone; - (tg_stock_buy_notify_msg*) build; - (tg_stock_buy_notify_msg*) buildPartial; - (tg_stock_buy_notify_msgBuilder*) mergeFrom:(tg_stock_buy_notify_msg*) other; - (tg_stock_buy_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_buy_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_buy_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_buy_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_buy_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_buy_notify_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (tg_stock_buy_notify_msgBuilder*) setName:(NSString*) value; - (tg_stock_buy_notify_msgBuilder*) clearName; - (BOOL) hasBuyPrice; - (Float32) buyPrice; - (tg_stock_buy_notify_msgBuilder*) setBuyPrice:(Float32) value; - (tg_stock_buy_notify_msgBuilder*) clearBuyPrice; - (BOOL) hasTargetPrice; - (Float32) targetPrice; - (tg_stock_buy_notify_msgBuilder*) setTargetPrice:(Float32) value; - (tg_stock_buy_notify_msgBuilder*) clearTargetPrice; - (BOOL) hasStopPrice; - (Float32) stopPrice; - (tg_stock_buy_notify_msgBuilder*) setStopPrice:(Float32) value; - (tg_stock_buy_notify_msgBuilder*) clearStopPrice; - (BOOL) hasAutoBuy; - (BOOL) autoBuy; - (tg_stock_buy_notify_msgBuilder*) setAutoBuy:(BOOL) value; - (tg_stock_buy_notify_msgBuilder*) clearAutoBuy; @end #define tg_stock_out_pool_notify_msg_date @"date" #define tg_stock_out_pool_notify_msg_code @"code" #define tg_stock_out_pool_notify_msg_name @"name" #define tg_stock_out_pool_notify_msg_desc @"desc" @interface tg_stock_out_pool_notify_msg : PBGeneratedMessage { @private BOOL hasDate_:1; BOOL hasCode_:1; BOOL hasName_:1; BOOL hasDesc_:1; SInt64 date; NSString* code; NSString* name; NSString* desc; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasName; - (BOOL) hasDesc; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly, strong) NSString* desc; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_out_pool_notify_msgBuilder*) builder; + (tg_stock_out_pool_notify_msgBuilder*) builder; + (tg_stock_out_pool_notify_msgBuilder*) builderWithPrototype:(tg_stock_out_pool_notify_msg*) prototype; - (tg_stock_out_pool_notify_msgBuilder*) toBuilder; + (tg_stock_out_pool_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_out_pool_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_out_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_out_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_out_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_out_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_out_pool_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_out_pool_notify_msg* resultTgStockOutPoolNotifyMsg; } - (tg_stock_out_pool_notify_msg*) defaultInstance; - (tg_stock_out_pool_notify_msgBuilder*) clear; - (tg_stock_out_pool_notify_msgBuilder*) clone; - (tg_stock_out_pool_notify_msg*) build; - (tg_stock_out_pool_notify_msg*) buildPartial; - (tg_stock_out_pool_notify_msgBuilder*) mergeFrom:(tg_stock_out_pool_notify_msg*) other; - (tg_stock_out_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_out_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_out_pool_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_out_pool_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_out_pool_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_out_pool_notify_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (tg_stock_out_pool_notify_msgBuilder*) setName:(NSString*) value; - (tg_stock_out_pool_notify_msgBuilder*) clearName; - (BOOL) hasDesc; - (NSString*) desc; - (tg_stock_out_pool_notify_msgBuilder*) setDesc:(NSString*) value; - (tg_stock_out_pool_notify_msgBuilder*) clearDesc; @end #define tg_stock_new_target_notify_msg_date @"date" #define tg_stock_new_target_notify_msg_code @"code" #define tg_stock_new_target_notify_msg_old_target @"oldTarget" #define tg_stock_new_target_notify_msg_new_target @"newTarget" @interface tg_stock_new_target_notify_msg : PBGeneratedMessage { @private BOOL hasOldTarget_:1; BOOL hasNewTarget_:1; BOOL hasDate_:1; BOOL hasCode_:1; Float32 oldTarget; Float32 newTarget; SInt64 date; NSString* code; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasOldTarget; - (BOOL) hasNewTarget; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly) Float32 oldTarget; @property (readonly) Float32 newTarget; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_new_target_notify_msgBuilder*) builder; + (tg_stock_new_target_notify_msgBuilder*) builder; + (tg_stock_new_target_notify_msgBuilder*) builderWithPrototype:(tg_stock_new_target_notify_msg*) prototype; - (tg_stock_new_target_notify_msgBuilder*) toBuilder; + (tg_stock_new_target_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_new_target_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_new_target_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_new_target_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_new_target_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_new_target_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_new_target_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_new_target_notify_msg* resultTgStockNewTargetNotifyMsg; } - (tg_stock_new_target_notify_msg*) defaultInstance; - (tg_stock_new_target_notify_msgBuilder*) clear; - (tg_stock_new_target_notify_msgBuilder*) clone; - (tg_stock_new_target_notify_msg*) build; - (tg_stock_new_target_notify_msg*) buildPartial; - (tg_stock_new_target_notify_msgBuilder*) mergeFrom:(tg_stock_new_target_notify_msg*) other; - (tg_stock_new_target_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_new_target_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_new_target_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_new_target_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_new_target_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_new_target_notify_msgBuilder*) clearCode; - (BOOL) hasOldTarget; - (Float32) oldTarget; - (tg_stock_new_target_notify_msgBuilder*) setOldTarget:(Float32) value; - (tg_stock_new_target_notify_msgBuilder*) clearOldTarget; - (BOOL) hasNewTarget; - (Float32) newTarget; - (tg_stock_new_target_notify_msgBuilder*) setNewTarget:(Float32) value; - (tg_stock_new_target_notify_msgBuilder*) clearNewTarget; @end #define tg_stock_new_stop_notify_msg_date @"date" #define tg_stock_new_stop_notify_msg_code @"code" #define tg_stock_new_stop_notify_msg_old_stop @"oldStop" #define tg_stock_new_stop_notify_msg_new_stop @"newStop" @interface tg_stock_new_stop_notify_msg : PBGeneratedMessage { @private BOOL hasOldStop_:1; BOOL hasNewStop_:1; BOOL hasDate_:1; BOOL hasCode_:1; Float32 oldStop; Float32 newStop; SInt64 date; NSString* code; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasOldStop; - (BOOL) hasNewStop; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly) Float32 oldStop; @property (readonly) Float32 newStop; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_new_stop_notify_msgBuilder*) builder; + (tg_stock_new_stop_notify_msgBuilder*) builder; + (tg_stock_new_stop_notify_msgBuilder*) builderWithPrototype:(tg_stock_new_stop_notify_msg*) prototype; - (tg_stock_new_stop_notify_msgBuilder*) toBuilder; + (tg_stock_new_stop_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_new_stop_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_new_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_new_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_new_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_new_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_new_stop_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_new_stop_notify_msg* resultTgStockNewStopNotifyMsg; } - (tg_stock_new_stop_notify_msg*) defaultInstance; - (tg_stock_new_stop_notify_msgBuilder*) clear; - (tg_stock_new_stop_notify_msgBuilder*) clone; - (tg_stock_new_stop_notify_msg*) build; - (tg_stock_new_stop_notify_msg*) buildPartial; - (tg_stock_new_stop_notify_msgBuilder*) mergeFrom:(tg_stock_new_stop_notify_msg*) other; - (tg_stock_new_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_new_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_new_stop_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_new_stop_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_new_stop_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_new_stop_notify_msgBuilder*) clearCode; - (BOOL) hasOldStop; - (Float32) oldStop; - (tg_stock_new_stop_notify_msgBuilder*) setOldStop:(Float32) value; - (tg_stock_new_stop_notify_msgBuilder*) clearOldStop; - (BOOL) hasNewStop; - (Float32) newStop; - (tg_stock_new_stop_notify_msgBuilder*) setNewStop:(Float32) value; - (tg_stock_new_stop_notify_msgBuilder*) clearNewStop; @end #define tg_stock_profit_notify_msg_date @"date" #define tg_stock_profit_notify_msg_code @"code" #define tg_stock_profit_notify_msg_target_price @"targetPrice" #define tg_stock_profit_notify_msg_sell_price @"sellPrice" #define tg_stock_profit_notify_msg_system_auto @"systemAuto" #define tg_stock_profit_notify_msg_desc @"desc" @interface tg_stock_profit_notify_msg : PBGeneratedMessage { @private BOOL hasSystemAuto_:1; BOOL hasTargetPrice_:1; BOOL hasSellPrice_:1; BOOL hasDate_:1; BOOL hasCode_:1; BOOL hasDesc_:1; BOOL systemAuto_:1; Float32 targetPrice; Float32 sellPrice; SInt64 date; NSString* code; NSString* desc; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasTargetPrice; - (BOOL) hasSellPrice; - (BOOL) hasSystemAuto; - (BOOL) hasDesc; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly) Float32 targetPrice; @property (readonly) Float32 sellPrice; - (BOOL) systemAuto; @property (readonly, strong) NSString* desc; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_profit_notify_msgBuilder*) builder; + (tg_stock_profit_notify_msgBuilder*) builder; + (tg_stock_profit_notify_msgBuilder*) builderWithPrototype:(tg_stock_profit_notify_msg*) prototype; - (tg_stock_profit_notify_msgBuilder*) toBuilder; + (tg_stock_profit_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_profit_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_profit_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_profit_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_profit_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_profit_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_profit_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_profit_notify_msg* resultTgStockProfitNotifyMsg; } - (tg_stock_profit_notify_msg*) defaultInstance; - (tg_stock_profit_notify_msgBuilder*) clear; - (tg_stock_profit_notify_msgBuilder*) clone; - (tg_stock_profit_notify_msg*) build; - (tg_stock_profit_notify_msg*) buildPartial; - (tg_stock_profit_notify_msgBuilder*) mergeFrom:(tg_stock_profit_notify_msg*) other; - (tg_stock_profit_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_profit_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_profit_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_profit_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_profit_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_profit_notify_msgBuilder*) clearCode; - (BOOL) hasTargetPrice; - (Float32) targetPrice; - (tg_stock_profit_notify_msgBuilder*) setTargetPrice:(Float32) value; - (tg_stock_profit_notify_msgBuilder*) clearTargetPrice; - (BOOL) hasSellPrice; - (Float32) sellPrice; - (tg_stock_profit_notify_msgBuilder*) setSellPrice:(Float32) value; - (tg_stock_profit_notify_msgBuilder*) clearSellPrice; - (BOOL) hasSystemAuto; - (BOOL) systemAuto; - (tg_stock_profit_notify_msgBuilder*) setSystemAuto:(BOOL) value; - (tg_stock_profit_notify_msgBuilder*) clearSystemAuto; - (BOOL) hasDesc; - (NSString*) desc; - (tg_stock_profit_notify_msgBuilder*) setDesc:(NSString*) value; - (tg_stock_profit_notify_msgBuilder*) clearDesc; @end #define tg_stock_stop_notify_msg_date @"date" #define tg_stock_stop_notify_msg_code @"code" #define tg_stock_stop_notify_msg_stop_price @"stopPrice" #define tg_stock_stop_notify_msg_sell_price @"sellPrice" #define tg_stock_stop_notify_msg_system_auto @"systemAuto" #define tg_stock_stop_notify_msg_desc @"desc" @interface tg_stock_stop_notify_msg : PBGeneratedMessage { @private BOOL hasSystemAuto_:1; BOOL hasStopPrice_:1; BOOL hasSellPrice_:1; BOOL hasDate_:1; BOOL hasCode_:1; BOOL hasDesc_:1; BOOL systemAuto_:1; Float32 stopPrice; Float32 sellPrice; SInt64 date; NSString* code; NSString* desc; } - (BOOL) hasDate; - (BOOL) hasCode; - (BOOL) hasStopPrice; - (BOOL) hasSellPrice; - (BOOL) hasSystemAuto; - (BOOL) hasDesc; @property (readonly) SInt64 date; @property (readonly, strong) NSString* code; @property (readonly) Float32 stopPrice; @property (readonly) Float32 sellPrice; - (BOOL) systemAuto; @property (readonly, strong) NSString* desc; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_stock_stop_notify_msgBuilder*) builder; + (tg_stock_stop_notify_msgBuilder*) builder; + (tg_stock_stop_notify_msgBuilder*) builderWithPrototype:(tg_stock_stop_notify_msg*) prototype; - (tg_stock_stop_notify_msgBuilder*) toBuilder; + (tg_stock_stop_notify_msg*) parseFromData:(NSData*) data; + (tg_stock_stop_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_stock_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_stock_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_stock_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_stock_stop_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_stock_stop_notify_msg* resultTgStockStopNotifyMsg; } - (tg_stock_stop_notify_msg*) defaultInstance; - (tg_stock_stop_notify_msgBuilder*) clear; - (tg_stock_stop_notify_msgBuilder*) clone; - (tg_stock_stop_notify_msg*) build; - (tg_stock_stop_notify_msg*) buildPartial; - (tg_stock_stop_notify_msgBuilder*) mergeFrom:(tg_stock_stop_notify_msg*) other; - (tg_stock_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_stock_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_stock_stop_notify_msgBuilder*) setDate:(SInt64) value; - (tg_stock_stop_notify_msgBuilder*) clearDate; - (BOOL) hasCode; - (NSString*) code; - (tg_stock_stop_notify_msgBuilder*) setCode:(NSString*) value; - (tg_stock_stop_notify_msgBuilder*) clearCode; - (BOOL) hasStopPrice; - (Float32) stopPrice; - (tg_stock_stop_notify_msgBuilder*) setStopPrice:(Float32) value; - (tg_stock_stop_notify_msgBuilder*) clearStopPrice; - (BOOL) hasSellPrice; - (Float32) sellPrice; - (tg_stock_stop_notify_msgBuilder*) setSellPrice:(Float32) value; - (tg_stock_stop_notify_msgBuilder*) clearSellPrice; - (BOOL) hasSystemAuto; - (BOOL) systemAuto; - (tg_stock_stop_notify_msgBuilder*) setSystemAuto:(BOOL) value; - (tg_stock_stop_notify_msgBuilder*) clearSystemAuto; - (BOOL) hasDesc; - (NSString*) desc; - (tg_stock_stop_notify_msgBuilder*) setDesc:(NSString*) value; - (tg_stock_stop_notify_msgBuilder*) clearDesc; @end #define tg_focus_news_notify_msg_date @"date" #define tg_focus_news_notify_msg_title @"title" #define tg_focus_news_notify_msg_content @"content" #define tg_focus_news_notify_msg_url @"url" @interface tg_focus_news_notify_msg : PBGeneratedMessage { @private BOOL hasDate_:1; BOOL hasTitle_:1; BOOL hasContent_:1; BOOL hasUrl_:1; SInt64 date; NSString* title; NSString* content; NSString* url; } - (BOOL) hasDate; - (BOOL) hasTitle; - (BOOL) hasContent; - (BOOL) hasUrl; @property (readonly) SInt64 date; @property (readonly, strong) NSString* title; @property (readonly, strong) NSString* content; @property (readonly, strong) NSString* url; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_focus_news_notify_msgBuilder*) builder; + (tg_focus_news_notify_msgBuilder*) builder; + (tg_focus_news_notify_msgBuilder*) builderWithPrototype:(tg_focus_news_notify_msg*) prototype; - (tg_focus_news_notify_msgBuilder*) toBuilder; + (tg_focus_news_notify_msg*) parseFromData:(NSData*) data; + (tg_focus_news_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_focus_news_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_focus_news_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_focus_news_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_focus_news_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_focus_news_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_focus_news_notify_msg* resultTgFocusNewsNotifyMsg; } - (tg_focus_news_notify_msg*) defaultInstance; - (tg_focus_news_notify_msgBuilder*) clear; - (tg_focus_news_notify_msgBuilder*) clone; - (tg_focus_news_notify_msg*) build; - (tg_focus_news_notify_msg*) buildPartial; - (tg_focus_news_notify_msgBuilder*) mergeFrom:(tg_focus_news_notify_msg*) other; - (tg_focus_news_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_focus_news_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_focus_news_notify_msgBuilder*) setDate:(SInt64) value; - (tg_focus_news_notify_msgBuilder*) clearDate; - (BOOL) hasTitle; - (NSString*) title; - (tg_focus_news_notify_msgBuilder*) setTitle:(NSString*) value; - (tg_focus_news_notify_msgBuilder*) clearTitle; - (BOOL) hasContent; - (NSString*) content; - (tg_focus_news_notify_msgBuilder*) setContent:(NSString*) value; - (tg_focus_news_notify_msgBuilder*) clearContent; - (BOOL) hasUrl; - (NSString*) url; - (tg_focus_news_notify_msgBuilder*) setUrl:(NSString*) value; - (tg_focus_news_notify_msgBuilder*) clearUrl; @end #define tg_trailer_notify_msg_date @"date" #define tg_trailer_notify_msg_title @"title" #define tg_trailer_notify_msg_content @"content" #define tg_trailer_notify_msg_url @"url" @interface tg_trailer_notify_msg : PBGeneratedMessage { @private BOOL hasDate_:1; BOOL hasTitle_:1; BOOL hasContent_:1; BOOL hasUrl_:1; SInt64 date; NSString* title; NSString* content; NSString* url; } - (BOOL) hasDate; - (BOOL) hasTitle; - (BOOL) hasContent; - (BOOL) hasUrl; @property (readonly) SInt64 date; @property (readonly, strong) NSString* title; @property (readonly, strong) NSString* content; @property (readonly, strong) NSString* url; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_trailer_notify_msgBuilder*) builder; + (tg_trailer_notify_msgBuilder*) builder; + (tg_trailer_notify_msgBuilder*) builderWithPrototype:(tg_trailer_notify_msg*) prototype; - (tg_trailer_notify_msgBuilder*) toBuilder; + (tg_trailer_notify_msg*) parseFromData:(NSData*) data; + (tg_trailer_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_trailer_notify_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_trailer_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_trailer_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_trailer_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_trailer_notify_msgBuilder : PBGeneratedMessageBuilder { @private tg_trailer_notify_msg* resultTgTrailerNotifyMsg; } - (tg_trailer_notify_msg*) defaultInstance; - (tg_trailer_notify_msgBuilder*) clear; - (tg_trailer_notify_msgBuilder*) clone; - (tg_trailer_notify_msg*) build; - (tg_trailer_notify_msg*) buildPartial; - (tg_trailer_notify_msgBuilder*) mergeFrom:(tg_trailer_notify_msg*) other; - (tg_trailer_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_trailer_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDate; - (SInt64) date; - (tg_trailer_notify_msgBuilder*) setDate:(SInt64) value; - (tg_trailer_notify_msgBuilder*) clearDate; - (BOOL) hasTitle; - (NSString*) title; - (tg_trailer_notify_msgBuilder*) setTitle:(NSString*) value; - (tg_trailer_notify_msgBuilder*) clearTitle; - (BOOL) hasContent; - (NSString*) content; - (tg_trailer_notify_msgBuilder*) setContent:(NSString*) value; - (tg_trailer_notify_msgBuilder*) clearContent; - (BOOL) hasUrl; - (NSString*) url; - (tg_trailer_notify_msgBuilder*) setUrl:(NSString*) value; - (tg_trailer_notify_msgBuilder*) clearUrl; @end #define tg_req_msg_box_msg_pid @"pid" #define tg_req_msg_box_msg_last_seq @"lastSeq" @interface tg_req_msg_box_msg : PBGeneratedMessage { @private BOOL hasLastSeq_:1; BOOL hasPid_:1; SInt64 lastSeq; SInt32 pid; } - (BOOL) hasPid; - (BOOL) hasLastSeq; @property (readonly) SInt32 pid; @property (readonly) SInt64 lastSeq; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_req_msg_box_msgBuilder*) builder; + (tg_req_msg_box_msgBuilder*) builder; + (tg_req_msg_box_msgBuilder*) builderWithPrototype:(tg_req_msg_box_msg*) prototype; - (tg_req_msg_box_msgBuilder*) toBuilder; + (tg_req_msg_box_msg*) parseFromData:(NSData*) data; + (tg_req_msg_box_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_req_msg_box_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_req_msg_box_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_req_msg_box_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_req_msg_box_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_req_msg_box_msgBuilder : PBGeneratedMessageBuilder { @private tg_req_msg_box_msg* resultTgReqMsgBoxMsg; } - (tg_req_msg_box_msg*) defaultInstance; - (tg_req_msg_box_msgBuilder*) clear; - (tg_req_msg_box_msgBuilder*) clone; - (tg_req_msg_box_msg*) build; - (tg_req_msg_box_msg*) buildPartial; - (tg_req_msg_box_msgBuilder*) mergeFrom:(tg_req_msg_box_msg*) other; - (tg_req_msg_box_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_req_msg_box_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasPid; - (SInt32) pid; - (tg_req_msg_box_msgBuilder*) setPid:(SInt32) value; - (tg_req_msg_box_msgBuilder*) clearPid; - (BOOL) hasLastSeq; - (SInt64) lastSeq; - (tg_req_msg_box_msgBuilder*) setLastSeq:(SInt64) value; - (tg_req_msg_box_msgBuilder*) clearLastSeq; @end #define tg_msg_box_combo_msg_msgs @"msgs" @interface tg_msg_box_combo_msg : PBGeneratedMessage { @private NSMutableArray * msgsArray; } @property (readonly, strong) NSArray * msgs; - (tg_msg_box_combo_msgtg_msg_node*)msgsAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_msg_box_combo_msgBuilder*) builder; + (tg_msg_box_combo_msgBuilder*) builder; + (tg_msg_box_combo_msgBuilder*) builderWithPrototype:(tg_msg_box_combo_msg*) prototype; - (tg_msg_box_combo_msgBuilder*) toBuilder; + (tg_msg_box_combo_msg*) parseFromData:(NSData*) data; + (tg_msg_box_combo_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_msg_box_combo_msg*) parseFromInputStream:(NSInputStream*) input; + (tg_msg_box_combo_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_msg_box_combo_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_msg_box_combo_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end #define tg_msg_node_type @"type" #define tg_msg_node_sub_msg @"subMsg" #define tg_msg_node_msg_seq @"msgSeq" @interface tg_msg_box_combo_msgtg_msg_node : PBGeneratedMessage { @private BOOL hasMsgSeq_:1; BOOL hasSubMsg_:1; BOOL hasType_:1; SInt64 msgSeq; NSData* subMsg; eum_nofity_type type; } - (BOOL) hasType; - (BOOL) hasSubMsg; - (BOOL) hasMsgSeq; @property (readonly) eum_nofity_type type; @property (readonly, strong) NSData* subMsg; @property (readonly) SInt64 msgSeq; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) builder; + (tg_msg_box_combo_msgtg_msg_nodeBuilder*) builder; + (tg_msg_box_combo_msgtg_msg_nodeBuilder*) builderWithPrototype:(tg_msg_box_combo_msgtg_msg_node*) prototype; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) toBuilder; + (tg_msg_box_combo_msgtg_msg_node*) parseFromData:(NSData*) data; + (tg_msg_box_combo_msgtg_msg_node*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_msg_box_combo_msgtg_msg_node*) parseFromInputStream:(NSInputStream*) input; + (tg_msg_box_combo_msgtg_msg_node*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (tg_msg_box_combo_msgtg_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (tg_msg_box_combo_msgtg_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface tg_msg_box_combo_msgtg_msg_nodeBuilder : PBGeneratedMessageBuilder { @private tg_msg_box_combo_msgtg_msg_node* resultTgMsgNode; } - (tg_msg_box_combo_msgtg_msg_node*) defaultInstance; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clear; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clone; - (tg_msg_box_combo_msgtg_msg_node*) build; - (tg_msg_box_combo_msgtg_msg_node*) buildPartial; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) mergeFrom:(tg_msg_box_combo_msgtg_msg_node*) other; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasType; - (eum_nofity_type) type; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) setType:(eum_nofity_type) value; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clearType; - (BOOL) hasSubMsg; - (NSData*) subMsg; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) setSubMsg:(NSData*) value; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clearSubMsg; - (BOOL) hasMsgSeq; - (SInt64) msgSeq; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) setMsgSeq:(SInt64) value; - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clearMsgSeq; @end @interface tg_msg_box_combo_msgBuilder : PBGeneratedMessageBuilder { @private tg_msg_box_combo_msg* resultTgMsgBoxComboMsg; } - (tg_msg_box_combo_msg*) defaultInstance; - (tg_msg_box_combo_msgBuilder*) clear; - (tg_msg_box_combo_msgBuilder*) clone; - (tg_msg_box_combo_msg*) build; - (tg_msg_box_combo_msg*) buildPartial; - (tg_msg_box_combo_msgBuilder*) mergeFrom:(tg_msg_box_combo_msg*) other; - (tg_msg_box_combo_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (tg_msg_box_combo_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)msgs; - (tg_msg_box_combo_msgtg_msg_node*)msgsAtIndex:(NSUInteger)index; - (tg_msg_box_combo_msgBuilder *)addMsgs:(tg_msg_box_combo_msgtg_msg_node*)value; - (tg_msg_box_combo_msgBuilder *)setMsgsArray:(NSArray *)array; - (tg_msg_box_combo_msgBuilder *)clearMsgs; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Investment.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Investment.pb.h" // @@protoc_insertion_point(imports) @implementation InvestmentRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [InvestmentRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; [CommonRoot registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end BOOL tg_investment_period_typeIsValidValue(tg_investment_period_type value) { switch (value) { case tg_investment_period_typeTgInvestmentPeriodTypeNull: case tg_investment_period_typeTgShortPeriod: case tg_investment_period_typeTgMidPeriod: case tg_investment_period_typeTgLongPeriod: return YES; default: return NO; } } NSString *NSStringFromtg_investment_period_type(tg_investment_period_type value) { switch (value) { case tg_investment_period_typeTgInvestmentPeriodTypeNull: return @"tg_investment_period_typeTgInvestmentPeriodTypeNull"; case tg_investment_period_typeTgShortPeriod: return @"tg_investment_period_typeTgShortPeriod"; case tg_investment_period_typeTgMidPeriod: return @"tg_investment_period_typeTgMidPeriod"; case tg_investment_period_typeTgLongPeriod: return @"tg_investment_period_typeTgLongPeriod"; default: return nil; } } BOOL tg_stock_investment_stateIsValidValue(tg_stock_investment_state value) { switch (value) { case tg_stock_investment_stateTgStockInvestmentStateNull: case tg_stock_investment_stateTgInPool: case tg_stock_investment_stateTgAutoBuy: case tg_stock_investment_stateTgManualBuy: case tg_stock_investment_stateTgHold: case tg_stock_investment_stateTgOutPool: case tg_stock_investment_stateTgModifyProfit: case tg_stock_investment_stateTgModifyStop: case tg_stock_investment_stateTgAutoProfit: case tg_stock_investment_stateTgAutoStop: case tg_stock_investment_stateTgManuallyProfit: case tg_stock_investment_stateTgManuallyStop: return YES; default: return NO; } } NSString *NSStringFromtg_stock_investment_state(tg_stock_investment_state value) { switch (value) { case tg_stock_investment_stateTgStockInvestmentStateNull: return @"tg_stock_investment_stateTgStockInvestmentStateNull"; case tg_stock_investment_stateTgInPool: return @"tg_stock_investment_stateTgInPool"; case tg_stock_investment_stateTgAutoBuy: return @"tg_stock_investment_stateTgAutoBuy"; case tg_stock_investment_stateTgManualBuy: return @"tg_stock_investment_stateTgManualBuy"; case tg_stock_investment_stateTgHold: return @"tg_stock_investment_stateTgHold"; case tg_stock_investment_stateTgOutPool: return @"tg_stock_investment_stateTgOutPool"; case tg_stock_investment_stateTgModifyProfit: return @"tg_stock_investment_stateTgModifyProfit"; case tg_stock_investment_stateTgModifyStop: return @"tg_stock_investment_stateTgModifyStop"; case tg_stock_investment_stateTgAutoProfit: return @"tg_stock_investment_stateTgAutoProfit"; case tg_stock_investment_stateTgAutoStop: return @"tg_stock_investment_stateTgAutoStop"; case tg_stock_investment_stateTgManuallyProfit: return @"tg_stock_investment_stateTgManuallyProfit"; case tg_stock_investment_stateTgManuallyStop: return @"tg_stock_investment_stateTgManuallyStop"; default: return nil; } } @interface tg_stock_att () @property (strong) NSString* code; @property SInt64 date; @property Float32 lowBuyPirce; @property Float32 highBuyPrice; @property Float32 targetPrice; @property Float32 stopPrice; @property tg_investment_period_type invType; @property tg_stock_investment_state buyState; @property Float32 currentBuyPrice; @property Float32 currentSellPrice; @end @implementation tg_stock_att - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasLowBuyPirce { return !!hasLowBuyPirce_; } - (void) setHasLowBuyPirce:(BOOL) _value_ { hasLowBuyPirce_ = !!_value_; } @synthesize lowBuyPirce; - (BOOL) hasHighBuyPrice { return !!hasHighBuyPrice_; } - (void) setHasHighBuyPrice:(BOOL) _value_ { hasHighBuyPrice_ = !!_value_; } @synthesize highBuyPrice; - (BOOL) hasTargetPrice { return !!hasTargetPrice_; } - (void) setHasTargetPrice:(BOOL) _value_ { hasTargetPrice_ = !!_value_; } @synthesize targetPrice; - (BOOL) hasStopPrice { return !!hasStopPrice_; } - (void) setHasStopPrice:(BOOL) _value_ { hasStopPrice_ = !!_value_; } @synthesize stopPrice; - (BOOL) hasInvType { return !!hasInvType_; } - (void) setHasInvType:(BOOL) _value_ { hasInvType_ = !!_value_; } @synthesize invType; - (BOOL) hasBuyState { return !!hasBuyState_; } - (void) setHasBuyState:(BOOL) _value_ { hasBuyState_ = !!_value_; } @synthesize buyState; - (BOOL) hasCurrentBuyPrice { return !!hasCurrentBuyPrice_; } - (void) setHasCurrentBuyPrice:(BOOL) _value_ { hasCurrentBuyPrice_ = !!_value_; } @synthesize currentBuyPrice; - (BOOL) hasCurrentSellPrice { return !!hasCurrentSellPrice_; } - (void) setHasCurrentSellPrice:(BOOL) _value_ { hasCurrentSellPrice_ = !!_value_; } @synthesize currentSellPrice; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.date = 0L; self.lowBuyPirce = 0; self.highBuyPrice = 0; self.targetPrice = 0; self.stopPrice = 0; self.invType = tg_investment_period_typeTgInvestmentPeriodTypeNull; self.buyState = tg_stock_investment_stateTgStockInvestmentStateNull; self.currentBuyPrice = 0; self.currentSellPrice = 0; } return self; } static tg_stock_att* defaulttg_stock_attInstance = nil; + (void) initialize { if (self == [tg_stock_att class]) { defaulttg_stock_attInstance = [[tg_stock_att alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_attInstance; } - (instancetype) defaultInstance { return defaulttg_stock_attInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasDate) { return NO; } if (!self.hasLowBuyPirce) { return NO; } if (!self.hasHighBuyPrice) { return NO; } if (!self.hasTargetPrice) { return NO; } if (!self.hasStopPrice) { return NO; } if (!self.hasInvType) { return NO; } if (!self.hasBuyState) { return NO; } if (!self.hasCurrentBuyPrice) { return NO; } if (!self.hasCurrentSellPrice) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasDate) { [output writeInt64:2 value:self.date]; } if (self.hasLowBuyPirce) { [output writeFloat:3 value:self.lowBuyPirce]; } if (self.hasHighBuyPrice) { [output writeFloat:4 value:self.highBuyPrice]; } if (self.hasTargetPrice) { [output writeFloat:5 value:self.targetPrice]; } if (self.hasStopPrice) { [output writeFloat:6 value:self.stopPrice]; } if (self.hasInvType) { [output writeEnum:7 value:self.invType]; } if (self.hasBuyState) { [output writeEnum:8 value:self.buyState]; } if (self.hasCurrentBuyPrice) { [output writeFloat:9 value:self.currentBuyPrice]; } if (self.hasCurrentSellPrice) { [output writeFloat:10 value:self.currentSellPrice]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasDate) { size_ += computeInt64Size(2, self.date); } if (self.hasLowBuyPirce) { size_ += computeFloatSize(3, self.lowBuyPirce); } if (self.hasHighBuyPrice) { size_ += computeFloatSize(4, self.highBuyPrice); } if (self.hasTargetPrice) { size_ += computeFloatSize(5, self.targetPrice); } if (self.hasStopPrice) { size_ += computeFloatSize(6, self.stopPrice); } if (self.hasInvType) { size_ += computeEnumSize(7, self.invType); } if (self.hasBuyState) { size_ += computeEnumSize(8, self.buyState); } if (self.hasCurrentBuyPrice) { size_ += computeFloatSize(9, self.currentBuyPrice); } if (self.hasCurrentSellPrice) { size_ += computeFloatSize(10, self.currentSellPrice); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_att*) parseFromData:(NSData*) data { return (tg_stock_att*)[[[tg_stock_att builder] mergeFromData:data] build]; } + (tg_stock_att*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_att*)[[[tg_stock_att builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_att*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_att*)[[[tg_stock_att builder] mergeFromInputStream:input] build]; } + (tg_stock_att*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_att*)[[[tg_stock_att builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_att*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_att*)[[[tg_stock_att builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_att*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_att*)[[[tg_stock_att builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_attBuilder*) builder { return [[tg_stock_attBuilder alloc] init]; } + (tg_stock_attBuilder*) builderWithPrototype:(tg_stock_att*) prototype { return [[tg_stock_att builder] mergeFrom:prototype]; } - (tg_stock_attBuilder*) builder { return [tg_stock_att builder]; } - (tg_stock_attBuilder*) toBuilder { return [tg_stock_att builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasLowBuyPirce) { [output appendFormat:@"%@%@: %@\n", indent, @"lowBuyPirce", [NSNumber numberWithFloat:self.lowBuyPirce]]; } if (self.hasHighBuyPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"highBuyPrice", [NSNumber numberWithFloat:self.highBuyPrice]]; } if (self.hasTargetPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"targetPrice", [NSNumber numberWithFloat:self.targetPrice]]; } if (self.hasStopPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"stopPrice", [NSNumber numberWithFloat:self.stopPrice]]; } if (self.hasInvType) { [output appendFormat:@"%@%@: %@\n", indent, @"invType", NSStringFromtg_investment_period_type(self.invType)]; } if (self.hasBuyState) { [output appendFormat:@"%@%@: %@\n", indent, @"buyState", NSStringFromtg_stock_investment_state(self.buyState)]; } if (self.hasCurrentBuyPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"currentBuyPrice", [NSNumber numberWithFloat:self.currentBuyPrice]]; } if (self.hasCurrentSellPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"currentSellPrice", [NSNumber numberWithFloat:self.currentSellPrice]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasLowBuyPirce) { [dictionary setObject: [NSNumber numberWithFloat:self.lowBuyPirce] forKey: @"lowBuyPirce"]; } if (self.hasHighBuyPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.highBuyPrice] forKey: @"highBuyPrice"]; } if (self.hasTargetPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.targetPrice] forKey: @"targetPrice"]; } if (self.hasStopPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.stopPrice] forKey: @"stopPrice"]; } if (self.hasInvType) { [dictionary setObject: @(self.invType) forKey: @"invType"]; } if (self.hasBuyState) { [dictionary setObject: @(self.buyState) forKey: @"buyState"]; } if (self.hasCurrentBuyPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.currentBuyPrice] forKey: @"currentBuyPrice"]; } if (self.hasCurrentSellPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.currentSellPrice] forKey: @"currentSellPrice"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_att class]]) { return NO; } tg_stock_att *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasLowBuyPirce == otherMessage.hasLowBuyPirce && (!self.hasLowBuyPirce || self.lowBuyPirce == otherMessage.lowBuyPirce) && self.hasHighBuyPrice == otherMessage.hasHighBuyPrice && (!self.hasHighBuyPrice || self.highBuyPrice == otherMessage.highBuyPrice) && self.hasTargetPrice == otherMessage.hasTargetPrice && (!self.hasTargetPrice || self.targetPrice == otherMessage.targetPrice) && self.hasStopPrice == otherMessage.hasStopPrice && (!self.hasStopPrice || self.stopPrice == otherMessage.stopPrice) && self.hasInvType == otherMessage.hasInvType && (!self.hasInvType || self.invType == otherMessage.invType) && self.hasBuyState == otherMessage.hasBuyState && (!self.hasBuyState || self.buyState == otherMessage.buyState) && self.hasCurrentBuyPrice == otherMessage.hasCurrentBuyPrice && (!self.hasCurrentBuyPrice || self.currentBuyPrice == otherMessage.currentBuyPrice) && self.hasCurrentSellPrice == otherMessage.hasCurrentSellPrice && (!self.hasCurrentSellPrice || self.currentSellPrice == otherMessage.currentSellPrice) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasLowBuyPirce) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.lowBuyPirce] hash]; } if (self.hasHighBuyPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.highBuyPrice] hash]; } if (self.hasTargetPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.targetPrice] hash]; } if (self.hasStopPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.stopPrice] hash]; } if (self.hasInvType) { hashCode = hashCode * 31 + self.invType; } if (self.hasBuyState) { hashCode = hashCode * 31 + self.buyState; } if (self.hasCurrentBuyPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.currentBuyPrice] hash]; } if (self.hasCurrentSellPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.currentSellPrice] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_attBuilder() @property (strong) tg_stock_att* resultTgStockAtt; @end @implementation tg_stock_attBuilder @synthesize resultTgStockAtt; - (instancetype) init { if ((self = [super init])) { self.resultTgStockAtt = [[tg_stock_att alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockAtt; } - (tg_stock_attBuilder*) clear { self.resultTgStockAtt = [[tg_stock_att alloc] init]; return self; } - (tg_stock_attBuilder*) clone { return [tg_stock_att builderWithPrototype:resultTgStockAtt]; } - (tg_stock_att*) defaultInstance { return [tg_stock_att defaultInstance]; } - (tg_stock_att*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_att*) buildPartial { tg_stock_att* returnMe = resultTgStockAtt; self.resultTgStockAtt = nil; return returnMe; } - (tg_stock_attBuilder*) mergeFrom:(tg_stock_att*) other { if (other == [tg_stock_att defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasLowBuyPirce) { [self setLowBuyPirce:other.lowBuyPirce]; } if (other.hasHighBuyPrice) { [self setHighBuyPrice:other.highBuyPrice]; } if (other.hasTargetPrice) { [self setTargetPrice:other.targetPrice]; } if (other.hasStopPrice) { [self setStopPrice:other.stopPrice]; } if (other.hasInvType) { [self setInvType:other.invType]; } if (other.hasBuyState) { [self setBuyState:other.buyState]; } if (other.hasCurrentBuyPrice) { [self setCurrentBuyPrice:other.currentBuyPrice]; } if (other.hasCurrentSellPrice) { [self setCurrentSellPrice:other.currentSellPrice]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_attBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_attBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 16: { [self setDate:[input readInt64]]; break; } case 29: { [self setLowBuyPirce:[input readFloat]]; break; } case 37: { [self setHighBuyPrice:[input readFloat]]; break; } case 45: { [self setTargetPrice:[input readFloat]]; break; } case 53: { [self setStopPrice:[input readFloat]]; break; } case 56: { tg_investment_period_type value = (tg_investment_period_type)[input readEnum]; if (tg_investment_period_typeIsValidValue(value)) { [self setInvType:value]; } else { [unknownFields mergeVarintField:7 value:value]; } break; } case 64: { tg_stock_investment_state value = (tg_stock_investment_state)[input readEnum]; if (tg_stock_investment_stateIsValidValue(value)) { [self setBuyState:value]; } else { [unknownFields mergeVarintField:8 value:value]; } break; } case 77: { [self setCurrentBuyPrice:[input readFloat]]; break; } case 85: { [self setCurrentSellPrice:[input readFloat]]; break; } } } } - (BOOL) hasCode { return resultTgStockAtt.hasCode; } - (NSString*) code { return resultTgStockAtt.code; } - (tg_stock_attBuilder*) setCode:(NSString*) value { resultTgStockAtt.hasCode = YES; resultTgStockAtt.code = value; return self; } - (tg_stock_attBuilder*) clearCode { resultTgStockAtt.hasCode = NO; resultTgStockAtt.code = @""; return self; } - (BOOL) hasDate { return resultTgStockAtt.hasDate; } - (SInt64) date { return resultTgStockAtt.date; } - (tg_stock_attBuilder*) setDate:(SInt64) value { resultTgStockAtt.hasDate = YES; resultTgStockAtt.date = value; return self; } - (tg_stock_attBuilder*) clearDate { resultTgStockAtt.hasDate = NO; resultTgStockAtt.date = 0L; return self; } - (BOOL) hasLowBuyPirce { return resultTgStockAtt.hasLowBuyPirce; } - (Float32) lowBuyPirce { return resultTgStockAtt.lowBuyPirce; } - (tg_stock_attBuilder*) setLowBuyPirce:(Float32) value { resultTgStockAtt.hasLowBuyPirce = YES; resultTgStockAtt.lowBuyPirce = value; return self; } - (tg_stock_attBuilder*) clearLowBuyPirce { resultTgStockAtt.hasLowBuyPirce = NO; resultTgStockAtt.lowBuyPirce = 0; return self; } - (BOOL) hasHighBuyPrice { return resultTgStockAtt.hasHighBuyPrice; } - (Float32) highBuyPrice { return resultTgStockAtt.highBuyPrice; } - (tg_stock_attBuilder*) setHighBuyPrice:(Float32) value { resultTgStockAtt.hasHighBuyPrice = YES; resultTgStockAtt.highBuyPrice = value; return self; } - (tg_stock_attBuilder*) clearHighBuyPrice { resultTgStockAtt.hasHighBuyPrice = NO; resultTgStockAtt.highBuyPrice = 0; return self; } - (BOOL) hasTargetPrice { return resultTgStockAtt.hasTargetPrice; } - (Float32) targetPrice { return resultTgStockAtt.targetPrice; } - (tg_stock_attBuilder*) setTargetPrice:(Float32) value { resultTgStockAtt.hasTargetPrice = YES; resultTgStockAtt.targetPrice = value; return self; } - (tg_stock_attBuilder*) clearTargetPrice { resultTgStockAtt.hasTargetPrice = NO; resultTgStockAtt.targetPrice = 0; return self; } - (BOOL) hasStopPrice { return resultTgStockAtt.hasStopPrice; } - (Float32) stopPrice { return resultTgStockAtt.stopPrice; } - (tg_stock_attBuilder*) setStopPrice:(Float32) value { resultTgStockAtt.hasStopPrice = YES; resultTgStockAtt.stopPrice = value; return self; } - (tg_stock_attBuilder*) clearStopPrice { resultTgStockAtt.hasStopPrice = NO; resultTgStockAtt.stopPrice = 0; return self; } - (BOOL) hasInvType { return resultTgStockAtt.hasInvType; } - (tg_investment_period_type) invType { return resultTgStockAtt.invType; } - (tg_stock_attBuilder*) setInvType:(tg_investment_period_type) value { resultTgStockAtt.hasInvType = YES; resultTgStockAtt.invType = value; return self; } - (tg_stock_attBuilder*) clearInvType { resultTgStockAtt.hasInvType = NO; resultTgStockAtt.invType = tg_investment_period_typeTgInvestmentPeriodTypeNull; return self; } - (BOOL) hasBuyState { return resultTgStockAtt.hasBuyState; } - (tg_stock_investment_state) buyState { return resultTgStockAtt.buyState; } - (tg_stock_attBuilder*) setBuyState:(tg_stock_investment_state) value { resultTgStockAtt.hasBuyState = YES; resultTgStockAtt.buyState = value; return self; } - (tg_stock_attBuilder*) clearBuyState { resultTgStockAtt.hasBuyState = NO; resultTgStockAtt.buyState = tg_stock_investment_stateTgStockInvestmentStateNull; return self; } - (BOOL) hasCurrentBuyPrice { return resultTgStockAtt.hasCurrentBuyPrice; } - (Float32) currentBuyPrice { return resultTgStockAtt.currentBuyPrice; } - (tg_stock_attBuilder*) setCurrentBuyPrice:(Float32) value { resultTgStockAtt.hasCurrentBuyPrice = YES; resultTgStockAtt.currentBuyPrice = value; return self; } - (tg_stock_attBuilder*) clearCurrentBuyPrice { resultTgStockAtt.hasCurrentBuyPrice = NO; resultTgStockAtt.currentBuyPrice = 0; return self; } - (BOOL) hasCurrentSellPrice { return resultTgStockAtt.hasCurrentSellPrice; } - (Float32) currentSellPrice { return resultTgStockAtt.currentSellPrice; } - (tg_stock_attBuilder*) setCurrentSellPrice:(Float32) value { resultTgStockAtt.hasCurrentSellPrice = YES; resultTgStockAtt.currentSellPrice = value; return self; } - (tg_stock_attBuilder*) clearCurrentSellPrice { resultTgStockAtt.hasCurrentSellPrice = NO; resultTgStockAtt.currentSellPrice = 0; return self; } @end @interface tg_req_stock_pool_msg () @property SInt64 versionId; @property SInt32 pid; @end @implementation tg_req_stock_pool_msg - (BOOL) hasVersionId { return !!hasVersionId_; } - (void) setHasVersionId:(BOOL) _value_ { hasVersionId_ = !!_value_; } @synthesize versionId; - (BOOL) hasPid { return !!hasPid_; } - (void) setHasPid:(BOOL) _value_ { hasPid_ = !!_value_; } @synthesize pid; - (instancetype) init { if ((self = [super init])) { self.versionId = 0L; self.pid = 0; } return self; } static tg_req_stock_pool_msg* defaulttg_req_stock_pool_msgInstance = nil; + (void) initialize { if (self == [tg_req_stock_pool_msg class]) { defaulttg_req_stock_pool_msgInstance = [[tg_req_stock_pool_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_req_stock_pool_msgInstance; } - (instancetype) defaultInstance { return defaulttg_req_stock_pool_msgInstance; } - (BOOL) isInitialized { if (!self.hasVersionId) { return NO; } if (!self.hasPid) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasVersionId) { [output writeInt64:1 value:self.versionId]; } if (self.hasPid) { [output writeInt32:2 value:self.pid]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasVersionId) { size_ += computeInt64Size(1, self.versionId); } if (self.hasPid) { size_ += computeInt32Size(2, self.pid); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_req_stock_pool_msg*) parseFromData:(NSData*) data { return (tg_req_stock_pool_msg*)[[[tg_req_stock_pool_msg builder] mergeFromData:data] build]; } + (tg_req_stock_pool_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_req_stock_pool_msg*)[[[tg_req_stock_pool_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_req_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_req_stock_pool_msg*)[[[tg_req_stock_pool_msg builder] mergeFromInputStream:input] build]; } + (tg_req_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_req_stock_pool_msg*)[[[tg_req_stock_pool_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_req_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_req_stock_pool_msg*)[[[tg_req_stock_pool_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_req_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_req_stock_pool_msg*)[[[tg_req_stock_pool_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_req_stock_pool_msgBuilder*) builder { return [[tg_req_stock_pool_msgBuilder alloc] init]; } + (tg_req_stock_pool_msgBuilder*) builderWithPrototype:(tg_req_stock_pool_msg*) prototype { return [[tg_req_stock_pool_msg builder] mergeFrom:prototype]; } - (tg_req_stock_pool_msgBuilder*) builder { return [tg_req_stock_pool_msg builder]; } - (tg_req_stock_pool_msgBuilder*) toBuilder { return [tg_req_stock_pool_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasVersionId) { [output appendFormat:@"%@%@: %@\n", indent, @"versionId", [NSNumber numberWithLongLong:self.versionId]]; } if (self.hasPid) { [output appendFormat:@"%@%@: %@\n", indent, @"pid", [NSNumber numberWithInteger:self.pid]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasVersionId) { [dictionary setObject: [NSNumber numberWithLongLong:self.versionId] forKey: @"versionId"]; } if (self.hasPid) { [dictionary setObject: [NSNumber numberWithInteger:self.pid] forKey: @"pid"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_req_stock_pool_msg class]]) { return NO; } tg_req_stock_pool_msg *otherMessage = other; return self.hasVersionId == otherMessage.hasVersionId && (!self.hasVersionId || self.versionId == otherMessage.versionId) && self.hasPid == otherMessage.hasPid && (!self.hasPid || self.pid == otherMessage.pid) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasVersionId) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.versionId] hash]; } if (self.hasPid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.pid] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_req_stock_pool_msgBuilder() @property (strong) tg_req_stock_pool_msg* resultTgReqStockPoolMsg; @end @implementation tg_req_stock_pool_msgBuilder @synthesize resultTgReqStockPoolMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgReqStockPoolMsg = [[tg_req_stock_pool_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgReqStockPoolMsg; } - (tg_req_stock_pool_msgBuilder*) clear { self.resultTgReqStockPoolMsg = [[tg_req_stock_pool_msg alloc] init]; return self; } - (tg_req_stock_pool_msgBuilder*) clone { return [tg_req_stock_pool_msg builderWithPrototype:resultTgReqStockPoolMsg]; } - (tg_req_stock_pool_msg*) defaultInstance { return [tg_req_stock_pool_msg defaultInstance]; } - (tg_req_stock_pool_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_req_stock_pool_msg*) buildPartial { tg_req_stock_pool_msg* returnMe = resultTgReqStockPoolMsg; self.resultTgReqStockPoolMsg = nil; return returnMe; } - (tg_req_stock_pool_msgBuilder*) mergeFrom:(tg_req_stock_pool_msg*) other { if (other == [tg_req_stock_pool_msg defaultInstance]) { return self; } if (other.hasVersionId) { [self setVersionId:other.versionId]; } if (other.hasPid) { [self setPid:other.pid]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_req_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_req_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setVersionId:[input readInt64]]; break; } case 16: { [self setPid:[input readInt32]]; break; } } } } - (BOOL) hasVersionId { return resultTgReqStockPoolMsg.hasVersionId; } - (SInt64) versionId { return resultTgReqStockPoolMsg.versionId; } - (tg_req_stock_pool_msgBuilder*) setVersionId:(SInt64) value { resultTgReqStockPoolMsg.hasVersionId = YES; resultTgReqStockPoolMsg.versionId = value; return self; } - (tg_req_stock_pool_msgBuilder*) clearVersionId { resultTgReqStockPoolMsg.hasVersionId = NO; resultTgReqStockPoolMsg.versionId = 0L; return self; } - (BOOL) hasPid { return resultTgReqStockPoolMsg.hasPid; } - (SInt32) pid { return resultTgReqStockPoolMsg.pid; } - (tg_req_stock_pool_msgBuilder*) setPid:(SInt32) value { resultTgReqStockPoolMsg.hasPid = YES; resultTgReqStockPoolMsg.pid = value; return self; } - (tg_req_stock_pool_msgBuilder*) clearPid { resultTgReqStockPoolMsg.hasPid = NO; resultTgReqStockPoolMsg.pid = 0; return self; } @end @interface tg_stock_pool_msg () @property SInt64 versionId; @property (strong) NSMutableArray * stocksArray; @property Float64 position; @end @implementation tg_stock_pool_msg - (BOOL) hasVersionId { return !!hasVersionId_; } - (void) setHasVersionId:(BOOL) _value_ { hasVersionId_ = !!_value_; } @synthesize versionId; @synthesize stocksArray; @dynamic stocks; - (BOOL) hasPosition { return !!hasPosition_; } - (void) setHasPosition:(BOOL) _value_ { hasPosition_ = !!_value_; } @synthesize position; - (instancetype) init { if ((self = [super init])) { self.versionId = 0L; self.position = 0; } return self; } static tg_stock_pool_msg* defaulttg_stock_pool_msgInstance = nil; + (void) initialize { if (self == [tg_stock_pool_msg class]) { defaulttg_stock_pool_msgInstance = [[tg_stock_pool_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_pool_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_pool_msgInstance; } - (NSArray *)stocks { return stocksArray; } - (tg_stock_att*)stocksAtIndex:(NSUInteger)index { return [stocksArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasVersionId) { return NO; } if (!self.hasPosition) { return NO; } __block BOOL isInitstocks = YES; [self.stocks enumerateObjectsUsingBlock:^(tg_stock_att *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitstocks = NO; *stop = YES; } }]; if (!isInitstocks) return isInitstocks; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasVersionId) { [output writeInt64:1 value:self.versionId]; } [self.stocksArray enumerateObjectsUsingBlock:^(tg_stock_att *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; if (self.hasPosition) { [output writeDouble:3 value:self.position]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasVersionId) { size_ += computeInt64Size(1, self.versionId); } [self.stocksArray enumerateObjectsUsingBlock:^(tg_stock_att *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; if (self.hasPosition) { size_ += computeDoubleSize(3, self.position); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_pool_msg*) parseFromData:(NSData*) data { return (tg_stock_pool_msg*)[[[tg_stock_pool_msg builder] mergeFromData:data] build]; } + (tg_stock_pool_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_pool_msg*)[[[tg_stock_pool_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_pool_msg*)[[[tg_stock_pool_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_pool_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_pool_msg*)[[[tg_stock_pool_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_pool_msg*)[[[tg_stock_pool_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_pool_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_pool_msg*)[[[tg_stock_pool_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_pool_msgBuilder*) builder { return [[tg_stock_pool_msgBuilder alloc] init]; } + (tg_stock_pool_msgBuilder*) builderWithPrototype:(tg_stock_pool_msg*) prototype { return [[tg_stock_pool_msg builder] mergeFrom:prototype]; } - (tg_stock_pool_msgBuilder*) builder { return [tg_stock_pool_msg builder]; } - (tg_stock_pool_msgBuilder*) toBuilder { return [tg_stock_pool_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasVersionId) { [output appendFormat:@"%@%@: %@\n", indent, @"versionId", [NSNumber numberWithLongLong:self.versionId]]; } [self.stocksArray enumerateObjectsUsingBlock:^(tg_stock_att *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"stocks"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; if (self.hasPosition) { [output appendFormat:@"%@%@: %@\n", indent, @"position", [NSNumber numberWithDouble:self.position]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasVersionId) { [dictionary setObject: [NSNumber numberWithLongLong:self.versionId] forKey: @"versionId"]; } for (tg_stock_att* element in self.stocksArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"stocks"]; } if (self.hasPosition) { [dictionary setObject: [NSNumber numberWithDouble:self.position] forKey: @"position"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_pool_msg class]]) { return NO; } tg_stock_pool_msg *otherMessage = other; return self.hasVersionId == otherMessage.hasVersionId && (!self.hasVersionId || self.versionId == otherMessage.versionId) && [self.stocksArray isEqualToArray:otherMessage.stocksArray] && self.hasPosition == otherMessage.hasPosition && (!self.hasPosition || self.position == otherMessage.position) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasVersionId) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.versionId] hash]; } [self.stocksArray enumerateObjectsUsingBlock:^(tg_stock_att *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasPosition) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.position] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_pool_msgBuilder() @property (strong) tg_stock_pool_msg* resultTgStockPoolMsg; @end @implementation tg_stock_pool_msgBuilder @synthesize resultTgStockPoolMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockPoolMsg = [[tg_stock_pool_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockPoolMsg; } - (tg_stock_pool_msgBuilder*) clear { self.resultTgStockPoolMsg = [[tg_stock_pool_msg alloc] init]; return self; } - (tg_stock_pool_msgBuilder*) clone { return [tg_stock_pool_msg builderWithPrototype:resultTgStockPoolMsg]; } - (tg_stock_pool_msg*) defaultInstance { return [tg_stock_pool_msg defaultInstance]; } - (tg_stock_pool_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_pool_msg*) buildPartial { tg_stock_pool_msg* returnMe = resultTgStockPoolMsg; self.resultTgStockPoolMsg = nil; return returnMe; } - (tg_stock_pool_msgBuilder*) mergeFrom:(tg_stock_pool_msg*) other { if (other == [tg_stock_pool_msg defaultInstance]) { return self; } if (other.hasVersionId) { [self setVersionId:other.versionId]; } if (other.stocksArray.count > 0) { if (resultTgStockPoolMsg.stocksArray == nil) { resultTgStockPoolMsg.stocksArray = [[NSMutableArray alloc] initWithArray:other.stocksArray]; } else { [resultTgStockPoolMsg.stocksArray addObjectsFromArray:other.stocksArray]; } } if (other.hasPosition) { [self setPosition:other.position]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_pool_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setVersionId:[input readInt64]]; break; } case 18: { tg_stock_attBuilder* subBuilder = [tg_stock_att builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addStocks:[subBuilder buildPartial]]; break; } case 25: { [self setPosition:[input readDouble]]; break; } } } } - (BOOL) hasVersionId { return resultTgStockPoolMsg.hasVersionId; } - (SInt64) versionId { return resultTgStockPoolMsg.versionId; } - (tg_stock_pool_msgBuilder*) setVersionId:(SInt64) value { resultTgStockPoolMsg.hasVersionId = YES; resultTgStockPoolMsg.versionId = value; return self; } - (tg_stock_pool_msgBuilder*) clearVersionId { resultTgStockPoolMsg.hasVersionId = NO; resultTgStockPoolMsg.versionId = 0L; return self; } - (NSMutableArray *)stocks { return resultTgStockPoolMsg.stocksArray; } - (tg_stock_att*)stocksAtIndex:(NSUInteger)index { return [resultTgStockPoolMsg stocksAtIndex:index]; } - (tg_stock_pool_msgBuilder *)addStocks:(tg_stock_att*)value { if (resultTgStockPoolMsg.stocksArray == nil) { resultTgStockPoolMsg.stocksArray = [[NSMutableArray alloc]init]; } [resultTgStockPoolMsg.stocksArray addObject:value]; return self; } - (tg_stock_pool_msgBuilder *)setStocksArray:(NSArray *)array { resultTgStockPoolMsg.stocksArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (tg_stock_pool_msgBuilder *)clearStocks { resultTgStockPoolMsg.stocksArray = nil; return self; } - (BOOL) hasPosition { return resultTgStockPoolMsg.hasPosition; } - (Float64) position { return resultTgStockPoolMsg.position; } - (tg_stock_pool_msgBuilder*) setPosition:(Float64) value { resultTgStockPoolMsg.hasPosition = YES; resultTgStockPoolMsg.position = value; return self; } - (tg_stock_pool_msgBuilder*) clearPosition { resultTgStockPoolMsg.hasPosition = NO; resultTgStockPoolMsg.position = 0; return self; } @end @interface tg_stock_in_pool_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property (strong) NSString* name; @property Float32 lowPrice; @property Float32 highPrice; @property Float32 targetPrice; @property Float32 stopPrice; @end @implementation tg_stock_in_pool_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasLowPrice { return !!hasLowPrice_; } - (void) setHasLowPrice:(BOOL) _value_ { hasLowPrice_ = !!_value_; } @synthesize lowPrice; - (BOOL) hasHighPrice { return !!hasHighPrice_; } - (void) setHasHighPrice:(BOOL) _value_ { hasHighPrice_ = !!_value_; } @synthesize highPrice; - (BOOL) hasTargetPrice { return !!hasTargetPrice_; } - (void) setHasTargetPrice:(BOOL) _value_ { hasTargetPrice_ = !!_value_; } @synthesize targetPrice; - (BOOL) hasStopPrice { return !!hasStopPrice_; } - (void) setHasStopPrice:(BOOL) _value_ { hasStopPrice_ = !!_value_; } @synthesize stopPrice; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.name = @""; self.lowPrice = 0; self.highPrice = 0; self.targetPrice = 0; self.stopPrice = 0; } return self; } static tg_stock_in_pool_notify_msg* defaulttg_stock_in_pool_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_in_pool_notify_msg class]) { defaulttg_stock_in_pool_notify_msgInstance = [[tg_stock_in_pool_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_in_pool_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_in_pool_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } if (!self.hasLowPrice) { return NO; } if (!self.hasHighPrice) { return NO; } if (!self.hasTargetPrice) { return NO; } if (!self.hasStopPrice) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasName) { [output writeString:3 value:self.name]; } if (self.hasLowPrice) { [output writeFloat:4 value:self.lowPrice]; } if (self.hasHighPrice) { [output writeFloat:5 value:self.highPrice]; } if (self.hasTargetPrice) { [output writeFloat:6 value:self.targetPrice]; } if (self.hasStopPrice) { [output writeFloat:7 value:self.stopPrice]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasName) { size_ += computeStringSize(3, self.name); } if (self.hasLowPrice) { size_ += computeFloatSize(4, self.lowPrice); } if (self.hasHighPrice) { size_ += computeFloatSize(5, self.highPrice); } if (self.hasTargetPrice) { size_ += computeFloatSize(6, self.targetPrice); } if (self.hasStopPrice) { size_ += computeFloatSize(7, self.stopPrice); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_in_pool_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_in_pool_notify_msg*)[[[tg_stock_in_pool_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_in_pool_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_in_pool_notify_msg*)[[[tg_stock_in_pool_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_in_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_in_pool_notify_msg*)[[[tg_stock_in_pool_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_in_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_in_pool_notify_msg*)[[[tg_stock_in_pool_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_in_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_in_pool_notify_msg*)[[[tg_stock_in_pool_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_in_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_in_pool_notify_msg*)[[[tg_stock_in_pool_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_in_pool_notify_msgBuilder*) builder { return [[tg_stock_in_pool_notify_msgBuilder alloc] init]; } + (tg_stock_in_pool_notify_msgBuilder*) builderWithPrototype:(tg_stock_in_pool_notify_msg*) prototype { return [[tg_stock_in_pool_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_in_pool_notify_msgBuilder*) builder { return [tg_stock_in_pool_notify_msg builder]; } - (tg_stock_in_pool_notify_msgBuilder*) toBuilder { return [tg_stock_in_pool_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasLowPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"lowPrice", [NSNumber numberWithFloat:self.lowPrice]]; } if (self.hasHighPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"highPrice", [NSNumber numberWithFloat:self.highPrice]]; } if (self.hasTargetPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"targetPrice", [NSNumber numberWithFloat:self.targetPrice]]; } if (self.hasStopPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"stopPrice", [NSNumber numberWithFloat:self.stopPrice]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasLowPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.lowPrice] forKey: @"lowPrice"]; } if (self.hasHighPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.highPrice] forKey: @"highPrice"]; } if (self.hasTargetPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.targetPrice] forKey: @"targetPrice"]; } if (self.hasStopPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.stopPrice] forKey: @"stopPrice"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_in_pool_notify_msg class]]) { return NO; } tg_stock_in_pool_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasLowPrice == otherMessage.hasLowPrice && (!self.hasLowPrice || self.lowPrice == otherMessage.lowPrice) && self.hasHighPrice == otherMessage.hasHighPrice && (!self.hasHighPrice || self.highPrice == otherMessage.highPrice) && self.hasTargetPrice == otherMessage.hasTargetPrice && (!self.hasTargetPrice || self.targetPrice == otherMessage.targetPrice) && self.hasStopPrice == otherMessage.hasStopPrice && (!self.hasStopPrice || self.stopPrice == otherMessage.stopPrice) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasLowPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.lowPrice] hash]; } if (self.hasHighPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.highPrice] hash]; } if (self.hasTargetPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.targetPrice] hash]; } if (self.hasStopPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.stopPrice] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_in_pool_notify_msgBuilder() @property (strong) tg_stock_in_pool_notify_msg* resultTgStockInPoolNotifyMsg; @end @implementation tg_stock_in_pool_notify_msgBuilder @synthesize resultTgStockInPoolNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockInPoolNotifyMsg = [[tg_stock_in_pool_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockInPoolNotifyMsg; } - (tg_stock_in_pool_notify_msgBuilder*) clear { self.resultTgStockInPoolNotifyMsg = [[tg_stock_in_pool_notify_msg alloc] init]; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clone { return [tg_stock_in_pool_notify_msg builderWithPrototype:resultTgStockInPoolNotifyMsg]; } - (tg_stock_in_pool_notify_msg*) defaultInstance { return [tg_stock_in_pool_notify_msg defaultInstance]; } - (tg_stock_in_pool_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_in_pool_notify_msg*) buildPartial { tg_stock_in_pool_notify_msg* returnMe = resultTgStockInPoolNotifyMsg; self.resultTgStockInPoolNotifyMsg = nil; return returnMe; } - (tg_stock_in_pool_notify_msgBuilder*) mergeFrom:(tg_stock_in_pool_notify_msg*) other { if (other == [tg_stock_in_pool_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.hasLowPrice) { [self setLowPrice:other.lowPrice]; } if (other.hasHighPrice) { [self setHighPrice:other.highPrice]; } if (other.hasTargetPrice) { [self setTargetPrice:other.targetPrice]; } if (other.hasStopPrice) { [self setStopPrice:other.stopPrice]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_in_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_in_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 26: { [self setName:[input readString]]; break; } case 37: { [self setLowPrice:[input readFloat]]; break; } case 45: { [self setHighPrice:[input readFloat]]; break; } case 53: { [self setTargetPrice:[input readFloat]]; break; } case 61: { [self setStopPrice:[input readFloat]]; break; } } } } - (BOOL) hasDate { return resultTgStockInPoolNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockInPoolNotifyMsg.date; } - (tg_stock_in_pool_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockInPoolNotifyMsg.hasDate = YES; resultTgStockInPoolNotifyMsg.date = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearDate { resultTgStockInPoolNotifyMsg.hasDate = NO; resultTgStockInPoolNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockInPoolNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockInPoolNotifyMsg.code; } - (tg_stock_in_pool_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockInPoolNotifyMsg.hasCode = YES; resultTgStockInPoolNotifyMsg.code = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearCode { resultTgStockInPoolNotifyMsg.hasCode = NO; resultTgStockInPoolNotifyMsg.code = @""; return self; } - (BOOL) hasName { return resultTgStockInPoolNotifyMsg.hasName; } - (NSString*) name { return resultTgStockInPoolNotifyMsg.name; } - (tg_stock_in_pool_notify_msgBuilder*) setName:(NSString*) value { resultTgStockInPoolNotifyMsg.hasName = YES; resultTgStockInPoolNotifyMsg.name = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearName { resultTgStockInPoolNotifyMsg.hasName = NO; resultTgStockInPoolNotifyMsg.name = @""; return self; } - (BOOL) hasLowPrice { return resultTgStockInPoolNotifyMsg.hasLowPrice; } - (Float32) lowPrice { return resultTgStockInPoolNotifyMsg.lowPrice; } - (tg_stock_in_pool_notify_msgBuilder*) setLowPrice:(Float32) value { resultTgStockInPoolNotifyMsg.hasLowPrice = YES; resultTgStockInPoolNotifyMsg.lowPrice = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearLowPrice { resultTgStockInPoolNotifyMsg.hasLowPrice = NO; resultTgStockInPoolNotifyMsg.lowPrice = 0; return self; } - (BOOL) hasHighPrice { return resultTgStockInPoolNotifyMsg.hasHighPrice; } - (Float32) highPrice { return resultTgStockInPoolNotifyMsg.highPrice; } - (tg_stock_in_pool_notify_msgBuilder*) setHighPrice:(Float32) value { resultTgStockInPoolNotifyMsg.hasHighPrice = YES; resultTgStockInPoolNotifyMsg.highPrice = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearHighPrice { resultTgStockInPoolNotifyMsg.hasHighPrice = NO; resultTgStockInPoolNotifyMsg.highPrice = 0; return self; } - (BOOL) hasTargetPrice { return resultTgStockInPoolNotifyMsg.hasTargetPrice; } - (Float32) targetPrice { return resultTgStockInPoolNotifyMsg.targetPrice; } - (tg_stock_in_pool_notify_msgBuilder*) setTargetPrice:(Float32) value { resultTgStockInPoolNotifyMsg.hasTargetPrice = YES; resultTgStockInPoolNotifyMsg.targetPrice = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearTargetPrice { resultTgStockInPoolNotifyMsg.hasTargetPrice = NO; resultTgStockInPoolNotifyMsg.targetPrice = 0; return self; } - (BOOL) hasStopPrice { return resultTgStockInPoolNotifyMsg.hasStopPrice; } - (Float32) stopPrice { return resultTgStockInPoolNotifyMsg.stopPrice; } - (tg_stock_in_pool_notify_msgBuilder*) setStopPrice:(Float32) value { resultTgStockInPoolNotifyMsg.hasStopPrice = YES; resultTgStockInPoolNotifyMsg.stopPrice = value; return self; } - (tg_stock_in_pool_notify_msgBuilder*) clearStopPrice { resultTgStockInPoolNotifyMsg.hasStopPrice = NO; resultTgStockInPoolNotifyMsg.stopPrice = 0; return self; } @end @interface tg_stock_buy_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property (strong) NSString* name; @property Float32 buyPrice; @property Float32 targetPrice; @property Float32 stopPrice; @property BOOL autoBuy; @end @implementation tg_stock_buy_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasBuyPrice { return !!hasBuyPrice_; } - (void) setHasBuyPrice:(BOOL) _value_ { hasBuyPrice_ = !!_value_; } @synthesize buyPrice; - (BOOL) hasTargetPrice { return !!hasTargetPrice_; } - (void) setHasTargetPrice:(BOOL) _value_ { hasTargetPrice_ = !!_value_; } @synthesize targetPrice; - (BOOL) hasStopPrice { return !!hasStopPrice_; } - (void) setHasStopPrice:(BOOL) _value_ { hasStopPrice_ = !!_value_; } @synthesize stopPrice; - (BOOL) hasAutoBuy { return !!hasAutoBuy_; } - (void) setHasAutoBuy:(BOOL) _value_ { hasAutoBuy_ = !!_value_; } - (BOOL) autoBuy { return !!autoBuy_; } - (void) setAutoBuy:(BOOL) _value_ { autoBuy_ = !!_value_; } - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.name = @""; self.buyPrice = 0; self.targetPrice = 0; self.stopPrice = 0; self.autoBuy = NO; } return self; } static tg_stock_buy_notify_msg* defaulttg_stock_buy_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_buy_notify_msg class]) { defaulttg_stock_buy_notify_msgInstance = [[tg_stock_buy_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_buy_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_buy_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } if (!self.hasBuyPrice) { return NO; } if (!self.hasTargetPrice) { return NO; } if (!self.hasStopPrice) { return NO; } if (!self.hasAutoBuy) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasName) { [output writeString:3 value:self.name]; } if (self.hasBuyPrice) { [output writeFloat:4 value:self.buyPrice]; } if (self.hasTargetPrice) { [output writeFloat:5 value:self.targetPrice]; } if (self.hasStopPrice) { [output writeFloat:6 value:self.stopPrice]; } if (self.hasAutoBuy) { [output writeBool:8 value:self.autoBuy]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasName) { size_ += computeStringSize(3, self.name); } if (self.hasBuyPrice) { size_ += computeFloatSize(4, self.buyPrice); } if (self.hasTargetPrice) { size_ += computeFloatSize(5, self.targetPrice); } if (self.hasStopPrice) { size_ += computeFloatSize(6, self.stopPrice); } if (self.hasAutoBuy) { size_ += computeBoolSize(8, self.autoBuy); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_buy_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_buy_notify_msg*)[[[tg_stock_buy_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_buy_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_buy_notify_msg*)[[[tg_stock_buy_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_buy_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_buy_notify_msg*)[[[tg_stock_buy_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_buy_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_buy_notify_msg*)[[[tg_stock_buy_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_buy_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_buy_notify_msg*)[[[tg_stock_buy_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_buy_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_buy_notify_msg*)[[[tg_stock_buy_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_buy_notify_msgBuilder*) builder { return [[tg_stock_buy_notify_msgBuilder alloc] init]; } + (tg_stock_buy_notify_msgBuilder*) builderWithPrototype:(tg_stock_buy_notify_msg*) prototype { return [[tg_stock_buy_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_buy_notify_msgBuilder*) builder { return [tg_stock_buy_notify_msg builder]; } - (tg_stock_buy_notify_msgBuilder*) toBuilder { return [tg_stock_buy_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasBuyPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"buyPrice", [NSNumber numberWithFloat:self.buyPrice]]; } if (self.hasTargetPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"targetPrice", [NSNumber numberWithFloat:self.targetPrice]]; } if (self.hasStopPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"stopPrice", [NSNumber numberWithFloat:self.stopPrice]]; } if (self.hasAutoBuy) { [output appendFormat:@"%@%@: %@\n", indent, @"autoBuy", [NSNumber numberWithBool:self.autoBuy]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasBuyPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.buyPrice] forKey: @"buyPrice"]; } if (self.hasTargetPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.targetPrice] forKey: @"targetPrice"]; } if (self.hasStopPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.stopPrice] forKey: @"stopPrice"]; } if (self.hasAutoBuy) { [dictionary setObject: [NSNumber numberWithBool:self.autoBuy] forKey: @"autoBuy"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_buy_notify_msg class]]) { return NO; } tg_stock_buy_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasBuyPrice == otherMessage.hasBuyPrice && (!self.hasBuyPrice || self.buyPrice == otherMessage.buyPrice) && self.hasTargetPrice == otherMessage.hasTargetPrice && (!self.hasTargetPrice || self.targetPrice == otherMessage.targetPrice) && self.hasStopPrice == otherMessage.hasStopPrice && (!self.hasStopPrice || self.stopPrice == otherMessage.stopPrice) && self.hasAutoBuy == otherMessage.hasAutoBuy && (!self.hasAutoBuy || self.autoBuy == otherMessage.autoBuy) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasBuyPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.buyPrice] hash]; } if (self.hasTargetPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.targetPrice] hash]; } if (self.hasStopPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.stopPrice] hash]; } if (self.hasAutoBuy) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.autoBuy] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_buy_notify_msgBuilder() @property (strong) tg_stock_buy_notify_msg* resultTgStockBuyNotifyMsg; @end @implementation tg_stock_buy_notify_msgBuilder @synthesize resultTgStockBuyNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockBuyNotifyMsg = [[tg_stock_buy_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockBuyNotifyMsg; } - (tg_stock_buy_notify_msgBuilder*) clear { self.resultTgStockBuyNotifyMsg = [[tg_stock_buy_notify_msg alloc] init]; return self; } - (tg_stock_buy_notify_msgBuilder*) clone { return [tg_stock_buy_notify_msg builderWithPrototype:resultTgStockBuyNotifyMsg]; } - (tg_stock_buy_notify_msg*) defaultInstance { return [tg_stock_buy_notify_msg defaultInstance]; } - (tg_stock_buy_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_buy_notify_msg*) buildPartial { tg_stock_buy_notify_msg* returnMe = resultTgStockBuyNotifyMsg; self.resultTgStockBuyNotifyMsg = nil; return returnMe; } - (tg_stock_buy_notify_msgBuilder*) mergeFrom:(tg_stock_buy_notify_msg*) other { if (other == [tg_stock_buy_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.hasBuyPrice) { [self setBuyPrice:other.buyPrice]; } if (other.hasTargetPrice) { [self setTargetPrice:other.targetPrice]; } if (other.hasStopPrice) { [self setStopPrice:other.stopPrice]; } if (other.hasAutoBuy) { [self setAutoBuy:other.autoBuy]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_buy_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_buy_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 26: { [self setName:[input readString]]; break; } case 37: { [self setBuyPrice:[input readFloat]]; break; } case 45: { [self setTargetPrice:[input readFloat]]; break; } case 53: { [self setStopPrice:[input readFloat]]; break; } case 64: { [self setAutoBuy:[input readBool]]; break; } } } } - (BOOL) hasDate { return resultTgStockBuyNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockBuyNotifyMsg.date; } - (tg_stock_buy_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockBuyNotifyMsg.hasDate = YES; resultTgStockBuyNotifyMsg.date = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearDate { resultTgStockBuyNotifyMsg.hasDate = NO; resultTgStockBuyNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockBuyNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockBuyNotifyMsg.code; } - (tg_stock_buy_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockBuyNotifyMsg.hasCode = YES; resultTgStockBuyNotifyMsg.code = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearCode { resultTgStockBuyNotifyMsg.hasCode = NO; resultTgStockBuyNotifyMsg.code = @""; return self; } - (BOOL) hasName { return resultTgStockBuyNotifyMsg.hasName; } - (NSString*) name { return resultTgStockBuyNotifyMsg.name; } - (tg_stock_buy_notify_msgBuilder*) setName:(NSString*) value { resultTgStockBuyNotifyMsg.hasName = YES; resultTgStockBuyNotifyMsg.name = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearName { resultTgStockBuyNotifyMsg.hasName = NO; resultTgStockBuyNotifyMsg.name = @""; return self; } - (BOOL) hasBuyPrice { return resultTgStockBuyNotifyMsg.hasBuyPrice; } - (Float32) buyPrice { return resultTgStockBuyNotifyMsg.buyPrice; } - (tg_stock_buy_notify_msgBuilder*) setBuyPrice:(Float32) value { resultTgStockBuyNotifyMsg.hasBuyPrice = YES; resultTgStockBuyNotifyMsg.buyPrice = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearBuyPrice { resultTgStockBuyNotifyMsg.hasBuyPrice = NO; resultTgStockBuyNotifyMsg.buyPrice = 0; return self; } - (BOOL) hasTargetPrice { return resultTgStockBuyNotifyMsg.hasTargetPrice; } - (Float32) targetPrice { return resultTgStockBuyNotifyMsg.targetPrice; } - (tg_stock_buy_notify_msgBuilder*) setTargetPrice:(Float32) value { resultTgStockBuyNotifyMsg.hasTargetPrice = YES; resultTgStockBuyNotifyMsg.targetPrice = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearTargetPrice { resultTgStockBuyNotifyMsg.hasTargetPrice = NO; resultTgStockBuyNotifyMsg.targetPrice = 0; return self; } - (BOOL) hasStopPrice { return resultTgStockBuyNotifyMsg.hasStopPrice; } - (Float32) stopPrice { return resultTgStockBuyNotifyMsg.stopPrice; } - (tg_stock_buy_notify_msgBuilder*) setStopPrice:(Float32) value { resultTgStockBuyNotifyMsg.hasStopPrice = YES; resultTgStockBuyNotifyMsg.stopPrice = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearStopPrice { resultTgStockBuyNotifyMsg.hasStopPrice = NO; resultTgStockBuyNotifyMsg.stopPrice = 0; return self; } - (BOOL) hasAutoBuy { return resultTgStockBuyNotifyMsg.hasAutoBuy; } - (BOOL) autoBuy { return resultTgStockBuyNotifyMsg.autoBuy; } - (tg_stock_buy_notify_msgBuilder*) setAutoBuy:(BOOL) value { resultTgStockBuyNotifyMsg.hasAutoBuy = YES; resultTgStockBuyNotifyMsg.autoBuy = value; return self; } - (tg_stock_buy_notify_msgBuilder*) clearAutoBuy { resultTgStockBuyNotifyMsg.hasAutoBuy = NO; resultTgStockBuyNotifyMsg.autoBuy = NO; return self; } @end @interface tg_stock_out_pool_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property (strong) NSString* name; @property (strong) NSString* desc; @end @implementation tg_stock_out_pool_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasDesc { return !!hasDesc_; } - (void) setHasDesc:(BOOL) _value_ { hasDesc_ = !!_value_; } @synthesize desc; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.name = @""; self.desc = @""; } return self; } static tg_stock_out_pool_notify_msg* defaulttg_stock_out_pool_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_out_pool_notify_msg class]) { defaulttg_stock_out_pool_notify_msgInstance = [[tg_stock_out_pool_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_out_pool_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_out_pool_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } if (!self.hasDesc) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasName) { [output writeString:3 value:self.name]; } if (self.hasDesc) { [output writeString:4 value:self.desc]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasName) { size_ += computeStringSize(3, self.name); } if (self.hasDesc) { size_ += computeStringSize(4, self.desc); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_out_pool_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_out_pool_notify_msg*)[[[tg_stock_out_pool_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_out_pool_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_out_pool_notify_msg*)[[[tg_stock_out_pool_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_out_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_out_pool_notify_msg*)[[[tg_stock_out_pool_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_out_pool_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_out_pool_notify_msg*)[[[tg_stock_out_pool_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_out_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_out_pool_notify_msg*)[[[tg_stock_out_pool_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_out_pool_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_out_pool_notify_msg*)[[[tg_stock_out_pool_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_out_pool_notify_msgBuilder*) builder { return [[tg_stock_out_pool_notify_msgBuilder alloc] init]; } + (tg_stock_out_pool_notify_msgBuilder*) builderWithPrototype:(tg_stock_out_pool_notify_msg*) prototype { return [[tg_stock_out_pool_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_out_pool_notify_msgBuilder*) builder { return [tg_stock_out_pool_notify_msg builder]; } - (tg_stock_out_pool_notify_msgBuilder*) toBuilder { return [tg_stock_out_pool_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasDesc) { [output appendFormat:@"%@%@: %@\n", indent, @"desc", self.desc]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasDesc) { [dictionary setObject: self.desc forKey: @"desc"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_out_pool_notify_msg class]]) { return NO; } tg_stock_out_pool_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasDesc == otherMessage.hasDesc && (!self.hasDesc || [self.desc isEqual:otherMessage.desc]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasDesc) { hashCode = hashCode * 31 + [self.desc hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_out_pool_notify_msgBuilder() @property (strong) tg_stock_out_pool_notify_msg* resultTgStockOutPoolNotifyMsg; @end @implementation tg_stock_out_pool_notify_msgBuilder @synthesize resultTgStockOutPoolNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockOutPoolNotifyMsg = [[tg_stock_out_pool_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockOutPoolNotifyMsg; } - (tg_stock_out_pool_notify_msgBuilder*) clear { self.resultTgStockOutPoolNotifyMsg = [[tg_stock_out_pool_notify_msg alloc] init]; return self; } - (tg_stock_out_pool_notify_msgBuilder*) clone { return [tg_stock_out_pool_notify_msg builderWithPrototype:resultTgStockOutPoolNotifyMsg]; } - (tg_stock_out_pool_notify_msg*) defaultInstance { return [tg_stock_out_pool_notify_msg defaultInstance]; } - (tg_stock_out_pool_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_out_pool_notify_msg*) buildPartial { tg_stock_out_pool_notify_msg* returnMe = resultTgStockOutPoolNotifyMsg; self.resultTgStockOutPoolNotifyMsg = nil; return returnMe; } - (tg_stock_out_pool_notify_msgBuilder*) mergeFrom:(tg_stock_out_pool_notify_msg*) other { if (other == [tg_stock_out_pool_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.hasDesc) { [self setDesc:other.desc]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_out_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_out_pool_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 26: { [self setName:[input readString]]; break; } case 34: { [self setDesc:[input readString]]; break; } } } } - (BOOL) hasDate { return resultTgStockOutPoolNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockOutPoolNotifyMsg.date; } - (tg_stock_out_pool_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockOutPoolNotifyMsg.hasDate = YES; resultTgStockOutPoolNotifyMsg.date = value; return self; } - (tg_stock_out_pool_notify_msgBuilder*) clearDate { resultTgStockOutPoolNotifyMsg.hasDate = NO; resultTgStockOutPoolNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockOutPoolNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockOutPoolNotifyMsg.code; } - (tg_stock_out_pool_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockOutPoolNotifyMsg.hasCode = YES; resultTgStockOutPoolNotifyMsg.code = value; return self; } - (tg_stock_out_pool_notify_msgBuilder*) clearCode { resultTgStockOutPoolNotifyMsg.hasCode = NO; resultTgStockOutPoolNotifyMsg.code = @""; return self; } - (BOOL) hasName { return resultTgStockOutPoolNotifyMsg.hasName; } - (NSString*) name { return resultTgStockOutPoolNotifyMsg.name; } - (tg_stock_out_pool_notify_msgBuilder*) setName:(NSString*) value { resultTgStockOutPoolNotifyMsg.hasName = YES; resultTgStockOutPoolNotifyMsg.name = value; return self; } - (tg_stock_out_pool_notify_msgBuilder*) clearName { resultTgStockOutPoolNotifyMsg.hasName = NO; resultTgStockOutPoolNotifyMsg.name = @""; return self; } - (BOOL) hasDesc { return resultTgStockOutPoolNotifyMsg.hasDesc; } - (NSString*) desc { return resultTgStockOutPoolNotifyMsg.desc; } - (tg_stock_out_pool_notify_msgBuilder*) setDesc:(NSString*) value { resultTgStockOutPoolNotifyMsg.hasDesc = YES; resultTgStockOutPoolNotifyMsg.desc = value; return self; } - (tg_stock_out_pool_notify_msgBuilder*) clearDesc { resultTgStockOutPoolNotifyMsg.hasDesc = NO; resultTgStockOutPoolNotifyMsg.desc = @""; return self; } @end @interface tg_stock_new_target_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property Float32 oldTarget; @property Float32 newTarget; @end @implementation tg_stock_new_target_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasOldTarget { return !!hasOldTarget_; } - (void) setHasOldTarget:(BOOL) _value_ { hasOldTarget_ = !!_value_; } @synthesize oldTarget; - (BOOL) hasNewTarget { return !!hasNewTarget_; } - (void) setHasNewTarget:(BOOL) _value_ { hasNewTarget_ = !!_value_; } @synthesize newTarget; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.oldTarget = 0; self.newTarget = 0; } return self; } static tg_stock_new_target_notify_msg* defaulttg_stock_new_target_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_new_target_notify_msg class]) { defaulttg_stock_new_target_notify_msgInstance = [[tg_stock_new_target_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_new_target_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_new_target_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasOldTarget) { return NO; } if (!self.hasNewTarget) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasOldTarget) { [output writeFloat:3 value:self.oldTarget]; } if (self.hasNewTarget) { [output writeFloat:4 value:self.newTarget]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasOldTarget) { size_ += computeFloatSize(3, self.oldTarget); } if (self.hasNewTarget) { size_ += computeFloatSize(4, self.newTarget); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_new_target_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_new_target_notify_msg*)[[[tg_stock_new_target_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_new_target_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_new_target_notify_msg*)[[[tg_stock_new_target_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_new_target_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_new_target_notify_msg*)[[[tg_stock_new_target_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_new_target_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_new_target_notify_msg*)[[[tg_stock_new_target_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_new_target_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_new_target_notify_msg*)[[[tg_stock_new_target_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_new_target_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_new_target_notify_msg*)[[[tg_stock_new_target_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_new_target_notify_msgBuilder*) builder { return [[tg_stock_new_target_notify_msgBuilder alloc] init]; } + (tg_stock_new_target_notify_msgBuilder*) builderWithPrototype:(tg_stock_new_target_notify_msg*) prototype { return [[tg_stock_new_target_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_new_target_notify_msgBuilder*) builder { return [tg_stock_new_target_notify_msg builder]; } - (tg_stock_new_target_notify_msgBuilder*) toBuilder { return [tg_stock_new_target_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasOldTarget) { [output appendFormat:@"%@%@: %@\n", indent, @"oldTarget", [NSNumber numberWithFloat:self.oldTarget]]; } if (self.hasNewTarget) { [output appendFormat:@"%@%@: %@\n", indent, @"newTarget", [NSNumber numberWithFloat:self.newTarget]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasOldTarget) { [dictionary setObject: [NSNumber numberWithFloat:self.oldTarget] forKey: @"oldTarget"]; } if (self.hasNewTarget) { [dictionary setObject: [NSNumber numberWithFloat:self.newTarget] forKey: @"newTarget"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_new_target_notify_msg class]]) { return NO; } tg_stock_new_target_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasOldTarget == otherMessage.hasOldTarget && (!self.hasOldTarget || self.oldTarget == otherMessage.oldTarget) && self.hasNewTarget == otherMessage.hasNewTarget && (!self.hasNewTarget || self.newTarget == otherMessage.newTarget) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasOldTarget) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.oldTarget] hash]; } if (self.hasNewTarget) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.newTarget] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_new_target_notify_msgBuilder() @property (strong) tg_stock_new_target_notify_msg* resultTgStockNewTargetNotifyMsg; @end @implementation tg_stock_new_target_notify_msgBuilder @synthesize resultTgStockNewTargetNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockNewTargetNotifyMsg = [[tg_stock_new_target_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockNewTargetNotifyMsg; } - (tg_stock_new_target_notify_msgBuilder*) clear { self.resultTgStockNewTargetNotifyMsg = [[tg_stock_new_target_notify_msg alloc] init]; return self; } - (tg_stock_new_target_notify_msgBuilder*) clone { return [tg_stock_new_target_notify_msg builderWithPrototype:resultTgStockNewTargetNotifyMsg]; } - (tg_stock_new_target_notify_msg*) defaultInstance { return [tg_stock_new_target_notify_msg defaultInstance]; } - (tg_stock_new_target_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_new_target_notify_msg*) buildPartial { tg_stock_new_target_notify_msg* returnMe = resultTgStockNewTargetNotifyMsg; self.resultTgStockNewTargetNotifyMsg = nil; return returnMe; } - (tg_stock_new_target_notify_msgBuilder*) mergeFrom:(tg_stock_new_target_notify_msg*) other { if (other == [tg_stock_new_target_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasOldTarget) { [self setOldTarget:other.oldTarget]; } if (other.hasNewTarget) { [self setNewTarget:other.newTarget]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_new_target_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_new_target_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 29: { [self setOldTarget:[input readFloat]]; break; } case 37: { [self setNewTarget:[input readFloat]]; break; } } } } - (BOOL) hasDate { return resultTgStockNewTargetNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockNewTargetNotifyMsg.date; } - (tg_stock_new_target_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockNewTargetNotifyMsg.hasDate = YES; resultTgStockNewTargetNotifyMsg.date = value; return self; } - (tg_stock_new_target_notify_msgBuilder*) clearDate { resultTgStockNewTargetNotifyMsg.hasDate = NO; resultTgStockNewTargetNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockNewTargetNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockNewTargetNotifyMsg.code; } - (tg_stock_new_target_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockNewTargetNotifyMsg.hasCode = YES; resultTgStockNewTargetNotifyMsg.code = value; return self; } - (tg_stock_new_target_notify_msgBuilder*) clearCode { resultTgStockNewTargetNotifyMsg.hasCode = NO; resultTgStockNewTargetNotifyMsg.code = @""; return self; } - (BOOL) hasOldTarget { return resultTgStockNewTargetNotifyMsg.hasOldTarget; } - (Float32) oldTarget { return resultTgStockNewTargetNotifyMsg.oldTarget; } - (tg_stock_new_target_notify_msgBuilder*) setOldTarget:(Float32) value { resultTgStockNewTargetNotifyMsg.hasOldTarget = YES; resultTgStockNewTargetNotifyMsg.oldTarget = value; return self; } - (tg_stock_new_target_notify_msgBuilder*) clearOldTarget { resultTgStockNewTargetNotifyMsg.hasOldTarget = NO; resultTgStockNewTargetNotifyMsg.oldTarget = 0; return self; } - (BOOL) hasNewTarget { return resultTgStockNewTargetNotifyMsg.hasNewTarget; } - (Float32) newTarget { return resultTgStockNewTargetNotifyMsg.newTarget; } - (tg_stock_new_target_notify_msgBuilder*) setNewTarget:(Float32) value { resultTgStockNewTargetNotifyMsg.hasNewTarget = YES; resultTgStockNewTargetNotifyMsg.newTarget = value; return self; } - (tg_stock_new_target_notify_msgBuilder*) clearNewTarget { resultTgStockNewTargetNotifyMsg.hasNewTarget = NO; resultTgStockNewTargetNotifyMsg.newTarget = 0; return self; } @end @interface tg_stock_new_stop_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property Float32 oldStop; @property Float32 newStop; @end @implementation tg_stock_new_stop_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasOldStop { return !!hasOldStop_; } - (void) setHasOldStop:(BOOL) _value_ { hasOldStop_ = !!_value_; } @synthesize oldStop; - (BOOL) hasNewStop { return !!hasNewStop_; } - (void) setHasNewStop:(BOOL) _value_ { hasNewStop_ = !!_value_; } @synthesize newStop; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.oldStop = 0; self.newStop = 0; } return self; } static tg_stock_new_stop_notify_msg* defaulttg_stock_new_stop_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_new_stop_notify_msg class]) { defaulttg_stock_new_stop_notify_msgInstance = [[tg_stock_new_stop_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_new_stop_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_new_stop_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasOldStop) { return NO; } if (!self.hasNewStop) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasOldStop) { [output writeFloat:3 value:self.oldStop]; } if (self.hasNewStop) { [output writeFloat:4 value:self.newStop]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasOldStop) { size_ += computeFloatSize(3, self.oldStop); } if (self.hasNewStop) { size_ += computeFloatSize(4, self.newStop); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_new_stop_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_new_stop_notify_msg*)[[[tg_stock_new_stop_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_new_stop_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_new_stop_notify_msg*)[[[tg_stock_new_stop_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_new_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_new_stop_notify_msg*)[[[tg_stock_new_stop_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_new_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_new_stop_notify_msg*)[[[tg_stock_new_stop_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_new_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_new_stop_notify_msg*)[[[tg_stock_new_stop_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_new_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_new_stop_notify_msg*)[[[tg_stock_new_stop_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_new_stop_notify_msgBuilder*) builder { return [[tg_stock_new_stop_notify_msgBuilder alloc] init]; } + (tg_stock_new_stop_notify_msgBuilder*) builderWithPrototype:(tg_stock_new_stop_notify_msg*) prototype { return [[tg_stock_new_stop_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_new_stop_notify_msgBuilder*) builder { return [tg_stock_new_stop_notify_msg builder]; } - (tg_stock_new_stop_notify_msgBuilder*) toBuilder { return [tg_stock_new_stop_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasOldStop) { [output appendFormat:@"%@%@: %@\n", indent, @"oldStop", [NSNumber numberWithFloat:self.oldStop]]; } if (self.hasNewStop) { [output appendFormat:@"%@%@: %@\n", indent, @"newStop", [NSNumber numberWithFloat:self.newStop]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasOldStop) { [dictionary setObject: [NSNumber numberWithFloat:self.oldStop] forKey: @"oldStop"]; } if (self.hasNewStop) { [dictionary setObject: [NSNumber numberWithFloat:self.newStop] forKey: @"newStop"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_new_stop_notify_msg class]]) { return NO; } tg_stock_new_stop_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasOldStop == otherMessage.hasOldStop && (!self.hasOldStop || self.oldStop == otherMessage.oldStop) && self.hasNewStop == otherMessage.hasNewStop && (!self.hasNewStop || self.newStop == otherMessage.newStop) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasOldStop) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.oldStop] hash]; } if (self.hasNewStop) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.newStop] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_new_stop_notify_msgBuilder() @property (strong) tg_stock_new_stop_notify_msg* resultTgStockNewStopNotifyMsg; @end @implementation tg_stock_new_stop_notify_msgBuilder @synthesize resultTgStockNewStopNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockNewStopNotifyMsg = [[tg_stock_new_stop_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockNewStopNotifyMsg; } - (tg_stock_new_stop_notify_msgBuilder*) clear { self.resultTgStockNewStopNotifyMsg = [[tg_stock_new_stop_notify_msg alloc] init]; return self; } - (tg_stock_new_stop_notify_msgBuilder*) clone { return [tg_stock_new_stop_notify_msg builderWithPrototype:resultTgStockNewStopNotifyMsg]; } - (tg_stock_new_stop_notify_msg*) defaultInstance { return [tg_stock_new_stop_notify_msg defaultInstance]; } - (tg_stock_new_stop_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_new_stop_notify_msg*) buildPartial { tg_stock_new_stop_notify_msg* returnMe = resultTgStockNewStopNotifyMsg; self.resultTgStockNewStopNotifyMsg = nil; return returnMe; } - (tg_stock_new_stop_notify_msgBuilder*) mergeFrom:(tg_stock_new_stop_notify_msg*) other { if (other == [tg_stock_new_stop_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasOldStop) { [self setOldStop:other.oldStop]; } if (other.hasNewStop) { [self setNewStop:other.newStop]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_new_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_new_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 29: { [self setOldStop:[input readFloat]]; break; } case 37: { [self setNewStop:[input readFloat]]; break; } } } } - (BOOL) hasDate { return resultTgStockNewStopNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockNewStopNotifyMsg.date; } - (tg_stock_new_stop_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockNewStopNotifyMsg.hasDate = YES; resultTgStockNewStopNotifyMsg.date = value; return self; } - (tg_stock_new_stop_notify_msgBuilder*) clearDate { resultTgStockNewStopNotifyMsg.hasDate = NO; resultTgStockNewStopNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockNewStopNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockNewStopNotifyMsg.code; } - (tg_stock_new_stop_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockNewStopNotifyMsg.hasCode = YES; resultTgStockNewStopNotifyMsg.code = value; return self; } - (tg_stock_new_stop_notify_msgBuilder*) clearCode { resultTgStockNewStopNotifyMsg.hasCode = NO; resultTgStockNewStopNotifyMsg.code = @""; return self; } - (BOOL) hasOldStop { return resultTgStockNewStopNotifyMsg.hasOldStop; } - (Float32) oldStop { return resultTgStockNewStopNotifyMsg.oldStop; } - (tg_stock_new_stop_notify_msgBuilder*) setOldStop:(Float32) value { resultTgStockNewStopNotifyMsg.hasOldStop = YES; resultTgStockNewStopNotifyMsg.oldStop = value; return self; } - (tg_stock_new_stop_notify_msgBuilder*) clearOldStop { resultTgStockNewStopNotifyMsg.hasOldStop = NO; resultTgStockNewStopNotifyMsg.oldStop = 0; return self; } - (BOOL) hasNewStop { return resultTgStockNewStopNotifyMsg.hasNewStop; } - (Float32) newStop { return resultTgStockNewStopNotifyMsg.newStop; } - (tg_stock_new_stop_notify_msgBuilder*) setNewStop:(Float32) value { resultTgStockNewStopNotifyMsg.hasNewStop = YES; resultTgStockNewStopNotifyMsg.newStop = value; return self; } - (tg_stock_new_stop_notify_msgBuilder*) clearNewStop { resultTgStockNewStopNotifyMsg.hasNewStop = NO; resultTgStockNewStopNotifyMsg.newStop = 0; return self; } @end @interface tg_stock_profit_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property Float32 targetPrice; @property Float32 sellPrice; @property BOOL systemAuto; @property (strong) NSString* desc; @end @implementation tg_stock_profit_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasTargetPrice { return !!hasTargetPrice_; } - (void) setHasTargetPrice:(BOOL) _value_ { hasTargetPrice_ = !!_value_; } @synthesize targetPrice; - (BOOL) hasSellPrice { return !!hasSellPrice_; } - (void) setHasSellPrice:(BOOL) _value_ { hasSellPrice_ = !!_value_; } @synthesize sellPrice; - (BOOL) hasSystemAuto { return !!hasSystemAuto_; } - (void) setHasSystemAuto:(BOOL) _value_ { hasSystemAuto_ = !!_value_; } - (BOOL) systemAuto { return !!systemAuto_; } - (void) setSystemAuto:(BOOL) _value_ { systemAuto_ = !!_value_; } - (BOOL) hasDesc { return !!hasDesc_; } - (void) setHasDesc:(BOOL) _value_ { hasDesc_ = !!_value_; } @synthesize desc; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.targetPrice = 0; self.sellPrice = 0; self.systemAuto = NO; self.desc = @""; } return self; } static tg_stock_profit_notify_msg* defaulttg_stock_profit_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_profit_notify_msg class]) { defaulttg_stock_profit_notify_msgInstance = [[tg_stock_profit_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_profit_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_profit_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasTargetPrice) { return NO; } if (!self.hasSellPrice) { return NO; } if (!self.hasSystemAuto) { return NO; } if (!self.hasDesc) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasTargetPrice) { [output writeFloat:3 value:self.targetPrice]; } if (self.hasSellPrice) { [output writeFloat:4 value:self.sellPrice]; } if (self.hasSystemAuto) { [output writeBool:5 value:self.systemAuto]; } if (self.hasDesc) { [output writeString:6 value:self.desc]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasTargetPrice) { size_ += computeFloatSize(3, self.targetPrice); } if (self.hasSellPrice) { size_ += computeFloatSize(4, self.sellPrice); } if (self.hasSystemAuto) { size_ += computeBoolSize(5, self.systemAuto); } if (self.hasDesc) { size_ += computeStringSize(6, self.desc); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_profit_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_profit_notify_msg*)[[[tg_stock_profit_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_profit_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_profit_notify_msg*)[[[tg_stock_profit_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_profit_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_profit_notify_msg*)[[[tg_stock_profit_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_profit_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_profit_notify_msg*)[[[tg_stock_profit_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_profit_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_profit_notify_msg*)[[[tg_stock_profit_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_profit_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_profit_notify_msg*)[[[tg_stock_profit_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_profit_notify_msgBuilder*) builder { return [[tg_stock_profit_notify_msgBuilder alloc] init]; } + (tg_stock_profit_notify_msgBuilder*) builderWithPrototype:(tg_stock_profit_notify_msg*) prototype { return [[tg_stock_profit_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_profit_notify_msgBuilder*) builder { return [tg_stock_profit_notify_msg builder]; } - (tg_stock_profit_notify_msgBuilder*) toBuilder { return [tg_stock_profit_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasTargetPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"targetPrice", [NSNumber numberWithFloat:self.targetPrice]]; } if (self.hasSellPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"sellPrice", [NSNumber numberWithFloat:self.sellPrice]]; } if (self.hasSystemAuto) { [output appendFormat:@"%@%@: %@\n", indent, @"systemAuto", [NSNumber numberWithBool:self.systemAuto]]; } if (self.hasDesc) { [output appendFormat:@"%@%@: %@\n", indent, @"desc", self.desc]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasTargetPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.targetPrice] forKey: @"targetPrice"]; } if (self.hasSellPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.sellPrice] forKey: @"sellPrice"]; } if (self.hasSystemAuto) { [dictionary setObject: [NSNumber numberWithBool:self.systemAuto] forKey: @"systemAuto"]; } if (self.hasDesc) { [dictionary setObject: self.desc forKey: @"desc"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_profit_notify_msg class]]) { return NO; } tg_stock_profit_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasTargetPrice == otherMessage.hasTargetPrice && (!self.hasTargetPrice || self.targetPrice == otherMessage.targetPrice) && self.hasSellPrice == otherMessage.hasSellPrice && (!self.hasSellPrice || self.sellPrice == otherMessage.sellPrice) && self.hasSystemAuto == otherMessage.hasSystemAuto && (!self.hasSystemAuto || self.systemAuto == otherMessage.systemAuto) && self.hasDesc == otherMessage.hasDesc && (!self.hasDesc || [self.desc isEqual:otherMessage.desc]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasTargetPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.targetPrice] hash]; } if (self.hasSellPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.sellPrice] hash]; } if (self.hasSystemAuto) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.systemAuto] hash]; } if (self.hasDesc) { hashCode = hashCode * 31 + [self.desc hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_profit_notify_msgBuilder() @property (strong) tg_stock_profit_notify_msg* resultTgStockProfitNotifyMsg; @end @implementation tg_stock_profit_notify_msgBuilder @synthesize resultTgStockProfitNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockProfitNotifyMsg = [[tg_stock_profit_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockProfitNotifyMsg; } - (tg_stock_profit_notify_msgBuilder*) clear { self.resultTgStockProfitNotifyMsg = [[tg_stock_profit_notify_msg alloc] init]; return self; } - (tg_stock_profit_notify_msgBuilder*) clone { return [tg_stock_profit_notify_msg builderWithPrototype:resultTgStockProfitNotifyMsg]; } - (tg_stock_profit_notify_msg*) defaultInstance { return [tg_stock_profit_notify_msg defaultInstance]; } - (tg_stock_profit_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_profit_notify_msg*) buildPartial { tg_stock_profit_notify_msg* returnMe = resultTgStockProfitNotifyMsg; self.resultTgStockProfitNotifyMsg = nil; return returnMe; } - (tg_stock_profit_notify_msgBuilder*) mergeFrom:(tg_stock_profit_notify_msg*) other { if (other == [tg_stock_profit_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasTargetPrice) { [self setTargetPrice:other.targetPrice]; } if (other.hasSellPrice) { [self setSellPrice:other.sellPrice]; } if (other.hasSystemAuto) { [self setSystemAuto:other.systemAuto]; } if (other.hasDesc) { [self setDesc:other.desc]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_profit_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_profit_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 29: { [self setTargetPrice:[input readFloat]]; break; } case 37: { [self setSellPrice:[input readFloat]]; break; } case 40: { [self setSystemAuto:[input readBool]]; break; } case 50: { [self setDesc:[input readString]]; break; } } } } - (BOOL) hasDate { return resultTgStockProfitNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockProfitNotifyMsg.date; } - (tg_stock_profit_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockProfitNotifyMsg.hasDate = YES; resultTgStockProfitNotifyMsg.date = value; return self; } - (tg_stock_profit_notify_msgBuilder*) clearDate { resultTgStockProfitNotifyMsg.hasDate = NO; resultTgStockProfitNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockProfitNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockProfitNotifyMsg.code; } - (tg_stock_profit_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockProfitNotifyMsg.hasCode = YES; resultTgStockProfitNotifyMsg.code = value; return self; } - (tg_stock_profit_notify_msgBuilder*) clearCode { resultTgStockProfitNotifyMsg.hasCode = NO; resultTgStockProfitNotifyMsg.code = @""; return self; } - (BOOL) hasTargetPrice { return resultTgStockProfitNotifyMsg.hasTargetPrice; } - (Float32) targetPrice { return resultTgStockProfitNotifyMsg.targetPrice; } - (tg_stock_profit_notify_msgBuilder*) setTargetPrice:(Float32) value { resultTgStockProfitNotifyMsg.hasTargetPrice = YES; resultTgStockProfitNotifyMsg.targetPrice = value; return self; } - (tg_stock_profit_notify_msgBuilder*) clearTargetPrice { resultTgStockProfitNotifyMsg.hasTargetPrice = NO; resultTgStockProfitNotifyMsg.targetPrice = 0; return self; } - (BOOL) hasSellPrice { return resultTgStockProfitNotifyMsg.hasSellPrice; } - (Float32) sellPrice { return resultTgStockProfitNotifyMsg.sellPrice; } - (tg_stock_profit_notify_msgBuilder*) setSellPrice:(Float32) value { resultTgStockProfitNotifyMsg.hasSellPrice = YES; resultTgStockProfitNotifyMsg.sellPrice = value; return self; } - (tg_stock_profit_notify_msgBuilder*) clearSellPrice { resultTgStockProfitNotifyMsg.hasSellPrice = NO; resultTgStockProfitNotifyMsg.sellPrice = 0; return self; } - (BOOL) hasSystemAuto { return resultTgStockProfitNotifyMsg.hasSystemAuto; } - (BOOL) systemAuto { return resultTgStockProfitNotifyMsg.systemAuto; } - (tg_stock_profit_notify_msgBuilder*) setSystemAuto:(BOOL) value { resultTgStockProfitNotifyMsg.hasSystemAuto = YES; resultTgStockProfitNotifyMsg.systemAuto = value; return self; } - (tg_stock_profit_notify_msgBuilder*) clearSystemAuto { resultTgStockProfitNotifyMsg.hasSystemAuto = NO; resultTgStockProfitNotifyMsg.systemAuto = NO; return self; } - (BOOL) hasDesc { return resultTgStockProfitNotifyMsg.hasDesc; } - (NSString*) desc { return resultTgStockProfitNotifyMsg.desc; } - (tg_stock_profit_notify_msgBuilder*) setDesc:(NSString*) value { resultTgStockProfitNotifyMsg.hasDesc = YES; resultTgStockProfitNotifyMsg.desc = value; return self; } - (tg_stock_profit_notify_msgBuilder*) clearDesc { resultTgStockProfitNotifyMsg.hasDesc = NO; resultTgStockProfitNotifyMsg.desc = @""; return self; } @end @interface tg_stock_stop_notify_msg () @property SInt64 date; @property (strong) NSString* code; @property Float32 stopPrice; @property Float32 sellPrice; @property BOOL systemAuto; @property (strong) NSString* desc; @end @implementation tg_stock_stop_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasStopPrice { return !!hasStopPrice_; } - (void) setHasStopPrice:(BOOL) _value_ { hasStopPrice_ = !!_value_; } @synthesize stopPrice; - (BOOL) hasSellPrice { return !!hasSellPrice_; } - (void) setHasSellPrice:(BOOL) _value_ { hasSellPrice_ = !!_value_; } @synthesize sellPrice; - (BOOL) hasSystemAuto { return !!hasSystemAuto_; } - (void) setHasSystemAuto:(BOOL) _value_ { hasSystemAuto_ = !!_value_; } - (BOOL) systemAuto { return !!systemAuto_; } - (void) setSystemAuto:(BOOL) _value_ { systemAuto_ = !!_value_; } - (BOOL) hasDesc { return !!hasDesc_; } - (void) setHasDesc:(BOOL) _value_ { hasDesc_ = !!_value_; } @synthesize desc; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.code = @""; self.stopPrice = 0; self.sellPrice = 0; self.systemAuto = NO; self.desc = @""; } return self; } static tg_stock_stop_notify_msg* defaulttg_stock_stop_notify_msgInstance = nil; + (void) initialize { if (self == [tg_stock_stop_notify_msg class]) { defaulttg_stock_stop_notify_msgInstance = [[tg_stock_stop_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_stock_stop_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_stock_stop_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasCode) { return NO; } if (!self.hasStopPrice) { return NO; } if (!self.hasSellPrice) { return NO; } if (!self.hasSystemAuto) { return NO; } if (!self.hasDesc) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasStopPrice) { [output writeFloat:3 value:self.stopPrice]; } if (self.hasSellPrice) { [output writeFloat:4 value:self.sellPrice]; } if (self.hasSystemAuto) { [output writeBool:5 value:self.systemAuto]; } if (self.hasDesc) { [output writeString:6 value:self.desc]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasStopPrice) { size_ += computeFloatSize(3, self.stopPrice); } if (self.hasSellPrice) { size_ += computeFloatSize(4, self.sellPrice); } if (self.hasSystemAuto) { size_ += computeBoolSize(5, self.systemAuto); } if (self.hasDesc) { size_ += computeStringSize(6, self.desc); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_stock_stop_notify_msg*) parseFromData:(NSData*) data { return (tg_stock_stop_notify_msg*)[[[tg_stock_stop_notify_msg builder] mergeFromData:data] build]; } + (tg_stock_stop_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_stop_notify_msg*)[[[tg_stock_stop_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_stock_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_stock_stop_notify_msg*)[[[tg_stock_stop_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_stock_stop_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_stop_notify_msg*)[[[tg_stock_stop_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_stock_stop_notify_msg*)[[[tg_stock_stop_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_stock_stop_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_stock_stop_notify_msg*)[[[tg_stock_stop_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_stock_stop_notify_msgBuilder*) builder { return [[tg_stock_stop_notify_msgBuilder alloc] init]; } + (tg_stock_stop_notify_msgBuilder*) builderWithPrototype:(tg_stock_stop_notify_msg*) prototype { return [[tg_stock_stop_notify_msg builder] mergeFrom:prototype]; } - (tg_stock_stop_notify_msgBuilder*) builder { return [tg_stock_stop_notify_msg builder]; } - (tg_stock_stop_notify_msgBuilder*) toBuilder { return [tg_stock_stop_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasStopPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"stopPrice", [NSNumber numberWithFloat:self.stopPrice]]; } if (self.hasSellPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"sellPrice", [NSNumber numberWithFloat:self.sellPrice]]; } if (self.hasSystemAuto) { [output appendFormat:@"%@%@: %@\n", indent, @"systemAuto", [NSNumber numberWithBool:self.systemAuto]]; } if (self.hasDesc) { [output appendFormat:@"%@%@: %@\n", indent, @"desc", self.desc]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasStopPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.stopPrice] forKey: @"stopPrice"]; } if (self.hasSellPrice) { [dictionary setObject: [NSNumber numberWithFloat:self.sellPrice] forKey: @"sellPrice"]; } if (self.hasSystemAuto) { [dictionary setObject: [NSNumber numberWithBool:self.systemAuto] forKey: @"systemAuto"]; } if (self.hasDesc) { [dictionary setObject: self.desc forKey: @"desc"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_stock_stop_notify_msg class]]) { return NO; } tg_stock_stop_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasStopPrice == otherMessage.hasStopPrice && (!self.hasStopPrice || self.stopPrice == otherMessage.stopPrice) && self.hasSellPrice == otherMessage.hasSellPrice && (!self.hasSellPrice || self.sellPrice == otherMessage.sellPrice) && self.hasSystemAuto == otherMessage.hasSystemAuto && (!self.hasSystemAuto || self.systemAuto == otherMessage.systemAuto) && self.hasDesc == otherMessage.hasDesc && (!self.hasDesc || [self.desc isEqual:otherMessage.desc]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasStopPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.stopPrice] hash]; } if (self.hasSellPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.sellPrice] hash]; } if (self.hasSystemAuto) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.systemAuto] hash]; } if (self.hasDesc) { hashCode = hashCode * 31 + [self.desc hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_stock_stop_notify_msgBuilder() @property (strong) tg_stock_stop_notify_msg* resultTgStockStopNotifyMsg; @end @implementation tg_stock_stop_notify_msgBuilder @synthesize resultTgStockStopNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgStockStopNotifyMsg = [[tg_stock_stop_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgStockStopNotifyMsg; } - (tg_stock_stop_notify_msgBuilder*) clear { self.resultTgStockStopNotifyMsg = [[tg_stock_stop_notify_msg alloc] init]; return self; } - (tg_stock_stop_notify_msgBuilder*) clone { return [tg_stock_stop_notify_msg builderWithPrototype:resultTgStockStopNotifyMsg]; } - (tg_stock_stop_notify_msg*) defaultInstance { return [tg_stock_stop_notify_msg defaultInstance]; } - (tg_stock_stop_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_stock_stop_notify_msg*) buildPartial { tg_stock_stop_notify_msg* returnMe = resultTgStockStopNotifyMsg; self.resultTgStockStopNotifyMsg = nil; return returnMe; } - (tg_stock_stop_notify_msgBuilder*) mergeFrom:(tg_stock_stop_notify_msg*) other { if (other == [tg_stock_stop_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasStopPrice) { [self setStopPrice:other.stopPrice]; } if (other.hasSellPrice) { [self setSellPrice:other.sellPrice]; } if (other.hasSystemAuto) { [self setSystemAuto:other.systemAuto]; } if (other.hasDesc) { [self setDesc:other.desc]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_stock_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_stock_stop_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setCode:[input readString]]; break; } case 29: { [self setStopPrice:[input readFloat]]; break; } case 37: { [self setSellPrice:[input readFloat]]; break; } case 40: { [self setSystemAuto:[input readBool]]; break; } case 50: { [self setDesc:[input readString]]; break; } } } } - (BOOL) hasDate { return resultTgStockStopNotifyMsg.hasDate; } - (SInt64) date { return resultTgStockStopNotifyMsg.date; } - (tg_stock_stop_notify_msgBuilder*) setDate:(SInt64) value { resultTgStockStopNotifyMsg.hasDate = YES; resultTgStockStopNotifyMsg.date = value; return self; } - (tg_stock_stop_notify_msgBuilder*) clearDate { resultTgStockStopNotifyMsg.hasDate = NO; resultTgStockStopNotifyMsg.date = 0L; return self; } - (BOOL) hasCode { return resultTgStockStopNotifyMsg.hasCode; } - (NSString*) code { return resultTgStockStopNotifyMsg.code; } - (tg_stock_stop_notify_msgBuilder*) setCode:(NSString*) value { resultTgStockStopNotifyMsg.hasCode = YES; resultTgStockStopNotifyMsg.code = value; return self; } - (tg_stock_stop_notify_msgBuilder*) clearCode { resultTgStockStopNotifyMsg.hasCode = NO; resultTgStockStopNotifyMsg.code = @""; return self; } - (BOOL) hasStopPrice { return resultTgStockStopNotifyMsg.hasStopPrice; } - (Float32) stopPrice { return resultTgStockStopNotifyMsg.stopPrice; } - (tg_stock_stop_notify_msgBuilder*) setStopPrice:(Float32) value { resultTgStockStopNotifyMsg.hasStopPrice = YES; resultTgStockStopNotifyMsg.stopPrice = value; return self; } - (tg_stock_stop_notify_msgBuilder*) clearStopPrice { resultTgStockStopNotifyMsg.hasStopPrice = NO; resultTgStockStopNotifyMsg.stopPrice = 0; return self; } - (BOOL) hasSellPrice { return resultTgStockStopNotifyMsg.hasSellPrice; } - (Float32) sellPrice { return resultTgStockStopNotifyMsg.sellPrice; } - (tg_stock_stop_notify_msgBuilder*) setSellPrice:(Float32) value { resultTgStockStopNotifyMsg.hasSellPrice = YES; resultTgStockStopNotifyMsg.sellPrice = value; return self; } - (tg_stock_stop_notify_msgBuilder*) clearSellPrice { resultTgStockStopNotifyMsg.hasSellPrice = NO; resultTgStockStopNotifyMsg.sellPrice = 0; return self; } - (BOOL) hasSystemAuto { return resultTgStockStopNotifyMsg.hasSystemAuto; } - (BOOL) systemAuto { return resultTgStockStopNotifyMsg.systemAuto; } - (tg_stock_stop_notify_msgBuilder*) setSystemAuto:(BOOL) value { resultTgStockStopNotifyMsg.hasSystemAuto = YES; resultTgStockStopNotifyMsg.systemAuto = value; return self; } - (tg_stock_stop_notify_msgBuilder*) clearSystemAuto { resultTgStockStopNotifyMsg.hasSystemAuto = NO; resultTgStockStopNotifyMsg.systemAuto = NO; return self; } - (BOOL) hasDesc { return resultTgStockStopNotifyMsg.hasDesc; } - (NSString*) desc { return resultTgStockStopNotifyMsg.desc; } - (tg_stock_stop_notify_msgBuilder*) setDesc:(NSString*) value { resultTgStockStopNotifyMsg.hasDesc = YES; resultTgStockStopNotifyMsg.desc = value; return self; } - (tg_stock_stop_notify_msgBuilder*) clearDesc { resultTgStockStopNotifyMsg.hasDesc = NO; resultTgStockStopNotifyMsg.desc = @""; return self; } @end @interface tg_focus_news_notify_msg () @property SInt64 date; @property (strong) NSString* title; @property (strong) NSString* content; @property (strong) NSString* url; @end @implementation tg_focus_news_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasTitle { return !!hasTitle_; } - (void) setHasTitle:(BOOL) _value_ { hasTitle_ = !!_value_; } @synthesize title; - (BOOL) hasContent { return !!hasContent_; } - (void) setHasContent:(BOOL) _value_ { hasContent_ = !!_value_; } @synthesize content; - (BOOL) hasUrl { return !!hasUrl_; } - (void) setHasUrl:(BOOL) _value_ { hasUrl_ = !!_value_; } @synthesize url; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.title = @""; self.content = @""; self.url = @""; } return self; } static tg_focus_news_notify_msg* defaulttg_focus_news_notify_msgInstance = nil; + (void) initialize { if (self == [tg_focus_news_notify_msg class]) { defaulttg_focus_news_notify_msgInstance = [[tg_focus_news_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_focus_news_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_focus_news_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasTitle) { return NO; } if (!self.hasContent) { return NO; } if (!self.hasUrl) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasTitle) { [output writeString:2 value:self.title]; } if (self.hasContent) { [output writeString:3 value:self.content]; } if (self.hasUrl) { [output writeString:4 value:self.url]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasTitle) { size_ += computeStringSize(2, self.title); } if (self.hasContent) { size_ += computeStringSize(3, self.content); } if (self.hasUrl) { size_ += computeStringSize(4, self.url); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_focus_news_notify_msg*) parseFromData:(NSData*) data { return (tg_focus_news_notify_msg*)[[[tg_focus_news_notify_msg builder] mergeFromData:data] build]; } + (tg_focus_news_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_focus_news_notify_msg*)[[[tg_focus_news_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_focus_news_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_focus_news_notify_msg*)[[[tg_focus_news_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_focus_news_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_focus_news_notify_msg*)[[[tg_focus_news_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_focus_news_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_focus_news_notify_msg*)[[[tg_focus_news_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_focus_news_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_focus_news_notify_msg*)[[[tg_focus_news_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_focus_news_notify_msgBuilder*) builder { return [[tg_focus_news_notify_msgBuilder alloc] init]; } + (tg_focus_news_notify_msgBuilder*) builderWithPrototype:(tg_focus_news_notify_msg*) prototype { return [[tg_focus_news_notify_msg builder] mergeFrom:prototype]; } - (tg_focus_news_notify_msgBuilder*) builder { return [tg_focus_news_notify_msg builder]; } - (tg_focus_news_notify_msgBuilder*) toBuilder { return [tg_focus_news_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasTitle) { [output appendFormat:@"%@%@: %@\n", indent, @"title", self.title]; } if (self.hasContent) { [output appendFormat:@"%@%@: %@\n", indent, @"content", self.content]; } if (self.hasUrl) { [output appendFormat:@"%@%@: %@\n", indent, @"url", self.url]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasTitle) { [dictionary setObject: self.title forKey: @"title"]; } if (self.hasContent) { [dictionary setObject: self.content forKey: @"content"]; } if (self.hasUrl) { [dictionary setObject: self.url forKey: @"url"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_focus_news_notify_msg class]]) { return NO; } tg_focus_news_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasTitle == otherMessage.hasTitle && (!self.hasTitle || [self.title isEqual:otherMessage.title]) && self.hasContent == otherMessage.hasContent && (!self.hasContent || [self.content isEqual:otherMessage.content]) && self.hasUrl == otherMessage.hasUrl && (!self.hasUrl || [self.url isEqual:otherMessage.url]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasTitle) { hashCode = hashCode * 31 + [self.title hash]; } if (self.hasContent) { hashCode = hashCode * 31 + [self.content hash]; } if (self.hasUrl) { hashCode = hashCode * 31 + [self.url hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_focus_news_notify_msgBuilder() @property (strong) tg_focus_news_notify_msg* resultTgFocusNewsNotifyMsg; @end @implementation tg_focus_news_notify_msgBuilder @synthesize resultTgFocusNewsNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgFocusNewsNotifyMsg = [[tg_focus_news_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgFocusNewsNotifyMsg; } - (tg_focus_news_notify_msgBuilder*) clear { self.resultTgFocusNewsNotifyMsg = [[tg_focus_news_notify_msg alloc] init]; return self; } - (tg_focus_news_notify_msgBuilder*) clone { return [tg_focus_news_notify_msg builderWithPrototype:resultTgFocusNewsNotifyMsg]; } - (tg_focus_news_notify_msg*) defaultInstance { return [tg_focus_news_notify_msg defaultInstance]; } - (tg_focus_news_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_focus_news_notify_msg*) buildPartial { tg_focus_news_notify_msg* returnMe = resultTgFocusNewsNotifyMsg; self.resultTgFocusNewsNotifyMsg = nil; return returnMe; } - (tg_focus_news_notify_msgBuilder*) mergeFrom:(tg_focus_news_notify_msg*) other { if (other == [tg_focus_news_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasTitle) { [self setTitle:other.title]; } if (other.hasContent) { [self setContent:other.content]; } if (other.hasUrl) { [self setUrl:other.url]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_focus_news_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_focus_news_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setTitle:[input readString]]; break; } case 26: { [self setContent:[input readString]]; break; } case 34: { [self setUrl:[input readString]]; break; } } } } - (BOOL) hasDate { return resultTgFocusNewsNotifyMsg.hasDate; } - (SInt64) date { return resultTgFocusNewsNotifyMsg.date; } - (tg_focus_news_notify_msgBuilder*) setDate:(SInt64) value { resultTgFocusNewsNotifyMsg.hasDate = YES; resultTgFocusNewsNotifyMsg.date = value; return self; } - (tg_focus_news_notify_msgBuilder*) clearDate { resultTgFocusNewsNotifyMsg.hasDate = NO; resultTgFocusNewsNotifyMsg.date = 0L; return self; } - (BOOL) hasTitle { return resultTgFocusNewsNotifyMsg.hasTitle; } - (NSString*) title { return resultTgFocusNewsNotifyMsg.title; } - (tg_focus_news_notify_msgBuilder*) setTitle:(NSString*) value { resultTgFocusNewsNotifyMsg.hasTitle = YES; resultTgFocusNewsNotifyMsg.title = value; return self; } - (tg_focus_news_notify_msgBuilder*) clearTitle { resultTgFocusNewsNotifyMsg.hasTitle = NO; resultTgFocusNewsNotifyMsg.title = @""; return self; } - (BOOL) hasContent { return resultTgFocusNewsNotifyMsg.hasContent; } - (NSString*) content { return resultTgFocusNewsNotifyMsg.content; } - (tg_focus_news_notify_msgBuilder*) setContent:(NSString*) value { resultTgFocusNewsNotifyMsg.hasContent = YES; resultTgFocusNewsNotifyMsg.content = value; return self; } - (tg_focus_news_notify_msgBuilder*) clearContent { resultTgFocusNewsNotifyMsg.hasContent = NO; resultTgFocusNewsNotifyMsg.content = @""; return self; } - (BOOL) hasUrl { return resultTgFocusNewsNotifyMsg.hasUrl; } - (NSString*) url { return resultTgFocusNewsNotifyMsg.url; } - (tg_focus_news_notify_msgBuilder*) setUrl:(NSString*) value { resultTgFocusNewsNotifyMsg.hasUrl = YES; resultTgFocusNewsNotifyMsg.url = value; return self; } - (tg_focus_news_notify_msgBuilder*) clearUrl { resultTgFocusNewsNotifyMsg.hasUrl = NO; resultTgFocusNewsNotifyMsg.url = @""; return self; } @end @interface tg_trailer_notify_msg () @property SInt64 date; @property (strong) NSString* title; @property (strong) NSString* content; @property (strong) NSString* url; @end @implementation tg_trailer_notify_msg - (BOOL) hasDate { return !!hasDate_; } - (void) setHasDate:(BOOL) _value_ { hasDate_ = !!_value_; } @synthesize date; - (BOOL) hasTitle { return !!hasTitle_; } - (void) setHasTitle:(BOOL) _value_ { hasTitle_ = !!_value_; } @synthesize title; - (BOOL) hasContent { return !!hasContent_; } - (void) setHasContent:(BOOL) _value_ { hasContent_ = !!_value_; } @synthesize content; - (BOOL) hasUrl { return !!hasUrl_; } - (void) setHasUrl:(BOOL) _value_ { hasUrl_ = !!_value_; } @synthesize url; - (instancetype) init { if ((self = [super init])) { self.date = 0L; self.title = @""; self.content = @""; self.url = @""; } return self; } static tg_trailer_notify_msg* defaulttg_trailer_notify_msgInstance = nil; + (void) initialize { if (self == [tg_trailer_notify_msg class]) { defaulttg_trailer_notify_msgInstance = [[tg_trailer_notify_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_trailer_notify_msgInstance; } - (instancetype) defaultInstance { return defaulttg_trailer_notify_msgInstance; } - (BOOL) isInitialized { if (!self.hasDate) { return NO; } if (!self.hasTitle) { return NO; } if (!self.hasContent) { return NO; } if (!self.hasUrl) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDate) { [output writeInt64:1 value:self.date]; } if (self.hasTitle) { [output writeString:2 value:self.title]; } if (self.hasContent) { [output writeString:3 value:self.content]; } if (self.hasUrl) { [output writeString:4 value:self.url]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDate) { size_ += computeInt64Size(1, self.date); } if (self.hasTitle) { size_ += computeStringSize(2, self.title); } if (self.hasContent) { size_ += computeStringSize(3, self.content); } if (self.hasUrl) { size_ += computeStringSize(4, self.url); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_trailer_notify_msg*) parseFromData:(NSData*) data { return (tg_trailer_notify_msg*)[[[tg_trailer_notify_msg builder] mergeFromData:data] build]; } + (tg_trailer_notify_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_trailer_notify_msg*)[[[tg_trailer_notify_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_trailer_notify_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_trailer_notify_msg*)[[[tg_trailer_notify_msg builder] mergeFromInputStream:input] build]; } + (tg_trailer_notify_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_trailer_notify_msg*)[[[tg_trailer_notify_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_trailer_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_trailer_notify_msg*)[[[tg_trailer_notify_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_trailer_notify_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_trailer_notify_msg*)[[[tg_trailer_notify_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_trailer_notify_msgBuilder*) builder { return [[tg_trailer_notify_msgBuilder alloc] init]; } + (tg_trailer_notify_msgBuilder*) builderWithPrototype:(tg_trailer_notify_msg*) prototype { return [[tg_trailer_notify_msg builder] mergeFrom:prototype]; } - (tg_trailer_notify_msgBuilder*) builder { return [tg_trailer_notify_msg builder]; } - (tg_trailer_notify_msgBuilder*) toBuilder { return [tg_trailer_notify_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDate) { [output appendFormat:@"%@%@: %@\n", indent, @"date", [NSNumber numberWithLongLong:self.date]]; } if (self.hasTitle) { [output appendFormat:@"%@%@: %@\n", indent, @"title", self.title]; } if (self.hasContent) { [output appendFormat:@"%@%@: %@\n", indent, @"content", self.content]; } if (self.hasUrl) { [output appendFormat:@"%@%@: %@\n", indent, @"url", self.url]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDate) { [dictionary setObject: [NSNumber numberWithLongLong:self.date] forKey: @"date"]; } if (self.hasTitle) { [dictionary setObject: self.title forKey: @"title"]; } if (self.hasContent) { [dictionary setObject: self.content forKey: @"content"]; } if (self.hasUrl) { [dictionary setObject: self.url forKey: @"url"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_trailer_notify_msg class]]) { return NO; } tg_trailer_notify_msg *otherMessage = other; return self.hasDate == otherMessage.hasDate && (!self.hasDate || self.date == otherMessage.date) && self.hasTitle == otherMessage.hasTitle && (!self.hasTitle || [self.title isEqual:otherMessage.title]) && self.hasContent == otherMessage.hasContent && (!self.hasContent || [self.content isEqual:otherMessage.content]) && self.hasUrl == otherMessage.hasUrl && (!self.hasUrl || [self.url isEqual:otherMessage.url]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDate) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.date] hash]; } if (self.hasTitle) { hashCode = hashCode * 31 + [self.title hash]; } if (self.hasContent) { hashCode = hashCode * 31 + [self.content hash]; } if (self.hasUrl) { hashCode = hashCode * 31 + [self.url hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_trailer_notify_msgBuilder() @property (strong) tg_trailer_notify_msg* resultTgTrailerNotifyMsg; @end @implementation tg_trailer_notify_msgBuilder @synthesize resultTgTrailerNotifyMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgTrailerNotifyMsg = [[tg_trailer_notify_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgTrailerNotifyMsg; } - (tg_trailer_notify_msgBuilder*) clear { self.resultTgTrailerNotifyMsg = [[tg_trailer_notify_msg alloc] init]; return self; } - (tg_trailer_notify_msgBuilder*) clone { return [tg_trailer_notify_msg builderWithPrototype:resultTgTrailerNotifyMsg]; } - (tg_trailer_notify_msg*) defaultInstance { return [tg_trailer_notify_msg defaultInstance]; } - (tg_trailer_notify_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_trailer_notify_msg*) buildPartial { tg_trailer_notify_msg* returnMe = resultTgTrailerNotifyMsg; self.resultTgTrailerNotifyMsg = nil; return returnMe; } - (tg_trailer_notify_msgBuilder*) mergeFrom:(tg_trailer_notify_msg*) other { if (other == [tg_trailer_notify_msg defaultInstance]) { return self; } if (other.hasDate) { [self setDate:other.date]; } if (other.hasTitle) { [self setTitle:other.title]; } if (other.hasContent) { [self setContent:other.content]; } if (other.hasUrl) { [self setUrl:other.url]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_trailer_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_trailer_notify_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDate:[input readInt64]]; break; } case 18: { [self setTitle:[input readString]]; break; } case 26: { [self setContent:[input readString]]; break; } case 34: { [self setUrl:[input readString]]; break; } } } } - (BOOL) hasDate { return resultTgTrailerNotifyMsg.hasDate; } - (SInt64) date { return resultTgTrailerNotifyMsg.date; } - (tg_trailer_notify_msgBuilder*) setDate:(SInt64) value { resultTgTrailerNotifyMsg.hasDate = YES; resultTgTrailerNotifyMsg.date = value; return self; } - (tg_trailer_notify_msgBuilder*) clearDate { resultTgTrailerNotifyMsg.hasDate = NO; resultTgTrailerNotifyMsg.date = 0L; return self; } - (BOOL) hasTitle { return resultTgTrailerNotifyMsg.hasTitle; } - (NSString*) title { return resultTgTrailerNotifyMsg.title; } - (tg_trailer_notify_msgBuilder*) setTitle:(NSString*) value { resultTgTrailerNotifyMsg.hasTitle = YES; resultTgTrailerNotifyMsg.title = value; return self; } - (tg_trailer_notify_msgBuilder*) clearTitle { resultTgTrailerNotifyMsg.hasTitle = NO; resultTgTrailerNotifyMsg.title = @""; return self; } - (BOOL) hasContent { return resultTgTrailerNotifyMsg.hasContent; } - (NSString*) content { return resultTgTrailerNotifyMsg.content; } - (tg_trailer_notify_msgBuilder*) setContent:(NSString*) value { resultTgTrailerNotifyMsg.hasContent = YES; resultTgTrailerNotifyMsg.content = value; return self; } - (tg_trailer_notify_msgBuilder*) clearContent { resultTgTrailerNotifyMsg.hasContent = NO; resultTgTrailerNotifyMsg.content = @""; return self; } - (BOOL) hasUrl { return resultTgTrailerNotifyMsg.hasUrl; } - (NSString*) url { return resultTgTrailerNotifyMsg.url; } - (tg_trailer_notify_msgBuilder*) setUrl:(NSString*) value { resultTgTrailerNotifyMsg.hasUrl = YES; resultTgTrailerNotifyMsg.url = value; return self; } - (tg_trailer_notify_msgBuilder*) clearUrl { resultTgTrailerNotifyMsg.hasUrl = NO; resultTgTrailerNotifyMsg.url = @""; return self; } @end @interface tg_req_msg_box_msg () @property SInt32 pid; @property SInt64 lastSeq; @end @implementation tg_req_msg_box_msg - (BOOL) hasPid { return !!hasPid_; } - (void) setHasPid:(BOOL) _value_ { hasPid_ = !!_value_; } @synthesize pid; - (BOOL) hasLastSeq { return !!hasLastSeq_; } - (void) setHasLastSeq:(BOOL) _value_ { hasLastSeq_ = !!_value_; } @synthesize lastSeq; - (instancetype) init { if ((self = [super init])) { self.pid = 0; self.lastSeq = 0L; } return self; } static tg_req_msg_box_msg* defaulttg_req_msg_box_msgInstance = nil; + (void) initialize { if (self == [tg_req_msg_box_msg class]) { defaulttg_req_msg_box_msgInstance = [[tg_req_msg_box_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_req_msg_box_msgInstance; } - (instancetype) defaultInstance { return defaulttg_req_msg_box_msgInstance; } - (BOOL) isInitialized { if (!self.hasPid) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasPid) { [output writeInt32:1 value:self.pid]; } if (self.hasLastSeq) { [output writeInt64:2 value:self.lastSeq]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasPid) { size_ += computeInt32Size(1, self.pid); } if (self.hasLastSeq) { size_ += computeInt64Size(2, self.lastSeq); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_req_msg_box_msg*) parseFromData:(NSData*) data { return (tg_req_msg_box_msg*)[[[tg_req_msg_box_msg builder] mergeFromData:data] build]; } + (tg_req_msg_box_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_req_msg_box_msg*)[[[tg_req_msg_box_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_req_msg_box_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_req_msg_box_msg*)[[[tg_req_msg_box_msg builder] mergeFromInputStream:input] build]; } + (tg_req_msg_box_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_req_msg_box_msg*)[[[tg_req_msg_box_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_req_msg_box_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_req_msg_box_msg*)[[[tg_req_msg_box_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_req_msg_box_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_req_msg_box_msg*)[[[tg_req_msg_box_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_req_msg_box_msgBuilder*) builder { return [[tg_req_msg_box_msgBuilder alloc] init]; } + (tg_req_msg_box_msgBuilder*) builderWithPrototype:(tg_req_msg_box_msg*) prototype { return [[tg_req_msg_box_msg builder] mergeFrom:prototype]; } - (tg_req_msg_box_msgBuilder*) builder { return [tg_req_msg_box_msg builder]; } - (tg_req_msg_box_msgBuilder*) toBuilder { return [tg_req_msg_box_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasPid) { [output appendFormat:@"%@%@: %@\n", indent, @"pid", [NSNumber numberWithInteger:self.pid]]; } if (self.hasLastSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"lastSeq", [NSNumber numberWithLongLong:self.lastSeq]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasPid) { [dictionary setObject: [NSNumber numberWithInteger:self.pid] forKey: @"pid"]; } if (self.hasLastSeq) { [dictionary setObject: [NSNumber numberWithLongLong:self.lastSeq] forKey: @"lastSeq"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_req_msg_box_msg class]]) { return NO; } tg_req_msg_box_msg *otherMessage = other; return self.hasPid == otherMessage.hasPid && (!self.hasPid || self.pid == otherMessage.pid) && self.hasLastSeq == otherMessage.hasLastSeq && (!self.hasLastSeq || self.lastSeq == otherMessage.lastSeq) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasPid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.pid] hash]; } if (self.hasLastSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.lastSeq] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_req_msg_box_msgBuilder() @property (strong) tg_req_msg_box_msg* resultTgReqMsgBoxMsg; @end @implementation tg_req_msg_box_msgBuilder @synthesize resultTgReqMsgBoxMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgReqMsgBoxMsg = [[tg_req_msg_box_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgReqMsgBoxMsg; } - (tg_req_msg_box_msgBuilder*) clear { self.resultTgReqMsgBoxMsg = [[tg_req_msg_box_msg alloc] init]; return self; } - (tg_req_msg_box_msgBuilder*) clone { return [tg_req_msg_box_msg builderWithPrototype:resultTgReqMsgBoxMsg]; } - (tg_req_msg_box_msg*) defaultInstance { return [tg_req_msg_box_msg defaultInstance]; } - (tg_req_msg_box_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_req_msg_box_msg*) buildPartial { tg_req_msg_box_msg* returnMe = resultTgReqMsgBoxMsg; self.resultTgReqMsgBoxMsg = nil; return returnMe; } - (tg_req_msg_box_msgBuilder*) mergeFrom:(tg_req_msg_box_msg*) other { if (other == [tg_req_msg_box_msg defaultInstance]) { return self; } if (other.hasPid) { [self setPid:other.pid]; } if (other.hasLastSeq) { [self setLastSeq:other.lastSeq]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_req_msg_box_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_req_msg_box_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setPid:[input readInt32]]; break; } case 16: { [self setLastSeq:[input readInt64]]; break; } } } } - (BOOL) hasPid { return resultTgReqMsgBoxMsg.hasPid; } - (SInt32) pid { return resultTgReqMsgBoxMsg.pid; } - (tg_req_msg_box_msgBuilder*) setPid:(SInt32) value { resultTgReqMsgBoxMsg.hasPid = YES; resultTgReqMsgBoxMsg.pid = value; return self; } - (tg_req_msg_box_msgBuilder*) clearPid { resultTgReqMsgBoxMsg.hasPid = NO; resultTgReqMsgBoxMsg.pid = 0; return self; } - (BOOL) hasLastSeq { return resultTgReqMsgBoxMsg.hasLastSeq; } - (SInt64) lastSeq { return resultTgReqMsgBoxMsg.lastSeq; } - (tg_req_msg_box_msgBuilder*) setLastSeq:(SInt64) value { resultTgReqMsgBoxMsg.hasLastSeq = YES; resultTgReqMsgBoxMsg.lastSeq = value; return self; } - (tg_req_msg_box_msgBuilder*) clearLastSeq { resultTgReqMsgBoxMsg.hasLastSeq = NO; resultTgReqMsgBoxMsg.lastSeq = 0L; return self; } @end @interface tg_msg_box_combo_msg () @property (strong) NSMutableArray * msgsArray; @end @implementation tg_msg_box_combo_msg @synthesize msgsArray; @dynamic msgs; - (instancetype) init { if ((self = [super init])) { } return self; } static tg_msg_box_combo_msg* defaulttg_msg_box_combo_msgInstance = nil; + (void) initialize { if (self == [tg_msg_box_combo_msg class]) { defaulttg_msg_box_combo_msgInstance = [[tg_msg_box_combo_msg alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_msg_box_combo_msgInstance; } - (instancetype) defaultInstance { return defaulttg_msg_box_combo_msgInstance; } - (NSArray *)msgs { return msgsArray; } - (tg_msg_box_combo_msgtg_msg_node*)msgsAtIndex:(NSUInteger)index { return [msgsArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitmsgs = YES; [self.msgs enumerateObjectsUsingBlock:^(tg_msg_box_combo_msgtg_msg_node *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitmsgs = NO; *stop = YES; } }]; if (!isInitmsgs) return isInitmsgs; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.msgsArray enumerateObjectsUsingBlock:^(tg_msg_box_combo_msgtg_msg_node *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.msgsArray enumerateObjectsUsingBlock:^(tg_msg_box_combo_msgtg_msg_node *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_msg_box_combo_msg*) parseFromData:(NSData*) data { return (tg_msg_box_combo_msg*)[[[tg_msg_box_combo_msg builder] mergeFromData:data] build]; } + (tg_msg_box_combo_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_msg_box_combo_msg*)[[[tg_msg_box_combo_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_msg_box_combo_msg*) parseFromInputStream:(NSInputStream*) input { return (tg_msg_box_combo_msg*)[[[tg_msg_box_combo_msg builder] mergeFromInputStream:input] build]; } + (tg_msg_box_combo_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_msg_box_combo_msg*)[[[tg_msg_box_combo_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_msg_box_combo_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_msg_box_combo_msg*)[[[tg_msg_box_combo_msg builder] mergeFromCodedInputStream:input] build]; } + (tg_msg_box_combo_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_msg_box_combo_msg*)[[[tg_msg_box_combo_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_msg_box_combo_msgBuilder*) builder { return [[tg_msg_box_combo_msgBuilder alloc] init]; } + (tg_msg_box_combo_msgBuilder*) builderWithPrototype:(tg_msg_box_combo_msg*) prototype { return [[tg_msg_box_combo_msg builder] mergeFrom:prototype]; } - (tg_msg_box_combo_msgBuilder*) builder { return [tg_msg_box_combo_msg builder]; } - (tg_msg_box_combo_msgBuilder*) toBuilder { return [tg_msg_box_combo_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.msgsArray enumerateObjectsUsingBlock:^(tg_msg_box_combo_msgtg_msg_node *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"msgs"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (tg_msg_box_combo_msgtg_msg_node* element in self.msgsArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"msgs"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_msg_box_combo_msg class]]) { return NO; } tg_msg_box_combo_msg *otherMessage = other; return [self.msgsArray isEqualToArray:otherMessage.msgsArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.msgsArray enumerateObjectsUsingBlock:^(tg_msg_box_combo_msgtg_msg_node *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_msg_box_combo_msgtg_msg_node () @property eum_nofity_type type; @property (strong) NSData* subMsg; @property SInt64 msgSeq; @end @implementation tg_msg_box_combo_msgtg_msg_node - (BOOL) hasType { return !!hasType_; } - (void) setHasType:(BOOL) _value_ { hasType_ = !!_value_; } @synthesize type; - (BOOL) hasSubMsg { return !!hasSubMsg_; } - (void) setHasSubMsg:(BOOL) _value_ { hasSubMsg_ = !!_value_; } @synthesize subMsg; - (BOOL) hasMsgSeq { return !!hasMsgSeq_; } - (void) setHasMsgSeq:(BOOL) _value_ { hasMsgSeq_ = !!_value_; } @synthesize msgSeq; - (instancetype) init { if ((self = [super init])) { self.type = eum_nofity_typeTgStockInPoolNotify; self.subMsg = [NSData data]; self.msgSeq = 0L; } return self; } static tg_msg_box_combo_msgtg_msg_node* defaulttg_msg_box_combo_msgtg_msg_nodeInstance = nil; + (void) initialize { if (self == [tg_msg_box_combo_msgtg_msg_node class]) { defaulttg_msg_box_combo_msgtg_msg_nodeInstance = [[tg_msg_box_combo_msgtg_msg_node alloc] init]; } } + (instancetype) defaultInstance { return defaulttg_msg_box_combo_msgtg_msg_nodeInstance; } - (instancetype) defaultInstance { return defaulttg_msg_box_combo_msgtg_msg_nodeInstance; } - (BOOL) isInitialized { if (!self.hasType) { return NO; } if (!self.hasSubMsg) { return NO; } if (!self.hasMsgSeq) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasType) { [output writeEnum:1 value:self.type]; } if (self.hasSubMsg) { [output writeData:2 value:self.subMsg]; } if (self.hasMsgSeq) { [output writeInt64:3 value:self.msgSeq]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasType) { size_ += computeEnumSize(1, self.type); } if (self.hasSubMsg) { size_ += computeDataSize(2, self.subMsg); } if (self.hasMsgSeq) { size_ += computeInt64Size(3, self.msgSeq); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (tg_msg_box_combo_msgtg_msg_node*) parseFromData:(NSData*) data { return (tg_msg_box_combo_msgtg_msg_node*)[[[tg_msg_box_combo_msgtg_msg_node builder] mergeFromData:data] build]; } + (tg_msg_box_combo_msgtg_msg_node*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_msg_box_combo_msgtg_msg_node*)[[[tg_msg_box_combo_msgtg_msg_node builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (tg_msg_box_combo_msgtg_msg_node*) parseFromInputStream:(NSInputStream*) input { return (tg_msg_box_combo_msgtg_msg_node*)[[[tg_msg_box_combo_msgtg_msg_node builder] mergeFromInputStream:input] build]; } + (tg_msg_box_combo_msgtg_msg_node*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_msg_box_combo_msgtg_msg_node*)[[[tg_msg_box_combo_msgtg_msg_node builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_msg_box_combo_msgtg_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (tg_msg_box_combo_msgtg_msg_node*)[[[tg_msg_box_combo_msgtg_msg_node builder] mergeFromCodedInputStream:input] build]; } + (tg_msg_box_combo_msgtg_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (tg_msg_box_combo_msgtg_msg_node*)[[[tg_msg_box_combo_msgtg_msg_node builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (tg_msg_box_combo_msgtg_msg_nodeBuilder*) builder { return [[tg_msg_box_combo_msgtg_msg_nodeBuilder alloc] init]; } + (tg_msg_box_combo_msgtg_msg_nodeBuilder*) builderWithPrototype:(tg_msg_box_combo_msgtg_msg_node*) prototype { return [[tg_msg_box_combo_msgtg_msg_node builder] mergeFrom:prototype]; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) builder { return [tg_msg_box_combo_msgtg_msg_node builder]; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) toBuilder { return [tg_msg_box_combo_msgtg_msg_node builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasType) { [output appendFormat:@"%@%@: %@\n", indent, @"type", NSStringFromeum_nofity_type(self.type)]; } if (self.hasSubMsg) { [output appendFormat:@"%@%@: %@\n", indent, @"subMsg", self.subMsg]; } if (self.hasMsgSeq) { [output appendFormat:@"%@%@: %@\n", indent, @"msgSeq", [NSNumber numberWithLongLong:self.msgSeq]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasType) { [dictionary setObject: @(self.type) forKey: @"type"]; } if (self.hasSubMsg) { [dictionary setObject: self.subMsg forKey: @"subMsg"]; } if (self.hasMsgSeq) { [dictionary setObject: [NSNumber numberWithLongLong:self.msgSeq] forKey: @"msgSeq"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[tg_msg_box_combo_msgtg_msg_node class]]) { return NO; } tg_msg_box_combo_msgtg_msg_node *otherMessage = other; return self.hasType == otherMessage.hasType && (!self.hasType || self.type == otherMessage.type) && self.hasSubMsg == otherMessage.hasSubMsg && (!self.hasSubMsg || [self.subMsg isEqual:otherMessage.subMsg]) && self.hasMsgSeq == otherMessage.hasMsgSeq && (!self.hasMsgSeq || self.msgSeq == otherMessage.msgSeq) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasType) { hashCode = hashCode * 31 + self.type; } if (self.hasSubMsg) { hashCode = hashCode * 31 + [self.subMsg hash]; } if (self.hasMsgSeq) { hashCode = hashCode * 31 + [[NSNumber numberWithLongLong:self.msgSeq] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface tg_msg_box_combo_msgtg_msg_nodeBuilder() @property (strong) tg_msg_box_combo_msgtg_msg_node* resultTgMsgNode; @end @implementation tg_msg_box_combo_msgtg_msg_nodeBuilder @synthesize resultTgMsgNode; - (instancetype) init { if ((self = [super init])) { self.resultTgMsgNode = [[tg_msg_box_combo_msgtg_msg_node alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgMsgNode; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clear { self.resultTgMsgNode = [[tg_msg_box_combo_msgtg_msg_node alloc] init]; return self; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clone { return [tg_msg_box_combo_msgtg_msg_node builderWithPrototype:resultTgMsgNode]; } - (tg_msg_box_combo_msgtg_msg_node*) defaultInstance { return [tg_msg_box_combo_msgtg_msg_node defaultInstance]; } - (tg_msg_box_combo_msgtg_msg_node*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_msg_box_combo_msgtg_msg_node*) buildPartial { tg_msg_box_combo_msgtg_msg_node* returnMe = resultTgMsgNode; self.resultTgMsgNode = nil; return returnMe; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) mergeFrom:(tg_msg_box_combo_msgtg_msg_node*) other { if (other == [tg_msg_box_combo_msgtg_msg_node defaultInstance]) { return self; } if (other.hasType) { [self setType:other.type]; } if (other.hasSubMsg) { [self setSubMsg:other.subMsg]; } if (other.hasMsgSeq) { [self setMsgSeq:other.msgSeq]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { eum_nofity_type value = (eum_nofity_type)[input readEnum]; if (eum_nofity_typeIsValidValue(value)) { [self setType:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setSubMsg:[input readData]]; break; } case 24: { [self setMsgSeq:[input readInt64]]; break; } } } } - (BOOL) hasType { return resultTgMsgNode.hasType; } - (eum_nofity_type) type { return resultTgMsgNode.type; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) setType:(eum_nofity_type) value { resultTgMsgNode.hasType = YES; resultTgMsgNode.type = value; return self; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clearType { resultTgMsgNode.hasType = NO; resultTgMsgNode.type = eum_nofity_typeTgStockInPoolNotify; return self; } - (BOOL) hasSubMsg { return resultTgMsgNode.hasSubMsg; } - (NSData*) subMsg { return resultTgMsgNode.subMsg; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) setSubMsg:(NSData*) value { resultTgMsgNode.hasSubMsg = YES; resultTgMsgNode.subMsg = value; return self; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clearSubMsg { resultTgMsgNode.hasSubMsg = NO; resultTgMsgNode.subMsg = [NSData data]; return self; } - (BOOL) hasMsgSeq { return resultTgMsgNode.hasMsgSeq; } - (SInt64) msgSeq { return resultTgMsgNode.msgSeq; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) setMsgSeq:(SInt64) value { resultTgMsgNode.hasMsgSeq = YES; resultTgMsgNode.msgSeq = value; return self; } - (tg_msg_box_combo_msgtg_msg_nodeBuilder*) clearMsgSeq { resultTgMsgNode.hasMsgSeq = NO; resultTgMsgNode.msgSeq = 0L; return self; } @end @interface tg_msg_box_combo_msgBuilder() @property (strong) tg_msg_box_combo_msg* resultTgMsgBoxComboMsg; @end @implementation tg_msg_box_combo_msgBuilder @synthesize resultTgMsgBoxComboMsg; - (instancetype) init { if ((self = [super init])) { self.resultTgMsgBoxComboMsg = [[tg_msg_box_combo_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultTgMsgBoxComboMsg; } - (tg_msg_box_combo_msgBuilder*) clear { self.resultTgMsgBoxComboMsg = [[tg_msg_box_combo_msg alloc] init]; return self; } - (tg_msg_box_combo_msgBuilder*) clone { return [tg_msg_box_combo_msg builderWithPrototype:resultTgMsgBoxComboMsg]; } - (tg_msg_box_combo_msg*) defaultInstance { return [tg_msg_box_combo_msg defaultInstance]; } - (tg_msg_box_combo_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (tg_msg_box_combo_msg*) buildPartial { tg_msg_box_combo_msg* returnMe = resultTgMsgBoxComboMsg; self.resultTgMsgBoxComboMsg = nil; return returnMe; } - (tg_msg_box_combo_msgBuilder*) mergeFrom:(tg_msg_box_combo_msg*) other { if (other == [tg_msg_box_combo_msg defaultInstance]) { return self; } if (other.msgsArray.count > 0) { if (resultTgMsgBoxComboMsg.msgsArray == nil) { resultTgMsgBoxComboMsg.msgsArray = [[NSMutableArray alloc] initWithArray:other.msgsArray]; } else { [resultTgMsgBoxComboMsg.msgsArray addObjectsFromArray:other.msgsArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (tg_msg_box_combo_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (tg_msg_box_combo_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { tg_msg_box_combo_msgtg_msg_nodeBuilder* subBuilder = [tg_msg_box_combo_msgtg_msg_node builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addMsgs:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)msgs { return resultTgMsgBoxComboMsg.msgsArray; } - (tg_msg_box_combo_msgtg_msg_node*)msgsAtIndex:(NSUInteger)index { return [resultTgMsgBoxComboMsg msgsAtIndex:index]; } - (tg_msg_box_combo_msgBuilder *)addMsgs:(tg_msg_box_combo_msgtg_msg_node*)value { if (resultTgMsgBoxComboMsg.msgsArray == nil) { resultTgMsgBoxComboMsg.msgsArray = [[NSMutableArray alloc]init]; } [resultTgMsgBoxComboMsg.msgsArray addObject:value]; return self; } - (tg_msg_box_combo_msgBuilder *)setMsgsArray:(NSArray *)array { resultTgMsgBoxComboMsg.msgsArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (tg_msg_box_combo_msgBuilder *)clearMsgs { resultTgMsgBoxComboMsg.msgsArray = nil; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Report.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" #import "Common.pb.h" // @@protoc_insertion_point(imports) @class auth_ctx_msg; @class auth_ctx_msgBuilder; @class client_login_msg; @class client_login_msgBuilder; @class client_login_result_msg; @class client_login_result_msgBuilder; @class combo_private_msg; @class combo_private_msgBuilder; @class common_reply_error_msg; @class common_reply_error_msgBuilder; @class common_update_notice_msg; @class common_update_notice_msgBuilder; @class count_offset_selector; @class count_offset_selectorBuilder; @class data_selector; @class data_selectorBuilder; @class ext_key_info; @class ext_key_infoBuilder; @class load_dector_msg; @class load_dector_msgBuilder; @class notify_ack_msg; @class notify_ack_msgBuilder; @class open_day_result_msg; @class open_day_result_msgBuilder; @class push_notify_msg; @class push_notify_msgBuilder; @class report_msg; @class report_msgBuilder; @class rpc_msg_root; @class rpc_msg_rootBuilder; @class s_biddeal_array_result_msg; @class s_biddeal_array_result_msgBuilder; @class s_biddeal_msg; @class s_biddeal_msgBuilder; @class s_biddeal_result_msg; @class s_biddeal_result_msgBuilder; @class s_block_relation_colunm_msg; @class s_block_relation_colunm_msgBuilder; @class s_block_relation_request; @class s_block_relation_requestBuilder; @class s_block_relation_result; @class s_block_relation_resultBuilder; @class s_board_report_colum_data_msg; @class s_board_report_colum_data_msgBuilder; @class s_board_report_data_msg; @class s_board_report_data_msgBuilder; @class s_board_report_optional_msg; @class s_board_report_optional_msgBuilder; @class s_borad_report_block_msg; @class s_borad_report_block_msgBuilder; @class s_borad_report_line_data; @class s_borad_report_line_dataBuilder; @class s_borad_report_optional_result_msg; @class s_borad_report_optional_result_msgBuilder; @class s_borad_report_result_msg; @class s_borad_report_result_msgBuilder; @class s_borad_report_top_msg; @class s_borad_report_top_msgBuilder; @class s_borad_report_top_result_msg; @class s_borad_report_top_result_msgBuilder; @class s_code_name_line; @class s_code_name_lineBuilder; @class s_code_name_relation_result; @class s_code_name_relation_resultBuilder; @class s_index_keep_line_msg; @class s_index_keep_line_msgBuilder; @class s_index_keep_result_msg; @class s_index_keep_result_msgBuilder; @class s_keep_array_result_msg; @class s_keep_array_result_msgBuilder; @class s_keep_msg; @class s_keep_msgBuilder; @class s_keep_result_msg; @class s_keep_result_msgBuilder; @class s_kline_array_result_msg; @class s_kline_array_result_msgBuilder; @class s_kline_msg; @class s_kline_msgBuilder; @class s_kline_result_msg; @class s_kline_result_msgBuilder; @class s_minute_array_result_msg; @class s_minute_array_result_msgBuilder; @class s_minute_msg; @class s_minute_msgBuilder; @class s_minute_result_msg; @class s_minute_result_msgBuilder; @class s_report_array_result_msg; @class s_report_array_result_msgBuilder; @class s_report_result_msg; @class s_report_result_msgBuilder; @class search_stock_array_result_msg; @class search_stock_array_result_msgBuilder; @class search_stock_msg; @class search_stock_msgBuilder; @class search_stock_result_msg; @class search_stock_result_msgBuilder; @class server_login_msg; @class server_login_msgBuilder; @class server_login_result_msg; @class server_login_result_msgBuilder; @class subcribe_msg; @class subcribe_msgBuilder; @class sync_notify_msg; @class sync_notify_msgBuilder; @class time_offset_selector; @class time_offset_selectorBuilder; @class time_range_selector; @class time_range_selectorBuilder; typedef NS_ENUM(SInt32, report_data_cycle) { report_data_cycleReportDataCycleBegin = -1, report_data_cycleReportDataCycle1Min = 0, report_data_cycleReportDataCycle3Min = 1, report_data_cycleReportDataCycle5Min = 2, report_data_cycleReportDataCycle10Min = 3, report_data_cycleReportDataCycle15Min = 4, report_data_cycleReportDataCycle20Min = 5, report_data_cycleReportDataCycle30Min = 6, report_data_cycleReportDataCycle60Min = 7, report_data_cycleReportDataCycleDay = 8, report_data_cycleReportDataCycleWeek = 9, report_data_cycleReportDataCycleMonth = 10, report_data_cycleReportDataCycleQuarter = 11, report_data_cycleReportDataCycleYear = 12, report_data_cycleReportDataCycleEnd = 10000, }; BOOL report_data_cycleIsValidValue(report_data_cycle value); NSString *NSStringFromreport_data_cycle(report_data_cycle value); typedef NS_ENUM(SInt32, colum_type) { colum_typeColIndex = 0, colum_typeColStockCode = 1, colum_typeColStockName = 2, colum_typeColSuspended = 3, colum_typeColRiseScope = 4, colum_typeColLastClosePrice = 5, colum_typeColOpenPrice = 6, colum_typeColHighPrice = 7, colum_typeColLowPrice = 8, colum_typeColNewPrice = 9, colum_typeColVolume = 10, colum_typeColNowVol = 11, colum_typeColAmount = 12, colum_typeColAvePrice = 13, colum_typeColRise = 14, colum_typeColAmplitude = 15, colum_typeColCommitScale = 16, colum_typeColCommitDif = 17, colum_typeColVolumeScale = 18, colum_typeColCommitBuyVol = 19, colum_typeColCimmitSellVol = 20, colum_typeColCommitBuy = 21, colum_typeColCimmitSell = 22, colum_typeColRiseVol = 23, colum_typeColDropVol = 24, colum_typeColRiseSpeed = 25, colum_typeColCommitBuyVol1 = 26, colum_typeColCommitBuyVol2 = 27, colum_typeColCommitBuyVol3 = 28, colum_typeColCommitBuyPrice1 = 29, colum_typeColCommitBuyPrice2 = 30, colum_typeColCommitBuyPrice3 = 31, colum_typeColCommitSellVol1 = 32, colum_typeColCommitSellVol2 = 33, colum_typeColCommitSellVol3 = 34, colum_typeColCommitSellPrice1 = 35, colum_typeColCommitSellPrice2 = 36, colum_typeColCommitSellPrice3 = 37, colum_typeColTurnover = 38, colum_typeColDay5AveVol = 39, colum_typeColPe = 40, colum_typeColDay3RiseScope = 41, colum_typeColDay5RiseScope = 42, colum_typeColDay20RiseScope = 43, colum_typeColCommitBuyVol4 = 44, colum_typeColCommitBuyPrice4 = 45, colum_typeColCommitSellVol4 = 46, colum_typeColCommitSellPrice4 = 47, colum_typeColZgb = 48, colum_typeColGjg = 49, colum_typeColFqfrg = 50, colum_typeColFrg = 51, colum_typeColBg = 52, colum_typeColHg = 53, colum_typeColLtag = 54, colum_typeColZgg = 55, colum_typeColA2Zpg = 56, colum_typeColZzc = 57, colum_typeColLdzc = 58, colum_typeColGdzc = 59, colum_typeColWxzc = 60, colum_typeColCqtz = 61, colum_typeColLdfz = 62, colum_typeColCqfz = 63, colum_typeColZbgjj = 64, colum_typeColMggjj = 65, colum_typeColGdqy = 66, colum_typeColZysr = 67, colum_typeColZylr = 68, colum_typeColQtlr = 69, colum_typeColYylr = 70, colum_typeColTzsy = 71, colum_typeColBtsy = 72, colum_typeColYywsz = 73, colum_typeColSnsytz = 74, colum_typeColLrze = 75, colum_typeColShlr = 76, colum_typeColJlr = 77, colum_typeColWfplr = 78, colum_typeColMgwfp = 79, colum_typeColMgsy = 80, colum_typeColMgjzc = 81, colum_typeColTzmgjzc = 82, colum_typeColGdqyb = 83, colum_typeColJzsyl = 84, colum_typeColMin5RiseScope = 85, colum_typeColDay5Turnover = 86, colum_typeColDay20Turnover = 87, colum_typeColContribution = 88, colum_typeColLargeMidDealDif = 89, colum_typeColLargeDealScale = 93, colum_typeColMidDealScale = 94, colum_typeColSmallDealScale = 95, colum_typeColRelative = 96, colum_typeColLargeDealDif = 97, colum_typeColMidDealDif = 98, colum_typeColSmallDealDif = 99, colum_typeColLargeDealAdd = 100, colum_typeColHs300Contri = 106, colum_typeColHs300Min5Contri = 107, colum_typeColLargeMidScale = 108, colum_typeColAllDealDif = 110, colum_typeColD5LargeMidDif = 111, colum_typeColD10LargeMidDif = 112, colum_typeColD20LargeMidDif = 113, colum_typeColAllPtjz = 114, colum_typeColBlockPtjz = 115, colum_typeColAllCzx = 116, colum_typeColBlockCzx = 117, colum_typeColJbmpj = 118, colum_typeColRiseDropScale = 119, colum_typeColRiseMostInBlock = 120, colum_typeColBljc = 121, colum_typeColStockBlock = 122, colum_typeColFxj = 123, colum_typeColD3LargeMidDif = 124, colum_typeColDay3Turnover = 125, colum_typeColMonth3Turnover = 126, colum_typeColMonth6Turnover = 127, colum_typeColContinueRiseDay = 128, colum_typeColHigestPrice = 129, colum_typeColLowestPrice = 130, colum_typeColMonth3Rise = 131, colum_typeColMonth6Rise = 132, colum_typeColYear1Rise = 133, colum_typeColBljjDn = 134, colum_typeColJgkp = 135, colum_typeColYlw = 136, colum_typeColZcw = 137, colum_typeColDqqs = 138, colum_typeColLjphd = 139, colum_typeColJgpj = 140, colum_typeColBpoint = 141, colum_typeColSpoint = 142, colum_typeCol20HigestPrice = 143, colum_typeCol20LowestPrice = 144, colum_typeColRiseInBlock = 145, colum_typeColDropInBlock = 146, colum_typeColKeepInBlock = 147, colum_typeColBlsc = 148, colum_typeColXsmll = 149, colum_typeColXsjll = 150, colum_typeColMgxjll = 151, colum_typeColZysrzzl = 152, colum_typeColJlrzzl = 153, colum_typeColIfsts = 154, colum_typeColIfcc = 155, colum_typeColIfrzc = 156, colum_typeColIfzjsj = 157, colum_typeCol10DayRise = 158, colum_typeColDqqsdn = 159, colum_typeColDqqsbh = 160, colum_typeColZqqsdn = 161, colum_typeColZqqsbh = 162, colum_typeColFullName = 163, colum_typeColContractCode = 164, colum_typeColUnderlyingCode = 165, colum_typeColUnderlyingName = 166, colum_typeColExcercizePrice = 167, colum_typeColExcercizeDate = 168, colum_typeColOptionVol = 169, colum_typeColExcercizePriceSort = 170, colum_typeColPb = 171, colum_typeColEnd = 172, }; BOOL colum_typeIsValidValue(colum_type value); NSString *NSStringFromcolum_type(colum_type value); @interface ReportRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define report_msg_code @"code" @interface report_msg : PBGeneratedMessage { @private NSMutableArray * codeArray; } @property (readonly, strong) NSArray * code; - (NSString*)codeAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (report_msgBuilder*) builder; + (report_msgBuilder*) builder; + (report_msgBuilder*) builderWithPrototype:(report_msg*) prototype; - (report_msgBuilder*) toBuilder; + (report_msg*) parseFromData:(NSData*) data; + (report_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (report_msg*) parseFromInputStream:(NSInputStream*) input; + (report_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (report_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (report_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface report_msgBuilder : PBGeneratedMessageBuilder { @private report_msg* resultReportMsg; } - (report_msg*) defaultInstance; - (report_msgBuilder*) clear; - (report_msgBuilder*) clone; - (report_msg*) build; - (report_msg*) buildPartial; - (report_msgBuilder*) mergeFrom:(report_msg*) other; - (report_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (report_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)code; - (NSString*)codeAtIndex:(NSUInteger)index; - (report_msgBuilder *)addCode:(NSString*)value; - (report_msgBuilder *)setCodeArray:(NSArray *)array; - (report_msgBuilder *)clearCode; @end #define s_report_result_msg_code @"code" #define s_report_result_msg_name @"name" #define s_report_result_msg_time @"time" #define s_report_result_msg_last_close @"lastClose" #define s_report_result_msg_new @"pb_new" #define s_report_result_msg_open @"open" #define s_report_result_msg_high @"high" #define s_report_result_msg_low @"low" #define s_report_result_msg_vol @"vol" #define s_report_result_msg_amount @"amount" #define s_report_result_msg_five_day_avevol @"fiveDayAvevol" #define s_report_result_msg_sel_price @"selPrice" #define s_report_result_msg_sel_vol @"selVol" #define s_report_result_msg_buy_price @"buyPrice" #define s_report_result_msg_buy_vol @"buyVol" #define s_report_result_msg_pe @"pe" #define s_report_result_msg_hhjcap @"hhjcap" #define s_report_result_msg_rise_vol @"riseVol" #define s_report_result_msg_drop_vol @"dropVol" #define s_report_result_msg_hsl @"hsl" #define s_report_result_msg_zgb @"zgb" #define s_report_result_msg_mgjzc @"mgjzc" #define s_report_result_msg_mgsy @"mgsy" @interface s_report_result_msg : PBGeneratedMessage { @private BOOL hasLastClose_:1; BOOL hasPbNew_:1; BOOL hasOpen_:1; BOOL hasHigh_:1; BOOL hasLow_:1; BOOL hasVol_:1; BOOL hasAmount_:1; BOOL hasFiveDayAvevol_:1; BOOL hasPe_:1; BOOL hasHhjcap_:1; BOOL hasRiseVol_:1; BOOL hasDropVol_:1; BOOL hasHsl_:1; BOOL hasZgb_:1; BOOL hasMgjzc_:1; BOOL hasMgsy_:1; BOOL hasCode_:1; BOOL hasName_:1; BOOL hasTime_:1; Float64 lastClose; Float64 pb_new; Float64 open; Float64 high; Float64 low; Float64 vol; Float64 amount; Float64 fiveDayAvevol; Float64 pe; Float64 hhjcap; Float64 riseVol; Float64 dropVol; Float64 hsl; Float64 zgb; Float64 mgjzc; Float64 mgsy; NSString* code; NSString* name; UInt32 time; PBAppendableArray * selPriceArray; PBAppendableArray * selVolArray; PBAppendableArray * buyPriceArray; PBAppendableArray * buyVolArray; } - (BOOL) hasCode; - (BOOL) hasName; - (BOOL) hasTime; - (BOOL) hasLastClose; - (BOOL) hasPbNew; - (BOOL) hasOpen; - (BOOL) hasHigh; - (BOOL) hasLow; - (BOOL) hasVol; - (BOOL) hasAmount; - (BOOL) hasFiveDayAvevol; - (BOOL) hasPe; - (BOOL) hasHhjcap; - (BOOL) hasRiseVol; - (BOOL) hasDropVol; - (BOOL) hasHsl; - (BOOL) hasZgb; - (BOOL) hasMgjzc; - (BOOL) hasMgsy; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly) UInt32 time; @property (readonly) Float64 lastClose; @property (readonly) Float64 pb_new; @property (readonly) Float64 open; @property (readonly) Float64 high; @property (readonly) Float64 low; @property (readonly) Float64 vol; @property (readonly) Float64 amount; @property (readonly) Float64 fiveDayAvevol; @property (readonly, strong) PBArray * selPrice; @property (readonly, strong) PBArray * selVol; @property (readonly, strong) PBArray * buyPrice; @property (readonly, strong) PBArray * buyVol; @property (readonly) Float64 pe; @property (readonly) Float64 hhjcap; @property (readonly) Float64 riseVol; @property (readonly) Float64 dropVol; @property (readonly) Float64 hsl; @property (readonly) Float64 zgb; @property (readonly) Float64 mgjzc; @property (readonly) Float64 mgsy; - (Float64)selPriceAtIndex:(NSUInteger)index; - (Float64)selVolAtIndex:(NSUInteger)index; - (Float64)buyPriceAtIndex:(NSUInteger)index; - (Float64)buyVolAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_report_result_msgBuilder*) builder; + (s_report_result_msgBuilder*) builder; + (s_report_result_msgBuilder*) builderWithPrototype:(s_report_result_msg*) prototype; - (s_report_result_msgBuilder*) toBuilder; + (s_report_result_msg*) parseFromData:(NSData*) data; + (s_report_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_report_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_report_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_report_result_msgBuilder : PBGeneratedMessageBuilder { @private s_report_result_msg* resultSReportResultMsg; } - (s_report_result_msg*) defaultInstance; - (s_report_result_msgBuilder*) clear; - (s_report_result_msgBuilder*) clone; - (s_report_result_msg*) build; - (s_report_result_msg*) buildPartial; - (s_report_result_msgBuilder*) mergeFrom:(s_report_result_msg*) other; - (s_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_report_result_msgBuilder*) setCode:(NSString*) value; - (s_report_result_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_report_result_msgBuilder*) setName:(NSString*) value; - (s_report_result_msgBuilder*) clearName; - (BOOL) hasTime; - (UInt32) time; - (s_report_result_msgBuilder*) setTime:(UInt32) value; - (s_report_result_msgBuilder*) clearTime; - (BOOL) hasLastClose; - (Float64) lastClose; - (s_report_result_msgBuilder*) setLastClose:(Float64) value; - (s_report_result_msgBuilder*) clearLastClose; - (BOOL) hasPbNew; - (Float64) pb_new; - (s_report_result_msgBuilder*) setPbNew:(Float64) value; - (s_report_result_msgBuilder*) clearPbNew; - (BOOL) hasOpen; - (Float64) open; - (s_report_result_msgBuilder*) setOpen:(Float64) value; - (s_report_result_msgBuilder*) clearOpen; - (BOOL) hasHigh; - (Float64) high; - (s_report_result_msgBuilder*) setHigh:(Float64) value; - (s_report_result_msgBuilder*) clearHigh; - (BOOL) hasLow; - (Float64) low; - (s_report_result_msgBuilder*) setLow:(Float64) value; - (s_report_result_msgBuilder*) clearLow; - (BOOL) hasVol; - (Float64) vol; - (s_report_result_msgBuilder*) setVol:(Float64) value; - (s_report_result_msgBuilder*) clearVol; - (BOOL) hasAmount; - (Float64) amount; - (s_report_result_msgBuilder*) setAmount:(Float64) value; - (s_report_result_msgBuilder*) clearAmount; - (BOOL) hasFiveDayAvevol; - (Float64) fiveDayAvevol; - (s_report_result_msgBuilder*) setFiveDayAvevol:(Float64) value; - (s_report_result_msgBuilder*) clearFiveDayAvevol; - (PBAppendableArray *)selPrice; - (Float64)selPriceAtIndex:(NSUInteger)index; - (s_report_result_msgBuilder *)addSelPrice:(Float64)value; - (s_report_result_msgBuilder *)setSelPriceArray:(NSArray *)array; - (s_report_result_msgBuilder *)setSelPriceValues:(const Float64 *)values count:(NSUInteger)count; - (s_report_result_msgBuilder *)clearSelPrice; - (PBAppendableArray *)selVol; - (Float64)selVolAtIndex:(NSUInteger)index; - (s_report_result_msgBuilder *)addSelVol:(Float64)value; - (s_report_result_msgBuilder *)setSelVolArray:(NSArray *)array; - (s_report_result_msgBuilder *)setSelVolValues:(const Float64 *)values count:(NSUInteger)count; - (s_report_result_msgBuilder *)clearSelVol; - (PBAppendableArray *)buyPrice; - (Float64)buyPriceAtIndex:(NSUInteger)index; - (s_report_result_msgBuilder *)addBuyPrice:(Float64)value; - (s_report_result_msgBuilder *)setBuyPriceArray:(NSArray *)array; - (s_report_result_msgBuilder *)setBuyPriceValues:(const Float64 *)values count:(NSUInteger)count; - (s_report_result_msgBuilder *)clearBuyPrice; - (PBAppendableArray *)buyVol; - (Float64)buyVolAtIndex:(NSUInteger)index; - (s_report_result_msgBuilder *)addBuyVol:(Float64)value; - (s_report_result_msgBuilder *)setBuyVolArray:(NSArray *)array; - (s_report_result_msgBuilder *)setBuyVolValues:(const Float64 *)values count:(NSUInteger)count; - (s_report_result_msgBuilder *)clearBuyVol; - (BOOL) hasPe; - (Float64) pe; - (s_report_result_msgBuilder*) setPe:(Float64) value; - (s_report_result_msgBuilder*) clearPe; - (BOOL) hasHhjcap; - (Float64) hhjcap; - (s_report_result_msgBuilder*) setHhjcap:(Float64) value; - (s_report_result_msgBuilder*) clearHhjcap; - (BOOL) hasRiseVol; - (Float64) riseVol; - (s_report_result_msgBuilder*) setRiseVol:(Float64) value; - (s_report_result_msgBuilder*) clearRiseVol; - (BOOL) hasDropVol; - (Float64) dropVol; - (s_report_result_msgBuilder*) setDropVol:(Float64) value; - (s_report_result_msgBuilder*) clearDropVol; - (BOOL) hasHsl; - (Float64) hsl; - (s_report_result_msgBuilder*) setHsl:(Float64) value; - (s_report_result_msgBuilder*) clearHsl; - (BOOL) hasZgb; - (Float64) zgb; - (s_report_result_msgBuilder*) setZgb:(Float64) value; - (s_report_result_msgBuilder*) clearZgb; - (BOOL) hasMgjzc; - (Float64) mgjzc; - (s_report_result_msgBuilder*) setMgjzc:(Float64) value; - (s_report_result_msgBuilder*) clearMgjzc; - (BOOL) hasMgsy; - (Float64) mgsy; - (s_report_result_msgBuilder*) setMgsy:(Float64) value; - (s_report_result_msgBuilder*) clearMgsy; @end #define s_report_array_result_msg_report_data @"reportData" @interface s_report_array_result_msg : PBGeneratedMessage { @private NSMutableArray * reportDataArray; } @property (readonly, strong) NSArray * reportData; - (s_report_result_msg*)reportDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_report_array_result_msgBuilder*) builder; + (s_report_array_result_msgBuilder*) builder; + (s_report_array_result_msgBuilder*) builderWithPrototype:(s_report_array_result_msg*) prototype; - (s_report_array_result_msgBuilder*) toBuilder; + (s_report_array_result_msg*) parseFromData:(NSData*) data; + (s_report_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_report_array_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_report_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_report_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_report_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_report_array_result_msgBuilder : PBGeneratedMessageBuilder { @private s_report_array_result_msg* resultSReportArrayResultMsg; } - (s_report_array_result_msg*) defaultInstance; - (s_report_array_result_msgBuilder*) clear; - (s_report_array_result_msgBuilder*) clone; - (s_report_array_result_msg*) build; - (s_report_array_result_msg*) buildPartial; - (s_report_array_result_msgBuilder*) mergeFrom:(s_report_array_result_msg*) other; - (s_report_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_report_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)reportData; - (s_report_result_msg*)reportDataAtIndex:(NSUInteger)index; - (s_report_array_result_msgBuilder *)addReportData:(s_report_result_msg*)value; - (s_report_array_result_msgBuilder *)setReportDataArray:(NSArray *)array; - (s_report_array_result_msgBuilder *)clearReportData; @end #define s_biddeal_msg_code @"code" #define s_biddeal_msg_selector @"selector" @interface s_biddeal_msg : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasSelector_:1; NSString* code; data_selector* selector; } - (BOOL) hasCode; - (BOOL) hasSelector; @property (readonly, strong) NSString* code; @property (readonly, strong) data_selector* selector; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_biddeal_msgBuilder*) builder; + (s_biddeal_msgBuilder*) builder; + (s_biddeal_msgBuilder*) builderWithPrototype:(s_biddeal_msg*) prototype; - (s_biddeal_msgBuilder*) toBuilder; + (s_biddeal_msg*) parseFromData:(NSData*) data; + (s_biddeal_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_biddeal_msg*) parseFromInputStream:(NSInputStream*) input; + (s_biddeal_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_biddeal_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_biddeal_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_biddeal_msgBuilder : PBGeneratedMessageBuilder { @private s_biddeal_msg* resultSBiddealMsg; } - (s_biddeal_msg*) defaultInstance; - (s_biddeal_msgBuilder*) clear; - (s_biddeal_msgBuilder*) clone; - (s_biddeal_msg*) build; - (s_biddeal_msg*) buildPartial; - (s_biddeal_msgBuilder*) mergeFrom:(s_biddeal_msg*) other; - (s_biddeal_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_biddeal_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_biddeal_msgBuilder*) setCode:(NSString*) value; - (s_biddeal_msgBuilder*) clearCode; - (BOOL) hasSelector; - (data_selector*) selector; - (s_biddeal_msgBuilder*) setSelector:(data_selector*) value; - (s_biddeal_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue; - (s_biddeal_msgBuilder*) mergeSelector:(data_selector*) value; - (s_biddeal_msgBuilder*) clearSelector; @end #define s_biddeal_result_msg_time @"time" #define s_biddeal_result_msg_price @"price" #define s_biddeal_result_msg_vol @"vol" #define s_biddeal_result_msg_amount @"amount" #define s_biddeal_result_msg_extend @"extend" @interface s_biddeal_result_msg : PBGeneratedMessage { @private BOOL hasPrice_:1; BOOL hasVol_:1; BOOL hasAmount_:1; BOOL hasExtend_:1; BOOL hasTime_:1; Float64 price; Float64 vol; Float64 amount; Float64 extend; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasPrice; - (BOOL) hasVol; - (BOOL) hasAmount; - (BOOL) hasExtend; @property (readonly) UInt32 time; @property (readonly) Float64 price; @property (readonly) Float64 vol; @property (readonly) Float64 amount; @property (readonly) Float64 extend; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_biddeal_result_msgBuilder*) builder; + (s_biddeal_result_msgBuilder*) builder; + (s_biddeal_result_msgBuilder*) builderWithPrototype:(s_biddeal_result_msg*) prototype; - (s_biddeal_result_msgBuilder*) toBuilder; + (s_biddeal_result_msg*) parseFromData:(NSData*) data; + (s_biddeal_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_biddeal_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_biddeal_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_biddeal_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_biddeal_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_biddeal_result_msgBuilder : PBGeneratedMessageBuilder { @private s_biddeal_result_msg* resultSBiddealResultMsg; } - (s_biddeal_result_msg*) defaultInstance; - (s_biddeal_result_msgBuilder*) clear; - (s_biddeal_result_msgBuilder*) clone; - (s_biddeal_result_msg*) build; - (s_biddeal_result_msg*) buildPartial; - (s_biddeal_result_msgBuilder*) mergeFrom:(s_biddeal_result_msg*) other; - (s_biddeal_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_biddeal_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (s_biddeal_result_msgBuilder*) setTime:(UInt32) value; - (s_biddeal_result_msgBuilder*) clearTime; - (BOOL) hasPrice; - (Float64) price; - (s_biddeal_result_msgBuilder*) setPrice:(Float64) value; - (s_biddeal_result_msgBuilder*) clearPrice; - (BOOL) hasVol; - (Float64) vol; - (s_biddeal_result_msgBuilder*) setVol:(Float64) value; - (s_biddeal_result_msgBuilder*) clearVol; - (BOOL) hasAmount; - (Float64) amount; - (s_biddeal_result_msgBuilder*) setAmount:(Float64) value; - (s_biddeal_result_msgBuilder*) clearAmount; - (BOOL) hasExtend; - (Float64) extend; - (s_biddeal_result_msgBuilder*) setExtend:(Float64) value; - (s_biddeal_result_msgBuilder*) clearExtend; @end #define s_biddeal_array_result_msg_biddeal_data @"biddealData" @interface s_biddeal_array_result_msg : PBGeneratedMessage { @private NSMutableArray * biddealDataArray; } @property (readonly, strong) NSArray * biddealData; - (s_biddeal_result_msg*)biddealDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_biddeal_array_result_msgBuilder*) builder; + (s_biddeal_array_result_msgBuilder*) builder; + (s_biddeal_array_result_msgBuilder*) builderWithPrototype:(s_biddeal_array_result_msg*) prototype; - (s_biddeal_array_result_msgBuilder*) toBuilder; + (s_biddeal_array_result_msg*) parseFromData:(NSData*) data; + (s_biddeal_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_biddeal_array_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_biddeal_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_biddeal_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_biddeal_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_biddeal_array_result_msgBuilder : PBGeneratedMessageBuilder { @private s_biddeal_array_result_msg* resultSBiddealArrayResultMsg; } - (s_biddeal_array_result_msg*) defaultInstance; - (s_biddeal_array_result_msgBuilder*) clear; - (s_biddeal_array_result_msgBuilder*) clone; - (s_biddeal_array_result_msg*) build; - (s_biddeal_array_result_msg*) buildPartial; - (s_biddeal_array_result_msgBuilder*) mergeFrom:(s_biddeal_array_result_msg*) other; - (s_biddeal_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_biddeal_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)biddealData; - (s_biddeal_result_msg*)biddealDataAtIndex:(NSUInteger)index; - (s_biddeal_array_result_msgBuilder *)addBiddealData:(s_biddeal_result_msg*)value; - (s_biddeal_array_result_msgBuilder *)setBiddealDataArray:(NSArray *)array; - (s_biddeal_array_result_msgBuilder *)clearBiddealData; @end #define s_kline_msg_code @"code" #define s_kline_msg_cycle @"cycle" #define s_kline_msg_selector @"selector" @interface s_kline_msg : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasSelector_:1; BOOL hasCycle_:1; NSString* code; data_selector* selector; report_data_cycle cycle; } - (BOOL) hasCode; - (BOOL) hasCycle; - (BOOL) hasSelector; @property (readonly, strong) NSString* code; @property (readonly) report_data_cycle cycle; @property (readonly, strong) data_selector* selector; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_kline_msgBuilder*) builder; + (s_kline_msgBuilder*) builder; + (s_kline_msgBuilder*) builderWithPrototype:(s_kline_msg*) prototype; - (s_kline_msgBuilder*) toBuilder; + (s_kline_msg*) parseFromData:(NSData*) data; + (s_kline_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_kline_msg*) parseFromInputStream:(NSInputStream*) input; + (s_kline_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_kline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_kline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_kline_msgBuilder : PBGeneratedMessageBuilder { @private s_kline_msg* resultSKlineMsg; } - (s_kline_msg*) defaultInstance; - (s_kline_msgBuilder*) clear; - (s_kline_msgBuilder*) clone; - (s_kline_msg*) build; - (s_kline_msg*) buildPartial; - (s_kline_msgBuilder*) mergeFrom:(s_kline_msg*) other; - (s_kline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_kline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_kline_msgBuilder*) setCode:(NSString*) value; - (s_kline_msgBuilder*) clearCode; - (BOOL) hasCycle; - (report_data_cycle) cycle; - (s_kline_msgBuilder*) setCycle:(report_data_cycle) value; - (s_kline_msgBuilder*) clearCycle; - (BOOL) hasSelector; - (data_selector*) selector; - (s_kline_msgBuilder*) setSelector:(data_selector*) value; - (s_kline_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue; - (s_kline_msgBuilder*) mergeSelector:(data_selector*) value; - (s_kline_msgBuilder*) clearSelector; @end #define s_kline_result_msg_time @"time" #define s_kline_result_msg_open @"open" #define s_kline_result_msg_high @"high" #define s_kline_result_msg_close @"close" #define s_kline_result_msg_low @"low" #define s_kline_result_msg_vol @"vol" #define s_kline_result_msg_amount @"amount" #define s_kline_result_msg_hsl @"hsl" #define s_kline_result_msg_zdf @"zdf" @interface s_kline_result_msg : PBGeneratedMessage { @private BOOL hasOpen_:1; BOOL hasHigh_:1; BOOL hasClose_:1; BOOL hasLow_:1; BOOL hasVol_:1; BOOL hasAmount_:1; BOOL hasHsl_:1; BOOL hasZdf_:1; BOOL hasTime_:1; Float64 open; Float64 high; Float64 close; Float64 low; Float64 vol; Float64 amount; Float64 hsl; Float64 zdf; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasOpen; - (BOOL) hasHigh; - (BOOL) hasClose; - (BOOL) hasLow; - (BOOL) hasVol; - (BOOL) hasAmount; - (BOOL) hasHsl; - (BOOL) hasZdf; @property (readonly) UInt32 time; @property (readonly) Float64 open; @property (readonly) Float64 high; @property (readonly) Float64 close; @property (readonly) Float64 low; @property (readonly) Float64 vol; @property (readonly) Float64 amount; @property (readonly) Float64 hsl; @property (readonly) Float64 zdf; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_kline_result_msgBuilder*) builder; + (s_kline_result_msgBuilder*) builder; + (s_kline_result_msgBuilder*) builderWithPrototype:(s_kline_result_msg*) prototype; - (s_kline_result_msgBuilder*) toBuilder; + (s_kline_result_msg*) parseFromData:(NSData*) data; + (s_kline_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_kline_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_kline_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_kline_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_kline_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_kline_result_msgBuilder : PBGeneratedMessageBuilder { @private s_kline_result_msg* resultSKlineResultMsg; } - (s_kline_result_msg*) defaultInstance; - (s_kline_result_msgBuilder*) clear; - (s_kline_result_msgBuilder*) clone; - (s_kline_result_msg*) build; - (s_kline_result_msg*) buildPartial; - (s_kline_result_msgBuilder*) mergeFrom:(s_kline_result_msg*) other; - (s_kline_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_kline_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (s_kline_result_msgBuilder*) setTime:(UInt32) value; - (s_kline_result_msgBuilder*) clearTime; - (BOOL) hasOpen; - (Float64) open; - (s_kline_result_msgBuilder*) setOpen:(Float64) value; - (s_kline_result_msgBuilder*) clearOpen; - (BOOL) hasHigh; - (Float64) high; - (s_kline_result_msgBuilder*) setHigh:(Float64) value; - (s_kline_result_msgBuilder*) clearHigh; - (BOOL) hasClose; - (Float64) close; - (s_kline_result_msgBuilder*) setClose:(Float64) value; - (s_kline_result_msgBuilder*) clearClose; - (BOOL) hasLow; - (Float64) low; - (s_kline_result_msgBuilder*) setLow:(Float64) value; - (s_kline_result_msgBuilder*) clearLow; - (BOOL) hasVol; - (Float64) vol; - (s_kline_result_msgBuilder*) setVol:(Float64) value; - (s_kline_result_msgBuilder*) clearVol; - (BOOL) hasAmount; - (Float64) amount; - (s_kline_result_msgBuilder*) setAmount:(Float64) value; - (s_kline_result_msgBuilder*) clearAmount; - (BOOL) hasHsl; - (Float64) hsl; - (s_kline_result_msgBuilder*) setHsl:(Float64) value; - (s_kline_result_msgBuilder*) clearHsl; - (BOOL) hasZdf; - (Float64) zdf; - (s_kline_result_msgBuilder*) setZdf:(Float64) value; - (s_kline_result_msgBuilder*) clearZdf; @end #define s_kline_array_result_msg_kline_data @"klineData" @interface s_kline_array_result_msg : PBGeneratedMessage { @private NSMutableArray * klineDataArray; } @property (readonly, strong) NSArray * klineData; - (s_kline_result_msg*)klineDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_kline_array_result_msgBuilder*) builder; + (s_kline_array_result_msgBuilder*) builder; + (s_kline_array_result_msgBuilder*) builderWithPrototype:(s_kline_array_result_msg*) prototype; - (s_kline_array_result_msgBuilder*) toBuilder; + (s_kline_array_result_msg*) parseFromData:(NSData*) data; + (s_kline_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_kline_array_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_kline_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_kline_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_kline_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_kline_array_result_msgBuilder : PBGeneratedMessageBuilder { @private s_kline_array_result_msg* resultSKlineArrayResultMsg; } - (s_kline_array_result_msg*) defaultInstance; - (s_kline_array_result_msgBuilder*) clear; - (s_kline_array_result_msgBuilder*) clone; - (s_kline_array_result_msg*) build; - (s_kline_array_result_msg*) buildPartial; - (s_kline_array_result_msgBuilder*) mergeFrom:(s_kline_array_result_msg*) other; - (s_kline_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_kline_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)klineData; - (s_kline_result_msg*)klineDataAtIndex:(NSUInteger)index; - (s_kline_array_result_msgBuilder *)addKlineData:(s_kline_result_msg*)value; - (s_kline_array_result_msgBuilder *)setKlineDataArray:(NSArray *)array; - (s_kline_array_result_msgBuilder *)clearKlineData; @end #define s_keep_msg_code @"code" @interface s_keep_msg : PBGeneratedMessage { @private BOOL hasCode_:1; NSString* code; } - (BOOL) hasCode; @property (readonly, strong) NSString* code; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_keep_msgBuilder*) builder; + (s_keep_msgBuilder*) builder; + (s_keep_msgBuilder*) builderWithPrototype:(s_keep_msg*) prototype; - (s_keep_msgBuilder*) toBuilder; + (s_keep_msg*) parseFromData:(NSData*) data; + (s_keep_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_keep_msg*) parseFromInputStream:(NSInputStream*) input; + (s_keep_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_keep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_keep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_keep_msgBuilder : PBGeneratedMessageBuilder { @private s_keep_msg* resultSKeepMsg; } - (s_keep_msg*) defaultInstance; - (s_keep_msgBuilder*) clear; - (s_keep_msgBuilder*) clone; - (s_keep_msg*) build; - (s_keep_msg*) buildPartial; - (s_keep_msgBuilder*) mergeFrom:(s_keep_msg*) other; - (s_keep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_keep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_keep_msgBuilder*) setCode:(NSString*) value; - (s_keep_msgBuilder*) clearCode; @end #define s_keep_result_msg_code @"code" #define s_keep_result_msg_name @"name" #define s_keep_result_msg_vol @"vol" #define s_keep_result_msg_buy_keep @"buyKeep" #define s_keep_result_msg_sell_keep @"sellKeep" #define s_keep_result_msg_vol_diu @"volDiu" #define s_keep_result_msg_buy_keep_diu @"buyKeepDiu" #define s_keep_result_msg_sell_keep_diu @"sellKeepDiu" @interface s_keep_result_msg : PBGeneratedMessage { @private BOOL hasVol_:1; BOOL hasBuyKeep_:1; BOOL hasSellKeep_:1; BOOL hasVolDiu_:1; BOOL hasBuyKeepDiu_:1; BOOL hasSellKeepDiu_:1; BOOL hasCode_:1; BOOL hasName_:1; Float64 vol; Float64 buyKeep; Float64 sellKeep; Float64 volDiu; Float64 buyKeepDiu; Float64 sellKeepDiu; NSString* code; NSString* name; } - (BOOL) hasCode; - (BOOL) hasName; - (BOOL) hasVol; - (BOOL) hasBuyKeep; - (BOOL) hasSellKeep; - (BOOL) hasVolDiu; - (BOOL) hasBuyKeepDiu; - (BOOL) hasSellKeepDiu; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly) Float64 vol; @property (readonly) Float64 buyKeep; @property (readonly) Float64 sellKeep; @property (readonly) Float64 volDiu; @property (readonly) Float64 buyKeepDiu; @property (readonly) Float64 sellKeepDiu; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_keep_result_msgBuilder*) builder; + (s_keep_result_msgBuilder*) builder; + (s_keep_result_msgBuilder*) builderWithPrototype:(s_keep_result_msg*) prototype; - (s_keep_result_msgBuilder*) toBuilder; + (s_keep_result_msg*) parseFromData:(NSData*) data; + (s_keep_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_keep_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_keep_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_keep_result_msgBuilder : PBGeneratedMessageBuilder { @private s_keep_result_msg* resultSKeepResultMsg; } - (s_keep_result_msg*) defaultInstance; - (s_keep_result_msgBuilder*) clear; - (s_keep_result_msgBuilder*) clone; - (s_keep_result_msg*) build; - (s_keep_result_msg*) buildPartial; - (s_keep_result_msgBuilder*) mergeFrom:(s_keep_result_msg*) other; - (s_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_keep_result_msgBuilder*) setCode:(NSString*) value; - (s_keep_result_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_keep_result_msgBuilder*) setName:(NSString*) value; - (s_keep_result_msgBuilder*) clearName; - (BOOL) hasVol; - (Float64) vol; - (s_keep_result_msgBuilder*) setVol:(Float64) value; - (s_keep_result_msgBuilder*) clearVol; - (BOOL) hasBuyKeep; - (Float64) buyKeep; - (s_keep_result_msgBuilder*) setBuyKeep:(Float64) value; - (s_keep_result_msgBuilder*) clearBuyKeep; - (BOOL) hasSellKeep; - (Float64) sellKeep; - (s_keep_result_msgBuilder*) setSellKeep:(Float64) value; - (s_keep_result_msgBuilder*) clearSellKeep; - (BOOL) hasVolDiu; - (Float64) volDiu; - (s_keep_result_msgBuilder*) setVolDiu:(Float64) value; - (s_keep_result_msgBuilder*) clearVolDiu; - (BOOL) hasBuyKeepDiu; - (Float64) buyKeepDiu; - (s_keep_result_msgBuilder*) setBuyKeepDiu:(Float64) value; - (s_keep_result_msgBuilder*) clearBuyKeepDiu; - (BOOL) hasSellKeepDiu; - (Float64) sellKeepDiu; - (s_keep_result_msgBuilder*) setSellKeepDiu:(Float64) value; - (s_keep_result_msgBuilder*) clearSellKeepDiu; @end #define s_keep_array_result_msg_keep_data @"keepData" @interface s_keep_array_result_msg : PBGeneratedMessage { @private NSMutableArray * keepDataArray; } @property (readonly, strong) NSArray * keepData; - (s_keep_result_msg*)keepDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_keep_array_result_msgBuilder*) builder; + (s_keep_array_result_msgBuilder*) builder; + (s_keep_array_result_msgBuilder*) builderWithPrototype:(s_keep_array_result_msg*) prototype; - (s_keep_array_result_msgBuilder*) toBuilder; + (s_keep_array_result_msg*) parseFromData:(NSData*) data; + (s_keep_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_keep_array_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_keep_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_keep_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_keep_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_keep_array_result_msgBuilder : PBGeneratedMessageBuilder { @private s_keep_array_result_msg* resultSKeepArrayResultMsg; } - (s_keep_array_result_msg*) defaultInstance; - (s_keep_array_result_msgBuilder*) clear; - (s_keep_array_result_msgBuilder*) clone; - (s_keep_array_result_msg*) build; - (s_keep_array_result_msg*) buildPartial; - (s_keep_array_result_msgBuilder*) mergeFrom:(s_keep_array_result_msg*) other; - (s_keep_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_keep_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)keepData; - (s_keep_result_msg*)keepDataAtIndex:(NSUInteger)index; - (s_keep_array_result_msgBuilder *)addKeepData:(s_keep_result_msg*)value; - (s_keep_array_result_msgBuilder *)setKeepDataArray:(NSArray *)array; - (s_keep_array_result_msgBuilder *)clearKeepData; @end #define s_minute_msg_code @"code" #define s_minute_msg_selector @"selector" @interface s_minute_msg : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasSelector_:1; NSString* code; data_selector* selector; } - (BOOL) hasCode; - (BOOL) hasSelector; @property (readonly, strong) NSString* code; @property (readonly, strong) data_selector* selector; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_minute_msgBuilder*) builder; + (s_minute_msgBuilder*) builder; + (s_minute_msgBuilder*) builderWithPrototype:(s_minute_msg*) prototype; - (s_minute_msgBuilder*) toBuilder; + (s_minute_msg*) parseFromData:(NSData*) data; + (s_minute_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_minute_msg*) parseFromInputStream:(NSInputStream*) input; + (s_minute_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_minute_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_minute_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_minute_msgBuilder : PBGeneratedMessageBuilder { @private s_minute_msg* resultSMinuteMsg; } - (s_minute_msg*) defaultInstance; - (s_minute_msgBuilder*) clear; - (s_minute_msgBuilder*) clone; - (s_minute_msg*) build; - (s_minute_msg*) buildPartial; - (s_minute_msgBuilder*) mergeFrom:(s_minute_msg*) other; - (s_minute_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_minute_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_minute_msgBuilder*) setCode:(NSString*) value; - (s_minute_msgBuilder*) clearCode; - (BOOL) hasSelector; - (data_selector*) selector; - (s_minute_msgBuilder*) setSelector:(data_selector*) value; - (s_minute_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue; - (s_minute_msgBuilder*) mergeSelector:(data_selector*) value; - (s_minute_msgBuilder*) clearSelector; @end #define s_minute_result_msg_time @"time" #define s_minute_result_msg_price @"price" #define s_minute_result_msg_vol @"vol" #define s_minute_result_msg_amount @"amount" @interface s_minute_result_msg : PBGeneratedMessage { @private BOOL hasPrice_:1; BOOL hasVol_:1; BOOL hasAmount_:1; BOOL hasTime_:1; Float64 price; Float64 vol; Float64 amount; UInt32 time; } - (BOOL) hasTime; - (BOOL) hasPrice; - (BOOL) hasVol; - (BOOL) hasAmount; @property (readonly) UInt32 time; @property (readonly) Float64 price; @property (readonly) Float64 vol; @property (readonly) Float64 amount; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_minute_result_msgBuilder*) builder; + (s_minute_result_msgBuilder*) builder; + (s_minute_result_msgBuilder*) builderWithPrototype:(s_minute_result_msg*) prototype; - (s_minute_result_msgBuilder*) toBuilder; + (s_minute_result_msg*) parseFromData:(NSData*) data; + (s_minute_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_minute_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_minute_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_minute_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_minute_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_minute_result_msgBuilder : PBGeneratedMessageBuilder { @private s_minute_result_msg* resultSMinuteResultMsg; } - (s_minute_result_msg*) defaultInstance; - (s_minute_result_msgBuilder*) clear; - (s_minute_result_msgBuilder*) clone; - (s_minute_result_msg*) build; - (s_minute_result_msg*) buildPartial; - (s_minute_result_msgBuilder*) mergeFrom:(s_minute_result_msg*) other; - (s_minute_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_minute_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasTime; - (UInt32) time; - (s_minute_result_msgBuilder*) setTime:(UInt32) value; - (s_minute_result_msgBuilder*) clearTime; - (BOOL) hasPrice; - (Float64) price; - (s_minute_result_msgBuilder*) setPrice:(Float64) value; - (s_minute_result_msgBuilder*) clearPrice; - (BOOL) hasVol; - (Float64) vol; - (s_minute_result_msgBuilder*) setVol:(Float64) value; - (s_minute_result_msgBuilder*) clearVol; - (BOOL) hasAmount; - (Float64) amount; - (s_minute_result_msgBuilder*) setAmount:(Float64) value; - (s_minute_result_msgBuilder*) clearAmount; @end #define s_minute_array_result_msg_minute_data @"minuteData" @interface s_minute_array_result_msg : PBGeneratedMessage { @private NSMutableArray * minuteDataArray; } @property (readonly, strong) NSArray * minuteData; - (s_minute_result_msg*)minuteDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_minute_array_result_msgBuilder*) builder; + (s_minute_array_result_msgBuilder*) builder; + (s_minute_array_result_msgBuilder*) builderWithPrototype:(s_minute_array_result_msg*) prototype; - (s_minute_array_result_msgBuilder*) toBuilder; + (s_minute_array_result_msg*) parseFromData:(NSData*) data; + (s_minute_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_minute_array_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_minute_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_minute_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_minute_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_minute_array_result_msgBuilder : PBGeneratedMessageBuilder { @private s_minute_array_result_msg* resultSMinuteArrayResultMsg; } - (s_minute_array_result_msg*) defaultInstance; - (s_minute_array_result_msgBuilder*) clear; - (s_minute_array_result_msgBuilder*) clone; - (s_minute_array_result_msg*) build; - (s_minute_array_result_msg*) buildPartial; - (s_minute_array_result_msgBuilder*) mergeFrom:(s_minute_array_result_msg*) other; - (s_minute_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_minute_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)minuteData; - (s_minute_result_msg*)minuteDataAtIndex:(NSUInteger)index; - (s_minute_array_result_msgBuilder *)addMinuteData:(s_minute_result_msg*)value; - (s_minute_array_result_msgBuilder *)setMinuteDataArray:(NSArray *)array; - (s_minute_array_result_msgBuilder *)clearMinuteData; @end #define search_stock_msg_search_string @"searchString" #define search_stock_msg_total_count @"totalCount" #define search_stock_msg_offset @"offset" #define search_stock_msg_selector @"selector" @interface search_stock_msg : PBGeneratedMessage { @private BOOL hasTotalCount_:1; BOOL hasOffset_:1; BOOL hasSearchString_:1; BOOL hasSelector_:1; SInt32 totalCount; SInt32 offset; NSString* searchString; data_selector* selector; } - (BOOL) hasSearchString; - (BOOL) hasTotalCount; - (BOOL) hasOffset; - (BOOL) hasSelector; @property (readonly, strong) NSString* searchString; @property (readonly) SInt32 totalCount; @property (readonly) SInt32 offset; @property (readonly, strong) data_selector* selector; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (search_stock_msgBuilder*) builder; + (search_stock_msgBuilder*) builder; + (search_stock_msgBuilder*) builderWithPrototype:(search_stock_msg*) prototype; - (search_stock_msgBuilder*) toBuilder; + (search_stock_msg*) parseFromData:(NSData*) data; + (search_stock_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (search_stock_msg*) parseFromInputStream:(NSInputStream*) input; + (search_stock_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (search_stock_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (search_stock_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface search_stock_msgBuilder : PBGeneratedMessageBuilder { @private search_stock_msg* resultSearchStockMsg; } - (search_stock_msg*) defaultInstance; - (search_stock_msgBuilder*) clear; - (search_stock_msgBuilder*) clone; - (search_stock_msg*) build; - (search_stock_msg*) buildPartial; - (search_stock_msgBuilder*) mergeFrom:(search_stock_msg*) other; - (search_stock_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (search_stock_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasSearchString; - (NSString*) searchString; - (search_stock_msgBuilder*) setSearchString:(NSString*) value; - (search_stock_msgBuilder*) clearSearchString; - (BOOL) hasTotalCount; - (SInt32) totalCount; - (search_stock_msgBuilder*) setTotalCount:(SInt32) value; - (search_stock_msgBuilder*) clearTotalCount; - (BOOL) hasOffset; - (SInt32) offset; - (search_stock_msgBuilder*) setOffset:(SInt32) value; - (search_stock_msgBuilder*) clearOffset; - (BOOL) hasSelector; - (data_selector*) selector; - (search_stock_msgBuilder*) setSelector:(data_selector*) value; - (search_stock_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue; - (search_stock_msgBuilder*) mergeSelector:(data_selector*) value; - (search_stock_msgBuilder*) clearSelector; @end #define search_stock_result_msg_code @"code" #define search_stock_result_msg_name @"name" @interface search_stock_result_msg : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasName_:1; NSString* code; NSString* name; } - (BOOL) hasCode; - (BOOL) hasName; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (search_stock_result_msgBuilder*) builder; + (search_stock_result_msgBuilder*) builder; + (search_stock_result_msgBuilder*) builderWithPrototype:(search_stock_result_msg*) prototype; - (search_stock_result_msgBuilder*) toBuilder; + (search_stock_result_msg*) parseFromData:(NSData*) data; + (search_stock_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (search_stock_result_msg*) parseFromInputStream:(NSInputStream*) input; + (search_stock_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (search_stock_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (search_stock_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface search_stock_result_msgBuilder : PBGeneratedMessageBuilder { @private search_stock_result_msg* resultSearchStockResultMsg; } - (search_stock_result_msg*) defaultInstance; - (search_stock_result_msgBuilder*) clear; - (search_stock_result_msgBuilder*) clone; - (search_stock_result_msg*) build; - (search_stock_result_msg*) buildPartial; - (search_stock_result_msgBuilder*) mergeFrom:(search_stock_result_msg*) other; - (search_stock_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (search_stock_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (search_stock_result_msgBuilder*) setCode:(NSString*) value; - (search_stock_result_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (search_stock_result_msgBuilder*) setName:(NSString*) value; - (search_stock_result_msgBuilder*) clearName; @end #define search_stock_array_result_msg_stock_data @"stockData" @interface search_stock_array_result_msg : PBGeneratedMessage { @private NSMutableArray * stockDataArray; } @property (readonly, strong) NSArray * stockData; - (search_stock_result_msg*)stockDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (search_stock_array_result_msgBuilder*) builder; + (search_stock_array_result_msgBuilder*) builder; + (search_stock_array_result_msgBuilder*) builderWithPrototype:(search_stock_array_result_msg*) prototype; - (search_stock_array_result_msgBuilder*) toBuilder; + (search_stock_array_result_msg*) parseFromData:(NSData*) data; + (search_stock_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (search_stock_array_result_msg*) parseFromInputStream:(NSInputStream*) input; + (search_stock_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (search_stock_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (search_stock_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface search_stock_array_result_msgBuilder : PBGeneratedMessageBuilder { @private search_stock_array_result_msg* resultSearchStockArrayResultMsg; } - (search_stock_array_result_msg*) defaultInstance; - (search_stock_array_result_msgBuilder*) clear; - (search_stock_array_result_msgBuilder*) clone; - (search_stock_array_result_msg*) build; - (search_stock_array_result_msg*) buildPartial; - (search_stock_array_result_msgBuilder*) mergeFrom:(search_stock_array_result_msg*) other; - (search_stock_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (search_stock_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)stockData; - (search_stock_result_msg*)stockDataAtIndex:(NSUInteger)index; - (search_stock_array_result_msgBuilder *)addStockData:(search_stock_result_msg*)value; - (search_stock_array_result_msgBuilder *)setStockDataArray:(NSArray *)array; - (search_stock_array_result_msgBuilder *)clearStockData; @end #define s_board_report_data_msg_block_code @"blockCode" #define s_board_report_data_msg_block_offset @"blockOffset" #define s_board_report_data_msg_count @"count" #define s_board_report_data_msg_sort_colum @"sortColum" #define s_board_report_data_msg_is_asc @"isAsc" #define s_board_report_data_msg_colum_array @"columArray" @interface s_board_report_data_msg : PBGeneratedMessage { @private BOOL hasIsAsc_:1; BOOL hasBlockCode_:1; BOOL hasBlockOffset_:1; BOOL hasCount_:1; BOOL hasSortColum_:1; BOOL isAsc_:1; UInt32 blockCode; UInt32 blockOffset; UInt32 count; colum_type sortColum; PBAppendableArray * columArrayArray; } - (BOOL) hasBlockCode; - (BOOL) hasBlockOffset; - (BOOL) hasCount; - (BOOL) hasSortColum; - (BOOL) hasIsAsc; @property (readonly) UInt32 blockCode; @property (readonly) UInt32 blockOffset; @property (readonly) UInt32 count; @property (readonly) colum_type sortColum; - (BOOL) isAsc; @property (readonly, strong) PBArray * columArray; - (colum_type)columArrayAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_board_report_data_msgBuilder*) builder; + (s_board_report_data_msgBuilder*) builder; + (s_board_report_data_msgBuilder*) builderWithPrototype:(s_board_report_data_msg*) prototype; - (s_board_report_data_msgBuilder*) toBuilder; + (s_board_report_data_msg*) parseFromData:(NSData*) data; + (s_board_report_data_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_board_report_data_msg*) parseFromInputStream:(NSInputStream*) input; + (s_board_report_data_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_board_report_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_board_report_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_board_report_data_msgBuilder : PBGeneratedMessageBuilder { @private s_board_report_data_msg* resultSBoardReportDataMsg; } - (s_board_report_data_msg*) defaultInstance; - (s_board_report_data_msgBuilder*) clear; - (s_board_report_data_msgBuilder*) clone; - (s_board_report_data_msg*) build; - (s_board_report_data_msg*) buildPartial; - (s_board_report_data_msgBuilder*) mergeFrom:(s_board_report_data_msg*) other; - (s_board_report_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_board_report_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasBlockCode; - (UInt32) blockCode; - (s_board_report_data_msgBuilder*) setBlockCode:(UInt32) value; - (s_board_report_data_msgBuilder*) clearBlockCode; - (BOOL) hasBlockOffset; - (UInt32) blockOffset; - (s_board_report_data_msgBuilder*) setBlockOffset:(UInt32) value; - (s_board_report_data_msgBuilder*) clearBlockOffset; - (BOOL) hasCount; - (UInt32) count; - (s_board_report_data_msgBuilder*) setCount:(UInt32) value; - (s_board_report_data_msgBuilder*) clearCount; - (BOOL) hasSortColum; - (colum_type) sortColum; - (s_board_report_data_msgBuilder*) setSortColum:(colum_type) value; - (s_board_report_data_msgBuilder*) clearSortColum; - (BOOL) hasIsAsc; - (BOOL) isAsc; - (s_board_report_data_msgBuilder*) setIsAsc:(BOOL) value; - (s_board_report_data_msgBuilder*) clearIsAsc; - (PBAppendableArray *)columArray; - (colum_type)columArrayAtIndex:(NSUInteger)index; - (s_board_report_data_msgBuilder *)addColumArray:(colum_type)value; - (s_board_report_data_msgBuilder *)setColumArrayArray:(NSArray *)array; - (s_board_report_data_msgBuilder *)setColumArrayValues:(const colum_type *)values count:(NSUInteger)count; - (s_board_report_data_msgBuilder *)clearColumArray; @end #define s_board_report_colum_data_msg_key @"key" #define s_board_report_colum_data_msg_value @"value" #define s_board_report_colum_data_msg_strvalue @"strvalue" @interface s_board_report_colum_data_msg : PBGeneratedMessage { @private BOOL hasValue_:1; BOOL hasStrvalue_:1; BOOL hasKey_:1; Float64 value; NSString* strvalue; colum_type key; } - (BOOL) hasKey; - (BOOL) hasValue; - (BOOL) hasStrvalue; @property (readonly) colum_type key; @property (readonly) Float64 value; @property (readonly, strong) NSString* strvalue; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_board_report_colum_data_msgBuilder*) builder; + (s_board_report_colum_data_msgBuilder*) builder; + (s_board_report_colum_data_msgBuilder*) builderWithPrototype:(s_board_report_colum_data_msg*) prototype; - (s_board_report_colum_data_msgBuilder*) toBuilder; + (s_board_report_colum_data_msg*) parseFromData:(NSData*) data; + (s_board_report_colum_data_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_board_report_colum_data_msg*) parseFromInputStream:(NSInputStream*) input; + (s_board_report_colum_data_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_board_report_colum_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_board_report_colum_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_board_report_colum_data_msgBuilder : PBGeneratedMessageBuilder { @private s_board_report_colum_data_msg* resultSBoardReportColumDataMsg; } - (s_board_report_colum_data_msg*) defaultInstance; - (s_board_report_colum_data_msgBuilder*) clear; - (s_board_report_colum_data_msgBuilder*) clone; - (s_board_report_colum_data_msg*) build; - (s_board_report_colum_data_msg*) buildPartial; - (s_board_report_colum_data_msgBuilder*) mergeFrom:(s_board_report_colum_data_msg*) other; - (s_board_report_colum_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_board_report_colum_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasKey; - (colum_type) key; - (s_board_report_colum_data_msgBuilder*) setKey:(colum_type) value; - (s_board_report_colum_data_msgBuilder*) clearKey; - (BOOL) hasValue; - (Float64) value; - (s_board_report_colum_data_msgBuilder*) setValue:(Float64) value; - (s_board_report_colum_data_msgBuilder*) clearValue; - (BOOL) hasStrvalue; - (NSString*) strvalue; - (s_board_report_colum_data_msgBuilder*) setStrvalue:(NSString*) value; - (s_board_report_colum_data_msgBuilder*) clearStrvalue; @end #define s_borad_report_line_data_index @"index" #define s_borad_report_line_data_code @"code" #define s_borad_report_line_data_name @"name" #define s_borad_report_line_data_colum_data @"columData" @interface s_borad_report_line_data : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasName_:1; BOOL hasIndex_:1; NSString* code; NSString* name; UInt32 index; NSMutableArray * columDataArray; } - (BOOL) hasIndex; - (BOOL) hasCode; - (BOOL) hasName; @property (readonly) UInt32 index; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly, strong) NSArray * columData; - (s_board_report_colum_data_msg*)columDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_borad_report_line_dataBuilder*) builder; + (s_borad_report_line_dataBuilder*) builder; + (s_borad_report_line_dataBuilder*) builderWithPrototype:(s_borad_report_line_data*) prototype; - (s_borad_report_line_dataBuilder*) toBuilder; + (s_borad_report_line_data*) parseFromData:(NSData*) data; + (s_borad_report_line_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_line_data*) parseFromInputStream:(NSInputStream*) input; + (s_borad_report_line_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_line_data*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_borad_report_line_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_borad_report_line_dataBuilder : PBGeneratedMessageBuilder { @private s_borad_report_line_data* resultSBoradReportLineData; } - (s_borad_report_line_data*) defaultInstance; - (s_borad_report_line_dataBuilder*) clear; - (s_borad_report_line_dataBuilder*) clone; - (s_borad_report_line_data*) build; - (s_borad_report_line_data*) buildPartial; - (s_borad_report_line_dataBuilder*) mergeFrom:(s_borad_report_line_data*) other; - (s_borad_report_line_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_borad_report_line_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasIndex; - (UInt32) index; - (s_borad_report_line_dataBuilder*) setIndex:(UInt32) value; - (s_borad_report_line_dataBuilder*) clearIndex; - (BOOL) hasCode; - (NSString*) code; - (s_borad_report_line_dataBuilder*) setCode:(NSString*) value; - (s_borad_report_line_dataBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_borad_report_line_dataBuilder*) setName:(NSString*) value; - (s_borad_report_line_dataBuilder*) clearName; - (NSMutableArray *)columData; - (s_board_report_colum_data_msg*)columDataAtIndex:(NSUInteger)index; - (s_borad_report_line_dataBuilder *)addColumData:(s_board_report_colum_data_msg*)value; - (s_borad_report_line_dataBuilder *)setColumDataArray:(NSArray *)array; - (s_borad_report_line_dataBuilder *)clearColumData; @end #define s_borad_report_result_msg_datas @"datas" @interface s_borad_report_result_msg : PBGeneratedMessage { @private NSMutableArray * datasArray; } @property (readonly, strong) NSArray * datas; - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_borad_report_result_msgBuilder*) builder; + (s_borad_report_result_msgBuilder*) builder; + (s_borad_report_result_msgBuilder*) builderWithPrototype:(s_borad_report_result_msg*) prototype; - (s_borad_report_result_msgBuilder*) toBuilder; + (s_borad_report_result_msg*) parseFromData:(NSData*) data; + (s_borad_report_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_borad_report_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_borad_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_borad_report_result_msgBuilder : PBGeneratedMessageBuilder { @private s_borad_report_result_msg* resultSBoradReportResultMsg; } - (s_borad_report_result_msg*) defaultInstance; - (s_borad_report_result_msgBuilder*) clear; - (s_borad_report_result_msgBuilder*) clone; - (s_borad_report_result_msg*) build; - (s_borad_report_result_msg*) buildPartial; - (s_borad_report_result_msgBuilder*) mergeFrom:(s_borad_report_result_msg*) other; - (s_borad_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_borad_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)datas; - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index; - (s_borad_report_result_msgBuilder *)addDatas:(s_borad_report_line_data*)value; - (s_borad_report_result_msgBuilder *)setDatasArray:(NSArray *)array; - (s_borad_report_result_msgBuilder *)clearDatas; @end #define open_day_result_msg_day @"day" #define open_day_result_msg_status @"status" @interface open_day_result_msg : PBGeneratedMessage { @private BOOL hasStatus_:1; BOOL hasDay_:1; BOOL status_:1; UInt32 day; } - (BOOL) hasDay; - (BOOL) hasStatus; @property (readonly) UInt32 day; - (BOOL) status; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (open_day_result_msgBuilder*) builder; + (open_day_result_msgBuilder*) builder; + (open_day_result_msgBuilder*) builderWithPrototype:(open_day_result_msg*) prototype; - (open_day_result_msgBuilder*) toBuilder; + (open_day_result_msg*) parseFromData:(NSData*) data; + (open_day_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (open_day_result_msg*) parseFromInputStream:(NSInputStream*) input; + (open_day_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (open_day_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (open_day_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface open_day_result_msgBuilder : PBGeneratedMessageBuilder { @private open_day_result_msg* resultOpenDayResultMsg; } - (open_day_result_msg*) defaultInstance; - (open_day_result_msgBuilder*) clear; - (open_day_result_msgBuilder*) clone; - (open_day_result_msg*) build; - (open_day_result_msg*) buildPartial; - (open_day_result_msgBuilder*) mergeFrom:(open_day_result_msg*) other; - (open_day_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (open_day_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasDay; - (UInt32) day; - (open_day_result_msgBuilder*) setDay:(UInt32) value; - (open_day_result_msgBuilder*) clearDay; - (BOOL) hasStatus; - (BOOL) status; - (open_day_result_msgBuilder*) setStatus:(BOOL) value; - (open_day_result_msgBuilder*) clearStatus; @end #define s_board_report_optional_msg_codes @"codes" #define s_board_report_optional_msg_sort_colum @"sortColum" #define s_board_report_optional_msg_is_asc @"isAsc" #define s_board_report_optional_msg_colum_array @"columArray" @interface s_board_report_optional_msg : PBGeneratedMessage { @private BOOL hasIsAsc_:1; BOOL hasSortColum_:1; BOOL isAsc_:1; colum_type sortColum; NSMutableArray * codesArray; PBAppendableArray * columArrayArray; } - (BOOL) hasSortColum; - (BOOL) hasIsAsc; @property (readonly, strong) NSArray * codes; @property (readonly) colum_type sortColum; - (BOOL) isAsc; @property (readonly, strong) PBArray * columArray; - (NSString*)codesAtIndex:(NSUInteger)index; - (colum_type)columArrayAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_board_report_optional_msgBuilder*) builder; + (s_board_report_optional_msgBuilder*) builder; + (s_board_report_optional_msgBuilder*) builderWithPrototype:(s_board_report_optional_msg*) prototype; - (s_board_report_optional_msgBuilder*) toBuilder; + (s_board_report_optional_msg*) parseFromData:(NSData*) data; + (s_board_report_optional_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_board_report_optional_msg*) parseFromInputStream:(NSInputStream*) input; + (s_board_report_optional_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_board_report_optional_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_board_report_optional_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_board_report_optional_msgBuilder : PBGeneratedMessageBuilder { @private s_board_report_optional_msg* resultSBoardReportOptionalMsg; } - (s_board_report_optional_msg*) defaultInstance; - (s_board_report_optional_msgBuilder*) clear; - (s_board_report_optional_msgBuilder*) clone; - (s_board_report_optional_msg*) build; - (s_board_report_optional_msg*) buildPartial; - (s_board_report_optional_msgBuilder*) mergeFrom:(s_board_report_optional_msg*) other; - (s_board_report_optional_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_board_report_optional_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)codes; - (NSString*)codesAtIndex:(NSUInteger)index; - (s_board_report_optional_msgBuilder *)addCodes:(NSString*)value; - (s_board_report_optional_msgBuilder *)setCodesArray:(NSArray *)array; - (s_board_report_optional_msgBuilder *)clearCodes; - (BOOL) hasSortColum; - (colum_type) sortColum; - (s_board_report_optional_msgBuilder*) setSortColum:(colum_type) value; - (s_board_report_optional_msgBuilder*) clearSortColum; - (BOOL) hasIsAsc; - (BOOL) isAsc; - (s_board_report_optional_msgBuilder*) setIsAsc:(BOOL) value; - (s_board_report_optional_msgBuilder*) clearIsAsc; - (PBAppendableArray *)columArray; - (colum_type)columArrayAtIndex:(NSUInteger)index; - (s_board_report_optional_msgBuilder *)addColumArray:(colum_type)value; - (s_board_report_optional_msgBuilder *)setColumArrayArray:(NSArray *)array; - (s_board_report_optional_msgBuilder *)setColumArrayValues:(const colum_type *)values count:(NSUInteger)count; - (s_board_report_optional_msgBuilder *)clearColumArray; @end #define s_borad_report_optional_result_msg_datas @"datas" @interface s_borad_report_optional_result_msg : PBGeneratedMessage { @private NSMutableArray * datasArray; } @property (readonly, strong) NSArray * datas; - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_borad_report_optional_result_msgBuilder*) builder; + (s_borad_report_optional_result_msgBuilder*) builder; + (s_borad_report_optional_result_msgBuilder*) builderWithPrototype:(s_borad_report_optional_result_msg*) prototype; - (s_borad_report_optional_result_msgBuilder*) toBuilder; + (s_borad_report_optional_result_msg*) parseFromData:(NSData*) data; + (s_borad_report_optional_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_optional_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_borad_report_optional_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_optional_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_borad_report_optional_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_borad_report_optional_result_msgBuilder : PBGeneratedMessageBuilder { @private s_borad_report_optional_result_msg* resultSBoradReportOptionalResultMsg; } - (s_borad_report_optional_result_msg*) defaultInstance; - (s_borad_report_optional_result_msgBuilder*) clear; - (s_borad_report_optional_result_msgBuilder*) clone; - (s_borad_report_optional_result_msg*) build; - (s_borad_report_optional_result_msg*) buildPartial; - (s_borad_report_optional_result_msgBuilder*) mergeFrom:(s_borad_report_optional_result_msg*) other; - (s_borad_report_optional_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_borad_report_optional_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)datas; - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index; - (s_borad_report_optional_result_msgBuilder *)addDatas:(s_borad_report_line_data*)value; - (s_borad_report_optional_result_msgBuilder *)setDatasArray:(NSArray *)array; - (s_borad_report_optional_result_msgBuilder *)clearDatas; @end #define s_borad_report_top_msg_block_codes @"blockCodes" #define s_borad_report_top_msg_sort_colum @"sortColum" #define s_borad_report_top_msg_is_asc @"isAsc" #define s_borad_report_top_msg_colum_array @"columArray" #define s_borad_report_top_msg_count @"count" @interface s_borad_report_top_msg : PBGeneratedMessage { @private BOOL hasIsAsc_:1; BOOL hasCount_:1; BOOL hasSortColum_:1; BOOL isAsc_:1; UInt32 count; colum_type sortColum; PBAppendableArray * blockCodesArray; PBAppendableArray * columArrayArray; } - (BOOL) hasSortColum; - (BOOL) hasIsAsc; - (BOOL) hasCount; @property (readonly, strong) PBArray * blockCodes; @property (readonly) colum_type sortColum; - (BOOL) isAsc; @property (readonly, strong) PBArray * columArray; @property (readonly) UInt32 count; - (UInt32)blockCodesAtIndex:(NSUInteger)index; - (colum_type)columArrayAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_borad_report_top_msgBuilder*) builder; + (s_borad_report_top_msgBuilder*) builder; + (s_borad_report_top_msgBuilder*) builderWithPrototype:(s_borad_report_top_msg*) prototype; - (s_borad_report_top_msgBuilder*) toBuilder; + (s_borad_report_top_msg*) parseFromData:(NSData*) data; + (s_borad_report_top_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_top_msg*) parseFromInputStream:(NSInputStream*) input; + (s_borad_report_top_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_top_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_borad_report_top_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_borad_report_top_msgBuilder : PBGeneratedMessageBuilder { @private s_borad_report_top_msg* resultSBoradReportTopMsg; } - (s_borad_report_top_msg*) defaultInstance; - (s_borad_report_top_msgBuilder*) clear; - (s_borad_report_top_msgBuilder*) clone; - (s_borad_report_top_msg*) build; - (s_borad_report_top_msg*) buildPartial; - (s_borad_report_top_msgBuilder*) mergeFrom:(s_borad_report_top_msg*) other; - (s_borad_report_top_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_borad_report_top_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (PBAppendableArray *)blockCodes; - (UInt32)blockCodesAtIndex:(NSUInteger)index; - (s_borad_report_top_msgBuilder *)addBlockCodes:(UInt32)value; - (s_borad_report_top_msgBuilder *)setBlockCodesArray:(NSArray *)array; - (s_borad_report_top_msgBuilder *)setBlockCodesValues:(const UInt32 *)values count:(NSUInteger)count; - (s_borad_report_top_msgBuilder *)clearBlockCodes; - (BOOL) hasSortColum; - (colum_type) sortColum; - (s_borad_report_top_msgBuilder*) setSortColum:(colum_type) value; - (s_borad_report_top_msgBuilder*) clearSortColum; - (BOOL) hasIsAsc; - (BOOL) isAsc; - (s_borad_report_top_msgBuilder*) setIsAsc:(BOOL) value; - (s_borad_report_top_msgBuilder*) clearIsAsc; - (PBAppendableArray *)columArray; - (colum_type)columArrayAtIndex:(NSUInteger)index; - (s_borad_report_top_msgBuilder *)addColumArray:(colum_type)value; - (s_borad_report_top_msgBuilder *)setColumArrayArray:(NSArray *)array; - (s_borad_report_top_msgBuilder *)setColumArrayValues:(const colum_type *)values count:(NSUInteger)count; - (s_borad_report_top_msgBuilder *)clearColumArray; - (BOOL) hasCount; - (UInt32) count; - (s_borad_report_top_msgBuilder*) setCount:(UInt32) value; - (s_borad_report_top_msgBuilder*) clearCount; @end #define s_borad_report_block_msg_code @"code" #define s_borad_report_block_msg_name @"name" #define s_borad_report_block_msg_datas @"datas" @interface s_borad_report_block_msg : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasName_:1; NSString* code; NSString* name; NSMutableArray * datasArray; } - (BOOL) hasCode; - (BOOL) hasName; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly, strong) NSArray * datas; - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_borad_report_block_msgBuilder*) builder; + (s_borad_report_block_msgBuilder*) builder; + (s_borad_report_block_msgBuilder*) builderWithPrototype:(s_borad_report_block_msg*) prototype; - (s_borad_report_block_msgBuilder*) toBuilder; + (s_borad_report_block_msg*) parseFromData:(NSData*) data; + (s_borad_report_block_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_block_msg*) parseFromInputStream:(NSInputStream*) input; + (s_borad_report_block_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_block_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_borad_report_block_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_borad_report_block_msgBuilder : PBGeneratedMessageBuilder { @private s_borad_report_block_msg* resultSBoradReportBlockMsg; } - (s_borad_report_block_msg*) defaultInstance; - (s_borad_report_block_msgBuilder*) clear; - (s_borad_report_block_msgBuilder*) clone; - (s_borad_report_block_msg*) build; - (s_borad_report_block_msg*) buildPartial; - (s_borad_report_block_msgBuilder*) mergeFrom:(s_borad_report_block_msg*) other; - (s_borad_report_block_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_borad_report_block_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_borad_report_block_msgBuilder*) setCode:(NSString*) value; - (s_borad_report_block_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_borad_report_block_msgBuilder*) setName:(NSString*) value; - (s_borad_report_block_msgBuilder*) clearName; - (NSMutableArray *)datas; - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index; - (s_borad_report_block_msgBuilder *)addDatas:(s_borad_report_line_data*)value; - (s_borad_report_block_msgBuilder *)setDatasArray:(NSArray *)array; - (s_borad_report_block_msgBuilder *)clearDatas; @end #define s_borad_report_top_result_msg_datas @"datas" @interface s_borad_report_top_result_msg : PBGeneratedMessage { @private NSMutableArray * datasArray; } @property (readonly, strong) NSArray * datas; - (s_borad_report_block_msg*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_borad_report_top_result_msgBuilder*) builder; + (s_borad_report_top_result_msgBuilder*) builder; + (s_borad_report_top_result_msgBuilder*) builderWithPrototype:(s_borad_report_top_result_msg*) prototype; - (s_borad_report_top_result_msgBuilder*) toBuilder; + (s_borad_report_top_result_msg*) parseFromData:(NSData*) data; + (s_borad_report_top_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_top_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_borad_report_top_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_borad_report_top_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_borad_report_top_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_borad_report_top_result_msgBuilder : PBGeneratedMessageBuilder { @private s_borad_report_top_result_msg* resultSBoradReportTopResultMsg; } - (s_borad_report_top_result_msg*) defaultInstance; - (s_borad_report_top_result_msgBuilder*) clear; - (s_borad_report_top_result_msgBuilder*) clone; - (s_borad_report_top_result_msg*) build; - (s_borad_report_top_result_msg*) buildPartial; - (s_borad_report_top_result_msgBuilder*) mergeFrom:(s_borad_report_top_result_msg*) other; - (s_borad_report_top_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_borad_report_top_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)datas; - (s_borad_report_block_msg*)datasAtIndex:(NSUInteger)index; - (s_borad_report_top_result_msgBuilder *)addDatas:(s_borad_report_block_msg*)value; - (s_borad_report_top_result_msgBuilder *)setDatasArray:(NSArray *)array; - (s_borad_report_top_result_msgBuilder *)clearDatas; @end #define s_index_keep_line_msg_code @"code" #define s_index_keep_line_msg_name @"name" #define s_index_keep_line_msg_vol @"vol" #define s_index_keep_line_msg_buykeep @"buykeep" #define s_index_keep_line_msg_sellkeep @"sellkeep" #define s_index_keep_line_msg_voldif @"voldif" #define s_index_keep_line_msg_buykeepdif @"buykeepdif" #define s_index_keep_line_msg_sellkeepdif @"sellkeepdif" @interface s_index_keep_line_msg : PBGeneratedMessage { @private BOOL hasVol_:1; BOOL hasBuykeep_:1; BOOL hasSellkeep_:1; BOOL hasVoldif_:1; BOOL hasBuykeepdif_:1; BOOL hasSellkeepdif_:1; BOOL hasCode_:1; BOOL hasName_:1; Float64 vol; Float64 buykeep; Float64 sellkeep; Float64 voldif; Float64 buykeepdif; Float64 sellkeepdif; NSString* code; NSString* name; } - (BOOL) hasCode; - (BOOL) hasName; - (BOOL) hasVol; - (BOOL) hasBuykeep; - (BOOL) hasSellkeep; - (BOOL) hasVoldif; - (BOOL) hasBuykeepdif; - (BOOL) hasSellkeepdif; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly) Float64 vol; @property (readonly) Float64 buykeep; @property (readonly) Float64 sellkeep; @property (readonly) Float64 voldif; @property (readonly) Float64 buykeepdif; @property (readonly) Float64 sellkeepdif; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_index_keep_line_msgBuilder*) builder; + (s_index_keep_line_msgBuilder*) builder; + (s_index_keep_line_msgBuilder*) builderWithPrototype:(s_index_keep_line_msg*) prototype; - (s_index_keep_line_msgBuilder*) toBuilder; + (s_index_keep_line_msg*) parseFromData:(NSData*) data; + (s_index_keep_line_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_index_keep_line_msg*) parseFromInputStream:(NSInputStream*) input; + (s_index_keep_line_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_index_keep_line_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_index_keep_line_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_index_keep_line_msgBuilder : PBGeneratedMessageBuilder { @private s_index_keep_line_msg* resultSIndexKeepLineMsg; } - (s_index_keep_line_msg*) defaultInstance; - (s_index_keep_line_msgBuilder*) clear; - (s_index_keep_line_msgBuilder*) clone; - (s_index_keep_line_msg*) build; - (s_index_keep_line_msg*) buildPartial; - (s_index_keep_line_msgBuilder*) mergeFrom:(s_index_keep_line_msg*) other; - (s_index_keep_line_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_index_keep_line_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_index_keep_line_msgBuilder*) setCode:(NSString*) value; - (s_index_keep_line_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_index_keep_line_msgBuilder*) setName:(NSString*) value; - (s_index_keep_line_msgBuilder*) clearName; - (BOOL) hasVol; - (Float64) vol; - (s_index_keep_line_msgBuilder*) setVol:(Float64) value; - (s_index_keep_line_msgBuilder*) clearVol; - (BOOL) hasBuykeep; - (Float64) buykeep; - (s_index_keep_line_msgBuilder*) setBuykeep:(Float64) value; - (s_index_keep_line_msgBuilder*) clearBuykeep; - (BOOL) hasSellkeep; - (Float64) sellkeep; - (s_index_keep_line_msgBuilder*) setSellkeep:(Float64) value; - (s_index_keep_line_msgBuilder*) clearSellkeep; - (BOOL) hasVoldif; - (Float64) voldif; - (s_index_keep_line_msgBuilder*) setVoldif:(Float64) value; - (s_index_keep_line_msgBuilder*) clearVoldif; - (BOOL) hasBuykeepdif; - (Float64) buykeepdif; - (s_index_keep_line_msgBuilder*) setBuykeepdif:(Float64) value; - (s_index_keep_line_msgBuilder*) clearBuykeepdif; - (BOOL) hasSellkeepdif; - (Float64) sellkeepdif; - (s_index_keep_line_msgBuilder*) setSellkeepdif:(Float64) value; - (s_index_keep_line_msgBuilder*) clearSellkeepdif; @end #define s_index_keep_result_msg_datas @"datas" @interface s_index_keep_result_msg : PBGeneratedMessage { @private NSMutableArray * datasArray; } @property (readonly, strong) NSArray * datas; - (s_index_keep_line_msg*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_index_keep_result_msgBuilder*) builder; + (s_index_keep_result_msgBuilder*) builder; + (s_index_keep_result_msgBuilder*) builderWithPrototype:(s_index_keep_result_msg*) prototype; - (s_index_keep_result_msgBuilder*) toBuilder; + (s_index_keep_result_msg*) parseFromData:(NSData*) data; + (s_index_keep_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_index_keep_result_msg*) parseFromInputStream:(NSInputStream*) input; + (s_index_keep_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_index_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_index_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_index_keep_result_msgBuilder : PBGeneratedMessageBuilder { @private s_index_keep_result_msg* resultSIndexKeepResultMsg; } - (s_index_keep_result_msg*) defaultInstance; - (s_index_keep_result_msgBuilder*) clear; - (s_index_keep_result_msgBuilder*) clone; - (s_index_keep_result_msg*) build; - (s_index_keep_result_msg*) buildPartial; - (s_index_keep_result_msgBuilder*) mergeFrom:(s_index_keep_result_msg*) other; - (s_index_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_index_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)datas; - (s_index_keep_line_msg*)datasAtIndex:(NSUInteger)index; - (s_index_keep_result_msgBuilder *)addDatas:(s_index_keep_line_msg*)value; - (s_index_keep_result_msgBuilder *)setDatasArray:(NSArray *)array; - (s_index_keep_result_msgBuilder *)clearDatas; @end #define s_block_relation_request_code @"code" @interface s_block_relation_request : PBGeneratedMessage { @private BOOL hasCode_:1; NSString* code; } - (BOOL) hasCode; @property (readonly, strong) NSString* code; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_block_relation_requestBuilder*) builder; + (s_block_relation_requestBuilder*) builder; + (s_block_relation_requestBuilder*) builderWithPrototype:(s_block_relation_request*) prototype; - (s_block_relation_requestBuilder*) toBuilder; + (s_block_relation_request*) parseFromData:(NSData*) data; + (s_block_relation_request*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_block_relation_request*) parseFromInputStream:(NSInputStream*) input; + (s_block_relation_request*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_block_relation_request*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_block_relation_request*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_block_relation_requestBuilder : PBGeneratedMessageBuilder { @private s_block_relation_request* resultSBlockRelationRequest; } - (s_block_relation_request*) defaultInstance; - (s_block_relation_requestBuilder*) clear; - (s_block_relation_requestBuilder*) clone; - (s_block_relation_request*) build; - (s_block_relation_request*) buildPartial; - (s_block_relation_requestBuilder*) mergeFrom:(s_block_relation_request*) other; - (s_block_relation_requestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_block_relation_requestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_block_relation_requestBuilder*) setCode:(NSString*) value; - (s_block_relation_requestBuilder*) clearCode; @end #define s_block_relation_colunm_msg_code @"code" #define s_block_relation_colunm_msg_name @"name" @interface s_block_relation_colunm_msg : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasName_:1; NSString* code; NSString* name; } - (BOOL) hasCode; - (BOOL) hasName; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_block_relation_colunm_msgBuilder*) builder; + (s_block_relation_colunm_msgBuilder*) builder; + (s_block_relation_colunm_msgBuilder*) builderWithPrototype:(s_block_relation_colunm_msg*) prototype; - (s_block_relation_colunm_msgBuilder*) toBuilder; + (s_block_relation_colunm_msg*) parseFromData:(NSData*) data; + (s_block_relation_colunm_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_block_relation_colunm_msg*) parseFromInputStream:(NSInputStream*) input; + (s_block_relation_colunm_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_block_relation_colunm_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_block_relation_colunm_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_block_relation_colunm_msgBuilder : PBGeneratedMessageBuilder { @private s_block_relation_colunm_msg* resultSBlockRelationColunmMsg; } - (s_block_relation_colunm_msg*) defaultInstance; - (s_block_relation_colunm_msgBuilder*) clear; - (s_block_relation_colunm_msgBuilder*) clone; - (s_block_relation_colunm_msg*) build; - (s_block_relation_colunm_msg*) buildPartial; - (s_block_relation_colunm_msgBuilder*) mergeFrom:(s_block_relation_colunm_msg*) other; - (s_block_relation_colunm_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_block_relation_colunm_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_block_relation_colunm_msgBuilder*) setCode:(NSString*) value; - (s_block_relation_colunm_msgBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_block_relation_colunm_msgBuilder*) setName:(NSString*) value; - (s_block_relation_colunm_msgBuilder*) clearName; @end #define s_block_relation_result_datas @"datas" @interface s_block_relation_result : PBGeneratedMessage { @private NSMutableArray * datasArray; } @property (readonly, strong) NSArray * datas; - (s_block_relation_colunm_msg*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_block_relation_resultBuilder*) builder; + (s_block_relation_resultBuilder*) builder; + (s_block_relation_resultBuilder*) builderWithPrototype:(s_block_relation_result*) prototype; - (s_block_relation_resultBuilder*) toBuilder; + (s_block_relation_result*) parseFromData:(NSData*) data; + (s_block_relation_result*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_block_relation_result*) parseFromInputStream:(NSInputStream*) input; + (s_block_relation_result*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_block_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_block_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_block_relation_resultBuilder : PBGeneratedMessageBuilder { @private s_block_relation_result* resultSBlockRelationResult; } - (s_block_relation_result*) defaultInstance; - (s_block_relation_resultBuilder*) clear; - (s_block_relation_resultBuilder*) clone; - (s_block_relation_result*) build; - (s_block_relation_result*) buildPartial; - (s_block_relation_resultBuilder*) mergeFrom:(s_block_relation_result*) other; - (s_block_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_block_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)datas; - (s_block_relation_colunm_msg*)datasAtIndex:(NSUInteger)index; - (s_block_relation_resultBuilder *)addDatas:(s_block_relation_colunm_msg*)value; - (s_block_relation_resultBuilder *)setDatasArray:(NSArray *)array; - (s_block_relation_resultBuilder *)clearDatas; @end #define s_code_name_line_code @"code" #define s_code_name_line_name @"name" @interface s_code_name_line : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasName_:1; NSString* code; NSString* name; } - (BOOL) hasCode; - (BOOL) hasName; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_code_name_lineBuilder*) builder; + (s_code_name_lineBuilder*) builder; + (s_code_name_lineBuilder*) builderWithPrototype:(s_code_name_line*) prototype; - (s_code_name_lineBuilder*) toBuilder; + (s_code_name_line*) parseFromData:(NSData*) data; + (s_code_name_line*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_code_name_line*) parseFromInputStream:(NSInputStream*) input; + (s_code_name_line*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_code_name_line*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_code_name_line*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_code_name_lineBuilder : PBGeneratedMessageBuilder { @private s_code_name_line* resultSCodeNameLine; } - (s_code_name_line*) defaultInstance; - (s_code_name_lineBuilder*) clear; - (s_code_name_lineBuilder*) clone; - (s_code_name_line*) build; - (s_code_name_line*) buildPartial; - (s_code_name_lineBuilder*) mergeFrom:(s_code_name_line*) other; - (s_code_name_lineBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_code_name_lineBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (s_code_name_lineBuilder*) setCode:(NSString*) value; - (s_code_name_lineBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (s_code_name_lineBuilder*) setName:(NSString*) value; - (s_code_name_lineBuilder*) clearName; @end #define s_code_name_relation_result_datas @"datas" @interface s_code_name_relation_result : PBGeneratedMessage { @private NSMutableArray * datasArray; } @property (readonly, strong) NSArray * datas; - (s_code_name_line*)datasAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (s_code_name_relation_resultBuilder*) builder; + (s_code_name_relation_resultBuilder*) builder; + (s_code_name_relation_resultBuilder*) builderWithPrototype:(s_code_name_relation_result*) prototype; - (s_code_name_relation_resultBuilder*) toBuilder; + (s_code_name_relation_result*) parseFromData:(NSData*) data; + (s_code_name_relation_result*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_code_name_relation_result*) parseFromInputStream:(NSInputStream*) input; + (s_code_name_relation_result*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (s_code_name_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (s_code_name_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface s_code_name_relation_resultBuilder : PBGeneratedMessageBuilder { @private s_code_name_relation_result* resultSCodeNameRelationResult; } - (s_code_name_relation_result*) defaultInstance; - (s_code_name_relation_resultBuilder*) clear; - (s_code_name_relation_resultBuilder*) clone; - (s_code_name_relation_result*) build; - (s_code_name_relation_result*) buildPartial; - (s_code_name_relation_resultBuilder*) mergeFrom:(s_code_name_relation_result*) other; - (s_code_name_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (s_code_name_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (NSMutableArray *)datas; - (s_code_name_line*)datasAtIndex:(NSUInteger)index; - (s_code_name_relation_resultBuilder *)addDatas:(s_code_name_line*)value; - (s_code_name_relation_resultBuilder *)setDatasArray:(NSArray *)array; - (s_code_name_relation_resultBuilder *)clearDatas; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Report.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Report.pb.h" // @@protoc_insertion_point(imports) @implementation ReportRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [ReportRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; [CommonRoot registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end BOOL report_data_cycleIsValidValue(report_data_cycle value) { switch (value) { case report_data_cycleReportDataCycleBegin: case report_data_cycleReportDataCycle1Min: case report_data_cycleReportDataCycle3Min: case report_data_cycleReportDataCycle5Min: case report_data_cycleReportDataCycle10Min: case report_data_cycleReportDataCycle15Min: case report_data_cycleReportDataCycle20Min: case report_data_cycleReportDataCycle30Min: case report_data_cycleReportDataCycle60Min: case report_data_cycleReportDataCycleDay: case report_data_cycleReportDataCycleWeek: case report_data_cycleReportDataCycleMonth: case report_data_cycleReportDataCycleQuarter: case report_data_cycleReportDataCycleYear: case report_data_cycleReportDataCycleEnd: return YES; default: return NO; } } NSString *NSStringFromreport_data_cycle(report_data_cycle value) { switch (value) { case report_data_cycleReportDataCycleBegin: return @"report_data_cycleReportDataCycleBegin"; case report_data_cycleReportDataCycle1Min: return @"report_data_cycleReportDataCycle1Min"; case report_data_cycleReportDataCycle3Min: return @"report_data_cycleReportDataCycle3Min"; case report_data_cycleReportDataCycle5Min: return @"report_data_cycleReportDataCycle5Min"; case report_data_cycleReportDataCycle10Min: return @"report_data_cycleReportDataCycle10Min"; case report_data_cycleReportDataCycle15Min: return @"report_data_cycleReportDataCycle15Min"; case report_data_cycleReportDataCycle20Min: return @"report_data_cycleReportDataCycle20Min"; case report_data_cycleReportDataCycle30Min: return @"report_data_cycleReportDataCycle30Min"; case report_data_cycleReportDataCycle60Min: return @"report_data_cycleReportDataCycle60Min"; case report_data_cycleReportDataCycleDay: return @"report_data_cycleReportDataCycleDay"; case report_data_cycleReportDataCycleWeek: return @"report_data_cycleReportDataCycleWeek"; case report_data_cycleReportDataCycleMonth: return @"report_data_cycleReportDataCycleMonth"; case report_data_cycleReportDataCycleQuarter: return @"report_data_cycleReportDataCycleQuarter"; case report_data_cycleReportDataCycleYear: return @"report_data_cycleReportDataCycleYear"; case report_data_cycleReportDataCycleEnd: return @"report_data_cycleReportDataCycleEnd"; default: return nil; } } BOOL colum_typeIsValidValue(colum_type value) { switch (value) { case colum_typeColIndex: case colum_typeColStockCode: case colum_typeColStockName: case colum_typeColSuspended: case colum_typeColRiseScope: case colum_typeColLastClosePrice: case colum_typeColOpenPrice: case colum_typeColHighPrice: case colum_typeColLowPrice: case colum_typeColNewPrice: case colum_typeColVolume: case colum_typeColNowVol: case colum_typeColAmount: case colum_typeColAvePrice: case colum_typeColRise: case colum_typeColAmplitude: case colum_typeColCommitScale: case colum_typeColCommitDif: case colum_typeColVolumeScale: case colum_typeColCommitBuyVol: case colum_typeColCimmitSellVol: case colum_typeColCommitBuy: case colum_typeColCimmitSell: case colum_typeColRiseVol: case colum_typeColDropVol: case colum_typeColRiseSpeed: case colum_typeColCommitBuyVol1: case colum_typeColCommitBuyVol2: case colum_typeColCommitBuyVol3: case colum_typeColCommitBuyPrice1: case colum_typeColCommitBuyPrice2: case colum_typeColCommitBuyPrice3: case colum_typeColCommitSellVol1: case colum_typeColCommitSellVol2: case colum_typeColCommitSellVol3: case colum_typeColCommitSellPrice1: case colum_typeColCommitSellPrice2: case colum_typeColCommitSellPrice3: case colum_typeColTurnover: case colum_typeColDay5AveVol: case colum_typeColPe: case colum_typeColDay3RiseScope: case colum_typeColDay5RiseScope: case colum_typeColDay20RiseScope: case colum_typeColCommitBuyVol4: case colum_typeColCommitBuyPrice4: case colum_typeColCommitSellVol4: case colum_typeColCommitSellPrice4: case colum_typeColZgb: case colum_typeColGjg: case colum_typeColFqfrg: case colum_typeColFrg: case colum_typeColBg: case colum_typeColHg: case colum_typeColLtag: case colum_typeColZgg: case colum_typeColA2Zpg: case colum_typeColZzc: case colum_typeColLdzc: case colum_typeColGdzc: case colum_typeColWxzc: case colum_typeColCqtz: case colum_typeColLdfz: case colum_typeColCqfz: case colum_typeColZbgjj: case colum_typeColMggjj: case colum_typeColGdqy: case colum_typeColZysr: case colum_typeColZylr: case colum_typeColQtlr: case colum_typeColYylr: case colum_typeColTzsy: case colum_typeColBtsy: case colum_typeColYywsz: case colum_typeColSnsytz: case colum_typeColLrze: case colum_typeColShlr: case colum_typeColJlr: case colum_typeColWfplr: case colum_typeColMgwfp: case colum_typeColMgsy: case colum_typeColMgjzc: case colum_typeColTzmgjzc: case colum_typeColGdqyb: case colum_typeColJzsyl: case colum_typeColMin5RiseScope: case colum_typeColDay5Turnover: case colum_typeColDay20Turnover: case colum_typeColContribution: case colum_typeColLargeMidDealDif: case colum_typeColLargeDealScale: case colum_typeColMidDealScale: case colum_typeColSmallDealScale: case colum_typeColRelative: case colum_typeColLargeDealDif: case colum_typeColMidDealDif: case colum_typeColSmallDealDif: case colum_typeColLargeDealAdd: case colum_typeColHs300Contri: case colum_typeColHs300Min5Contri: case colum_typeColLargeMidScale: case colum_typeColAllDealDif: case colum_typeColD5LargeMidDif: case colum_typeColD10LargeMidDif: case colum_typeColD20LargeMidDif: case colum_typeColAllPtjz: case colum_typeColBlockPtjz: case colum_typeColAllCzx: case colum_typeColBlockCzx: case colum_typeColJbmpj: case colum_typeColRiseDropScale: case colum_typeColRiseMostInBlock: case colum_typeColBljc: case colum_typeColStockBlock: case colum_typeColFxj: case colum_typeColD3LargeMidDif: case colum_typeColDay3Turnover: case colum_typeColMonth3Turnover: case colum_typeColMonth6Turnover: case colum_typeColContinueRiseDay: case colum_typeColHigestPrice: case colum_typeColLowestPrice: case colum_typeColMonth3Rise: case colum_typeColMonth6Rise: case colum_typeColYear1Rise: case colum_typeColBljjDn: case colum_typeColJgkp: case colum_typeColYlw: case colum_typeColZcw: case colum_typeColDqqs: case colum_typeColLjphd: case colum_typeColJgpj: case colum_typeColBpoint: case colum_typeColSpoint: case colum_typeCol20HigestPrice: case colum_typeCol20LowestPrice: case colum_typeColRiseInBlock: case colum_typeColDropInBlock: case colum_typeColKeepInBlock: case colum_typeColBlsc: case colum_typeColXsmll: case colum_typeColXsjll: case colum_typeColMgxjll: case colum_typeColZysrzzl: case colum_typeColJlrzzl: case colum_typeColIfsts: case colum_typeColIfcc: case colum_typeColIfrzc: case colum_typeColIfzjsj: case colum_typeCol10DayRise: case colum_typeColDqqsdn: case colum_typeColDqqsbh: case colum_typeColZqqsdn: case colum_typeColZqqsbh: case colum_typeColFullName: case colum_typeColContractCode: case colum_typeColUnderlyingCode: case colum_typeColUnderlyingName: case colum_typeColExcercizePrice: case colum_typeColExcercizeDate: case colum_typeColOptionVol: case colum_typeColExcercizePriceSort: case colum_typeColPb: case colum_typeColEnd: return YES; default: return NO; } } NSString *NSStringFromcolum_type(colum_type value) { switch (value) { case colum_typeColIndex: return @"colum_typeColIndex"; case colum_typeColStockCode: return @"colum_typeColStockCode"; case colum_typeColStockName: return @"colum_typeColStockName"; case colum_typeColSuspended: return @"colum_typeColSuspended"; case colum_typeColRiseScope: return @"colum_typeColRiseScope"; case colum_typeColLastClosePrice: return @"colum_typeColLastClosePrice"; case colum_typeColOpenPrice: return @"colum_typeColOpenPrice"; case colum_typeColHighPrice: return @"colum_typeColHighPrice"; case colum_typeColLowPrice: return @"colum_typeColLowPrice"; case colum_typeColNewPrice: return @"colum_typeColNewPrice"; case colum_typeColVolume: return @"colum_typeColVolume"; case colum_typeColNowVol: return @"colum_typeColNowVol"; case colum_typeColAmount: return @"colum_typeColAmount"; case colum_typeColAvePrice: return @"colum_typeColAvePrice"; case colum_typeColRise: return @"colum_typeColRise"; case colum_typeColAmplitude: return @"colum_typeColAmplitude"; case colum_typeColCommitScale: return @"colum_typeColCommitScale"; case colum_typeColCommitDif: return @"colum_typeColCommitDif"; case colum_typeColVolumeScale: return @"colum_typeColVolumeScale"; case colum_typeColCommitBuyVol: return @"colum_typeColCommitBuyVol"; case colum_typeColCimmitSellVol: return @"colum_typeColCimmitSellVol"; case colum_typeColCommitBuy: return @"colum_typeColCommitBuy"; case colum_typeColCimmitSell: return @"colum_typeColCimmitSell"; case colum_typeColRiseVol: return @"colum_typeColRiseVol"; case colum_typeColDropVol: return @"colum_typeColDropVol"; case colum_typeColRiseSpeed: return @"colum_typeColRiseSpeed"; case colum_typeColCommitBuyVol1: return @"colum_typeColCommitBuyVol1"; case colum_typeColCommitBuyVol2: return @"colum_typeColCommitBuyVol2"; case colum_typeColCommitBuyVol3: return @"colum_typeColCommitBuyVol3"; case colum_typeColCommitBuyPrice1: return @"colum_typeColCommitBuyPrice1"; case colum_typeColCommitBuyPrice2: return @"colum_typeColCommitBuyPrice2"; case colum_typeColCommitBuyPrice3: return @"colum_typeColCommitBuyPrice3"; case colum_typeColCommitSellVol1: return @"colum_typeColCommitSellVol1"; case colum_typeColCommitSellVol2: return @"colum_typeColCommitSellVol2"; case colum_typeColCommitSellVol3: return @"colum_typeColCommitSellVol3"; case colum_typeColCommitSellPrice1: return @"colum_typeColCommitSellPrice1"; case colum_typeColCommitSellPrice2: return @"colum_typeColCommitSellPrice2"; case colum_typeColCommitSellPrice3: return @"colum_typeColCommitSellPrice3"; case colum_typeColTurnover: return @"colum_typeColTurnover"; case colum_typeColDay5AveVol: return @"colum_typeColDay5AveVol"; case colum_typeColPe: return @"colum_typeColPe"; case colum_typeColDay3RiseScope: return @"colum_typeColDay3RiseScope"; case colum_typeColDay5RiseScope: return @"colum_typeColDay5RiseScope"; case colum_typeColDay20RiseScope: return @"colum_typeColDay20RiseScope"; case colum_typeColCommitBuyVol4: return @"colum_typeColCommitBuyVol4"; case colum_typeColCommitBuyPrice4: return @"colum_typeColCommitBuyPrice4"; case colum_typeColCommitSellVol4: return @"colum_typeColCommitSellVol4"; case colum_typeColCommitSellPrice4: return @"colum_typeColCommitSellPrice4"; case colum_typeColZgb: return @"colum_typeColZgb"; case colum_typeColGjg: return @"colum_typeColGjg"; case colum_typeColFqfrg: return @"colum_typeColFqfrg"; case colum_typeColFrg: return @"colum_typeColFrg"; case colum_typeColBg: return @"colum_typeColBg"; case colum_typeColHg: return @"colum_typeColHg"; case colum_typeColLtag: return @"colum_typeColLtag"; case colum_typeColZgg: return @"colum_typeColZgg"; case colum_typeColA2Zpg: return @"colum_typeColA2Zpg"; case colum_typeColZzc: return @"colum_typeColZzc"; case colum_typeColLdzc: return @"colum_typeColLdzc"; case colum_typeColGdzc: return @"colum_typeColGdzc"; case colum_typeColWxzc: return @"colum_typeColWxzc"; case colum_typeColCqtz: return @"colum_typeColCqtz"; case colum_typeColLdfz: return @"colum_typeColLdfz"; case colum_typeColCqfz: return @"colum_typeColCqfz"; case colum_typeColZbgjj: return @"colum_typeColZbgjj"; case colum_typeColMggjj: return @"colum_typeColMggjj"; case colum_typeColGdqy: return @"colum_typeColGdqy"; case colum_typeColZysr: return @"colum_typeColZysr"; case colum_typeColZylr: return @"colum_typeColZylr"; case colum_typeColQtlr: return @"colum_typeColQtlr"; case colum_typeColYylr: return @"colum_typeColYylr"; case colum_typeColTzsy: return @"colum_typeColTzsy"; case colum_typeColBtsy: return @"colum_typeColBtsy"; case colum_typeColYywsz: return @"colum_typeColYywsz"; case colum_typeColSnsytz: return @"colum_typeColSnsytz"; case colum_typeColLrze: return @"colum_typeColLrze"; case colum_typeColShlr: return @"colum_typeColShlr"; case colum_typeColJlr: return @"colum_typeColJlr"; case colum_typeColWfplr: return @"colum_typeColWfplr"; case colum_typeColMgwfp: return @"colum_typeColMgwfp"; case colum_typeColMgsy: return @"colum_typeColMgsy"; case colum_typeColMgjzc: return @"colum_typeColMgjzc"; case colum_typeColTzmgjzc: return @"colum_typeColTzmgjzc"; case colum_typeColGdqyb: return @"colum_typeColGdqyb"; case colum_typeColJzsyl: return @"colum_typeColJzsyl"; case colum_typeColMin5RiseScope: return @"colum_typeColMin5RiseScope"; case colum_typeColDay5Turnover: return @"colum_typeColDay5Turnover"; case colum_typeColDay20Turnover: return @"colum_typeColDay20Turnover"; case colum_typeColContribution: return @"colum_typeColContribution"; case colum_typeColLargeMidDealDif: return @"colum_typeColLargeMidDealDif"; case colum_typeColLargeDealScale: return @"colum_typeColLargeDealScale"; case colum_typeColMidDealScale: return @"colum_typeColMidDealScale"; case colum_typeColSmallDealScale: return @"colum_typeColSmallDealScale"; case colum_typeColRelative: return @"colum_typeColRelative"; case colum_typeColLargeDealDif: return @"colum_typeColLargeDealDif"; case colum_typeColMidDealDif: return @"colum_typeColMidDealDif"; case colum_typeColSmallDealDif: return @"colum_typeColSmallDealDif"; case colum_typeColLargeDealAdd: return @"colum_typeColLargeDealAdd"; case colum_typeColHs300Contri: return @"colum_typeColHs300Contri"; case colum_typeColHs300Min5Contri: return @"colum_typeColHs300Min5Contri"; case colum_typeColLargeMidScale: return @"colum_typeColLargeMidScale"; case colum_typeColAllDealDif: return @"colum_typeColAllDealDif"; case colum_typeColD5LargeMidDif: return @"colum_typeColD5LargeMidDif"; case colum_typeColD10LargeMidDif: return @"colum_typeColD10LargeMidDif"; case colum_typeColD20LargeMidDif: return @"colum_typeColD20LargeMidDif"; case colum_typeColAllPtjz: return @"colum_typeColAllPtjz"; case colum_typeColBlockPtjz: return @"colum_typeColBlockPtjz"; case colum_typeColAllCzx: return @"colum_typeColAllCzx"; case colum_typeColBlockCzx: return @"colum_typeColBlockCzx"; case colum_typeColJbmpj: return @"colum_typeColJbmpj"; case colum_typeColRiseDropScale: return @"colum_typeColRiseDropScale"; case colum_typeColRiseMostInBlock: return @"colum_typeColRiseMostInBlock"; case colum_typeColBljc: return @"colum_typeColBljc"; case colum_typeColStockBlock: return @"colum_typeColStockBlock"; case colum_typeColFxj: return @"colum_typeColFxj"; case colum_typeColD3LargeMidDif: return @"colum_typeColD3LargeMidDif"; case colum_typeColDay3Turnover: return @"colum_typeColDay3Turnover"; case colum_typeColMonth3Turnover: return @"colum_typeColMonth3Turnover"; case colum_typeColMonth6Turnover: return @"colum_typeColMonth6Turnover"; case colum_typeColContinueRiseDay: return @"colum_typeColContinueRiseDay"; case colum_typeColHigestPrice: return @"colum_typeColHigestPrice"; case colum_typeColLowestPrice: return @"colum_typeColLowestPrice"; case colum_typeColMonth3Rise: return @"colum_typeColMonth3Rise"; case colum_typeColMonth6Rise: return @"colum_typeColMonth6Rise"; case colum_typeColYear1Rise: return @"colum_typeColYear1Rise"; case colum_typeColBljjDn: return @"colum_typeColBljjDn"; case colum_typeColJgkp: return @"colum_typeColJgkp"; case colum_typeColYlw: return @"colum_typeColYlw"; case colum_typeColZcw: return @"colum_typeColZcw"; case colum_typeColDqqs: return @"colum_typeColDqqs"; case colum_typeColLjphd: return @"colum_typeColLjphd"; case colum_typeColJgpj: return @"colum_typeColJgpj"; case colum_typeColBpoint: return @"colum_typeColBpoint"; case colum_typeColSpoint: return @"colum_typeColSpoint"; case colum_typeCol20HigestPrice: return @"colum_typeCol20HigestPrice"; case colum_typeCol20LowestPrice: return @"colum_typeCol20LowestPrice"; case colum_typeColRiseInBlock: return @"colum_typeColRiseInBlock"; case colum_typeColDropInBlock: return @"colum_typeColDropInBlock"; case colum_typeColKeepInBlock: return @"colum_typeColKeepInBlock"; case colum_typeColBlsc: return @"colum_typeColBlsc"; case colum_typeColXsmll: return @"colum_typeColXsmll"; case colum_typeColXsjll: return @"colum_typeColXsjll"; case colum_typeColMgxjll: return @"colum_typeColMgxjll"; case colum_typeColZysrzzl: return @"colum_typeColZysrzzl"; case colum_typeColJlrzzl: return @"colum_typeColJlrzzl"; case colum_typeColIfsts: return @"colum_typeColIfsts"; case colum_typeColIfcc: return @"colum_typeColIfcc"; case colum_typeColIfrzc: return @"colum_typeColIfrzc"; case colum_typeColIfzjsj: return @"colum_typeColIfzjsj"; case colum_typeCol10DayRise: return @"colum_typeCol10DayRise"; case colum_typeColDqqsdn: return @"colum_typeColDqqsdn"; case colum_typeColDqqsbh: return @"colum_typeColDqqsbh"; case colum_typeColZqqsdn: return @"colum_typeColZqqsdn"; case colum_typeColZqqsbh: return @"colum_typeColZqqsbh"; case colum_typeColFullName: return @"colum_typeColFullName"; case colum_typeColContractCode: return @"colum_typeColContractCode"; case colum_typeColUnderlyingCode: return @"colum_typeColUnderlyingCode"; case colum_typeColUnderlyingName: return @"colum_typeColUnderlyingName"; case colum_typeColExcercizePrice: return @"colum_typeColExcercizePrice"; case colum_typeColExcercizeDate: return @"colum_typeColExcercizeDate"; case colum_typeColOptionVol: return @"colum_typeColOptionVol"; case colum_typeColExcercizePriceSort: return @"colum_typeColExcercizePriceSort"; case colum_typeColPb: return @"colum_typeColPb"; case colum_typeColEnd: return @"colum_typeColEnd"; default: return nil; } } @interface report_msg () @property (strong) NSMutableArray * codeArray; @end @implementation report_msg @synthesize codeArray; @dynamic code; - (instancetype) init { if ((self = [super init])) { } return self; } static report_msg* defaultreport_msgInstance = nil; + (void) initialize { if (self == [report_msg class]) { defaultreport_msgInstance = [[report_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultreport_msgInstance; } - (instancetype) defaultInstance { return defaultreport_msgInstance; } - (NSArray *)code { return codeArray; } - (NSString*)codeAtIndex:(NSUInteger)index { return [codeArray objectAtIndex:index]; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.codeArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { [output writeString:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; { __block SInt32 dataSize = 0; const NSUInteger count = self.codeArray.count; [self.codeArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { dataSize += computeStringSizeNoTag(element); }]; size_ += dataSize; size_ += (SInt32)(1 * count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (report_msg*) parseFromData:(NSData*) data { return (report_msg*)[[[report_msg builder] mergeFromData:data] build]; } + (report_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (report_msg*)[[[report_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (report_msg*) parseFromInputStream:(NSInputStream*) input { return (report_msg*)[[[report_msg builder] mergeFromInputStream:input] build]; } + (report_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (report_msg*)[[[report_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (report_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (report_msg*)[[[report_msg builder] mergeFromCodedInputStream:input] build]; } + (report_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (report_msg*)[[[report_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (report_msgBuilder*) builder { return [[report_msgBuilder alloc] init]; } + (report_msgBuilder*) builderWithPrototype:(report_msg*) prototype { return [[report_msg builder] mergeFrom:prototype]; } - (report_msgBuilder*) builder { return [report_msg builder]; } - (report_msgBuilder*) toBuilder { return [report_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.codeArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"code", obj]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { [dictionary setObject:self.code forKey: @"code"]; [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[report_msg class]]) { return NO; } report_msg *otherMessage = other; return [self.codeArray isEqualToArray:otherMessage.codeArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.codeArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface report_msgBuilder() @property (strong) report_msg* resultReportMsg; @end @implementation report_msgBuilder @synthesize resultReportMsg; - (instancetype) init { if ((self = [super init])) { self.resultReportMsg = [[report_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultReportMsg; } - (report_msgBuilder*) clear { self.resultReportMsg = [[report_msg alloc] init]; return self; } - (report_msgBuilder*) clone { return [report_msg builderWithPrototype:resultReportMsg]; } - (report_msg*) defaultInstance { return [report_msg defaultInstance]; } - (report_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (report_msg*) buildPartial { report_msg* returnMe = resultReportMsg; self.resultReportMsg = nil; return returnMe; } - (report_msgBuilder*) mergeFrom:(report_msg*) other { if (other == [report_msg defaultInstance]) { return self; } if (other.codeArray.count > 0) { if (resultReportMsg.codeArray == nil) { resultReportMsg.codeArray = [[NSMutableArray alloc] initWithArray:other.codeArray]; } else { [resultReportMsg.codeArray addObjectsFromArray:other.codeArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (report_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (report_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self addCode:[input readString]]; break; } } } } - (NSMutableArray *)code { return resultReportMsg.codeArray; } - (NSString*)codeAtIndex:(NSUInteger)index { return [resultReportMsg codeAtIndex:index]; } - (report_msgBuilder *)addCode:(NSString*)value { if (resultReportMsg.codeArray == nil) { resultReportMsg.codeArray = [[NSMutableArray alloc]init]; } [resultReportMsg.codeArray addObject:value]; return self; } - (report_msgBuilder *)setCodeArray:(NSArray *)array { resultReportMsg.codeArray = [[NSMutableArray alloc] initWithArray:array]; return self; } - (report_msgBuilder *)clearCode { resultReportMsg.codeArray = nil; return self; } @end @interface s_report_result_msg () @property (strong) NSString* code; @property (strong) NSString* name; @property UInt32 time; @property Float64 lastClose; @property Float64 pb_new; @property Float64 open; @property Float64 high; @property Float64 low; @property Float64 vol; @property Float64 amount; @property Float64 fiveDayAvevol; @property (strong) PBAppendableArray * selPriceArray; @property (strong) PBAppendableArray * selVolArray; @property (strong) PBAppendableArray * buyPriceArray; @property (strong) PBAppendableArray * buyVolArray; @property Float64 pe; @property Float64 hhjcap; @property Float64 riseVol; @property Float64 dropVol; @property Float64 hsl; @property Float64 zgb; @property Float64 mgjzc; @property Float64 mgsy; @end @implementation s_report_result_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasLastClose { return !!hasLastClose_; } - (void) setHasLastClose:(BOOL) _value_ { hasLastClose_ = !!_value_; } @synthesize lastClose; - (BOOL) hasPbNew { return !!hasPbNew_; } - (void) setHasPbNew:(BOOL) _value_ { hasPbNew_ = !!_value_; } @synthesize pb_new; - (BOOL) hasOpen { return !!hasOpen_; } - (void) setHasOpen:(BOOL) _value_ { hasOpen_ = !!_value_; } @synthesize open; - (BOOL) hasHigh { return !!hasHigh_; } - (void) setHasHigh:(BOOL) _value_ { hasHigh_ = !!_value_; } @synthesize high; - (BOOL) hasLow { return !!hasLow_; } - (void) setHasLow:(BOOL) _value_ { hasLow_ = !!_value_; } @synthesize low; - (BOOL) hasVol { return !!hasVol_; } - (void) setHasVol:(BOOL) _value_ { hasVol_ = !!_value_; } @synthesize vol; - (BOOL) hasAmount { return !!hasAmount_; } - (void) setHasAmount:(BOOL) _value_ { hasAmount_ = !!_value_; } @synthesize amount; - (BOOL) hasFiveDayAvevol { return !!hasFiveDayAvevol_; } - (void) setHasFiveDayAvevol:(BOOL) _value_ { hasFiveDayAvevol_ = !!_value_; } @synthesize fiveDayAvevol; @synthesize selPriceArray; @dynamic selPrice; @synthesize selVolArray; @dynamic selVol; @synthesize buyPriceArray; @dynamic buyPrice; @synthesize buyVolArray; @dynamic buyVol; - (BOOL) hasPe { return !!hasPe_; } - (void) setHasPe:(BOOL) _value_ { hasPe_ = !!_value_; } @synthesize pe; - (BOOL) hasHhjcap { return !!hasHhjcap_; } - (void) setHasHhjcap:(BOOL) _value_ { hasHhjcap_ = !!_value_; } @synthesize hhjcap; - (BOOL) hasRiseVol { return !!hasRiseVol_; } - (void) setHasRiseVol:(BOOL) _value_ { hasRiseVol_ = !!_value_; } @synthesize riseVol; - (BOOL) hasDropVol { return !!hasDropVol_; } - (void) setHasDropVol:(BOOL) _value_ { hasDropVol_ = !!_value_; } @synthesize dropVol; - (BOOL) hasHsl { return !!hasHsl_; } - (void) setHasHsl:(BOOL) _value_ { hasHsl_ = !!_value_; } @synthesize hsl; - (BOOL) hasZgb { return !!hasZgb_; } - (void) setHasZgb:(BOOL) _value_ { hasZgb_ = !!_value_; } @synthesize zgb; - (BOOL) hasMgjzc { return !!hasMgjzc_; } - (void) setHasMgjzc:(BOOL) _value_ { hasMgjzc_ = !!_value_; } @synthesize mgjzc; - (BOOL) hasMgsy { return !!hasMgsy_; } - (void) setHasMgsy:(BOOL) _value_ { hasMgsy_ = !!_value_; } @synthesize mgsy; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; self.time = 0; self.lastClose = 0; self.pb_new = 0; self.open = 0; self.high = 0; self.low = 0; self.vol = 0; self.amount = 0; self.fiveDayAvevol = 0; self.pe = 0; self.hhjcap = 0; self.riseVol = 0; self.dropVol = 0; self.hsl = 0; self.zgb = 0; self.mgjzc = 0; self.mgsy = 0; } return self; } static s_report_result_msg* defaults_report_result_msgInstance = nil; + (void) initialize { if (self == [s_report_result_msg class]) { defaults_report_result_msgInstance = [[s_report_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_report_result_msgInstance; } - (instancetype) defaultInstance { return defaults_report_result_msgInstance; } - (PBArray *)selPrice { return selPriceArray; } - (Float64)selPriceAtIndex:(NSUInteger)index { return [selPriceArray doubleAtIndex:index]; } - (PBArray *)selVol { return selVolArray; } - (Float64)selVolAtIndex:(NSUInteger)index { return [selVolArray doubleAtIndex:index]; } - (PBArray *)buyPrice { return buyPriceArray; } - (Float64)buyPriceAtIndex:(NSUInteger)index { return [buyPriceArray doubleAtIndex:index]; } - (PBArray *)buyVol { return buyVolArray; } - (Float64)buyVolAtIndex:(NSUInteger)index { return [buyVolArray doubleAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } if (!self.hasTime) { return NO; } if (!self.hasLastClose) { return NO; } if (!self.hasPbNew) { return NO; } if (!self.hasOpen) { return NO; } if (!self.hasHigh) { return NO; } if (!self.hasLow) { return NO; } if (!self.hasVol) { return NO; } if (!self.hasAmount) { return NO; } if (!self.hasFiveDayAvevol) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } if (self.hasTime) { [output writeUInt32:3 value:self.time]; } if (self.hasLastClose) { [output writeDouble:4 value:self.lastClose]; } if (self.hasPbNew) { [output writeDouble:5 value:self.pb_new]; } if (self.hasOpen) { [output writeDouble:6 value:self.open]; } if (self.hasHigh) { [output writeDouble:7 value:self.high]; } if (self.hasLow) { [output writeDouble:8 value:self.low]; } if (self.hasVol) { [output writeDouble:9 value:self.vol]; } if (self.hasAmount) { [output writeDouble:10 value:self.amount]; } if (self.hasFiveDayAvevol) { [output writeDouble:11 value:self.fiveDayAvevol]; } const NSUInteger selPriceArrayCount = self.selPriceArray.count; if (selPriceArrayCount > 0) { const Float64 *values = (const Float64 *)self.selPriceArray.data; for (NSUInteger i = 0; i < selPriceArrayCount; ++i) { [output writeDouble:12 value:values[i]]; } } const NSUInteger selVolArrayCount = self.selVolArray.count; if (selVolArrayCount > 0) { const Float64 *values = (const Float64 *)self.selVolArray.data; for (NSUInteger i = 0; i < selVolArrayCount; ++i) { [output writeDouble:13 value:values[i]]; } } const NSUInteger buyPriceArrayCount = self.buyPriceArray.count; if (buyPriceArrayCount > 0) { const Float64 *values = (const Float64 *)self.buyPriceArray.data; for (NSUInteger i = 0; i < buyPriceArrayCount; ++i) { [output writeDouble:14 value:values[i]]; } } const NSUInteger buyVolArrayCount = self.buyVolArray.count; if (buyVolArrayCount > 0) { const Float64 *values = (const Float64 *)self.buyVolArray.data; for (NSUInteger i = 0; i < buyVolArrayCount; ++i) { [output writeDouble:15 value:values[i]]; } } if (self.hasPe) { [output writeDouble:16 value:self.pe]; } if (self.hasHhjcap) { [output writeDouble:19 value:self.hhjcap]; } if (self.hasRiseVol) { [output writeDouble:20 value:self.riseVol]; } if (self.hasDropVol) { [output writeDouble:21 value:self.dropVol]; } if (self.hasHsl) { [output writeDouble:22 value:self.hsl]; } if (self.hasZgb) { [output writeDouble:23 value:self.zgb]; } if (self.hasMgjzc) { [output writeDouble:24 value:self.mgjzc]; } if (self.hasMgsy) { [output writeDouble:25 value:self.mgsy]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } if (self.hasTime) { size_ += computeUInt32Size(3, self.time); } if (self.hasLastClose) { size_ += computeDoubleSize(4, self.lastClose); } if (self.hasPbNew) { size_ += computeDoubleSize(5, self.pb_new); } if (self.hasOpen) { size_ += computeDoubleSize(6, self.open); } if (self.hasHigh) { size_ += computeDoubleSize(7, self.high); } if (self.hasLow) { size_ += computeDoubleSize(8, self.low); } if (self.hasVol) { size_ += computeDoubleSize(9, self.vol); } if (self.hasAmount) { size_ += computeDoubleSize(10, self.amount); } if (self.hasFiveDayAvevol) { size_ += computeDoubleSize(11, self.fiveDayAvevol); } { __block SInt32 dataSize = 0; const NSUInteger count = self.selPriceArray.count; dataSize = (SInt32)(8 * count); size_ += dataSize; size_ += (SInt32)(1 * count); } { __block SInt32 dataSize = 0; const NSUInteger count = self.selVolArray.count; dataSize = (SInt32)(8 * count); size_ += dataSize; size_ += (SInt32)(1 * count); } { __block SInt32 dataSize = 0; const NSUInteger count = self.buyPriceArray.count; dataSize = (SInt32)(8 * count); size_ += dataSize; size_ += (SInt32)(1 * count); } { __block SInt32 dataSize = 0; const NSUInteger count = self.buyVolArray.count; dataSize = (SInt32)(8 * count); size_ += dataSize; size_ += (SInt32)(1 * count); } if (self.hasPe) { size_ += computeDoubleSize(16, self.pe); } if (self.hasHhjcap) { size_ += computeDoubleSize(19, self.hhjcap); } if (self.hasRiseVol) { size_ += computeDoubleSize(20, self.riseVol); } if (self.hasDropVol) { size_ += computeDoubleSize(21, self.dropVol); } if (self.hasHsl) { size_ += computeDoubleSize(22, self.hsl); } if (self.hasZgb) { size_ += computeDoubleSize(23, self.zgb); } if (self.hasMgjzc) { size_ += computeDoubleSize(24, self.mgjzc); } if (self.hasMgsy) { size_ += computeDoubleSize(25, self.mgsy); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_report_result_msg*) parseFromData:(NSData*) data { return (s_report_result_msg*)[[[s_report_result_msg builder] mergeFromData:data] build]; } + (s_report_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_report_result_msg*)[[[s_report_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_report_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_report_result_msg*)[[[s_report_result_msg builder] mergeFromInputStream:input] build]; } + (s_report_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_report_result_msg*)[[[s_report_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_report_result_msg*)[[[s_report_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_report_result_msg*)[[[s_report_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_report_result_msgBuilder*) builder { return [[s_report_result_msgBuilder alloc] init]; } + (s_report_result_msgBuilder*) builderWithPrototype:(s_report_result_msg*) prototype { return [[s_report_result_msg builder] mergeFrom:prototype]; } - (s_report_result_msgBuilder*) builder { return [s_report_result_msg builder]; } - (s_report_result_msgBuilder*) toBuilder { return [s_report_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasLastClose) { [output appendFormat:@"%@%@: %@\n", indent, @"lastClose", [NSNumber numberWithDouble:self.lastClose]]; } if (self.hasPbNew) { [output appendFormat:@"%@%@: %@\n", indent, @"pb_new", [NSNumber numberWithDouble:self.pb_new]]; } if (self.hasOpen) { [output appendFormat:@"%@%@: %@\n", indent, @"open", [NSNumber numberWithDouble:self.open]]; } if (self.hasHigh) { [output appendFormat:@"%@%@: %@\n", indent, @"high", [NSNumber numberWithDouble:self.high]]; } if (self.hasLow) { [output appendFormat:@"%@%@: %@\n", indent, @"low", [NSNumber numberWithDouble:self.low]]; } if (self.hasVol) { [output appendFormat:@"%@%@: %@\n", indent, @"vol", [NSNumber numberWithDouble:self.vol]]; } if (self.hasAmount) { [output appendFormat:@"%@%@: %@\n", indent, @"amount", [NSNumber numberWithDouble:self.amount]]; } if (self.hasFiveDayAvevol) { [output appendFormat:@"%@%@: %@\n", indent, @"fiveDayAvevol", [NSNumber numberWithDouble:self.fiveDayAvevol]]; } [self.selPriceArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"selPrice", obj]; }]; [self.selVolArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"selVol", obj]; }]; [self.buyPriceArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"buyPrice", obj]; }]; [self.buyVolArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"buyVol", obj]; }]; if (self.hasPe) { [output appendFormat:@"%@%@: %@\n", indent, @"pe", [NSNumber numberWithDouble:self.pe]]; } if (self.hasHhjcap) { [output appendFormat:@"%@%@: %@\n", indent, @"hhjcap", [NSNumber numberWithDouble:self.hhjcap]]; } if (self.hasRiseVol) { [output appendFormat:@"%@%@: %@\n", indent, @"riseVol", [NSNumber numberWithDouble:self.riseVol]]; } if (self.hasDropVol) { [output appendFormat:@"%@%@: %@\n", indent, @"dropVol", [NSNumber numberWithDouble:self.dropVol]]; } if (self.hasHsl) { [output appendFormat:@"%@%@: %@\n", indent, @"hsl", [NSNumber numberWithDouble:self.hsl]]; } if (self.hasZgb) { [output appendFormat:@"%@%@: %@\n", indent, @"zgb", [NSNumber numberWithDouble:self.zgb]]; } if (self.hasMgjzc) { [output appendFormat:@"%@%@: %@\n", indent, @"mgjzc", [NSNumber numberWithDouble:self.mgjzc]]; } if (self.hasMgsy) { [output appendFormat:@"%@%@: %@\n", indent, @"mgsy", [NSNumber numberWithDouble:self.mgsy]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasLastClose) { [dictionary setObject: [NSNumber numberWithDouble:self.lastClose] forKey: @"lastClose"]; } if (self.hasPbNew) { [dictionary setObject: [NSNumber numberWithDouble:self.pb_new] forKey: @"pb_new"]; } if (self.hasOpen) { [dictionary setObject: [NSNumber numberWithDouble:self.open] forKey: @"open"]; } if (self.hasHigh) { [dictionary setObject: [NSNumber numberWithDouble:self.high] forKey: @"high"]; } if (self.hasLow) { [dictionary setObject: [NSNumber numberWithDouble:self.low] forKey: @"low"]; } if (self.hasVol) { [dictionary setObject: [NSNumber numberWithDouble:self.vol] forKey: @"vol"]; } if (self.hasAmount) { [dictionary setObject: [NSNumber numberWithDouble:self.amount] forKey: @"amount"]; } if (self.hasFiveDayAvevol) { [dictionary setObject: [NSNumber numberWithDouble:self.fiveDayAvevol] forKey: @"fiveDayAvevol"]; } NSMutableArray * selPriceArrayArray = [NSMutableArray new]; NSUInteger selPriceArrayCount=self.selPriceArray.count; for(int i=0;i 0) { if (resultSReportResultMsg.selPriceArray == nil) { resultSReportResultMsg.selPriceArray = [other.selPriceArray copy]; } else { [resultSReportResultMsg.selPriceArray appendArray:other.selPriceArray]; } } if (other.selVolArray.count > 0) { if (resultSReportResultMsg.selVolArray == nil) { resultSReportResultMsg.selVolArray = [other.selVolArray copy]; } else { [resultSReportResultMsg.selVolArray appendArray:other.selVolArray]; } } if (other.buyPriceArray.count > 0) { if (resultSReportResultMsg.buyPriceArray == nil) { resultSReportResultMsg.buyPriceArray = [other.buyPriceArray copy]; } else { [resultSReportResultMsg.buyPriceArray appendArray:other.buyPriceArray]; } } if (other.buyVolArray.count > 0) { if (resultSReportResultMsg.buyVolArray == nil) { resultSReportResultMsg.buyVolArray = [other.buyVolArray copy]; } else { [resultSReportResultMsg.buyVolArray appendArray:other.buyVolArray]; } } if (other.hasPe) { [self setPe:other.pe]; } if (other.hasHhjcap) { [self setHhjcap:other.hhjcap]; } if (other.hasRiseVol) { [self setRiseVol:other.riseVol]; } if (other.hasDropVol) { [self setDropVol:other.dropVol]; } if (other.hasHsl) { [self setHsl:other.hsl]; } if (other.hasZgb) { [self setZgb:other.zgb]; } if (other.hasMgjzc) { [self setMgjzc:other.mgjzc]; } if (other.hasMgsy) { [self setMgsy:other.mgsy]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } case 24: { [self setTime:[input readUInt32]]; break; } case 33: { [self setLastClose:[input readDouble]]; break; } case 41: { [self setPbNew:[input readDouble]]; break; } case 49: { [self setOpen:[input readDouble]]; break; } case 57: { [self setHigh:[input readDouble]]; break; } case 65: { [self setLow:[input readDouble]]; break; } case 73: { [self setVol:[input readDouble]]; break; } case 81: { [self setAmount:[input readDouble]]; break; } case 89: { [self setFiveDayAvevol:[input readDouble]]; break; } case 97: { [self addSelPrice:[input readDouble]]; break; } case 105: { [self addSelVol:[input readDouble]]; break; } case 113: { [self addBuyPrice:[input readDouble]]; break; } case 121: { [self addBuyVol:[input readDouble]]; break; } case 129: { [self setPe:[input readDouble]]; break; } case 153: { [self setHhjcap:[input readDouble]]; break; } case 161: { [self setRiseVol:[input readDouble]]; break; } case 169: { [self setDropVol:[input readDouble]]; break; } case 177: { [self setHsl:[input readDouble]]; break; } case 185: { [self setZgb:[input readDouble]]; break; } case 193: { [self setMgjzc:[input readDouble]]; break; } case 201: { [self setMgsy:[input readDouble]]; break; } } } } - (BOOL) hasCode { return resultSReportResultMsg.hasCode; } - (NSString*) code { return resultSReportResultMsg.code; } - (s_report_result_msgBuilder*) setCode:(NSString*) value { resultSReportResultMsg.hasCode = YES; resultSReportResultMsg.code = value; return self; } - (s_report_result_msgBuilder*) clearCode { resultSReportResultMsg.hasCode = NO; resultSReportResultMsg.code = @""; return self; } - (BOOL) hasName { return resultSReportResultMsg.hasName; } - (NSString*) name { return resultSReportResultMsg.name; } - (s_report_result_msgBuilder*) setName:(NSString*) value { resultSReportResultMsg.hasName = YES; resultSReportResultMsg.name = value; return self; } - (s_report_result_msgBuilder*) clearName { resultSReportResultMsg.hasName = NO; resultSReportResultMsg.name = @""; return self; } - (BOOL) hasTime { return resultSReportResultMsg.hasTime; } - (UInt32) time { return resultSReportResultMsg.time; } - (s_report_result_msgBuilder*) setTime:(UInt32) value { resultSReportResultMsg.hasTime = YES; resultSReportResultMsg.time = value; return self; } - (s_report_result_msgBuilder*) clearTime { resultSReportResultMsg.hasTime = NO; resultSReportResultMsg.time = 0; return self; } - (BOOL) hasLastClose { return resultSReportResultMsg.hasLastClose; } - (Float64) lastClose { return resultSReportResultMsg.lastClose; } - (s_report_result_msgBuilder*) setLastClose:(Float64) value { resultSReportResultMsg.hasLastClose = YES; resultSReportResultMsg.lastClose = value; return self; } - (s_report_result_msgBuilder*) clearLastClose { resultSReportResultMsg.hasLastClose = NO; resultSReportResultMsg.lastClose = 0; return self; } - (BOOL) hasPbNew { return resultSReportResultMsg.hasPbNew; } - (Float64) pb_new { return resultSReportResultMsg.pb_new; } - (s_report_result_msgBuilder*) setPbNew:(Float64) value { resultSReportResultMsg.hasPbNew = YES; resultSReportResultMsg.pb_new = value; return self; } - (s_report_result_msgBuilder*) clearPbNew { resultSReportResultMsg.hasPbNew = NO; resultSReportResultMsg.pb_new = 0; return self; } - (BOOL) hasOpen { return resultSReportResultMsg.hasOpen; } - (Float64) open { return resultSReportResultMsg.open; } - (s_report_result_msgBuilder*) setOpen:(Float64) value { resultSReportResultMsg.hasOpen = YES; resultSReportResultMsg.open = value; return self; } - (s_report_result_msgBuilder*) clearOpen { resultSReportResultMsg.hasOpen = NO; resultSReportResultMsg.open = 0; return self; } - (BOOL) hasHigh { return resultSReportResultMsg.hasHigh; } - (Float64) high { return resultSReportResultMsg.high; } - (s_report_result_msgBuilder*) setHigh:(Float64) value { resultSReportResultMsg.hasHigh = YES; resultSReportResultMsg.high = value; return self; } - (s_report_result_msgBuilder*) clearHigh { resultSReportResultMsg.hasHigh = NO; resultSReportResultMsg.high = 0; return self; } - (BOOL) hasLow { return resultSReportResultMsg.hasLow; } - (Float64) low { return resultSReportResultMsg.low; } - (s_report_result_msgBuilder*) setLow:(Float64) value { resultSReportResultMsg.hasLow = YES; resultSReportResultMsg.low = value; return self; } - (s_report_result_msgBuilder*) clearLow { resultSReportResultMsg.hasLow = NO; resultSReportResultMsg.low = 0; return self; } - (BOOL) hasVol { return resultSReportResultMsg.hasVol; } - (Float64) vol { return resultSReportResultMsg.vol; } - (s_report_result_msgBuilder*) setVol:(Float64) value { resultSReportResultMsg.hasVol = YES; resultSReportResultMsg.vol = value; return self; } - (s_report_result_msgBuilder*) clearVol { resultSReportResultMsg.hasVol = NO; resultSReportResultMsg.vol = 0; return self; } - (BOOL) hasAmount { return resultSReportResultMsg.hasAmount; } - (Float64) amount { return resultSReportResultMsg.amount; } - (s_report_result_msgBuilder*) setAmount:(Float64) value { resultSReportResultMsg.hasAmount = YES; resultSReportResultMsg.amount = value; return self; } - (s_report_result_msgBuilder*) clearAmount { resultSReportResultMsg.hasAmount = NO; resultSReportResultMsg.amount = 0; return self; } - (BOOL) hasFiveDayAvevol { return resultSReportResultMsg.hasFiveDayAvevol; } - (Float64) fiveDayAvevol { return resultSReportResultMsg.fiveDayAvevol; } - (s_report_result_msgBuilder*) setFiveDayAvevol:(Float64) value { resultSReportResultMsg.hasFiveDayAvevol = YES; resultSReportResultMsg.fiveDayAvevol = value; return self; } - (s_report_result_msgBuilder*) clearFiveDayAvevol { resultSReportResultMsg.hasFiveDayAvevol = NO; resultSReportResultMsg.fiveDayAvevol = 0; return self; } - (PBAppendableArray *)selPrice { return resultSReportResultMsg.selPriceArray; } - (Float64)selPriceAtIndex:(NSUInteger)index { return [resultSReportResultMsg selPriceAtIndex:index]; } - (s_report_result_msgBuilder *)addSelPrice:(Float64)value { if (resultSReportResultMsg.selPriceArray == nil) { resultSReportResultMsg.selPriceArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeDouble]; } [resultSReportResultMsg.selPriceArray addDouble:value]; return self; } - (s_report_result_msgBuilder *)setSelPriceArray:(NSArray *)array { resultSReportResultMsg.selPriceArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)setSelPriceValues:(const Float64 *)values count:(NSUInteger)count { resultSReportResultMsg.selPriceArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)clearSelPrice { resultSReportResultMsg.selPriceArray = nil; return self; } - (PBAppendableArray *)selVol { return resultSReportResultMsg.selVolArray; } - (Float64)selVolAtIndex:(NSUInteger)index { return [resultSReportResultMsg selVolAtIndex:index]; } - (s_report_result_msgBuilder *)addSelVol:(Float64)value { if (resultSReportResultMsg.selVolArray == nil) { resultSReportResultMsg.selVolArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeDouble]; } [resultSReportResultMsg.selVolArray addDouble:value]; return self; } - (s_report_result_msgBuilder *)setSelVolArray:(NSArray *)array { resultSReportResultMsg.selVolArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)setSelVolValues:(const Float64 *)values count:(NSUInteger)count { resultSReportResultMsg.selVolArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)clearSelVol { resultSReportResultMsg.selVolArray = nil; return self; } - (PBAppendableArray *)buyPrice { return resultSReportResultMsg.buyPriceArray; } - (Float64)buyPriceAtIndex:(NSUInteger)index { return [resultSReportResultMsg buyPriceAtIndex:index]; } - (s_report_result_msgBuilder *)addBuyPrice:(Float64)value { if (resultSReportResultMsg.buyPriceArray == nil) { resultSReportResultMsg.buyPriceArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeDouble]; } [resultSReportResultMsg.buyPriceArray addDouble:value]; return self; } - (s_report_result_msgBuilder *)setBuyPriceArray:(NSArray *)array { resultSReportResultMsg.buyPriceArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)setBuyPriceValues:(const Float64 *)values count:(NSUInteger)count { resultSReportResultMsg.buyPriceArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)clearBuyPrice { resultSReportResultMsg.buyPriceArray = nil; return self; } - (PBAppendableArray *)buyVol { return resultSReportResultMsg.buyVolArray; } - (Float64)buyVolAtIndex:(NSUInteger)index { return [resultSReportResultMsg buyVolAtIndex:index]; } - (s_report_result_msgBuilder *)addBuyVol:(Float64)value { if (resultSReportResultMsg.buyVolArray == nil) { resultSReportResultMsg.buyVolArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeDouble]; } [resultSReportResultMsg.buyVolArray addDouble:value]; return self; } - (s_report_result_msgBuilder *)setBuyVolArray:(NSArray *)array { resultSReportResultMsg.buyVolArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)setBuyVolValues:(const Float64 *)values count:(NSUInteger)count { resultSReportResultMsg.buyVolArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeDouble]; return self; } - (s_report_result_msgBuilder *)clearBuyVol { resultSReportResultMsg.buyVolArray = nil; return self; } - (BOOL) hasPe { return resultSReportResultMsg.hasPe; } - (Float64) pe { return resultSReportResultMsg.pe; } - (s_report_result_msgBuilder*) setPe:(Float64) value { resultSReportResultMsg.hasPe = YES; resultSReportResultMsg.pe = value; return self; } - (s_report_result_msgBuilder*) clearPe { resultSReportResultMsg.hasPe = NO; resultSReportResultMsg.pe = 0; return self; } - (BOOL) hasHhjcap { return resultSReportResultMsg.hasHhjcap; } - (Float64) hhjcap { return resultSReportResultMsg.hhjcap; } - (s_report_result_msgBuilder*) setHhjcap:(Float64) value { resultSReportResultMsg.hasHhjcap = YES; resultSReportResultMsg.hhjcap = value; return self; } - (s_report_result_msgBuilder*) clearHhjcap { resultSReportResultMsg.hasHhjcap = NO; resultSReportResultMsg.hhjcap = 0; return self; } - (BOOL) hasRiseVol { return resultSReportResultMsg.hasRiseVol; } - (Float64) riseVol { return resultSReportResultMsg.riseVol; } - (s_report_result_msgBuilder*) setRiseVol:(Float64) value { resultSReportResultMsg.hasRiseVol = YES; resultSReportResultMsg.riseVol = value; return self; } - (s_report_result_msgBuilder*) clearRiseVol { resultSReportResultMsg.hasRiseVol = NO; resultSReportResultMsg.riseVol = 0; return self; } - (BOOL) hasDropVol { return resultSReportResultMsg.hasDropVol; } - (Float64) dropVol { return resultSReportResultMsg.dropVol; } - (s_report_result_msgBuilder*) setDropVol:(Float64) value { resultSReportResultMsg.hasDropVol = YES; resultSReportResultMsg.dropVol = value; return self; } - (s_report_result_msgBuilder*) clearDropVol { resultSReportResultMsg.hasDropVol = NO; resultSReportResultMsg.dropVol = 0; return self; } - (BOOL) hasHsl { return resultSReportResultMsg.hasHsl; } - (Float64) hsl { return resultSReportResultMsg.hsl; } - (s_report_result_msgBuilder*) setHsl:(Float64) value { resultSReportResultMsg.hasHsl = YES; resultSReportResultMsg.hsl = value; return self; } - (s_report_result_msgBuilder*) clearHsl { resultSReportResultMsg.hasHsl = NO; resultSReportResultMsg.hsl = 0; return self; } - (BOOL) hasZgb { return resultSReportResultMsg.hasZgb; } - (Float64) zgb { return resultSReportResultMsg.zgb; } - (s_report_result_msgBuilder*) setZgb:(Float64) value { resultSReportResultMsg.hasZgb = YES; resultSReportResultMsg.zgb = value; return self; } - (s_report_result_msgBuilder*) clearZgb { resultSReportResultMsg.hasZgb = NO; resultSReportResultMsg.zgb = 0; return self; } - (BOOL) hasMgjzc { return resultSReportResultMsg.hasMgjzc; } - (Float64) mgjzc { return resultSReportResultMsg.mgjzc; } - (s_report_result_msgBuilder*) setMgjzc:(Float64) value { resultSReportResultMsg.hasMgjzc = YES; resultSReportResultMsg.mgjzc = value; return self; } - (s_report_result_msgBuilder*) clearMgjzc { resultSReportResultMsg.hasMgjzc = NO; resultSReportResultMsg.mgjzc = 0; return self; } - (BOOL) hasMgsy { return resultSReportResultMsg.hasMgsy; } - (Float64) mgsy { return resultSReportResultMsg.mgsy; } - (s_report_result_msgBuilder*) setMgsy:(Float64) value { resultSReportResultMsg.hasMgsy = YES; resultSReportResultMsg.mgsy = value; return self; } - (s_report_result_msgBuilder*) clearMgsy { resultSReportResultMsg.hasMgsy = NO; resultSReportResultMsg.mgsy = 0; return self; } @end @interface s_report_array_result_msg () @property (strong) NSMutableArray * reportDataArray; @end @implementation s_report_array_result_msg @synthesize reportDataArray; @dynamic reportData; - (instancetype) init { if ((self = [super init])) { } return self; } static s_report_array_result_msg* defaults_report_array_result_msgInstance = nil; + (void) initialize { if (self == [s_report_array_result_msg class]) { defaults_report_array_result_msgInstance = [[s_report_array_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_report_array_result_msgInstance; } - (instancetype) defaultInstance { return defaults_report_array_result_msgInstance; } - (NSArray *)reportData { return reportDataArray; } - (s_report_result_msg*)reportDataAtIndex:(NSUInteger)index { return [reportDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitreportData = YES; [self.reportData enumerateObjectsUsingBlock:^(s_report_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitreportData = NO; *stop = YES; } }]; if (!isInitreportData) return isInitreportData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.reportDataArray enumerateObjectsUsingBlock:^(s_report_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.reportDataArray enumerateObjectsUsingBlock:^(s_report_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_report_array_result_msg*) parseFromData:(NSData*) data { return (s_report_array_result_msg*)[[[s_report_array_result_msg builder] mergeFromData:data] build]; } + (s_report_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_report_array_result_msg*)[[[s_report_array_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_report_array_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_report_array_result_msg*)[[[s_report_array_result_msg builder] mergeFromInputStream:input] build]; } + (s_report_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_report_array_result_msg*)[[[s_report_array_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_report_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_report_array_result_msg*)[[[s_report_array_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_report_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_report_array_result_msg*)[[[s_report_array_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_report_array_result_msgBuilder*) builder { return [[s_report_array_result_msgBuilder alloc] init]; } + (s_report_array_result_msgBuilder*) builderWithPrototype:(s_report_array_result_msg*) prototype { return [[s_report_array_result_msg builder] mergeFrom:prototype]; } - (s_report_array_result_msgBuilder*) builder { return [s_report_array_result_msg builder]; } - (s_report_array_result_msgBuilder*) toBuilder { return [s_report_array_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.reportDataArray enumerateObjectsUsingBlock:^(s_report_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"reportData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_report_result_msg* element in self.reportDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"reportData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_report_array_result_msg class]]) { return NO; } s_report_array_result_msg *otherMessage = other; return [self.reportDataArray isEqualToArray:otherMessage.reportDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.reportDataArray enumerateObjectsUsingBlock:^(s_report_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_report_array_result_msgBuilder() @property (strong) s_report_array_result_msg* resultSReportArrayResultMsg; @end @implementation s_report_array_result_msgBuilder @synthesize resultSReportArrayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSReportArrayResultMsg = [[s_report_array_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSReportArrayResultMsg; } - (s_report_array_result_msgBuilder*) clear { self.resultSReportArrayResultMsg = [[s_report_array_result_msg alloc] init]; return self; } - (s_report_array_result_msgBuilder*) clone { return [s_report_array_result_msg builderWithPrototype:resultSReportArrayResultMsg]; } - (s_report_array_result_msg*) defaultInstance { return [s_report_array_result_msg defaultInstance]; } - (s_report_array_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_report_array_result_msg*) buildPartial { s_report_array_result_msg* returnMe = resultSReportArrayResultMsg; self.resultSReportArrayResultMsg = nil; return returnMe; } - (s_report_array_result_msgBuilder*) mergeFrom:(s_report_array_result_msg*) other { if (other == [s_report_array_result_msg defaultInstance]) { return self; } if (other.reportDataArray.count > 0) { if (resultSReportArrayResultMsg.reportDataArray == nil) { resultSReportArrayResultMsg.reportDataArray = [[NSMutableArray alloc] initWithArray:other.reportDataArray]; } else { [resultSReportArrayResultMsg.reportDataArray addObjectsFromArray:other.reportDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_report_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_report_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_report_result_msgBuilder* subBuilder = [s_report_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addReportData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)reportData { return resultSReportArrayResultMsg.reportDataArray; } - (s_report_result_msg*)reportDataAtIndex:(NSUInteger)index { return [resultSReportArrayResultMsg reportDataAtIndex:index]; } - (s_report_array_result_msgBuilder *)addReportData:(s_report_result_msg*)value { if (resultSReportArrayResultMsg.reportDataArray == nil) { resultSReportArrayResultMsg.reportDataArray = [[NSMutableArray alloc]init]; } [resultSReportArrayResultMsg.reportDataArray addObject:value]; return self; } - (s_report_array_result_msgBuilder *)setReportDataArray:(NSArray *)array { resultSReportArrayResultMsg.reportDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_report_array_result_msgBuilder *)clearReportData { resultSReportArrayResultMsg.reportDataArray = nil; return self; } @end @interface s_biddeal_msg () @property (strong) NSString* code; @property (strong) data_selector* selector; @end @implementation s_biddeal_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.selector = [data_selector defaultInstance]; } return self; } static s_biddeal_msg* defaults_biddeal_msgInstance = nil; + (void) initialize { if (self == [s_biddeal_msg class]) { defaults_biddeal_msgInstance = [[s_biddeal_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_biddeal_msgInstance; } - (instancetype) defaultInstance { return defaults_biddeal_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasSelector) { return NO; } if (!self.selector.isInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasSelector) { [output writeMessage:2 value:self.selector]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasSelector) { size_ += computeMessageSize(2, self.selector); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_biddeal_msg*) parseFromData:(NSData*) data { return (s_biddeal_msg*)[[[s_biddeal_msg builder] mergeFromData:data] build]; } + (s_biddeal_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_msg*)[[[s_biddeal_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_biddeal_msg*) parseFromInputStream:(NSInputStream*) input { return (s_biddeal_msg*)[[[s_biddeal_msg builder] mergeFromInputStream:input] build]; } + (s_biddeal_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_msg*)[[[s_biddeal_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_biddeal_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_biddeal_msg*)[[[s_biddeal_msg builder] mergeFromCodedInputStream:input] build]; } + (s_biddeal_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_msg*)[[[s_biddeal_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_biddeal_msgBuilder*) builder { return [[s_biddeal_msgBuilder alloc] init]; } + (s_biddeal_msgBuilder*) builderWithPrototype:(s_biddeal_msg*) prototype { return [[s_biddeal_msg builder] mergeFrom:prototype]; } - (s_biddeal_msgBuilder*) builder { return [s_biddeal_msg builder]; } - (s_biddeal_msgBuilder*) toBuilder { return [s_biddeal_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasSelector) { [output appendFormat:@"%@%@ {\n", indent, @"selector"]; [self.selector writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasSelector) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.selector storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"selector"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_biddeal_msg class]]) { return NO; } s_biddeal_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_biddeal_msgBuilder() @property (strong) s_biddeal_msg* resultSBiddealMsg; @end @implementation s_biddeal_msgBuilder @synthesize resultSBiddealMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBiddealMsg = [[s_biddeal_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBiddealMsg; } - (s_biddeal_msgBuilder*) clear { self.resultSBiddealMsg = [[s_biddeal_msg alloc] init]; return self; } - (s_biddeal_msgBuilder*) clone { return [s_biddeal_msg builderWithPrototype:resultSBiddealMsg]; } - (s_biddeal_msg*) defaultInstance { return [s_biddeal_msg defaultInstance]; } - (s_biddeal_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_biddeal_msg*) buildPartial { s_biddeal_msg* returnMe = resultSBiddealMsg; self.resultSBiddealMsg = nil; return returnMe; } - (s_biddeal_msgBuilder*) mergeFrom:(s_biddeal_msg*) other { if (other == [s_biddeal_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasSelector) { [self mergeSelector:other.selector]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_biddeal_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_biddeal_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { data_selectorBuilder* subBuilder = [data_selector builder]; if (self.hasSelector) { [subBuilder mergeFrom:self.selector]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSelector:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasCode { return resultSBiddealMsg.hasCode; } - (NSString*) code { return resultSBiddealMsg.code; } - (s_biddeal_msgBuilder*) setCode:(NSString*) value { resultSBiddealMsg.hasCode = YES; resultSBiddealMsg.code = value; return self; } - (s_biddeal_msgBuilder*) clearCode { resultSBiddealMsg.hasCode = NO; resultSBiddealMsg.code = @""; return self; } - (BOOL) hasSelector { return resultSBiddealMsg.hasSelector; } - (data_selector*) selector { return resultSBiddealMsg.selector; } - (s_biddeal_msgBuilder*) setSelector:(data_selector*) value { resultSBiddealMsg.hasSelector = YES; resultSBiddealMsg.selector = value; return self; } - (s_biddeal_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue { return [self setSelector:[builderForValue build]]; } - (s_biddeal_msgBuilder*) mergeSelector:(data_selector*) value { if (resultSBiddealMsg.hasSelector && resultSBiddealMsg.selector != [data_selector defaultInstance]) { resultSBiddealMsg.selector = [[[data_selector builderWithPrototype:resultSBiddealMsg.selector] mergeFrom:value] buildPartial]; } else { resultSBiddealMsg.selector = value; } resultSBiddealMsg.hasSelector = YES; return self; } - (s_biddeal_msgBuilder*) clearSelector { resultSBiddealMsg.hasSelector = NO; resultSBiddealMsg.selector = [data_selector defaultInstance]; return self; } @end @interface s_biddeal_result_msg () @property UInt32 time; @property Float64 price; @property Float64 vol; @property Float64 amount; @property Float64 extend; @end @implementation s_biddeal_result_msg - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasPrice { return !!hasPrice_; } - (void) setHasPrice:(BOOL) _value_ { hasPrice_ = !!_value_; } @synthesize price; - (BOOL) hasVol { return !!hasVol_; } - (void) setHasVol:(BOOL) _value_ { hasVol_ = !!_value_; } @synthesize vol; - (BOOL) hasAmount { return !!hasAmount_; } - (void) setHasAmount:(BOOL) _value_ { hasAmount_ = !!_value_; } @synthesize amount; - (BOOL) hasExtend { return !!hasExtend_; } - (void) setHasExtend:(BOOL) _value_ { hasExtend_ = !!_value_; } @synthesize extend; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.price = 0; self.vol = 0; self.amount = 0; self.extend = 0; } return self; } static s_biddeal_result_msg* defaults_biddeal_result_msgInstance = nil; + (void) initialize { if (self == [s_biddeal_result_msg class]) { defaults_biddeal_result_msgInstance = [[s_biddeal_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_biddeal_result_msgInstance; } - (instancetype) defaultInstance { return defaults_biddeal_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasPrice) { return NO; } if (!self.hasVol) { return NO; } if (!self.hasAmount) { return NO; } if (!self.hasExtend) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasPrice) { [output writeDouble:2 value:self.price]; } if (self.hasVol) { [output writeDouble:3 value:self.vol]; } if (self.hasAmount) { [output writeDouble:4 value:self.amount]; } if (self.hasExtend) { [output writeDouble:5 value:self.extend]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasPrice) { size_ += computeDoubleSize(2, self.price); } if (self.hasVol) { size_ += computeDoubleSize(3, self.vol); } if (self.hasAmount) { size_ += computeDoubleSize(4, self.amount); } if (self.hasExtend) { size_ += computeDoubleSize(5, self.extend); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_biddeal_result_msg*) parseFromData:(NSData*) data { return (s_biddeal_result_msg*)[[[s_biddeal_result_msg builder] mergeFromData:data] build]; } + (s_biddeal_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_result_msg*)[[[s_biddeal_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_biddeal_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_biddeal_result_msg*)[[[s_biddeal_result_msg builder] mergeFromInputStream:input] build]; } + (s_biddeal_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_result_msg*)[[[s_biddeal_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_biddeal_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_biddeal_result_msg*)[[[s_biddeal_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_biddeal_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_result_msg*)[[[s_biddeal_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_biddeal_result_msgBuilder*) builder { return [[s_biddeal_result_msgBuilder alloc] init]; } + (s_biddeal_result_msgBuilder*) builderWithPrototype:(s_biddeal_result_msg*) prototype { return [[s_biddeal_result_msg builder] mergeFrom:prototype]; } - (s_biddeal_result_msgBuilder*) builder { return [s_biddeal_result_msg builder]; } - (s_biddeal_result_msgBuilder*) toBuilder { return [s_biddeal_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"price", [NSNumber numberWithDouble:self.price]]; } if (self.hasVol) { [output appendFormat:@"%@%@: %@\n", indent, @"vol", [NSNumber numberWithDouble:self.vol]]; } if (self.hasAmount) { [output appendFormat:@"%@%@: %@\n", indent, @"amount", [NSNumber numberWithDouble:self.amount]]; } if (self.hasExtend) { [output appendFormat:@"%@%@: %@\n", indent, @"extend", [NSNumber numberWithDouble:self.extend]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasPrice) { [dictionary setObject: [NSNumber numberWithDouble:self.price] forKey: @"price"]; } if (self.hasVol) { [dictionary setObject: [NSNumber numberWithDouble:self.vol] forKey: @"vol"]; } if (self.hasAmount) { [dictionary setObject: [NSNumber numberWithDouble:self.amount] forKey: @"amount"]; } if (self.hasExtend) { [dictionary setObject: [NSNumber numberWithDouble:self.extend] forKey: @"extend"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_biddeal_result_msg class]]) { return NO; } s_biddeal_result_msg *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasPrice == otherMessage.hasPrice && (!self.hasPrice || self.price == otherMessage.price) && self.hasVol == otherMessage.hasVol && (!self.hasVol || self.vol == otherMessage.vol) && self.hasAmount == otherMessage.hasAmount && (!self.hasAmount || self.amount == otherMessage.amount) && self.hasExtend == otherMessage.hasExtend && (!self.hasExtend || self.extend == otherMessage.extend) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.price] hash]; } if (self.hasVol) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.vol] hash]; } if (self.hasAmount) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.amount] hash]; } if (self.hasExtend) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.extend] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_biddeal_result_msgBuilder() @property (strong) s_biddeal_result_msg* resultSBiddealResultMsg; @end @implementation s_biddeal_result_msgBuilder @synthesize resultSBiddealResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBiddealResultMsg = [[s_biddeal_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBiddealResultMsg; } - (s_biddeal_result_msgBuilder*) clear { self.resultSBiddealResultMsg = [[s_biddeal_result_msg alloc] init]; return self; } - (s_biddeal_result_msgBuilder*) clone { return [s_biddeal_result_msg builderWithPrototype:resultSBiddealResultMsg]; } - (s_biddeal_result_msg*) defaultInstance { return [s_biddeal_result_msg defaultInstance]; } - (s_biddeal_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_biddeal_result_msg*) buildPartial { s_biddeal_result_msg* returnMe = resultSBiddealResultMsg; self.resultSBiddealResultMsg = nil; return returnMe; } - (s_biddeal_result_msgBuilder*) mergeFrom:(s_biddeal_result_msg*) other { if (other == [s_biddeal_result_msg defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasPrice) { [self setPrice:other.price]; } if (other.hasVol) { [self setVol:other.vol]; } if (other.hasAmount) { [self setAmount:other.amount]; } if (other.hasExtend) { [self setExtend:other.extend]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_biddeal_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_biddeal_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setPrice:[input readDouble]]; break; } case 25: { [self setVol:[input readDouble]]; break; } case 33: { [self setAmount:[input readDouble]]; break; } case 41: { [self setExtend:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultSBiddealResultMsg.hasTime; } - (UInt32) time { return resultSBiddealResultMsg.time; } - (s_biddeal_result_msgBuilder*) setTime:(UInt32) value { resultSBiddealResultMsg.hasTime = YES; resultSBiddealResultMsg.time = value; return self; } - (s_biddeal_result_msgBuilder*) clearTime { resultSBiddealResultMsg.hasTime = NO; resultSBiddealResultMsg.time = 0; return self; } - (BOOL) hasPrice { return resultSBiddealResultMsg.hasPrice; } - (Float64) price { return resultSBiddealResultMsg.price; } - (s_biddeal_result_msgBuilder*) setPrice:(Float64) value { resultSBiddealResultMsg.hasPrice = YES; resultSBiddealResultMsg.price = value; return self; } - (s_biddeal_result_msgBuilder*) clearPrice { resultSBiddealResultMsg.hasPrice = NO; resultSBiddealResultMsg.price = 0; return self; } - (BOOL) hasVol { return resultSBiddealResultMsg.hasVol; } - (Float64) vol { return resultSBiddealResultMsg.vol; } - (s_biddeal_result_msgBuilder*) setVol:(Float64) value { resultSBiddealResultMsg.hasVol = YES; resultSBiddealResultMsg.vol = value; return self; } - (s_biddeal_result_msgBuilder*) clearVol { resultSBiddealResultMsg.hasVol = NO; resultSBiddealResultMsg.vol = 0; return self; } - (BOOL) hasAmount { return resultSBiddealResultMsg.hasAmount; } - (Float64) amount { return resultSBiddealResultMsg.amount; } - (s_biddeal_result_msgBuilder*) setAmount:(Float64) value { resultSBiddealResultMsg.hasAmount = YES; resultSBiddealResultMsg.amount = value; return self; } - (s_biddeal_result_msgBuilder*) clearAmount { resultSBiddealResultMsg.hasAmount = NO; resultSBiddealResultMsg.amount = 0; return self; } - (BOOL) hasExtend { return resultSBiddealResultMsg.hasExtend; } - (Float64) extend { return resultSBiddealResultMsg.extend; } - (s_biddeal_result_msgBuilder*) setExtend:(Float64) value { resultSBiddealResultMsg.hasExtend = YES; resultSBiddealResultMsg.extend = value; return self; } - (s_biddeal_result_msgBuilder*) clearExtend { resultSBiddealResultMsg.hasExtend = NO; resultSBiddealResultMsg.extend = 0; return self; } @end @interface s_biddeal_array_result_msg () @property (strong) NSMutableArray * biddealDataArray; @end @implementation s_biddeal_array_result_msg @synthesize biddealDataArray; @dynamic biddealData; - (instancetype) init { if ((self = [super init])) { } return self; } static s_biddeal_array_result_msg* defaults_biddeal_array_result_msgInstance = nil; + (void) initialize { if (self == [s_biddeal_array_result_msg class]) { defaults_biddeal_array_result_msgInstance = [[s_biddeal_array_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_biddeal_array_result_msgInstance; } - (instancetype) defaultInstance { return defaults_biddeal_array_result_msgInstance; } - (NSArray *)biddealData { return biddealDataArray; } - (s_biddeal_result_msg*)biddealDataAtIndex:(NSUInteger)index { return [biddealDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitbiddealData = YES; [self.biddealData enumerateObjectsUsingBlock:^(s_biddeal_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitbiddealData = NO; *stop = YES; } }]; if (!isInitbiddealData) return isInitbiddealData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.biddealDataArray enumerateObjectsUsingBlock:^(s_biddeal_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.biddealDataArray enumerateObjectsUsingBlock:^(s_biddeal_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_biddeal_array_result_msg*) parseFromData:(NSData*) data { return (s_biddeal_array_result_msg*)[[[s_biddeal_array_result_msg builder] mergeFromData:data] build]; } + (s_biddeal_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_array_result_msg*)[[[s_biddeal_array_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_biddeal_array_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_biddeal_array_result_msg*)[[[s_biddeal_array_result_msg builder] mergeFromInputStream:input] build]; } + (s_biddeal_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_array_result_msg*)[[[s_biddeal_array_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_biddeal_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_biddeal_array_result_msg*)[[[s_biddeal_array_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_biddeal_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_biddeal_array_result_msg*)[[[s_biddeal_array_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_biddeal_array_result_msgBuilder*) builder { return [[s_biddeal_array_result_msgBuilder alloc] init]; } + (s_biddeal_array_result_msgBuilder*) builderWithPrototype:(s_biddeal_array_result_msg*) prototype { return [[s_biddeal_array_result_msg builder] mergeFrom:prototype]; } - (s_biddeal_array_result_msgBuilder*) builder { return [s_biddeal_array_result_msg builder]; } - (s_biddeal_array_result_msgBuilder*) toBuilder { return [s_biddeal_array_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.biddealDataArray enumerateObjectsUsingBlock:^(s_biddeal_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"biddealData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_biddeal_result_msg* element in self.biddealDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"biddealData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_biddeal_array_result_msg class]]) { return NO; } s_biddeal_array_result_msg *otherMessage = other; return [self.biddealDataArray isEqualToArray:otherMessage.biddealDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.biddealDataArray enumerateObjectsUsingBlock:^(s_biddeal_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_biddeal_array_result_msgBuilder() @property (strong) s_biddeal_array_result_msg* resultSBiddealArrayResultMsg; @end @implementation s_biddeal_array_result_msgBuilder @synthesize resultSBiddealArrayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBiddealArrayResultMsg = [[s_biddeal_array_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBiddealArrayResultMsg; } - (s_biddeal_array_result_msgBuilder*) clear { self.resultSBiddealArrayResultMsg = [[s_biddeal_array_result_msg alloc] init]; return self; } - (s_biddeal_array_result_msgBuilder*) clone { return [s_biddeal_array_result_msg builderWithPrototype:resultSBiddealArrayResultMsg]; } - (s_biddeal_array_result_msg*) defaultInstance { return [s_biddeal_array_result_msg defaultInstance]; } - (s_biddeal_array_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_biddeal_array_result_msg*) buildPartial { s_biddeal_array_result_msg* returnMe = resultSBiddealArrayResultMsg; self.resultSBiddealArrayResultMsg = nil; return returnMe; } - (s_biddeal_array_result_msgBuilder*) mergeFrom:(s_biddeal_array_result_msg*) other { if (other == [s_biddeal_array_result_msg defaultInstance]) { return self; } if (other.biddealDataArray.count > 0) { if (resultSBiddealArrayResultMsg.biddealDataArray == nil) { resultSBiddealArrayResultMsg.biddealDataArray = [[NSMutableArray alloc] initWithArray:other.biddealDataArray]; } else { [resultSBiddealArrayResultMsg.biddealDataArray addObjectsFromArray:other.biddealDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_biddeal_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_biddeal_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_biddeal_result_msgBuilder* subBuilder = [s_biddeal_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addBiddealData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)biddealData { return resultSBiddealArrayResultMsg.biddealDataArray; } - (s_biddeal_result_msg*)biddealDataAtIndex:(NSUInteger)index { return [resultSBiddealArrayResultMsg biddealDataAtIndex:index]; } - (s_biddeal_array_result_msgBuilder *)addBiddealData:(s_biddeal_result_msg*)value { if (resultSBiddealArrayResultMsg.biddealDataArray == nil) { resultSBiddealArrayResultMsg.biddealDataArray = [[NSMutableArray alloc]init]; } [resultSBiddealArrayResultMsg.biddealDataArray addObject:value]; return self; } - (s_biddeal_array_result_msgBuilder *)setBiddealDataArray:(NSArray *)array { resultSBiddealArrayResultMsg.biddealDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_biddeal_array_result_msgBuilder *)clearBiddealData { resultSBiddealArrayResultMsg.biddealDataArray = nil; return self; } @end @interface s_kline_msg () @property (strong) NSString* code; @property report_data_cycle cycle; @property (strong) data_selector* selector; @end @implementation s_kline_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasCycle { return !!hasCycle_; } - (void) setHasCycle:(BOOL) _value_ { hasCycle_ = !!_value_; } @synthesize cycle; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.cycle = report_data_cycleReportDataCycleBegin; self.selector = [data_selector defaultInstance]; } return self; } static s_kline_msg* defaults_kline_msgInstance = nil; + (void) initialize { if (self == [s_kline_msg class]) { defaults_kline_msgInstance = [[s_kline_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_kline_msgInstance; } - (instancetype) defaultInstance { return defaults_kline_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasCycle) { return NO; } if (!self.hasSelector) { return NO; } if (!self.selector.isInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasCycle) { [output writeEnum:2 value:self.cycle]; } if (self.hasSelector) { [output writeMessage:3 value:self.selector]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasCycle) { size_ += computeEnumSize(2, self.cycle); } if (self.hasSelector) { size_ += computeMessageSize(3, self.selector); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_kline_msg*) parseFromData:(NSData*) data { return (s_kline_msg*)[[[s_kline_msg builder] mergeFromData:data] build]; } + (s_kline_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_msg*)[[[s_kline_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_kline_msg*) parseFromInputStream:(NSInputStream*) input { return (s_kline_msg*)[[[s_kline_msg builder] mergeFromInputStream:input] build]; } + (s_kline_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_msg*)[[[s_kline_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_kline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_kline_msg*)[[[s_kline_msg builder] mergeFromCodedInputStream:input] build]; } + (s_kline_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_msg*)[[[s_kline_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_kline_msgBuilder*) builder { return [[s_kline_msgBuilder alloc] init]; } + (s_kline_msgBuilder*) builderWithPrototype:(s_kline_msg*) prototype { return [[s_kline_msg builder] mergeFrom:prototype]; } - (s_kline_msgBuilder*) builder { return [s_kline_msg builder]; } - (s_kline_msgBuilder*) toBuilder { return [s_kline_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasCycle) { [output appendFormat:@"%@%@: %@\n", indent, @"cycle", NSStringFromreport_data_cycle(self.cycle)]; } if (self.hasSelector) { [output appendFormat:@"%@%@ {\n", indent, @"selector"]; [self.selector writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasCycle) { [dictionary setObject: @(self.cycle) forKey: @"cycle"]; } if (self.hasSelector) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.selector storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"selector"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_kline_msg class]]) { return NO; } s_kline_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasCycle == otherMessage.hasCycle && (!self.hasCycle || self.cycle == otherMessage.cycle) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasCycle) { hashCode = hashCode * 31 + self.cycle; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_kline_msgBuilder() @property (strong) s_kline_msg* resultSKlineMsg; @end @implementation s_kline_msgBuilder @synthesize resultSKlineMsg; - (instancetype) init { if ((self = [super init])) { self.resultSKlineMsg = [[s_kline_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSKlineMsg; } - (s_kline_msgBuilder*) clear { self.resultSKlineMsg = [[s_kline_msg alloc] init]; return self; } - (s_kline_msgBuilder*) clone { return [s_kline_msg builderWithPrototype:resultSKlineMsg]; } - (s_kline_msg*) defaultInstance { return [s_kline_msg defaultInstance]; } - (s_kline_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_kline_msg*) buildPartial { s_kline_msg* returnMe = resultSKlineMsg; self.resultSKlineMsg = nil; return returnMe; } - (s_kline_msgBuilder*) mergeFrom:(s_kline_msg*) other { if (other == [s_kline_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasCycle) { [self setCycle:other.cycle]; } if (other.hasSelector) { [self mergeSelector:other.selector]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_kline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_kline_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 16: { report_data_cycle value = (report_data_cycle)[input readEnum]; if (report_data_cycleIsValidValue(value)) { [self setCycle:value]; } else { [unknownFields mergeVarintField:2 value:value]; } break; } case 26: { data_selectorBuilder* subBuilder = [data_selector builder]; if (self.hasSelector) { [subBuilder mergeFrom:self.selector]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSelector:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasCode { return resultSKlineMsg.hasCode; } - (NSString*) code { return resultSKlineMsg.code; } - (s_kline_msgBuilder*) setCode:(NSString*) value { resultSKlineMsg.hasCode = YES; resultSKlineMsg.code = value; return self; } - (s_kline_msgBuilder*) clearCode { resultSKlineMsg.hasCode = NO; resultSKlineMsg.code = @""; return self; } - (BOOL) hasCycle { return resultSKlineMsg.hasCycle; } - (report_data_cycle) cycle { return resultSKlineMsg.cycle; } - (s_kline_msgBuilder*) setCycle:(report_data_cycle) value { resultSKlineMsg.hasCycle = YES; resultSKlineMsg.cycle = value; return self; } - (s_kline_msgBuilder*) clearCycle { resultSKlineMsg.hasCycle = NO; resultSKlineMsg.cycle = report_data_cycleReportDataCycleBegin; return self; } - (BOOL) hasSelector { return resultSKlineMsg.hasSelector; } - (data_selector*) selector { return resultSKlineMsg.selector; } - (s_kline_msgBuilder*) setSelector:(data_selector*) value { resultSKlineMsg.hasSelector = YES; resultSKlineMsg.selector = value; return self; } - (s_kline_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue { return [self setSelector:[builderForValue build]]; } - (s_kline_msgBuilder*) mergeSelector:(data_selector*) value { if (resultSKlineMsg.hasSelector && resultSKlineMsg.selector != [data_selector defaultInstance]) { resultSKlineMsg.selector = [[[data_selector builderWithPrototype:resultSKlineMsg.selector] mergeFrom:value] buildPartial]; } else { resultSKlineMsg.selector = value; } resultSKlineMsg.hasSelector = YES; return self; } - (s_kline_msgBuilder*) clearSelector { resultSKlineMsg.hasSelector = NO; resultSKlineMsg.selector = [data_selector defaultInstance]; return self; } @end @interface s_kline_result_msg () @property UInt32 time; @property Float64 open; @property Float64 high; @property Float64 close; @property Float64 low; @property Float64 vol; @property Float64 amount; @property Float64 hsl; @property Float64 zdf; @end @implementation s_kline_result_msg - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasOpen { return !!hasOpen_; } - (void) setHasOpen:(BOOL) _value_ { hasOpen_ = !!_value_; } @synthesize open; - (BOOL) hasHigh { return !!hasHigh_; } - (void) setHasHigh:(BOOL) _value_ { hasHigh_ = !!_value_; } @synthesize high; - (BOOL) hasClose { return !!hasClose_; } - (void) setHasClose:(BOOL) _value_ { hasClose_ = !!_value_; } @synthesize close; - (BOOL) hasLow { return !!hasLow_; } - (void) setHasLow:(BOOL) _value_ { hasLow_ = !!_value_; } @synthesize low; - (BOOL) hasVol { return !!hasVol_; } - (void) setHasVol:(BOOL) _value_ { hasVol_ = !!_value_; } @synthesize vol; - (BOOL) hasAmount { return !!hasAmount_; } - (void) setHasAmount:(BOOL) _value_ { hasAmount_ = !!_value_; } @synthesize amount; - (BOOL) hasHsl { return !!hasHsl_; } - (void) setHasHsl:(BOOL) _value_ { hasHsl_ = !!_value_; } @synthesize hsl; - (BOOL) hasZdf { return !!hasZdf_; } - (void) setHasZdf:(BOOL) _value_ { hasZdf_ = !!_value_; } @synthesize zdf; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.open = 0; self.high = 0; self.close = 0; self.low = 0; self.vol = 0; self.amount = 0; self.hsl = 0; self.zdf = 0; } return self; } static s_kline_result_msg* defaults_kline_result_msgInstance = nil; + (void) initialize { if (self == [s_kline_result_msg class]) { defaults_kline_result_msgInstance = [[s_kline_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_kline_result_msgInstance; } - (instancetype) defaultInstance { return defaults_kline_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasOpen) { return NO; } if (!self.hasHigh) { return NO; } if (!self.hasClose) { return NO; } if (!self.hasLow) { return NO; } if (!self.hasVol) { return NO; } if (!self.hasAmount) { return NO; } if (!self.hasHsl) { return NO; } if (!self.hasZdf) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasOpen) { [output writeDouble:2 value:self.open]; } if (self.hasHigh) { [output writeDouble:3 value:self.high]; } if (self.hasClose) { [output writeDouble:4 value:self.close]; } if (self.hasLow) { [output writeDouble:5 value:self.low]; } if (self.hasVol) { [output writeDouble:6 value:self.vol]; } if (self.hasAmount) { [output writeDouble:7 value:self.amount]; } if (self.hasHsl) { [output writeDouble:8 value:self.hsl]; } if (self.hasZdf) { [output writeDouble:9 value:self.zdf]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasOpen) { size_ += computeDoubleSize(2, self.open); } if (self.hasHigh) { size_ += computeDoubleSize(3, self.high); } if (self.hasClose) { size_ += computeDoubleSize(4, self.close); } if (self.hasLow) { size_ += computeDoubleSize(5, self.low); } if (self.hasVol) { size_ += computeDoubleSize(6, self.vol); } if (self.hasAmount) { size_ += computeDoubleSize(7, self.amount); } if (self.hasHsl) { size_ += computeDoubleSize(8, self.hsl); } if (self.hasZdf) { size_ += computeDoubleSize(9, self.zdf); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_kline_result_msg*) parseFromData:(NSData*) data { return (s_kline_result_msg*)[[[s_kline_result_msg builder] mergeFromData:data] build]; } + (s_kline_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_result_msg*)[[[s_kline_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_kline_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_kline_result_msg*)[[[s_kline_result_msg builder] mergeFromInputStream:input] build]; } + (s_kline_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_result_msg*)[[[s_kline_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_kline_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_kline_result_msg*)[[[s_kline_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_kline_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_result_msg*)[[[s_kline_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_kline_result_msgBuilder*) builder { return [[s_kline_result_msgBuilder alloc] init]; } + (s_kline_result_msgBuilder*) builderWithPrototype:(s_kline_result_msg*) prototype { return [[s_kline_result_msg builder] mergeFrom:prototype]; } - (s_kline_result_msgBuilder*) builder { return [s_kline_result_msg builder]; } - (s_kline_result_msgBuilder*) toBuilder { return [s_kline_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasOpen) { [output appendFormat:@"%@%@: %@\n", indent, @"open", [NSNumber numberWithDouble:self.open]]; } if (self.hasHigh) { [output appendFormat:@"%@%@: %@\n", indent, @"high", [NSNumber numberWithDouble:self.high]]; } if (self.hasClose) { [output appendFormat:@"%@%@: %@\n", indent, @"close", [NSNumber numberWithDouble:self.close]]; } if (self.hasLow) { [output appendFormat:@"%@%@: %@\n", indent, @"low", [NSNumber numberWithDouble:self.low]]; } if (self.hasVol) { [output appendFormat:@"%@%@: %@\n", indent, @"vol", [NSNumber numberWithDouble:self.vol]]; } if (self.hasAmount) { [output appendFormat:@"%@%@: %@\n", indent, @"amount", [NSNumber numberWithDouble:self.amount]]; } if (self.hasHsl) { [output appendFormat:@"%@%@: %@\n", indent, @"hsl", [NSNumber numberWithDouble:self.hsl]]; } if (self.hasZdf) { [output appendFormat:@"%@%@: %@\n", indent, @"zdf", [NSNumber numberWithDouble:self.zdf]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasOpen) { [dictionary setObject: [NSNumber numberWithDouble:self.open] forKey: @"open"]; } if (self.hasHigh) { [dictionary setObject: [NSNumber numberWithDouble:self.high] forKey: @"high"]; } if (self.hasClose) { [dictionary setObject: [NSNumber numberWithDouble:self.close] forKey: @"close"]; } if (self.hasLow) { [dictionary setObject: [NSNumber numberWithDouble:self.low] forKey: @"low"]; } if (self.hasVol) { [dictionary setObject: [NSNumber numberWithDouble:self.vol] forKey: @"vol"]; } if (self.hasAmount) { [dictionary setObject: [NSNumber numberWithDouble:self.amount] forKey: @"amount"]; } if (self.hasHsl) { [dictionary setObject: [NSNumber numberWithDouble:self.hsl] forKey: @"hsl"]; } if (self.hasZdf) { [dictionary setObject: [NSNumber numberWithDouble:self.zdf] forKey: @"zdf"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_kline_result_msg class]]) { return NO; } s_kline_result_msg *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasOpen == otherMessage.hasOpen && (!self.hasOpen || self.open == otherMessage.open) && self.hasHigh == otherMessage.hasHigh && (!self.hasHigh || self.high == otherMessage.high) && self.hasClose == otherMessage.hasClose && (!self.hasClose || self.close == otherMessage.close) && self.hasLow == otherMessage.hasLow && (!self.hasLow || self.low == otherMessage.low) && self.hasVol == otherMessage.hasVol && (!self.hasVol || self.vol == otherMessage.vol) && self.hasAmount == otherMessage.hasAmount && (!self.hasAmount || self.amount == otherMessage.amount) && self.hasHsl == otherMessage.hasHsl && (!self.hasHsl || self.hsl == otherMessage.hsl) && self.hasZdf == otherMessage.hasZdf && (!self.hasZdf || self.zdf == otherMessage.zdf) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasOpen) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.open] hash]; } if (self.hasHigh) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.high] hash]; } if (self.hasClose) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.close] hash]; } if (self.hasLow) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.low] hash]; } if (self.hasVol) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.vol] hash]; } if (self.hasAmount) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.amount] hash]; } if (self.hasHsl) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.hsl] hash]; } if (self.hasZdf) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.zdf] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_kline_result_msgBuilder() @property (strong) s_kline_result_msg* resultSKlineResultMsg; @end @implementation s_kline_result_msgBuilder @synthesize resultSKlineResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSKlineResultMsg = [[s_kline_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSKlineResultMsg; } - (s_kline_result_msgBuilder*) clear { self.resultSKlineResultMsg = [[s_kline_result_msg alloc] init]; return self; } - (s_kline_result_msgBuilder*) clone { return [s_kline_result_msg builderWithPrototype:resultSKlineResultMsg]; } - (s_kline_result_msg*) defaultInstance { return [s_kline_result_msg defaultInstance]; } - (s_kline_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_kline_result_msg*) buildPartial { s_kline_result_msg* returnMe = resultSKlineResultMsg; self.resultSKlineResultMsg = nil; return returnMe; } - (s_kline_result_msgBuilder*) mergeFrom:(s_kline_result_msg*) other { if (other == [s_kline_result_msg defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasOpen) { [self setOpen:other.open]; } if (other.hasHigh) { [self setHigh:other.high]; } if (other.hasClose) { [self setClose:other.close]; } if (other.hasLow) { [self setLow:other.low]; } if (other.hasVol) { [self setVol:other.vol]; } if (other.hasAmount) { [self setAmount:other.amount]; } if (other.hasHsl) { [self setHsl:other.hsl]; } if (other.hasZdf) { [self setZdf:other.zdf]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_kline_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_kline_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setOpen:[input readDouble]]; break; } case 25: { [self setHigh:[input readDouble]]; break; } case 33: { [self setClose:[input readDouble]]; break; } case 41: { [self setLow:[input readDouble]]; break; } case 49: { [self setVol:[input readDouble]]; break; } case 57: { [self setAmount:[input readDouble]]; break; } case 65: { [self setHsl:[input readDouble]]; break; } case 73: { [self setZdf:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultSKlineResultMsg.hasTime; } - (UInt32) time { return resultSKlineResultMsg.time; } - (s_kline_result_msgBuilder*) setTime:(UInt32) value { resultSKlineResultMsg.hasTime = YES; resultSKlineResultMsg.time = value; return self; } - (s_kline_result_msgBuilder*) clearTime { resultSKlineResultMsg.hasTime = NO; resultSKlineResultMsg.time = 0; return self; } - (BOOL) hasOpen { return resultSKlineResultMsg.hasOpen; } - (Float64) open { return resultSKlineResultMsg.open; } - (s_kline_result_msgBuilder*) setOpen:(Float64) value { resultSKlineResultMsg.hasOpen = YES; resultSKlineResultMsg.open = value; return self; } - (s_kline_result_msgBuilder*) clearOpen { resultSKlineResultMsg.hasOpen = NO; resultSKlineResultMsg.open = 0; return self; } - (BOOL) hasHigh { return resultSKlineResultMsg.hasHigh; } - (Float64) high { return resultSKlineResultMsg.high; } - (s_kline_result_msgBuilder*) setHigh:(Float64) value { resultSKlineResultMsg.hasHigh = YES; resultSKlineResultMsg.high = value; return self; } - (s_kline_result_msgBuilder*) clearHigh { resultSKlineResultMsg.hasHigh = NO; resultSKlineResultMsg.high = 0; return self; } - (BOOL) hasClose { return resultSKlineResultMsg.hasClose; } - (Float64) close { return resultSKlineResultMsg.close; } - (s_kline_result_msgBuilder*) setClose:(Float64) value { resultSKlineResultMsg.hasClose = YES; resultSKlineResultMsg.close = value; return self; } - (s_kline_result_msgBuilder*) clearClose { resultSKlineResultMsg.hasClose = NO; resultSKlineResultMsg.close = 0; return self; } - (BOOL) hasLow { return resultSKlineResultMsg.hasLow; } - (Float64) low { return resultSKlineResultMsg.low; } - (s_kline_result_msgBuilder*) setLow:(Float64) value { resultSKlineResultMsg.hasLow = YES; resultSKlineResultMsg.low = value; return self; } - (s_kline_result_msgBuilder*) clearLow { resultSKlineResultMsg.hasLow = NO; resultSKlineResultMsg.low = 0; return self; } - (BOOL) hasVol { return resultSKlineResultMsg.hasVol; } - (Float64) vol { return resultSKlineResultMsg.vol; } - (s_kline_result_msgBuilder*) setVol:(Float64) value { resultSKlineResultMsg.hasVol = YES; resultSKlineResultMsg.vol = value; return self; } - (s_kline_result_msgBuilder*) clearVol { resultSKlineResultMsg.hasVol = NO; resultSKlineResultMsg.vol = 0; return self; } - (BOOL) hasAmount { return resultSKlineResultMsg.hasAmount; } - (Float64) amount { return resultSKlineResultMsg.amount; } - (s_kline_result_msgBuilder*) setAmount:(Float64) value { resultSKlineResultMsg.hasAmount = YES; resultSKlineResultMsg.amount = value; return self; } - (s_kline_result_msgBuilder*) clearAmount { resultSKlineResultMsg.hasAmount = NO; resultSKlineResultMsg.amount = 0; return self; } - (BOOL) hasHsl { return resultSKlineResultMsg.hasHsl; } - (Float64) hsl { return resultSKlineResultMsg.hsl; } - (s_kline_result_msgBuilder*) setHsl:(Float64) value { resultSKlineResultMsg.hasHsl = YES; resultSKlineResultMsg.hsl = value; return self; } - (s_kline_result_msgBuilder*) clearHsl { resultSKlineResultMsg.hasHsl = NO; resultSKlineResultMsg.hsl = 0; return self; } - (BOOL) hasZdf { return resultSKlineResultMsg.hasZdf; } - (Float64) zdf { return resultSKlineResultMsg.zdf; } - (s_kline_result_msgBuilder*) setZdf:(Float64) value { resultSKlineResultMsg.hasZdf = YES; resultSKlineResultMsg.zdf = value; return self; } - (s_kline_result_msgBuilder*) clearZdf { resultSKlineResultMsg.hasZdf = NO; resultSKlineResultMsg.zdf = 0; return self; } @end @interface s_kline_array_result_msg () @property (strong) NSMutableArray * klineDataArray; @end @implementation s_kline_array_result_msg @synthesize klineDataArray; @dynamic klineData; - (instancetype) init { if ((self = [super init])) { } return self; } static s_kline_array_result_msg* defaults_kline_array_result_msgInstance = nil; + (void) initialize { if (self == [s_kline_array_result_msg class]) { defaults_kline_array_result_msgInstance = [[s_kline_array_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_kline_array_result_msgInstance; } - (instancetype) defaultInstance { return defaults_kline_array_result_msgInstance; } - (NSArray *)klineData { return klineDataArray; } - (s_kline_result_msg*)klineDataAtIndex:(NSUInteger)index { return [klineDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitklineData = YES; [self.klineData enumerateObjectsUsingBlock:^(s_kline_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitklineData = NO; *stop = YES; } }]; if (!isInitklineData) return isInitklineData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.klineDataArray enumerateObjectsUsingBlock:^(s_kline_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.klineDataArray enumerateObjectsUsingBlock:^(s_kline_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_kline_array_result_msg*) parseFromData:(NSData*) data { return (s_kline_array_result_msg*)[[[s_kline_array_result_msg builder] mergeFromData:data] build]; } + (s_kline_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_array_result_msg*)[[[s_kline_array_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_kline_array_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_kline_array_result_msg*)[[[s_kline_array_result_msg builder] mergeFromInputStream:input] build]; } + (s_kline_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_array_result_msg*)[[[s_kline_array_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_kline_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_kline_array_result_msg*)[[[s_kline_array_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_kline_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_kline_array_result_msg*)[[[s_kline_array_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_kline_array_result_msgBuilder*) builder { return [[s_kline_array_result_msgBuilder alloc] init]; } + (s_kline_array_result_msgBuilder*) builderWithPrototype:(s_kline_array_result_msg*) prototype { return [[s_kline_array_result_msg builder] mergeFrom:prototype]; } - (s_kline_array_result_msgBuilder*) builder { return [s_kline_array_result_msg builder]; } - (s_kline_array_result_msgBuilder*) toBuilder { return [s_kline_array_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.klineDataArray enumerateObjectsUsingBlock:^(s_kline_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"klineData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_kline_result_msg* element in self.klineDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"klineData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_kline_array_result_msg class]]) { return NO; } s_kline_array_result_msg *otherMessage = other; return [self.klineDataArray isEqualToArray:otherMessage.klineDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.klineDataArray enumerateObjectsUsingBlock:^(s_kline_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_kline_array_result_msgBuilder() @property (strong) s_kline_array_result_msg* resultSKlineArrayResultMsg; @end @implementation s_kline_array_result_msgBuilder @synthesize resultSKlineArrayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSKlineArrayResultMsg = [[s_kline_array_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSKlineArrayResultMsg; } - (s_kline_array_result_msgBuilder*) clear { self.resultSKlineArrayResultMsg = [[s_kline_array_result_msg alloc] init]; return self; } - (s_kline_array_result_msgBuilder*) clone { return [s_kline_array_result_msg builderWithPrototype:resultSKlineArrayResultMsg]; } - (s_kline_array_result_msg*) defaultInstance { return [s_kline_array_result_msg defaultInstance]; } - (s_kline_array_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_kline_array_result_msg*) buildPartial { s_kline_array_result_msg* returnMe = resultSKlineArrayResultMsg; self.resultSKlineArrayResultMsg = nil; return returnMe; } - (s_kline_array_result_msgBuilder*) mergeFrom:(s_kline_array_result_msg*) other { if (other == [s_kline_array_result_msg defaultInstance]) { return self; } if (other.klineDataArray.count > 0) { if (resultSKlineArrayResultMsg.klineDataArray == nil) { resultSKlineArrayResultMsg.klineDataArray = [[NSMutableArray alloc] initWithArray:other.klineDataArray]; } else { [resultSKlineArrayResultMsg.klineDataArray addObjectsFromArray:other.klineDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_kline_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_kline_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_kline_result_msgBuilder* subBuilder = [s_kline_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addKlineData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)klineData { return resultSKlineArrayResultMsg.klineDataArray; } - (s_kline_result_msg*)klineDataAtIndex:(NSUInteger)index { return [resultSKlineArrayResultMsg klineDataAtIndex:index]; } - (s_kline_array_result_msgBuilder *)addKlineData:(s_kline_result_msg*)value { if (resultSKlineArrayResultMsg.klineDataArray == nil) { resultSKlineArrayResultMsg.klineDataArray = [[NSMutableArray alloc]init]; } [resultSKlineArrayResultMsg.klineDataArray addObject:value]; return self; } - (s_kline_array_result_msgBuilder *)setKlineDataArray:(NSArray *)array { resultSKlineArrayResultMsg.klineDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_kline_array_result_msgBuilder *)clearKlineData { resultSKlineArrayResultMsg.klineDataArray = nil; return self; } @end @interface s_keep_msg () @property (strong) NSString* code; @end @implementation s_keep_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (instancetype) init { if ((self = [super init])) { self.code = @""; } return self; } static s_keep_msg* defaults_keep_msgInstance = nil; + (void) initialize { if (self == [s_keep_msg class]) { defaults_keep_msgInstance = [[s_keep_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_keep_msgInstance; } - (instancetype) defaultInstance { return defaults_keep_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_keep_msg*) parseFromData:(NSData*) data { return (s_keep_msg*)[[[s_keep_msg builder] mergeFromData:data] build]; } + (s_keep_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_msg*)[[[s_keep_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_keep_msg*) parseFromInputStream:(NSInputStream*) input { return (s_keep_msg*)[[[s_keep_msg builder] mergeFromInputStream:input] build]; } + (s_keep_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_msg*)[[[s_keep_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_keep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_keep_msg*)[[[s_keep_msg builder] mergeFromCodedInputStream:input] build]; } + (s_keep_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_msg*)[[[s_keep_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_keep_msgBuilder*) builder { return [[s_keep_msgBuilder alloc] init]; } + (s_keep_msgBuilder*) builderWithPrototype:(s_keep_msg*) prototype { return [[s_keep_msg builder] mergeFrom:prototype]; } - (s_keep_msgBuilder*) builder { return [s_keep_msg builder]; } - (s_keep_msgBuilder*) toBuilder { return [s_keep_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_keep_msg class]]) { return NO; } s_keep_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_keep_msgBuilder() @property (strong) s_keep_msg* resultSKeepMsg; @end @implementation s_keep_msgBuilder @synthesize resultSKeepMsg; - (instancetype) init { if ((self = [super init])) { self.resultSKeepMsg = [[s_keep_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSKeepMsg; } - (s_keep_msgBuilder*) clear { self.resultSKeepMsg = [[s_keep_msg alloc] init]; return self; } - (s_keep_msgBuilder*) clone { return [s_keep_msg builderWithPrototype:resultSKeepMsg]; } - (s_keep_msg*) defaultInstance { return [s_keep_msg defaultInstance]; } - (s_keep_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_keep_msg*) buildPartial { s_keep_msg* returnMe = resultSKeepMsg; self.resultSKeepMsg = nil; return returnMe; } - (s_keep_msgBuilder*) mergeFrom:(s_keep_msg*) other { if (other == [s_keep_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_keep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_keep_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } } } } - (BOOL) hasCode { return resultSKeepMsg.hasCode; } - (NSString*) code { return resultSKeepMsg.code; } - (s_keep_msgBuilder*) setCode:(NSString*) value { resultSKeepMsg.hasCode = YES; resultSKeepMsg.code = value; return self; } - (s_keep_msgBuilder*) clearCode { resultSKeepMsg.hasCode = NO; resultSKeepMsg.code = @""; return self; } @end @interface s_keep_result_msg () @property (strong) NSString* code; @property (strong) NSString* name; @property Float64 vol; @property Float64 buyKeep; @property Float64 sellKeep; @property Float64 volDiu; @property Float64 buyKeepDiu; @property Float64 sellKeepDiu; @end @implementation s_keep_result_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasVol { return !!hasVol_; } - (void) setHasVol:(BOOL) _value_ { hasVol_ = !!_value_; } @synthesize vol; - (BOOL) hasBuyKeep { return !!hasBuyKeep_; } - (void) setHasBuyKeep:(BOOL) _value_ { hasBuyKeep_ = !!_value_; } @synthesize buyKeep; - (BOOL) hasSellKeep { return !!hasSellKeep_; } - (void) setHasSellKeep:(BOOL) _value_ { hasSellKeep_ = !!_value_; } @synthesize sellKeep; - (BOOL) hasVolDiu { return !!hasVolDiu_; } - (void) setHasVolDiu:(BOOL) _value_ { hasVolDiu_ = !!_value_; } @synthesize volDiu; - (BOOL) hasBuyKeepDiu { return !!hasBuyKeepDiu_; } - (void) setHasBuyKeepDiu:(BOOL) _value_ { hasBuyKeepDiu_ = !!_value_; } @synthesize buyKeepDiu; - (BOOL) hasSellKeepDiu { return !!hasSellKeepDiu_; } - (void) setHasSellKeepDiu:(BOOL) _value_ { hasSellKeepDiu_ = !!_value_; } @synthesize sellKeepDiu; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; self.vol = 0; self.buyKeep = 0; self.sellKeep = 0; self.volDiu = 0; self.buyKeepDiu = 0; self.sellKeepDiu = 0; } return self; } static s_keep_result_msg* defaults_keep_result_msgInstance = nil; + (void) initialize { if (self == [s_keep_result_msg class]) { defaults_keep_result_msgInstance = [[s_keep_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_keep_result_msgInstance; } - (instancetype) defaultInstance { return defaults_keep_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } if (!self.hasVol) { return NO; } if (!self.hasBuyKeep) { return NO; } if (!self.hasSellKeep) { return NO; } if (!self.hasVolDiu) { return NO; } if (!self.hasBuyKeepDiu) { return NO; } if (!self.hasSellKeepDiu) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } if (self.hasVol) { [output writeDouble:3 value:self.vol]; } if (self.hasBuyKeep) { [output writeDouble:4 value:self.buyKeep]; } if (self.hasSellKeep) { [output writeDouble:5 value:self.sellKeep]; } if (self.hasVolDiu) { [output writeDouble:6 value:self.volDiu]; } if (self.hasBuyKeepDiu) { [output writeDouble:7 value:self.buyKeepDiu]; } if (self.hasSellKeepDiu) { [output writeDouble:8 value:self.sellKeepDiu]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } if (self.hasVol) { size_ += computeDoubleSize(3, self.vol); } if (self.hasBuyKeep) { size_ += computeDoubleSize(4, self.buyKeep); } if (self.hasSellKeep) { size_ += computeDoubleSize(5, self.sellKeep); } if (self.hasVolDiu) { size_ += computeDoubleSize(6, self.volDiu); } if (self.hasBuyKeepDiu) { size_ += computeDoubleSize(7, self.buyKeepDiu); } if (self.hasSellKeepDiu) { size_ += computeDoubleSize(8, self.sellKeepDiu); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_keep_result_msg*) parseFromData:(NSData*) data { return (s_keep_result_msg*)[[[s_keep_result_msg builder] mergeFromData:data] build]; } + (s_keep_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_result_msg*)[[[s_keep_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_keep_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_keep_result_msg*)[[[s_keep_result_msg builder] mergeFromInputStream:input] build]; } + (s_keep_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_result_msg*)[[[s_keep_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_keep_result_msg*)[[[s_keep_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_result_msg*)[[[s_keep_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_keep_result_msgBuilder*) builder { return [[s_keep_result_msgBuilder alloc] init]; } + (s_keep_result_msgBuilder*) builderWithPrototype:(s_keep_result_msg*) prototype { return [[s_keep_result_msg builder] mergeFrom:prototype]; } - (s_keep_result_msgBuilder*) builder { return [s_keep_result_msg builder]; } - (s_keep_result_msgBuilder*) toBuilder { return [s_keep_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasVol) { [output appendFormat:@"%@%@: %@\n", indent, @"vol", [NSNumber numberWithDouble:self.vol]]; } if (self.hasBuyKeep) { [output appendFormat:@"%@%@: %@\n", indent, @"buyKeep", [NSNumber numberWithDouble:self.buyKeep]]; } if (self.hasSellKeep) { [output appendFormat:@"%@%@: %@\n", indent, @"sellKeep", [NSNumber numberWithDouble:self.sellKeep]]; } if (self.hasVolDiu) { [output appendFormat:@"%@%@: %@\n", indent, @"volDiu", [NSNumber numberWithDouble:self.volDiu]]; } if (self.hasBuyKeepDiu) { [output appendFormat:@"%@%@: %@\n", indent, @"buyKeepDiu", [NSNumber numberWithDouble:self.buyKeepDiu]]; } if (self.hasSellKeepDiu) { [output appendFormat:@"%@%@: %@\n", indent, @"sellKeepDiu", [NSNumber numberWithDouble:self.sellKeepDiu]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasVol) { [dictionary setObject: [NSNumber numberWithDouble:self.vol] forKey: @"vol"]; } if (self.hasBuyKeep) { [dictionary setObject: [NSNumber numberWithDouble:self.buyKeep] forKey: @"buyKeep"]; } if (self.hasSellKeep) { [dictionary setObject: [NSNumber numberWithDouble:self.sellKeep] forKey: @"sellKeep"]; } if (self.hasVolDiu) { [dictionary setObject: [NSNumber numberWithDouble:self.volDiu] forKey: @"volDiu"]; } if (self.hasBuyKeepDiu) { [dictionary setObject: [NSNumber numberWithDouble:self.buyKeepDiu] forKey: @"buyKeepDiu"]; } if (self.hasSellKeepDiu) { [dictionary setObject: [NSNumber numberWithDouble:self.sellKeepDiu] forKey: @"sellKeepDiu"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_keep_result_msg class]]) { return NO; } s_keep_result_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasVol == otherMessage.hasVol && (!self.hasVol || self.vol == otherMessage.vol) && self.hasBuyKeep == otherMessage.hasBuyKeep && (!self.hasBuyKeep || self.buyKeep == otherMessage.buyKeep) && self.hasSellKeep == otherMessage.hasSellKeep && (!self.hasSellKeep || self.sellKeep == otherMessage.sellKeep) && self.hasVolDiu == otherMessage.hasVolDiu && (!self.hasVolDiu || self.volDiu == otherMessage.volDiu) && self.hasBuyKeepDiu == otherMessage.hasBuyKeepDiu && (!self.hasBuyKeepDiu || self.buyKeepDiu == otherMessage.buyKeepDiu) && self.hasSellKeepDiu == otherMessage.hasSellKeepDiu && (!self.hasSellKeepDiu || self.sellKeepDiu == otherMessage.sellKeepDiu) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasVol) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.vol] hash]; } if (self.hasBuyKeep) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.buyKeep] hash]; } if (self.hasSellKeep) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.sellKeep] hash]; } if (self.hasVolDiu) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.volDiu] hash]; } if (self.hasBuyKeepDiu) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.buyKeepDiu] hash]; } if (self.hasSellKeepDiu) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.sellKeepDiu] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_keep_result_msgBuilder() @property (strong) s_keep_result_msg* resultSKeepResultMsg; @end @implementation s_keep_result_msgBuilder @synthesize resultSKeepResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSKeepResultMsg = [[s_keep_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSKeepResultMsg; } - (s_keep_result_msgBuilder*) clear { self.resultSKeepResultMsg = [[s_keep_result_msg alloc] init]; return self; } - (s_keep_result_msgBuilder*) clone { return [s_keep_result_msg builderWithPrototype:resultSKeepResultMsg]; } - (s_keep_result_msg*) defaultInstance { return [s_keep_result_msg defaultInstance]; } - (s_keep_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_keep_result_msg*) buildPartial { s_keep_result_msg* returnMe = resultSKeepResultMsg; self.resultSKeepResultMsg = nil; return returnMe; } - (s_keep_result_msgBuilder*) mergeFrom:(s_keep_result_msg*) other { if (other == [s_keep_result_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.hasVol) { [self setVol:other.vol]; } if (other.hasBuyKeep) { [self setBuyKeep:other.buyKeep]; } if (other.hasSellKeep) { [self setSellKeep:other.sellKeep]; } if (other.hasVolDiu) { [self setVolDiu:other.volDiu]; } if (other.hasBuyKeepDiu) { [self setBuyKeepDiu:other.buyKeepDiu]; } if (other.hasSellKeepDiu) { [self setSellKeepDiu:other.sellKeepDiu]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } case 25: { [self setVol:[input readDouble]]; break; } case 33: { [self setBuyKeep:[input readDouble]]; break; } case 41: { [self setSellKeep:[input readDouble]]; break; } case 49: { [self setVolDiu:[input readDouble]]; break; } case 57: { [self setBuyKeepDiu:[input readDouble]]; break; } case 65: { [self setSellKeepDiu:[input readDouble]]; break; } } } } - (BOOL) hasCode { return resultSKeepResultMsg.hasCode; } - (NSString*) code { return resultSKeepResultMsg.code; } - (s_keep_result_msgBuilder*) setCode:(NSString*) value { resultSKeepResultMsg.hasCode = YES; resultSKeepResultMsg.code = value; return self; } - (s_keep_result_msgBuilder*) clearCode { resultSKeepResultMsg.hasCode = NO; resultSKeepResultMsg.code = @""; return self; } - (BOOL) hasName { return resultSKeepResultMsg.hasName; } - (NSString*) name { return resultSKeepResultMsg.name; } - (s_keep_result_msgBuilder*) setName:(NSString*) value { resultSKeepResultMsg.hasName = YES; resultSKeepResultMsg.name = value; return self; } - (s_keep_result_msgBuilder*) clearName { resultSKeepResultMsg.hasName = NO; resultSKeepResultMsg.name = @""; return self; } - (BOOL) hasVol { return resultSKeepResultMsg.hasVol; } - (Float64) vol { return resultSKeepResultMsg.vol; } - (s_keep_result_msgBuilder*) setVol:(Float64) value { resultSKeepResultMsg.hasVol = YES; resultSKeepResultMsg.vol = value; return self; } - (s_keep_result_msgBuilder*) clearVol { resultSKeepResultMsg.hasVol = NO; resultSKeepResultMsg.vol = 0; return self; } - (BOOL) hasBuyKeep { return resultSKeepResultMsg.hasBuyKeep; } - (Float64) buyKeep { return resultSKeepResultMsg.buyKeep; } - (s_keep_result_msgBuilder*) setBuyKeep:(Float64) value { resultSKeepResultMsg.hasBuyKeep = YES; resultSKeepResultMsg.buyKeep = value; return self; } - (s_keep_result_msgBuilder*) clearBuyKeep { resultSKeepResultMsg.hasBuyKeep = NO; resultSKeepResultMsg.buyKeep = 0; return self; } - (BOOL) hasSellKeep { return resultSKeepResultMsg.hasSellKeep; } - (Float64) sellKeep { return resultSKeepResultMsg.sellKeep; } - (s_keep_result_msgBuilder*) setSellKeep:(Float64) value { resultSKeepResultMsg.hasSellKeep = YES; resultSKeepResultMsg.sellKeep = value; return self; } - (s_keep_result_msgBuilder*) clearSellKeep { resultSKeepResultMsg.hasSellKeep = NO; resultSKeepResultMsg.sellKeep = 0; return self; } - (BOOL) hasVolDiu { return resultSKeepResultMsg.hasVolDiu; } - (Float64) volDiu { return resultSKeepResultMsg.volDiu; } - (s_keep_result_msgBuilder*) setVolDiu:(Float64) value { resultSKeepResultMsg.hasVolDiu = YES; resultSKeepResultMsg.volDiu = value; return self; } - (s_keep_result_msgBuilder*) clearVolDiu { resultSKeepResultMsg.hasVolDiu = NO; resultSKeepResultMsg.volDiu = 0; return self; } - (BOOL) hasBuyKeepDiu { return resultSKeepResultMsg.hasBuyKeepDiu; } - (Float64) buyKeepDiu { return resultSKeepResultMsg.buyKeepDiu; } - (s_keep_result_msgBuilder*) setBuyKeepDiu:(Float64) value { resultSKeepResultMsg.hasBuyKeepDiu = YES; resultSKeepResultMsg.buyKeepDiu = value; return self; } - (s_keep_result_msgBuilder*) clearBuyKeepDiu { resultSKeepResultMsg.hasBuyKeepDiu = NO; resultSKeepResultMsg.buyKeepDiu = 0; return self; } - (BOOL) hasSellKeepDiu { return resultSKeepResultMsg.hasSellKeepDiu; } - (Float64) sellKeepDiu { return resultSKeepResultMsg.sellKeepDiu; } - (s_keep_result_msgBuilder*) setSellKeepDiu:(Float64) value { resultSKeepResultMsg.hasSellKeepDiu = YES; resultSKeepResultMsg.sellKeepDiu = value; return self; } - (s_keep_result_msgBuilder*) clearSellKeepDiu { resultSKeepResultMsg.hasSellKeepDiu = NO; resultSKeepResultMsg.sellKeepDiu = 0; return self; } @end @interface s_keep_array_result_msg () @property (strong) NSMutableArray * keepDataArray; @end @implementation s_keep_array_result_msg @synthesize keepDataArray; @dynamic keepData; - (instancetype) init { if ((self = [super init])) { } return self; } static s_keep_array_result_msg* defaults_keep_array_result_msgInstance = nil; + (void) initialize { if (self == [s_keep_array_result_msg class]) { defaults_keep_array_result_msgInstance = [[s_keep_array_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_keep_array_result_msgInstance; } - (instancetype) defaultInstance { return defaults_keep_array_result_msgInstance; } - (NSArray *)keepData { return keepDataArray; } - (s_keep_result_msg*)keepDataAtIndex:(NSUInteger)index { return [keepDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitkeepData = YES; [self.keepData enumerateObjectsUsingBlock:^(s_keep_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitkeepData = NO; *stop = YES; } }]; if (!isInitkeepData) return isInitkeepData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.keepDataArray enumerateObjectsUsingBlock:^(s_keep_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.keepDataArray enumerateObjectsUsingBlock:^(s_keep_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_keep_array_result_msg*) parseFromData:(NSData*) data { return (s_keep_array_result_msg*)[[[s_keep_array_result_msg builder] mergeFromData:data] build]; } + (s_keep_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_array_result_msg*)[[[s_keep_array_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_keep_array_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_keep_array_result_msg*)[[[s_keep_array_result_msg builder] mergeFromInputStream:input] build]; } + (s_keep_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_array_result_msg*)[[[s_keep_array_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_keep_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_keep_array_result_msg*)[[[s_keep_array_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_keep_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_keep_array_result_msg*)[[[s_keep_array_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_keep_array_result_msgBuilder*) builder { return [[s_keep_array_result_msgBuilder alloc] init]; } + (s_keep_array_result_msgBuilder*) builderWithPrototype:(s_keep_array_result_msg*) prototype { return [[s_keep_array_result_msg builder] mergeFrom:prototype]; } - (s_keep_array_result_msgBuilder*) builder { return [s_keep_array_result_msg builder]; } - (s_keep_array_result_msgBuilder*) toBuilder { return [s_keep_array_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.keepDataArray enumerateObjectsUsingBlock:^(s_keep_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"keepData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_keep_result_msg* element in self.keepDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"keepData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_keep_array_result_msg class]]) { return NO; } s_keep_array_result_msg *otherMessage = other; return [self.keepDataArray isEqualToArray:otherMessage.keepDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.keepDataArray enumerateObjectsUsingBlock:^(s_keep_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_keep_array_result_msgBuilder() @property (strong) s_keep_array_result_msg* resultSKeepArrayResultMsg; @end @implementation s_keep_array_result_msgBuilder @synthesize resultSKeepArrayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSKeepArrayResultMsg = [[s_keep_array_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSKeepArrayResultMsg; } - (s_keep_array_result_msgBuilder*) clear { self.resultSKeepArrayResultMsg = [[s_keep_array_result_msg alloc] init]; return self; } - (s_keep_array_result_msgBuilder*) clone { return [s_keep_array_result_msg builderWithPrototype:resultSKeepArrayResultMsg]; } - (s_keep_array_result_msg*) defaultInstance { return [s_keep_array_result_msg defaultInstance]; } - (s_keep_array_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_keep_array_result_msg*) buildPartial { s_keep_array_result_msg* returnMe = resultSKeepArrayResultMsg; self.resultSKeepArrayResultMsg = nil; return returnMe; } - (s_keep_array_result_msgBuilder*) mergeFrom:(s_keep_array_result_msg*) other { if (other == [s_keep_array_result_msg defaultInstance]) { return self; } if (other.keepDataArray.count > 0) { if (resultSKeepArrayResultMsg.keepDataArray == nil) { resultSKeepArrayResultMsg.keepDataArray = [[NSMutableArray alloc] initWithArray:other.keepDataArray]; } else { [resultSKeepArrayResultMsg.keepDataArray addObjectsFromArray:other.keepDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_keep_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_keep_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_keep_result_msgBuilder* subBuilder = [s_keep_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addKeepData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)keepData { return resultSKeepArrayResultMsg.keepDataArray; } - (s_keep_result_msg*)keepDataAtIndex:(NSUInteger)index { return [resultSKeepArrayResultMsg keepDataAtIndex:index]; } - (s_keep_array_result_msgBuilder *)addKeepData:(s_keep_result_msg*)value { if (resultSKeepArrayResultMsg.keepDataArray == nil) { resultSKeepArrayResultMsg.keepDataArray = [[NSMutableArray alloc]init]; } [resultSKeepArrayResultMsg.keepDataArray addObject:value]; return self; } - (s_keep_array_result_msgBuilder *)setKeepDataArray:(NSArray *)array { resultSKeepArrayResultMsg.keepDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_keep_array_result_msgBuilder *)clearKeepData { resultSKeepArrayResultMsg.keepDataArray = nil; return self; } @end @interface s_minute_msg () @property (strong) NSString* code; @property (strong) data_selector* selector; @end @implementation s_minute_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.selector = [data_selector defaultInstance]; } return self; } static s_minute_msg* defaults_minute_msgInstance = nil; + (void) initialize { if (self == [s_minute_msg class]) { defaults_minute_msgInstance = [[s_minute_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_minute_msgInstance; } - (instancetype) defaultInstance { return defaults_minute_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasSelector) { return NO; } if (!self.selector.isInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasSelector) { [output writeMessage:2 value:self.selector]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasSelector) { size_ += computeMessageSize(2, self.selector); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_minute_msg*) parseFromData:(NSData*) data { return (s_minute_msg*)[[[s_minute_msg builder] mergeFromData:data] build]; } + (s_minute_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_msg*)[[[s_minute_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_minute_msg*) parseFromInputStream:(NSInputStream*) input { return (s_minute_msg*)[[[s_minute_msg builder] mergeFromInputStream:input] build]; } + (s_minute_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_msg*)[[[s_minute_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_minute_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_minute_msg*)[[[s_minute_msg builder] mergeFromCodedInputStream:input] build]; } + (s_minute_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_msg*)[[[s_minute_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_minute_msgBuilder*) builder { return [[s_minute_msgBuilder alloc] init]; } + (s_minute_msgBuilder*) builderWithPrototype:(s_minute_msg*) prototype { return [[s_minute_msg builder] mergeFrom:prototype]; } - (s_minute_msgBuilder*) builder { return [s_minute_msg builder]; } - (s_minute_msgBuilder*) toBuilder { return [s_minute_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasSelector) { [output appendFormat:@"%@%@ {\n", indent, @"selector"]; [self.selector writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasSelector) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.selector storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"selector"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_minute_msg class]]) { return NO; } s_minute_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_minute_msgBuilder() @property (strong) s_minute_msg* resultSMinuteMsg; @end @implementation s_minute_msgBuilder @synthesize resultSMinuteMsg; - (instancetype) init { if ((self = [super init])) { self.resultSMinuteMsg = [[s_minute_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSMinuteMsg; } - (s_minute_msgBuilder*) clear { self.resultSMinuteMsg = [[s_minute_msg alloc] init]; return self; } - (s_minute_msgBuilder*) clone { return [s_minute_msg builderWithPrototype:resultSMinuteMsg]; } - (s_minute_msg*) defaultInstance { return [s_minute_msg defaultInstance]; } - (s_minute_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_minute_msg*) buildPartial { s_minute_msg* returnMe = resultSMinuteMsg; self.resultSMinuteMsg = nil; return returnMe; } - (s_minute_msgBuilder*) mergeFrom:(s_minute_msg*) other { if (other == [s_minute_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasSelector) { [self mergeSelector:other.selector]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_minute_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_minute_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { data_selectorBuilder* subBuilder = [data_selector builder]; if (self.hasSelector) { [subBuilder mergeFrom:self.selector]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSelector:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasCode { return resultSMinuteMsg.hasCode; } - (NSString*) code { return resultSMinuteMsg.code; } - (s_minute_msgBuilder*) setCode:(NSString*) value { resultSMinuteMsg.hasCode = YES; resultSMinuteMsg.code = value; return self; } - (s_minute_msgBuilder*) clearCode { resultSMinuteMsg.hasCode = NO; resultSMinuteMsg.code = @""; return self; } - (BOOL) hasSelector { return resultSMinuteMsg.hasSelector; } - (data_selector*) selector { return resultSMinuteMsg.selector; } - (s_minute_msgBuilder*) setSelector:(data_selector*) value { resultSMinuteMsg.hasSelector = YES; resultSMinuteMsg.selector = value; return self; } - (s_minute_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue { return [self setSelector:[builderForValue build]]; } - (s_minute_msgBuilder*) mergeSelector:(data_selector*) value { if (resultSMinuteMsg.hasSelector && resultSMinuteMsg.selector != [data_selector defaultInstance]) { resultSMinuteMsg.selector = [[[data_selector builderWithPrototype:resultSMinuteMsg.selector] mergeFrom:value] buildPartial]; } else { resultSMinuteMsg.selector = value; } resultSMinuteMsg.hasSelector = YES; return self; } - (s_minute_msgBuilder*) clearSelector { resultSMinuteMsg.hasSelector = NO; resultSMinuteMsg.selector = [data_selector defaultInstance]; return self; } @end @interface s_minute_result_msg () @property UInt32 time; @property Float64 price; @property Float64 vol; @property Float64 amount; @end @implementation s_minute_result_msg - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (BOOL) hasPrice { return !!hasPrice_; } - (void) setHasPrice:(BOOL) _value_ { hasPrice_ = !!_value_; } @synthesize price; - (BOOL) hasVol { return !!hasVol_; } - (void) setHasVol:(BOOL) _value_ { hasVol_ = !!_value_; } @synthesize vol; - (BOOL) hasAmount { return !!hasAmount_; } - (void) setHasAmount:(BOOL) _value_ { hasAmount_ = !!_value_; } @synthesize amount; - (instancetype) init { if ((self = [super init])) { self.time = 0; self.price = 0; self.vol = 0; self.amount = 0; } return self; } static s_minute_result_msg* defaults_minute_result_msgInstance = nil; + (void) initialize { if (self == [s_minute_result_msg class]) { defaults_minute_result_msgInstance = [[s_minute_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_minute_result_msgInstance; } - (instancetype) defaultInstance { return defaults_minute_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasTime) { return NO; } if (!self.hasPrice) { return NO; } if (!self.hasVol) { return NO; } if (!self.hasAmount) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasTime) { [output writeUInt32:1 value:self.time]; } if (self.hasPrice) { [output writeDouble:2 value:self.price]; } if (self.hasVol) { [output writeDouble:3 value:self.vol]; } if (self.hasAmount) { [output writeDouble:4 value:self.amount]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasTime) { size_ += computeUInt32Size(1, self.time); } if (self.hasPrice) { size_ += computeDoubleSize(2, self.price); } if (self.hasVol) { size_ += computeDoubleSize(3, self.vol); } if (self.hasAmount) { size_ += computeDoubleSize(4, self.amount); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_minute_result_msg*) parseFromData:(NSData*) data { return (s_minute_result_msg*)[[[s_minute_result_msg builder] mergeFromData:data] build]; } + (s_minute_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_result_msg*)[[[s_minute_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_minute_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_minute_result_msg*)[[[s_minute_result_msg builder] mergeFromInputStream:input] build]; } + (s_minute_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_result_msg*)[[[s_minute_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_minute_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_minute_result_msg*)[[[s_minute_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_minute_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_result_msg*)[[[s_minute_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_minute_result_msgBuilder*) builder { return [[s_minute_result_msgBuilder alloc] init]; } + (s_minute_result_msgBuilder*) builderWithPrototype:(s_minute_result_msg*) prototype { return [[s_minute_result_msg builder] mergeFrom:prototype]; } - (s_minute_result_msgBuilder*) builder { return [s_minute_result_msg builder]; } - (s_minute_result_msgBuilder*) toBuilder { return [s_minute_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } if (self.hasPrice) { [output appendFormat:@"%@%@: %@\n", indent, @"price", [NSNumber numberWithDouble:self.price]]; } if (self.hasVol) { [output appendFormat:@"%@%@: %@\n", indent, @"vol", [NSNumber numberWithDouble:self.vol]]; } if (self.hasAmount) { [output appendFormat:@"%@%@: %@\n", indent, @"amount", [NSNumber numberWithDouble:self.amount]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } if (self.hasPrice) { [dictionary setObject: [NSNumber numberWithDouble:self.price] forKey: @"price"]; } if (self.hasVol) { [dictionary setObject: [NSNumber numberWithDouble:self.vol] forKey: @"vol"]; } if (self.hasAmount) { [dictionary setObject: [NSNumber numberWithDouble:self.amount] forKey: @"amount"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_minute_result_msg class]]) { return NO; } s_minute_result_msg *otherMessage = other; return self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && self.hasPrice == otherMessage.hasPrice && (!self.hasPrice || self.price == otherMessage.price) && self.hasVol == otherMessage.hasVol && (!self.hasVol || self.vol == otherMessage.vol) && self.hasAmount == otherMessage.hasAmount && (!self.hasAmount || self.amount == otherMessage.amount) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } if (self.hasPrice) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.price] hash]; } if (self.hasVol) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.vol] hash]; } if (self.hasAmount) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.amount] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_minute_result_msgBuilder() @property (strong) s_minute_result_msg* resultSMinuteResultMsg; @end @implementation s_minute_result_msgBuilder @synthesize resultSMinuteResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSMinuteResultMsg = [[s_minute_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSMinuteResultMsg; } - (s_minute_result_msgBuilder*) clear { self.resultSMinuteResultMsg = [[s_minute_result_msg alloc] init]; return self; } - (s_minute_result_msgBuilder*) clone { return [s_minute_result_msg builderWithPrototype:resultSMinuteResultMsg]; } - (s_minute_result_msg*) defaultInstance { return [s_minute_result_msg defaultInstance]; } - (s_minute_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_minute_result_msg*) buildPartial { s_minute_result_msg* returnMe = resultSMinuteResultMsg; self.resultSMinuteResultMsg = nil; return returnMe; } - (s_minute_result_msgBuilder*) mergeFrom:(s_minute_result_msg*) other { if (other == [s_minute_result_msg defaultInstance]) { return self; } if (other.hasTime) { [self setTime:other.time]; } if (other.hasPrice) { [self setPrice:other.price]; } if (other.hasVol) { [self setVol:other.vol]; } if (other.hasAmount) { [self setAmount:other.amount]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_minute_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_minute_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setTime:[input readUInt32]]; break; } case 17: { [self setPrice:[input readDouble]]; break; } case 25: { [self setVol:[input readDouble]]; break; } case 33: { [self setAmount:[input readDouble]]; break; } } } } - (BOOL) hasTime { return resultSMinuteResultMsg.hasTime; } - (UInt32) time { return resultSMinuteResultMsg.time; } - (s_minute_result_msgBuilder*) setTime:(UInt32) value { resultSMinuteResultMsg.hasTime = YES; resultSMinuteResultMsg.time = value; return self; } - (s_minute_result_msgBuilder*) clearTime { resultSMinuteResultMsg.hasTime = NO; resultSMinuteResultMsg.time = 0; return self; } - (BOOL) hasPrice { return resultSMinuteResultMsg.hasPrice; } - (Float64) price { return resultSMinuteResultMsg.price; } - (s_minute_result_msgBuilder*) setPrice:(Float64) value { resultSMinuteResultMsg.hasPrice = YES; resultSMinuteResultMsg.price = value; return self; } - (s_minute_result_msgBuilder*) clearPrice { resultSMinuteResultMsg.hasPrice = NO; resultSMinuteResultMsg.price = 0; return self; } - (BOOL) hasVol { return resultSMinuteResultMsg.hasVol; } - (Float64) vol { return resultSMinuteResultMsg.vol; } - (s_minute_result_msgBuilder*) setVol:(Float64) value { resultSMinuteResultMsg.hasVol = YES; resultSMinuteResultMsg.vol = value; return self; } - (s_minute_result_msgBuilder*) clearVol { resultSMinuteResultMsg.hasVol = NO; resultSMinuteResultMsg.vol = 0; return self; } - (BOOL) hasAmount { return resultSMinuteResultMsg.hasAmount; } - (Float64) amount { return resultSMinuteResultMsg.amount; } - (s_minute_result_msgBuilder*) setAmount:(Float64) value { resultSMinuteResultMsg.hasAmount = YES; resultSMinuteResultMsg.amount = value; return self; } - (s_minute_result_msgBuilder*) clearAmount { resultSMinuteResultMsg.hasAmount = NO; resultSMinuteResultMsg.amount = 0; return self; } @end @interface s_minute_array_result_msg () @property (strong) NSMutableArray * minuteDataArray; @end @implementation s_minute_array_result_msg @synthesize minuteDataArray; @dynamic minuteData; - (instancetype) init { if ((self = [super init])) { } return self; } static s_minute_array_result_msg* defaults_minute_array_result_msgInstance = nil; + (void) initialize { if (self == [s_minute_array_result_msg class]) { defaults_minute_array_result_msgInstance = [[s_minute_array_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_minute_array_result_msgInstance; } - (instancetype) defaultInstance { return defaults_minute_array_result_msgInstance; } - (NSArray *)minuteData { return minuteDataArray; } - (s_minute_result_msg*)minuteDataAtIndex:(NSUInteger)index { return [minuteDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitminuteData = YES; [self.minuteData enumerateObjectsUsingBlock:^(s_minute_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitminuteData = NO; *stop = YES; } }]; if (!isInitminuteData) return isInitminuteData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.minuteDataArray enumerateObjectsUsingBlock:^(s_minute_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.minuteDataArray enumerateObjectsUsingBlock:^(s_minute_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_minute_array_result_msg*) parseFromData:(NSData*) data { return (s_minute_array_result_msg*)[[[s_minute_array_result_msg builder] mergeFromData:data] build]; } + (s_minute_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_array_result_msg*)[[[s_minute_array_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_minute_array_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_minute_array_result_msg*)[[[s_minute_array_result_msg builder] mergeFromInputStream:input] build]; } + (s_minute_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_array_result_msg*)[[[s_minute_array_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_minute_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_minute_array_result_msg*)[[[s_minute_array_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_minute_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_minute_array_result_msg*)[[[s_minute_array_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_minute_array_result_msgBuilder*) builder { return [[s_minute_array_result_msgBuilder alloc] init]; } + (s_minute_array_result_msgBuilder*) builderWithPrototype:(s_minute_array_result_msg*) prototype { return [[s_minute_array_result_msg builder] mergeFrom:prototype]; } - (s_minute_array_result_msgBuilder*) builder { return [s_minute_array_result_msg builder]; } - (s_minute_array_result_msgBuilder*) toBuilder { return [s_minute_array_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.minuteDataArray enumerateObjectsUsingBlock:^(s_minute_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"minuteData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_minute_result_msg* element in self.minuteDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"minuteData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_minute_array_result_msg class]]) { return NO; } s_minute_array_result_msg *otherMessage = other; return [self.minuteDataArray isEqualToArray:otherMessage.minuteDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.minuteDataArray enumerateObjectsUsingBlock:^(s_minute_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_minute_array_result_msgBuilder() @property (strong) s_minute_array_result_msg* resultSMinuteArrayResultMsg; @end @implementation s_minute_array_result_msgBuilder @synthesize resultSMinuteArrayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSMinuteArrayResultMsg = [[s_minute_array_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSMinuteArrayResultMsg; } - (s_minute_array_result_msgBuilder*) clear { self.resultSMinuteArrayResultMsg = [[s_minute_array_result_msg alloc] init]; return self; } - (s_minute_array_result_msgBuilder*) clone { return [s_minute_array_result_msg builderWithPrototype:resultSMinuteArrayResultMsg]; } - (s_minute_array_result_msg*) defaultInstance { return [s_minute_array_result_msg defaultInstance]; } - (s_minute_array_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_minute_array_result_msg*) buildPartial { s_minute_array_result_msg* returnMe = resultSMinuteArrayResultMsg; self.resultSMinuteArrayResultMsg = nil; return returnMe; } - (s_minute_array_result_msgBuilder*) mergeFrom:(s_minute_array_result_msg*) other { if (other == [s_minute_array_result_msg defaultInstance]) { return self; } if (other.minuteDataArray.count > 0) { if (resultSMinuteArrayResultMsg.minuteDataArray == nil) { resultSMinuteArrayResultMsg.minuteDataArray = [[NSMutableArray alloc] initWithArray:other.minuteDataArray]; } else { [resultSMinuteArrayResultMsg.minuteDataArray addObjectsFromArray:other.minuteDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_minute_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_minute_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_minute_result_msgBuilder* subBuilder = [s_minute_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addMinuteData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)minuteData { return resultSMinuteArrayResultMsg.minuteDataArray; } - (s_minute_result_msg*)minuteDataAtIndex:(NSUInteger)index { return [resultSMinuteArrayResultMsg minuteDataAtIndex:index]; } - (s_minute_array_result_msgBuilder *)addMinuteData:(s_minute_result_msg*)value { if (resultSMinuteArrayResultMsg.minuteDataArray == nil) { resultSMinuteArrayResultMsg.minuteDataArray = [[NSMutableArray alloc]init]; } [resultSMinuteArrayResultMsg.minuteDataArray addObject:value]; return self; } - (s_minute_array_result_msgBuilder *)setMinuteDataArray:(NSArray *)array { resultSMinuteArrayResultMsg.minuteDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_minute_array_result_msgBuilder *)clearMinuteData { resultSMinuteArrayResultMsg.minuteDataArray = nil; return self; } @end @interface search_stock_msg () @property (strong) NSString* searchString; @property SInt32 totalCount; @property SInt32 offset; @property (strong) data_selector* selector; @end @implementation search_stock_msg - (BOOL) hasSearchString { return !!hasSearchString_; } - (void) setHasSearchString:(BOOL) _value_ { hasSearchString_ = !!_value_; } @synthesize searchString; - (BOOL) hasTotalCount { return !!hasTotalCount_; } - (void) setHasTotalCount:(BOOL) _value_ { hasTotalCount_ = !!_value_; } @synthesize totalCount; - (BOOL) hasOffset { return !!hasOffset_; } - (void) setHasOffset:(BOOL) _value_ { hasOffset_ = !!_value_; } @synthesize offset; - (BOOL) hasSelector { return !!hasSelector_; } - (void) setHasSelector:(BOOL) _value_ { hasSelector_ = !!_value_; } @synthesize selector; - (instancetype) init { if ((self = [super init])) { self.searchString = @""; self.totalCount = 20; self.offset = 0; self.selector = [data_selector defaultInstance]; } return self; } static search_stock_msg* defaultsearch_stock_msgInstance = nil; + (void) initialize { if (self == [search_stock_msg class]) { defaultsearch_stock_msgInstance = [[search_stock_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultsearch_stock_msgInstance; } - (instancetype) defaultInstance { return defaultsearch_stock_msgInstance; } - (BOOL) isInitialized { if (!self.hasSearchString) { return NO; } if (!self.hasSelector) { return NO; } if (!self.selector.isInitialized) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasSearchString) { [output writeString:1 value:self.searchString]; } if (self.hasTotalCount) { [output writeInt32:2 value:self.totalCount]; } if (self.hasOffset) { [output writeInt32:3 value:self.offset]; } if (self.hasSelector) { [output writeMessage:4 value:self.selector]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasSearchString) { size_ += computeStringSize(1, self.searchString); } if (self.hasTotalCount) { size_ += computeInt32Size(2, self.totalCount); } if (self.hasOffset) { size_ += computeInt32Size(3, self.offset); } if (self.hasSelector) { size_ += computeMessageSize(4, self.selector); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (search_stock_msg*) parseFromData:(NSData*) data { return (search_stock_msg*)[[[search_stock_msg builder] mergeFromData:data] build]; } + (search_stock_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_msg*)[[[search_stock_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (search_stock_msg*) parseFromInputStream:(NSInputStream*) input { return (search_stock_msg*)[[[search_stock_msg builder] mergeFromInputStream:input] build]; } + (search_stock_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_msg*)[[[search_stock_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (search_stock_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (search_stock_msg*)[[[search_stock_msg builder] mergeFromCodedInputStream:input] build]; } + (search_stock_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_msg*)[[[search_stock_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (search_stock_msgBuilder*) builder { return [[search_stock_msgBuilder alloc] init]; } + (search_stock_msgBuilder*) builderWithPrototype:(search_stock_msg*) prototype { return [[search_stock_msg builder] mergeFrom:prototype]; } - (search_stock_msgBuilder*) builder { return [search_stock_msg builder]; } - (search_stock_msgBuilder*) toBuilder { return [search_stock_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasSearchString) { [output appendFormat:@"%@%@: %@\n", indent, @"searchString", self.searchString]; } if (self.hasTotalCount) { [output appendFormat:@"%@%@: %@\n", indent, @"totalCount", [NSNumber numberWithInteger:self.totalCount]]; } if (self.hasOffset) { [output appendFormat:@"%@%@: %@\n", indent, @"offset", [NSNumber numberWithInteger:self.offset]]; } if (self.hasSelector) { [output appendFormat:@"%@%@ {\n", indent, @"selector"]; [self.selector writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasSearchString) { [dictionary setObject: self.searchString forKey: @"searchString"]; } if (self.hasTotalCount) { [dictionary setObject: [NSNumber numberWithInteger:self.totalCount] forKey: @"totalCount"]; } if (self.hasOffset) { [dictionary setObject: [NSNumber numberWithInteger:self.offset] forKey: @"offset"]; } if (self.hasSelector) { NSMutableDictionary *messageDictionary = [NSMutableDictionary dictionary]; [self.selector storeInDictionary:messageDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:messageDictionary] forKey:@"selector"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[search_stock_msg class]]) { return NO; } search_stock_msg *otherMessage = other; return self.hasSearchString == otherMessage.hasSearchString && (!self.hasSearchString || [self.searchString isEqual:otherMessage.searchString]) && self.hasTotalCount == otherMessage.hasTotalCount && (!self.hasTotalCount || self.totalCount == otherMessage.totalCount) && self.hasOffset == otherMessage.hasOffset && (!self.hasOffset || self.offset == otherMessage.offset) && self.hasSelector == otherMessage.hasSelector && (!self.hasSelector || [self.selector isEqual:otherMessage.selector]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasSearchString) { hashCode = hashCode * 31 + [self.searchString hash]; } if (self.hasTotalCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.totalCount] hash]; } if (self.hasOffset) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.offset] hash]; } if (self.hasSelector) { hashCode = hashCode * 31 + [self.selector hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface search_stock_msgBuilder() @property (strong) search_stock_msg* resultSearchStockMsg; @end @implementation search_stock_msgBuilder @synthesize resultSearchStockMsg; - (instancetype) init { if ((self = [super init])) { self.resultSearchStockMsg = [[search_stock_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSearchStockMsg; } - (search_stock_msgBuilder*) clear { self.resultSearchStockMsg = [[search_stock_msg alloc] init]; return self; } - (search_stock_msgBuilder*) clone { return [search_stock_msg builderWithPrototype:resultSearchStockMsg]; } - (search_stock_msg*) defaultInstance { return [search_stock_msg defaultInstance]; } - (search_stock_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (search_stock_msg*) buildPartial { search_stock_msg* returnMe = resultSearchStockMsg; self.resultSearchStockMsg = nil; return returnMe; } - (search_stock_msgBuilder*) mergeFrom:(search_stock_msg*) other { if (other == [search_stock_msg defaultInstance]) { return self; } if (other.hasSearchString) { [self setSearchString:other.searchString]; } if (other.hasTotalCount) { [self setTotalCount:other.totalCount]; } if (other.hasOffset) { [self setOffset:other.offset]; } if (other.hasSelector) { [self mergeSelector:other.selector]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (search_stock_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (search_stock_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setSearchString:[input readString]]; break; } case 16: { [self setTotalCount:[input readInt32]]; break; } case 24: { [self setOffset:[input readInt32]]; break; } case 34: { data_selectorBuilder* subBuilder = [data_selector builder]; if (self.hasSelector) { [subBuilder mergeFrom:self.selector]; } [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self setSelector:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasSearchString { return resultSearchStockMsg.hasSearchString; } - (NSString*) searchString { return resultSearchStockMsg.searchString; } - (search_stock_msgBuilder*) setSearchString:(NSString*) value { resultSearchStockMsg.hasSearchString = YES; resultSearchStockMsg.searchString = value; return self; } - (search_stock_msgBuilder*) clearSearchString { resultSearchStockMsg.hasSearchString = NO; resultSearchStockMsg.searchString = @""; return self; } - (BOOL) hasTotalCount { return resultSearchStockMsg.hasTotalCount; } - (SInt32) totalCount { return resultSearchStockMsg.totalCount; } - (search_stock_msgBuilder*) setTotalCount:(SInt32) value { resultSearchStockMsg.hasTotalCount = YES; resultSearchStockMsg.totalCount = value; return self; } - (search_stock_msgBuilder*) clearTotalCount { resultSearchStockMsg.hasTotalCount = NO; resultSearchStockMsg.totalCount = 20; return self; } - (BOOL) hasOffset { return resultSearchStockMsg.hasOffset; } - (SInt32) offset { return resultSearchStockMsg.offset; } - (search_stock_msgBuilder*) setOffset:(SInt32) value { resultSearchStockMsg.hasOffset = YES; resultSearchStockMsg.offset = value; return self; } - (search_stock_msgBuilder*) clearOffset { resultSearchStockMsg.hasOffset = NO; resultSearchStockMsg.offset = 0; return self; } - (BOOL) hasSelector { return resultSearchStockMsg.hasSelector; } - (data_selector*) selector { return resultSearchStockMsg.selector; } - (search_stock_msgBuilder*) setSelector:(data_selector*) value { resultSearchStockMsg.hasSelector = YES; resultSearchStockMsg.selector = value; return self; } - (search_stock_msgBuilder*) setSelectorBuilder:(data_selectorBuilder*) builderForValue { return [self setSelector:[builderForValue build]]; } - (search_stock_msgBuilder*) mergeSelector:(data_selector*) value { if (resultSearchStockMsg.hasSelector && resultSearchStockMsg.selector != [data_selector defaultInstance]) { resultSearchStockMsg.selector = [[[data_selector builderWithPrototype:resultSearchStockMsg.selector] mergeFrom:value] buildPartial]; } else { resultSearchStockMsg.selector = value; } resultSearchStockMsg.hasSelector = YES; return self; } - (search_stock_msgBuilder*) clearSelector { resultSearchStockMsg.hasSelector = NO; resultSearchStockMsg.selector = [data_selector defaultInstance]; return self; } @end @interface search_stock_result_msg () @property (strong) NSString* code; @property (strong) NSString* name; @end @implementation search_stock_result_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; } return self; } static search_stock_result_msg* defaultsearch_stock_result_msgInstance = nil; + (void) initialize { if (self == [search_stock_result_msg class]) { defaultsearch_stock_result_msgInstance = [[search_stock_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultsearch_stock_result_msgInstance; } - (instancetype) defaultInstance { return defaultsearch_stock_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (search_stock_result_msg*) parseFromData:(NSData*) data { return (search_stock_result_msg*)[[[search_stock_result_msg builder] mergeFromData:data] build]; } + (search_stock_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_result_msg*)[[[search_stock_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (search_stock_result_msg*) parseFromInputStream:(NSInputStream*) input { return (search_stock_result_msg*)[[[search_stock_result_msg builder] mergeFromInputStream:input] build]; } + (search_stock_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_result_msg*)[[[search_stock_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (search_stock_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (search_stock_result_msg*)[[[search_stock_result_msg builder] mergeFromCodedInputStream:input] build]; } + (search_stock_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_result_msg*)[[[search_stock_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (search_stock_result_msgBuilder*) builder { return [[search_stock_result_msgBuilder alloc] init]; } + (search_stock_result_msgBuilder*) builderWithPrototype:(search_stock_result_msg*) prototype { return [[search_stock_result_msg builder] mergeFrom:prototype]; } - (search_stock_result_msgBuilder*) builder { return [search_stock_result_msg builder]; } - (search_stock_result_msgBuilder*) toBuilder { return [search_stock_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[search_stock_result_msg class]]) { return NO; } search_stock_result_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface search_stock_result_msgBuilder() @property (strong) search_stock_result_msg* resultSearchStockResultMsg; @end @implementation search_stock_result_msgBuilder @synthesize resultSearchStockResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSearchStockResultMsg = [[search_stock_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSearchStockResultMsg; } - (search_stock_result_msgBuilder*) clear { self.resultSearchStockResultMsg = [[search_stock_result_msg alloc] init]; return self; } - (search_stock_result_msgBuilder*) clone { return [search_stock_result_msg builderWithPrototype:resultSearchStockResultMsg]; } - (search_stock_result_msg*) defaultInstance { return [search_stock_result_msg defaultInstance]; } - (search_stock_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (search_stock_result_msg*) buildPartial { search_stock_result_msg* returnMe = resultSearchStockResultMsg; self.resultSearchStockResultMsg = nil; return returnMe; } - (search_stock_result_msgBuilder*) mergeFrom:(search_stock_result_msg*) other { if (other == [search_stock_result_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (search_stock_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (search_stock_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } } } } - (BOOL) hasCode { return resultSearchStockResultMsg.hasCode; } - (NSString*) code { return resultSearchStockResultMsg.code; } - (search_stock_result_msgBuilder*) setCode:(NSString*) value { resultSearchStockResultMsg.hasCode = YES; resultSearchStockResultMsg.code = value; return self; } - (search_stock_result_msgBuilder*) clearCode { resultSearchStockResultMsg.hasCode = NO; resultSearchStockResultMsg.code = @""; return self; } - (BOOL) hasName { return resultSearchStockResultMsg.hasName; } - (NSString*) name { return resultSearchStockResultMsg.name; } - (search_stock_result_msgBuilder*) setName:(NSString*) value { resultSearchStockResultMsg.hasName = YES; resultSearchStockResultMsg.name = value; return self; } - (search_stock_result_msgBuilder*) clearName { resultSearchStockResultMsg.hasName = NO; resultSearchStockResultMsg.name = @""; return self; } @end @interface search_stock_array_result_msg () @property (strong) NSMutableArray * stockDataArray; @end @implementation search_stock_array_result_msg @synthesize stockDataArray; @dynamic stockData; - (instancetype) init { if ((self = [super init])) { } return self; } static search_stock_array_result_msg* defaultsearch_stock_array_result_msgInstance = nil; + (void) initialize { if (self == [search_stock_array_result_msg class]) { defaultsearch_stock_array_result_msgInstance = [[search_stock_array_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultsearch_stock_array_result_msgInstance; } - (instancetype) defaultInstance { return defaultsearch_stock_array_result_msgInstance; } - (NSArray *)stockData { return stockDataArray; } - (search_stock_result_msg*)stockDataAtIndex:(NSUInteger)index { return [stockDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitstockData = YES; [self.stockData enumerateObjectsUsingBlock:^(search_stock_result_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitstockData = NO; *stop = YES; } }]; if (!isInitstockData) return isInitstockData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.stockDataArray enumerateObjectsUsingBlock:^(search_stock_result_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.stockDataArray enumerateObjectsUsingBlock:^(search_stock_result_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (search_stock_array_result_msg*) parseFromData:(NSData*) data { return (search_stock_array_result_msg*)[[[search_stock_array_result_msg builder] mergeFromData:data] build]; } + (search_stock_array_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_array_result_msg*)[[[search_stock_array_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (search_stock_array_result_msg*) parseFromInputStream:(NSInputStream*) input { return (search_stock_array_result_msg*)[[[search_stock_array_result_msg builder] mergeFromInputStream:input] build]; } + (search_stock_array_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_array_result_msg*)[[[search_stock_array_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (search_stock_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (search_stock_array_result_msg*)[[[search_stock_array_result_msg builder] mergeFromCodedInputStream:input] build]; } + (search_stock_array_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (search_stock_array_result_msg*)[[[search_stock_array_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (search_stock_array_result_msgBuilder*) builder { return [[search_stock_array_result_msgBuilder alloc] init]; } + (search_stock_array_result_msgBuilder*) builderWithPrototype:(search_stock_array_result_msg*) prototype { return [[search_stock_array_result_msg builder] mergeFrom:prototype]; } - (search_stock_array_result_msgBuilder*) builder { return [search_stock_array_result_msg builder]; } - (search_stock_array_result_msgBuilder*) toBuilder { return [search_stock_array_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.stockDataArray enumerateObjectsUsingBlock:^(search_stock_result_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"stockData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (search_stock_result_msg* element in self.stockDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"stockData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[search_stock_array_result_msg class]]) { return NO; } search_stock_array_result_msg *otherMessage = other; return [self.stockDataArray isEqualToArray:otherMessage.stockDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.stockDataArray enumerateObjectsUsingBlock:^(search_stock_result_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface search_stock_array_result_msgBuilder() @property (strong) search_stock_array_result_msg* resultSearchStockArrayResultMsg; @end @implementation search_stock_array_result_msgBuilder @synthesize resultSearchStockArrayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSearchStockArrayResultMsg = [[search_stock_array_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSearchStockArrayResultMsg; } - (search_stock_array_result_msgBuilder*) clear { self.resultSearchStockArrayResultMsg = [[search_stock_array_result_msg alloc] init]; return self; } - (search_stock_array_result_msgBuilder*) clone { return [search_stock_array_result_msg builderWithPrototype:resultSearchStockArrayResultMsg]; } - (search_stock_array_result_msg*) defaultInstance { return [search_stock_array_result_msg defaultInstance]; } - (search_stock_array_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (search_stock_array_result_msg*) buildPartial { search_stock_array_result_msg* returnMe = resultSearchStockArrayResultMsg; self.resultSearchStockArrayResultMsg = nil; return returnMe; } - (search_stock_array_result_msgBuilder*) mergeFrom:(search_stock_array_result_msg*) other { if (other == [search_stock_array_result_msg defaultInstance]) { return self; } if (other.stockDataArray.count > 0) { if (resultSearchStockArrayResultMsg.stockDataArray == nil) { resultSearchStockArrayResultMsg.stockDataArray = [[NSMutableArray alloc] initWithArray:other.stockDataArray]; } else { [resultSearchStockArrayResultMsg.stockDataArray addObjectsFromArray:other.stockDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (search_stock_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (search_stock_array_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { search_stock_result_msgBuilder* subBuilder = [search_stock_result_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addStockData:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)stockData { return resultSearchStockArrayResultMsg.stockDataArray; } - (search_stock_result_msg*)stockDataAtIndex:(NSUInteger)index { return [resultSearchStockArrayResultMsg stockDataAtIndex:index]; } - (search_stock_array_result_msgBuilder *)addStockData:(search_stock_result_msg*)value { if (resultSearchStockArrayResultMsg.stockDataArray == nil) { resultSearchStockArrayResultMsg.stockDataArray = [[NSMutableArray alloc]init]; } [resultSearchStockArrayResultMsg.stockDataArray addObject:value]; return self; } - (search_stock_array_result_msgBuilder *)setStockDataArray:(NSArray *)array { resultSearchStockArrayResultMsg.stockDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (search_stock_array_result_msgBuilder *)clearStockData { resultSearchStockArrayResultMsg.stockDataArray = nil; return self; } @end @interface s_board_report_data_msg () @property UInt32 blockCode; @property UInt32 blockOffset; @property UInt32 count; @property colum_type sortColum; @property BOOL isAsc; @property (strong) PBAppendableArray * columArrayArray; @end @implementation s_board_report_data_msg - (BOOL) hasBlockCode { return !!hasBlockCode_; } - (void) setHasBlockCode:(BOOL) _value_ { hasBlockCode_ = !!_value_; } @synthesize blockCode; - (BOOL) hasBlockOffset { return !!hasBlockOffset_; } - (void) setHasBlockOffset:(BOOL) _value_ { hasBlockOffset_ = !!_value_; } @synthesize blockOffset; - (BOOL) hasCount { return !!hasCount_; } - (void) setHasCount:(BOOL) _value_ { hasCount_ = !!_value_; } @synthesize count; - (BOOL) hasSortColum { return !!hasSortColum_; } - (void) setHasSortColum:(BOOL) _value_ { hasSortColum_ = !!_value_; } @synthesize sortColum; - (BOOL) hasIsAsc { return !!hasIsAsc_; } - (void) setHasIsAsc:(BOOL) _value_ { hasIsAsc_ = !!_value_; } - (BOOL) isAsc { return !!isAsc_; } - (void) setIsAsc:(BOOL) _value_ { isAsc_ = !!_value_; } @synthesize columArrayArray; @dynamic columArray; - (instancetype) init { if ((self = [super init])) { self.blockCode = 0; self.blockOffset = 0; self.count = 0; self.sortColum = colum_typeColIndex; self.isAsc = NO; } return self; } static s_board_report_data_msg* defaults_board_report_data_msgInstance = nil; + (void) initialize { if (self == [s_board_report_data_msg class]) { defaults_board_report_data_msgInstance = [[s_board_report_data_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_board_report_data_msgInstance; } - (instancetype) defaultInstance { return defaults_board_report_data_msgInstance; } - (PBArray *)columArray { return columArrayArray; } - (colum_type)columArrayAtIndex:(NSUInteger)index { return (colum_type)[columArrayArray enumAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasBlockCode) { return NO; } if (!self.hasBlockOffset) { return NO; } if (!self.hasCount) { return NO; } if (!self.hasSortColum) { return NO; } if (!self.hasIsAsc) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasBlockCode) { [output writeUInt32:1 value:self.blockCode]; } if (self.hasBlockOffset) { [output writeUInt32:2 value:self.blockOffset]; } if (self.hasCount) { [output writeUInt32:3 value:self.count]; } if (self.hasSortColum) { [output writeEnum:4 value:self.sortColum]; } if (self.hasIsAsc) { [output writeBool:5 value:self.isAsc]; } const NSUInteger columArrayArrayCount = self.columArrayArray.count; const colum_type *columArrayArrayValues = (const colum_type *)self.columArrayArray.data; for (NSUInteger i = 0; i < columArrayArrayCount; ++i) { [output writeEnum:6 value:columArrayArrayValues[i]]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasBlockCode) { size_ += computeUInt32Size(1, self.blockCode); } if (self.hasBlockOffset) { size_ += computeUInt32Size(2, self.blockOffset); } if (self.hasCount) { size_ += computeUInt32Size(3, self.count); } if (self.hasSortColum) { size_ += computeEnumSize(4, self.sortColum); } if (self.hasIsAsc) { size_ += computeBoolSize(5, self.isAsc); } { SInt32 dataSize = 0; const NSUInteger count = self.columArrayArray.count; const colum_type *values = (const colum_type *)self.columArrayArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeEnumSizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_board_report_data_msg*) parseFromData:(NSData*) data { return (s_board_report_data_msg*)[[[s_board_report_data_msg builder] mergeFromData:data] build]; } + (s_board_report_data_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_data_msg*)[[[s_board_report_data_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_board_report_data_msg*) parseFromInputStream:(NSInputStream*) input { return (s_board_report_data_msg*)[[[s_board_report_data_msg builder] mergeFromInputStream:input] build]; } + (s_board_report_data_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_data_msg*)[[[s_board_report_data_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_board_report_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_board_report_data_msg*)[[[s_board_report_data_msg builder] mergeFromCodedInputStream:input] build]; } + (s_board_report_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_data_msg*)[[[s_board_report_data_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_board_report_data_msgBuilder*) builder { return [[s_board_report_data_msgBuilder alloc] init]; } + (s_board_report_data_msgBuilder*) builderWithPrototype:(s_board_report_data_msg*) prototype { return [[s_board_report_data_msg builder] mergeFrom:prototype]; } - (s_board_report_data_msgBuilder*) builder { return [s_board_report_data_msg builder]; } - (s_board_report_data_msgBuilder*) toBuilder { return [s_board_report_data_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasBlockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"blockCode", [NSNumber numberWithInteger:self.blockCode]]; } if (self.hasBlockOffset) { [output appendFormat:@"%@%@: %@\n", indent, @"blockOffset", [NSNumber numberWithInteger:self.blockOffset]]; } if (self.hasCount) { [output appendFormat:@"%@%@: %@\n", indent, @"count", [NSNumber numberWithInteger:self.count]]; } if (self.hasSortColum) { [output appendFormat:@"%@%@: %@\n", indent, @"sortColum", NSStringFromcolum_type(self.sortColum)]; } if (self.hasIsAsc) { [output appendFormat:@"%@%@: %@\n", indent, @"isAsc", [NSNumber numberWithBool:self.isAsc]]; } [self.columArrayArray enumerateObjectsUsingBlock:^(id element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"columArray", NSStringFromcolum_type([(NSNumber *)element intValue])]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasBlockCode) { [dictionary setObject: [NSNumber numberWithInteger:self.blockCode] forKey: @"blockCode"]; } if (self.hasBlockOffset) { [dictionary setObject: [NSNumber numberWithInteger:self.blockOffset] forKey: @"blockOffset"]; } if (self.hasCount) { [dictionary setObject: [NSNumber numberWithInteger:self.count] forKey: @"count"]; } if (self.hasSortColum) { [dictionary setObject: @(self.sortColum) forKey: @"sortColum"]; } if (self.hasIsAsc) { [dictionary setObject: [NSNumber numberWithBool:self.isAsc] forKey: @"isAsc"]; } const NSUInteger columArrayArrayCount = self.columArrayArray.count; if (columArrayArrayCount > 0) { const colum_type *columArrayArrayValues = (const colum_type *)self.columArrayArray.data; NSMutableArray * columArrayArrayArray = [NSMutableArray new]; for (NSUInteger i = 0; i < columArrayArrayCount; ++i) { [columArrayArrayArray addObject: @(columArrayArrayValues[i])]; } [dictionary setObject: columArrayArrayArray forKey: @"columArray"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_board_report_data_msg class]]) { return NO; } s_board_report_data_msg *otherMessage = other; return self.hasBlockCode == otherMessage.hasBlockCode && (!self.hasBlockCode || self.blockCode == otherMessage.blockCode) && self.hasBlockOffset == otherMessage.hasBlockOffset && (!self.hasBlockOffset || self.blockOffset == otherMessage.blockOffset) && self.hasCount == otherMessage.hasCount && (!self.hasCount || self.count == otherMessage.count) && self.hasSortColum == otherMessage.hasSortColum && (!self.hasSortColum || self.sortColum == otherMessage.sortColum) && self.hasIsAsc == otherMessage.hasIsAsc && (!self.hasIsAsc || self.isAsc == otherMessage.isAsc) && [self.columArrayArray isEqualToArray:otherMessage.columArrayArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasBlockCode) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.blockCode] hash]; } if (self.hasBlockOffset) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.blockOffset] hash]; } if (self.hasCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.count] hash]; } if (self.hasSortColum) { hashCode = hashCode * 31 + self.sortColum; } if (self.hasIsAsc) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.isAsc] hash]; } [self.columArrayArray enumerateObjectsUsingBlock:^(NSNumber* element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + element.longValue; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_board_report_data_msgBuilder() @property (strong) s_board_report_data_msg* resultSBoardReportDataMsg; @end @implementation s_board_report_data_msgBuilder @synthesize resultSBoardReportDataMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoardReportDataMsg = [[s_board_report_data_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoardReportDataMsg; } - (s_board_report_data_msgBuilder*) clear { self.resultSBoardReportDataMsg = [[s_board_report_data_msg alloc] init]; return self; } - (s_board_report_data_msgBuilder*) clone { return [s_board_report_data_msg builderWithPrototype:resultSBoardReportDataMsg]; } - (s_board_report_data_msg*) defaultInstance { return [s_board_report_data_msg defaultInstance]; } - (s_board_report_data_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_board_report_data_msg*) buildPartial { s_board_report_data_msg* returnMe = resultSBoardReportDataMsg; self.resultSBoardReportDataMsg = nil; return returnMe; } - (s_board_report_data_msgBuilder*) mergeFrom:(s_board_report_data_msg*) other { if (other == [s_board_report_data_msg defaultInstance]) { return self; } if (other.hasBlockCode) { [self setBlockCode:other.blockCode]; } if (other.hasBlockOffset) { [self setBlockOffset:other.blockOffset]; } if (other.hasCount) { [self setCount:other.count]; } if (other.hasSortColum) { [self setSortColum:other.sortColum]; } if (other.hasIsAsc) { [self setIsAsc:other.isAsc]; } if (other.columArrayArray.count > 0) { if (resultSBoardReportDataMsg.columArrayArray == nil) { resultSBoardReportDataMsg.columArrayArray = [other.columArrayArray copy]; } else { [resultSBoardReportDataMsg.columArrayArray appendArray:other.columArrayArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_board_report_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_board_report_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setBlockCode:[input readUInt32]]; break; } case 16: { [self setBlockOffset:[input readUInt32]]; break; } case 24: { [self setCount:[input readUInt32]]; break; } case 32: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self setSortColum:value]; } else { [unknownFields mergeVarintField:4 value:value]; } break; } case 40: { [self setIsAsc:[input readBool]]; break; } case 48: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self addColumArray:value]; } else { [unknownFields mergeVarintField:6 value:value]; } break; } } } } - (BOOL) hasBlockCode { return resultSBoardReportDataMsg.hasBlockCode; } - (UInt32) blockCode { return resultSBoardReportDataMsg.blockCode; } - (s_board_report_data_msgBuilder*) setBlockCode:(UInt32) value { resultSBoardReportDataMsg.hasBlockCode = YES; resultSBoardReportDataMsg.blockCode = value; return self; } - (s_board_report_data_msgBuilder*) clearBlockCode { resultSBoardReportDataMsg.hasBlockCode = NO; resultSBoardReportDataMsg.blockCode = 0; return self; } - (BOOL) hasBlockOffset { return resultSBoardReportDataMsg.hasBlockOffset; } - (UInt32) blockOffset { return resultSBoardReportDataMsg.blockOffset; } - (s_board_report_data_msgBuilder*) setBlockOffset:(UInt32) value { resultSBoardReportDataMsg.hasBlockOffset = YES; resultSBoardReportDataMsg.blockOffset = value; return self; } - (s_board_report_data_msgBuilder*) clearBlockOffset { resultSBoardReportDataMsg.hasBlockOffset = NO; resultSBoardReportDataMsg.blockOffset = 0; return self; } - (BOOL) hasCount { return resultSBoardReportDataMsg.hasCount; } - (UInt32) count { return resultSBoardReportDataMsg.count; } - (s_board_report_data_msgBuilder*) setCount:(UInt32) value { resultSBoardReportDataMsg.hasCount = YES; resultSBoardReportDataMsg.count = value; return self; } - (s_board_report_data_msgBuilder*) clearCount { resultSBoardReportDataMsg.hasCount = NO; resultSBoardReportDataMsg.count = 0; return self; } - (BOOL) hasSortColum { return resultSBoardReportDataMsg.hasSortColum; } - (colum_type) sortColum { return resultSBoardReportDataMsg.sortColum; } - (s_board_report_data_msgBuilder*) setSortColum:(colum_type) value { resultSBoardReportDataMsg.hasSortColum = YES; resultSBoardReportDataMsg.sortColum = value; return self; } - (s_board_report_data_msgBuilder*) clearSortColum { resultSBoardReportDataMsg.hasSortColum = NO; resultSBoardReportDataMsg.sortColum = colum_typeColIndex; return self; } - (BOOL) hasIsAsc { return resultSBoardReportDataMsg.hasIsAsc; } - (BOOL) isAsc { return resultSBoardReportDataMsg.isAsc; } - (s_board_report_data_msgBuilder*) setIsAsc:(BOOL) value { resultSBoardReportDataMsg.hasIsAsc = YES; resultSBoardReportDataMsg.isAsc = value; return self; } - (s_board_report_data_msgBuilder*) clearIsAsc { resultSBoardReportDataMsg.hasIsAsc = NO; resultSBoardReportDataMsg.isAsc = NO; return self; } - (PBAppendableArray *)columArray { return resultSBoardReportDataMsg.columArrayArray; } - (colum_type)columArrayAtIndex:(NSUInteger)index { return [resultSBoardReportDataMsg columArrayAtIndex:index]; } - (s_board_report_data_msgBuilder *)addColumArray:(colum_type)value { if (resultSBoardReportDataMsg.columArrayArray == nil) { resultSBoardReportDataMsg.columArrayArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultSBoardReportDataMsg.columArrayArray addEnum:value]; return self; } - (s_board_report_data_msgBuilder *)setColumArrayArray:(NSArray *)array { resultSBoardReportDataMsg.columArrayArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (s_board_report_data_msgBuilder *)setColumArrayValues:(const colum_type *)values count:(NSUInteger)count { resultSBoardReportDataMsg.columArrayArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (s_board_report_data_msgBuilder *)clearColumArray { resultSBoardReportDataMsg.columArrayArray = nil; return self; } @end @interface s_board_report_colum_data_msg () @property colum_type key; @property Float64 value; @property (strong) NSString* strvalue; @end @implementation s_board_report_colum_data_msg - (BOOL) hasKey { return !!hasKey_; } - (void) setHasKey:(BOOL) _value_ { hasKey_ = !!_value_; } @synthesize key; - (BOOL) hasValue { return !!hasValue_; } - (void) setHasValue:(BOOL) _value_ { hasValue_ = !!_value_; } @synthesize value; - (BOOL) hasStrvalue { return !!hasStrvalue_; } - (void) setHasStrvalue:(BOOL) _value_ { hasStrvalue_ = !!_value_; } @synthesize strvalue; - (instancetype) init { if ((self = [super init])) { self.key = colum_typeColIndex; self.value = 0; self.strvalue = @""; } return self; } static s_board_report_colum_data_msg* defaults_board_report_colum_data_msgInstance = nil; + (void) initialize { if (self == [s_board_report_colum_data_msg class]) { defaults_board_report_colum_data_msgInstance = [[s_board_report_colum_data_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_board_report_colum_data_msgInstance; } - (instancetype) defaultInstance { return defaults_board_report_colum_data_msgInstance; } - (BOOL) isInitialized { if (!self.hasKey) { return NO; } if (!self.hasValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasKey) { [output writeEnum:1 value:self.key]; } if (self.hasValue) { [output writeDouble:2 value:self.value]; } if (self.hasStrvalue) { [output writeString:3 value:self.strvalue]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasKey) { size_ += computeEnumSize(1, self.key); } if (self.hasValue) { size_ += computeDoubleSize(2, self.value); } if (self.hasStrvalue) { size_ += computeStringSize(3, self.strvalue); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_board_report_colum_data_msg*) parseFromData:(NSData*) data { return (s_board_report_colum_data_msg*)[[[s_board_report_colum_data_msg builder] mergeFromData:data] build]; } + (s_board_report_colum_data_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_colum_data_msg*)[[[s_board_report_colum_data_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_board_report_colum_data_msg*) parseFromInputStream:(NSInputStream*) input { return (s_board_report_colum_data_msg*)[[[s_board_report_colum_data_msg builder] mergeFromInputStream:input] build]; } + (s_board_report_colum_data_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_colum_data_msg*)[[[s_board_report_colum_data_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_board_report_colum_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_board_report_colum_data_msg*)[[[s_board_report_colum_data_msg builder] mergeFromCodedInputStream:input] build]; } + (s_board_report_colum_data_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_colum_data_msg*)[[[s_board_report_colum_data_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_board_report_colum_data_msgBuilder*) builder { return [[s_board_report_colum_data_msgBuilder alloc] init]; } + (s_board_report_colum_data_msgBuilder*) builderWithPrototype:(s_board_report_colum_data_msg*) prototype { return [[s_board_report_colum_data_msg builder] mergeFrom:prototype]; } - (s_board_report_colum_data_msgBuilder*) builder { return [s_board_report_colum_data_msg builder]; } - (s_board_report_colum_data_msgBuilder*) toBuilder { return [s_board_report_colum_data_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasKey) { [output appendFormat:@"%@%@: %@\n", indent, @"key", NSStringFromcolum_type(self.key)]; } if (self.hasValue) { [output appendFormat:@"%@%@: %@\n", indent, @"value", [NSNumber numberWithDouble:self.value]]; } if (self.hasStrvalue) { [output appendFormat:@"%@%@: %@\n", indent, @"strvalue", self.strvalue]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasKey) { [dictionary setObject: @(self.key) forKey: @"key"]; } if (self.hasValue) { [dictionary setObject: [NSNumber numberWithDouble:self.value] forKey: @"value"]; } if (self.hasStrvalue) { [dictionary setObject: self.strvalue forKey: @"strvalue"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_board_report_colum_data_msg class]]) { return NO; } s_board_report_colum_data_msg *otherMessage = other; return self.hasKey == otherMessage.hasKey && (!self.hasKey || self.key == otherMessage.key) && self.hasValue == otherMessage.hasValue && (!self.hasValue || self.value == otherMessage.value) && self.hasStrvalue == otherMessage.hasStrvalue && (!self.hasStrvalue || [self.strvalue isEqual:otherMessage.strvalue]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasKey) { hashCode = hashCode * 31 + self.key; } if (self.hasValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.value] hash]; } if (self.hasStrvalue) { hashCode = hashCode * 31 + [self.strvalue hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_board_report_colum_data_msgBuilder() @property (strong) s_board_report_colum_data_msg* resultSBoardReportColumDataMsg; @end @implementation s_board_report_colum_data_msgBuilder @synthesize resultSBoardReportColumDataMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoardReportColumDataMsg = [[s_board_report_colum_data_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoardReportColumDataMsg; } - (s_board_report_colum_data_msgBuilder*) clear { self.resultSBoardReportColumDataMsg = [[s_board_report_colum_data_msg alloc] init]; return self; } - (s_board_report_colum_data_msgBuilder*) clone { return [s_board_report_colum_data_msg builderWithPrototype:resultSBoardReportColumDataMsg]; } - (s_board_report_colum_data_msg*) defaultInstance { return [s_board_report_colum_data_msg defaultInstance]; } - (s_board_report_colum_data_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_board_report_colum_data_msg*) buildPartial { s_board_report_colum_data_msg* returnMe = resultSBoardReportColumDataMsg; self.resultSBoardReportColumDataMsg = nil; return returnMe; } - (s_board_report_colum_data_msgBuilder*) mergeFrom:(s_board_report_colum_data_msg*) other { if (other == [s_board_report_colum_data_msg defaultInstance]) { return self; } if (other.hasKey) { [self setKey:other.key]; } if (other.hasValue) { [self setValue:other.value]; } if (other.hasStrvalue) { [self setStrvalue:other.strvalue]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_board_report_colum_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_board_report_colum_data_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self setKey:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 17: { [self setValue:[input readDouble]]; break; } case 26: { [self setStrvalue:[input readString]]; break; } } } } - (BOOL) hasKey { return resultSBoardReportColumDataMsg.hasKey; } - (colum_type) key { return resultSBoardReportColumDataMsg.key; } - (s_board_report_colum_data_msgBuilder*) setKey:(colum_type) value { resultSBoardReportColumDataMsg.hasKey = YES; resultSBoardReportColumDataMsg.key = value; return self; } - (s_board_report_colum_data_msgBuilder*) clearKey { resultSBoardReportColumDataMsg.hasKey = NO; resultSBoardReportColumDataMsg.key = colum_typeColIndex; return self; } - (BOOL) hasValue { return resultSBoardReportColumDataMsg.hasValue; } - (Float64) value { return resultSBoardReportColumDataMsg.value; } - (s_board_report_colum_data_msgBuilder*) setValue:(Float64) value { resultSBoardReportColumDataMsg.hasValue = YES; resultSBoardReportColumDataMsg.value = value; return self; } - (s_board_report_colum_data_msgBuilder*) clearValue { resultSBoardReportColumDataMsg.hasValue = NO; resultSBoardReportColumDataMsg.value = 0; return self; } - (BOOL) hasStrvalue { return resultSBoardReportColumDataMsg.hasStrvalue; } - (NSString*) strvalue { return resultSBoardReportColumDataMsg.strvalue; } - (s_board_report_colum_data_msgBuilder*) setStrvalue:(NSString*) value { resultSBoardReportColumDataMsg.hasStrvalue = YES; resultSBoardReportColumDataMsg.strvalue = value; return self; } - (s_board_report_colum_data_msgBuilder*) clearStrvalue { resultSBoardReportColumDataMsg.hasStrvalue = NO; resultSBoardReportColumDataMsg.strvalue = @""; return self; } @end @interface s_borad_report_line_data () @property UInt32 index; @property (strong) NSString* code; @property (strong) NSString* name; @property (strong) NSMutableArray * columDataArray; @end @implementation s_borad_report_line_data - (BOOL) hasIndex { return !!hasIndex_; } - (void) setHasIndex:(BOOL) _value_ { hasIndex_ = !!_value_; } @synthesize index; - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize columDataArray; @dynamic columData; - (instancetype) init { if ((self = [super init])) { self.index = 0; self.code = @""; self.name = @""; } return self; } static s_borad_report_line_data* defaults_borad_report_line_dataInstance = nil; + (void) initialize { if (self == [s_borad_report_line_data class]) { defaults_borad_report_line_dataInstance = [[s_borad_report_line_data alloc] init]; } } + (instancetype) defaultInstance { return defaults_borad_report_line_dataInstance; } - (instancetype) defaultInstance { return defaults_borad_report_line_dataInstance; } - (NSArray *)columData { return columDataArray; } - (s_board_report_colum_data_msg*)columDataAtIndex:(NSUInteger)index { return [columDataArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitcolumData = YES; [self.columData enumerateObjectsUsingBlock:^(s_board_report_colum_data_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitcolumData = NO; *stop = YES; } }]; if (!isInitcolumData) return isInitcolumData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasIndex) { [output writeUInt32:1 value:self.index]; } if (self.hasCode) { [output writeString:2 value:self.code]; } if (self.hasName) { [output writeString:3 value:self.name]; } [self.columDataArray enumerateObjectsUsingBlock:^(s_board_report_colum_data_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:4 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasIndex) { size_ += computeUInt32Size(1, self.index); } if (self.hasCode) { size_ += computeStringSize(2, self.code); } if (self.hasName) { size_ += computeStringSize(3, self.name); } [self.columDataArray enumerateObjectsUsingBlock:^(s_board_report_colum_data_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(4, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_borad_report_line_data*) parseFromData:(NSData*) data { return (s_borad_report_line_data*)[[[s_borad_report_line_data builder] mergeFromData:data] build]; } + (s_borad_report_line_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_line_data*)[[[s_borad_report_line_data builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_borad_report_line_data*) parseFromInputStream:(NSInputStream*) input { return (s_borad_report_line_data*)[[[s_borad_report_line_data builder] mergeFromInputStream:input] build]; } + (s_borad_report_line_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_line_data*)[[[s_borad_report_line_data builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_line_data*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_borad_report_line_data*)[[[s_borad_report_line_data builder] mergeFromCodedInputStream:input] build]; } + (s_borad_report_line_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_line_data*)[[[s_borad_report_line_data builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_line_dataBuilder*) builder { return [[s_borad_report_line_dataBuilder alloc] init]; } + (s_borad_report_line_dataBuilder*) builderWithPrototype:(s_borad_report_line_data*) prototype { return [[s_borad_report_line_data builder] mergeFrom:prototype]; } - (s_borad_report_line_dataBuilder*) builder { return [s_borad_report_line_data builder]; } - (s_borad_report_line_dataBuilder*) toBuilder { return [s_borad_report_line_data builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasIndex) { [output appendFormat:@"%@%@: %@\n", indent, @"index", [NSNumber numberWithInteger:self.index]]; } if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.columDataArray enumerateObjectsUsingBlock:^(s_board_report_colum_data_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"columData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasIndex) { [dictionary setObject: [NSNumber numberWithInteger:self.index] forKey: @"index"]; } if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } for (s_board_report_colum_data_msg* element in self.columDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"columData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_borad_report_line_data class]]) { return NO; } s_borad_report_line_data *otherMessage = other; return self.hasIndex == otherMessage.hasIndex && (!self.hasIndex || self.index == otherMessage.index) && self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && [self.columDataArray isEqualToArray:otherMessage.columDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasIndex) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.index] hash]; } if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } [self.columDataArray enumerateObjectsUsingBlock:^(s_board_report_colum_data_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_borad_report_line_dataBuilder() @property (strong) s_borad_report_line_data* resultSBoradReportLineData; @end @implementation s_borad_report_line_dataBuilder @synthesize resultSBoradReportLineData; - (instancetype) init { if ((self = [super init])) { self.resultSBoradReportLineData = [[s_borad_report_line_data alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoradReportLineData; } - (s_borad_report_line_dataBuilder*) clear { self.resultSBoradReportLineData = [[s_borad_report_line_data alloc] init]; return self; } - (s_borad_report_line_dataBuilder*) clone { return [s_borad_report_line_data builderWithPrototype:resultSBoradReportLineData]; } - (s_borad_report_line_data*) defaultInstance { return [s_borad_report_line_data defaultInstance]; } - (s_borad_report_line_data*) build { [self checkInitialized]; return [self buildPartial]; } - (s_borad_report_line_data*) buildPartial { s_borad_report_line_data* returnMe = resultSBoradReportLineData; self.resultSBoradReportLineData = nil; return returnMe; } - (s_borad_report_line_dataBuilder*) mergeFrom:(s_borad_report_line_data*) other { if (other == [s_borad_report_line_data defaultInstance]) { return self; } if (other.hasIndex) { [self setIndex:other.index]; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.columDataArray.count > 0) { if (resultSBoradReportLineData.columDataArray == nil) { resultSBoradReportLineData.columDataArray = [[NSMutableArray alloc] initWithArray:other.columDataArray]; } else { [resultSBoradReportLineData.columDataArray addObjectsFromArray:other.columDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_borad_report_line_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_borad_report_line_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setIndex:[input readUInt32]]; break; } case 18: { [self setCode:[input readString]]; break; } case 26: { [self setName:[input readString]]; break; } case 34: { s_board_report_colum_data_msgBuilder* subBuilder = [s_board_report_colum_data_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addColumData:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasIndex { return resultSBoradReportLineData.hasIndex; } - (UInt32) index { return resultSBoradReportLineData.index; } - (s_borad_report_line_dataBuilder*) setIndex:(UInt32) value { resultSBoradReportLineData.hasIndex = YES; resultSBoradReportLineData.index = value; return self; } - (s_borad_report_line_dataBuilder*) clearIndex { resultSBoradReportLineData.hasIndex = NO; resultSBoradReportLineData.index = 0; return self; } - (BOOL) hasCode { return resultSBoradReportLineData.hasCode; } - (NSString*) code { return resultSBoradReportLineData.code; } - (s_borad_report_line_dataBuilder*) setCode:(NSString*) value { resultSBoradReportLineData.hasCode = YES; resultSBoradReportLineData.code = value; return self; } - (s_borad_report_line_dataBuilder*) clearCode { resultSBoradReportLineData.hasCode = NO; resultSBoradReportLineData.code = @""; return self; } - (BOOL) hasName { return resultSBoradReportLineData.hasName; } - (NSString*) name { return resultSBoradReportLineData.name; } - (s_borad_report_line_dataBuilder*) setName:(NSString*) value { resultSBoradReportLineData.hasName = YES; resultSBoradReportLineData.name = value; return self; } - (s_borad_report_line_dataBuilder*) clearName { resultSBoradReportLineData.hasName = NO; resultSBoradReportLineData.name = @""; return self; } - (NSMutableArray *)columData { return resultSBoradReportLineData.columDataArray; } - (s_board_report_colum_data_msg*)columDataAtIndex:(NSUInteger)index { return [resultSBoradReportLineData columDataAtIndex:index]; } - (s_borad_report_line_dataBuilder *)addColumData:(s_board_report_colum_data_msg*)value { if (resultSBoradReportLineData.columDataArray == nil) { resultSBoradReportLineData.columDataArray = [[NSMutableArray alloc]init]; } [resultSBoradReportLineData.columDataArray addObject:value]; return self; } - (s_borad_report_line_dataBuilder *)setColumDataArray:(NSArray *)array { resultSBoradReportLineData.columDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_borad_report_line_dataBuilder *)clearColumData { resultSBoradReportLineData.columDataArray = nil; return self; } @end @interface s_borad_report_result_msg () @property (strong) NSMutableArray * datasArray; @end @implementation s_borad_report_result_msg @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { } return self; } static s_borad_report_result_msg* defaults_borad_report_result_msgInstance = nil; + (void) initialize { if (self == [s_borad_report_result_msg class]) { defaults_borad_report_result_msgInstance = [[s_borad_report_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_borad_report_result_msgInstance; } - (instancetype) defaultInstance { return defaults_borad_report_result_msgInstance; } - (NSArray *)datas { return datasArray; } - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_borad_report_result_msg*) parseFromData:(NSData*) data { return (s_borad_report_result_msg*)[[[s_borad_report_result_msg builder] mergeFromData:data] build]; } + (s_borad_report_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_result_msg*)[[[s_borad_report_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_borad_report_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_borad_report_result_msg*)[[[s_borad_report_result_msg builder] mergeFromInputStream:input] build]; } + (s_borad_report_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_result_msg*)[[[s_borad_report_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_borad_report_result_msg*)[[[s_borad_report_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_borad_report_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_result_msg*)[[[s_borad_report_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_result_msgBuilder*) builder { return [[s_borad_report_result_msgBuilder alloc] init]; } + (s_borad_report_result_msgBuilder*) builderWithPrototype:(s_borad_report_result_msg*) prototype { return [[s_borad_report_result_msg builder] mergeFrom:prototype]; } - (s_borad_report_result_msgBuilder*) builder { return [s_borad_report_result_msg builder]; } - (s_borad_report_result_msgBuilder*) toBuilder { return [s_borad_report_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_borad_report_line_data* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_borad_report_result_msg class]]) { return NO; } s_borad_report_result_msg *otherMessage = other; return [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_borad_report_result_msgBuilder() @property (strong) s_borad_report_result_msg* resultSBoradReportResultMsg; @end @implementation s_borad_report_result_msgBuilder @synthesize resultSBoradReportResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoradReportResultMsg = [[s_borad_report_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoradReportResultMsg; } - (s_borad_report_result_msgBuilder*) clear { self.resultSBoradReportResultMsg = [[s_borad_report_result_msg alloc] init]; return self; } - (s_borad_report_result_msgBuilder*) clone { return [s_borad_report_result_msg builderWithPrototype:resultSBoradReportResultMsg]; } - (s_borad_report_result_msg*) defaultInstance { return [s_borad_report_result_msg defaultInstance]; } - (s_borad_report_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_borad_report_result_msg*) buildPartial { s_borad_report_result_msg* returnMe = resultSBoradReportResultMsg; self.resultSBoradReportResultMsg = nil; return returnMe; } - (s_borad_report_result_msgBuilder*) mergeFrom:(s_borad_report_result_msg*) other { if (other == [s_borad_report_result_msg defaultInstance]) { return self; } if (other.datasArray.count > 0) { if (resultSBoradReportResultMsg.datasArray == nil) { resultSBoradReportResultMsg.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSBoradReportResultMsg.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_borad_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_borad_report_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_borad_report_line_dataBuilder* subBuilder = [s_borad_report_line_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)datas { return resultSBoradReportResultMsg.datasArray; } - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index { return [resultSBoradReportResultMsg datasAtIndex:index]; } - (s_borad_report_result_msgBuilder *)addDatas:(s_borad_report_line_data*)value { if (resultSBoradReportResultMsg.datasArray == nil) { resultSBoradReportResultMsg.datasArray = [[NSMutableArray alloc]init]; } [resultSBoradReportResultMsg.datasArray addObject:value]; return self; } - (s_borad_report_result_msgBuilder *)setDatasArray:(NSArray *)array { resultSBoradReportResultMsg.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_borad_report_result_msgBuilder *)clearDatas { resultSBoradReportResultMsg.datasArray = nil; return self; } @end @interface open_day_result_msg () @property UInt32 day; @property BOOL status; @end @implementation open_day_result_msg - (BOOL) hasDay { return !!hasDay_; } - (void) setHasDay:(BOOL) _value_ { hasDay_ = !!_value_; } @synthesize day; - (BOOL) hasStatus { return !!hasStatus_; } - (void) setHasStatus:(BOOL) _value_ { hasStatus_ = !!_value_; } - (BOOL) status { return !!status_; } - (void) setStatus:(BOOL) _value_ { status_ = !!_value_; } - (instancetype) init { if ((self = [super init])) { self.day = 0; self.status = NO; } return self; } static open_day_result_msg* defaultopen_day_result_msgInstance = nil; + (void) initialize { if (self == [open_day_result_msg class]) { defaultopen_day_result_msgInstance = [[open_day_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultopen_day_result_msgInstance; } - (instancetype) defaultInstance { return defaultopen_day_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasDay) { return NO; } if (!self.hasStatus) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasDay) { [output writeUInt32:1 value:self.day]; } if (self.hasStatus) { [output writeBool:2 value:self.status]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasDay) { size_ += computeUInt32Size(1, self.day); } if (self.hasStatus) { size_ += computeBoolSize(2, self.status); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (open_day_result_msg*) parseFromData:(NSData*) data { return (open_day_result_msg*)[[[open_day_result_msg builder] mergeFromData:data] build]; } + (open_day_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (open_day_result_msg*)[[[open_day_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (open_day_result_msg*) parseFromInputStream:(NSInputStream*) input { return (open_day_result_msg*)[[[open_day_result_msg builder] mergeFromInputStream:input] build]; } + (open_day_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (open_day_result_msg*)[[[open_day_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (open_day_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (open_day_result_msg*)[[[open_day_result_msg builder] mergeFromCodedInputStream:input] build]; } + (open_day_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (open_day_result_msg*)[[[open_day_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (open_day_result_msgBuilder*) builder { return [[open_day_result_msgBuilder alloc] init]; } + (open_day_result_msgBuilder*) builderWithPrototype:(open_day_result_msg*) prototype { return [[open_day_result_msg builder] mergeFrom:prototype]; } - (open_day_result_msgBuilder*) builder { return [open_day_result_msg builder]; } - (open_day_result_msgBuilder*) toBuilder { return [open_day_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasDay) { [output appendFormat:@"%@%@: %@\n", indent, @"day", [NSNumber numberWithInteger:self.day]]; } if (self.hasStatus) { [output appendFormat:@"%@%@: %@\n", indent, @"status", [NSNumber numberWithBool:self.status]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasDay) { [dictionary setObject: [NSNumber numberWithInteger:self.day] forKey: @"day"]; } if (self.hasStatus) { [dictionary setObject: [NSNumber numberWithBool:self.status] forKey: @"status"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[open_day_result_msg class]]) { return NO; } open_day_result_msg *otherMessage = other; return self.hasDay == otherMessage.hasDay && (!self.hasDay || self.day == otherMessage.day) && self.hasStatus == otherMessage.hasStatus && (!self.hasStatus || self.status == otherMessage.status) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasDay) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.day] hash]; } if (self.hasStatus) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.status] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface open_day_result_msgBuilder() @property (strong) open_day_result_msg* resultOpenDayResultMsg; @end @implementation open_day_result_msgBuilder @synthesize resultOpenDayResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultOpenDayResultMsg = [[open_day_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultOpenDayResultMsg; } - (open_day_result_msgBuilder*) clear { self.resultOpenDayResultMsg = [[open_day_result_msg alloc] init]; return self; } - (open_day_result_msgBuilder*) clone { return [open_day_result_msg builderWithPrototype:resultOpenDayResultMsg]; } - (open_day_result_msg*) defaultInstance { return [open_day_result_msg defaultInstance]; } - (open_day_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (open_day_result_msg*) buildPartial { open_day_result_msg* returnMe = resultOpenDayResultMsg; self.resultOpenDayResultMsg = nil; return returnMe; } - (open_day_result_msgBuilder*) mergeFrom:(open_day_result_msg*) other { if (other == [open_day_result_msg defaultInstance]) { return self; } if (other.hasDay) { [self setDay:other.day]; } if (other.hasStatus) { [self setStatus:other.status]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (open_day_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (open_day_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setDay:[input readUInt32]]; break; } case 16: { [self setStatus:[input readBool]]; break; } } } } - (BOOL) hasDay { return resultOpenDayResultMsg.hasDay; } - (UInt32) day { return resultOpenDayResultMsg.day; } - (open_day_result_msgBuilder*) setDay:(UInt32) value { resultOpenDayResultMsg.hasDay = YES; resultOpenDayResultMsg.day = value; return self; } - (open_day_result_msgBuilder*) clearDay { resultOpenDayResultMsg.hasDay = NO; resultOpenDayResultMsg.day = 0; return self; } - (BOOL) hasStatus { return resultOpenDayResultMsg.hasStatus; } - (BOOL) status { return resultOpenDayResultMsg.status; } - (open_day_result_msgBuilder*) setStatus:(BOOL) value { resultOpenDayResultMsg.hasStatus = YES; resultOpenDayResultMsg.status = value; return self; } - (open_day_result_msgBuilder*) clearStatus { resultOpenDayResultMsg.hasStatus = NO; resultOpenDayResultMsg.status = NO; return self; } @end @interface s_board_report_optional_msg () @property (strong) NSMutableArray * codesArray; @property colum_type sortColum; @property BOOL isAsc; @property (strong) PBAppendableArray * columArrayArray; @end @implementation s_board_report_optional_msg @synthesize codesArray; @dynamic codes; - (BOOL) hasSortColum { return !!hasSortColum_; } - (void) setHasSortColum:(BOOL) _value_ { hasSortColum_ = !!_value_; } @synthesize sortColum; - (BOOL) hasIsAsc { return !!hasIsAsc_; } - (void) setHasIsAsc:(BOOL) _value_ { hasIsAsc_ = !!_value_; } - (BOOL) isAsc { return !!isAsc_; } - (void) setIsAsc:(BOOL) _value_ { isAsc_ = !!_value_; } @synthesize columArrayArray; @dynamic columArray; - (instancetype) init { if ((self = [super init])) { self.sortColum = colum_typeColIndex; self.isAsc = NO; } return self; } static s_board_report_optional_msg* defaults_board_report_optional_msgInstance = nil; + (void) initialize { if (self == [s_board_report_optional_msg class]) { defaults_board_report_optional_msgInstance = [[s_board_report_optional_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_board_report_optional_msgInstance; } - (instancetype) defaultInstance { return defaults_board_report_optional_msgInstance; } - (NSArray *)codes { return codesArray; } - (NSString*)codesAtIndex:(NSUInteger)index { return [codesArray objectAtIndex:index]; } - (PBArray *)columArray { return columArrayArray; } - (colum_type)columArrayAtIndex:(NSUInteger)index { return (colum_type)[columArrayArray enumAtIndex:index]; } - (BOOL) isInitialized { return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.codesArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { [output writeString:1 value:element]; }]; if (self.hasIsAsc) { [output writeBool:2 value:self.isAsc]; } const NSUInteger columArrayArrayCount = self.columArrayArray.count; const colum_type *columArrayArrayValues = (const colum_type *)self.columArrayArray.data; for (NSUInteger i = 0; i < columArrayArrayCount; ++i) { [output writeEnum:3 value:columArrayArrayValues[i]]; } if (self.hasSortColum) { [output writeEnum:4 value:self.sortColum]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; { __block SInt32 dataSize = 0; const NSUInteger count = self.codesArray.count; [self.codesArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { dataSize += computeStringSizeNoTag(element); }]; size_ += dataSize; size_ += (SInt32)(1 * count); } if (self.hasIsAsc) { size_ += computeBoolSize(2, self.isAsc); } { SInt32 dataSize = 0; const NSUInteger count = self.columArrayArray.count; const colum_type *values = (const colum_type *)self.columArrayArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeEnumSizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } if (self.hasSortColum) { size_ += computeEnumSize(4, self.sortColum); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_board_report_optional_msg*) parseFromData:(NSData*) data { return (s_board_report_optional_msg*)[[[s_board_report_optional_msg builder] mergeFromData:data] build]; } + (s_board_report_optional_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_optional_msg*)[[[s_board_report_optional_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_board_report_optional_msg*) parseFromInputStream:(NSInputStream*) input { return (s_board_report_optional_msg*)[[[s_board_report_optional_msg builder] mergeFromInputStream:input] build]; } + (s_board_report_optional_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_optional_msg*)[[[s_board_report_optional_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_board_report_optional_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_board_report_optional_msg*)[[[s_board_report_optional_msg builder] mergeFromCodedInputStream:input] build]; } + (s_board_report_optional_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_board_report_optional_msg*)[[[s_board_report_optional_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_board_report_optional_msgBuilder*) builder { return [[s_board_report_optional_msgBuilder alloc] init]; } + (s_board_report_optional_msgBuilder*) builderWithPrototype:(s_board_report_optional_msg*) prototype { return [[s_board_report_optional_msg builder] mergeFrom:prototype]; } - (s_board_report_optional_msgBuilder*) builder { return [s_board_report_optional_msg builder]; } - (s_board_report_optional_msgBuilder*) toBuilder { return [s_board_report_optional_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.codesArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"codes", obj]; }]; if (self.hasIsAsc) { [output appendFormat:@"%@%@: %@\n", indent, @"isAsc", [NSNumber numberWithBool:self.isAsc]]; } [self.columArrayArray enumerateObjectsUsingBlock:^(id element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"columArray", NSStringFromcolum_type([(NSNumber *)element intValue])]; }]; if (self.hasSortColum) { [output appendFormat:@"%@%@: %@\n", indent, @"sortColum", NSStringFromcolum_type(self.sortColum)]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { [dictionary setObject:self.codes forKey: @"codes"]; if (self.hasIsAsc) { [dictionary setObject: [NSNumber numberWithBool:self.isAsc] forKey: @"isAsc"]; } const NSUInteger columArrayArrayCount = self.columArrayArray.count; if (columArrayArrayCount > 0) { const colum_type *columArrayArrayValues = (const colum_type *)self.columArrayArray.data; NSMutableArray * columArrayArrayArray = [NSMutableArray new]; for (NSUInteger i = 0; i < columArrayArrayCount; ++i) { [columArrayArrayArray addObject: @(columArrayArrayValues[i])]; } [dictionary setObject: columArrayArrayArray forKey: @"columArray"]; } if (self.hasSortColum) { [dictionary setObject: @(self.sortColum) forKey: @"sortColum"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_board_report_optional_msg class]]) { return NO; } s_board_report_optional_msg *otherMessage = other; return [self.codesArray isEqualToArray:otherMessage.codesArray] && self.hasIsAsc == otherMessage.hasIsAsc && (!self.hasIsAsc || self.isAsc == otherMessage.isAsc) && [self.columArrayArray isEqualToArray:otherMessage.columArrayArray] && self.hasSortColum == otherMessage.hasSortColum && (!self.hasSortColum || self.sortColum == otherMessage.sortColum) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.codesArray enumerateObjectsUsingBlock:^(NSString *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; if (self.hasIsAsc) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.isAsc] hash]; } [self.columArrayArray enumerateObjectsUsingBlock:^(NSNumber* element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + element.longValue; }]; if (self.hasSortColum) { hashCode = hashCode * 31 + self.sortColum; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_board_report_optional_msgBuilder() @property (strong) s_board_report_optional_msg* resultSBoardReportOptionalMsg; @end @implementation s_board_report_optional_msgBuilder @synthesize resultSBoardReportOptionalMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoardReportOptionalMsg = [[s_board_report_optional_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoardReportOptionalMsg; } - (s_board_report_optional_msgBuilder*) clear { self.resultSBoardReportOptionalMsg = [[s_board_report_optional_msg alloc] init]; return self; } - (s_board_report_optional_msgBuilder*) clone { return [s_board_report_optional_msg builderWithPrototype:resultSBoardReportOptionalMsg]; } - (s_board_report_optional_msg*) defaultInstance { return [s_board_report_optional_msg defaultInstance]; } - (s_board_report_optional_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_board_report_optional_msg*) buildPartial { s_board_report_optional_msg* returnMe = resultSBoardReportOptionalMsg; self.resultSBoardReportOptionalMsg = nil; return returnMe; } - (s_board_report_optional_msgBuilder*) mergeFrom:(s_board_report_optional_msg*) other { if (other == [s_board_report_optional_msg defaultInstance]) { return self; } if (other.codesArray.count > 0) { if (resultSBoardReportOptionalMsg.codesArray == nil) { resultSBoardReportOptionalMsg.codesArray = [[NSMutableArray alloc] initWithArray:other.codesArray]; } else { [resultSBoardReportOptionalMsg.codesArray addObjectsFromArray:other.codesArray]; } } if (other.hasSortColum) { [self setSortColum:other.sortColum]; } if (other.hasIsAsc) { [self setIsAsc:other.isAsc]; } if (other.columArrayArray.count > 0) { if (resultSBoardReportOptionalMsg.columArrayArray == nil) { resultSBoardReportOptionalMsg.columArrayArray = [other.columArrayArray copy]; } else { [resultSBoardReportOptionalMsg.columArrayArray appendArray:other.columArrayArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_board_report_optional_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_board_report_optional_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self addCodes:[input readString]]; break; } case 16: { [self setIsAsc:[input readBool]]; break; } case 24: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self addColumArray:value]; } else { [unknownFields mergeVarintField:3 value:value]; } break; } case 32: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self setSortColum:value]; } else { [unknownFields mergeVarintField:4 value:value]; } break; } } } } - (NSMutableArray *)codes { return resultSBoardReportOptionalMsg.codesArray; } - (NSString*)codesAtIndex:(NSUInteger)index { return [resultSBoardReportOptionalMsg codesAtIndex:index]; } - (s_board_report_optional_msgBuilder *)addCodes:(NSString*)value { if (resultSBoardReportOptionalMsg.codesArray == nil) { resultSBoardReportOptionalMsg.codesArray = [[NSMutableArray alloc]init]; } [resultSBoardReportOptionalMsg.codesArray addObject:value]; return self; } - (s_board_report_optional_msgBuilder *)setCodesArray:(NSArray *)array { resultSBoardReportOptionalMsg.codesArray = [[NSMutableArray alloc] initWithArray:array]; return self; } - (s_board_report_optional_msgBuilder *)clearCodes { resultSBoardReportOptionalMsg.codesArray = nil; return self; } - (BOOL) hasSortColum { return resultSBoardReportOptionalMsg.hasSortColum; } - (colum_type) sortColum { return resultSBoardReportOptionalMsg.sortColum; } - (s_board_report_optional_msgBuilder*) setSortColum:(colum_type) value { resultSBoardReportOptionalMsg.hasSortColum = YES; resultSBoardReportOptionalMsg.sortColum = value; return self; } - (s_board_report_optional_msgBuilder*) clearSortColum { resultSBoardReportOptionalMsg.hasSortColum = NO; resultSBoardReportOptionalMsg.sortColum = colum_typeColIndex; return self; } - (BOOL) hasIsAsc { return resultSBoardReportOptionalMsg.hasIsAsc; } - (BOOL) isAsc { return resultSBoardReportOptionalMsg.isAsc; } - (s_board_report_optional_msgBuilder*) setIsAsc:(BOOL) value { resultSBoardReportOptionalMsg.hasIsAsc = YES; resultSBoardReportOptionalMsg.isAsc = value; return self; } - (s_board_report_optional_msgBuilder*) clearIsAsc { resultSBoardReportOptionalMsg.hasIsAsc = NO; resultSBoardReportOptionalMsg.isAsc = NO; return self; } - (PBAppendableArray *)columArray { return resultSBoardReportOptionalMsg.columArrayArray; } - (colum_type)columArrayAtIndex:(NSUInteger)index { return [resultSBoardReportOptionalMsg columArrayAtIndex:index]; } - (s_board_report_optional_msgBuilder *)addColumArray:(colum_type)value { if (resultSBoardReportOptionalMsg.columArrayArray == nil) { resultSBoardReportOptionalMsg.columArrayArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultSBoardReportOptionalMsg.columArrayArray addEnum:value]; return self; } - (s_board_report_optional_msgBuilder *)setColumArrayArray:(NSArray *)array { resultSBoardReportOptionalMsg.columArrayArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (s_board_report_optional_msgBuilder *)setColumArrayValues:(const colum_type *)values count:(NSUInteger)count { resultSBoardReportOptionalMsg.columArrayArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (s_board_report_optional_msgBuilder *)clearColumArray { resultSBoardReportOptionalMsg.columArrayArray = nil; return self; } @end @interface s_borad_report_optional_result_msg () @property (strong) NSMutableArray * datasArray; @end @implementation s_borad_report_optional_result_msg @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { } return self; } static s_borad_report_optional_result_msg* defaults_borad_report_optional_result_msgInstance = nil; + (void) initialize { if (self == [s_borad_report_optional_result_msg class]) { defaults_borad_report_optional_result_msgInstance = [[s_borad_report_optional_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_borad_report_optional_result_msgInstance; } - (instancetype) defaultInstance { return defaults_borad_report_optional_result_msgInstance; } - (NSArray *)datas { return datasArray; } - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_borad_report_optional_result_msg*) parseFromData:(NSData*) data { return (s_borad_report_optional_result_msg*)[[[s_borad_report_optional_result_msg builder] mergeFromData:data] build]; } + (s_borad_report_optional_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_optional_result_msg*)[[[s_borad_report_optional_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_borad_report_optional_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_borad_report_optional_result_msg*)[[[s_borad_report_optional_result_msg builder] mergeFromInputStream:input] build]; } + (s_borad_report_optional_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_optional_result_msg*)[[[s_borad_report_optional_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_optional_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_borad_report_optional_result_msg*)[[[s_borad_report_optional_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_borad_report_optional_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_optional_result_msg*)[[[s_borad_report_optional_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_optional_result_msgBuilder*) builder { return [[s_borad_report_optional_result_msgBuilder alloc] init]; } + (s_borad_report_optional_result_msgBuilder*) builderWithPrototype:(s_borad_report_optional_result_msg*) prototype { return [[s_borad_report_optional_result_msg builder] mergeFrom:prototype]; } - (s_borad_report_optional_result_msgBuilder*) builder { return [s_borad_report_optional_result_msg builder]; } - (s_borad_report_optional_result_msgBuilder*) toBuilder { return [s_borad_report_optional_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_borad_report_line_data* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_borad_report_optional_result_msg class]]) { return NO; } s_borad_report_optional_result_msg *otherMessage = other; return [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_borad_report_optional_result_msgBuilder() @property (strong) s_borad_report_optional_result_msg* resultSBoradReportOptionalResultMsg; @end @implementation s_borad_report_optional_result_msgBuilder @synthesize resultSBoradReportOptionalResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoradReportOptionalResultMsg = [[s_borad_report_optional_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoradReportOptionalResultMsg; } - (s_borad_report_optional_result_msgBuilder*) clear { self.resultSBoradReportOptionalResultMsg = [[s_borad_report_optional_result_msg alloc] init]; return self; } - (s_borad_report_optional_result_msgBuilder*) clone { return [s_borad_report_optional_result_msg builderWithPrototype:resultSBoradReportOptionalResultMsg]; } - (s_borad_report_optional_result_msg*) defaultInstance { return [s_borad_report_optional_result_msg defaultInstance]; } - (s_borad_report_optional_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_borad_report_optional_result_msg*) buildPartial { s_borad_report_optional_result_msg* returnMe = resultSBoradReportOptionalResultMsg; self.resultSBoradReportOptionalResultMsg = nil; return returnMe; } - (s_borad_report_optional_result_msgBuilder*) mergeFrom:(s_borad_report_optional_result_msg*) other { if (other == [s_borad_report_optional_result_msg defaultInstance]) { return self; } if (other.datasArray.count > 0) { if (resultSBoradReportOptionalResultMsg.datasArray == nil) { resultSBoradReportOptionalResultMsg.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSBoradReportOptionalResultMsg.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_borad_report_optional_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_borad_report_optional_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_borad_report_line_dataBuilder* subBuilder = [s_borad_report_line_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)datas { return resultSBoradReportOptionalResultMsg.datasArray; } - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index { return [resultSBoradReportOptionalResultMsg datasAtIndex:index]; } - (s_borad_report_optional_result_msgBuilder *)addDatas:(s_borad_report_line_data*)value { if (resultSBoradReportOptionalResultMsg.datasArray == nil) { resultSBoradReportOptionalResultMsg.datasArray = [[NSMutableArray alloc]init]; } [resultSBoradReportOptionalResultMsg.datasArray addObject:value]; return self; } - (s_borad_report_optional_result_msgBuilder *)setDatasArray:(NSArray *)array { resultSBoradReportOptionalResultMsg.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_borad_report_optional_result_msgBuilder *)clearDatas { resultSBoradReportOptionalResultMsg.datasArray = nil; return self; } @end @interface s_borad_report_top_msg () @property (strong) PBAppendableArray * blockCodesArray; @property colum_type sortColum; @property BOOL isAsc; @property (strong) PBAppendableArray * columArrayArray; @property UInt32 count; @end @implementation s_borad_report_top_msg @synthesize blockCodesArray; @dynamic blockCodes; - (BOOL) hasSortColum { return !!hasSortColum_; } - (void) setHasSortColum:(BOOL) _value_ { hasSortColum_ = !!_value_; } @synthesize sortColum; - (BOOL) hasIsAsc { return !!hasIsAsc_; } - (void) setHasIsAsc:(BOOL) _value_ { hasIsAsc_ = !!_value_; } - (BOOL) isAsc { return !!isAsc_; } - (void) setIsAsc:(BOOL) _value_ { isAsc_ = !!_value_; } @synthesize columArrayArray; @dynamic columArray; - (BOOL) hasCount { return !!hasCount_; } - (void) setHasCount:(BOOL) _value_ { hasCount_ = !!_value_; } @synthesize count; - (instancetype) init { if ((self = [super init])) { self.sortColum = colum_typeColIndex; self.isAsc = NO; self.count = 0; } return self; } static s_borad_report_top_msg* defaults_borad_report_top_msgInstance = nil; + (void) initialize { if (self == [s_borad_report_top_msg class]) { defaults_borad_report_top_msgInstance = [[s_borad_report_top_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_borad_report_top_msgInstance; } - (instancetype) defaultInstance { return defaults_borad_report_top_msgInstance; } - (PBArray *)blockCodes { return blockCodesArray; } - (UInt32)blockCodesAtIndex:(NSUInteger)index { return [blockCodesArray uint32AtIndex:index]; } - (PBArray *)columArray { return columArrayArray; } - (colum_type)columArrayAtIndex:(NSUInteger)index { return (colum_type)[columArrayArray enumAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasSortColum) { return NO; } if (!self.hasIsAsc) { return NO; } if (!self.hasCount) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { const NSUInteger blockCodesArrayCount = self.blockCodesArray.count; if (blockCodesArrayCount > 0) { const UInt32 *values = (const UInt32 *)self.blockCodesArray.data; for (NSUInteger i = 0; i < blockCodesArrayCount; ++i) { [output writeUInt32:1 value:values[i]]; } } if (self.hasSortColum) { [output writeEnum:2 value:self.sortColum]; } if (self.hasIsAsc) { [output writeBool:3 value:self.isAsc]; } const NSUInteger columArrayArrayCount = self.columArrayArray.count; const colum_type *columArrayArrayValues = (const colum_type *)self.columArrayArray.data; for (NSUInteger i = 0; i < columArrayArrayCount; ++i) { [output writeEnum:4 value:columArrayArrayValues[i]]; } if (self.hasCount) { [output writeUInt32:5 value:self.count]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; { __block SInt32 dataSize = 0; const NSUInteger count = self.blockCodesArray.count; const UInt32 *values = (const UInt32 *)self.blockCodesArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeUInt32SizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } if (self.hasSortColum) { size_ += computeEnumSize(2, self.sortColum); } if (self.hasIsAsc) { size_ += computeBoolSize(3, self.isAsc); } { SInt32 dataSize = 0; const NSUInteger count = self.columArrayArray.count; const colum_type *values = (const colum_type *)self.columArrayArray.data; for (NSUInteger i = 0; i < count; ++i) { dataSize += computeEnumSizeNoTag(values[i]); } size_ += dataSize; size_ += (SInt32)(1 * count); } if (self.hasCount) { size_ += computeUInt32Size(5, self.count); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_borad_report_top_msg*) parseFromData:(NSData*) data { return (s_borad_report_top_msg*)[[[s_borad_report_top_msg builder] mergeFromData:data] build]; } + (s_borad_report_top_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_top_msg*)[[[s_borad_report_top_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_borad_report_top_msg*) parseFromInputStream:(NSInputStream*) input { return (s_borad_report_top_msg*)[[[s_borad_report_top_msg builder] mergeFromInputStream:input] build]; } + (s_borad_report_top_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_top_msg*)[[[s_borad_report_top_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_top_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_borad_report_top_msg*)[[[s_borad_report_top_msg builder] mergeFromCodedInputStream:input] build]; } + (s_borad_report_top_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_top_msg*)[[[s_borad_report_top_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_top_msgBuilder*) builder { return [[s_borad_report_top_msgBuilder alloc] init]; } + (s_borad_report_top_msgBuilder*) builderWithPrototype:(s_borad_report_top_msg*) prototype { return [[s_borad_report_top_msg builder] mergeFrom:prototype]; } - (s_borad_report_top_msgBuilder*) builder { return [s_borad_report_top_msg builder]; } - (s_borad_report_top_msgBuilder*) toBuilder { return [s_borad_report_top_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.blockCodesArray enumerateObjectsUsingBlock:^(id obj, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"blockCodes", obj]; }]; if (self.hasSortColum) { [output appendFormat:@"%@%@: %@\n", indent, @"sortColum", NSStringFromcolum_type(self.sortColum)]; } if (self.hasIsAsc) { [output appendFormat:@"%@%@: %@\n", indent, @"isAsc", [NSNumber numberWithBool:self.isAsc]]; } [self.columArrayArray enumerateObjectsUsingBlock:^(id element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@: %@\n", indent, @"columArray", NSStringFromcolum_type([(NSNumber *)element intValue])]; }]; if (self.hasCount) { [output appendFormat:@"%@%@: %@\n", indent, @"count", [NSNumber numberWithInteger:self.count]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { NSMutableArray * blockCodesArrayArray = [NSMutableArray new]; NSUInteger blockCodesArrayCount=self.blockCodesArray.count; for(int i=0;i 0) { const colum_type *columArrayArrayValues = (const colum_type *)self.columArrayArray.data; NSMutableArray * columArrayArrayArray = [NSMutableArray new]; for (NSUInteger i = 0; i < columArrayArrayCount; ++i) { [columArrayArrayArray addObject: @(columArrayArrayValues[i])]; } [dictionary setObject: columArrayArrayArray forKey: @"columArray"]; } if (self.hasCount) { [dictionary setObject: [NSNumber numberWithInteger:self.count] forKey: @"count"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_borad_report_top_msg class]]) { return NO; } s_borad_report_top_msg *otherMessage = other; return [self.blockCodesArray isEqualToArray:otherMessage.blockCodesArray] && self.hasSortColum == otherMessage.hasSortColum && (!self.hasSortColum || self.sortColum == otherMessage.sortColum) && self.hasIsAsc == otherMessage.hasIsAsc && (!self.hasIsAsc || self.isAsc == otherMessage.isAsc) && [self.columArrayArray isEqualToArray:otherMessage.columArrayArray] && self.hasCount == otherMessage.hasCount && (!self.hasCount || self.count == otherMessage.count) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.blockCodesArray enumerateObjectsUsingBlock:^(NSNumber *obj, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [obj longValue]; }]; if (self.hasSortColum) { hashCode = hashCode * 31 + self.sortColum; } if (self.hasIsAsc) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.isAsc] hash]; } [self.columArrayArray enumerateObjectsUsingBlock:^(NSNumber* element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + element.longValue; }]; if (self.hasCount) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.count] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_borad_report_top_msgBuilder() @property (strong) s_borad_report_top_msg* resultSBoradReportTopMsg; @end @implementation s_borad_report_top_msgBuilder @synthesize resultSBoradReportTopMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoradReportTopMsg = [[s_borad_report_top_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoradReportTopMsg; } - (s_borad_report_top_msgBuilder*) clear { self.resultSBoradReportTopMsg = [[s_borad_report_top_msg alloc] init]; return self; } - (s_borad_report_top_msgBuilder*) clone { return [s_borad_report_top_msg builderWithPrototype:resultSBoradReportTopMsg]; } - (s_borad_report_top_msg*) defaultInstance { return [s_borad_report_top_msg defaultInstance]; } - (s_borad_report_top_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_borad_report_top_msg*) buildPartial { s_borad_report_top_msg* returnMe = resultSBoradReportTopMsg; self.resultSBoradReportTopMsg = nil; return returnMe; } - (s_borad_report_top_msgBuilder*) mergeFrom:(s_borad_report_top_msg*) other { if (other == [s_borad_report_top_msg defaultInstance]) { return self; } if (other.blockCodesArray.count > 0) { if (resultSBoradReportTopMsg.blockCodesArray == nil) { resultSBoradReportTopMsg.blockCodesArray = [other.blockCodesArray copy]; } else { [resultSBoradReportTopMsg.blockCodesArray appendArray:other.blockCodesArray]; } } if (other.hasSortColum) { [self setSortColum:other.sortColum]; } if (other.hasIsAsc) { [self setIsAsc:other.isAsc]; } if (other.columArrayArray.count > 0) { if (resultSBoradReportTopMsg.columArrayArray == nil) { resultSBoradReportTopMsg.columArrayArray = [other.columArrayArray copy]; } else { [resultSBoradReportTopMsg.columArrayArray appendArray:other.columArrayArray]; } } if (other.hasCount) { [self setCount:other.count]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_borad_report_top_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_borad_report_top_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self addBlockCodes:[input readUInt32]]; break; } case 16: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self setSortColum:value]; } else { [unknownFields mergeVarintField:2 value:value]; } break; } case 24: { [self setIsAsc:[input readBool]]; break; } case 32: { colum_type value = (colum_type)[input readEnum]; if (colum_typeIsValidValue(value)) { [self addColumArray:value]; } else { [unknownFields mergeVarintField:4 value:value]; } break; } case 40: { [self setCount:[input readUInt32]]; break; } } } } - (PBAppendableArray *)blockCodes { return resultSBoradReportTopMsg.blockCodesArray; } - (UInt32)blockCodesAtIndex:(NSUInteger)index { return [resultSBoradReportTopMsg blockCodesAtIndex:index]; } - (s_borad_report_top_msgBuilder *)addBlockCodes:(UInt32)value { if (resultSBoradReportTopMsg.blockCodesArray == nil) { resultSBoradReportTopMsg.blockCodesArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeUInt32]; } [resultSBoradReportTopMsg.blockCodesArray addUint32:value]; return self; } - (s_borad_report_top_msgBuilder *)setBlockCodesArray:(NSArray *)array { resultSBoradReportTopMsg.blockCodesArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeUInt32]; return self; } - (s_borad_report_top_msgBuilder *)setBlockCodesValues:(const UInt32 *)values count:(NSUInteger)count { resultSBoradReportTopMsg.blockCodesArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeUInt32]; return self; } - (s_borad_report_top_msgBuilder *)clearBlockCodes { resultSBoradReportTopMsg.blockCodesArray = nil; return self; } - (BOOL) hasSortColum { return resultSBoradReportTopMsg.hasSortColum; } - (colum_type) sortColum { return resultSBoradReportTopMsg.sortColum; } - (s_borad_report_top_msgBuilder*) setSortColum:(colum_type) value { resultSBoradReportTopMsg.hasSortColum = YES; resultSBoradReportTopMsg.sortColum = value; return self; } - (s_borad_report_top_msgBuilder*) clearSortColum { resultSBoradReportTopMsg.hasSortColum = NO; resultSBoradReportTopMsg.sortColum = colum_typeColIndex; return self; } - (BOOL) hasIsAsc { return resultSBoradReportTopMsg.hasIsAsc; } - (BOOL) isAsc { return resultSBoradReportTopMsg.isAsc; } - (s_borad_report_top_msgBuilder*) setIsAsc:(BOOL) value { resultSBoradReportTopMsg.hasIsAsc = YES; resultSBoradReportTopMsg.isAsc = value; return self; } - (s_borad_report_top_msgBuilder*) clearIsAsc { resultSBoradReportTopMsg.hasIsAsc = NO; resultSBoradReportTopMsg.isAsc = NO; return self; } - (PBAppendableArray *)columArray { return resultSBoradReportTopMsg.columArrayArray; } - (colum_type)columArrayAtIndex:(NSUInteger)index { return [resultSBoradReportTopMsg columArrayAtIndex:index]; } - (s_borad_report_top_msgBuilder *)addColumArray:(colum_type)value { if (resultSBoradReportTopMsg.columArrayArray == nil) { resultSBoradReportTopMsg.columArrayArray = [PBAppendableArray arrayWithValueType:PBArrayValueTypeInt32]; } [resultSBoradReportTopMsg.columArrayArray addEnum:value]; return self; } - (s_borad_report_top_msgBuilder *)setColumArrayArray:(NSArray *)array { resultSBoradReportTopMsg.columArrayArray = [PBAppendableArray arrayWithArray:array valueType:PBArrayValueTypeInt32]; return self; } - (s_borad_report_top_msgBuilder *)setColumArrayValues:(const colum_type *)values count:(NSUInteger)count { resultSBoradReportTopMsg.columArrayArray = [PBAppendableArray arrayWithValues:values count:count valueType:PBArrayValueTypeInt32]; return self; } - (s_borad_report_top_msgBuilder *)clearColumArray { resultSBoradReportTopMsg.columArrayArray = nil; return self; } - (BOOL) hasCount { return resultSBoradReportTopMsg.hasCount; } - (UInt32) count { return resultSBoradReportTopMsg.count; } - (s_borad_report_top_msgBuilder*) setCount:(UInt32) value { resultSBoradReportTopMsg.hasCount = YES; resultSBoradReportTopMsg.count = value; return self; } - (s_borad_report_top_msgBuilder*) clearCount { resultSBoradReportTopMsg.hasCount = NO; resultSBoradReportTopMsg.count = 0; return self; } @end @interface s_borad_report_block_msg () @property (strong) NSString* code; @property (strong) NSString* name; @property (strong) NSMutableArray * datasArray; @end @implementation s_borad_report_block_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; } return self; } static s_borad_report_block_msg* defaults_borad_report_block_msgInstance = nil; + (void) initialize { if (self == [s_borad_report_block_msg class]) { defaults_borad_report_block_msgInstance = [[s_borad_report_block_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_borad_report_block_msgInstance; } - (instancetype) defaultInstance { return defaults_borad_report_block_msgInstance; } - (NSArray *)datas { return datasArray; } - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:3 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(3, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_borad_report_block_msg*) parseFromData:(NSData*) data { return (s_borad_report_block_msg*)[[[s_borad_report_block_msg builder] mergeFromData:data] build]; } + (s_borad_report_block_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_block_msg*)[[[s_borad_report_block_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_borad_report_block_msg*) parseFromInputStream:(NSInputStream*) input { return (s_borad_report_block_msg*)[[[s_borad_report_block_msg builder] mergeFromInputStream:input] build]; } + (s_borad_report_block_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_block_msg*)[[[s_borad_report_block_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_block_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_borad_report_block_msg*)[[[s_borad_report_block_msg builder] mergeFromCodedInputStream:input] build]; } + (s_borad_report_block_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_block_msg*)[[[s_borad_report_block_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_block_msgBuilder*) builder { return [[s_borad_report_block_msgBuilder alloc] init]; } + (s_borad_report_block_msgBuilder*) builderWithPrototype:(s_borad_report_block_msg*) prototype { return [[s_borad_report_block_msg builder] mergeFrom:prototype]; } - (s_borad_report_block_msgBuilder*) builder { return [s_borad_report_block_msg builder]; } - (s_borad_report_block_msgBuilder*) toBuilder { return [s_borad_report_block_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } for (s_borad_report_line_data* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_borad_report_block_msg class]]) { return NO; } s_borad_report_block_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_line_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_borad_report_block_msgBuilder() @property (strong) s_borad_report_block_msg* resultSBoradReportBlockMsg; @end @implementation s_borad_report_block_msgBuilder @synthesize resultSBoradReportBlockMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoradReportBlockMsg = [[s_borad_report_block_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoradReportBlockMsg; } - (s_borad_report_block_msgBuilder*) clear { self.resultSBoradReportBlockMsg = [[s_borad_report_block_msg alloc] init]; return self; } - (s_borad_report_block_msgBuilder*) clone { return [s_borad_report_block_msg builderWithPrototype:resultSBoradReportBlockMsg]; } - (s_borad_report_block_msg*) defaultInstance { return [s_borad_report_block_msg defaultInstance]; } - (s_borad_report_block_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_borad_report_block_msg*) buildPartial { s_borad_report_block_msg* returnMe = resultSBoradReportBlockMsg; self.resultSBoradReportBlockMsg = nil; return returnMe; } - (s_borad_report_block_msgBuilder*) mergeFrom:(s_borad_report_block_msg*) other { if (other == [s_borad_report_block_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.datasArray.count > 0) { if (resultSBoradReportBlockMsg.datasArray == nil) { resultSBoradReportBlockMsg.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSBoradReportBlockMsg.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_borad_report_block_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_borad_report_block_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } case 26: { s_borad_report_line_dataBuilder* subBuilder = [s_borad_report_line_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasCode { return resultSBoradReportBlockMsg.hasCode; } - (NSString*) code { return resultSBoradReportBlockMsg.code; } - (s_borad_report_block_msgBuilder*) setCode:(NSString*) value { resultSBoradReportBlockMsg.hasCode = YES; resultSBoradReportBlockMsg.code = value; return self; } - (s_borad_report_block_msgBuilder*) clearCode { resultSBoradReportBlockMsg.hasCode = NO; resultSBoradReportBlockMsg.code = @""; return self; } - (BOOL) hasName { return resultSBoradReportBlockMsg.hasName; } - (NSString*) name { return resultSBoradReportBlockMsg.name; } - (s_borad_report_block_msgBuilder*) setName:(NSString*) value { resultSBoradReportBlockMsg.hasName = YES; resultSBoradReportBlockMsg.name = value; return self; } - (s_borad_report_block_msgBuilder*) clearName { resultSBoradReportBlockMsg.hasName = NO; resultSBoradReportBlockMsg.name = @""; return self; } - (NSMutableArray *)datas { return resultSBoradReportBlockMsg.datasArray; } - (s_borad_report_line_data*)datasAtIndex:(NSUInteger)index { return [resultSBoradReportBlockMsg datasAtIndex:index]; } - (s_borad_report_block_msgBuilder *)addDatas:(s_borad_report_line_data*)value { if (resultSBoradReportBlockMsg.datasArray == nil) { resultSBoradReportBlockMsg.datasArray = [[NSMutableArray alloc]init]; } [resultSBoradReportBlockMsg.datasArray addObject:value]; return self; } - (s_borad_report_block_msgBuilder *)setDatasArray:(NSArray *)array { resultSBoradReportBlockMsg.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_borad_report_block_msgBuilder *)clearDatas { resultSBoradReportBlockMsg.datasArray = nil; return self; } @end @interface s_borad_report_top_result_msg () @property (strong) NSMutableArray * datasArray; @end @implementation s_borad_report_top_result_msg @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { } return self; } static s_borad_report_top_result_msg* defaults_borad_report_top_result_msgInstance = nil; + (void) initialize { if (self == [s_borad_report_top_result_msg class]) { defaults_borad_report_top_result_msgInstance = [[s_borad_report_top_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_borad_report_top_result_msgInstance; } - (instancetype) defaultInstance { return defaults_borad_report_top_result_msgInstance; } - (NSArray *)datas { return datasArray; } - (s_borad_report_block_msg*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_borad_report_block_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_block_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_block_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_borad_report_top_result_msg*) parseFromData:(NSData*) data { return (s_borad_report_top_result_msg*)[[[s_borad_report_top_result_msg builder] mergeFromData:data] build]; } + (s_borad_report_top_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_top_result_msg*)[[[s_borad_report_top_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_borad_report_top_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_borad_report_top_result_msg*)[[[s_borad_report_top_result_msg builder] mergeFromInputStream:input] build]; } + (s_borad_report_top_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_top_result_msg*)[[[s_borad_report_top_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_top_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_borad_report_top_result_msg*)[[[s_borad_report_top_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_borad_report_top_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_borad_report_top_result_msg*)[[[s_borad_report_top_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_borad_report_top_result_msgBuilder*) builder { return [[s_borad_report_top_result_msgBuilder alloc] init]; } + (s_borad_report_top_result_msgBuilder*) builderWithPrototype:(s_borad_report_top_result_msg*) prototype { return [[s_borad_report_top_result_msg builder] mergeFrom:prototype]; } - (s_borad_report_top_result_msgBuilder*) builder { return [s_borad_report_top_result_msg builder]; } - (s_borad_report_top_result_msgBuilder*) toBuilder { return [s_borad_report_top_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_block_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_borad_report_block_msg* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_borad_report_top_result_msg class]]) { return NO; } s_borad_report_top_result_msg *otherMessage = other; return [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.datasArray enumerateObjectsUsingBlock:^(s_borad_report_block_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_borad_report_top_result_msgBuilder() @property (strong) s_borad_report_top_result_msg* resultSBoradReportTopResultMsg; @end @implementation s_borad_report_top_result_msgBuilder @synthesize resultSBoradReportTopResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBoradReportTopResultMsg = [[s_borad_report_top_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBoradReportTopResultMsg; } - (s_borad_report_top_result_msgBuilder*) clear { self.resultSBoradReportTopResultMsg = [[s_borad_report_top_result_msg alloc] init]; return self; } - (s_borad_report_top_result_msgBuilder*) clone { return [s_borad_report_top_result_msg builderWithPrototype:resultSBoradReportTopResultMsg]; } - (s_borad_report_top_result_msg*) defaultInstance { return [s_borad_report_top_result_msg defaultInstance]; } - (s_borad_report_top_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_borad_report_top_result_msg*) buildPartial { s_borad_report_top_result_msg* returnMe = resultSBoradReportTopResultMsg; self.resultSBoradReportTopResultMsg = nil; return returnMe; } - (s_borad_report_top_result_msgBuilder*) mergeFrom:(s_borad_report_top_result_msg*) other { if (other == [s_borad_report_top_result_msg defaultInstance]) { return self; } if (other.datasArray.count > 0) { if (resultSBoradReportTopResultMsg.datasArray == nil) { resultSBoradReportTopResultMsg.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSBoradReportTopResultMsg.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_borad_report_top_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_borad_report_top_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_borad_report_block_msgBuilder* subBuilder = [s_borad_report_block_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)datas { return resultSBoradReportTopResultMsg.datasArray; } - (s_borad_report_block_msg*)datasAtIndex:(NSUInteger)index { return [resultSBoradReportTopResultMsg datasAtIndex:index]; } - (s_borad_report_top_result_msgBuilder *)addDatas:(s_borad_report_block_msg*)value { if (resultSBoradReportTopResultMsg.datasArray == nil) { resultSBoradReportTopResultMsg.datasArray = [[NSMutableArray alloc]init]; } [resultSBoradReportTopResultMsg.datasArray addObject:value]; return self; } - (s_borad_report_top_result_msgBuilder *)setDatasArray:(NSArray *)array { resultSBoradReportTopResultMsg.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_borad_report_top_result_msgBuilder *)clearDatas { resultSBoradReportTopResultMsg.datasArray = nil; return self; } @end @interface s_index_keep_line_msg () @property (strong) NSString* code; @property (strong) NSString* name; @property Float64 vol; @property Float64 buykeep; @property Float64 sellkeep; @property Float64 voldif; @property Float64 buykeepdif; @property Float64 sellkeepdif; @end @implementation s_index_keep_line_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (BOOL) hasVol { return !!hasVol_; } - (void) setHasVol:(BOOL) _value_ { hasVol_ = !!_value_; } @synthesize vol; - (BOOL) hasBuykeep { return !!hasBuykeep_; } - (void) setHasBuykeep:(BOOL) _value_ { hasBuykeep_ = !!_value_; } @synthesize buykeep; - (BOOL) hasSellkeep { return !!hasSellkeep_; } - (void) setHasSellkeep:(BOOL) _value_ { hasSellkeep_ = !!_value_; } @synthesize sellkeep; - (BOOL) hasVoldif { return !!hasVoldif_; } - (void) setHasVoldif:(BOOL) _value_ { hasVoldif_ = !!_value_; } @synthesize voldif; - (BOOL) hasBuykeepdif { return !!hasBuykeepdif_; } - (void) setHasBuykeepdif:(BOOL) _value_ { hasBuykeepdif_ = !!_value_; } @synthesize buykeepdif; - (BOOL) hasSellkeepdif { return !!hasSellkeepdif_; } - (void) setHasSellkeepdif:(BOOL) _value_ { hasSellkeepdif_ = !!_value_; } @synthesize sellkeepdif; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; self.vol = 0; self.buykeep = 0; self.sellkeep = 0; self.voldif = 0; self.buykeepdif = 0; self.sellkeepdif = 0; } return self; } static s_index_keep_line_msg* defaults_index_keep_line_msgInstance = nil; + (void) initialize { if (self == [s_index_keep_line_msg class]) { defaults_index_keep_line_msgInstance = [[s_index_keep_line_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_index_keep_line_msgInstance; } - (instancetype) defaultInstance { return defaults_index_keep_line_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } if (!self.hasVol) { return NO; } if (!self.hasBuykeep) { return NO; } if (!self.hasSellkeep) { return NO; } if (!self.hasVoldif) { return NO; } if (!self.hasBuykeepdif) { return NO; } if (!self.hasSellkeepdif) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } if (self.hasVol) { [output writeDouble:3 value:self.vol]; } if (self.hasBuykeep) { [output writeDouble:4 value:self.buykeep]; } if (self.hasSellkeep) { [output writeDouble:5 value:self.sellkeep]; } if (self.hasVoldif) { [output writeDouble:6 value:self.voldif]; } if (self.hasBuykeepdif) { [output writeDouble:7 value:self.buykeepdif]; } if (self.hasSellkeepdif) { [output writeDouble:8 value:self.sellkeepdif]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } if (self.hasVol) { size_ += computeDoubleSize(3, self.vol); } if (self.hasBuykeep) { size_ += computeDoubleSize(4, self.buykeep); } if (self.hasSellkeep) { size_ += computeDoubleSize(5, self.sellkeep); } if (self.hasVoldif) { size_ += computeDoubleSize(6, self.voldif); } if (self.hasBuykeepdif) { size_ += computeDoubleSize(7, self.buykeepdif); } if (self.hasSellkeepdif) { size_ += computeDoubleSize(8, self.sellkeepdif); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_index_keep_line_msg*) parseFromData:(NSData*) data { return (s_index_keep_line_msg*)[[[s_index_keep_line_msg builder] mergeFromData:data] build]; } + (s_index_keep_line_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_index_keep_line_msg*)[[[s_index_keep_line_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_index_keep_line_msg*) parseFromInputStream:(NSInputStream*) input { return (s_index_keep_line_msg*)[[[s_index_keep_line_msg builder] mergeFromInputStream:input] build]; } + (s_index_keep_line_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_index_keep_line_msg*)[[[s_index_keep_line_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_index_keep_line_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_index_keep_line_msg*)[[[s_index_keep_line_msg builder] mergeFromCodedInputStream:input] build]; } + (s_index_keep_line_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_index_keep_line_msg*)[[[s_index_keep_line_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_index_keep_line_msgBuilder*) builder { return [[s_index_keep_line_msgBuilder alloc] init]; } + (s_index_keep_line_msgBuilder*) builderWithPrototype:(s_index_keep_line_msg*) prototype { return [[s_index_keep_line_msg builder] mergeFrom:prototype]; } - (s_index_keep_line_msgBuilder*) builder { return [s_index_keep_line_msg builder]; } - (s_index_keep_line_msgBuilder*) toBuilder { return [s_index_keep_line_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } if (self.hasVol) { [output appendFormat:@"%@%@: %@\n", indent, @"vol", [NSNumber numberWithDouble:self.vol]]; } if (self.hasBuykeep) { [output appendFormat:@"%@%@: %@\n", indent, @"buykeep", [NSNumber numberWithDouble:self.buykeep]]; } if (self.hasSellkeep) { [output appendFormat:@"%@%@: %@\n", indent, @"sellkeep", [NSNumber numberWithDouble:self.sellkeep]]; } if (self.hasVoldif) { [output appendFormat:@"%@%@: %@\n", indent, @"voldif", [NSNumber numberWithDouble:self.voldif]]; } if (self.hasBuykeepdif) { [output appendFormat:@"%@%@: %@\n", indent, @"buykeepdif", [NSNumber numberWithDouble:self.buykeepdif]]; } if (self.hasSellkeepdif) { [output appendFormat:@"%@%@: %@\n", indent, @"sellkeepdif", [NSNumber numberWithDouble:self.sellkeepdif]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } if (self.hasVol) { [dictionary setObject: [NSNumber numberWithDouble:self.vol] forKey: @"vol"]; } if (self.hasBuykeep) { [dictionary setObject: [NSNumber numberWithDouble:self.buykeep] forKey: @"buykeep"]; } if (self.hasSellkeep) { [dictionary setObject: [NSNumber numberWithDouble:self.sellkeep] forKey: @"sellkeep"]; } if (self.hasVoldif) { [dictionary setObject: [NSNumber numberWithDouble:self.voldif] forKey: @"voldif"]; } if (self.hasBuykeepdif) { [dictionary setObject: [NSNumber numberWithDouble:self.buykeepdif] forKey: @"buykeepdif"]; } if (self.hasSellkeepdif) { [dictionary setObject: [NSNumber numberWithDouble:self.sellkeepdif] forKey: @"sellkeepdif"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_index_keep_line_msg class]]) { return NO; } s_index_keep_line_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && self.hasVol == otherMessage.hasVol && (!self.hasVol || self.vol == otherMessage.vol) && self.hasBuykeep == otherMessage.hasBuykeep && (!self.hasBuykeep || self.buykeep == otherMessage.buykeep) && self.hasSellkeep == otherMessage.hasSellkeep && (!self.hasSellkeep || self.sellkeep == otherMessage.sellkeep) && self.hasVoldif == otherMessage.hasVoldif && (!self.hasVoldif || self.voldif == otherMessage.voldif) && self.hasBuykeepdif == otherMessage.hasBuykeepdif && (!self.hasBuykeepdif || self.buykeepdif == otherMessage.buykeepdif) && self.hasSellkeepdif == otherMessage.hasSellkeepdif && (!self.hasSellkeepdif || self.sellkeepdif == otherMessage.sellkeepdif) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } if (self.hasVol) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.vol] hash]; } if (self.hasBuykeep) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.buykeep] hash]; } if (self.hasSellkeep) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.sellkeep] hash]; } if (self.hasVoldif) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.voldif] hash]; } if (self.hasBuykeepdif) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.buykeepdif] hash]; } if (self.hasSellkeepdif) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.sellkeepdif] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_index_keep_line_msgBuilder() @property (strong) s_index_keep_line_msg* resultSIndexKeepLineMsg; @end @implementation s_index_keep_line_msgBuilder @synthesize resultSIndexKeepLineMsg; - (instancetype) init { if ((self = [super init])) { self.resultSIndexKeepLineMsg = [[s_index_keep_line_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSIndexKeepLineMsg; } - (s_index_keep_line_msgBuilder*) clear { self.resultSIndexKeepLineMsg = [[s_index_keep_line_msg alloc] init]; return self; } - (s_index_keep_line_msgBuilder*) clone { return [s_index_keep_line_msg builderWithPrototype:resultSIndexKeepLineMsg]; } - (s_index_keep_line_msg*) defaultInstance { return [s_index_keep_line_msg defaultInstance]; } - (s_index_keep_line_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_index_keep_line_msg*) buildPartial { s_index_keep_line_msg* returnMe = resultSIndexKeepLineMsg; self.resultSIndexKeepLineMsg = nil; return returnMe; } - (s_index_keep_line_msgBuilder*) mergeFrom:(s_index_keep_line_msg*) other { if (other == [s_index_keep_line_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.hasVol) { [self setVol:other.vol]; } if (other.hasBuykeep) { [self setBuykeep:other.buykeep]; } if (other.hasSellkeep) { [self setSellkeep:other.sellkeep]; } if (other.hasVoldif) { [self setVoldif:other.voldif]; } if (other.hasBuykeepdif) { [self setBuykeepdif:other.buykeepdif]; } if (other.hasSellkeepdif) { [self setSellkeepdif:other.sellkeepdif]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_index_keep_line_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_index_keep_line_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } case 25: { [self setVol:[input readDouble]]; break; } case 33: { [self setBuykeep:[input readDouble]]; break; } case 41: { [self setSellkeep:[input readDouble]]; break; } case 49: { [self setVoldif:[input readDouble]]; break; } case 57: { [self setBuykeepdif:[input readDouble]]; break; } case 65: { [self setSellkeepdif:[input readDouble]]; break; } } } } - (BOOL) hasCode { return resultSIndexKeepLineMsg.hasCode; } - (NSString*) code { return resultSIndexKeepLineMsg.code; } - (s_index_keep_line_msgBuilder*) setCode:(NSString*) value { resultSIndexKeepLineMsg.hasCode = YES; resultSIndexKeepLineMsg.code = value; return self; } - (s_index_keep_line_msgBuilder*) clearCode { resultSIndexKeepLineMsg.hasCode = NO; resultSIndexKeepLineMsg.code = @""; return self; } - (BOOL) hasName { return resultSIndexKeepLineMsg.hasName; } - (NSString*) name { return resultSIndexKeepLineMsg.name; } - (s_index_keep_line_msgBuilder*) setName:(NSString*) value { resultSIndexKeepLineMsg.hasName = YES; resultSIndexKeepLineMsg.name = value; return self; } - (s_index_keep_line_msgBuilder*) clearName { resultSIndexKeepLineMsg.hasName = NO; resultSIndexKeepLineMsg.name = @""; return self; } - (BOOL) hasVol { return resultSIndexKeepLineMsg.hasVol; } - (Float64) vol { return resultSIndexKeepLineMsg.vol; } - (s_index_keep_line_msgBuilder*) setVol:(Float64) value { resultSIndexKeepLineMsg.hasVol = YES; resultSIndexKeepLineMsg.vol = value; return self; } - (s_index_keep_line_msgBuilder*) clearVol { resultSIndexKeepLineMsg.hasVol = NO; resultSIndexKeepLineMsg.vol = 0; return self; } - (BOOL) hasBuykeep { return resultSIndexKeepLineMsg.hasBuykeep; } - (Float64) buykeep { return resultSIndexKeepLineMsg.buykeep; } - (s_index_keep_line_msgBuilder*) setBuykeep:(Float64) value { resultSIndexKeepLineMsg.hasBuykeep = YES; resultSIndexKeepLineMsg.buykeep = value; return self; } - (s_index_keep_line_msgBuilder*) clearBuykeep { resultSIndexKeepLineMsg.hasBuykeep = NO; resultSIndexKeepLineMsg.buykeep = 0; return self; } - (BOOL) hasSellkeep { return resultSIndexKeepLineMsg.hasSellkeep; } - (Float64) sellkeep { return resultSIndexKeepLineMsg.sellkeep; } - (s_index_keep_line_msgBuilder*) setSellkeep:(Float64) value { resultSIndexKeepLineMsg.hasSellkeep = YES; resultSIndexKeepLineMsg.sellkeep = value; return self; } - (s_index_keep_line_msgBuilder*) clearSellkeep { resultSIndexKeepLineMsg.hasSellkeep = NO; resultSIndexKeepLineMsg.sellkeep = 0; return self; } - (BOOL) hasVoldif { return resultSIndexKeepLineMsg.hasVoldif; } - (Float64) voldif { return resultSIndexKeepLineMsg.voldif; } - (s_index_keep_line_msgBuilder*) setVoldif:(Float64) value { resultSIndexKeepLineMsg.hasVoldif = YES; resultSIndexKeepLineMsg.voldif = value; return self; } - (s_index_keep_line_msgBuilder*) clearVoldif { resultSIndexKeepLineMsg.hasVoldif = NO; resultSIndexKeepLineMsg.voldif = 0; return self; } - (BOOL) hasBuykeepdif { return resultSIndexKeepLineMsg.hasBuykeepdif; } - (Float64) buykeepdif { return resultSIndexKeepLineMsg.buykeepdif; } - (s_index_keep_line_msgBuilder*) setBuykeepdif:(Float64) value { resultSIndexKeepLineMsg.hasBuykeepdif = YES; resultSIndexKeepLineMsg.buykeepdif = value; return self; } - (s_index_keep_line_msgBuilder*) clearBuykeepdif { resultSIndexKeepLineMsg.hasBuykeepdif = NO; resultSIndexKeepLineMsg.buykeepdif = 0; return self; } - (BOOL) hasSellkeepdif { return resultSIndexKeepLineMsg.hasSellkeepdif; } - (Float64) sellkeepdif { return resultSIndexKeepLineMsg.sellkeepdif; } - (s_index_keep_line_msgBuilder*) setSellkeepdif:(Float64) value { resultSIndexKeepLineMsg.hasSellkeepdif = YES; resultSIndexKeepLineMsg.sellkeepdif = value; return self; } - (s_index_keep_line_msgBuilder*) clearSellkeepdif { resultSIndexKeepLineMsg.hasSellkeepdif = NO; resultSIndexKeepLineMsg.sellkeepdif = 0; return self; } @end @interface s_index_keep_result_msg () @property (strong) NSMutableArray * datasArray; @end @implementation s_index_keep_result_msg @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { } return self; } static s_index_keep_result_msg* defaults_index_keep_result_msgInstance = nil; + (void) initialize { if (self == [s_index_keep_result_msg class]) { defaults_index_keep_result_msgInstance = [[s_index_keep_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_index_keep_result_msgInstance; } - (instancetype) defaultInstance { return defaults_index_keep_result_msgInstance; } - (NSArray *)datas { return datasArray; } - (s_index_keep_line_msg*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_index_keep_line_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.datasArray enumerateObjectsUsingBlock:^(s_index_keep_line_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.datasArray enumerateObjectsUsingBlock:^(s_index_keep_line_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_index_keep_result_msg*) parseFromData:(NSData*) data { return (s_index_keep_result_msg*)[[[s_index_keep_result_msg builder] mergeFromData:data] build]; } + (s_index_keep_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_index_keep_result_msg*)[[[s_index_keep_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_index_keep_result_msg*) parseFromInputStream:(NSInputStream*) input { return (s_index_keep_result_msg*)[[[s_index_keep_result_msg builder] mergeFromInputStream:input] build]; } + (s_index_keep_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_index_keep_result_msg*)[[[s_index_keep_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_index_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_index_keep_result_msg*)[[[s_index_keep_result_msg builder] mergeFromCodedInputStream:input] build]; } + (s_index_keep_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_index_keep_result_msg*)[[[s_index_keep_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_index_keep_result_msgBuilder*) builder { return [[s_index_keep_result_msgBuilder alloc] init]; } + (s_index_keep_result_msgBuilder*) builderWithPrototype:(s_index_keep_result_msg*) prototype { return [[s_index_keep_result_msg builder] mergeFrom:prototype]; } - (s_index_keep_result_msgBuilder*) builder { return [s_index_keep_result_msg builder]; } - (s_index_keep_result_msgBuilder*) toBuilder { return [s_index_keep_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.datasArray enumerateObjectsUsingBlock:^(s_index_keep_line_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_index_keep_line_msg* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_index_keep_result_msg class]]) { return NO; } s_index_keep_result_msg *otherMessage = other; return [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.datasArray enumerateObjectsUsingBlock:^(s_index_keep_line_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_index_keep_result_msgBuilder() @property (strong) s_index_keep_result_msg* resultSIndexKeepResultMsg; @end @implementation s_index_keep_result_msgBuilder @synthesize resultSIndexKeepResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSIndexKeepResultMsg = [[s_index_keep_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSIndexKeepResultMsg; } - (s_index_keep_result_msgBuilder*) clear { self.resultSIndexKeepResultMsg = [[s_index_keep_result_msg alloc] init]; return self; } - (s_index_keep_result_msgBuilder*) clone { return [s_index_keep_result_msg builderWithPrototype:resultSIndexKeepResultMsg]; } - (s_index_keep_result_msg*) defaultInstance { return [s_index_keep_result_msg defaultInstance]; } - (s_index_keep_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_index_keep_result_msg*) buildPartial { s_index_keep_result_msg* returnMe = resultSIndexKeepResultMsg; self.resultSIndexKeepResultMsg = nil; return returnMe; } - (s_index_keep_result_msgBuilder*) mergeFrom:(s_index_keep_result_msg*) other { if (other == [s_index_keep_result_msg defaultInstance]) { return self; } if (other.datasArray.count > 0) { if (resultSIndexKeepResultMsg.datasArray == nil) { resultSIndexKeepResultMsg.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSIndexKeepResultMsg.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_index_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_index_keep_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_index_keep_line_msgBuilder* subBuilder = [s_index_keep_line_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)datas { return resultSIndexKeepResultMsg.datasArray; } - (s_index_keep_line_msg*)datasAtIndex:(NSUInteger)index { return [resultSIndexKeepResultMsg datasAtIndex:index]; } - (s_index_keep_result_msgBuilder *)addDatas:(s_index_keep_line_msg*)value { if (resultSIndexKeepResultMsg.datasArray == nil) { resultSIndexKeepResultMsg.datasArray = [[NSMutableArray alloc]init]; } [resultSIndexKeepResultMsg.datasArray addObject:value]; return self; } - (s_index_keep_result_msgBuilder *)setDatasArray:(NSArray *)array { resultSIndexKeepResultMsg.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_index_keep_result_msgBuilder *)clearDatas { resultSIndexKeepResultMsg.datasArray = nil; return self; } @end @interface s_block_relation_request () @property (strong) NSString* code; @end @implementation s_block_relation_request - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (instancetype) init { if ((self = [super init])) { self.code = @""; } return self; } static s_block_relation_request* defaults_block_relation_requestInstance = nil; + (void) initialize { if (self == [s_block_relation_request class]) { defaults_block_relation_requestInstance = [[s_block_relation_request alloc] init]; } } + (instancetype) defaultInstance { return defaults_block_relation_requestInstance; } - (instancetype) defaultInstance { return defaults_block_relation_requestInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_block_relation_request*) parseFromData:(NSData*) data { return (s_block_relation_request*)[[[s_block_relation_request builder] mergeFromData:data] build]; } + (s_block_relation_request*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_request*)[[[s_block_relation_request builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_block_relation_request*) parseFromInputStream:(NSInputStream*) input { return (s_block_relation_request*)[[[s_block_relation_request builder] mergeFromInputStream:input] build]; } + (s_block_relation_request*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_request*)[[[s_block_relation_request builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_block_relation_request*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_block_relation_request*)[[[s_block_relation_request builder] mergeFromCodedInputStream:input] build]; } + (s_block_relation_request*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_request*)[[[s_block_relation_request builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_block_relation_requestBuilder*) builder { return [[s_block_relation_requestBuilder alloc] init]; } + (s_block_relation_requestBuilder*) builderWithPrototype:(s_block_relation_request*) prototype { return [[s_block_relation_request builder] mergeFrom:prototype]; } - (s_block_relation_requestBuilder*) builder { return [s_block_relation_request builder]; } - (s_block_relation_requestBuilder*) toBuilder { return [s_block_relation_request builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_block_relation_request class]]) { return NO; } s_block_relation_request *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_block_relation_requestBuilder() @property (strong) s_block_relation_request* resultSBlockRelationRequest; @end @implementation s_block_relation_requestBuilder @synthesize resultSBlockRelationRequest; - (instancetype) init { if ((self = [super init])) { self.resultSBlockRelationRequest = [[s_block_relation_request alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBlockRelationRequest; } - (s_block_relation_requestBuilder*) clear { self.resultSBlockRelationRequest = [[s_block_relation_request alloc] init]; return self; } - (s_block_relation_requestBuilder*) clone { return [s_block_relation_request builderWithPrototype:resultSBlockRelationRequest]; } - (s_block_relation_request*) defaultInstance { return [s_block_relation_request defaultInstance]; } - (s_block_relation_request*) build { [self checkInitialized]; return [self buildPartial]; } - (s_block_relation_request*) buildPartial { s_block_relation_request* returnMe = resultSBlockRelationRequest; self.resultSBlockRelationRequest = nil; return returnMe; } - (s_block_relation_requestBuilder*) mergeFrom:(s_block_relation_request*) other { if (other == [s_block_relation_request defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_block_relation_requestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_block_relation_requestBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } } } } - (BOOL) hasCode { return resultSBlockRelationRequest.hasCode; } - (NSString*) code { return resultSBlockRelationRequest.code; } - (s_block_relation_requestBuilder*) setCode:(NSString*) value { resultSBlockRelationRequest.hasCode = YES; resultSBlockRelationRequest.code = value; return self; } - (s_block_relation_requestBuilder*) clearCode { resultSBlockRelationRequest.hasCode = NO; resultSBlockRelationRequest.code = @""; return self; } @end @interface s_block_relation_colunm_msg () @property (strong) NSString* code; @property (strong) NSString* name; @end @implementation s_block_relation_colunm_msg - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; } return self; } static s_block_relation_colunm_msg* defaults_block_relation_colunm_msgInstance = nil; + (void) initialize { if (self == [s_block_relation_colunm_msg class]) { defaults_block_relation_colunm_msgInstance = [[s_block_relation_colunm_msg alloc] init]; } } + (instancetype) defaultInstance { return defaults_block_relation_colunm_msgInstance; } - (instancetype) defaultInstance { return defaults_block_relation_colunm_msgInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_block_relation_colunm_msg*) parseFromData:(NSData*) data { return (s_block_relation_colunm_msg*)[[[s_block_relation_colunm_msg builder] mergeFromData:data] build]; } + (s_block_relation_colunm_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_colunm_msg*)[[[s_block_relation_colunm_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_block_relation_colunm_msg*) parseFromInputStream:(NSInputStream*) input { return (s_block_relation_colunm_msg*)[[[s_block_relation_colunm_msg builder] mergeFromInputStream:input] build]; } + (s_block_relation_colunm_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_colunm_msg*)[[[s_block_relation_colunm_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_block_relation_colunm_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_block_relation_colunm_msg*)[[[s_block_relation_colunm_msg builder] mergeFromCodedInputStream:input] build]; } + (s_block_relation_colunm_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_colunm_msg*)[[[s_block_relation_colunm_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_block_relation_colunm_msgBuilder*) builder { return [[s_block_relation_colunm_msgBuilder alloc] init]; } + (s_block_relation_colunm_msgBuilder*) builderWithPrototype:(s_block_relation_colunm_msg*) prototype { return [[s_block_relation_colunm_msg builder] mergeFrom:prototype]; } - (s_block_relation_colunm_msgBuilder*) builder { return [s_block_relation_colunm_msg builder]; } - (s_block_relation_colunm_msgBuilder*) toBuilder { return [s_block_relation_colunm_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_block_relation_colunm_msg class]]) { return NO; } s_block_relation_colunm_msg *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_block_relation_colunm_msgBuilder() @property (strong) s_block_relation_colunm_msg* resultSBlockRelationColunmMsg; @end @implementation s_block_relation_colunm_msgBuilder @synthesize resultSBlockRelationColunmMsg; - (instancetype) init { if ((self = [super init])) { self.resultSBlockRelationColunmMsg = [[s_block_relation_colunm_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBlockRelationColunmMsg; } - (s_block_relation_colunm_msgBuilder*) clear { self.resultSBlockRelationColunmMsg = [[s_block_relation_colunm_msg alloc] init]; return self; } - (s_block_relation_colunm_msgBuilder*) clone { return [s_block_relation_colunm_msg builderWithPrototype:resultSBlockRelationColunmMsg]; } - (s_block_relation_colunm_msg*) defaultInstance { return [s_block_relation_colunm_msg defaultInstance]; } - (s_block_relation_colunm_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (s_block_relation_colunm_msg*) buildPartial { s_block_relation_colunm_msg* returnMe = resultSBlockRelationColunmMsg; self.resultSBlockRelationColunmMsg = nil; return returnMe; } - (s_block_relation_colunm_msgBuilder*) mergeFrom:(s_block_relation_colunm_msg*) other { if (other == [s_block_relation_colunm_msg defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_block_relation_colunm_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_block_relation_colunm_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } } } } - (BOOL) hasCode { return resultSBlockRelationColunmMsg.hasCode; } - (NSString*) code { return resultSBlockRelationColunmMsg.code; } - (s_block_relation_colunm_msgBuilder*) setCode:(NSString*) value { resultSBlockRelationColunmMsg.hasCode = YES; resultSBlockRelationColunmMsg.code = value; return self; } - (s_block_relation_colunm_msgBuilder*) clearCode { resultSBlockRelationColunmMsg.hasCode = NO; resultSBlockRelationColunmMsg.code = @""; return self; } - (BOOL) hasName { return resultSBlockRelationColunmMsg.hasName; } - (NSString*) name { return resultSBlockRelationColunmMsg.name; } - (s_block_relation_colunm_msgBuilder*) setName:(NSString*) value { resultSBlockRelationColunmMsg.hasName = YES; resultSBlockRelationColunmMsg.name = value; return self; } - (s_block_relation_colunm_msgBuilder*) clearName { resultSBlockRelationColunmMsg.hasName = NO; resultSBlockRelationColunmMsg.name = @""; return self; } @end @interface s_block_relation_result () @property (strong) NSMutableArray * datasArray; @end @implementation s_block_relation_result @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { } return self; } static s_block_relation_result* defaults_block_relation_resultInstance = nil; + (void) initialize { if (self == [s_block_relation_result class]) { defaults_block_relation_resultInstance = [[s_block_relation_result alloc] init]; } } + (instancetype) defaultInstance { return defaults_block_relation_resultInstance; } - (instancetype) defaultInstance { return defaults_block_relation_resultInstance; } - (NSArray *)datas { return datasArray; } - (s_block_relation_colunm_msg*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_block_relation_colunm_msg *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.datasArray enumerateObjectsUsingBlock:^(s_block_relation_colunm_msg *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.datasArray enumerateObjectsUsingBlock:^(s_block_relation_colunm_msg *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_block_relation_result*) parseFromData:(NSData*) data { return (s_block_relation_result*)[[[s_block_relation_result builder] mergeFromData:data] build]; } + (s_block_relation_result*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_result*)[[[s_block_relation_result builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_block_relation_result*) parseFromInputStream:(NSInputStream*) input { return (s_block_relation_result*)[[[s_block_relation_result builder] mergeFromInputStream:input] build]; } + (s_block_relation_result*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_result*)[[[s_block_relation_result builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_block_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_block_relation_result*)[[[s_block_relation_result builder] mergeFromCodedInputStream:input] build]; } + (s_block_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_block_relation_result*)[[[s_block_relation_result builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_block_relation_resultBuilder*) builder { return [[s_block_relation_resultBuilder alloc] init]; } + (s_block_relation_resultBuilder*) builderWithPrototype:(s_block_relation_result*) prototype { return [[s_block_relation_result builder] mergeFrom:prototype]; } - (s_block_relation_resultBuilder*) builder { return [s_block_relation_result builder]; } - (s_block_relation_resultBuilder*) toBuilder { return [s_block_relation_result builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.datasArray enumerateObjectsUsingBlock:^(s_block_relation_colunm_msg *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_block_relation_colunm_msg* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_block_relation_result class]]) { return NO; } s_block_relation_result *otherMessage = other; return [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.datasArray enumerateObjectsUsingBlock:^(s_block_relation_colunm_msg *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_block_relation_resultBuilder() @property (strong) s_block_relation_result* resultSBlockRelationResult; @end @implementation s_block_relation_resultBuilder @synthesize resultSBlockRelationResult; - (instancetype) init { if ((self = [super init])) { self.resultSBlockRelationResult = [[s_block_relation_result alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSBlockRelationResult; } - (s_block_relation_resultBuilder*) clear { self.resultSBlockRelationResult = [[s_block_relation_result alloc] init]; return self; } - (s_block_relation_resultBuilder*) clone { return [s_block_relation_result builderWithPrototype:resultSBlockRelationResult]; } - (s_block_relation_result*) defaultInstance { return [s_block_relation_result defaultInstance]; } - (s_block_relation_result*) build { [self checkInitialized]; return [self buildPartial]; } - (s_block_relation_result*) buildPartial { s_block_relation_result* returnMe = resultSBlockRelationResult; self.resultSBlockRelationResult = nil; return returnMe; } - (s_block_relation_resultBuilder*) mergeFrom:(s_block_relation_result*) other { if (other == [s_block_relation_result defaultInstance]) { return self; } if (other.datasArray.count > 0) { if (resultSBlockRelationResult.datasArray == nil) { resultSBlockRelationResult.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSBlockRelationResult.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_block_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_block_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_block_relation_colunm_msgBuilder* subBuilder = [s_block_relation_colunm_msg builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)datas { return resultSBlockRelationResult.datasArray; } - (s_block_relation_colunm_msg*)datasAtIndex:(NSUInteger)index { return [resultSBlockRelationResult datasAtIndex:index]; } - (s_block_relation_resultBuilder *)addDatas:(s_block_relation_colunm_msg*)value { if (resultSBlockRelationResult.datasArray == nil) { resultSBlockRelationResult.datasArray = [[NSMutableArray alloc]init]; } [resultSBlockRelationResult.datasArray addObject:value]; return self; } - (s_block_relation_resultBuilder *)setDatasArray:(NSArray *)array { resultSBlockRelationResult.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_block_relation_resultBuilder *)clearDatas { resultSBlockRelationResult.datasArray = nil; return self; } @end @interface s_code_name_line () @property (strong) NSString* code; @property (strong) NSString* name; @end @implementation s_code_name_line - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; } return self; } static s_code_name_line* defaults_code_name_lineInstance = nil; + (void) initialize { if (self == [s_code_name_line class]) { defaults_code_name_lineInstance = [[s_code_name_line alloc] init]; } } + (instancetype) defaultInstance { return defaults_code_name_lineInstance; } - (instancetype) defaultInstance { return defaults_code_name_lineInstance; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_code_name_line*) parseFromData:(NSData*) data { return (s_code_name_line*)[[[s_code_name_line builder] mergeFromData:data] build]; } + (s_code_name_line*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_code_name_line*)[[[s_code_name_line builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_code_name_line*) parseFromInputStream:(NSInputStream*) input { return (s_code_name_line*)[[[s_code_name_line builder] mergeFromInputStream:input] build]; } + (s_code_name_line*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_code_name_line*)[[[s_code_name_line builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_code_name_line*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_code_name_line*)[[[s_code_name_line builder] mergeFromCodedInputStream:input] build]; } + (s_code_name_line*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_code_name_line*)[[[s_code_name_line builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_code_name_lineBuilder*) builder { return [[s_code_name_lineBuilder alloc] init]; } + (s_code_name_lineBuilder*) builderWithPrototype:(s_code_name_line*) prototype { return [[s_code_name_line builder] mergeFrom:prototype]; } - (s_code_name_lineBuilder*) builder { return [s_code_name_line builder]; } - (s_code_name_lineBuilder*) toBuilder { return [s_code_name_line builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_code_name_line class]]) { return NO; } s_code_name_line *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_code_name_lineBuilder() @property (strong) s_code_name_line* resultSCodeNameLine; @end @implementation s_code_name_lineBuilder @synthesize resultSCodeNameLine; - (instancetype) init { if ((self = [super init])) { self.resultSCodeNameLine = [[s_code_name_line alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSCodeNameLine; } - (s_code_name_lineBuilder*) clear { self.resultSCodeNameLine = [[s_code_name_line alloc] init]; return self; } - (s_code_name_lineBuilder*) clone { return [s_code_name_line builderWithPrototype:resultSCodeNameLine]; } - (s_code_name_line*) defaultInstance { return [s_code_name_line defaultInstance]; } - (s_code_name_line*) build { [self checkInitialized]; return [self buildPartial]; } - (s_code_name_line*) buildPartial { s_code_name_line* returnMe = resultSCodeNameLine; self.resultSCodeNameLine = nil; return returnMe; } - (s_code_name_lineBuilder*) mergeFrom:(s_code_name_line*) other { if (other == [s_code_name_line defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_code_name_lineBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_code_name_lineBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } } } } - (BOOL) hasCode { return resultSCodeNameLine.hasCode; } - (NSString*) code { return resultSCodeNameLine.code; } - (s_code_name_lineBuilder*) setCode:(NSString*) value { resultSCodeNameLine.hasCode = YES; resultSCodeNameLine.code = value; return self; } - (s_code_name_lineBuilder*) clearCode { resultSCodeNameLine.hasCode = NO; resultSCodeNameLine.code = @""; return self; } - (BOOL) hasName { return resultSCodeNameLine.hasName; } - (NSString*) name { return resultSCodeNameLine.name; } - (s_code_name_lineBuilder*) setName:(NSString*) value { resultSCodeNameLine.hasName = YES; resultSCodeNameLine.name = value; return self; } - (s_code_name_lineBuilder*) clearName { resultSCodeNameLine.hasName = NO; resultSCodeNameLine.name = @""; return self; } @end @interface s_code_name_relation_result () @property (strong) NSMutableArray * datasArray; @end @implementation s_code_name_relation_result @synthesize datasArray; @dynamic datas; - (instancetype) init { if ((self = [super init])) { } return self; } static s_code_name_relation_result* defaults_code_name_relation_resultInstance = nil; + (void) initialize { if (self == [s_code_name_relation_result class]) { defaults_code_name_relation_resultInstance = [[s_code_name_relation_result alloc] init]; } } + (instancetype) defaultInstance { return defaults_code_name_relation_resultInstance; } - (instancetype) defaultInstance { return defaults_code_name_relation_resultInstance; } - (NSArray *)datas { return datasArray; } - (s_code_name_line*)datasAtIndex:(NSUInteger)index { return [datasArray objectAtIndex:index]; } - (BOOL) isInitialized { __block BOOL isInitdatas = YES; [self.datas enumerateObjectsUsingBlock:^(s_code_name_line *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitdatas = NO; *stop = YES; } }]; if (!isInitdatas) return isInitdatas; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { [self.datasArray enumerateObjectsUsingBlock:^(s_code_name_line *element, NSUInteger idx, BOOL *stop) { [output writeMessage:1 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; [self.datasArray enumerateObjectsUsingBlock:^(s_code_name_line *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(1, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (s_code_name_relation_result*) parseFromData:(NSData*) data { return (s_code_name_relation_result*)[[[s_code_name_relation_result builder] mergeFromData:data] build]; } + (s_code_name_relation_result*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_code_name_relation_result*)[[[s_code_name_relation_result builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (s_code_name_relation_result*) parseFromInputStream:(NSInputStream*) input { return (s_code_name_relation_result*)[[[s_code_name_relation_result builder] mergeFromInputStream:input] build]; } + (s_code_name_relation_result*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_code_name_relation_result*)[[[s_code_name_relation_result builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_code_name_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (s_code_name_relation_result*)[[[s_code_name_relation_result builder] mergeFromCodedInputStream:input] build]; } + (s_code_name_relation_result*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (s_code_name_relation_result*)[[[s_code_name_relation_result builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (s_code_name_relation_resultBuilder*) builder { return [[s_code_name_relation_resultBuilder alloc] init]; } + (s_code_name_relation_resultBuilder*) builderWithPrototype:(s_code_name_relation_result*) prototype { return [[s_code_name_relation_result builder] mergeFrom:prototype]; } - (s_code_name_relation_resultBuilder*) builder { return [s_code_name_relation_result builder]; } - (s_code_name_relation_resultBuilder*) toBuilder { return [s_code_name_relation_result builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { [self.datasArray enumerateObjectsUsingBlock:^(s_code_name_line *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"datas"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { for (s_code_name_line* element in self.datasArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"datas"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[s_code_name_relation_result class]]) { return NO; } s_code_name_relation_result *otherMessage = other; return [self.datasArray isEqualToArray:otherMessage.datasArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; [self.datasArray enumerateObjectsUsingBlock:^(s_code_name_line *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface s_code_name_relation_resultBuilder() @property (strong) s_code_name_relation_result* resultSCodeNameRelationResult; @end @implementation s_code_name_relation_resultBuilder @synthesize resultSCodeNameRelationResult; - (instancetype) init { if ((self = [super init])) { self.resultSCodeNameRelationResult = [[s_code_name_relation_result alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSCodeNameRelationResult; } - (s_code_name_relation_resultBuilder*) clear { self.resultSCodeNameRelationResult = [[s_code_name_relation_result alloc] init]; return self; } - (s_code_name_relation_resultBuilder*) clone { return [s_code_name_relation_result builderWithPrototype:resultSCodeNameRelationResult]; } - (s_code_name_relation_result*) defaultInstance { return [s_code_name_relation_result defaultInstance]; } - (s_code_name_relation_result*) build { [self checkInitialized]; return [self buildPartial]; } - (s_code_name_relation_result*) buildPartial { s_code_name_relation_result* returnMe = resultSCodeNameRelationResult; self.resultSCodeNameRelationResult = nil; return returnMe; } - (s_code_name_relation_resultBuilder*) mergeFrom:(s_code_name_relation_result*) other { if (other == [s_code_name_relation_result defaultInstance]) { return self; } if (other.datasArray.count > 0) { if (resultSCodeNameRelationResult.datasArray == nil) { resultSCodeNameRelationResult.datasArray = [[NSMutableArray alloc] initWithArray:other.datasArray]; } else { [resultSCodeNameRelationResult.datasArray addObjectsFromArray:other.datasArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (s_code_name_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (s_code_name_relation_resultBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { s_code_name_lineBuilder* subBuilder = [s_code_name_line builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addDatas:[subBuilder buildPartial]]; break; } } } } - (NSMutableArray *)datas { return resultSCodeNameRelationResult.datasArray; } - (s_code_name_line*)datasAtIndex:(NSUInteger)index { return [resultSCodeNameRelationResult datasAtIndex:index]; } - (s_code_name_relation_resultBuilder *)addDatas:(s_code_name_line*)value { if (resultSCodeNameRelationResult.datasArray == nil) { resultSCodeNameRelationResult.datasArray = [[NSMutableArray alloc]init]; } [resultSCodeNameRelationResult.datasArray addObject:value]; return self; } - (s_code_name_relation_resultBuilder *)setDatasArray:(NSArray *)array { resultSCodeNameRelationResult.datasArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (s_code_name_relation_resultBuilder *)clearDatas { resultSCodeNameRelationResult.datasArray = nil; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Warning.pb.h ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "ProtocolBuffers.h" #import "Common.pb.h" // @@protoc_insertion_point(imports) @class auth_ctx_msg; @class auth_ctx_msgBuilder; @class client_login_msg; @class client_login_msgBuilder; @class client_login_result_msg; @class client_login_result_msgBuilder; @class combo_private_msg; @class combo_private_msgBuilder; @class common_reply_error_msg; @class common_reply_error_msgBuilder; @class common_update_notice_msg; @class common_update_notice_msgBuilder; @class count_offset_selector; @class count_offset_selectorBuilder; @class data_selector; @class data_selectorBuilder; @class delete_warning_config_form_code_msg; @class delete_warning_config_form_code_msgBuilder; @class delete_warning_config_result_form_code_msg; @class delete_warning_config_result_form_code_msgBuilder; @class ext_key_info; @class ext_key_infoBuilder; @class get_warning_record_from_uid_msg; @class get_warning_record_from_uid_msgBuilder; @class get_warning_record_from_uid_result_msg; @class get_warning_record_from_uid_result_msgBuilder; @class load_dector_msg; @class load_dector_msgBuilder; @class notify_ack_msg; @class notify_ack_msgBuilder; @class push_notify_msg; @class push_notify_msgBuilder; @class rpc_msg_root; @class rpc_msg_rootBuilder; @class server_login_msg; @class server_login_msgBuilder; @class server_login_result_msg; @class server_login_result_msgBuilder; @class set_warning_config_msg; @class set_warning_config_msgBuilder; @class set_warning_config_result_msg; @class set_warning_config_result_msgBuilder; @class subcribe_msg; @class subcribe_msgBuilder; @class sync_notify_msg; @class sync_notify_msgBuilder; @class time_offset_selector; @class time_offset_selectorBuilder; @class time_range_selector; @class time_range_selectorBuilder; @class user_warning_stock_status; @class user_warning_stock_statusBuilder; @class warning_config_data; @class warning_config_dataBuilder; @class warning_config_msg; @class warning_config_msgBuilder; @class warning_config_result_msg; @class warning_config_result_msgBuilder; @class warning_record; @class warning_recordBuilder; @class warning_recordwarning_msg_node; @class warning_recordwarning_msg_nodeBuilder; @class warning_stock_value; @class warning_stock_valueBuilder; @class warning_user_all_stock_status_msg; @class warning_user_all_stock_status_msgBuilder; @class warning_user_all_stock_status_result_msg; @class warning_user_all_stock_status_result_msgBuilder; typedef NS_ENUM(SInt32, enum_warning_type) { enum_warning_typeBeginWarningTypeEnum = 0, enum_warning_typeWarningPriceHigh = 1, enum_warning_typeWarningPriceLow = 2, enum_warning_typeWarningRisePercentage = 3, enum_warning_typeWarningDropPercentage = 4, enum_warning_typeEndWarningTypeEnum = 5, }; BOOL enum_warning_typeIsValidValue(enum_warning_type value); NSString *NSStringFromenum_warning_type(enum_warning_type value); @interface WarningRoot : NSObject { } + (PBExtensionRegistry*) extensionRegistry; + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry; @end #define warning_config_data_type @"type" #define warning_config_data_value @"value" #define warning_config_data_status @"status" @interface warning_config_data : PBGeneratedMessage { @private BOOL hasValue_:1; BOOL hasStatus_:1; BOOL hasType_:1; Float32 value; UInt32 status; enum_warning_type type; } - (BOOL) hasType; - (BOOL) hasValue; - (BOOL) hasStatus; @property (readonly) enum_warning_type type; @property (readonly) Float32 value; @property (readonly) UInt32 status; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_config_dataBuilder*) builder; + (warning_config_dataBuilder*) builder; + (warning_config_dataBuilder*) builderWithPrototype:(warning_config_data*) prototype; - (warning_config_dataBuilder*) toBuilder; + (warning_config_data*) parseFromData:(NSData*) data; + (warning_config_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_config_data*) parseFromInputStream:(NSInputStream*) input; + (warning_config_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_config_data*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_config_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_config_dataBuilder : PBGeneratedMessageBuilder { @private warning_config_data* resultWarningConfigData; } - (warning_config_data*) defaultInstance; - (warning_config_dataBuilder*) clear; - (warning_config_dataBuilder*) clone; - (warning_config_data*) build; - (warning_config_data*) buildPartial; - (warning_config_dataBuilder*) mergeFrom:(warning_config_data*) other; - (warning_config_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_config_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasType; - (enum_warning_type) type; - (warning_config_dataBuilder*) setType:(enum_warning_type) value; - (warning_config_dataBuilder*) clearType; - (BOOL) hasValue; - (Float32) value; - (warning_config_dataBuilder*) setValue:(Float32) value; - (warning_config_dataBuilder*) clearValue; - (BOOL) hasStatus; - (UInt32) status; - (warning_config_dataBuilder*) setStatus:(UInt32) value; - (warning_config_dataBuilder*) clearStatus; @end #define user_warning_stock_status_stock_code @"stockCode" #define user_warning_stock_status_stock_name @"stockName" #define user_warning_stock_status_status @"status" @interface user_warning_stock_status : PBGeneratedMessage { @private BOOL hasStatus_:1; BOOL hasStockCode_:1; BOOL hasStockName_:1; BOOL status_:1; NSString* stockCode; NSString* stockName; } - (BOOL) hasStockCode; - (BOOL) hasStockName; - (BOOL) hasStatus; @property (readonly, strong) NSString* stockCode; @property (readonly, strong) NSString* stockName; - (BOOL) status; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (user_warning_stock_statusBuilder*) builder; + (user_warning_stock_statusBuilder*) builder; + (user_warning_stock_statusBuilder*) builderWithPrototype:(user_warning_stock_status*) prototype; - (user_warning_stock_statusBuilder*) toBuilder; + (user_warning_stock_status*) parseFromData:(NSData*) data; + (user_warning_stock_status*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (user_warning_stock_status*) parseFromInputStream:(NSInputStream*) input; + (user_warning_stock_status*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (user_warning_stock_status*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (user_warning_stock_status*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface user_warning_stock_statusBuilder : PBGeneratedMessageBuilder { @private user_warning_stock_status* resultUserWarningStockStatus; } - (user_warning_stock_status*) defaultInstance; - (user_warning_stock_statusBuilder*) clear; - (user_warning_stock_statusBuilder*) clone; - (user_warning_stock_status*) build; - (user_warning_stock_status*) buildPartial; - (user_warning_stock_statusBuilder*) mergeFrom:(user_warning_stock_status*) other; - (user_warning_stock_statusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (user_warning_stock_statusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasStockCode; - (NSString*) stockCode; - (user_warning_stock_statusBuilder*) setStockCode:(NSString*) value; - (user_warning_stock_statusBuilder*) clearStockCode; - (BOOL) hasStockName; - (NSString*) stockName; - (user_warning_stock_statusBuilder*) setStockName:(NSString*) value; - (user_warning_stock_statusBuilder*) clearStockName; - (BOOL) hasStatus; - (BOOL) status; - (user_warning_stock_statusBuilder*) setStatus:(BOOL) value; - (user_warning_stock_statusBuilder*) clearStatus; @end #define warning_config_msg_uid @"uid" #define warning_config_msg_stock_code @"stockCode" @interface warning_config_msg : PBGeneratedMessage { @private BOOL hasStockCode_:1; BOOL hasUid_:1; NSString* stockCode; UInt32 uid; } - (BOOL) hasUid; - (BOOL) hasStockCode; @property (readonly) UInt32 uid; @property (readonly, strong) NSString* stockCode; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_config_msgBuilder*) builder; + (warning_config_msgBuilder*) builder; + (warning_config_msgBuilder*) builderWithPrototype:(warning_config_msg*) prototype; - (warning_config_msgBuilder*) toBuilder; + (warning_config_msg*) parseFromData:(NSData*) data; + (warning_config_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_config_msg*) parseFromInputStream:(NSInputStream*) input; + (warning_config_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_config_msgBuilder : PBGeneratedMessageBuilder { @private warning_config_msg* resultWarningConfigMsg; } - (warning_config_msg*) defaultInstance; - (warning_config_msgBuilder*) clear; - (warning_config_msgBuilder*) clone; - (warning_config_msg*) build; - (warning_config_msg*) buildPartial; - (warning_config_msgBuilder*) mergeFrom:(warning_config_msg*) other; - (warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (warning_config_msgBuilder*) setUid:(UInt32) value; - (warning_config_msgBuilder*) clearUid; - (BOOL) hasStockCode; - (NSString*) stockCode; - (warning_config_msgBuilder*) setStockCode:(NSString*) value; - (warning_config_msgBuilder*) clearStockCode; @end #define warning_config_result_msg_uid @"uid" #define warning_config_result_msg_config_data @"configData" @interface warning_config_result_msg : PBGeneratedMessage { @private BOOL hasUid_:1; UInt32 uid; NSMutableArray * configDataArray; } - (BOOL) hasUid; @property (readonly) UInt32 uid; @property (readonly, strong) NSArray * configData; - (warning_config_data*)configDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_config_result_msgBuilder*) builder; + (warning_config_result_msgBuilder*) builder; + (warning_config_result_msgBuilder*) builderWithPrototype:(warning_config_result_msg*) prototype; - (warning_config_result_msgBuilder*) toBuilder; + (warning_config_result_msg*) parseFromData:(NSData*) data; + (warning_config_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input; + (warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_config_result_msgBuilder : PBGeneratedMessageBuilder { @private warning_config_result_msg* resultWarningConfigResultMsg; } - (warning_config_result_msg*) defaultInstance; - (warning_config_result_msgBuilder*) clear; - (warning_config_result_msgBuilder*) clone; - (warning_config_result_msg*) build; - (warning_config_result_msg*) buildPartial; - (warning_config_result_msgBuilder*) mergeFrom:(warning_config_result_msg*) other; - (warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (warning_config_result_msgBuilder*) setUid:(UInt32) value; - (warning_config_result_msgBuilder*) clearUid; - (NSMutableArray *)configData; - (warning_config_data*)configDataAtIndex:(NSUInteger)index; - (warning_config_result_msgBuilder *)addConfigData:(warning_config_data*)value; - (warning_config_result_msgBuilder *)setConfigDataArray:(NSArray *)array; - (warning_config_result_msgBuilder *)clearConfigData; @end #define warning_user_all_stock_status_msg_uid @"uid" @interface warning_user_all_stock_status_msg : PBGeneratedMessage { @private BOOL hasUid_:1; UInt32 uid; } - (BOOL) hasUid; @property (readonly) UInt32 uid; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_user_all_stock_status_msgBuilder*) builder; + (warning_user_all_stock_status_msgBuilder*) builder; + (warning_user_all_stock_status_msgBuilder*) builderWithPrototype:(warning_user_all_stock_status_msg*) prototype; - (warning_user_all_stock_status_msgBuilder*) toBuilder; + (warning_user_all_stock_status_msg*) parseFromData:(NSData*) data; + (warning_user_all_stock_status_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_user_all_stock_status_msg*) parseFromInputStream:(NSInputStream*) input; + (warning_user_all_stock_status_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_user_all_stock_status_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_user_all_stock_status_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_user_all_stock_status_msgBuilder : PBGeneratedMessageBuilder { @private warning_user_all_stock_status_msg* resultWarningUserAllStockStatusMsg; } - (warning_user_all_stock_status_msg*) defaultInstance; - (warning_user_all_stock_status_msgBuilder*) clear; - (warning_user_all_stock_status_msgBuilder*) clone; - (warning_user_all_stock_status_msg*) build; - (warning_user_all_stock_status_msg*) buildPartial; - (warning_user_all_stock_status_msgBuilder*) mergeFrom:(warning_user_all_stock_status_msg*) other; - (warning_user_all_stock_status_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_user_all_stock_status_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (warning_user_all_stock_status_msgBuilder*) setUid:(UInt32) value; - (warning_user_all_stock_status_msgBuilder*) clearUid; @end #define warning_user_all_stock_status_result_msg_uid @"uid" #define warning_user_all_stock_status_result_msg_stock_status @"stockStatus" @interface warning_user_all_stock_status_result_msg : PBGeneratedMessage { @private BOOL hasUid_:1; UInt32 uid; NSMutableArray * stockStatusArray; } - (BOOL) hasUid; @property (readonly) UInt32 uid; @property (readonly, strong) NSArray * stockStatus; - (user_warning_stock_status*)stockStatusAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_user_all_stock_status_result_msgBuilder*) builder; + (warning_user_all_stock_status_result_msgBuilder*) builder; + (warning_user_all_stock_status_result_msgBuilder*) builderWithPrototype:(warning_user_all_stock_status_result_msg*) prototype; - (warning_user_all_stock_status_result_msgBuilder*) toBuilder; + (warning_user_all_stock_status_result_msg*) parseFromData:(NSData*) data; + (warning_user_all_stock_status_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_user_all_stock_status_result_msg*) parseFromInputStream:(NSInputStream*) input; + (warning_user_all_stock_status_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_user_all_stock_status_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_user_all_stock_status_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_user_all_stock_status_result_msgBuilder : PBGeneratedMessageBuilder { @private warning_user_all_stock_status_result_msg* resultWarningUserAllStockStatusResultMsg; } - (warning_user_all_stock_status_result_msg*) defaultInstance; - (warning_user_all_stock_status_result_msgBuilder*) clear; - (warning_user_all_stock_status_result_msgBuilder*) clone; - (warning_user_all_stock_status_result_msg*) build; - (warning_user_all_stock_status_result_msg*) buildPartial; - (warning_user_all_stock_status_result_msgBuilder*) mergeFrom:(warning_user_all_stock_status_result_msg*) other; - (warning_user_all_stock_status_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_user_all_stock_status_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (warning_user_all_stock_status_result_msgBuilder*) setUid:(UInt32) value; - (warning_user_all_stock_status_result_msgBuilder*) clearUid; - (NSMutableArray *)stockStatus; - (user_warning_stock_status*)stockStatusAtIndex:(NSUInteger)index; - (warning_user_all_stock_status_result_msgBuilder *)addStockStatus:(user_warning_stock_status*)value; - (warning_user_all_stock_status_result_msgBuilder *)setStockStatusArray:(NSArray *)array; - (warning_user_all_stock_status_result_msgBuilder *)clearStockStatus; @end #define delete_warning_config_form_code_msg_uid @"uid" #define delete_warning_config_form_code_msg_stock_code @"stockCode" @interface delete_warning_config_form_code_msg : PBGeneratedMessage { @private BOOL hasStockCode_:1; BOOL hasUid_:1; NSString* stockCode; UInt32 uid; } - (BOOL) hasUid; - (BOOL) hasStockCode; @property (readonly) UInt32 uid; @property (readonly, strong) NSString* stockCode; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (delete_warning_config_form_code_msgBuilder*) builder; + (delete_warning_config_form_code_msgBuilder*) builder; + (delete_warning_config_form_code_msgBuilder*) builderWithPrototype:(delete_warning_config_form_code_msg*) prototype; - (delete_warning_config_form_code_msgBuilder*) toBuilder; + (delete_warning_config_form_code_msg*) parseFromData:(NSData*) data; + (delete_warning_config_form_code_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (delete_warning_config_form_code_msg*) parseFromInputStream:(NSInputStream*) input; + (delete_warning_config_form_code_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (delete_warning_config_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (delete_warning_config_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface delete_warning_config_form_code_msgBuilder : PBGeneratedMessageBuilder { @private delete_warning_config_form_code_msg* resultDeleteWarningConfigFormCodeMsg; } - (delete_warning_config_form_code_msg*) defaultInstance; - (delete_warning_config_form_code_msgBuilder*) clear; - (delete_warning_config_form_code_msgBuilder*) clone; - (delete_warning_config_form_code_msg*) build; - (delete_warning_config_form_code_msg*) buildPartial; - (delete_warning_config_form_code_msgBuilder*) mergeFrom:(delete_warning_config_form_code_msg*) other; - (delete_warning_config_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (delete_warning_config_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (delete_warning_config_form_code_msgBuilder*) setUid:(UInt32) value; - (delete_warning_config_form_code_msgBuilder*) clearUid; - (BOOL) hasStockCode; - (NSString*) stockCode; - (delete_warning_config_form_code_msgBuilder*) setStockCode:(NSString*) value; - (delete_warning_config_form_code_msgBuilder*) clearStockCode; @end #define delete_warning_config_result_form_code_msg_status @"status" @interface delete_warning_config_result_form_code_msg : PBGeneratedMessage { @private BOOL hasStatus_:1; UInt32 status; } - (BOOL) hasStatus; @property (readonly) UInt32 status; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (delete_warning_config_result_form_code_msgBuilder*) builder; + (delete_warning_config_result_form_code_msgBuilder*) builder; + (delete_warning_config_result_form_code_msgBuilder*) builderWithPrototype:(delete_warning_config_result_form_code_msg*) prototype; - (delete_warning_config_result_form_code_msgBuilder*) toBuilder; + (delete_warning_config_result_form_code_msg*) parseFromData:(NSData*) data; + (delete_warning_config_result_form_code_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (delete_warning_config_result_form_code_msg*) parseFromInputStream:(NSInputStream*) input; + (delete_warning_config_result_form_code_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (delete_warning_config_result_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (delete_warning_config_result_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface delete_warning_config_result_form_code_msgBuilder : PBGeneratedMessageBuilder { @private delete_warning_config_result_form_code_msg* resultDeleteWarningConfigResultFormCodeMsg; } - (delete_warning_config_result_form_code_msg*) defaultInstance; - (delete_warning_config_result_form_code_msgBuilder*) clear; - (delete_warning_config_result_form_code_msgBuilder*) clone; - (delete_warning_config_result_form_code_msg*) build; - (delete_warning_config_result_form_code_msg*) buildPartial; - (delete_warning_config_result_form_code_msgBuilder*) mergeFrom:(delete_warning_config_result_form_code_msg*) other; - (delete_warning_config_result_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (delete_warning_config_result_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasStatus; - (UInt32) status; - (delete_warning_config_result_form_code_msgBuilder*) setStatus:(UInt32) value; - (delete_warning_config_result_form_code_msgBuilder*) clearStatus; @end #define set_warning_config_msg_uid @"uid" #define set_warning_config_msg_stock_code @"stockCode" #define set_warning_config_msg_config_data @"configData" @interface set_warning_config_msg : PBGeneratedMessage { @private BOOL hasStockCode_:1; BOOL hasUid_:1; NSString* stockCode; UInt32 uid; NSMutableArray * configDataArray; } - (BOOL) hasUid; - (BOOL) hasStockCode; @property (readonly) UInt32 uid; @property (readonly, strong) NSString* stockCode; @property (readonly, strong) NSArray * configData; - (warning_config_data*)configDataAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (set_warning_config_msgBuilder*) builder; + (set_warning_config_msgBuilder*) builder; + (set_warning_config_msgBuilder*) builderWithPrototype:(set_warning_config_msg*) prototype; - (set_warning_config_msgBuilder*) toBuilder; + (set_warning_config_msg*) parseFromData:(NSData*) data; + (set_warning_config_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (set_warning_config_msg*) parseFromInputStream:(NSInputStream*) input; + (set_warning_config_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (set_warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (set_warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface set_warning_config_msgBuilder : PBGeneratedMessageBuilder { @private set_warning_config_msg* resultSetWarningConfigMsg; } - (set_warning_config_msg*) defaultInstance; - (set_warning_config_msgBuilder*) clear; - (set_warning_config_msgBuilder*) clone; - (set_warning_config_msg*) build; - (set_warning_config_msg*) buildPartial; - (set_warning_config_msgBuilder*) mergeFrom:(set_warning_config_msg*) other; - (set_warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (set_warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (set_warning_config_msgBuilder*) setUid:(UInt32) value; - (set_warning_config_msgBuilder*) clearUid; - (BOOL) hasStockCode; - (NSString*) stockCode; - (set_warning_config_msgBuilder*) setStockCode:(NSString*) value; - (set_warning_config_msgBuilder*) clearStockCode; - (NSMutableArray *)configData; - (warning_config_data*)configDataAtIndex:(NSUInteger)index; - (set_warning_config_msgBuilder *)addConfigData:(warning_config_data*)value; - (set_warning_config_msgBuilder *)setConfigDataArray:(NSArray *)array; - (set_warning_config_msgBuilder *)clearConfigData; @end #define set_warning_config_result_msg_status @"status" @interface set_warning_config_result_msg : PBGeneratedMessage { @private BOOL hasStatus_:1; UInt32 status; } - (BOOL) hasStatus; @property (readonly) UInt32 status; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (set_warning_config_result_msgBuilder*) builder; + (set_warning_config_result_msgBuilder*) builder; + (set_warning_config_result_msgBuilder*) builderWithPrototype:(set_warning_config_result_msg*) prototype; - (set_warning_config_result_msgBuilder*) toBuilder; + (set_warning_config_result_msg*) parseFromData:(NSData*) data; + (set_warning_config_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (set_warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input; + (set_warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (set_warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (set_warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface set_warning_config_result_msgBuilder : PBGeneratedMessageBuilder { @private set_warning_config_result_msg* resultSetWarningConfigResultMsg; } - (set_warning_config_result_msg*) defaultInstance; - (set_warning_config_result_msgBuilder*) clear; - (set_warning_config_result_msgBuilder*) clone; - (set_warning_config_result_msg*) build; - (set_warning_config_result_msg*) buildPartial; - (set_warning_config_result_msgBuilder*) mergeFrom:(set_warning_config_result_msg*) other; - (set_warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (set_warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasStatus; - (UInt32) status; - (set_warning_config_result_msgBuilder*) setStatus:(UInt32) value; - (set_warning_config_result_msgBuilder*) clearStatus; @end #define warning_stock_value_value @"value" @interface warning_stock_value : PBGeneratedMessage { @private BOOL hasValue_:1; Float64 value; } - (BOOL) hasValue; @property (readonly) Float64 value; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_stock_valueBuilder*) builder; + (warning_stock_valueBuilder*) builder; + (warning_stock_valueBuilder*) builderWithPrototype:(warning_stock_value*) prototype; - (warning_stock_valueBuilder*) toBuilder; + (warning_stock_value*) parseFromData:(NSData*) data; + (warning_stock_value*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_stock_value*) parseFromInputStream:(NSInputStream*) input; + (warning_stock_value*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_stock_value*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_stock_value*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_stock_valueBuilder : PBGeneratedMessageBuilder { @private warning_stock_value* resultWarningStockValue; } - (warning_stock_value*) defaultInstance; - (warning_stock_valueBuilder*) clear; - (warning_stock_valueBuilder*) clone; - (warning_stock_value*) build; - (warning_stock_value*) buildPartial; - (warning_stock_valueBuilder*) mergeFrom:(warning_stock_value*) other; - (warning_stock_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_stock_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasValue; - (Float64) value; - (warning_stock_valueBuilder*) setValue:(Float64) value; - (warning_stock_valueBuilder*) clearValue; @end #define warning_record_code @"code" #define warning_record_name @"name" #define warning_record_node @"node" @interface warning_record : PBGeneratedMessage { @private BOOL hasCode_:1; BOOL hasName_:1; NSString* code; NSString* name; NSMutableArray * nodeArray; } - (BOOL) hasCode; - (BOOL) hasName; @property (readonly, strong) NSString* code; @property (readonly, strong) NSString* name; @property (readonly, strong) NSArray * node; - (warning_recordwarning_msg_node*)nodeAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_recordBuilder*) builder; + (warning_recordBuilder*) builder; + (warning_recordBuilder*) builderWithPrototype:(warning_record*) prototype; - (warning_recordBuilder*) toBuilder; + (warning_record*) parseFromData:(NSData*) data; + (warning_record*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_record*) parseFromInputStream:(NSInputStream*) input; + (warning_record*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_record*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_record*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end #define warning_msg_node_warning_type @"warningType" #define warning_msg_node_sub_msg @"subMsg" #define warning_msg_node_time @"time" @interface warning_recordwarning_msg_node : PBGeneratedMessage { @private BOOL hasSubMsg_:1; BOOL hasTime_:1; BOOL hasWarningType_:1; NSData* subMsg; UInt32 time; enum_warning_type warningType; } - (BOOL) hasWarningType; - (BOOL) hasSubMsg; - (BOOL) hasTime; @property (readonly) enum_warning_type warningType; @property (readonly, strong) NSData* subMsg; @property (readonly) UInt32 time; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (warning_recordwarning_msg_nodeBuilder*) builder; + (warning_recordwarning_msg_nodeBuilder*) builder; + (warning_recordwarning_msg_nodeBuilder*) builderWithPrototype:(warning_recordwarning_msg_node*) prototype; - (warning_recordwarning_msg_nodeBuilder*) toBuilder; + (warning_recordwarning_msg_node*) parseFromData:(NSData*) data; + (warning_recordwarning_msg_node*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_recordwarning_msg_node*) parseFromInputStream:(NSInputStream*) input; + (warning_recordwarning_msg_node*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (warning_recordwarning_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (warning_recordwarning_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface warning_recordwarning_msg_nodeBuilder : PBGeneratedMessageBuilder { @private warning_recordwarning_msg_node* resultWarningMsgNode; } - (warning_recordwarning_msg_node*) defaultInstance; - (warning_recordwarning_msg_nodeBuilder*) clear; - (warning_recordwarning_msg_nodeBuilder*) clone; - (warning_recordwarning_msg_node*) build; - (warning_recordwarning_msg_node*) buildPartial; - (warning_recordwarning_msg_nodeBuilder*) mergeFrom:(warning_recordwarning_msg_node*) other; - (warning_recordwarning_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_recordwarning_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasWarningType; - (enum_warning_type) warningType; - (warning_recordwarning_msg_nodeBuilder*) setWarningType:(enum_warning_type) value; - (warning_recordwarning_msg_nodeBuilder*) clearWarningType; - (BOOL) hasSubMsg; - (NSData*) subMsg; - (warning_recordwarning_msg_nodeBuilder*) setSubMsg:(NSData*) value; - (warning_recordwarning_msg_nodeBuilder*) clearSubMsg; - (BOOL) hasTime; - (UInt32) time; - (warning_recordwarning_msg_nodeBuilder*) setTime:(UInt32) value; - (warning_recordwarning_msg_nodeBuilder*) clearTime; @end @interface warning_recordBuilder : PBGeneratedMessageBuilder { @private warning_record* resultWarningRecord; } - (warning_record*) defaultInstance; - (warning_recordBuilder*) clear; - (warning_recordBuilder*) clone; - (warning_record*) build; - (warning_record*) buildPartial; - (warning_recordBuilder*) mergeFrom:(warning_record*) other; - (warning_recordBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (warning_recordBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasCode; - (NSString*) code; - (warning_recordBuilder*) setCode:(NSString*) value; - (warning_recordBuilder*) clearCode; - (BOOL) hasName; - (NSString*) name; - (warning_recordBuilder*) setName:(NSString*) value; - (warning_recordBuilder*) clearName; - (NSMutableArray *)node; - (warning_recordwarning_msg_node*)nodeAtIndex:(NSUInteger)index; - (warning_recordBuilder *)addNode:(warning_recordwarning_msg_node*)value; - (warning_recordBuilder *)setNodeArray:(NSArray *)array; - (warning_recordBuilder *)clearNode; @end #define get_warning_record_from_uid_msg_uid @"uid" @interface get_warning_record_from_uid_msg : PBGeneratedMessage { @private BOOL hasUid_:1; UInt32 uid; } - (BOOL) hasUid; @property (readonly) UInt32 uid; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (get_warning_record_from_uid_msgBuilder*) builder; + (get_warning_record_from_uid_msgBuilder*) builder; + (get_warning_record_from_uid_msgBuilder*) builderWithPrototype:(get_warning_record_from_uid_msg*) prototype; - (get_warning_record_from_uid_msgBuilder*) toBuilder; + (get_warning_record_from_uid_msg*) parseFromData:(NSData*) data; + (get_warning_record_from_uid_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (get_warning_record_from_uid_msg*) parseFromInputStream:(NSInputStream*) input; + (get_warning_record_from_uid_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (get_warning_record_from_uid_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (get_warning_record_from_uid_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface get_warning_record_from_uid_msgBuilder : PBGeneratedMessageBuilder { @private get_warning_record_from_uid_msg* resultGetWarningRecordFromUidMsg; } - (get_warning_record_from_uid_msg*) defaultInstance; - (get_warning_record_from_uid_msgBuilder*) clear; - (get_warning_record_from_uid_msgBuilder*) clone; - (get_warning_record_from_uid_msg*) build; - (get_warning_record_from_uid_msg*) buildPartial; - (get_warning_record_from_uid_msgBuilder*) mergeFrom:(get_warning_record_from_uid_msg*) other; - (get_warning_record_from_uid_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (get_warning_record_from_uid_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (get_warning_record_from_uid_msgBuilder*) setUid:(UInt32) value; - (get_warning_record_from_uid_msgBuilder*) clearUid; @end #define get_warning_record_from_uid_result_msg_uid @"uid" #define get_warning_record_from_uid_result_msg_record @"record" @interface get_warning_record_from_uid_result_msg : PBGeneratedMessage { @private BOOL hasUid_:1; UInt32 uid; NSMutableArray * recordArray; } - (BOOL) hasUid; @property (readonly) UInt32 uid; @property (readonly, strong) NSArray * record; - (warning_record*)recordAtIndex:(NSUInteger)index; + (instancetype) defaultInstance; - (instancetype) defaultInstance; - (BOOL) isInitialized; - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output; - (get_warning_record_from_uid_result_msgBuilder*) builder; + (get_warning_record_from_uid_result_msgBuilder*) builder; + (get_warning_record_from_uid_result_msgBuilder*) builderWithPrototype:(get_warning_record_from_uid_result_msg*) prototype; - (get_warning_record_from_uid_result_msgBuilder*) toBuilder; + (get_warning_record_from_uid_result_msg*) parseFromData:(NSData*) data; + (get_warning_record_from_uid_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (get_warning_record_from_uid_result_msg*) parseFromInputStream:(NSInputStream*) input; + (get_warning_record_from_uid_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; + (get_warning_record_from_uid_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input; + (get_warning_record_from_uid_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; @end @interface get_warning_record_from_uid_result_msgBuilder : PBGeneratedMessageBuilder { @private get_warning_record_from_uid_result_msg* resultGetWarningRecordFromUidResultMsg; } - (get_warning_record_from_uid_result_msg*) defaultInstance; - (get_warning_record_from_uid_result_msgBuilder*) clear; - (get_warning_record_from_uid_result_msgBuilder*) clone; - (get_warning_record_from_uid_result_msg*) build; - (get_warning_record_from_uid_result_msg*) buildPartial; - (get_warning_record_from_uid_result_msgBuilder*) mergeFrom:(get_warning_record_from_uid_result_msg*) other; - (get_warning_record_from_uid_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input; - (get_warning_record_from_uid_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry; - (BOOL) hasUid; - (UInt32) uid; - (get_warning_record_from_uid_result_msgBuilder*) setUid:(UInt32) value; - (get_warning_record_from_uid_result_msgBuilder*) clearUid; - (NSMutableArray *)record; - (warning_record*)recordAtIndex:(NSUInteger)index; - (get_warning_record_from_uid_result_msgBuilder *)addRecord:(warning_record*)value; - (get_warning_record_from_uid_result_msgBuilder *)setRecordArray:(NSArray *)array; - (get_warning_record_from_uid_result_msgBuilder *)clearRecord; @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket/src/Warning.pb.m ================================================ // Generated by the protocol buffer compiler. DO NOT EDIT! #import "Warning.pb.h" // @@protoc_insertion_point(imports) @implementation WarningRoot static PBExtensionRegistry* extensionRegistry = nil; + (PBExtensionRegistry*) extensionRegistry { return extensionRegistry; } + (void) initialize { if (self == [WarningRoot class]) { PBMutableExtensionRegistry* registry = [PBMutableExtensionRegistry registry]; [self registerAllExtensions:registry]; [CommonRoot registerAllExtensions:registry]; extensionRegistry = registry; } } + (void) registerAllExtensions:(PBMutableExtensionRegistry*) registry { } @end BOOL enum_warning_typeIsValidValue(enum_warning_type value) { switch (value) { case enum_warning_typeBeginWarningTypeEnum: case enum_warning_typeWarningPriceHigh: case enum_warning_typeWarningPriceLow: case enum_warning_typeWarningRisePercentage: case enum_warning_typeWarningDropPercentage: case enum_warning_typeEndWarningTypeEnum: return YES; default: return NO; } } NSString *NSStringFromenum_warning_type(enum_warning_type value) { switch (value) { case enum_warning_typeBeginWarningTypeEnum: return @"enum_warning_typeBeginWarningTypeEnum"; case enum_warning_typeWarningPriceHigh: return @"enum_warning_typeWarningPriceHigh"; case enum_warning_typeWarningPriceLow: return @"enum_warning_typeWarningPriceLow"; case enum_warning_typeWarningRisePercentage: return @"enum_warning_typeWarningRisePercentage"; case enum_warning_typeWarningDropPercentage: return @"enum_warning_typeWarningDropPercentage"; case enum_warning_typeEndWarningTypeEnum: return @"enum_warning_typeEndWarningTypeEnum"; default: return nil; } } @interface warning_config_data () @property enum_warning_type type; @property Float32 value; @property UInt32 status; @end @implementation warning_config_data - (BOOL) hasType { return !!hasType_; } - (void) setHasType:(BOOL) _value_ { hasType_ = !!_value_; } @synthesize type; - (BOOL) hasValue { return !!hasValue_; } - (void) setHasValue:(BOOL) _value_ { hasValue_ = !!_value_; } @synthesize value; - (BOOL) hasStatus { return !!hasStatus_; } - (void) setHasStatus:(BOOL) _value_ { hasStatus_ = !!_value_; } @synthesize status; - (instancetype) init { if ((self = [super init])) { self.type = enum_warning_typeBeginWarningTypeEnum; self.value = 0; self.status = 0; } return self; } static warning_config_data* defaultwarning_config_dataInstance = nil; + (void) initialize { if (self == [warning_config_data class]) { defaultwarning_config_dataInstance = [[warning_config_data alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_config_dataInstance; } - (instancetype) defaultInstance { return defaultwarning_config_dataInstance; } - (BOOL) isInitialized { if (!self.hasType) { return NO; } if (!self.hasValue) { return NO; } if (!self.hasStatus) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasType) { [output writeEnum:1 value:self.type]; } if (self.hasValue) { [output writeFloat:2 value:self.value]; } if (self.hasStatus) { [output writeUInt32:3 value:self.status]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasType) { size_ += computeEnumSize(1, self.type); } if (self.hasValue) { size_ += computeFloatSize(2, self.value); } if (self.hasStatus) { size_ += computeUInt32Size(3, self.status); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_config_data*) parseFromData:(NSData*) data { return (warning_config_data*)[[[warning_config_data builder] mergeFromData:data] build]; } + (warning_config_data*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_data*)[[[warning_config_data builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_config_data*) parseFromInputStream:(NSInputStream*) input { return (warning_config_data*)[[[warning_config_data builder] mergeFromInputStream:input] build]; } + (warning_config_data*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_data*)[[[warning_config_data builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_config_data*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_config_data*)[[[warning_config_data builder] mergeFromCodedInputStream:input] build]; } + (warning_config_data*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_data*)[[[warning_config_data builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_config_dataBuilder*) builder { return [[warning_config_dataBuilder alloc] init]; } + (warning_config_dataBuilder*) builderWithPrototype:(warning_config_data*) prototype { return [[warning_config_data builder] mergeFrom:prototype]; } - (warning_config_dataBuilder*) builder { return [warning_config_data builder]; } - (warning_config_dataBuilder*) toBuilder { return [warning_config_data builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasType) { [output appendFormat:@"%@%@: %@\n", indent, @"type", NSStringFromenum_warning_type(self.type)]; } if (self.hasValue) { [output appendFormat:@"%@%@: %@\n", indent, @"value", [NSNumber numberWithFloat:self.value]]; } if (self.hasStatus) { [output appendFormat:@"%@%@: %@\n", indent, @"status", [NSNumber numberWithInteger:self.status]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasType) { [dictionary setObject: @(self.type) forKey: @"type"]; } if (self.hasValue) { [dictionary setObject: [NSNumber numberWithFloat:self.value] forKey: @"value"]; } if (self.hasStatus) { [dictionary setObject: [NSNumber numberWithInteger:self.status] forKey: @"status"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_config_data class]]) { return NO; } warning_config_data *otherMessage = other; return self.hasType == otherMessage.hasType && (!self.hasType || self.type == otherMessage.type) && self.hasValue == otherMessage.hasValue && (!self.hasValue || self.value == otherMessage.value) && self.hasStatus == otherMessage.hasStatus && (!self.hasStatus || self.status == otherMessage.status) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasType) { hashCode = hashCode * 31 + self.type; } if (self.hasValue) { hashCode = hashCode * 31 + [[NSNumber numberWithFloat:self.value] hash]; } if (self.hasStatus) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.status] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_config_dataBuilder() @property (strong) warning_config_data* resultWarningConfigData; @end @implementation warning_config_dataBuilder @synthesize resultWarningConfigData; - (instancetype) init { if ((self = [super init])) { self.resultWarningConfigData = [[warning_config_data alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningConfigData; } - (warning_config_dataBuilder*) clear { self.resultWarningConfigData = [[warning_config_data alloc] init]; return self; } - (warning_config_dataBuilder*) clone { return [warning_config_data builderWithPrototype:resultWarningConfigData]; } - (warning_config_data*) defaultInstance { return [warning_config_data defaultInstance]; } - (warning_config_data*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_config_data*) buildPartial { warning_config_data* returnMe = resultWarningConfigData; self.resultWarningConfigData = nil; return returnMe; } - (warning_config_dataBuilder*) mergeFrom:(warning_config_data*) other { if (other == [warning_config_data defaultInstance]) { return self; } if (other.hasType) { [self setType:other.type]; } if (other.hasValue) { [self setValue:other.value]; } if (other.hasStatus) { [self setStatus:other.status]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_config_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_config_dataBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { enum_warning_type value = (enum_warning_type)[input readEnum]; if (enum_warning_typeIsValidValue(value)) { [self setType:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 21: { [self setValue:[input readFloat]]; break; } case 24: { [self setStatus:[input readUInt32]]; break; } } } } - (BOOL) hasType { return resultWarningConfigData.hasType; } - (enum_warning_type) type { return resultWarningConfigData.type; } - (warning_config_dataBuilder*) setType:(enum_warning_type) value { resultWarningConfigData.hasType = YES; resultWarningConfigData.type = value; return self; } - (warning_config_dataBuilder*) clearType { resultWarningConfigData.hasType = NO; resultWarningConfigData.type = enum_warning_typeBeginWarningTypeEnum; return self; } - (BOOL) hasValue { return resultWarningConfigData.hasValue; } - (Float32) value { return resultWarningConfigData.value; } - (warning_config_dataBuilder*) setValue:(Float32) value { resultWarningConfigData.hasValue = YES; resultWarningConfigData.value = value; return self; } - (warning_config_dataBuilder*) clearValue { resultWarningConfigData.hasValue = NO; resultWarningConfigData.value = 0; return self; } - (BOOL) hasStatus { return resultWarningConfigData.hasStatus; } - (UInt32) status { return resultWarningConfigData.status; } - (warning_config_dataBuilder*) setStatus:(UInt32) value { resultWarningConfigData.hasStatus = YES; resultWarningConfigData.status = value; return self; } - (warning_config_dataBuilder*) clearStatus { resultWarningConfigData.hasStatus = NO; resultWarningConfigData.status = 0; return self; } @end @interface user_warning_stock_status () @property (strong) NSString* stockCode; @property (strong) NSString* stockName; @property BOOL status; @end @implementation user_warning_stock_status - (BOOL) hasStockCode { return !!hasStockCode_; } - (void) setHasStockCode:(BOOL) _value_ { hasStockCode_ = !!_value_; } @synthesize stockCode; - (BOOL) hasStockName { return !!hasStockName_; } - (void) setHasStockName:(BOOL) _value_ { hasStockName_ = !!_value_; } @synthesize stockName; - (BOOL) hasStatus { return !!hasStatus_; } - (void) setHasStatus:(BOOL) _value_ { hasStatus_ = !!_value_; } - (BOOL) status { return !!status_; } - (void) setStatus:(BOOL) _value_ { status_ = !!_value_; } - (instancetype) init { if ((self = [super init])) { self.stockCode = @""; self.stockName = @""; self.status = NO; } return self; } static user_warning_stock_status* defaultuser_warning_stock_statusInstance = nil; + (void) initialize { if (self == [user_warning_stock_status class]) { defaultuser_warning_stock_statusInstance = [[user_warning_stock_status alloc] init]; } } + (instancetype) defaultInstance { return defaultuser_warning_stock_statusInstance; } - (instancetype) defaultInstance { return defaultuser_warning_stock_statusInstance; } - (BOOL) isInitialized { if (!self.hasStockCode) { return NO; } if (!self.hasStockName) { return NO; } if (!self.hasStatus) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasStockCode) { [output writeString:1 value:self.stockCode]; } if (self.hasStockName) { [output writeString:2 value:self.stockName]; } if (self.hasStatus) { [output writeBool:3 value:self.status]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasStockCode) { size_ += computeStringSize(1, self.stockCode); } if (self.hasStockName) { size_ += computeStringSize(2, self.stockName); } if (self.hasStatus) { size_ += computeBoolSize(3, self.status); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (user_warning_stock_status*) parseFromData:(NSData*) data { return (user_warning_stock_status*)[[[user_warning_stock_status builder] mergeFromData:data] build]; } + (user_warning_stock_status*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (user_warning_stock_status*)[[[user_warning_stock_status builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (user_warning_stock_status*) parseFromInputStream:(NSInputStream*) input { return (user_warning_stock_status*)[[[user_warning_stock_status builder] mergeFromInputStream:input] build]; } + (user_warning_stock_status*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (user_warning_stock_status*)[[[user_warning_stock_status builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (user_warning_stock_status*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (user_warning_stock_status*)[[[user_warning_stock_status builder] mergeFromCodedInputStream:input] build]; } + (user_warning_stock_status*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (user_warning_stock_status*)[[[user_warning_stock_status builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (user_warning_stock_statusBuilder*) builder { return [[user_warning_stock_statusBuilder alloc] init]; } + (user_warning_stock_statusBuilder*) builderWithPrototype:(user_warning_stock_status*) prototype { return [[user_warning_stock_status builder] mergeFrom:prototype]; } - (user_warning_stock_statusBuilder*) builder { return [user_warning_stock_status builder]; } - (user_warning_stock_statusBuilder*) toBuilder { return [user_warning_stock_status builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasStockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", self.stockCode]; } if (self.hasStockName) { [output appendFormat:@"%@%@: %@\n", indent, @"stockName", self.stockName]; } if (self.hasStatus) { [output appendFormat:@"%@%@: %@\n", indent, @"status", [NSNumber numberWithBool:self.status]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasStockCode) { [dictionary setObject: self.stockCode forKey: @"stockCode"]; } if (self.hasStockName) { [dictionary setObject: self.stockName forKey: @"stockName"]; } if (self.hasStatus) { [dictionary setObject: [NSNumber numberWithBool:self.status] forKey: @"status"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[user_warning_stock_status class]]) { return NO; } user_warning_stock_status *otherMessage = other; return self.hasStockCode == otherMessage.hasStockCode && (!self.hasStockCode || [self.stockCode isEqual:otherMessage.stockCode]) && self.hasStockName == otherMessage.hasStockName && (!self.hasStockName || [self.stockName isEqual:otherMessage.stockName]) && self.hasStatus == otherMessage.hasStatus && (!self.hasStatus || self.status == otherMessage.status) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasStockCode) { hashCode = hashCode * 31 + [self.stockCode hash]; } if (self.hasStockName) { hashCode = hashCode * 31 + [self.stockName hash]; } if (self.hasStatus) { hashCode = hashCode * 31 + [[NSNumber numberWithBool:self.status] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface user_warning_stock_statusBuilder() @property (strong) user_warning_stock_status* resultUserWarningStockStatus; @end @implementation user_warning_stock_statusBuilder @synthesize resultUserWarningStockStatus; - (instancetype) init { if ((self = [super init])) { self.resultUserWarningStockStatus = [[user_warning_stock_status alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultUserWarningStockStatus; } - (user_warning_stock_statusBuilder*) clear { self.resultUserWarningStockStatus = [[user_warning_stock_status alloc] init]; return self; } - (user_warning_stock_statusBuilder*) clone { return [user_warning_stock_status builderWithPrototype:resultUserWarningStockStatus]; } - (user_warning_stock_status*) defaultInstance { return [user_warning_stock_status defaultInstance]; } - (user_warning_stock_status*) build { [self checkInitialized]; return [self buildPartial]; } - (user_warning_stock_status*) buildPartial { user_warning_stock_status* returnMe = resultUserWarningStockStatus; self.resultUserWarningStockStatus = nil; return returnMe; } - (user_warning_stock_statusBuilder*) mergeFrom:(user_warning_stock_status*) other { if (other == [user_warning_stock_status defaultInstance]) { return self; } if (other.hasStockCode) { [self setStockCode:other.stockCode]; } if (other.hasStockName) { [self setStockName:other.stockName]; } if (other.hasStatus) { [self setStatus:other.status]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (user_warning_stock_statusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (user_warning_stock_statusBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setStockCode:[input readString]]; break; } case 18: { [self setStockName:[input readString]]; break; } case 24: { [self setStatus:[input readBool]]; break; } } } } - (BOOL) hasStockCode { return resultUserWarningStockStatus.hasStockCode; } - (NSString*) stockCode { return resultUserWarningStockStatus.stockCode; } - (user_warning_stock_statusBuilder*) setStockCode:(NSString*) value { resultUserWarningStockStatus.hasStockCode = YES; resultUserWarningStockStatus.stockCode = value; return self; } - (user_warning_stock_statusBuilder*) clearStockCode { resultUserWarningStockStatus.hasStockCode = NO; resultUserWarningStockStatus.stockCode = @""; return self; } - (BOOL) hasStockName { return resultUserWarningStockStatus.hasStockName; } - (NSString*) stockName { return resultUserWarningStockStatus.stockName; } - (user_warning_stock_statusBuilder*) setStockName:(NSString*) value { resultUserWarningStockStatus.hasStockName = YES; resultUserWarningStockStatus.stockName = value; return self; } - (user_warning_stock_statusBuilder*) clearStockName { resultUserWarningStockStatus.hasStockName = NO; resultUserWarningStockStatus.stockName = @""; return self; } - (BOOL) hasStatus { return resultUserWarningStockStatus.hasStatus; } - (BOOL) status { return resultUserWarningStockStatus.status; } - (user_warning_stock_statusBuilder*) setStatus:(BOOL) value { resultUserWarningStockStatus.hasStatus = YES; resultUserWarningStockStatus.status = value; return self; } - (user_warning_stock_statusBuilder*) clearStatus { resultUserWarningStockStatus.hasStatus = NO; resultUserWarningStockStatus.status = NO; return self; } @end @interface warning_config_msg () @property UInt32 uid; @property (strong) NSString* stockCode; @end @implementation warning_config_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (BOOL) hasStockCode { return !!hasStockCode_; } - (void) setHasStockCode:(BOOL) _value_ { hasStockCode_ = !!_value_; } @synthesize stockCode; - (instancetype) init { if ((self = [super init])) { self.uid = 0; self.stockCode = @""; } return self; } static warning_config_msg* defaultwarning_config_msgInstance = nil; + (void) initialize { if (self == [warning_config_msg class]) { defaultwarning_config_msgInstance = [[warning_config_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_config_msgInstance; } - (instancetype) defaultInstance { return defaultwarning_config_msgInstance; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } if (!self.hasStockCode) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } if (self.hasStockCode) { [output writeString:2 value:self.stockCode]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } if (self.hasStockCode) { size_ += computeStringSize(2, self.stockCode); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_config_msg*) parseFromData:(NSData*) data { return (warning_config_msg*)[[[warning_config_msg builder] mergeFromData:data] build]; } + (warning_config_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_msg*)[[[warning_config_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_config_msg*) parseFromInputStream:(NSInputStream*) input { return (warning_config_msg*)[[[warning_config_msg builder] mergeFromInputStream:input] build]; } + (warning_config_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_msg*)[[[warning_config_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_config_msg*)[[[warning_config_msg builder] mergeFromCodedInputStream:input] build]; } + (warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_msg*)[[[warning_config_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_config_msgBuilder*) builder { return [[warning_config_msgBuilder alloc] init]; } + (warning_config_msgBuilder*) builderWithPrototype:(warning_config_msg*) prototype { return [[warning_config_msg builder] mergeFrom:prototype]; } - (warning_config_msgBuilder*) builder { return [warning_config_msg builder]; } - (warning_config_msgBuilder*) toBuilder { return [warning_config_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } if (self.hasStockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", self.stockCode]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } if (self.hasStockCode) { [dictionary setObject: self.stockCode forKey: @"stockCode"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_config_msg class]]) { return NO; } warning_config_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && self.hasStockCode == otherMessage.hasStockCode && (!self.hasStockCode || [self.stockCode isEqual:otherMessage.stockCode]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } if (self.hasStockCode) { hashCode = hashCode * 31 + [self.stockCode hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_config_msgBuilder() @property (strong) warning_config_msg* resultWarningConfigMsg; @end @implementation warning_config_msgBuilder @synthesize resultWarningConfigMsg; - (instancetype) init { if ((self = [super init])) { self.resultWarningConfigMsg = [[warning_config_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningConfigMsg; } - (warning_config_msgBuilder*) clear { self.resultWarningConfigMsg = [[warning_config_msg alloc] init]; return self; } - (warning_config_msgBuilder*) clone { return [warning_config_msg builderWithPrototype:resultWarningConfigMsg]; } - (warning_config_msg*) defaultInstance { return [warning_config_msg defaultInstance]; } - (warning_config_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_config_msg*) buildPartial { warning_config_msg* returnMe = resultWarningConfigMsg; self.resultWarningConfigMsg = nil; return returnMe; } - (warning_config_msgBuilder*) mergeFrom:(warning_config_msg*) other { if (other == [warning_config_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.hasStockCode) { [self setStockCode:other.stockCode]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } case 18: { [self setStockCode:[input readString]]; break; } } } } - (BOOL) hasUid { return resultWarningConfigMsg.hasUid; } - (UInt32) uid { return resultWarningConfigMsg.uid; } - (warning_config_msgBuilder*) setUid:(UInt32) value { resultWarningConfigMsg.hasUid = YES; resultWarningConfigMsg.uid = value; return self; } - (warning_config_msgBuilder*) clearUid { resultWarningConfigMsg.hasUid = NO; resultWarningConfigMsg.uid = 0; return self; } - (BOOL) hasStockCode { return resultWarningConfigMsg.hasStockCode; } - (NSString*) stockCode { return resultWarningConfigMsg.stockCode; } - (warning_config_msgBuilder*) setStockCode:(NSString*) value { resultWarningConfigMsg.hasStockCode = YES; resultWarningConfigMsg.stockCode = value; return self; } - (warning_config_msgBuilder*) clearStockCode { resultWarningConfigMsg.hasStockCode = NO; resultWarningConfigMsg.stockCode = @""; return self; } @end @interface warning_config_result_msg () @property UInt32 uid; @property (strong) NSMutableArray * configDataArray; @end @implementation warning_config_result_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; @synthesize configDataArray; @dynamic configData; - (instancetype) init { if ((self = [super init])) { self.uid = 0; } return self; } static warning_config_result_msg* defaultwarning_config_result_msgInstance = nil; + (void) initialize { if (self == [warning_config_result_msg class]) { defaultwarning_config_result_msgInstance = [[warning_config_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_config_result_msgInstance; } - (instancetype) defaultInstance { return defaultwarning_config_result_msgInstance; } - (NSArray *)configData { return configDataArray; } - (warning_config_data*)configDataAtIndex:(NSUInteger)index { return [configDataArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } __block BOOL isInitconfigData = YES; [self.configData enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitconfigData = NO; *stop = YES; } }]; if (!isInitconfigData) return isInitconfigData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_config_result_msg*) parseFromData:(NSData*) data { return (warning_config_result_msg*)[[[warning_config_result_msg builder] mergeFromData:data] build]; } + (warning_config_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_result_msg*)[[[warning_config_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input { return (warning_config_result_msg*)[[[warning_config_result_msg builder] mergeFromInputStream:input] build]; } + (warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_result_msg*)[[[warning_config_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_config_result_msg*)[[[warning_config_result_msg builder] mergeFromCodedInputStream:input] build]; } + (warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_config_result_msg*)[[[warning_config_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_config_result_msgBuilder*) builder { return [[warning_config_result_msgBuilder alloc] init]; } + (warning_config_result_msgBuilder*) builderWithPrototype:(warning_config_result_msg*) prototype { return [[warning_config_result_msg builder] mergeFrom:prototype]; } - (warning_config_result_msgBuilder*) builder { return [warning_config_result_msg builder]; } - (warning_config_result_msgBuilder*) toBuilder { return [warning_config_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"configData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } for (warning_config_data* element in self.configDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"configData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_config_result_msg class]]) { return NO; } warning_config_result_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && [self.configDataArray isEqualToArray:otherMessage.configDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_config_result_msgBuilder() @property (strong) warning_config_result_msg* resultWarningConfigResultMsg; @end @implementation warning_config_result_msgBuilder @synthesize resultWarningConfigResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultWarningConfigResultMsg = [[warning_config_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningConfigResultMsg; } - (warning_config_result_msgBuilder*) clear { self.resultWarningConfigResultMsg = [[warning_config_result_msg alloc] init]; return self; } - (warning_config_result_msgBuilder*) clone { return [warning_config_result_msg builderWithPrototype:resultWarningConfigResultMsg]; } - (warning_config_result_msg*) defaultInstance { return [warning_config_result_msg defaultInstance]; } - (warning_config_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_config_result_msg*) buildPartial { warning_config_result_msg* returnMe = resultWarningConfigResultMsg; self.resultWarningConfigResultMsg = nil; return returnMe; } - (warning_config_result_msgBuilder*) mergeFrom:(warning_config_result_msg*) other { if (other == [warning_config_result_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.configDataArray.count > 0) { if (resultWarningConfigResultMsg.configDataArray == nil) { resultWarningConfigResultMsg.configDataArray = [[NSMutableArray alloc] initWithArray:other.configDataArray]; } else { [resultWarningConfigResultMsg.configDataArray addObjectsFromArray:other.configDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } case 18: { warning_config_dataBuilder* subBuilder = [warning_config_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addConfigData:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasUid { return resultWarningConfigResultMsg.hasUid; } - (UInt32) uid { return resultWarningConfigResultMsg.uid; } - (warning_config_result_msgBuilder*) setUid:(UInt32) value { resultWarningConfigResultMsg.hasUid = YES; resultWarningConfigResultMsg.uid = value; return self; } - (warning_config_result_msgBuilder*) clearUid { resultWarningConfigResultMsg.hasUid = NO; resultWarningConfigResultMsg.uid = 0; return self; } - (NSMutableArray *)configData { return resultWarningConfigResultMsg.configDataArray; } - (warning_config_data*)configDataAtIndex:(NSUInteger)index { return [resultWarningConfigResultMsg configDataAtIndex:index]; } - (warning_config_result_msgBuilder *)addConfigData:(warning_config_data*)value { if (resultWarningConfigResultMsg.configDataArray == nil) { resultWarningConfigResultMsg.configDataArray = [[NSMutableArray alloc]init]; } [resultWarningConfigResultMsg.configDataArray addObject:value]; return self; } - (warning_config_result_msgBuilder *)setConfigDataArray:(NSArray *)array { resultWarningConfigResultMsg.configDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (warning_config_result_msgBuilder *)clearConfigData { resultWarningConfigResultMsg.configDataArray = nil; return self; } @end @interface warning_user_all_stock_status_msg () @property UInt32 uid; @end @implementation warning_user_all_stock_status_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (instancetype) init { if ((self = [super init])) { self.uid = 0; } return self; } static warning_user_all_stock_status_msg* defaultwarning_user_all_stock_status_msgInstance = nil; + (void) initialize { if (self == [warning_user_all_stock_status_msg class]) { defaultwarning_user_all_stock_status_msgInstance = [[warning_user_all_stock_status_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_user_all_stock_status_msgInstance; } - (instancetype) defaultInstance { return defaultwarning_user_all_stock_status_msgInstance; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_user_all_stock_status_msg*) parseFromData:(NSData*) data { return (warning_user_all_stock_status_msg*)[[[warning_user_all_stock_status_msg builder] mergeFromData:data] build]; } + (warning_user_all_stock_status_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_user_all_stock_status_msg*)[[[warning_user_all_stock_status_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_user_all_stock_status_msg*) parseFromInputStream:(NSInputStream*) input { return (warning_user_all_stock_status_msg*)[[[warning_user_all_stock_status_msg builder] mergeFromInputStream:input] build]; } + (warning_user_all_stock_status_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_user_all_stock_status_msg*)[[[warning_user_all_stock_status_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_user_all_stock_status_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_user_all_stock_status_msg*)[[[warning_user_all_stock_status_msg builder] mergeFromCodedInputStream:input] build]; } + (warning_user_all_stock_status_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_user_all_stock_status_msg*)[[[warning_user_all_stock_status_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_user_all_stock_status_msgBuilder*) builder { return [[warning_user_all_stock_status_msgBuilder alloc] init]; } + (warning_user_all_stock_status_msgBuilder*) builderWithPrototype:(warning_user_all_stock_status_msg*) prototype { return [[warning_user_all_stock_status_msg builder] mergeFrom:prototype]; } - (warning_user_all_stock_status_msgBuilder*) builder { return [warning_user_all_stock_status_msg builder]; } - (warning_user_all_stock_status_msgBuilder*) toBuilder { return [warning_user_all_stock_status_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_user_all_stock_status_msg class]]) { return NO; } warning_user_all_stock_status_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_user_all_stock_status_msgBuilder() @property (strong) warning_user_all_stock_status_msg* resultWarningUserAllStockStatusMsg; @end @implementation warning_user_all_stock_status_msgBuilder @synthesize resultWarningUserAllStockStatusMsg; - (instancetype) init { if ((self = [super init])) { self.resultWarningUserAllStockStatusMsg = [[warning_user_all_stock_status_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningUserAllStockStatusMsg; } - (warning_user_all_stock_status_msgBuilder*) clear { self.resultWarningUserAllStockStatusMsg = [[warning_user_all_stock_status_msg alloc] init]; return self; } - (warning_user_all_stock_status_msgBuilder*) clone { return [warning_user_all_stock_status_msg builderWithPrototype:resultWarningUserAllStockStatusMsg]; } - (warning_user_all_stock_status_msg*) defaultInstance { return [warning_user_all_stock_status_msg defaultInstance]; } - (warning_user_all_stock_status_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_user_all_stock_status_msg*) buildPartial { warning_user_all_stock_status_msg* returnMe = resultWarningUserAllStockStatusMsg; self.resultWarningUserAllStockStatusMsg = nil; return returnMe; } - (warning_user_all_stock_status_msgBuilder*) mergeFrom:(warning_user_all_stock_status_msg*) other { if (other == [warning_user_all_stock_status_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_user_all_stock_status_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_user_all_stock_status_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } } } } - (BOOL) hasUid { return resultWarningUserAllStockStatusMsg.hasUid; } - (UInt32) uid { return resultWarningUserAllStockStatusMsg.uid; } - (warning_user_all_stock_status_msgBuilder*) setUid:(UInt32) value { resultWarningUserAllStockStatusMsg.hasUid = YES; resultWarningUserAllStockStatusMsg.uid = value; return self; } - (warning_user_all_stock_status_msgBuilder*) clearUid { resultWarningUserAllStockStatusMsg.hasUid = NO; resultWarningUserAllStockStatusMsg.uid = 0; return self; } @end @interface warning_user_all_stock_status_result_msg () @property UInt32 uid; @property (strong) NSMutableArray * stockStatusArray; @end @implementation warning_user_all_stock_status_result_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; @synthesize stockStatusArray; @dynamic stockStatus; - (instancetype) init { if ((self = [super init])) { self.uid = 0; } return self; } static warning_user_all_stock_status_result_msg* defaultwarning_user_all_stock_status_result_msgInstance = nil; + (void) initialize { if (self == [warning_user_all_stock_status_result_msg class]) { defaultwarning_user_all_stock_status_result_msgInstance = [[warning_user_all_stock_status_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_user_all_stock_status_result_msgInstance; } - (instancetype) defaultInstance { return defaultwarning_user_all_stock_status_result_msgInstance; } - (NSArray *)stockStatus { return stockStatusArray; } - (user_warning_stock_status*)stockStatusAtIndex:(NSUInteger)index { return [stockStatusArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } __block BOOL isInitstockStatus = YES; [self.stockStatus enumerateObjectsUsingBlock:^(user_warning_stock_status *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitstockStatus = NO; *stop = YES; } }]; if (!isInitstockStatus) return isInitstockStatus; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } [self.stockStatusArray enumerateObjectsUsingBlock:^(user_warning_stock_status *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } [self.stockStatusArray enumerateObjectsUsingBlock:^(user_warning_stock_status *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_user_all_stock_status_result_msg*) parseFromData:(NSData*) data { return (warning_user_all_stock_status_result_msg*)[[[warning_user_all_stock_status_result_msg builder] mergeFromData:data] build]; } + (warning_user_all_stock_status_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_user_all_stock_status_result_msg*)[[[warning_user_all_stock_status_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_user_all_stock_status_result_msg*) parseFromInputStream:(NSInputStream*) input { return (warning_user_all_stock_status_result_msg*)[[[warning_user_all_stock_status_result_msg builder] mergeFromInputStream:input] build]; } + (warning_user_all_stock_status_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_user_all_stock_status_result_msg*)[[[warning_user_all_stock_status_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_user_all_stock_status_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_user_all_stock_status_result_msg*)[[[warning_user_all_stock_status_result_msg builder] mergeFromCodedInputStream:input] build]; } + (warning_user_all_stock_status_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_user_all_stock_status_result_msg*)[[[warning_user_all_stock_status_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_user_all_stock_status_result_msgBuilder*) builder { return [[warning_user_all_stock_status_result_msgBuilder alloc] init]; } + (warning_user_all_stock_status_result_msgBuilder*) builderWithPrototype:(warning_user_all_stock_status_result_msg*) prototype { return [[warning_user_all_stock_status_result_msg builder] mergeFrom:prototype]; } - (warning_user_all_stock_status_result_msgBuilder*) builder { return [warning_user_all_stock_status_result_msg builder]; } - (warning_user_all_stock_status_result_msgBuilder*) toBuilder { return [warning_user_all_stock_status_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } [self.stockStatusArray enumerateObjectsUsingBlock:^(user_warning_stock_status *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"stockStatus"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } for (user_warning_stock_status* element in self.stockStatusArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"stockStatus"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_user_all_stock_status_result_msg class]]) { return NO; } warning_user_all_stock_status_result_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && [self.stockStatusArray isEqualToArray:otherMessage.stockStatusArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } [self.stockStatusArray enumerateObjectsUsingBlock:^(user_warning_stock_status *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_user_all_stock_status_result_msgBuilder() @property (strong) warning_user_all_stock_status_result_msg* resultWarningUserAllStockStatusResultMsg; @end @implementation warning_user_all_stock_status_result_msgBuilder @synthesize resultWarningUserAllStockStatusResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultWarningUserAllStockStatusResultMsg = [[warning_user_all_stock_status_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningUserAllStockStatusResultMsg; } - (warning_user_all_stock_status_result_msgBuilder*) clear { self.resultWarningUserAllStockStatusResultMsg = [[warning_user_all_stock_status_result_msg alloc] init]; return self; } - (warning_user_all_stock_status_result_msgBuilder*) clone { return [warning_user_all_stock_status_result_msg builderWithPrototype:resultWarningUserAllStockStatusResultMsg]; } - (warning_user_all_stock_status_result_msg*) defaultInstance { return [warning_user_all_stock_status_result_msg defaultInstance]; } - (warning_user_all_stock_status_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_user_all_stock_status_result_msg*) buildPartial { warning_user_all_stock_status_result_msg* returnMe = resultWarningUserAllStockStatusResultMsg; self.resultWarningUserAllStockStatusResultMsg = nil; return returnMe; } - (warning_user_all_stock_status_result_msgBuilder*) mergeFrom:(warning_user_all_stock_status_result_msg*) other { if (other == [warning_user_all_stock_status_result_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.stockStatusArray.count > 0) { if (resultWarningUserAllStockStatusResultMsg.stockStatusArray == nil) { resultWarningUserAllStockStatusResultMsg.stockStatusArray = [[NSMutableArray alloc] initWithArray:other.stockStatusArray]; } else { [resultWarningUserAllStockStatusResultMsg.stockStatusArray addObjectsFromArray:other.stockStatusArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_user_all_stock_status_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_user_all_stock_status_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } case 18: { user_warning_stock_statusBuilder* subBuilder = [user_warning_stock_status builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addStockStatus:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasUid { return resultWarningUserAllStockStatusResultMsg.hasUid; } - (UInt32) uid { return resultWarningUserAllStockStatusResultMsg.uid; } - (warning_user_all_stock_status_result_msgBuilder*) setUid:(UInt32) value { resultWarningUserAllStockStatusResultMsg.hasUid = YES; resultWarningUserAllStockStatusResultMsg.uid = value; return self; } - (warning_user_all_stock_status_result_msgBuilder*) clearUid { resultWarningUserAllStockStatusResultMsg.hasUid = NO; resultWarningUserAllStockStatusResultMsg.uid = 0; return self; } - (NSMutableArray *)stockStatus { return resultWarningUserAllStockStatusResultMsg.stockStatusArray; } - (user_warning_stock_status*)stockStatusAtIndex:(NSUInteger)index { return [resultWarningUserAllStockStatusResultMsg stockStatusAtIndex:index]; } - (warning_user_all_stock_status_result_msgBuilder *)addStockStatus:(user_warning_stock_status*)value { if (resultWarningUserAllStockStatusResultMsg.stockStatusArray == nil) { resultWarningUserAllStockStatusResultMsg.stockStatusArray = [[NSMutableArray alloc]init]; } [resultWarningUserAllStockStatusResultMsg.stockStatusArray addObject:value]; return self; } - (warning_user_all_stock_status_result_msgBuilder *)setStockStatusArray:(NSArray *)array { resultWarningUserAllStockStatusResultMsg.stockStatusArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (warning_user_all_stock_status_result_msgBuilder *)clearStockStatus { resultWarningUserAllStockStatusResultMsg.stockStatusArray = nil; return self; } @end @interface delete_warning_config_form_code_msg () @property UInt32 uid; @property (strong) NSString* stockCode; @end @implementation delete_warning_config_form_code_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (BOOL) hasStockCode { return !!hasStockCode_; } - (void) setHasStockCode:(BOOL) _value_ { hasStockCode_ = !!_value_; } @synthesize stockCode; - (instancetype) init { if ((self = [super init])) { self.uid = 0; self.stockCode = @""; } return self; } static delete_warning_config_form_code_msg* defaultdelete_warning_config_form_code_msgInstance = nil; + (void) initialize { if (self == [delete_warning_config_form_code_msg class]) { defaultdelete_warning_config_form_code_msgInstance = [[delete_warning_config_form_code_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultdelete_warning_config_form_code_msgInstance; } - (instancetype) defaultInstance { return defaultdelete_warning_config_form_code_msgInstance; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } if (!self.hasStockCode) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } if (self.hasStockCode) { [output writeString:2 value:self.stockCode]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } if (self.hasStockCode) { size_ += computeStringSize(2, self.stockCode); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (delete_warning_config_form_code_msg*) parseFromData:(NSData*) data { return (delete_warning_config_form_code_msg*)[[[delete_warning_config_form_code_msg builder] mergeFromData:data] build]; } + (delete_warning_config_form_code_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (delete_warning_config_form_code_msg*)[[[delete_warning_config_form_code_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (delete_warning_config_form_code_msg*) parseFromInputStream:(NSInputStream*) input { return (delete_warning_config_form_code_msg*)[[[delete_warning_config_form_code_msg builder] mergeFromInputStream:input] build]; } + (delete_warning_config_form_code_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (delete_warning_config_form_code_msg*)[[[delete_warning_config_form_code_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (delete_warning_config_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (delete_warning_config_form_code_msg*)[[[delete_warning_config_form_code_msg builder] mergeFromCodedInputStream:input] build]; } + (delete_warning_config_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (delete_warning_config_form_code_msg*)[[[delete_warning_config_form_code_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (delete_warning_config_form_code_msgBuilder*) builder { return [[delete_warning_config_form_code_msgBuilder alloc] init]; } + (delete_warning_config_form_code_msgBuilder*) builderWithPrototype:(delete_warning_config_form_code_msg*) prototype { return [[delete_warning_config_form_code_msg builder] mergeFrom:prototype]; } - (delete_warning_config_form_code_msgBuilder*) builder { return [delete_warning_config_form_code_msg builder]; } - (delete_warning_config_form_code_msgBuilder*) toBuilder { return [delete_warning_config_form_code_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } if (self.hasStockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", self.stockCode]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } if (self.hasStockCode) { [dictionary setObject: self.stockCode forKey: @"stockCode"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[delete_warning_config_form_code_msg class]]) { return NO; } delete_warning_config_form_code_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && self.hasStockCode == otherMessage.hasStockCode && (!self.hasStockCode || [self.stockCode isEqual:otherMessage.stockCode]) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } if (self.hasStockCode) { hashCode = hashCode * 31 + [self.stockCode hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface delete_warning_config_form_code_msgBuilder() @property (strong) delete_warning_config_form_code_msg* resultDeleteWarningConfigFormCodeMsg; @end @implementation delete_warning_config_form_code_msgBuilder @synthesize resultDeleteWarningConfigFormCodeMsg; - (instancetype) init { if ((self = [super init])) { self.resultDeleteWarningConfigFormCodeMsg = [[delete_warning_config_form_code_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultDeleteWarningConfigFormCodeMsg; } - (delete_warning_config_form_code_msgBuilder*) clear { self.resultDeleteWarningConfigFormCodeMsg = [[delete_warning_config_form_code_msg alloc] init]; return self; } - (delete_warning_config_form_code_msgBuilder*) clone { return [delete_warning_config_form_code_msg builderWithPrototype:resultDeleteWarningConfigFormCodeMsg]; } - (delete_warning_config_form_code_msg*) defaultInstance { return [delete_warning_config_form_code_msg defaultInstance]; } - (delete_warning_config_form_code_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (delete_warning_config_form_code_msg*) buildPartial { delete_warning_config_form_code_msg* returnMe = resultDeleteWarningConfigFormCodeMsg; self.resultDeleteWarningConfigFormCodeMsg = nil; return returnMe; } - (delete_warning_config_form_code_msgBuilder*) mergeFrom:(delete_warning_config_form_code_msg*) other { if (other == [delete_warning_config_form_code_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.hasStockCode) { [self setStockCode:other.stockCode]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (delete_warning_config_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (delete_warning_config_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } case 18: { [self setStockCode:[input readString]]; break; } } } } - (BOOL) hasUid { return resultDeleteWarningConfigFormCodeMsg.hasUid; } - (UInt32) uid { return resultDeleteWarningConfigFormCodeMsg.uid; } - (delete_warning_config_form_code_msgBuilder*) setUid:(UInt32) value { resultDeleteWarningConfigFormCodeMsg.hasUid = YES; resultDeleteWarningConfigFormCodeMsg.uid = value; return self; } - (delete_warning_config_form_code_msgBuilder*) clearUid { resultDeleteWarningConfigFormCodeMsg.hasUid = NO; resultDeleteWarningConfigFormCodeMsg.uid = 0; return self; } - (BOOL) hasStockCode { return resultDeleteWarningConfigFormCodeMsg.hasStockCode; } - (NSString*) stockCode { return resultDeleteWarningConfigFormCodeMsg.stockCode; } - (delete_warning_config_form_code_msgBuilder*) setStockCode:(NSString*) value { resultDeleteWarningConfigFormCodeMsg.hasStockCode = YES; resultDeleteWarningConfigFormCodeMsg.stockCode = value; return self; } - (delete_warning_config_form_code_msgBuilder*) clearStockCode { resultDeleteWarningConfigFormCodeMsg.hasStockCode = NO; resultDeleteWarningConfigFormCodeMsg.stockCode = @""; return self; } @end @interface delete_warning_config_result_form_code_msg () @property UInt32 status; @end @implementation delete_warning_config_result_form_code_msg - (BOOL) hasStatus { return !!hasStatus_; } - (void) setHasStatus:(BOOL) _value_ { hasStatus_ = !!_value_; } @synthesize status; - (instancetype) init { if ((self = [super init])) { self.status = 0; } return self; } static delete_warning_config_result_form_code_msg* defaultdelete_warning_config_result_form_code_msgInstance = nil; + (void) initialize { if (self == [delete_warning_config_result_form_code_msg class]) { defaultdelete_warning_config_result_form_code_msgInstance = [[delete_warning_config_result_form_code_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultdelete_warning_config_result_form_code_msgInstance; } - (instancetype) defaultInstance { return defaultdelete_warning_config_result_form_code_msgInstance; } - (BOOL) isInitialized { if (!self.hasStatus) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasStatus) { [output writeUInt32:1 value:self.status]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasStatus) { size_ += computeUInt32Size(1, self.status); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (delete_warning_config_result_form_code_msg*) parseFromData:(NSData*) data { return (delete_warning_config_result_form_code_msg*)[[[delete_warning_config_result_form_code_msg builder] mergeFromData:data] build]; } + (delete_warning_config_result_form_code_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (delete_warning_config_result_form_code_msg*)[[[delete_warning_config_result_form_code_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (delete_warning_config_result_form_code_msg*) parseFromInputStream:(NSInputStream*) input { return (delete_warning_config_result_form_code_msg*)[[[delete_warning_config_result_form_code_msg builder] mergeFromInputStream:input] build]; } + (delete_warning_config_result_form_code_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (delete_warning_config_result_form_code_msg*)[[[delete_warning_config_result_form_code_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (delete_warning_config_result_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (delete_warning_config_result_form_code_msg*)[[[delete_warning_config_result_form_code_msg builder] mergeFromCodedInputStream:input] build]; } + (delete_warning_config_result_form_code_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (delete_warning_config_result_form_code_msg*)[[[delete_warning_config_result_form_code_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (delete_warning_config_result_form_code_msgBuilder*) builder { return [[delete_warning_config_result_form_code_msgBuilder alloc] init]; } + (delete_warning_config_result_form_code_msgBuilder*) builderWithPrototype:(delete_warning_config_result_form_code_msg*) prototype { return [[delete_warning_config_result_form_code_msg builder] mergeFrom:prototype]; } - (delete_warning_config_result_form_code_msgBuilder*) builder { return [delete_warning_config_result_form_code_msg builder]; } - (delete_warning_config_result_form_code_msgBuilder*) toBuilder { return [delete_warning_config_result_form_code_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasStatus) { [output appendFormat:@"%@%@: %@\n", indent, @"status", [NSNumber numberWithInteger:self.status]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasStatus) { [dictionary setObject: [NSNumber numberWithInteger:self.status] forKey: @"status"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[delete_warning_config_result_form_code_msg class]]) { return NO; } delete_warning_config_result_form_code_msg *otherMessage = other; return self.hasStatus == otherMessage.hasStatus && (!self.hasStatus || self.status == otherMessage.status) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasStatus) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.status] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface delete_warning_config_result_form_code_msgBuilder() @property (strong) delete_warning_config_result_form_code_msg* resultDeleteWarningConfigResultFormCodeMsg; @end @implementation delete_warning_config_result_form_code_msgBuilder @synthesize resultDeleteWarningConfigResultFormCodeMsg; - (instancetype) init { if ((self = [super init])) { self.resultDeleteWarningConfigResultFormCodeMsg = [[delete_warning_config_result_form_code_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultDeleteWarningConfigResultFormCodeMsg; } - (delete_warning_config_result_form_code_msgBuilder*) clear { self.resultDeleteWarningConfigResultFormCodeMsg = [[delete_warning_config_result_form_code_msg alloc] init]; return self; } - (delete_warning_config_result_form_code_msgBuilder*) clone { return [delete_warning_config_result_form_code_msg builderWithPrototype:resultDeleteWarningConfigResultFormCodeMsg]; } - (delete_warning_config_result_form_code_msg*) defaultInstance { return [delete_warning_config_result_form_code_msg defaultInstance]; } - (delete_warning_config_result_form_code_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (delete_warning_config_result_form_code_msg*) buildPartial { delete_warning_config_result_form_code_msg* returnMe = resultDeleteWarningConfigResultFormCodeMsg; self.resultDeleteWarningConfigResultFormCodeMsg = nil; return returnMe; } - (delete_warning_config_result_form_code_msgBuilder*) mergeFrom:(delete_warning_config_result_form_code_msg*) other { if (other == [delete_warning_config_result_form_code_msg defaultInstance]) { return self; } if (other.hasStatus) { [self setStatus:other.status]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (delete_warning_config_result_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (delete_warning_config_result_form_code_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setStatus:[input readUInt32]]; break; } } } } - (BOOL) hasStatus { return resultDeleteWarningConfigResultFormCodeMsg.hasStatus; } - (UInt32) status { return resultDeleteWarningConfigResultFormCodeMsg.status; } - (delete_warning_config_result_form_code_msgBuilder*) setStatus:(UInt32) value { resultDeleteWarningConfigResultFormCodeMsg.hasStatus = YES; resultDeleteWarningConfigResultFormCodeMsg.status = value; return self; } - (delete_warning_config_result_form_code_msgBuilder*) clearStatus { resultDeleteWarningConfigResultFormCodeMsg.hasStatus = NO; resultDeleteWarningConfigResultFormCodeMsg.status = 0; return self; } @end @interface set_warning_config_msg () @property UInt32 uid; @property (strong) NSString* stockCode; @property (strong) NSMutableArray * configDataArray; @end @implementation set_warning_config_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (BOOL) hasStockCode { return !!hasStockCode_; } - (void) setHasStockCode:(BOOL) _value_ { hasStockCode_ = !!_value_; } @synthesize stockCode; @synthesize configDataArray; @dynamic configData; - (instancetype) init { if ((self = [super init])) { self.uid = 0; self.stockCode = @""; } return self; } static set_warning_config_msg* defaultset_warning_config_msgInstance = nil; + (void) initialize { if (self == [set_warning_config_msg class]) { defaultset_warning_config_msgInstance = [[set_warning_config_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultset_warning_config_msgInstance; } - (instancetype) defaultInstance { return defaultset_warning_config_msgInstance; } - (NSArray *)configData { return configDataArray; } - (warning_config_data*)configDataAtIndex:(NSUInteger)index { return [configDataArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } if (!self.hasStockCode) { return NO; } __block BOOL isInitconfigData = YES; [self.configData enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitconfigData = NO; *stop = YES; } }]; if (!isInitconfigData) return isInitconfigData; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } if (self.hasStockCode) { [output writeString:2 value:self.stockCode]; } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { [output writeMessage:3 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } if (self.hasStockCode) { size_ += computeStringSize(2, self.stockCode); } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(3, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (set_warning_config_msg*) parseFromData:(NSData*) data { return (set_warning_config_msg*)[[[set_warning_config_msg builder] mergeFromData:data] build]; } + (set_warning_config_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (set_warning_config_msg*)[[[set_warning_config_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (set_warning_config_msg*) parseFromInputStream:(NSInputStream*) input { return (set_warning_config_msg*)[[[set_warning_config_msg builder] mergeFromInputStream:input] build]; } + (set_warning_config_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (set_warning_config_msg*)[[[set_warning_config_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (set_warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (set_warning_config_msg*)[[[set_warning_config_msg builder] mergeFromCodedInputStream:input] build]; } + (set_warning_config_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (set_warning_config_msg*)[[[set_warning_config_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (set_warning_config_msgBuilder*) builder { return [[set_warning_config_msgBuilder alloc] init]; } + (set_warning_config_msgBuilder*) builderWithPrototype:(set_warning_config_msg*) prototype { return [[set_warning_config_msg builder] mergeFrom:prototype]; } - (set_warning_config_msgBuilder*) builder { return [set_warning_config_msg builder]; } - (set_warning_config_msgBuilder*) toBuilder { return [set_warning_config_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } if (self.hasStockCode) { [output appendFormat:@"%@%@: %@\n", indent, @"stockCode", self.stockCode]; } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"configData"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } if (self.hasStockCode) { [dictionary setObject: self.stockCode forKey: @"stockCode"]; } for (warning_config_data* element in self.configDataArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"configData"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[set_warning_config_msg class]]) { return NO; } set_warning_config_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && self.hasStockCode == otherMessage.hasStockCode && (!self.hasStockCode || [self.stockCode isEqual:otherMessage.stockCode]) && [self.configDataArray isEqualToArray:otherMessage.configDataArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } if (self.hasStockCode) { hashCode = hashCode * 31 + [self.stockCode hash]; } [self.configDataArray enumerateObjectsUsingBlock:^(warning_config_data *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface set_warning_config_msgBuilder() @property (strong) set_warning_config_msg* resultSetWarningConfigMsg; @end @implementation set_warning_config_msgBuilder @synthesize resultSetWarningConfigMsg; - (instancetype) init { if ((self = [super init])) { self.resultSetWarningConfigMsg = [[set_warning_config_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSetWarningConfigMsg; } - (set_warning_config_msgBuilder*) clear { self.resultSetWarningConfigMsg = [[set_warning_config_msg alloc] init]; return self; } - (set_warning_config_msgBuilder*) clone { return [set_warning_config_msg builderWithPrototype:resultSetWarningConfigMsg]; } - (set_warning_config_msg*) defaultInstance { return [set_warning_config_msg defaultInstance]; } - (set_warning_config_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (set_warning_config_msg*) buildPartial { set_warning_config_msg* returnMe = resultSetWarningConfigMsg; self.resultSetWarningConfigMsg = nil; return returnMe; } - (set_warning_config_msgBuilder*) mergeFrom:(set_warning_config_msg*) other { if (other == [set_warning_config_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.hasStockCode) { [self setStockCode:other.stockCode]; } if (other.configDataArray.count > 0) { if (resultSetWarningConfigMsg.configDataArray == nil) { resultSetWarningConfigMsg.configDataArray = [[NSMutableArray alloc] initWithArray:other.configDataArray]; } else { [resultSetWarningConfigMsg.configDataArray addObjectsFromArray:other.configDataArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (set_warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (set_warning_config_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } case 18: { [self setStockCode:[input readString]]; break; } case 26: { warning_config_dataBuilder* subBuilder = [warning_config_data builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addConfigData:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasUid { return resultSetWarningConfigMsg.hasUid; } - (UInt32) uid { return resultSetWarningConfigMsg.uid; } - (set_warning_config_msgBuilder*) setUid:(UInt32) value { resultSetWarningConfigMsg.hasUid = YES; resultSetWarningConfigMsg.uid = value; return self; } - (set_warning_config_msgBuilder*) clearUid { resultSetWarningConfigMsg.hasUid = NO; resultSetWarningConfigMsg.uid = 0; return self; } - (BOOL) hasStockCode { return resultSetWarningConfigMsg.hasStockCode; } - (NSString*) stockCode { return resultSetWarningConfigMsg.stockCode; } - (set_warning_config_msgBuilder*) setStockCode:(NSString*) value { resultSetWarningConfigMsg.hasStockCode = YES; resultSetWarningConfigMsg.stockCode = value; return self; } - (set_warning_config_msgBuilder*) clearStockCode { resultSetWarningConfigMsg.hasStockCode = NO; resultSetWarningConfigMsg.stockCode = @""; return self; } - (NSMutableArray *)configData { return resultSetWarningConfigMsg.configDataArray; } - (warning_config_data*)configDataAtIndex:(NSUInteger)index { return [resultSetWarningConfigMsg configDataAtIndex:index]; } - (set_warning_config_msgBuilder *)addConfigData:(warning_config_data*)value { if (resultSetWarningConfigMsg.configDataArray == nil) { resultSetWarningConfigMsg.configDataArray = [[NSMutableArray alloc]init]; } [resultSetWarningConfigMsg.configDataArray addObject:value]; return self; } - (set_warning_config_msgBuilder *)setConfigDataArray:(NSArray *)array { resultSetWarningConfigMsg.configDataArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (set_warning_config_msgBuilder *)clearConfigData { resultSetWarningConfigMsg.configDataArray = nil; return self; } @end @interface set_warning_config_result_msg () @property UInt32 status; @end @implementation set_warning_config_result_msg - (BOOL) hasStatus { return !!hasStatus_; } - (void) setHasStatus:(BOOL) _value_ { hasStatus_ = !!_value_; } @synthesize status; - (instancetype) init { if ((self = [super init])) { self.status = 0; } return self; } static set_warning_config_result_msg* defaultset_warning_config_result_msgInstance = nil; + (void) initialize { if (self == [set_warning_config_result_msg class]) { defaultset_warning_config_result_msgInstance = [[set_warning_config_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultset_warning_config_result_msgInstance; } - (instancetype) defaultInstance { return defaultset_warning_config_result_msgInstance; } - (BOOL) isInitialized { if (!self.hasStatus) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasStatus) { [output writeUInt32:1 value:self.status]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasStatus) { size_ += computeUInt32Size(1, self.status); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (set_warning_config_result_msg*) parseFromData:(NSData*) data { return (set_warning_config_result_msg*)[[[set_warning_config_result_msg builder] mergeFromData:data] build]; } + (set_warning_config_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (set_warning_config_result_msg*)[[[set_warning_config_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (set_warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input { return (set_warning_config_result_msg*)[[[set_warning_config_result_msg builder] mergeFromInputStream:input] build]; } + (set_warning_config_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (set_warning_config_result_msg*)[[[set_warning_config_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (set_warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (set_warning_config_result_msg*)[[[set_warning_config_result_msg builder] mergeFromCodedInputStream:input] build]; } + (set_warning_config_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (set_warning_config_result_msg*)[[[set_warning_config_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (set_warning_config_result_msgBuilder*) builder { return [[set_warning_config_result_msgBuilder alloc] init]; } + (set_warning_config_result_msgBuilder*) builderWithPrototype:(set_warning_config_result_msg*) prototype { return [[set_warning_config_result_msg builder] mergeFrom:prototype]; } - (set_warning_config_result_msgBuilder*) builder { return [set_warning_config_result_msg builder]; } - (set_warning_config_result_msgBuilder*) toBuilder { return [set_warning_config_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasStatus) { [output appendFormat:@"%@%@: %@\n", indent, @"status", [NSNumber numberWithInteger:self.status]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasStatus) { [dictionary setObject: [NSNumber numberWithInteger:self.status] forKey: @"status"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[set_warning_config_result_msg class]]) { return NO; } set_warning_config_result_msg *otherMessage = other; return self.hasStatus == otherMessage.hasStatus && (!self.hasStatus || self.status == otherMessage.status) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasStatus) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.status] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface set_warning_config_result_msgBuilder() @property (strong) set_warning_config_result_msg* resultSetWarningConfigResultMsg; @end @implementation set_warning_config_result_msgBuilder @synthesize resultSetWarningConfigResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultSetWarningConfigResultMsg = [[set_warning_config_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultSetWarningConfigResultMsg; } - (set_warning_config_result_msgBuilder*) clear { self.resultSetWarningConfigResultMsg = [[set_warning_config_result_msg alloc] init]; return self; } - (set_warning_config_result_msgBuilder*) clone { return [set_warning_config_result_msg builderWithPrototype:resultSetWarningConfigResultMsg]; } - (set_warning_config_result_msg*) defaultInstance { return [set_warning_config_result_msg defaultInstance]; } - (set_warning_config_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (set_warning_config_result_msg*) buildPartial { set_warning_config_result_msg* returnMe = resultSetWarningConfigResultMsg; self.resultSetWarningConfigResultMsg = nil; return returnMe; } - (set_warning_config_result_msgBuilder*) mergeFrom:(set_warning_config_result_msg*) other { if (other == [set_warning_config_result_msg defaultInstance]) { return self; } if (other.hasStatus) { [self setStatus:other.status]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (set_warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (set_warning_config_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setStatus:[input readUInt32]]; break; } } } } - (BOOL) hasStatus { return resultSetWarningConfigResultMsg.hasStatus; } - (UInt32) status { return resultSetWarningConfigResultMsg.status; } - (set_warning_config_result_msgBuilder*) setStatus:(UInt32) value { resultSetWarningConfigResultMsg.hasStatus = YES; resultSetWarningConfigResultMsg.status = value; return self; } - (set_warning_config_result_msgBuilder*) clearStatus { resultSetWarningConfigResultMsg.hasStatus = NO; resultSetWarningConfigResultMsg.status = 0; return self; } @end @interface warning_stock_value () @property Float64 value; @end @implementation warning_stock_value - (BOOL) hasValue { return !!hasValue_; } - (void) setHasValue:(BOOL) _value_ { hasValue_ = !!_value_; } @synthesize value; - (instancetype) init { if ((self = [super init])) { self.value = 0; } return self; } static warning_stock_value* defaultwarning_stock_valueInstance = nil; + (void) initialize { if (self == [warning_stock_value class]) { defaultwarning_stock_valueInstance = [[warning_stock_value alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_stock_valueInstance; } - (instancetype) defaultInstance { return defaultwarning_stock_valueInstance; } - (BOOL) isInitialized { if (!self.hasValue) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasValue) { [output writeDouble:1 value:self.value]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasValue) { size_ += computeDoubleSize(1, self.value); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_stock_value*) parseFromData:(NSData*) data { return (warning_stock_value*)[[[warning_stock_value builder] mergeFromData:data] build]; } + (warning_stock_value*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_stock_value*)[[[warning_stock_value builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_stock_value*) parseFromInputStream:(NSInputStream*) input { return (warning_stock_value*)[[[warning_stock_value builder] mergeFromInputStream:input] build]; } + (warning_stock_value*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_stock_value*)[[[warning_stock_value builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_stock_value*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_stock_value*)[[[warning_stock_value builder] mergeFromCodedInputStream:input] build]; } + (warning_stock_value*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_stock_value*)[[[warning_stock_value builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_stock_valueBuilder*) builder { return [[warning_stock_valueBuilder alloc] init]; } + (warning_stock_valueBuilder*) builderWithPrototype:(warning_stock_value*) prototype { return [[warning_stock_value builder] mergeFrom:prototype]; } - (warning_stock_valueBuilder*) builder { return [warning_stock_value builder]; } - (warning_stock_valueBuilder*) toBuilder { return [warning_stock_value builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasValue) { [output appendFormat:@"%@%@: %@\n", indent, @"value", [NSNumber numberWithDouble:self.value]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasValue) { [dictionary setObject: [NSNumber numberWithDouble:self.value] forKey: @"value"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_stock_value class]]) { return NO; } warning_stock_value *otherMessage = other; return self.hasValue == otherMessage.hasValue && (!self.hasValue || self.value == otherMessage.value) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasValue) { hashCode = hashCode * 31 + [[NSNumber numberWithDouble:self.value] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_stock_valueBuilder() @property (strong) warning_stock_value* resultWarningStockValue; @end @implementation warning_stock_valueBuilder @synthesize resultWarningStockValue; - (instancetype) init { if ((self = [super init])) { self.resultWarningStockValue = [[warning_stock_value alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningStockValue; } - (warning_stock_valueBuilder*) clear { self.resultWarningStockValue = [[warning_stock_value alloc] init]; return self; } - (warning_stock_valueBuilder*) clone { return [warning_stock_value builderWithPrototype:resultWarningStockValue]; } - (warning_stock_value*) defaultInstance { return [warning_stock_value defaultInstance]; } - (warning_stock_value*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_stock_value*) buildPartial { warning_stock_value* returnMe = resultWarningStockValue; self.resultWarningStockValue = nil; return returnMe; } - (warning_stock_valueBuilder*) mergeFrom:(warning_stock_value*) other { if (other == [warning_stock_value defaultInstance]) { return self; } if (other.hasValue) { [self setValue:other.value]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_stock_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_stock_valueBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 9: { [self setValue:[input readDouble]]; break; } } } } - (BOOL) hasValue { return resultWarningStockValue.hasValue; } - (Float64) value { return resultWarningStockValue.value; } - (warning_stock_valueBuilder*) setValue:(Float64) value { resultWarningStockValue.hasValue = YES; resultWarningStockValue.value = value; return self; } - (warning_stock_valueBuilder*) clearValue { resultWarningStockValue.hasValue = NO; resultWarningStockValue.value = 0; return self; } @end @interface warning_record () @property (strong) NSString* code; @property (strong) NSString* name; @property (strong) NSMutableArray * nodeArray; @end @implementation warning_record - (BOOL) hasCode { return !!hasCode_; } - (void) setHasCode:(BOOL) _value_ { hasCode_ = !!_value_; } @synthesize code; - (BOOL) hasName { return !!hasName_; } - (void) setHasName:(BOOL) _value_ { hasName_ = !!_value_; } @synthesize name; @synthesize nodeArray; @dynamic node; - (instancetype) init { if ((self = [super init])) { self.code = @""; self.name = @""; } return self; } static warning_record* defaultwarning_recordInstance = nil; + (void) initialize { if (self == [warning_record class]) { defaultwarning_recordInstance = [[warning_record alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_recordInstance; } - (instancetype) defaultInstance { return defaultwarning_recordInstance; } - (NSArray *)node { return nodeArray; } - (warning_recordwarning_msg_node*)nodeAtIndex:(NSUInteger)index { return [nodeArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasCode) { return NO; } if (!self.hasName) { return NO; } __block BOOL isInitnode = YES; [self.node enumerateObjectsUsingBlock:^(warning_recordwarning_msg_node *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitnode = NO; *stop = YES; } }]; if (!isInitnode) return isInitnode; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasCode) { [output writeString:1 value:self.code]; } if (self.hasName) { [output writeString:2 value:self.name]; } [self.nodeArray enumerateObjectsUsingBlock:^(warning_recordwarning_msg_node *element, NSUInteger idx, BOOL *stop) { [output writeMessage:3 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasCode) { size_ += computeStringSize(1, self.code); } if (self.hasName) { size_ += computeStringSize(2, self.name); } [self.nodeArray enumerateObjectsUsingBlock:^(warning_recordwarning_msg_node *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(3, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_record*) parseFromData:(NSData*) data { return (warning_record*)[[[warning_record builder] mergeFromData:data] build]; } + (warning_record*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_record*)[[[warning_record builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_record*) parseFromInputStream:(NSInputStream*) input { return (warning_record*)[[[warning_record builder] mergeFromInputStream:input] build]; } + (warning_record*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_record*)[[[warning_record builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_record*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_record*)[[[warning_record builder] mergeFromCodedInputStream:input] build]; } + (warning_record*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_record*)[[[warning_record builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_recordBuilder*) builder { return [[warning_recordBuilder alloc] init]; } + (warning_recordBuilder*) builderWithPrototype:(warning_record*) prototype { return [[warning_record builder] mergeFrom:prototype]; } - (warning_recordBuilder*) builder { return [warning_record builder]; } - (warning_recordBuilder*) toBuilder { return [warning_record builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasCode) { [output appendFormat:@"%@%@: %@\n", indent, @"code", self.code]; } if (self.hasName) { [output appendFormat:@"%@%@: %@\n", indent, @"name", self.name]; } [self.nodeArray enumerateObjectsUsingBlock:^(warning_recordwarning_msg_node *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"node"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasCode) { [dictionary setObject: self.code forKey: @"code"]; } if (self.hasName) { [dictionary setObject: self.name forKey: @"name"]; } for (warning_recordwarning_msg_node* element in self.nodeArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"node"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_record class]]) { return NO; } warning_record *otherMessage = other; return self.hasCode == otherMessage.hasCode && (!self.hasCode || [self.code isEqual:otherMessage.code]) && self.hasName == otherMessage.hasName && (!self.hasName || [self.name isEqual:otherMessage.name]) && [self.nodeArray isEqualToArray:otherMessage.nodeArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasCode) { hashCode = hashCode * 31 + [self.code hash]; } if (self.hasName) { hashCode = hashCode * 31 + [self.name hash]; } [self.nodeArray enumerateObjectsUsingBlock:^(warning_recordwarning_msg_node *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_recordwarning_msg_node () @property enum_warning_type warningType; @property (strong) NSData* subMsg; @property UInt32 time; @end @implementation warning_recordwarning_msg_node - (BOOL) hasWarningType { return !!hasWarningType_; } - (void) setHasWarningType:(BOOL) _value_ { hasWarningType_ = !!_value_; } @synthesize warningType; - (BOOL) hasSubMsg { return !!hasSubMsg_; } - (void) setHasSubMsg:(BOOL) _value_ { hasSubMsg_ = !!_value_; } @synthesize subMsg; - (BOOL) hasTime { return !!hasTime_; } - (void) setHasTime:(BOOL) _value_ { hasTime_ = !!_value_; } @synthesize time; - (instancetype) init { if ((self = [super init])) { self.warningType = enum_warning_typeBeginWarningTypeEnum; self.subMsg = [NSData data]; self.time = 0; } return self; } static warning_recordwarning_msg_node* defaultwarning_recordwarning_msg_nodeInstance = nil; + (void) initialize { if (self == [warning_recordwarning_msg_node class]) { defaultwarning_recordwarning_msg_nodeInstance = [[warning_recordwarning_msg_node alloc] init]; } } + (instancetype) defaultInstance { return defaultwarning_recordwarning_msg_nodeInstance; } - (instancetype) defaultInstance { return defaultwarning_recordwarning_msg_nodeInstance; } - (BOOL) isInitialized { if (!self.hasWarningType) { return NO; } if (!self.hasTime) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasWarningType) { [output writeEnum:1 value:self.warningType]; } if (self.hasSubMsg) { [output writeData:2 value:self.subMsg]; } if (self.hasTime) { [output writeUInt32:3 value:self.time]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasWarningType) { size_ += computeEnumSize(1, self.warningType); } if (self.hasSubMsg) { size_ += computeDataSize(2, self.subMsg); } if (self.hasTime) { size_ += computeUInt32Size(3, self.time); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (warning_recordwarning_msg_node*) parseFromData:(NSData*) data { return (warning_recordwarning_msg_node*)[[[warning_recordwarning_msg_node builder] mergeFromData:data] build]; } + (warning_recordwarning_msg_node*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_recordwarning_msg_node*)[[[warning_recordwarning_msg_node builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (warning_recordwarning_msg_node*) parseFromInputStream:(NSInputStream*) input { return (warning_recordwarning_msg_node*)[[[warning_recordwarning_msg_node builder] mergeFromInputStream:input] build]; } + (warning_recordwarning_msg_node*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_recordwarning_msg_node*)[[[warning_recordwarning_msg_node builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_recordwarning_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (warning_recordwarning_msg_node*)[[[warning_recordwarning_msg_node builder] mergeFromCodedInputStream:input] build]; } + (warning_recordwarning_msg_node*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (warning_recordwarning_msg_node*)[[[warning_recordwarning_msg_node builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (warning_recordwarning_msg_nodeBuilder*) builder { return [[warning_recordwarning_msg_nodeBuilder alloc] init]; } + (warning_recordwarning_msg_nodeBuilder*) builderWithPrototype:(warning_recordwarning_msg_node*) prototype { return [[warning_recordwarning_msg_node builder] mergeFrom:prototype]; } - (warning_recordwarning_msg_nodeBuilder*) builder { return [warning_recordwarning_msg_node builder]; } - (warning_recordwarning_msg_nodeBuilder*) toBuilder { return [warning_recordwarning_msg_node builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasWarningType) { [output appendFormat:@"%@%@: %@\n", indent, @"warningType", NSStringFromenum_warning_type(self.warningType)]; } if (self.hasSubMsg) { [output appendFormat:@"%@%@: %@\n", indent, @"subMsg", self.subMsg]; } if (self.hasTime) { [output appendFormat:@"%@%@: %@\n", indent, @"time", [NSNumber numberWithInteger:self.time]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasWarningType) { [dictionary setObject: @(self.warningType) forKey: @"warningType"]; } if (self.hasSubMsg) { [dictionary setObject: self.subMsg forKey: @"subMsg"]; } if (self.hasTime) { [dictionary setObject: [NSNumber numberWithInteger:self.time] forKey: @"time"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[warning_recordwarning_msg_node class]]) { return NO; } warning_recordwarning_msg_node *otherMessage = other; return self.hasWarningType == otherMessage.hasWarningType && (!self.hasWarningType || self.warningType == otherMessage.warningType) && self.hasSubMsg == otherMessage.hasSubMsg && (!self.hasSubMsg || [self.subMsg isEqual:otherMessage.subMsg]) && self.hasTime == otherMessage.hasTime && (!self.hasTime || self.time == otherMessage.time) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasWarningType) { hashCode = hashCode * 31 + self.warningType; } if (self.hasSubMsg) { hashCode = hashCode * 31 + [self.subMsg hash]; } if (self.hasTime) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.time] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface warning_recordwarning_msg_nodeBuilder() @property (strong) warning_recordwarning_msg_node* resultWarningMsgNode; @end @implementation warning_recordwarning_msg_nodeBuilder @synthesize resultWarningMsgNode; - (instancetype) init { if ((self = [super init])) { self.resultWarningMsgNode = [[warning_recordwarning_msg_node alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningMsgNode; } - (warning_recordwarning_msg_nodeBuilder*) clear { self.resultWarningMsgNode = [[warning_recordwarning_msg_node alloc] init]; return self; } - (warning_recordwarning_msg_nodeBuilder*) clone { return [warning_recordwarning_msg_node builderWithPrototype:resultWarningMsgNode]; } - (warning_recordwarning_msg_node*) defaultInstance { return [warning_recordwarning_msg_node defaultInstance]; } - (warning_recordwarning_msg_node*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_recordwarning_msg_node*) buildPartial { warning_recordwarning_msg_node* returnMe = resultWarningMsgNode; self.resultWarningMsgNode = nil; return returnMe; } - (warning_recordwarning_msg_nodeBuilder*) mergeFrom:(warning_recordwarning_msg_node*) other { if (other == [warning_recordwarning_msg_node defaultInstance]) { return self; } if (other.hasWarningType) { [self setWarningType:other.warningType]; } if (other.hasSubMsg) { [self setSubMsg:other.subMsg]; } if (other.hasTime) { [self setTime:other.time]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_recordwarning_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_recordwarning_msg_nodeBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { enum_warning_type value = (enum_warning_type)[input readEnum]; if (enum_warning_typeIsValidValue(value)) { [self setWarningType:value]; } else { [unknownFields mergeVarintField:1 value:value]; } break; } case 18: { [self setSubMsg:[input readData]]; break; } case 24: { [self setTime:[input readUInt32]]; break; } } } } - (BOOL) hasWarningType { return resultWarningMsgNode.hasWarningType; } - (enum_warning_type) warningType { return resultWarningMsgNode.warningType; } - (warning_recordwarning_msg_nodeBuilder*) setWarningType:(enum_warning_type) value { resultWarningMsgNode.hasWarningType = YES; resultWarningMsgNode.warningType = value; return self; } - (warning_recordwarning_msg_nodeBuilder*) clearWarningType { resultWarningMsgNode.hasWarningType = NO; resultWarningMsgNode.warningType = enum_warning_typeBeginWarningTypeEnum; return self; } - (BOOL) hasSubMsg { return resultWarningMsgNode.hasSubMsg; } - (NSData*) subMsg { return resultWarningMsgNode.subMsg; } - (warning_recordwarning_msg_nodeBuilder*) setSubMsg:(NSData*) value { resultWarningMsgNode.hasSubMsg = YES; resultWarningMsgNode.subMsg = value; return self; } - (warning_recordwarning_msg_nodeBuilder*) clearSubMsg { resultWarningMsgNode.hasSubMsg = NO; resultWarningMsgNode.subMsg = [NSData data]; return self; } - (BOOL) hasTime { return resultWarningMsgNode.hasTime; } - (UInt32) time { return resultWarningMsgNode.time; } - (warning_recordwarning_msg_nodeBuilder*) setTime:(UInt32) value { resultWarningMsgNode.hasTime = YES; resultWarningMsgNode.time = value; return self; } - (warning_recordwarning_msg_nodeBuilder*) clearTime { resultWarningMsgNode.hasTime = NO; resultWarningMsgNode.time = 0; return self; } @end @interface warning_recordBuilder() @property (strong) warning_record* resultWarningRecord; @end @implementation warning_recordBuilder @synthesize resultWarningRecord; - (instancetype) init { if ((self = [super init])) { self.resultWarningRecord = [[warning_record alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultWarningRecord; } - (warning_recordBuilder*) clear { self.resultWarningRecord = [[warning_record alloc] init]; return self; } - (warning_recordBuilder*) clone { return [warning_record builderWithPrototype:resultWarningRecord]; } - (warning_record*) defaultInstance { return [warning_record defaultInstance]; } - (warning_record*) build { [self checkInitialized]; return [self buildPartial]; } - (warning_record*) buildPartial { warning_record* returnMe = resultWarningRecord; self.resultWarningRecord = nil; return returnMe; } - (warning_recordBuilder*) mergeFrom:(warning_record*) other { if (other == [warning_record defaultInstance]) { return self; } if (other.hasCode) { [self setCode:other.code]; } if (other.hasName) { [self setName:other.name]; } if (other.nodeArray.count > 0) { if (resultWarningRecord.nodeArray == nil) { resultWarningRecord.nodeArray = [[NSMutableArray alloc] initWithArray:other.nodeArray]; } else { [resultWarningRecord.nodeArray addObjectsFromArray:other.nodeArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (warning_recordBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (warning_recordBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 10: { [self setCode:[input readString]]; break; } case 18: { [self setName:[input readString]]; break; } case 26: { warning_recordwarning_msg_nodeBuilder* subBuilder = [warning_recordwarning_msg_node builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addNode:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasCode { return resultWarningRecord.hasCode; } - (NSString*) code { return resultWarningRecord.code; } - (warning_recordBuilder*) setCode:(NSString*) value { resultWarningRecord.hasCode = YES; resultWarningRecord.code = value; return self; } - (warning_recordBuilder*) clearCode { resultWarningRecord.hasCode = NO; resultWarningRecord.code = @""; return self; } - (BOOL) hasName { return resultWarningRecord.hasName; } - (NSString*) name { return resultWarningRecord.name; } - (warning_recordBuilder*) setName:(NSString*) value { resultWarningRecord.hasName = YES; resultWarningRecord.name = value; return self; } - (warning_recordBuilder*) clearName { resultWarningRecord.hasName = NO; resultWarningRecord.name = @""; return self; } - (NSMutableArray *)node { return resultWarningRecord.nodeArray; } - (warning_recordwarning_msg_node*)nodeAtIndex:(NSUInteger)index { return [resultWarningRecord nodeAtIndex:index]; } - (warning_recordBuilder *)addNode:(warning_recordwarning_msg_node*)value { if (resultWarningRecord.nodeArray == nil) { resultWarningRecord.nodeArray = [[NSMutableArray alloc]init]; } [resultWarningRecord.nodeArray addObject:value]; return self; } - (warning_recordBuilder *)setNodeArray:(NSArray *)array { resultWarningRecord.nodeArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (warning_recordBuilder *)clearNode { resultWarningRecord.nodeArray = nil; return self; } @end @interface get_warning_record_from_uid_msg () @property UInt32 uid; @end @implementation get_warning_record_from_uid_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; - (instancetype) init { if ((self = [super init])) { self.uid = 0; } return self; } static get_warning_record_from_uid_msg* defaultget_warning_record_from_uid_msgInstance = nil; + (void) initialize { if (self == [get_warning_record_from_uid_msg class]) { defaultget_warning_record_from_uid_msgInstance = [[get_warning_record_from_uid_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultget_warning_record_from_uid_msgInstance; } - (instancetype) defaultInstance { return defaultget_warning_record_from_uid_msgInstance; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (get_warning_record_from_uid_msg*) parseFromData:(NSData*) data { return (get_warning_record_from_uid_msg*)[[[get_warning_record_from_uid_msg builder] mergeFromData:data] build]; } + (get_warning_record_from_uid_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (get_warning_record_from_uid_msg*)[[[get_warning_record_from_uid_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (get_warning_record_from_uid_msg*) parseFromInputStream:(NSInputStream*) input { return (get_warning_record_from_uid_msg*)[[[get_warning_record_from_uid_msg builder] mergeFromInputStream:input] build]; } + (get_warning_record_from_uid_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (get_warning_record_from_uid_msg*)[[[get_warning_record_from_uid_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (get_warning_record_from_uid_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (get_warning_record_from_uid_msg*)[[[get_warning_record_from_uid_msg builder] mergeFromCodedInputStream:input] build]; } + (get_warning_record_from_uid_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (get_warning_record_from_uid_msg*)[[[get_warning_record_from_uid_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (get_warning_record_from_uid_msgBuilder*) builder { return [[get_warning_record_from_uid_msgBuilder alloc] init]; } + (get_warning_record_from_uid_msgBuilder*) builderWithPrototype:(get_warning_record_from_uid_msg*) prototype { return [[get_warning_record_from_uid_msg builder] mergeFrom:prototype]; } - (get_warning_record_from_uid_msgBuilder*) builder { return [get_warning_record_from_uid_msg builder]; } - (get_warning_record_from_uid_msgBuilder*) toBuilder { return [get_warning_record_from_uid_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[get_warning_record_from_uid_msg class]]) { return NO; } get_warning_record_from_uid_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface get_warning_record_from_uid_msgBuilder() @property (strong) get_warning_record_from_uid_msg* resultGetWarningRecordFromUidMsg; @end @implementation get_warning_record_from_uid_msgBuilder @synthesize resultGetWarningRecordFromUidMsg; - (instancetype) init { if ((self = [super init])) { self.resultGetWarningRecordFromUidMsg = [[get_warning_record_from_uid_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultGetWarningRecordFromUidMsg; } - (get_warning_record_from_uid_msgBuilder*) clear { self.resultGetWarningRecordFromUidMsg = [[get_warning_record_from_uid_msg alloc] init]; return self; } - (get_warning_record_from_uid_msgBuilder*) clone { return [get_warning_record_from_uid_msg builderWithPrototype:resultGetWarningRecordFromUidMsg]; } - (get_warning_record_from_uid_msg*) defaultInstance { return [get_warning_record_from_uid_msg defaultInstance]; } - (get_warning_record_from_uid_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (get_warning_record_from_uid_msg*) buildPartial { get_warning_record_from_uid_msg* returnMe = resultGetWarningRecordFromUidMsg; self.resultGetWarningRecordFromUidMsg = nil; return returnMe; } - (get_warning_record_from_uid_msgBuilder*) mergeFrom:(get_warning_record_from_uid_msg*) other { if (other == [get_warning_record_from_uid_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } [self mergeUnknownFields:other.unknownFields]; return self; } - (get_warning_record_from_uid_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (get_warning_record_from_uid_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } } } } - (BOOL) hasUid { return resultGetWarningRecordFromUidMsg.hasUid; } - (UInt32) uid { return resultGetWarningRecordFromUidMsg.uid; } - (get_warning_record_from_uid_msgBuilder*) setUid:(UInt32) value { resultGetWarningRecordFromUidMsg.hasUid = YES; resultGetWarningRecordFromUidMsg.uid = value; return self; } - (get_warning_record_from_uid_msgBuilder*) clearUid { resultGetWarningRecordFromUidMsg.hasUid = NO; resultGetWarningRecordFromUidMsg.uid = 0; return self; } @end @interface get_warning_record_from_uid_result_msg () @property UInt32 uid; @property (strong) NSMutableArray * recordArray; @end @implementation get_warning_record_from_uid_result_msg - (BOOL) hasUid { return !!hasUid_; } - (void) setHasUid:(BOOL) _value_ { hasUid_ = !!_value_; } @synthesize uid; @synthesize recordArray; @dynamic record; - (instancetype) init { if ((self = [super init])) { self.uid = 0; } return self; } static get_warning_record_from_uid_result_msg* defaultget_warning_record_from_uid_result_msgInstance = nil; + (void) initialize { if (self == [get_warning_record_from_uid_result_msg class]) { defaultget_warning_record_from_uid_result_msgInstance = [[get_warning_record_from_uid_result_msg alloc] init]; } } + (instancetype) defaultInstance { return defaultget_warning_record_from_uid_result_msgInstance; } - (instancetype) defaultInstance { return defaultget_warning_record_from_uid_result_msgInstance; } - (NSArray *)record { return recordArray; } - (warning_record*)recordAtIndex:(NSUInteger)index { return [recordArray objectAtIndex:index]; } - (BOOL) isInitialized { if (!self.hasUid) { return NO; } __block BOOL isInitrecord = YES; [self.record enumerateObjectsUsingBlock:^(warning_record *element, NSUInteger idx, BOOL *stop) { if (!element.isInitialized) { isInitrecord = NO; *stop = YES; } }]; if (!isInitrecord) return isInitrecord; return YES; } - (void) writeToCodedOutputStream:(PBCodedOutputStream*) output { if (self.hasUid) { [output writeUInt32:1 value:self.uid]; } [self.recordArray enumerateObjectsUsingBlock:^(warning_record *element, NSUInteger idx, BOOL *stop) { [output writeMessage:2 value:element]; }]; [self.unknownFields writeToCodedOutputStream:output]; } - (SInt32) serializedSize { __block SInt32 size_ = memoizedSerializedSize; if (size_ != -1) { return size_; } size_ = 0; if (self.hasUid) { size_ += computeUInt32Size(1, self.uid); } [self.recordArray enumerateObjectsUsingBlock:^(warning_record *element, NSUInteger idx, BOOL *stop) { size_ += computeMessageSize(2, element); }]; size_ += self.unknownFields.serializedSize; memoizedSerializedSize = size_; return size_; } + (get_warning_record_from_uid_result_msg*) parseFromData:(NSData*) data { return (get_warning_record_from_uid_result_msg*)[[[get_warning_record_from_uid_result_msg builder] mergeFromData:data] build]; } + (get_warning_record_from_uid_result_msg*) parseFromData:(NSData*) data extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (get_warning_record_from_uid_result_msg*)[[[get_warning_record_from_uid_result_msg builder] mergeFromData:data extensionRegistry:extensionRegistry] build]; } + (get_warning_record_from_uid_result_msg*) parseFromInputStream:(NSInputStream*) input { return (get_warning_record_from_uid_result_msg*)[[[get_warning_record_from_uid_result_msg builder] mergeFromInputStream:input] build]; } + (get_warning_record_from_uid_result_msg*) parseFromInputStream:(NSInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (get_warning_record_from_uid_result_msg*)[[[get_warning_record_from_uid_result_msg builder] mergeFromInputStream:input extensionRegistry:extensionRegistry] build]; } + (get_warning_record_from_uid_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input { return (get_warning_record_from_uid_result_msg*)[[[get_warning_record_from_uid_result_msg builder] mergeFromCodedInputStream:input] build]; } + (get_warning_record_from_uid_result_msg*) parseFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { return (get_warning_record_from_uid_result_msg*)[[[get_warning_record_from_uid_result_msg builder] mergeFromCodedInputStream:input extensionRegistry:extensionRegistry] build]; } + (get_warning_record_from_uid_result_msgBuilder*) builder { return [[get_warning_record_from_uid_result_msgBuilder alloc] init]; } + (get_warning_record_from_uid_result_msgBuilder*) builderWithPrototype:(get_warning_record_from_uid_result_msg*) prototype { return [[get_warning_record_from_uid_result_msg builder] mergeFrom:prototype]; } - (get_warning_record_from_uid_result_msgBuilder*) builder { return [get_warning_record_from_uid_result_msg builder]; } - (get_warning_record_from_uid_result_msgBuilder*) toBuilder { return [get_warning_record_from_uid_result_msg builderWithPrototype:self]; } - (void) writeDescriptionTo:(NSMutableString*) output withIndent:(NSString*) indent { if (self.hasUid) { [output appendFormat:@"%@%@: %@\n", indent, @"uid", [NSNumber numberWithInteger:self.uid]]; } [self.recordArray enumerateObjectsUsingBlock:^(warning_record *element, NSUInteger idx, BOOL *stop) { [output appendFormat:@"%@%@ {\n", indent, @"record"]; [element writeDescriptionTo:output withIndent:[NSString stringWithFormat:@"%@ ", indent]]; [output appendFormat:@"%@}\n", indent]; }]; [self.unknownFields writeDescriptionTo:output withIndent:indent]; } - (void) storeInDictionary:(NSMutableDictionary *)dictionary { if (self.hasUid) { [dictionary setObject: [NSNumber numberWithInteger:self.uid] forKey: @"uid"]; } for (warning_record* element in self.recordArray) { NSMutableDictionary *elementDictionary = [NSMutableDictionary dictionary]; [element storeInDictionary:elementDictionary]; [dictionary setObject:[NSDictionary dictionaryWithDictionary:elementDictionary] forKey:@"record"]; } [self.unknownFields storeInDictionary:dictionary]; } - (BOOL) isEqual:(id)other { if (other == self) { return YES; } if (![other isKindOfClass:[get_warning_record_from_uid_result_msg class]]) { return NO; } get_warning_record_from_uid_result_msg *otherMessage = other; return self.hasUid == otherMessage.hasUid && (!self.hasUid || self.uid == otherMessage.uid) && [self.recordArray isEqualToArray:otherMessage.recordArray] && (self.unknownFields == otherMessage.unknownFields || (self.unknownFields != nil && [self.unknownFields isEqual:otherMessage.unknownFields])); } - (NSUInteger) hash { __block NSUInteger hashCode = 7; if (self.hasUid) { hashCode = hashCode * 31 + [[NSNumber numberWithInteger:self.uid] hash]; } [self.recordArray enumerateObjectsUsingBlock:^(warning_record *element, NSUInteger idx, BOOL *stop) { hashCode = hashCode * 31 + [element hash]; }]; hashCode = hashCode * 31 + [self.unknownFields hash]; return hashCode; } @end @interface get_warning_record_from_uid_result_msgBuilder() @property (strong) get_warning_record_from_uid_result_msg* resultGetWarningRecordFromUidResultMsg; @end @implementation get_warning_record_from_uid_result_msgBuilder @synthesize resultGetWarningRecordFromUidResultMsg; - (instancetype) init { if ((self = [super init])) { self.resultGetWarningRecordFromUidResultMsg = [[get_warning_record_from_uid_result_msg alloc] init]; } return self; } - (PBGeneratedMessage*) internalGetResult { return resultGetWarningRecordFromUidResultMsg; } - (get_warning_record_from_uid_result_msgBuilder*) clear { self.resultGetWarningRecordFromUidResultMsg = [[get_warning_record_from_uid_result_msg alloc] init]; return self; } - (get_warning_record_from_uid_result_msgBuilder*) clone { return [get_warning_record_from_uid_result_msg builderWithPrototype:resultGetWarningRecordFromUidResultMsg]; } - (get_warning_record_from_uid_result_msg*) defaultInstance { return [get_warning_record_from_uid_result_msg defaultInstance]; } - (get_warning_record_from_uid_result_msg*) build { [self checkInitialized]; return [self buildPartial]; } - (get_warning_record_from_uid_result_msg*) buildPartial { get_warning_record_from_uid_result_msg* returnMe = resultGetWarningRecordFromUidResultMsg; self.resultGetWarningRecordFromUidResultMsg = nil; return returnMe; } - (get_warning_record_from_uid_result_msgBuilder*) mergeFrom:(get_warning_record_from_uid_result_msg*) other { if (other == [get_warning_record_from_uid_result_msg defaultInstance]) { return self; } if (other.hasUid) { [self setUid:other.uid]; } if (other.recordArray.count > 0) { if (resultGetWarningRecordFromUidResultMsg.recordArray == nil) { resultGetWarningRecordFromUidResultMsg.recordArray = [[NSMutableArray alloc] initWithArray:other.recordArray]; } else { [resultGetWarningRecordFromUidResultMsg.recordArray addObjectsFromArray:other.recordArray]; } } [self mergeUnknownFields:other.unknownFields]; return self; } - (get_warning_record_from_uid_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input { return [self mergeFromCodedInputStream:input extensionRegistry:[PBExtensionRegistry emptyRegistry]]; } - (get_warning_record_from_uid_result_msgBuilder*) mergeFromCodedInputStream:(PBCodedInputStream*) input extensionRegistry:(PBExtensionRegistry*) extensionRegistry { PBUnknownFieldSetBuilder* unknownFields = [PBUnknownFieldSet builderWithUnknownFields:self.unknownFields]; while (YES) { SInt32 tag = [input readTag]; switch (tag) { case 0: [self setUnknownFields:[unknownFields build]]; return self; default: { if (![self parseUnknownField:input unknownFields:unknownFields extensionRegistry:extensionRegistry tag:tag]) { [self setUnknownFields:[unknownFields build]]; return self; } break; } case 8: { [self setUid:[input readUInt32]]; break; } case 18: { warning_recordBuilder* subBuilder = [warning_record builder]; [input readMessage:subBuilder extensionRegistry:extensionRegistry]; [self addRecord:[subBuilder buildPartial]]; break; } } } } - (BOOL) hasUid { return resultGetWarningRecordFromUidResultMsg.hasUid; } - (UInt32) uid { return resultGetWarningRecordFromUidResultMsg.uid; } - (get_warning_record_from_uid_result_msgBuilder*) setUid:(UInt32) value { resultGetWarningRecordFromUidResultMsg.hasUid = YES; resultGetWarningRecordFromUidResultMsg.uid = value; return self; } - (get_warning_record_from_uid_result_msgBuilder*) clearUid { resultGetWarningRecordFromUidResultMsg.hasUid = NO; resultGetWarningRecordFromUidResultMsg.uid = 0; return self; } - (NSMutableArray *)record { return resultGetWarningRecordFromUidResultMsg.recordArray; } - (warning_record*)recordAtIndex:(NSUInteger)index { return [resultGetWarningRecordFromUidResultMsg recordAtIndex:index]; } - (get_warning_record_from_uid_result_msgBuilder *)addRecord:(warning_record*)value { if (resultGetWarningRecordFromUidResultMsg.recordArray == nil) { resultGetWarningRecordFromUidResultMsg.recordArray = [[NSMutableArray alloc]init]; } [resultGetWarningRecordFromUidResultMsg.recordArray addObject:value]; return self; } - (get_warning_record_from_uid_result_msgBuilder *)setRecordArray:(NSArray *)array { resultGetWarningRecordFromUidResultMsg.recordArray = [[NSMutableArray alloc]initWithArray:array]; return self; } - (get_warning_record_from_uid_result_msgBuilder *)clearRecord { resultGetWarningRecordFromUidResultMsg.recordArray = nil; return self; } @end // @@protoc_insertion_point(global_scope) ================================================ FILE: GCDAsyncSocket.xcodeproj/project.pbxproj ================================================ // !$*UTF8*$! { archiveVersion = 1; classes = { }; objectVersion = 46; objects = { /* Begin PBXBuildFile section */ 64DA9EDD1D2B4B4E0006AEE5 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EDC1D2B4B4E0006AEE5 /* main.m */; }; 64DA9EE01D2B4B4E0006AEE5 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EDF1D2B4B4E0006AEE5 /* AppDelegate.m */; }; 64DA9EE31D2B4B4E0006AEE5 /* ViewController.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EE21D2B4B4E0006AEE5 /* ViewController.m */; }; 64DA9EE61D2B4B4E0006AEE5 /* Main.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 64DA9EE41D2B4B4E0006AEE5 /* Main.storyboard */; }; 64DA9EE81D2B4B4E0006AEE5 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 64DA9EE71D2B4B4E0006AEE5 /* Assets.xcassets */; }; 64DA9EEB1D2B4B4E0006AEE5 /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 64DA9EE91D2B4B4E0006AEE5 /* LaunchScreen.storyboard */; }; 64DA9EF61D2B4B850006AEE5 /* SocketManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EF31D2B4B850006AEE5 /* SocketManager.m */; }; 64DA9EF71D2B4B850006AEE5 /* TCPAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EF51D2B4B850006AEE5 /* TCPAPI.m */; }; 64DA9F011D2B4BA20006AEE5 /* AsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EFA1D2B4BA20006AEE5 /* AsyncSocket.m */; }; 64DA9F021D2B4BA20006AEE5 /* AsyncUdpSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EFC1D2B4BA20006AEE5 /* AsyncUdpSocket.m */; }; 64DA9F031D2B4BA20006AEE5 /* GCDAsyncSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9EFE1D2B4BA20006AEE5 /* GCDAsyncSocket.m */; }; 64DA9F041D2B4BA20006AEE5 /* GCDAsyncUdpSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F001D2B4BA20006AEE5 /* GCDAsyncUdpSocket.m */; }; 64DA9F181D2B4FDE0006AEE5 /* Auth.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F071D2B4FDE0006AEE5 /* Auth.pb.m */; }; 64DA9F1A1D2B4FDE0006AEE5 /* Common.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F0A1D2B4FDE0006AEE5 /* Common.pb.m */; }; 64DA9F1C1D2B4FDE0006AEE5 /* Index.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F0D1D2B4FDE0006AEE5 /* Index.pb.m */; }; 64DA9F1E1D2B4FDE0006AEE5 /* Investment.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F101D2B4FDE0006AEE5 /* Investment.pb.m */; }; 64DA9F201D2B4FDE0006AEE5 /* Report.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F131D2B4FDE0006AEE5 /* Report.pb.m */; }; 64DA9F221D2B4FDE0006AEE5 /* Warning.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F161D2B4FDE0006AEE5 /* Warning.pb.m */; }; 64DA9F571D2B50450006AEE5 /* AbstractMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F261D2B50450006AEE5 /* AbstractMessage.m */; }; 64DA9F581D2B50450006AEE5 /* AbstractMessageBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F281D2B50450006AEE5 /* AbstractMessageBuilder.m */; }; 64DA9F591D2B50450006AEE5 /* CodedInputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F2B1D2B50450006AEE5 /* CodedInputStream.m */; }; 64DA9F5A1D2B50450006AEE5 /* CodedOutputStream.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F2D1D2B50450006AEE5 /* CodedOutputStream.m */; }; 64DA9F5B1D2B50450006AEE5 /* ConcreteExtensionField.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F2F1D2B50450006AEE5 /* ConcreteExtensionField.m */; }; 64DA9F5C1D2B50450006AEE5 /* Descriptor.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F311D2B50450006AEE5 /* Descriptor.pb.m */; }; 64DA9F5D1D2B50450006AEE5 /* ExtendableMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F331D2B50450006AEE5 /* ExtendableMessage.m */; }; 64DA9F5E1D2B50450006AEE5 /* ExtendableMessageBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F351D2B50450006AEE5 /* ExtendableMessageBuilder.m */; }; 64DA9F5F1D2B50450006AEE5 /* ExtensionRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F381D2B50450006AEE5 /* ExtensionRegistry.m */; }; 64DA9F601D2B50450006AEE5 /* Field.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F3A1D2B50450006AEE5 /* Field.m */; }; 64DA9F611D2B50450006AEE5 /* GeneratedMessage.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F3D1D2B50450006AEE5 /* GeneratedMessage.m */; }; 64DA9F621D2B50450006AEE5 /* GeneratedMessageBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F3F1D2B50450006AEE5 /* GeneratedMessageBuilder.m */; }; 64DA9F631D2B50450006AEE5 /* MutableExtensionRegistry.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F431D2B50450006AEE5 /* MutableExtensionRegistry.m */; }; 64DA9F641D2B50450006AEE5 /* MutableField.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F451D2B50450006AEE5 /* MutableField.m */; }; 64DA9F651D2B50450006AEE5 /* ObjectivecDescriptor.pb.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F471D2B50450006AEE5 /* ObjectivecDescriptor.pb.m */; }; 64DA9F661D2B50450006AEE5 /* PBArray.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F491D2B50450006AEE5 /* PBArray.m */; }; 64DA9F671D2B50450006AEE5 /* RingBuffer.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F4C1D2B50450006AEE5 /* RingBuffer.m */; }; 64DA9F681D2B50450006AEE5 /* TextFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F4E1D2B50450006AEE5 /* TextFormat.m */; }; 64DA9F691D2B50450006AEE5 /* UnknownFieldSet.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F501D2B50450006AEE5 /* UnknownFieldSet.m */; }; 64DA9F6A1D2B50450006AEE5 /* UnknownFieldSetBuilder.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F521D2B50450006AEE5 /* UnknownFieldSetBuilder.m */; }; 64DA9F6B1D2B50450006AEE5 /* Utilities.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F541D2B50450006AEE5 /* Utilities.m */; }; 64DA9F6C1D2B50450006AEE5 /* WireFormat.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9F561D2B50450006AEE5 /* WireFormat.m */; }; 64DA9FA51D2CFD3E0006AEE5 /* NetWorkManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 64DA9FA41D2CFD3E0006AEE5 /* NetWorkManager.m */; }; 64F28D081D2F32E7005961F1 /* AFHTTPSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28CFC1D2F32E7005961F1 /* AFHTTPSessionManager.m */; }; 64F28D091D2F32E7005961F1 /* AFNetworkReachabilityManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28CFF1D2F32E7005961F1 /* AFNetworkReachabilityManager.m */; }; 64F28D0A1D2F32E7005961F1 /* AFSecurityPolicy.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28D011D2F32E7005961F1 /* AFSecurityPolicy.m */; }; 64F28D0B1D2F32E7005961F1 /* AFURLRequestSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28D031D2F32E7005961F1 /* AFURLRequestSerialization.m */; }; 64F28D0C1D2F32E7005961F1 /* AFURLResponseSerialization.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28D051D2F32E7005961F1 /* AFURLResponseSerialization.m */; }; 64F28D0D1D2F32E7005961F1 /* AFURLSessionManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28D071D2F32E7005961F1 /* AFURLSessionManager.m */; }; 64F28D101D2F336B005961F1 /* SpeedDectectManager.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28D0F1D2F336B005961F1 /* SpeedDectectManager.m */; }; 64F28D131D2F3483005961F1 /* ServerURLModel.m in Sources */ = {isa = PBXBuildFile; fileRef = 64F28D121D2F3483005961F1 /* ServerURLModel.m */; }; /* End PBXBuildFile section */ /* Begin PBXFileReference section */ 64DA9ED81D2B4B4E0006AEE5 /* GCDAsyncSocket.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = GCDAsyncSocket.app; sourceTree = BUILT_PRODUCTS_DIR; }; 64DA9EDC1D2B4B4E0006AEE5 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = ""; }; 64DA9EDE1D2B4B4E0006AEE5 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = ""; }; 64DA9EDF1D2B4B4E0006AEE5 /* AppDelegate.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = ""; }; 64DA9EE11D2B4B4E0006AEE5 /* ViewController.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ViewController.h; sourceTree = ""; }; 64DA9EE21D2B4B4E0006AEE5 /* ViewController.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = ViewController.m; sourceTree = ""; }; 64DA9EE51D2B4B4E0006AEE5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/Main.storyboard; sourceTree = ""; }; 64DA9EE71D2B4B4E0006AEE5 /* Assets.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; path = Assets.xcassets; sourceTree = ""; }; 64DA9EEA1D2B4B4E0006AEE5 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.storyboard; name = Base; path = Base.lproj/LaunchScreen.storyboard; sourceTree = ""; }; 64DA9EEC1D2B4B4E0006AEE5 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = ""; }; 64DA9EF21D2B4B850006AEE5 /* SocketManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SocketManager.h; sourceTree = ""; }; 64DA9EF31D2B4B850006AEE5 /* SocketManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SocketManager.m; sourceTree = ""; }; 64DA9EF41D2B4B850006AEE5 /* TCPAPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TCPAPI.h; sourceTree = ""; }; 64DA9EF51D2B4B850006AEE5 /* TCPAPI.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TCPAPI.m; sourceTree = ""; }; 64DA9EF91D2B4BA20006AEE5 /* AsyncSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncSocket.h; sourceTree = ""; }; 64DA9EFA1D2B4BA20006AEE5 /* AsyncSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AsyncSocket.m; sourceTree = ""; }; 64DA9EFB1D2B4BA20006AEE5 /* AsyncUdpSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AsyncUdpSocket.h; sourceTree = ""; }; 64DA9EFC1D2B4BA20006AEE5 /* AsyncUdpSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AsyncUdpSocket.m; sourceTree = ""; }; 64DA9EFD1D2B4BA20006AEE5 /* GCDAsyncSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDAsyncSocket.h; sourceTree = ""; }; 64DA9EFE1D2B4BA20006AEE5 /* GCDAsyncSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCDAsyncSocket.m; sourceTree = ""; }; 64DA9EFF1D2B4BA20006AEE5 /* GCDAsyncUdpSocket.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GCDAsyncUdpSocket.h; sourceTree = ""; }; 64DA9F001D2B4BA20006AEE5 /* GCDAsyncUdpSocket.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GCDAsyncUdpSocket.m; sourceTree = ""; }; 64DA9F061D2B4FDE0006AEE5 /* Auth.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Auth.pb.h; sourceTree = ""; }; 64DA9F071D2B4FDE0006AEE5 /* Auth.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Auth.pb.m; sourceTree = ""; }; 64DA9F091D2B4FDE0006AEE5 /* Common.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Common.pb.h; sourceTree = ""; }; 64DA9F0A1D2B4FDE0006AEE5 /* Common.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Common.pb.m; sourceTree = ""; }; 64DA9F0C1D2B4FDE0006AEE5 /* Index.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Index.pb.h; sourceTree = ""; }; 64DA9F0D1D2B4FDE0006AEE5 /* Index.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Index.pb.m; sourceTree = ""; }; 64DA9F0F1D2B4FDE0006AEE5 /* Investment.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Investment.pb.h; sourceTree = ""; }; 64DA9F101D2B4FDE0006AEE5 /* Investment.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Investment.pb.m; sourceTree = ""; }; 64DA9F121D2B4FDE0006AEE5 /* Report.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Report.pb.h; sourceTree = ""; }; 64DA9F131D2B4FDE0006AEE5 /* Report.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Report.pb.m; sourceTree = ""; }; 64DA9F151D2B4FDE0006AEE5 /* Warning.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Warning.pb.h; sourceTree = ""; }; 64DA9F161D2B4FDE0006AEE5 /* Warning.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Warning.pb.m; sourceTree = ""; }; 64DA9F251D2B50450006AEE5 /* AbstractMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractMessage.h; sourceTree = ""; }; 64DA9F261D2B50450006AEE5 /* AbstractMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AbstractMessage.m; sourceTree = ""; }; 64DA9F271D2B50450006AEE5 /* AbstractMessageBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AbstractMessageBuilder.h; sourceTree = ""; }; 64DA9F281D2B50450006AEE5 /* AbstractMessageBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AbstractMessageBuilder.m; sourceTree = ""; }; 64DA9F291D2B50450006AEE5 /* Bootstrap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Bootstrap.h; sourceTree = ""; }; 64DA9F2A1D2B50450006AEE5 /* CodedInputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodedInputStream.h; sourceTree = ""; }; 64DA9F2B1D2B50450006AEE5 /* CodedInputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CodedInputStream.m; sourceTree = ""; }; 64DA9F2C1D2B50450006AEE5 /* CodedOutputStream.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CodedOutputStream.h; sourceTree = ""; }; 64DA9F2D1D2B50450006AEE5 /* CodedOutputStream.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CodedOutputStream.m; sourceTree = ""; }; 64DA9F2E1D2B50450006AEE5 /* ConcreteExtensionField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConcreteExtensionField.h; sourceTree = ""; }; 64DA9F2F1D2B50450006AEE5 /* ConcreteExtensionField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ConcreteExtensionField.m; sourceTree = ""; }; 64DA9F301D2B50450006AEE5 /* Descriptor.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Descriptor.pb.h; sourceTree = ""; }; 64DA9F311D2B50450006AEE5 /* Descriptor.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Descriptor.pb.m; sourceTree = ""; }; 64DA9F321D2B50450006AEE5 /* ExtendableMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtendableMessage.h; sourceTree = ""; }; 64DA9F331D2B50450006AEE5 /* ExtendableMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtendableMessage.m; sourceTree = ""; }; 64DA9F341D2B50450006AEE5 /* ExtendableMessageBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtendableMessageBuilder.h; sourceTree = ""; }; 64DA9F351D2B50450006AEE5 /* ExtendableMessageBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtendableMessageBuilder.m; sourceTree = ""; }; 64DA9F361D2B50450006AEE5 /* ExtensionField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionField.h; sourceTree = ""; }; 64DA9F371D2B50450006AEE5 /* ExtensionRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExtensionRegistry.h; sourceTree = ""; }; 64DA9F381D2B50450006AEE5 /* ExtensionRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ExtensionRegistry.m; sourceTree = ""; }; 64DA9F391D2B50450006AEE5 /* Field.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Field.h; sourceTree = ""; }; 64DA9F3A1D2B50450006AEE5 /* Field.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Field.m; sourceTree = ""; }; 64DA9F3B1D2B50450006AEE5 /* ForwardDeclarations.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ForwardDeclarations.h; sourceTree = ""; }; 64DA9F3C1D2B50450006AEE5 /* GeneratedMessage.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedMessage.h; sourceTree = ""; }; 64DA9F3D1D2B50450006AEE5 /* GeneratedMessage.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedMessage.m; sourceTree = ""; }; 64DA9F3E1D2B50450006AEE5 /* GeneratedMessageBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = GeneratedMessageBuilder.h; sourceTree = ""; }; 64DA9F3F1D2B50450006AEE5 /* GeneratedMessageBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = GeneratedMessageBuilder.m; sourceTree = ""; }; 64DA9F401D2B50450006AEE5 /* Message.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Message.h; sourceTree = ""; }; 64DA9F411D2B50450006AEE5 /* MessageBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MessageBuilder.h; sourceTree = ""; }; 64DA9F421D2B50450006AEE5 /* MutableExtensionRegistry.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableExtensionRegistry.h; sourceTree = ""; }; 64DA9F431D2B50450006AEE5 /* MutableExtensionRegistry.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MutableExtensionRegistry.m; sourceTree = ""; }; 64DA9F441D2B50450006AEE5 /* MutableField.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MutableField.h; sourceTree = ""; }; 64DA9F451D2B50450006AEE5 /* MutableField.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = MutableField.m; sourceTree = ""; }; 64DA9F461D2B50450006AEE5 /* ObjectivecDescriptor.pb.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ObjectivecDescriptor.pb.h; sourceTree = ""; }; 64DA9F471D2B50450006AEE5 /* ObjectivecDescriptor.pb.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ObjectivecDescriptor.pb.m; sourceTree = ""; }; 64DA9F481D2B50450006AEE5 /* PBArray.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = PBArray.h; sourceTree = ""; }; 64DA9F491D2B50450006AEE5 /* PBArray.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = PBArray.m; sourceTree = ""; }; 64DA9F4A1D2B50450006AEE5 /* ProtocolBuffers.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ProtocolBuffers.h; sourceTree = ""; }; 64DA9F4B1D2B50450006AEE5 /* RingBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RingBuffer.h; sourceTree = ""; }; 64DA9F4C1D2B50450006AEE5 /* RingBuffer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RingBuffer.m; sourceTree = ""; }; 64DA9F4D1D2B50450006AEE5 /* TextFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TextFormat.h; sourceTree = ""; }; 64DA9F4E1D2B50450006AEE5 /* TextFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TextFormat.m; sourceTree = ""; }; 64DA9F4F1D2B50450006AEE5 /* UnknownFieldSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnknownFieldSet.h; sourceTree = ""; }; 64DA9F501D2B50450006AEE5 /* UnknownFieldSet.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnknownFieldSet.m; sourceTree = ""; }; 64DA9F511D2B50450006AEE5 /* UnknownFieldSetBuilder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnknownFieldSetBuilder.h; sourceTree = ""; }; 64DA9F521D2B50450006AEE5 /* UnknownFieldSetBuilder.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = UnknownFieldSetBuilder.m; sourceTree = ""; }; 64DA9F531D2B50450006AEE5 /* Utilities.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Utilities.h; sourceTree = ""; }; 64DA9F541D2B50450006AEE5 /* Utilities.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Utilities.m; sourceTree = ""; }; 64DA9F551D2B50450006AEE5 /* WireFormat.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WireFormat.h; sourceTree = ""; }; 64DA9F561D2B50450006AEE5 /* WireFormat.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = WireFormat.m; sourceTree = ""; }; 64DA9FA31D2CFD3E0006AEE5 /* NetWorkManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NetWorkManager.h; sourceTree = ""; }; 64DA9FA41D2CFD3E0006AEE5 /* NetWorkManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = NetWorkManager.m; sourceTree = ""; }; 64F28CFB1D2F32E7005961F1 /* AFHTTPSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFHTTPSessionManager.h; sourceTree = ""; }; 64F28CFC1D2F32E7005961F1 /* AFHTTPSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFHTTPSessionManager.m; sourceTree = ""; }; 64F28CFD1D2F32E7005961F1 /* AFNetworking.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworking.h; sourceTree = ""; }; 64F28CFE1D2F32E7005961F1 /* AFNetworkReachabilityManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFNetworkReachabilityManager.h; sourceTree = ""; }; 64F28CFF1D2F32E7005961F1 /* AFNetworkReachabilityManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFNetworkReachabilityManager.m; sourceTree = ""; }; 64F28D001D2F32E7005961F1 /* AFSecurityPolicy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFSecurityPolicy.h; sourceTree = ""; }; 64F28D011D2F32E7005961F1 /* AFSecurityPolicy.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFSecurityPolicy.m; sourceTree = ""; }; 64F28D021D2F32E7005961F1 /* AFURLRequestSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLRequestSerialization.h; sourceTree = ""; }; 64F28D031D2F32E7005961F1 /* AFURLRequestSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLRequestSerialization.m; sourceTree = ""; }; 64F28D041D2F32E7005961F1 /* AFURLResponseSerialization.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLResponseSerialization.h; sourceTree = ""; }; 64F28D051D2F32E7005961F1 /* AFURLResponseSerialization.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLResponseSerialization.m; sourceTree = ""; }; 64F28D061D2F32E7005961F1 /* AFURLSessionManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AFURLSessionManager.h; sourceTree = ""; }; 64F28D071D2F32E7005961F1 /* AFURLSessionManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AFURLSessionManager.m; sourceTree = ""; }; 64F28D0E1D2F336B005961F1 /* SpeedDectectManager.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SpeedDectectManager.h; sourceTree = ""; }; 64F28D0F1D2F336B005961F1 /* SpeedDectectManager.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SpeedDectectManager.m; sourceTree = ""; }; 64F28D111D2F3483005961F1 /* ServerURLModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ServerURLModel.h; sourceTree = ""; }; 64F28D121D2F3483005961F1 /* ServerURLModel.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ServerURLModel.m; sourceTree = ""; }; /* End PBXFileReference section */ /* Begin PBXFrameworksBuildPhase section */ 64DA9ED51D2B4B4E0006AEE5 /* Frameworks */ = { isa = PBXFrameworksBuildPhase; buildActionMask = 2147483647; files = ( ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXFrameworksBuildPhase section */ /* Begin PBXGroup section */ 64DA9ECF1D2B4B4E0006AEE5 = { isa = PBXGroup; children = ( 64DA9EDA1D2B4B4E0006AEE5 /* GCDAsyncSocket */, 64DA9ED91D2B4B4E0006AEE5 /* Products */, ); sourceTree = ""; }; 64DA9ED91D2B4B4E0006AEE5 /* Products */ = { isa = PBXGroup; children = ( 64DA9ED81D2B4B4E0006AEE5 /* GCDAsyncSocket.app */, ); name = Products; sourceTree = ""; }; 64DA9EDA1D2B4B4E0006AEE5 /* GCDAsyncSocket */ = { isa = PBXGroup; children = ( 64DA9EDE1D2B4B4E0006AEE5 /* AppDelegate.h */, 64DA9EDF1D2B4B4E0006AEE5 /* AppDelegate.m */, 64DA9EE11D2B4B4E0006AEE5 /* ViewController.h */, 64DA9EE21D2B4B4E0006AEE5 /* ViewController.m */, 64DA9EF41D2B4B850006AEE5 /* TCPAPI.h */, 64DA9EF51D2B4B850006AEE5 /* TCPAPI.m */, 64DA9EF21D2B4B850006AEE5 /* SocketManager.h */, 64DA9EF31D2B4B850006AEE5 /* SocketManager.m */, 64DA9FA31D2CFD3E0006AEE5 /* NetWorkManager.h */, 64DA9FA41D2CFD3E0006AEE5 /* NetWorkManager.m */, 64F28D0E1D2F336B005961F1 /* SpeedDectectManager.h */, 64F28D0F1D2F336B005961F1 /* SpeedDectectManager.m */, 64F28D111D2F3483005961F1 /* ServerURLModel.h */, 64F28D121D2F3483005961F1 /* ServerURLModel.m */, 64DA9EE41D2B4B4E0006AEE5 /* Main.storyboard */, 64DA9EE71D2B4B4E0006AEE5 /* Assets.xcassets */, 64DA9F051D2B4FDE0006AEE5 /* pbbuf */, 64DA9FA21D2CF05B0006AEE5 /* Library */, 64DA9EE91D2B4B4E0006AEE5 /* LaunchScreen.storyboard */, 64DA9EEC1D2B4B4E0006AEE5 /* Info.plist */, 64DA9EDB1D2B4B4E0006AEE5 /* Supporting Files */, ); path = GCDAsyncSocket; sourceTree = ""; }; 64DA9EDB1D2B4B4E0006AEE5 /* Supporting Files */ = { isa = PBXGroup; children = ( 64DA9EDC1D2B4B4E0006AEE5 /* main.m */, ); name = "Supporting Files"; sourceTree = ""; }; 64DA9EF81D2B4BA20006AEE5 /* CocoaAsyncSocket */ = { isa = PBXGroup; children = ( 64DA9EF91D2B4BA20006AEE5 /* AsyncSocket.h */, 64DA9EFA1D2B4BA20006AEE5 /* AsyncSocket.m */, 64DA9EFB1D2B4BA20006AEE5 /* AsyncUdpSocket.h */, 64DA9EFC1D2B4BA20006AEE5 /* AsyncUdpSocket.m */, 64DA9EFD1D2B4BA20006AEE5 /* GCDAsyncSocket.h */, 64DA9EFE1D2B4BA20006AEE5 /* GCDAsyncSocket.m */, 64DA9EFF1D2B4BA20006AEE5 /* GCDAsyncUdpSocket.h */, 64DA9F001D2B4BA20006AEE5 /* GCDAsyncUdpSocket.m */, ); path = CocoaAsyncSocket; sourceTree = ""; }; 64DA9F051D2B4FDE0006AEE5 /* pbbuf */ = { isa = PBXGroup; children = ( 64DA9F061D2B4FDE0006AEE5 /* Auth.pb.h */, 64DA9F071D2B4FDE0006AEE5 /* Auth.pb.m */, 64DA9F091D2B4FDE0006AEE5 /* Common.pb.h */, 64DA9F0A1D2B4FDE0006AEE5 /* Common.pb.m */, 64DA9F0C1D2B4FDE0006AEE5 /* Index.pb.h */, 64DA9F0D1D2B4FDE0006AEE5 /* Index.pb.m */, 64DA9F0F1D2B4FDE0006AEE5 /* Investment.pb.h */, 64DA9F101D2B4FDE0006AEE5 /* Investment.pb.m */, 64DA9F121D2B4FDE0006AEE5 /* Report.pb.h */, 64DA9F131D2B4FDE0006AEE5 /* Report.pb.m */, 64DA9F151D2B4FDE0006AEE5 /* Warning.pb.h */, 64DA9F161D2B4FDE0006AEE5 /* Warning.pb.m */, ); name = pbbuf; path = src; sourceTree = ""; }; 64DA9F241D2B50450006AEE5 /* ProtobufBuffer */ = { isa = PBXGroup; children = ( 64DA9F251D2B50450006AEE5 /* AbstractMessage.h */, 64DA9F261D2B50450006AEE5 /* AbstractMessage.m */, 64DA9F271D2B50450006AEE5 /* AbstractMessageBuilder.h */, 64DA9F281D2B50450006AEE5 /* AbstractMessageBuilder.m */, 64DA9F291D2B50450006AEE5 /* Bootstrap.h */, 64DA9F2A1D2B50450006AEE5 /* CodedInputStream.h */, 64DA9F2B1D2B50450006AEE5 /* CodedInputStream.m */, 64DA9F2C1D2B50450006AEE5 /* CodedOutputStream.h */, 64DA9F2D1D2B50450006AEE5 /* CodedOutputStream.m */, 64DA9F2E1D2B50450006AEE5 /* ConcreteExtensionField.h */, 64DA9F2F1D2B50450006AEE5 /* ConcreteExtensionField.m */, 64DA9F301D2B50450006AEE5 /* Descriptor.pb.h */, 64DA9F311D2B50450006AEE5 /* Descriptor.pb.m */, 64DA9F321D2B50450006AEE5 /* ExtendableMessage.h */, 64DA9F331D2B50450006AEE5 /* ExtendableMessage.m */, 64DA9F341D2B50450006AEE5 /* ExtendableMessageBuilder.h */, 64DA9F351D2B50450006AEE5 /* ExtendableMessageBuilder.m */, 64DA9F361D2B50450006AEE5 /* ExtensionField.h */, 64DA9F371D2B50450006AEE5 /* ExtensionRegistry.h */, 64DA9F381D2B50450006AEE5 /* ExtensionRegistry.m */, 64DA9F391D2B50450006AEE5 /* Field.h */, 64DA9F3A1D2B50450006AEE5 /* Field.m */, 64DA9F3B1D2B50450006AEE5 /* ForwardDeclarations.h */, 64DA9F3C1D2B50450006AEE5 /* GeneratedMessage.h */, 64DA9F3D1D2B50450006AEE5 /* GeneratedMessage.m */, 64DA9F3E1D2B50450006AEE5 /* GeneratedMessageBuilder.h */, 64DA9F3F1D2B50450006AEE5 /* GeneratedMessageBuilder.m */, 64DA9F401D2B50450006AEE5 /* Message.h */, 64DA9F411D2B50450006AEE5 /* MessageBuilder.h */, 64DA9F421D2B50450006AEE5 /* MutableExtensionRegistry.h */, 64DA9F431D2B50450006AEE5 /* MutableExtensionRegistry.m */, 64DA9F441D2B50450006AEE5 /* MutableField.h */, 64DA9F451D2B50450006AEE5 /* MutableField.m */, 64DA9F461D2B50450006AEE5 /* ObjectivecDescriptor.pb.h */, 64DA9F471D2B50450006AEE5 /* ObjectivecDescriptor.pb.m */, 64DA9F481D2B50450006AEE5 /* PBArray.h */, 64DA9F491D2B50450006AEE5 /* PBArray.m */, 64DA9F4A1D2B50450006AEE5 /* ProtocolBuffers.h */, 64DA9F4B1D2B50450006AEE5 /* RingBuffer.h */, 64DA9F4C1D2B50450006AEE5 /* RingBuffer.m */, 64DA9F4D1D2B50450006AEE5 /* TextFormat.h */, 64DA9F4E1D2B50450006AEE5 /* TextFormat.m */, 64DA9F4F1D2B50450006AEE5 /* UnknownFieldSet.h */, 64DA9F501D2B50450006AEE5 /* UnknownFieldSet.m */, 64DA9F511D2B50450006AEE5 /* UnknownFieldSetBuilder.h */, 64DA9F521D2B50450006AEE5 /* UnknownFieldSetBuilder.m */, 64DA9F531D2B50450006AEE5 /* Utilities.h */, 64DA9F541D2B50450006AEE5 /* Utilities.m */, 64DA9F551D2B50450006AEE5 /* WireFormat.h */, 64DA9F561D2B50450006AEE5 /* WireFormat.m */, ); path = ProtobufBuffer; sourceTree = ""; }; 64DA9FA21D2CF05B0006AEE5 /* Library */ = { isa = PBXGroup; children = ( 64F28CFA1D2F32E7005961F1 /* AFNetworking */, 64DA9F241D2B50450006AEE5 /* ProtobufBuffer */, 64DA9EF81D2B4BA20006AEE5 /* CocoaAsyncSocket */, ); name = Library; sourceTree = ""; }; 64F28CFA1D2F32E7005961F1 /* AFNetworking */ = { isa = PBXGroup; children = ( 64F28CFB1D2F32E7005961F1 /* AFHTTPSessionManager.h */, 64F28CFC1D2F32E7005961F1 /* AFHTTPSessionManager.m */, 64F28CFD1D2F32E7005961F1 /* AFNetworking.h */, 64F28CFE1D2F32E7005961F1 /* AFNetworkReachabilityManager.h */, 64F28CFF1D2F32E7005961F1 /* AFNetworkReachabilityManager.m */, 64F28D001D2F32E7005961F1 /* AFSecurityPolicy.h */, 64F28D011D2F32E7005961F1 /* AFSecurityPolicy.m */, 64F28D021D2F32E7005961F1 /* AFURLRequestSerialization.h */, 64F28D031D2F32E7005961F1 /* AFURLRequestSerialization.m */, 64F28D041D2F32E7005961F1 /* AFURLResponseSerialization.h */, 64F28D051D2F32E7005961F1 /* AFURLResponseSerialization.m */, 64F28D061D2F32E7005961F1 /* AFURLSessionManager.h */, 64F28D071D2F32E7005961F1 /* AFURLSessionManager.m */, ); path = AFNetworking; sourceTree = ""; }; /* End PBXGroup section */ /* Begin PBXNativeTarget section */ 64DA9ED71D2B4B4E0006AEE5 /* GCDAsyncSocket */ = { isa = PBXNativeTarget; buildConfigurationList = 64DA9EEF1D2B4B4E0006AEE5 /* Build configuration list for PBXNativeTarget "GCDAsyncSocket" */; buildPhases = ( 64DA9ED41D2B4B4E0006AEE5 /* Sources */, 64DA9ED51D2B4B4E0006AEE5 /* Frameworks */, 64DA9ED61D2B4B4E0006AEE5 /* Resources */, ); buildRules = ( ); dependencies = ( ); name = GCDAsyncSocket; productName = GCDAsyncSocket; productReference = 64DA9ED81D2B4B4E0006AEE5 /* GCDAsyncSocket.app */; productType = "com.apple.product-type.application"; }; /* End PBXNativeTarget section */ /* Begin PBXProject section */ 64DA9ED01D2B4B4E0006AEE5 /* Project object */ = { isa = PBXProject; attributes = { LastUpgradeCheck = 0730; ORGANIZATIONNAME = caokun; TargetAttributes = { 64DA9ED71D2B4B4E0006AEE5 = { CreatedOnToolsVersion = 7.3; }; }; }; buildConfigurationList = 64DA9ED31D2B4B4E0006AEE5 /* Build configuration list for PBXProject "GCDAsyncSocket" */; compatibilityVersion = "Xcode 3.2"; developmentRegion = English; hasScannedForEncodings = 0; knownRegions = ( en, Base, ); mainGroup = 64DA9ECF1D2B4B4E0006AEE5; productRefGroup = 64DA9ED91D2B4B4E0006AEE5 /* Products */; projectDirPath = ""; projectRoot = ""; targets = ( 64DA9ED71D2B4B4E0006AEE5 /* GCDAsyncSocket */, ); }; /* End PBXProject section */ /* Begin PBXResourcesBuildPhase section */ 64DA9ED61D2B4B4E0006AEE5 /* Resources */ = { isa = PBXResourcesBuildPhase; buildActionMask = 2147483647; files = ( 64DA9EEB1D2B4B4E0006AEE5 /* LaunchScreen.storyboard in Resources */, 64DA9EE81D2B4B4E0006AEE5 /* Assets.xcassets in Resources */, 64DA9EE61D2B4B4E0006AEE5 /* Main.storyboard in Resources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXResourcesBuildPhase section */ /* Begin PBXSourcesBuildPhase section */ 64DA9ED41D2B4B4E0006AEE5 /* Sources */ = { isa = PBXSourcesBuildPhase; buildActionMask = 2147483647; files = ( 64F28D101D2F336B005961F1 /* SpeedDectectManager.m in Sources */, 64F28D0D1D2F32E7005961F1 /* AFURLSessionManager.m in Sources */, 64DA9F031D2B4BA20006AEE5 /* GCDAsyncSocket.m in Sources */, 64DA9F1C1D2B4FDE0006AEE5 /* Index.pb.m in Sources */, 64DA9F691D2B50450006AEE5 /* UnknownFieldSet.m in Sources */, 64DA9F041D2B4BA20006AEE5 /* GCDAsyncUdpSocket.m in Sources */, 64DA9EF71D2B4B850006AEE5 /* TCPAPI.m in Sources */, 64DA9F641D2B50450006AEE5 /* MutableField.m in Sources */, 64DA9F5C1D2B50450006AEE5 /* Descriptor.pb.m in Sources */, 64F28D081D2F32E7005961F1 /* AFHTTPSessionManager.m in Sources */, 64DA9F631D2B50450006AEE5 /* MutableExtensionRegistry.m in Sources */, 64DA9F5D1D2B50450006AEE5 /* ExtendableMessage.m in Sources */, 64DA9F201D2B4FDE0006AEE5 /* Report.pb.m in Sources */, 64DA9F571D2B50450006AEE5 /* AbstractMessage.m in Sources */, 64F28D131D2F3483005961F1 /* ServerURLModel.m in Sources */, 64DA9F5A1D2B50450006AEE5 /* CodedOutputStream.m in Sources */, 64DA9F601D2B50450006AEE5 /* Field.m in Sources */, 64DA9EE31D2B4B4E0006AEE5 /* ViewController.m in Sources */, 64DA9F651D2B50450006AEE5 /* ObjectivecDescriptor.pb.m in Sources */, 64DA9EE01D2B4B4E0006AEE5 /* AppDelegate.m in Sources */, 64DA9F6C1D2B50450006AEE5 /* WireFormat.m in Sources */, 64DA9F011D2B4BA20006AEE5 /* AsyncSocket.m in Sources */, 64DA9F611D2B50450006AEE5 /* GeneratedMessage.m in Sources */, 64DA9F671D2B50450006AEE5 /* RingBuffer.m in Sources */, 64DA9F181D2B4FDE0006AEE5 /* Auth.pb.m in Sources */, 64DA9FA51D2CFD3E0006AEE5 /* NetWorkManager.m in Sources */, 64DA9F5B1D2B50450006AEE5 /* ConcreteExtensionField.m in Sources */, 64F28D0B1D2F32E7005961F1 /* AFURLRequestSerialization.m in Sources */, 64DA9F591D2B50450006AEE5 /* CodedInputStream.m in Sources */, 64F28D0C1D2F32E7005961F1 /* AFURLResponseSerialization.m in Sources */, 64DA9F6A1D2B50450006AEE5 /* UnknownFieldSetBuilder.m in Sources */, 64DA9F1E1D2B4FDE0006AEE5 /* Investment.pb.m in Sources */, 64F28D0A1D2F32E7005961F1 /* AFSecurityPolicy.m in Sources */, 64DA9F221D2B4FDE0006AEE5 /* Warning.pb.m in Sources */, 64DA9F661D2B50450006AEE5 /* PBArray.m in Sources */, 64DA9F581D2B50450006AEE5 /* AbstractMessageBuilder.m in Sources */, 64DA9EF61D2B4B850006AEE5 /* SocketManager.m in Sources */, 64DA9F1A1D2B4FDE0006AEE5 /* Common.pb.m in Sources */, 64F28D091D2F32E7005961F1 /* AFNetworkReachabilityManager.m in Sources */, 64DA9F5F1D2B50450006AEE5 /* ExtensionRegistry.m in Sources */, 64DA9F6B1D2B50450006AEE5 /* Utilities.m in Sources */, 64DA9EDD1D2B4B4E0006AEE5 /* main.m in Sources */, 64DA9F621D2B50450006AEE5 /* GeneratedMessageBuilder.m in Sources */, 64DA9F5E1D2B50450006AEE5 /* ExtendableMessageBuilder.m in Sources */, 64DA9F021D2B4BA20006AEE5 /* AsyncUdpSocket.m in Sources */, 64DA9F681D2B50450006AEE5 /* TextFormat.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; /* End PBXSourcesBuildPhase section */ /* Begin PBXVariantGroup section */ 64DA9EE41D2B4B4E0006AEE5 /* Main.storyboard */ = { isa = PBXVariantGroup; children = ( 64DA9EE51D2B4B4E0006AEE5 /* Base */, ); name = Main.storyboard; sourceTree = ""; }; 64DA9EE91D2B4B4E0006AEE5 /* LaunchScreen.storyboard */ = { isa = PBXVariantGroup; children = ( 64DA9EEA1D2B4B4E0006AEE5 /* Base */, ); name = LaunchScreen.storyboard; sourceTree = ""; }; /* End PBXVariantGroup section */ /* Begin XCBuildConfiguration section */ 64DA9EED1D2B4B4E0006AEE5 /* Debug */ = { isa = XCBuildConfiguration; 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_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 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 = 9.3; MTL_ENABLE_DEBUG_INFO = YES; ONLY_ACTIVE_ARCH = YES; SDKROOT = iphoneos; }; name = Debug; }; 64DA9EEE1D2B4B4E0006AEE5 /* Release */ = { isa = XCBuildConfiguration; 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_INT_CONVERSION = YES; CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 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-with-dsym"; ENABLE_NS_ASSERTIONS = NO; ENABLE_STRICT_OBJC_MSGSEND = YES; GCC_C_LANGUAGE_STANDARD = gnu99; GCC_NO_COMMON_BLOCKS = YES; 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 = 9.3; MTL_ENABLE_DEBUG_INFO = NO; SDKROOT = iphoneos; VALIDATE_PRODUCT = YES; }; name = Release; }; 64DA9EF01D2B4B4E0006AEE5 /* Debug */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = GCDAsyncSocket/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = caokun.GCDAsyncSocket; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "GCDAsyncSocket/GCDAsyncSocket-Bridging-Header.h"; SWIFT_OPTIMIZATION_LEVEL = "-Onone"; }; name = Debug; }; 64DA9EF11D2B4B4E0006AEE5 /* Release */ = { isa = XCBuildConfiguration; buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CLANG_ENABLE_MODULES = YES; INFOPLIST_FILE = GCDAsyncSocket/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 8.0; LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks"; PRODUCT_BUNDLE_IDENTIFIER = caokun.GCDAsyncSocket; PRODUCT_NAME = "$(TARGET_NAME)"; SWIFT_OBJC_BRIDGING_HEADER = "GCDAsyncSocket/GCDAsyncSocket-Bridging-Header.h"; }; name = Release; }; /* End XCBuildConfiguration section */ /* Begin XCConfigurationList section */ 64DA9ED31D2B4B4E0006AEE5 /* Build configuration list for PBXProject "GCDAsyncSocket" */ = { isa = XCConfigurationList; buildConfigurations = ( 64DA9EED1D2B4B4E0006AEE5 /* Debug */, 64DA9EEE1D2B4B4E0006AEE5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; 64DA9EEF1D2B4B4E0006AEE5 /* Build configuration list for PBXNativeTarget "GCDAsyncSocket" */ = { isa = XCConfigurationList; buildConfigurations = ( 64DA9EF01D2B4B4E0006AEE5 /* Debug */, 64DA9EF11D2B4B4E0006AEE5 /* Release */, ); defaultConfigurationIsVisible = 0; defaultConfigurationName = Release; }; /* End XCConfigurationList section */ }; rootObject = 64DA9ED01D2B4B4E0006AEE5 /* Project object */; } ================================================ FILE: GCDAsyncSocket.xcodeproj/project.xcworkspace/contents.xcworkspacedata ================================================ ================================================ FILE: README.md ================================================ # AsyncSocket 我在工作中用GCDAsyncSocket封装的一套TCP网络服务框架,用在公司的股票产品上 股票场景有实时性,所以通讯协议必须走socket,股票数据量大,传输协议用谷歌的ProtoBuffer,序列化速度快,数据压缩比高,省流量 因为是公司的产品用的,我删掉了相关的账号和公司内部的ip,所以能看到程序实现思路,而不能运行了 文件说明 ViewController.h 测试的界面 TCPAPI.h 这个类负责tcp请求封装,心跳机制,tcp打包拆包,自动重登录,数据序列化 SocketManager.h 这个类负责socket状态管理,掉线重连 SpeedDectectManager.h 这个类负责客户端的负载均衡,测速服务 NetWorkManager.h 判断网络状态 我把有状态的socket封装成了对应用层来说是无状态的,就像使用HTTP请求那样简单,它能够处理自动重连,自动TCP层的重登录,自动测速和负载均衡,包括一些缓存,能适应网络频繁断开连上的情况,具体细节写在注释中了,有兴趣的可以看看 整个TCP网络服务层逻辑,图片可能太小,建议从代码库中下载到本地查看 ![](https://github.com/hehe520/AsyncSocket/blob/master/TCP%E7%BD%91%E7%BB%9C%E6%9C%8D%E5%8A%A1%E5%B1%82%E9%80%BB%E8%BE%91.png) 如果您发现程序有问题,欢迎反馈,谢谢,我的QQ:657668857,或者邮箱657668857@qq.com