PageRenderTime 36ms CodeModel.GetById 21ms app.highlight 13ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 86 lines | 44 code | 23 blank | 19 comment | 3 complexity | d81e342c185c6e29447c3b00ba4169db 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//  GDataEntryPhotoBase.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
21
22#define GDATAPHOTOBASE_DEFINE_GLOBALS 1
23#import "GDataEntryPhotoBase.h"
24#import "GDataPhotoConstants.h"
25
26@implementation GDataEntryPhotoBase
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+ (NSString *)defaultServiceVersion {
47  return kGDataPhotosDefaultServiceVersion;
48}
49
50#pragma mark -
51
52- (NSString *)GPhotoID {
53  
54  GDataPhotoGPhotoID *obj = [self objectForExtensionClass:[GDataPhotoGPhotoID class]];
55  
56  return [obj stringValue];
57}
58
59- (void)setGPhotoID:(NSString *)str {
60  
61  if (str) {
62    GDataPhotoGPhotoID *obj = [GDataPhotoGPhotoID valueWithString:str];
63    
64    [self setObject:obj forExtensionClass:[GDataPhotoGPhotoID class]];
65  } else {
66    [self setObject:nil forExtensionClass:[GDataPhotoGPhotoID class]];
67  }
68}
69
70// like in the Java library, we'll rename summary as description
71
72- (GDataTextConstruct *)photoDescription {
73  return [self summary]; 
74}
75
76- (void)setPhotoDescription:(GDataTextConstruct *)obj {
77  [self setSummary:obj];
78}
79
80- (void)setPhotoDescriptionWithString:(NSString *)str {
81  [self setSummary:[GDataTextConstruct textConstructWithString:str]];
82}
83
84@end
85
86#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE