Permalink
Browse files

Add some old sources to fix compile

  • Loading branch information...
1 parent 4998521 commit 04a8789e2aec7cc284bf0d7b8d1dd986fbd17bd3 @qwzybug qwzybug committed Oct 16, 2010
@@ -0,0 +1,76 @@
+//
+// CCompletionTicket.h
+// TouchCode
+//
+// Created by Jonathan Wight on 8/22/08.
+// Copyright 2008 toxicsoftware.com. All rights reserved.
+//
+// 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 <Foundation/Foundation.h>
+
+@protocol CCompletionTicketDelegate;
+@class CPointerArray;
+
+@interface CCompletionTicket : NSObject {
+ NSString *identifier;
+ CPointerArray *delegatePointers;
+ id userInfo;
+ CCompletionTicket *subTicket;
+}
+
+@property (readonly, nonatomic, retain) NSString *identifier;
+@property (readonly, nonatomic, retain) NSArray *delegates;
+@property (readonly, nonatomic, retain) id userInfo;
+@property (readonly, nonatomic, retain) CCompletionTicket *subTicket;
+
++ (CCompletionTicket *)completionTicketWithIdentifier:(NSString *)inIdentifier delegate:(id <CCompletionTicketDelegate>)inDelegate userInfo:(id)inUserInfo;
++ (CCompletionTicket *)completionTicketWithIdentifier:(NSString *)inIdentifier delegate:(id <CCompletionTicketDelegate>)inDelegate userInfo:(id)inUserInfo subTicket:(CCompletionTicket *)inSubTicket;
+
+- (id)initWithIdentifier:(NSString *)inIdentifier delegates:(NSArray *)inDelegates userInfo:(id)inUserInfo subTicket:(CCompletionTicket *)inSubTicket;
+- (id)initWithIdentifier:(NSString *)inIdentifier delegate:(id <CCompletionTicketDelegate>)inDelegate userInfo:(id)inUserInfo subTicket:(CCompletionTicket *)inSubTicket;
+
+- (void)addDelegate:(id <CCompletionTicketDelegate>)inDelegate;
+
+- (void)invalidate;
+
+- (void)didBeginForTarget:(id)inTarget;
+- (void)didCompleteForTarget:(id)inTarget result:(id)inResult;
+- (void)didFailForTarget:(id)inTarget error:(NSError *)inError;
+- (void)didCancelForTarget:(id)inTarget;
+
+@end
+
+#pragma mark -
+
+@protocol CCompletionTicketDelegate <NSObject>
+
+@required
+- (void)completionTicket:(CCompletionTicket *)inCompletionTicket didCompleteForTarget:(id)inTarget result:(id)inResult;
+
+@optional
+- (void)completionTicket:(CCompletionTicket *)inCompletionTicket didBeginForTarget:(id)inTarget;
+- (void)completionTicket:(CCompletionTicket *)inCompletionTicket didFailForTarget:(id)inTarget error:(NSError *)inError;
+- (void)completionTicket:(CCompletionTicket *)inCompletionTicket didCancelForTarget:(id)inTarget;
+
+@end
@@ -0,0 +1,155 @@
+//
+// CCompletionTicket.m
+// TouchCode
+//
+// Created by Jonathan Wight on 8/22/08.
+// Copyright 2008 toxicsoftware.com. All rights reserved.
+//
+// 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 "CCompletionTicket.h"
+
+#import "CPointerArray.h"
+
+@interface CCompletionTicket ()
+@property (readwrite, nonatomic, retain) NSString *identifier;
+@property (readwrite, nonatomic, retain) CPointerArray *delegatePointers;
+@property (readwrite, nonatomic, retain) id userInfo;
+@property (readwrite, nonatomic, retain) CCompletionTicket *subTicket;
+@end
+
+@implementation CCompletionTicket
+
+@synthesize identifier;
+@dynamic delegates;
+@synthesize delegatePointers;
+@synthesize userInfo;
+@synthesize subTicket;
+
++ (CCompletionTicket *)completionTicketWithIdentifier:(NSString *)inIdentifier delegate:(id <CCompletionTicketDelegate>)inDelegate userInfo:(id)inUserInfo
+{
+return([[[self alloc] initWithIdentifier:inIdentifier delegate:inDelegate userInfo:inUserInfo subTicket:NULL] autorelease]);
+}
+
++ (CCompletionTicket *)completionTicketWithIdentifier:(NSString *)inIdentifier delegate:(id <CCompletionTicketDelegate>)inDelegate userInfo:(id)inUserInfo subTicket:(CCompletionTicket *)inSubTicket;
+{
+return([[[self alloc] initWithIdentifier:inIdentifier delegate:inDelegate userInfo:inUserInfo subTicket:inSubTicket] autorelease]);
+}
+
+- (id)initWithIdentifier:(NSString *)inIdentifier delegates:(NSArray *)inDelegates userInfo:(id)inUserInfo subTicket:(CCompletionTicket *)inSubTicket
+{
+if ((self = [super init]) != NULL)
+ {
+ self.identifier = inIdentifier;
+ self.delegatePointers = [[[CPointerArray alloc] init] autorelease];
+ for (id theDelegate in inDelegates)
+ {
+ NSAssert([theDelegate conformsToProtocol:@protocol(CCompletionTicketDelegate)], @"Delegate does not conform to CCompletionTicketDelegate protocol");
+ [self.delegatePointers addPointer:theDelegate];
+ }
+ self.userInfo = inUserInfo;
+ self.subTicket = inSubTicket;
+ }
+return(self);
+}
+
+- (id)initWithIdentifier:(NSString *)inIdentifier delegate:(id <CCompletionTicketDelegate>)inDelegate userInfo:(id)inUserInfo subTicket:(CCompletionTicket *)inSubTicket
+{
+if ((self = [self initWithIdentifier:inIdentifier delegates:[NSArray arrayWithObject:inDelegate] userInfo:inUserInfo subTicket:inSubTicket]) != NULL)
+ {
+
+ }
+return(self);
+}
+
+- (void)dealloc
+{
+self.identifier = NULL;
+self.delegatePointers = NULL;
+self.userInfo = NULL;
+self.subTicket = NULL;
+//
+[super dealloc];
+}
+
+#pragma mark -
+
+- (NSArray *)delegates
+{
+NSMutableArray *theArray = [NSMutableArray arrayWithCapacity:self.delegatePointers.count];
+for (id <CCompletionTicketDelegate> theDelegate in self.delegatePointers)
+ {
+ [theArray addObject:theDelegate];
+ }
+return(theArray);
+}
+
+#pragma mark -
+
+- (void)addDelegate:(id <CCompletionTicketDelegate>)inDelegate;
+{
+[self.delegatePointers addPointer:inDelegate];
+}
+
+- (void)invalidate
+{
+self.delegatePointers = NULL;
+}
+
+- (void)didBeginForTarget:(id)inTarget
+{
+for (id <CCompletionTicketDelegate> theDelegate in self.delegatePointers)
+ {
+ if ([theDelegate respondsToSelector:@selector(completionTicket:didBeginForTarget:)])
+ [theDelegate completionTicket:self didBeginForTarget:inTarget];
+ }
+}
+
+- (void)didCompleteForTarget:(id)inTarget result:(id)inResult
+{
+for (id <CCompletionTicketDelegate> theDelegate in self.delegatePointers)
+ {
+ if ([theDelegate respondsToSelector:@selector(completionTicket:didCompleteForTarget:result:)])
+ [theDelegate completionTicket:self didCompleteForTarget:inTarget result:inResult];
+ }
+}
+
+- (void)didFailForTarget:(id)inTarget error:(NSError *)inError
+{
+for (id <CCompletionTicketDelegate> theDelegate in self.delegatePointers)
+ {
+ if ([theDelegate respondsToSelector:@selector(completionTicket:didFailForTarget:error:)])
+ [theDelegate completionTicket:self didFailForTarget:inTarget error:inError];
+ }
+}
+
+- (void)didCancelForTarget:(id)inTarget
+{
+for (id <CCompletionTicketDelegate> theDelegate in self.delegatePointers)
+ {
+ if ([theDelegate respondsToSelector:@selector(completionTicket:didCancelForTarget:)])
+ [theDelegate completionTicket:self didCancelForTarget:inTarget];
+ }
+}
+
+@end
@@ -0,0 +1,71 @@
+//
+// CManagedURLConnection.h
+// TouchCode
+//
+// Created by Jonathan Wight on 04/16/08.
+// Copyright 2008 toxicsoftware.com. All rights reserved.
+//
+// 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 <Foundation/Foundation.h>
+
+@class CCompletionTicket;
+
+/** A URL Connection that does most of the grunt work for you. You should generally use this with CURLConnectionManager. */
+@interface CManagedURLConnection : NSObject {
+ CCompletionTicket *completionTicket;
+
+ NSURLRequest *request;
+ NSInteger priority;
+ NSString *channel;
+ NSURLConnection *connection;
+ NSURLResponse *response;
+ id privateData;
+ BOOL dataIsMutable;
+ NSURLCredential *credential;
+
+ NSTimeInterval startTime;
+ NSTimeInterval endTime;
+}
+
+@property (readwrite, nonatomic, retain) CCompletionTicket *completionTicket;
+
+@property (readonly, nonatomic, retain) NSURLRequest *request;
+@property (readwrite, nonatomic, assign) NSInteger priority;
+@property (readwrite, nonatomic, retain) NSString *channel;
+
+@property (readonly, nonatomic, retain) NSURLConnection *connection;
+@property (readonly, nonatomic, retain) NSURLResponse *response;
+@property (retain, nonatomic) NSURLCredential *credential;
+
+@property (readonly, nonatomic, retain) NSData *data;
+
+@property (readonly, nonatomic, assign) NSTimeInterval startTime;
+@property (readonly, nonatomic, assign) NSTimeInterval endTime;
+
+- (id)initWithRequest:(NSURLRequest *)inRequest completionTicket:(CCompletionTicket *)inCompletionTicket;
+
+- (void)start;
+- (void)cancel;
+
+@end
Oops, something went wrong.

0 comments on commit 04a8789

Please sign in to comment.