PageRenderTime 43ms CodeModel.GetById 26ms app.highlight 15ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Elements/GDataBatchInterrupted.m

http://macfuse.googlecode.com/
Objective C | 113 lines | 66 code | 28 blank | 19 comment | 0 complexity | 2e01f89bd4c89604760f68c8845a3583 MD5 | raw file
  1/* Copyright (c) 2007 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//  GDataBatchInterrupted.m
 18//
 19
 20#import "GDataBatchInterrupted.h"
 21
 22static NSString* const kReasonAttr = @"reason";
 23static NSString* const kSuccessAttr = @"success";
 24static NSString* const kFailuresAttr = @"failures";
 25static NSString* const kParsedAttr = @"parsed";
 26static NSString* const kContentTypeAttr = @"content-type";
 27
 28@implementation GDataBatchInterrupted
 29
 30// for batch Interrupteds, like
 31//  <batch:interrupted reason="reason" success="N" failures="N" parsed="N" />
 32
 33+ (NSString *)extensionElementURI       { return kGDataNamespaceBatch; }
 34+ (NSString *)extensionElementPrefix    { return kGDataNamespaceBatchPrefix; }
 35+ (NSString *)extensionElementLocalName { return @"interrupted"; }
 36
 37+ (GDataBatchInterrupted *)batchInterrupted {
 38  GDataBatchInterrupted* obj = [self object];
 39  return obj;
 40}
 41
 42- (void)addParseDeclarations {
 43
 44  NSArray *attrs = [NSArray arrayWithObjects:
 45                    kReasonAttr, kSuccessAttr, kFailuresAttr, kParsedAttr,
 46                    kContentTypeAttr, nil];
 47
 48  [self addLocalAttributeDeclarations:attrs];
 49
 50  [self addContentValueDeclaration];
 51}
 52
 53#if !GDATA_SIMPLE_DESCRIPTIONS
 54- (NSMutableArray *)itemsForDescription {
 55  NSMutableArray *items = [NSMutableArray array];
 56
 57  [self addAttributeDescriptionsToArray:items];
 58  [self addContentDescriptionToArray:items withName:@"content"];
 59
 60  return items;
 61}
 62#endif
 63
 64- (NSString *)reason {
 65  return [self stringValueForAttribute:kReasonAttr];
 66}
 67
 68- (void)setReason:(NSString *)str {
 69  [self setStringValue:str forAttribute:kReasonAttr];
 70}
 71
 72- (NSNumber *)successCount {
 73  return [self intNumberForAttribute:kSuccessAttr];
 74}
 75
 76- (void)setSuccessCount:(NSNumber *)val {
 77  [self setStringValue:[val stringValue] forAttribute:kSuccessAttr];
 78}
 79
 80- (NSNumber *)errorCount {
 81  return [self intNumberForAttribute:kFailuresAttr];
 82}
 83
 84- (void)setErrorCount:(NSNumber *)val {
 85  [self setStringValue:[val stringValue] forAttribute:kFailuresAttr];
 86}
 87
 88- (NSNumber *)totalCount {
 89  return [self intNumberForAttribute:kParsedAttr];
 90}
 91
 92- (void)setTotalCount:(NSNumber *)val {
 93  [self setStringValue:[val stringValue] forAttribute:kParsedAttr];
 94}
 95
 96- (NSString *)contentType {
 97  return [self stringValueForAttribute:kContentTypeAttr];
 98}
 99
100- (void)setContentType:(NSString *)str {
101  [self setStringValue:str forAttribute:kContentTypeAttr];
102}
103
104- (NSString *)stringValue {
105  return [self contentStringValue];;
106}
107
108- (void)setStringValue:(NSString *)str {
109  [self setContentStringValue:str];
110}
111
112@end
113