PageRenderTime 39ms CodeModel.GetById 35ms RepoModel.GetById 0ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 88 lines | 51 code | 20 blank | 17 comment | 2 complexity | 394233160089c2e311715cd034c2e7c1 MD5 | raw file
Possible License(s): Apache-2.0, BSD-3-Clause, GPL-2.0
  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. // GDataAtomWorkspace.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION
  19. #import "GDataAtomWorkspace.h"
  20. #import "GDataAtomCollection.h"
  21. #import "GDataBaseElements.h"
  22. @implementation GDataAtomWorkspace
  23. + (NSString *)extensionElementURI { return kGDataNamespaceAtomPub; }
  24. + (NSString *)extensionElementPrefix { return kGDataNamespaceAtomPubPrefix; }
  25. + (NSString *)extensionElementLocalName { return @"workspace"; }
  26. - (void)addExtensionDeclarations {
  27. [super addExtensionDeclarations];
  28. [self addExtensionDeclarationForParentClass:[self class]
  29. childClasses:
  30. [GDataAtomCollection class],
  31. [GDataAtomTitle class],
  32. nil];
  33. }
  34. #if !GDATA_SIMPLE_DESCRIPTIONS
  35. - (NSMutableArray *)itemsForDescription {
  36. static struct GDataDescriptionRecord descRecs[] = {
  37. { @"title", @"title.stringValue", kGDataDescValueLabeled },
  38. { @"collections", @"collections", kGDataDescArrayDescs },
  39. { nil, nil, (GDataDescRecTypes)0 }
  40. };
  41. NSMutableArray *items = [super itemsForDescription];
  42. [self addDescriptionRecords:descRecs toItems:items];
  43. return items;
  44. }
  45. #endif
  46. #pragma mark -
  47. - (GDataTextConstruct *)title {
  48. return [self objectForExtensionClass:[GDataAtomTitle class]];
  49. }
  50. - (void)setTitle:(GDataTextConstruct *)obj {
  51. [self setObject:obj forExtensionClass:[GDataAtomTitle class]];
  52. }
  53. - (NSArray *)collections {
  54. NSArray *array = [self objectsForExtensionClass:[GDataAtomCollection class]];
  55. return array;
  56. }
  57. - (void)setCollections:(NSArray *)array {
  58. [self setObjects:array forExtensionClass:[GDataAtomCollection class]];
  59. }
  60. - (GDataAtomCollection *)primaryCollection {
  61. NSArray *collections = [self collections];
  62. if ([collections count] > 0) {
  63. return [collections objectAtIndex:0];
  64. }
  65. return nil;
  66. }
  67. @end
  68. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_SERVICE_INTROSPECTION