PageRenderTime 24ms CodeModel.GetById 13ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Introspection/GDataAtomWorkspace.m

http://macfuse.googlecode.com/
Objective C | 88 lines | 51 code | 20 blank | 17 comment | 2 complexity | 394233160089c2e311715cd034c2e7c1 MD5 | raw file
 1/* Copyright (c) 2009 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//  GDataAtomWorkspace.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION
21
22#import "GDataAtomWorkspace.h"
23#import "GDataAtomCollection.h"
24#import "GDataBaseElements.h"
25
26@implementation GDataAtomWorkspace
27
28+ (NSString *)extensionElementURI       { return kGDataNamespaceAtomPub; }
29+ (NSString *)extensionElementPrefix    { return kGDataNamespaceAtomPubPrefix; }
30+ (NSString *)extensionElementLocalName { return @"workspace"; }
31
32- (void)addExtensionDeclarations {
33
34  [super addExtensionDeclarations];
35
36  [self addExtensionDeclarationForParentClass:[self class]
37                                 childClasses:
38   [GDataAtomCollection class],
39   [GDataAtomTitle class],
40   nil];
41}
42
43#if !GDATA_SIMPLE_DESCRIPTIONS
44- (NSMutableArray *)itemsForDescription {
45  static struct GDataDescriptionRecord descRecs[] = {
46    { @"title",       @"title.stringValue", kGDataDescValueLabeled },
47    { @"collections", @"collections",       kGDataDescArrayDescs },
48    { nil, nil, (GDataDescRecTypes)0 }
49  };
50  
51  NSMutableArray *items = [super itemsForDescription];
52  [self addDescriptionRecords:descRecs toItems:items];
53  return items;
54}
55#endif
56
57#pragma mark -
58
59- (GDataTextConstruct *)title {
60  return [self objectForExtensionClass:[GDataAtomTitle class]];
61}
62
63- (void)setTitle:(GDataTextConstruct *)obj {
64  [self setObject:obj forExtensionClass:[GDataAtomTitle class]];
65}
66
67- (NSArray *)collections {
68  NSArray *array = [self objectsForExtensionClass:[GDataAtomCollection class]];
69  return array;
70}
71
72- (void)setCollections:(NSArray *)array {
73  [self setObjects:array forExtensionClass:[GDataAtomCollection class]];
74}
75
76- (GDataAtomCollection *)primaryCollection {
77  NSArray *collections = [self collections];
78
79  if ([collections count] > 0) {
80    return [collections objectAtIndex:0];
81  }
82
83  return nil;
84}
85
86@end
87
88#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION