PageRenderTime 20ms CodeModel.GetById 8ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Photos/GDataFeedPhotoBase.m

http://macfuse.googlecode.com/
Objective C | 100 lines | 55 code | 26 blank | 19 comment | 3 complexity | 76a04ec0166ef380b9d2ea88bce020e6 MD5 | raw file
  1/* Copyright (c) 2007 Google Inc.
  2 *
  3 * Licensed under the Apache License, Version 2.0 (the "License");
  4 * you may not use this file except in compliance with the License.
  5 * You may obtain a copy of the License at
  6 *
  7 *     http://www.apache.org/licenses/LICENSE-2.0
  8 *
  9 * Unless required by applicable law or agreed to in writing, software
 10 * distributed under the License is distributed on an "AS IS" BASIS,
 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12 * See the License for the specific language governing permissions and
 13 * limitations under the License.
 14 */
 15
 16//
 17//  GDataFeedPhotoBase.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
 21
 22#import "GDataFeedPhotoBase.h"
 23#import "GDataPhotoConstants.h"
 24#import "GDataPhotoElements.h"
 25
 26@implementation GDataFeedPhotoBase
 27
 28- (void)addExtensionDeclarations {
 29  
 30  [super addExtensionDeclarations];
 31  
 32  // common photo extensions
 33  [self addExtensionDeclarationForParentClass:[self class]
 34                                   childClass:[GDataPhotoGPhotoID class]];
 35}
 36
 37#if !GDATA_SIMPLE_DESCRIPTIONS
 38- (NSMutableArray *)itemsForDescription {
 39  
 40  NSMutableArray *items = [super itemsForDescription];
 41  [self addToArray:items objectDescriptionIfNonNil:[self GPhotoID] withName:@"gphotoID"];
 42  return items;
 43}
 44#endif
 45
 46- (Class)classForEntries {
 47  return kUseRegisteredEntryClass;
 48}
 49
 50+ (NSString *)defaultServiceVersion {
 51  return kGDataPhotosDefaultServiceVersion;
 52}
 53
 54#pragma mark -
 55
 56- (NSString *)GPhotoID {
 57  
 58  GDataPhotoGPhotoID *obj = [self objectForExtensionClass:[GDataPhotoGPhotoID class]];
 59  
 60  return [obj stringValue];
 61}
 62
 63- (void)setGPhotoID:(NSString *)str {
 64  
 65  if (str) {
 66    GDataPhotoGPhotoID *obj = [GDataPhotoGPhotoID valueWithString:str];
 67    
 68    [self setObject:obj forExtensionClass:[GDataPhotoGPhotoID class]];
 69  } else {
 70    [self setObject:nil forExtensionClass:[GDataPhotoGPhotoID class]];
 71  }
 72}
 73
 74// like in the Java library, we'll rename subtitle as description
 75
 76- (GDataTextConstruct *)photoDescription {
 77  return [self subtitle]; 
 78}
 79
 80- (void)setPhotoDescription:(GDataTextConstruct *)obj {
 81  [self setSubtitle:obj];
 82}
 83
 84- (void)setPhotoDescriptionWithString:(NSString *)str {
 85  [self setSubtitle:[GDataTextConstruct textConstructWithString:str]]; 
 86}
 87
 88#pragma mark -
 89
 90- (id)entryForGPhotoID:(NSString *)str {
 91  GDataEntryPhotoBase *obj;
 92
 93  obj = [GDataUtilities firstObjectFromArray:[self entries]
 94                                   withValue:str
 95                                  forKeyPath:@"GPhotoID"];
 96  return obj;
 97}
 98@end
 99
100#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE