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

http://macfuse.googlecode.com/ · Objective C · 82 lines · 44 code · 19 blank · 19 comment · 1 complexity · 285f598732dbd7a1a068765694d4d7c9 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. // GDataOrganizationName.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE
  19. #import "GDataOrganizationName.h"
  20. static NSString* const kYomiAttr = @"yomi";
  21. @implementation GDataOrganizationName
  22. // organization name
  23. // <gd:orgName yomi="Ak Me">Acme Corp</gd:orgName>
  24. + (NSString *)extensionElementURI { return kGDataNamespaceGData; }
  25. + (NSString *)extensionElementPrefix { return kGDataNamespaceGDataPrefix; }
  26. + (NSString *)extensionElementLocalName { return @"orgName"; }
  27. + (id)organizationNameWithString:(NSString *)str {
  28. GDataOrganizationName *obj = [self object];
  29. [obj setStringValue:str];
  30. return obj;
  31. }
  32. - (void)addParseDeclarations {
  33. NSArray *attrs = [NSArray arrayWithObject:kYomiAttr];
  34. [self addLocalAttributeDeclarations:attrs];
  35. [self addContentValueDeclaration];
  36. }
  37. #if !GDATA_SIMPLE_DESCRIPTIONS
  38. - (NSMutableArray *)itemsForDescription {
  39. static struct GDataDescriptionRecord descRecs[] = {
  40. { @"value", @"stringValue", kGDataDescValueLabeled },
  41. { @"yomi", @"yomi", kGDataDescValueLabeled },
  42. { nil, nil, (GDataDescRecTypes)0 }
  43. };
  44. NSMutableArray *items = [super itemsForDescription];
  45. [self addDescriptionRecords:descRecs toItems:items];
  46. return items;
  47. }
  48. #endif
  49. #pragma mark -
  50. - (NSString *)stringValue {
  51. return [self contentStringValue];
  52. }
  53. - (void)setStringValue:(NSString *)str {
  54. [self setContentStringValue:str];
  55. }
  56. - (NSString *)yomi {
  57. return [self stringValueForAttribute:kYomiAttr];
  58. }
  59. - (void)setYomi:(NSString *)str {
  60. [self setStringValue:str forAttribute:kYomiAttr];
  61. }
  62. @end
  63. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_CONTACTS_SERVICE