PageRenderTime 50ms CodeModel.GetById 37ms app.highlight 11ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 86 lines | 42 code | 25 blank | 19 comment | 1 complexity | bf9b2d0f352af7acc650f77360007558 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//  GDataEntryPhotoTag.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE
21
22#import "GDataEntryPhotoTag.h"
23#import "GDataPhotoElements.h"
24#import "GDataPhotoConstants.h"
25
26@implementation GDataEntryPhotoTag
27
28+ (GDataEntryPhotoTag *)tagEntryWithString:(NSString *)tagStr {
29  
30  GDataEntryPhotoTag *entry = [self object];
31
32  [entry setNamespaces:[GDataPhotoConstants photoNamespaces]];
33  
34  [entry setTitle:[GDataTextConstruct textConstructWithString:tagStr]];
35  
36  return entry;
37}
38
39#pragma mark -
40
41+ (NSString *)standardEntryKind {
42  return kGDataCategoryPhotosTag;
43}
44
45+ (void)load {
46  [self registerEntryClass];
47}
48
49- (void)addExtensionDeclarations {
50  
51  [super addExtensionDeclarations];
52  
53  // common photo extensions
54  Class entryClass = [self class];
55  
56  [self addExtensionDeclarationForParentClass:entryClass
57                                   childClass:[GDataPhotoWeight class]];
58}
59
60#if !GDATA_SIMPLE_DESCRIPTIONS
61- (NSMutableArray *)itemsForDescription {
62  
63  NSMutableArray *items = [super itemsForDescription];
64  
65  [self addToArray:items objectDescriptionIfNonNil:[self weight] withName:@"weight"];
66  
67  return items;
68}
69#endif
70
71#pragma mark -
72
73- (NSNumber *)weight {
74  // int
75  GDataPhotoWeight *obj = [self objectForExtensionClass:[GDataPhotoWeight class]];
76  return [obj intNumberValue];
77}
78
79- (void)setWeight:(NSNumber *)num {
80  GDataPhotoWeight *obj = [GDataPhotoWeight valueWithNumber:num];
81  [self setObject:obj forExtensionClass:[obj class]];  
82}
83
84@end
85
86#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE