/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/YouTube/GDataEntryYouTubeCaptionTrack.m

http://macfuse.googlecode.com/ · Objective C · 111 lines · 61 code · 29 blank · 21 comment · 5 complexity · 63813ce79de15c2c225ec4ca2af47eda 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. // GDataEntryYouTubeCaptionTrack.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
  19. #import "GDataEntryYouTubeCaptionTrack.h"
  20. #import "GDataYouTubeConstants.h"
  21. #import "GDataYouTubeElements.h"
  22. @implementation GDataEntryYouTubeCaptionTrack
  23. + (GDataEntryYouTubeCaptionTrack *)captionTrackEntry {
  24. GDataEntryYouTubeCaptionTrack *entry = [self object];
  25. [entry setNamespaces:[GDataYouTubeConstants youTubeNamespaces]];
  26. return entry;
  27. }
  28. #pragma mark -
  29. + (NSString *)standardEntryKind {
  30. return kGDataCategoryYouTubeCaptionTrack;
  31. }
  32. + (void)load {
  33. [self registerEntryClass];
  34. }
  35. - (void)addExtensionDeclarations {
  36. [super addExtensionDeclarations];
  37. [self addExtensionDeclarationForParentClass:[self class]
  38. childClass:[GDataYouTubeDerived class]];
  39. // the publication state element is an extension to the Atom publishing
  40. // control element
  41. [self addExtensionDeclarationForParentClass:[GDataAtomPubControl class]
  42. childClass:[GDataYouTubePublicationState class]];
  43. }
  44. #if !GDATA_SIMPLE_DESCRIPTIONS
  45. - (NSMutableArray *)itemsForDescription {
  46. static struct GDataDescriptionRecord descRecs[] = {
  47. { @"state", @"publicationState", kGDataDescValueLabeled },
  48. { nil, nil, (GDataDescRecTypes)0 }
  49. };
  50. NSMutableArray *items = [super itemsForDescription];
  51. [self addDescriptionRecords:descRecs toItems:items];
  52. return items;
  53. }
  54. #endif
  55. + (NSString *)defaultServiceVersion {
  56. return kGDataYouTubeDefaultServiceVersion;
  57. }
  58. #pragma mark -
  59. - (GDataYouTubePublicationState *)publicationState {
  60. // publication state is an extension to the entry's atomPubControl
  61. GDataAtomPubControl *atomPubControl = [self atomPubControl];
  62. return [atomPubControl objectForExtensionClass:[GDataYouTubePublicationState class]];
  63. }
  64. - (void)setGDataYouTubePublicationState:(GDataYouTubePublicationState *)obj {
  65. GDataAtomPubControl *atomPubControl = [self atomPubControl];
  66. if (obj != nil && atomPubControl == nil) {
  67. // to set the publication state, we need to make an atomPubControl element
  68. atomPubControl = [GDataAtomPubControl atomPubControl];
  69. }
  70. [atomPubControl setObject:obj
  71. forExtensionClass:[GDataYouTubePublicationState class]];
  72. }
  73. - (NSString *)derived {
  74. GDataYouTubeDerived *obj = [self objectForExtensionClass:[GDataYouTubeDerived class]];
  75. return [obj stringValue];
  76. }
  77. - (void)setDerived:(NSString *)str {
  78. GDataYouTubeDerived *obj = [GDataYouTubeDerived valueWithString:str];
  79. [self setObject:obj forExtensionClass:[GDataYouTubeDerived class]];
  80. }
  81. @end
  82. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE