Changeset 14252 for lang/objective-c
- Timestamp:
- 06/19/08 16:05:22 (5 years ago)
- Location:
- lang/objective-c/Atompub
- Files:
-
- 2 added
- 3 modified
- 5 moved
-
tags (added)
-
trunk (added)
-
trunk/Classes (moved) (moved from lang/objective-c/Atompub/Classes)
-
trunk/Classes/AtomService.m (modified) (1 diff)
-
trunk/Classes/AtompubClient.h (modified) (7 diffs)
-
trunk/Classes/AtompubClient.m (modified) (11 diffs)
-
trunk/EXAMPLE.txt (moved) (moved from lang/objective-c/Atompub/EXAMPLE.txt)
-
trunk/README.txt (moved) (moved from lang/objective-c/Atompub/README.txt) (1 diff)
-
trunk/TASK.txt (moved) (moved from lang/objective-c/Atompub/TASK.txt) (1 diff)
-
trunk/Tests (moved) (moved from lang/objective-c/Atompub/Tests)
Legend:
- Unmodified
- Added
- Removed
-
lang/objective-c/Atompub/trunk/Classes/AtomService.m
r13814 r14252 52 52 53 53 @end 54 -
lang/objective-c/Atompub/trunk/Classes/AtompubClient.h
r13814 r14252 1 1 #import <Foundation/Foundation.h> 2 2 #import "AtompubCredential.h" 3 #import "AtompubClientDelegate.h" 4 5 #define defaultTimeoutInterval 60.0 6 7 typedef enum { 8 None, 9 GettingService, 10 GettingCategories, 11 GettingFeed, 12 GettingEntry, 13 GettingMedia, 14 PostingEntry, 15 PostingMedia, 16 PuttingEntry, 17 PuttingMedia, 18 DeletingEntry, 19 DeletingMedia 20 } AtompubClientFetchMode; 3 21 4 22 @class AtompubCacheStorage, AtomEntry; … … 6 24 @interface AtompubClient : NSObject { 7 25 NSObject <AtompubCredential> *credential; 8 iddelegate;9 unsigned int timeoutInterval;10 NSString *agentName;11 intfetchMode;12 NSMutableData *responseData;13 NSHTTPURLResponse *lastResponse;14 NSURLConnection *connection;15 AtompubCacheStorage *cacheStorage;16 NSURL *lastRequestURL;26 NSObject <AtompubClientDelegate> *delegate; 27 unsigned int timeoutInterval; 28 NSString *agentName; 29 AtompubClientFetchMode fetchMode; 30 NSMutableData *responseData; 31 NSHTTPURLResponse *lastResponse; 32 NSURLConnection *connection; 33 AtompubCacheStorage *cacheStorage; 34 NSURL *lastRequestURL; 17 35 } 18 36 … … 24 42 - (AtompubCacheStorage *)cacheStorage; 25 43 - (void)setCacheStorage:(AtompubCacheStorage *)storage; 26 - ( id)delegate;27 - (void)setDelegate:( id)target;44 - (NSObject <AtompubClientDelegate> *)delegate; 45 - (void)setDelegate:(NSObject <AtompubClientDelegate> *)target; 28 46 - (void)setCredential:(NSObject <AtompubCredential> *)aCredential; 29 47 - (unsigned int)timeoutInterval; … … 49 67 contentType:(NSString *)aType 50 68 slug:(NSString *)slug; 69 - (void)cancel; 70 - (void)closeConnection; 71 - (void)clear; 72 - (void)dealloc; 73 @end 74 75 76 @interface AtompubClient (PrivateMethods) 51 77 - (void)connection:(NSURLConnection *)conn 52 78 didReceiveResponse:(NSURLResponse *)response; … … 56 82 didFailWithError:(NSError *)error; 57 83 - (void)connectionDidFinishLoading:(NSURLConnection *)conn; 58 - (void)cancel;59 - (void)closeConnection;60 - (void)clear;61 - (void)dealloc;62 84 - (void)startLoadingResponseWithURL:(NSURL *)url 63 mode:( int)mode;85 mode:(AtompubClientFetchMode)mode; 64 86 - (void)startConnectionWithRequest:(NSMutableURLRequest *)request 65 mode:( int)mode;87 mode:(AtompubClientFetchMode)mode; 66 88 - (void)dispatchErrorWithStatus:(int)status 67 89 description:(NSString *)description; … … 70 92 contentType:(NSString *)aType 71 93 slug:(NSString *)slug 72 mode:( int)mode;94 mode:(AtompubClientFetchMode)mode; 73 95 - (void)startUpdatingResource:(NSData *)resource 74 96 withURL:(NSURL *)url 75 97 contentType:(NSString *)aType 76 mode:( int)mode;98 mode:(AtompubClientFetchMode)mode; 77 99 - (void)startDeletingResourceWithURL:(NSURL *)url 78 mode:( int)mode;100 mode:(AtompubClientFetchMode)mode; 79 101 - (void)handleResponseWithType:(NSString *)aType 80 102 dispatcher:(SEL)dispatcher … … 85 107 - (void)handleResponseForPuttingOrDeletingResourceWithDispatcher:(SEL)dispatcher; 86 108 @end 87 -
lang/objective-c/Atompub/trunk/Classes/AtompubClient.m
r13814 r14252 9 9 #import "AtompubCacheStorage.h" 10 10 11 #define defaultTimeoutInterval 60.012 13 enum FetchMode {14 None,15 GettingService,16 GettingCategories,17 GettingFeed,18 GettingEntry,19 GettingMedia,20 PostingEntry,21 PostingMedia,22 PuttingEntry,23 PuttingMedia,24 DeletingEntry,25 DeletingMedia26 };27 28 11 @implementation AtompubClient 29 12 … … 130 113 131 114 - (void)startLoadingResponseWithURL:(NSURL *)url 132 mode:( int)mode {115 mode:(AtompubClientFetchMode)mode { 133 116 if ([ self isFetching ]) 134 117 return; … … 212 195 contentType:(NSString *)aType 213 196 slug:(NSString *)slug 214 mode:( int)mode {197 mode:(AtompubClientFetchMode)mode { 215 198 if ([ self isFetching ]) 216 199 return; … … 263 246 withURL:(NSURL *)url 264 247 contentType:(NSString *)aType 265 mode:( int)mode {248 mode:(AtompubClientFetchMode)mode { 266 249 267 250 if ([ self isFetching ]) … … 310 293 311 294 - (void)startDeletingResourceWithURL:(NSURL *)url 312 mode:( int)mode {295 mode:(AtompubClientFetchMode)mode { 313 296 if ([ self isFetching ]) 314 297 return; … … 330 313 331 314 - (void)startConnectionWithRequest:(NSMutableURLRequest *)request 332 mode:( int)mode {315 mode:(AtompubClientFetchMode)mode { 333 316 connection = [ [ NSURLConnection alloc ] initWithRequest:request 334 317 delegate:self ]; … … 372 355 373 356 NSLog(@"finished loading"); 374 intmode = fetchMode;357 AtompubClientFetchMode mode = fetchMode; 375 358 376 359 [ self closeConnection ]; … … 445 428 if (status >= 200 && status < 300) { 446 429 if (status != 200 && status != 204) 447 NSLog( [ NSString stringWithFormat:@"Bad status code: %d", status ]);430 NSLog(@"Bad status code: %d", status); 448 431 [ cacheStorage removeCacheForURL:lastRequestURL ]; 449 432 if (delegate != nil … … 465 448 466 449 if (status != 201) 467 NSLog( [ NSString stringWithFormat:@"Bad status code: %d", status ]);450 NSLog(@"Bad status code: %d", status); 468 451 469 452 NSString *type = (NSString *)[ headers objectForKey:@"Content-Type" ]; 470 453 if (![ type isEqualToString:@"application/atom+xml;type=entry" ]) 471 NSLog( [ NSString stringWithFormat:@"Bad Content-Type: %@", type ]);454 NSLog(@"Bad Content-Type: %@", type); 472 455 473 456 NSString *location = (NSString *)[ headers objectForKey:@"Location" ]; … … 509 492 //if (![ type isEqualToString:@"application/atomsvc+xml" ]) 510 493 if (![ type isEqualToString:@"application/atom+xml;type=entry" ]) 511 NSLog( [ NSString stringWithFormat:@"Bad Content-Type: %@", type ]);494 NSLog(@"Bad Content-Type: %@", type); 512 495 if (cacheStorage != nil) { 513 496 AtompubCache *newCache = [ AtompubCache cache ]; … … 622 605 //if (![ type isEqualToString:@"application/atomsvc+xml" ]) 623 606 if (![ type isEqualToString:aType ]) 624 NSLog( [ NSString stringWithFormat:@"Bad Content-Type: %@", type ]);607 NSLog(@"Bad Content-Type: %@", type); 625 608 NSXMLDocument *doc = 626 609 [ [ NSXMLDocument alloc ] initWithData:responseData -
lang/objective-c/Atompub/trunk/README.txt
r13814 r14252 14 14 ** SSCrypto 15 15 16 Copyright (c) 2003-2006, Septicus Software All rights reserved.17 18 16 This library depends on SSCrypto by SEPTICUS SOFTWARE(BSD License). 19 17 (http://septicus.com/products/opensource/) 20 18 See the document. 21 19 20 Copyright (c) 2003-2006, Septicus Software All rights reserved. 22 21 23 22 Redistribution and use in source and binary forms, with or without -
lang/objective-c/Atompub/trunk/TASK.txt
r14246 r14252 11 11 - add KeyChain controller to each AtompubCredential class for both Mac OSX and iPhone OS 12 12 - make this package one single framework. 13
![(please configure the [header_logo] section in trac.ini)](/share/chrome/site/your_project_logo.png)