Changeset 14252 for lang/objective-c

Show
Ignore:
Timestamp:
06/19/08 16:05:22 (5 years ago)
Author:
lyokato
Message:

lang/objective-c/Atompub: made trunk and tags directory, and moved files appropriately

Location:
lang/objective-c/Atompub
Files:
2 added
3 modified
5 moved

Legend:

Unmodified
Added
Removed
  • lang/objective-c/Atompub/trunk/Classes/AtomService.m

    r13814 r14252  
    5252 
    5353@end 
     54 
  • lang/objective-c/Atompub/trunk/Classes/AtompubClient.h

    r13814 r14252  
    11#import <Foundation/Foundation.h> 
    22#import "AtompubCredential.h" 
     3#import "AtompubClientDelegate.h" 
     4 
     5#define defaultTimeoutInterval 60.0 
     6 
     7typedef 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; 
    321 
    422@class AtompubCacheStorage, AtomEntry; 
     
    624@interface AtompubClient : NSObject { 
    725  NSObject <AtompubCredential> *credential; 
    8   id                            delegate; 
    9   unsigned int                  timeoutInterval; 
    10   NSString                     *agentName; 
    11   int                          fetchMode; 
    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; 
    1735} 
    1836 
     
    2442- (AtompubCacheStorage *)cacheStorage; 
    2543- (void)setCacheStorage:(AtompubCacheStorage *)storage; 
    26 - (id)delegate; 
    27 - (void)setDelegate:(id)target; 
     44- (NSObject <AtompubClientDelegate> *)delegate; 
     45- (void)setDelegate:(NSObject <AtompubClientDelegate> *)target; 
    2846- (void)setCredential:(NSObject <AtompubCredential> *)aCredential; 
    2947- (unsigned int)timeoutInterval; 
     
    4967               contentType:(NSString *)aType 
    5068                      slug:(NSString *)slug; 
     69- (void)cancel; 
     70- (void)closeConnection; 
     71- (void)clear; 
     72- (void)dealloc; 
     73@end 
     74 
     75 
     76@interface AtompubClient (PrivateMethods) 
    5177- (void)connection:(NSURLConnection *)conn 
    5278didReceiveResponse:(NSURLResponse *)response; 
     
    5682  didFailWithError:(NSError *)error; 
    5783- (void)connectionDidFinishLoading:(NSURLConnection *)conn; 
    58 - (void)cancel; 
    59 - (void)closeConnection; 
    60 - (void)clear; 
    61 - (void)dealloc; 
    6284- (void)startLoadingResponseWithURL:(NSURL *)url 
    63                                mode:(int)mode; 
     85                               mode:(AtompubClientFetchMode)mode; 
    6486- (void)startConnectionWithRequest:(NSMutableURLRequest *)request 
    65                               mode:(int)mode; 
     87                              mode:(AtompubClientFetchMode)mode; 
    6688- (void)dispatchErrorWithStatus:(int)status 
    6789                    description:(NSString *)description; 
     
    7092                  contentType:(NSString *)aType 
    7193                         slug:(NSString *)slug 
    72                          mode:(int)mode; 
     94                         mode:(AtompubClientFetchMode)mode; 
    7395- (void)startUpdatingResource:(NSData *)resource 
    7496                      withURL:(NSURL *)url 
    7597                  contentType:(NSString *)aType 
    76                          mode:(int)mode; 
     98                         mode:(AtompubClientFetchMode)mode; 
    7799- (void)startDeletingResourceWithURL:(NSURL *)url 
    78                                 mode:(int)mode; 
     100                                mode:(AtompubClientFetchMode)mode; 
    79101- (void)handleResponseWithType:(NSString *)aType 
    80102                    dispatcher:(SEL)dispatcher 
     
    85107- (void)handleResponseForPuttingOrDeletingResourceWithDispatcher:(SEL)dispatcher; 
    86108@end 
    87  
  • lang/objective-c/Atompub/trunk/Classes/AtompubClient.m

    r13814 r14252  
    99#import "AtompubCacheStorage.h" 
    1010 
    11 #define defaultTimeoutInterval 60.0 
    12  
    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   DeletingMedia 
    26 }; 
    27  
    2811@implementation AtompubClient 
    2912 
     
    130113 
    131114- (void)startLoadingResponseWithURL:(NSURL *)url 
    132                                mode:(int)mode { 
     115                               mode:(AtompubClientFetchMode)mode { 
    133116  if ([ self isFetching ]) 
    134117    return; 
     
    212195                  contentType:(NSString *)aType 
    213196                         slug:(NSString *)slug 
    214                          mode:(int)mode { 
     197                         mode:(AtompubClientFetchMode)mode { 
    215198  if ([ self isFetching ]) 
    216199    return; 
     
    263246                      withURL:(NSURL *)url 
    264247                  contentType:(NSString *)aType 
    265                          mode:(int)mode { 
     248                         mode:(AtompubClientFetchMode)mode { 
    266249 
    267250  if ([ self isFetching ]) 
     
    310293 
    311294- (void)startDeletingResourceWithURL:(NSURL *)url 
    312                                 mode:(int)mode { 
     295                                mode:(AtompubClientFetchMode)mode { 
    313296  if ([ self isFetching ]) 
    314297    return; 
     
    330313 
    331314- (void)startConnectionWithRequest:(NSMutableURLRequest *)request 
    332                               mode:(int)mode { 
     315                              mode:(AtompubClientFetchMode)mode { 
    333316  connection = [ [ NSURLConnection alloc ] initWithRequest:request 
    334317                                                  delegate:self ]; 
     
    372355 
    373356  NSLog(@"finished loading"); 
    374   int mode = fetchMode; 
     357  AtompubClientFetchMode mode = fetchMode; 
    375358 
    376359  [ self closeConnection ]; 
     
    445428  if (status >= 200 && status < 300) { 
    446429    if (status != 200 && status != 204) 
    447       NSLog([ NSString stringWithFormat:@"Bad status code: %d", status ]); 
     430      NSLog(@"Bad status code: %d", status); 
    448431    [ cacheStorage removeCacheForURL:lastRequestURL ]; 
    449432    if (delegate != nil 
     
    465448 
    466449    if (status != 201) 
    467       NSLog( [ NSString stringWithFormat:@"Bad status code: %d", status ] ); 
     450      NSLog(@"Bad status code: %d", status); 
    468451 
    469452    NSString *type = (NSString *)[ headers objectForKey:@"Content-Type" ]; 
    470453    if (![ type isEqualToString:@"application/atom+xml;type=entry" ]) 
    471       NSLog( [ NSString stringWithFormat:@"Bad Content-Type: %@", type ] ); 
     454      NSLog(@"Bad Content-Type: %@", type); 
    472455 
    473456    NSString *location = (NSString *)[ headers objectForKey:@"Location" ]; 
     
    509492    //if (![ type isEqualToString:@"application/atomsvc+xml" ]) 
    510493    if (![ type isEqualToString:@"application/atom+xml;type=entry" ]) 
    511       NSLog( [ NSString stringWithFormat:@"Bad Content-Type: %@", type ] ); 
     494      NSLog(@"Bad Content-Type: %@", type); 
    512495    if (cacheStorage != nil) { 
    513496      AtompubCache *newCache = [ AtompubCache cache ]; 
     
    622605    //if (![ type isEqualToString:@"application/atomsvc+xml" ]) 
    623606    if (![ type isEqualToString:aType ]) 
    624       NSLog( [ NSString stringWithFormat:@"Bad Content-Type: %@", type ] ); 
     607      NSLog(@"Bad Content-Type: %@", type); 
    625608    NSXMLDocument *doc = 
    626609      [ [ NSXMLDocument alloc ] initWithData:responseData 
  • lang/objective-c/Atompub/trunk/README.txt

    r13814 r14252  
    1414** SSCrypto 
    1515 
    16 Copyright (c) 2003-2006, Septicus Software All rights reserved. 
    17  
    1816This library depends on SSCrypto by SEPTICUS SOFTWARE(BSD License). 
    1917(http://septicus.com/products/opensource/) 
    2018See the document. 
    2119  
     20Copyright (c) 2003-2006, Septicus Software All rights reserved. 
    2221 
    2322 Redistribution and use in source and binary forms, with or without 
  • lang/objective-c/Atompub/trunk/TASK.txt

    r14246 r14252  
    1111- add KeyChain controller to each AtompubCredential class for both Mac OSX and iPhone OS 
    1212- make this package one single framework. 
     13