/core/externals/update-engine/externals/gdata-objectivec-client/Source/Introspection/GDataAtomServiceDocument.m

http://macfuse.googlecode.com/ · Objective C · 79 lines · 40 code · 20 blank · 19 comment · 2 complexity · 7e76ff62537d2c1f844bd36d8cd675af 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. // GDataAtomServiceDocument.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION
  19. // app:service, an Atom service document,
  20. // per http://tools.ietf.org/html/rfc5023#section-8.3.1
  21. #import "GDataAtomServiceDocument.h"
  22. #import "GDataAtomWorkspace.h"
  23. @implementation GDataAtomServiceDocument
  24. - (void)addExtensionDeclarations {
  25. [super addExtensionDeclarations];
  26. [self addExtensionDeclarationForParentClass:[self class]
  27. childClass:[GDataAtomWorkspace class]];
  28. }
  29. #if !GDATA_SIMPLE_DESCRIPTIONS
  30. - (NSMutableArray *)itemsForDescription {
  31. static struct GDataDescriptionRecord descRecs[] = {
  32. { @"workspaces", @"workspaces", kGDataDescArrayDescs },
  33. { nil, nil, (GDataDescRecTypes)0 }
  34. };
  35. NSMutableArray *items = [super itemsForDescription];
  36. [self addDescriptionRecords:descRecs toItems:items];
  37. return items;
  38. }
  39. #endif
  40. #pragma mark -
  41. - (NSArray *)workspaces {
  42. NSArray *array = [self objectsForExtensionClass:[GDataAtomWorkspace class]];
  43. return array;
  44. }
  45. - (void)setWorkspaces:(NSArray *)array {
  46. [self setObjects:array forExtensionClass:[GDataAtomWorkspace class]];
  47. }
  48. - (GDataAtomWorkspace *)primaryWorkspace {
  49. NSArray *workspaces = [self workspaces];
  50. if ([workspaces count] > 0) {
  51. return [workspaces objectAtIndex:0];
  52. }
  53. return nil;
  54. }
  55. + (NSString *)defaultServiceVersion {
  56. return @"2.0";
  57. }
  58. @end
  59. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION