/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/WebmasterTools/GDataFeedSiteKeyword.m

http://macfuse.googlecode.com/ · Objective C · 94 lines · 52 code · 24 blank · 18 comment · 1 complexity · 02061e6211ba93a569bc0c91056fe165 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. // GDataFeedSiteKeyword.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_WEBMASTERTOOLS_SERVICE
  19. #import "GDataFeedSiteKeyword.h"
  20. #import "GDataWebmasterToolsConstants.h"
  21. @implementation GDataFeedSiteKeyword
  22. + (GDataFeedSiteKeyword *)siteKeywordFeed {
  23. GDataFeedSiteKeyword *feed = [self object];
  24. [feed setNamespaces:[GDataWebmasterToolsConstants webmasterToolsNamespaces]];
  25. return feed;
  26. }
  27. + (NSString *)standardFeedKind {
  28. return kGDataCategorySiteKeyword;
  29. }
  30. + (void)load {
  31. [self registerFeedClass];
  32. }
  33. - (void)addExtensionDeclarations {
  34. [super addExtensionDeclarations];
  35. [self addExtensionDeclarationForParentClass:[self class]
  36. childClass:[GDataSiteKeyword class]];
  37. }
  38. #if !GDATA_SIMPLE_DESCRIPTIONS
  39. - (NSMutableArray *)itemsForDescription {
  40. static struct GDataDescriptionRecord descRecs[] = {
  41. { @"keywords", @"keywords", kGDataDescArrayDescs },
  42. { nil, nil, (GDataDescRecTypes)0 }
  43. };
  44. NSMutableArray *items = [super itemsForDescription];
  45. [self addDescriptionRecords:descRecs toItems:items];
  46. return items;
  47. }
  48. #endif
  49. + (NSString *)defaultServiceVersion {
  50. return kGDataWebmasterToolsDefaultServiceVersion;
  51. }
  52. #pragma mark -
  53. - (NSArray *)keywords {
  54. return [self objectsForExtensionClass:[GDataSiteKeyword class]];
  55. }
  56. - (void)setKeywords:(NSArray *)array {
  57. [self setObjects:array forExtensionClass:[GDataSiteKeyword class]];
  58. }
  59. - (void)addKeyword:(GDataSiteKeyword *)obj {
  60. [self addObject:obj forExtensionClass:[GDataSiteKeyword class]];
  61. }
  62. // convenience accessor
  63. - (NSArray *)keywordsWithSource:(NSString *)source {
  64. NSArray *array = [GDataUtilities objectsFromArray:[self keywords]
  65. withValue:source
  66. forKeyPath:@"source"];
  67. return array;
  68. }
  69. @end
  70. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_WEBMASTERTOOLS_SERVICE