/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Docs/GDataDocFeature.m

http://macfuse.googlecode.com/ · Objective C · 101 lines · 59 code · 19 blank · 23 comment · 1 complexity · a3f02e50b1b9da020480bb612702ebb8 MD5 · raw file

  1. /* Copyright (c) 2010 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. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE
  16. //
  17. // GDataDocFeature.m
  18. //
  19. #import "GDataDocFeature.h"
  20. #import "GDataDocConstants.h"
  21. @interface GDataDocFeatureName : GDataValueElementConstruct <GDataExtension>
  22. @end
  23. @implementation GDataDocFeatureName
  24. + (NSString *)extensionElementURI { return kGDataNamespaceDocuments; }
  25. + (NSString *)extensionElementPrefix { return kGDataNamespaceDocumentsPrefix; }
  26. + (NSString *)extensionElementLocalName { return @"featureName"; }
  27. @end
  28. @interface GDataDocFeatureRate : GDataValueElementConstruct <GDataExtension>
  29. @end
  30. @implementation GDataDocFeatureRate
  31. + (NSString *)extensionElementURI { return kGDataNamespaceDocuments; }
  32. + (NSString *)extensionElementPrefix { return kGDataNamespaceDocumentsPrefix; }
  33. + (NSString *)extensionElementLocalName { return @"featureRate"; }
  34. @end
  35. @implementation GDataDocFeature
  36. // a docs feature, such as
  37. //
  38. // <docs:feature>
  39. // <docs:featureName>ocr</docs:featureName>
  40. // <docs:featureRate>rate</docs:featureRate>
  41. // </docs:feature>
  42. + (NSString *)extensionElementURI { return kGDataNamespaceDocuments; }
  43. + (NSString *)extensionElementPrefix { return kGDataNamespaceDocumentsPrefix; }
  44. + (NSString *)extensionElementLocalName { return @"feature"; }
  45. - (void)addExtensionDeclarations {
  46. [super addExtensionDeclarations];
  47. [self addExtensionDeclarationForParentClass:[self class]
  48. childClasses:
  49. [GDataDocFeatureName class],
  50. [GDataDocFeatureRate class],
  51. nil];
  52. }
  53. #if !GDATA_SIMPLE_DESCRIPTIONS
  54. - (NSMutableArray *)itemsForDescription {
  55. static struct GDataDescriptionRecord descRecs[] = {
  56. { @"name", @"featureName", kGDataDescValueLabeled },
  57. { @"rate", @"featureRate", kGDataDescValueLabeled },
  58. { nil, nil, (GDataDescRecTypes)0 }
  59. };
  60. NSMutableArray *items = [super itemsForDescription];
  61. [self addDescriptionRecords:descRecs toItems:items];
  62. return items;
  63. }
  64. #endif
  65. - (NSString *)featureName {
  66. GDataDocFeatureName *obj = [self objectForExtensionClass:[GDataDocFeatureName class]];
  67. return [obj stringValue];
  68. }
  69. - (void)setFeatureName:(NSString *)str {
  70. GDataDocFeatureName *obj = [GDataDocFeatureName valueWithString:str];
  71. [self setObject:obj forExtensionClass:[GDataDocFeatureName class]];
  72. }
  73. - (NSString *)featureRate {
  74. GDataDocFeatureRate *obj = [self objectForExtensionClass:[GDataDocFeatureRate class]];
  75. return [obj stringValue];
  76. }
  77. - (void)setFeatureRate:(NSString *)str {
  78. GDataDocFeatureRate *obj = [GDataDocFeatureRate valueWithString:str];
  79. [self setObject:obj forExtensionClass:[GDataDocFeatureRate class]];
  80. }
  81. @end
  82. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_DOCS_SERVICE