/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. // GDataBatchInterrupted.m
  17. //
  18. #import "GDataBatchInterrupted.h"
  19. static NSString* const kReasonAttr = @"reason";
  20. static NSString* const kSuccessAttr = @"success";
  21. static NSString* const kFailuresAttr = @"failures";
  22. static NSString* const kParsedAttr = @"parsed";
  23. static NSString* const kContentTypeAttr = @"content-type";
  24. @implementation GDataBatchInterrupted
  25. // for batch Interrupteds, like
  26. // <batch:interrupted reason="reason" success="N" failures="N" parsed="N" />
  27. + (NSString *)extensionElementURI { return kGDataNamespaceBatch; }
  28. + (NSString *)extensionElementPrefix { return kGDataNamespaceBatchPrefix; }
  29. + (NSString *)extensionElementLocalName { return @"interrupted"; }
  30. + (GDataBatchInterrupted *)batchInterrupted {
  31. GDataBatchInterrupted* obj = [self object];
  32. return obj;
  33. }
  34. - (void)addParseDeclarations {
  35. NSArray *attrs = [NSArray arrayWithObjects:
  36. kReasonAttr, kSuccessAttr, kFailuresAttr, kParsedAttr,
  37. kContentTypeAttr, nil];
  38. [self addLocalAttributeDeclarations:attrs];
  39. [self addContentValueDeclaration];
  40. }
  41. #if !GDATA_SIMPLE_DESCRIPTIONS
  42. - (NSMutableArray *)itemsForDescription {
  43. NSMutableArray *items = [NSMutableArray array];
  44. [self addAttributeDescriptionsToArray:items];
  45. [self addContentDescriptionToArray:items withName:@"content"];
  46. return items;
  47. }
  48. #endif
  49. - (NSString *)reason {
  50. return [self stringValueForAttribute:kReasonAttr];
  51. }
  52. - (void)setReason:(NSString *)str {
  53. [self setStringValue:str forAttribute:kReasonAttr];
  54. }
  55. - (NSNumber *)successCount {
  56. return [self intNumberForAttribute:kSuccessAttr];
  57. }
  58. - (void)setSuccessCount:(NSNumber *)val {
  59. [self setStringValue:[val stringValue] forAttribute:kSuccessAttr];
  60. }
  61. - (NSNumber *)errorCount {
  62. return [self intNumberForAttribute:kFailuresAttr];
  63. }
  64. - (void)setErrorCount:(NSNumber *)val {
  65. [self setStringValue:[val stringValue] forAttribute:kFailuresAttr];
  66. }
  67. - (NSNumber *)totalCount {
  68. return [self intNumberForAttribute:kParsedAttr];
  69. }
  70. - (void)setTotalCount:(NSNumber *)val {
  71. [self setStringValue:[val stringValue] forAttribute:kParsedAttr];
  72. }
  73. - (NSString *)contentType {
  74. return [self stringValueForAttribute:kContentTypeAttr];
  75. }
  76. - (void)setContentType:(NSString *)str {
  77. [self setStringValue:str forAttribute:kContentTypeAttr];
  78. }
  79. - (NSString *)stringValue {
  80. return [self contentStringValue];;
  81. }
  82. - (void)setStringValue:(NSString *)str {
  83. [self setContentStringValue:str];
  84. }
  85. @end