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