/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Books/GDataVolumeReadingPosition.m

http://macfuse.googlecode.com/ · Objective C · 96 lines · 54 code · 20 blank · 22 comment · 1 complexity · 9b72fbd50621b6f9f4376e2d32d10a26 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. // GDataVolumeReadingPosition.m
  17. //
  18. // reading position, like
  19. // <gbs:readingPosition action="NextPage"
  20. // application="Sony Reader"
  21. // value="GBS.25.w.2.9.15"
  22. // time="2007-07-16T00:00:00" />
  23. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE
  24. #import "GDataVolumeReadingPosition.h"
  25. #import "GDataBookConstants.h"
  26. static NSString* const kActionAttr = @"action";
  27. static NSString* const kApplicationAttr = @"application";
  28. static NSString* const kTimeAttr = @"time";
  29. static NSString* const kValueAttr = @"value";
  30. @implementation GDataVolumeReadingPosition
  31. + (NSString *)extensionElementURI { return kGDataNamespaceBooks; }
  32. + (NSString *)extensionElementPrefix { return kGDataNamespaceBooksPrefix; }
  33. + (NSString *)extensionElementLocalName { return @"readingPosition"; }
  34. + (GDataVolumeReadingPosition *)positionWithAction:(NSString *)action
  35. applicationName:(NSString *)name
  36. time:(GDataDateTime *)dateTime
  37. value:(NSString *)value {
  38. GDataVolumeReadingPosition *obj = [self object];
  39. [obj setAction:action];
  40. [obj setApplicationName:name];
  41. [obj setValue:value];
  42. [obj setPositionTime:dateTime];
  43. return obj;
  44. }
  45. - (void)addParseDeclarations {
  46. NSArray *attrs = [NSArray arrayWithObjects:
  47. kActionAttr, kApplicationAttr, kTimeAttr, kValueAttr, nil];
  48. [self addLocalAttributeDeclarations:attrs];
  49. }
  50. #pragma mark -
  51. - (NSString *)action {
  52. return [self stringValueForAttribute:kActionAttr];
  53. }
  54. - (void)setAction:(NSString *)str {
  55. [self setStringValue:str forAttribute:kActionAttr];
  56. }
  57. - (NSString *)applicationName {
  58. return [self stringValueForAttribute:kApplicationAttr];
  59. }
  60. - (void)setApplicationName:(NSString *)str {
  61. [self setStringValue:str forAttribute:kApplicationAttr];
  62. }
  63. - (NSString *)value {
  64. return [self stringValueForAttribute:kValueAttr];
  65. }
  66. - (void)setValue:(NSString *)str {
  67. [self setStringValue:str forAttribute:kValueAttr];
  68. }
  69. - (GDataDateTime *)positionTime {
  70. return [self dateTimeForAttribute:kTimeAttr];
  71. }
  72. - (void)setPositionTime:(GDataDateTime *)dateTime {
  73. [self setDateTimeValue:dateTime forAttribute:kTimeAttr];
  74. }
  75. @end
  76. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_BOOKS_SERVICE