PageRenderTime 42ms CodeModel.GetById 32ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 79 lines | 40 code | 20 blank | 19 comment | 2 complexity | 7e76ff62537d2c1f844bd36d8cd675af 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//  GDataAtomServiceDocument.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION
21
22// app:service, an Atom service document,
23// per http://tools.ietf.org/html/rfc5023#section-8.3.1
24
25#import "GDataAtomServiceDocument.h"
26#import "GDataAtomWorkspace.h"
27
28@implementation GDataAtomServiceDocument
29
30- (void)addExtensionDeclarations {
31
32  [super addExtensionDeclarations];
33
34  [self addExtensionDeclarationForParentClass:[self class]
35                                   childClass:[GDataAtomWorkspace class]];
36}
37
38#if !GDATA_SIMPLE_DESCRIPTIONS
39- (NSMutableArray *)itemsForDescription {
40  
41  static struct GDataDescriptionRecord descRecs[] = {
42    { @"workspaces", @"workspaces", kGDataDescArrayDescs },
43    { nil, nil, (GDataDescRecTypes)0 }
44  };
45  
46  NSMutableArray *items = [super itemsForDescription];
47  [self addDescriptionRecords:descRecs toItems:items];
48  return items;
49}
50#endif
51
52#pragma mark -
53
54- (NSArray *)workspaces {
55  NSArray *array = [self objectsForExtensionClass:[GDataAtomWorkspace class]];
56  return array;
57}
58
59- (void)setWorkspaces:(NSArray *)array {
60  [self setObjects:array forExtensionClass:[GDataAtomWorkspace class]];
61}
62
63- (GDataAtomWorkspace *)primaryWorkspace {
64  NSArray *workspaces = [self workspaces];
65
66  if ([workspaces count] > 0) {
67    return [workspaces objectAtIndex:0];
68  }
69
70  return nil;
71}
72
73+ (NSString *)defaultServiceVersion {
74  return @"2.0";
75}
76
77@end
78
79#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION