<commit_before>//
//  IKConnectionDelegate.h
//  IKConnectionDelegate
//
//  Created by <NAME> on 11.08.10.
//  Copyright 2010. All rights reserved.

#import <Foundation/Foundation.h>


/*
 @param loadedDataLength Length of data that is already loaded.
 @param maximumLength The expected length of data. 
 @discussion For download progress can return NSURLResponseUnknownLength if the length cannot be determined. 
 For upload progress maximumLength may change during the upload if the request needs to be retransmitted due to a lost connection or an authentication challenge from the server.
 */
typedef void (^IKConnectionProgressBlock)(NSUInteger loadedDataLength, NSUInteger maximumLength);

/*
 @param data Downloaded data.
 @param response The URL response for the connection's request.
 @param error An error object containing details of why the connection failed to load the request successfully. nil if no error is occured.
 */
typedef void (^IKConnectionCompletionBlock)(NSData *data, NSURLResponse *response, NSError *error);

@interface IKConnectionDelegate : NSObject {
    IKConnectionProgressBlock downloadProgress;
    IKConnectionProgressBlock uploadProgress;
    IKConnectionCompletionBlock completion;
    dispatch_queue_t queue;
    NSMutableData *data;
    NSURLResponse *response;
    BOOL isFinished;
@private
    NSURLConnection *_connection;
}

/*
 @abstract Executes a given block after connection downloads data incrementally.
 */
@property (copy, readonly) IKConnectionProgressBlock downloadProgress;
/*
 @abstract Executes a given block after connection uploads data incrementally.
 */
@property (copy, readonly) IKConnectionProgressBlock uploadProgress;
/*
 @abstract Executes a given block after connection has finished loading or failed to load its request successfully.
 */
@property (copy, readonly) IKConnectionCompletionBlock completion;
/*
 @abstract Data that connection is loaded.
 */
@property (retain, readonly) NSMutableData *data;
/*
 @abstract Response for the connection.
 */
@property (retain, readonly) NSURLResponse *response;
/*
 @abstract Returns a Boolean value indicating whether the operation is done downloading/uploading. Observable.
 */
@property (assign, readonly) BOOL isFinished;

/*
 @abstract Creates and returns an autoreleased IKConnectionDelegate object.
 @discussion Copies given blocks.
 */
+ (IKConnectionDelegate *)connectionDelegateWithDownloadProgress:(IKConnectionProgressBlock)aDownloadProgress
                                                  uploadProgress:(IKConnectionProgressBlock)anUploadProgress
                                                      completion:(IKConnectionCompletionBlock)aCompletion;

/*
 @abstract Designated Initializer.
 @discussion Copies given blocks.
 */
- (IKConnectionDelegate *)initWithDownloadProgress:(IKConnectionProgressBlock)aDownloadProgress
                                    uploadProgress:(IKConnectionProgressBlock)anUploadProgress
                                        completion:(IKConnectionCompletionBlock)aCompletion;

@end<commit_msg>add more commits<commit_after>//
//  IKConnectionDelegate.h
//  IKConnectionDelegate
//
//  Created by <NAME> on 11.08.10.
//  Copyright 2010. All rights reserved.

#import <Foundation/Foundation.h>


/*
 @param loadedDataLength Length of data that is already loaded.
 @param maximumLength The expected length of data. 
 @discussion For download progress can return NSURLResponseUnknownLength if the length cannot be determined. 
 For upload progress maximumLength may change during the upload if the request needs to be retransmitted due to a lost connection or an authentication challenge from the server.
 */
typedef void (^IKConnectionProgressBlock)(NSUInteger loadedDataLength, NSUInteger maximumLength);

/*
 @param data Downloaded data.
 @param response The URL response for the connection's request.
 @param error An error object containing details of why the connection failed to load the request successfully. nil if no error is occured.
 */
typedef void (^IKConnectionCompletionBlock)(NSData *data, NSURLResponse *response, NSError *error);

@interface IKConnectionDelegate : NSObject {
    IKConnectionProgressBlock downloadProgress;
    IKConnectionProgressBlock uploadProgress;
    IKConnectionCompletionBlock completion;
    dispatch_queue_t queue;
    NSMutableData *data;
    NSURLResponse *response;
    BOOL isFinished;
@private
    NSURLConnection *_connection;
}

/*
 @abstract Executes a given block after connection downloads data incrementally.
 */
@property (copy, readonly) IKConnectionProgressBlock downloadProgress;
/*
 @abstract Executes a given block after connection uploads data incrementally.
 */
@property (copy, readonly) IKConnectionProgressBlock uploadProgress;
/*
 @abstract Executes a given block after connection has finished loading or failed to load its request successfully.
 */
@property (copy, readonly) IKConnectionCompletionBlock completion;
/*
 @abstract Downloaded data.
 */
@property (retain, readonly) NSMutableData *data;
/*
 @abstract Response for the connection.
 */
@property (retain, readonly) NSURLResponse *response;
/*
 @abstract Returns a Boolean value indicating whether the operation is done downloading/uploading. Observable.
 */
@property (assign, readonly) BOOL isFinished;

/*
 @abstract Creates and returns an autoreleased IKConnectionDelegate object.
 @param aDownloadProgress Executes a given block after connection downloads data incrementally.
 @param anUploadProgress Executes a given block after connection uploads data incrementally.
 @param aCompletion Executes a given block after connection has finished loading or failed to load its request successfully.
 @discussion Copies given blocks.
 */
+ (IKConnectionDelegate *)connectionDelegateWithDownloadProgress:(IKConnectionProgressBlock)aDownloadProgress
                                                  uploadProgress:(IKConnectionProgressBlock)anUploadProgress
                                                      completion:(IKConnectionCompletionBlock)aCompletion;

/*
 @abstract Designated Initializer.
 @param aDownloadProgress Executes a given block after connection downloads data incrementally.
 @param anUploadProgress Executes a given block after connection uploads data incrementally.
 @param aCompletion Executes a given block after connection has finished loading or failed to load its request successfully.
 @discussion Copies given blocks.
 */
- (IKConnectionDelegate *)initWithDownloadProgress:(IKConnectionProgressBlock)aDownloadProgress
                                    uploadProgress:(IKConnectionProgressBlock)anUploadProgress
                                        completion:(IKConnectionCompletionBlock)aCompletion;

@end
{'fraction_non_alphanumeric': 0.06114574057583853, 'fraction_numerical': 0.0029682398337785693, 'mean_word_length': 4.175883256528418, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 37, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6712262', 'n_tokens_mistral': 1582, 'n_tokens_neox': 1476, 'n_words': 602}