PageRenderTime 46ms CodeModel.GetById 8ms app.highlight 34ms RepoModel.GetById 2ms app.codeStats 0ms

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