PageRenderTime 52ms CodeModel.GetById 16ms app.highlight 33ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Docs/GDataFeedDocChange.m

http://macfuse.googlecode.com/
Objective C | 99 lines | 58 code | 22 blank | 19 comment | 1 complexity | 7667e4fd98cd1319e23bd593be541618 MD5 | raw file
 1/* Copyright (c) 2011 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//  GDataFeedDocChange.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE
21
22#import "GDataFeedDocChange.h"
23#import "GDataEntryDocChange.h"
24#import "GDataDocElements.h"
25
26@implementation GDataFeedDocChange
27
28+ (NSString *)coreProtocolVersionForServiceVersion:(NSString *)serviceVersion {
29  return [GDataDocConstants coreProtocolVersionForServiceVersion:serviceVersion];
30}
31
32+ (NSString *)standardFeedKind {
33  return kGDataCategoryDocChange;
34}
35
36+ (void)load {
37  [self registerFeedClass];
38}
39
40- (void)addExtensionDeclarations {
41  [super addExtensionDeclarations];
42
43  [self addExtensionDeclarationForParentClass:[self class]
44                                   childClass:[GDataDocLargestChangestamp class]];
45}
46
47#if !GDATA_SIMPLE_DESCRIPTIONS
48- (NSMutableArray *)itemsForDescription {
49
50  static struct GDataDescriptionRecord descRecs[] = {
51    { @"largestChangestamp", @"largestChangestamp", kGDataDescValueLabeled },
52    { nil, nil, (GDataDescRecTypes)0 }
53  };
54
55  NSMutableArray *items = [super itemsForDescription];
56  [self addDescriptionRecords:descRecs toItems:items];
57  return items;
58}
59#endif
60
61+ (NSString *)defaultServiceVersion {
62  return kGDataDocsDefaultServiceVersion;
63}
64
65- (Class)classForEntries {
66  return kUseRegisteredEntryClass;
67}
68
69// A changefeed is a list of Documents that have changed
70// therefore we return a DocBase as a default class for this feed.
71+ (Class)defaultClassForEntries {
72  return [GDataEntryDocBase class];
73}
74
75#pragma mark -
76
77- (NSNumber *)largestChangestamp {
78  GDataDocLargestChangestamp *obj;
79  obj = [self objectForExtensionClass:[GDataDocLargestChangestamp class]];
80  return [obj longLongNumberValue];
81}
82
83- (void)setLargestChangestamp:(NSNumber *)num {
84  GDataDocLargestChangestamp *obj;
85  obj = [GDataDocLargestChangestamp valueWithNumber:num];
86  [self setObject:obj forExtensionClass:[GDataDocLargestChangestamp class]];
87}
88
89#pragma mark -
90
91- (NSNumber *)lastEntryChangestamp {
92  GDataEntryDocBase *lastEntry = [[self entries] lastObject];
93  NSNumber *result = [lastEntry changestamp];
94  return result;
95}
96
97@end
98
99#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE