PageRenderTime 71ms CodeModel.GetById 10ms app.highlight 58ms RepoModel.GetById 1ms app.codeStats 0ms

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

http://macfuse.googlecode.com/
Objective C | 173 lines | 118 code | 36 blank | 19 comment | 1 complexity | 9556612ed59e7d3d580c4899e597b0e6 MD5 | raw file
  1/* Copyright (c) 2008 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//
 17//  GDataQueryYouTube.m
 18//
 19
 20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
 21
 22#define GDATAQUERYYOUTUBE_DEFINE_GLOBALS 1
 23#import "GDataQueryYouTube.h"
 24
 25#import "GDataServiceGoogleYouTube.h"
 26
 27static NSString *const kTimeParamName = @"time";
 28static NSString *const kFormatParamName = @"format";
 29static NSString *const kCaptionTrackFormatParamName = @"fmt";
 30static NSString *const kSafeSearchParamName = @"safeSearch";
 31static NSString *const kRestrictionParamName = @"restriction";
 32static NSString *const kLanguageRestrictionParamName = @"lr";
 33static NSString *const kLocationParamName = @"location";
 34static NSString *const kLocationRadiusParamName = @"location-radius";
 35static NSString *const kCaptionParamName = @"caption";
 36static NSString *const k3DParamName = @"3d";
 37static NSString *const kInlineParamName = @"inline";
 38static NSString *const kUploaderParamName = @"uploader";
 39
 40@implementation GDataQueryYouTube
 41
 42+ (GDataQueryYouTube *)youTubeQueryWithFeedURL:(NSURL *)feedURL {
 43  return [self queryWithFeedURL:feedURL];   
 44}
 45
 46
 47- (void)setVideoQuery:(NSString *)str {
 48  // The vq query parameter has been replaced with
 49  // "q" (kFullTextQueryStringParamName) for v2
 50  [self setFullTextQueryString:str];
 51}
 52
 53- (NSString *)videoQuery {
 54  return [self fullTextQueryString];
 55}
 56
 57- (void)setFormat:(NSString *)str {
 58  [self addCustomParameterWithName:kFormatParamName
 59                             value:str];
 60}
 61
 62- (NSString *)format {
 63  return [self valueForParameterWithName:kFormatParamName];
 64}
 65
 66- (void)setCaptionTrackFormat:(NSString *)str {
 67  [self addCustomParameterWithName:kCaptionTrackFormatParamName
 68                             value:str];
 69}
 70
 71- (NSString *)captionTrackFormat {
 72  return [self valueForParameterWithName:kCaptionTrackFormatParamName];
 73}
 74
 75- (void)setTimePeriod:(NSString *)str {
 76  [self addCustomParameterWithName:kTimeParamName
 77                             value:str];
 78}
 79
 80- (NSString *)timePeriod {
 81  return [self valueForParameterWithName:kTimeParamName];
 82}
 83
 84- (void)setRestriction:(NSString *)str {
 85  [self addCustomParameterWithName:kRestrictionParamName
 86                             value:str];
 87}
 88
 89- (NSString *)restriction {
 90  return [self valueForParameterWithName:kRestrictionParamName];
 91}
 92
 93- (void)setLanguageRestriction:(NSString *)str {
 94  [self addCustomParameterWithName:kLanguageRestrictionParamName
 95                             value:str];
 96}
 97
 98- (NSString *)languageRestriction {
 99  return [self valueForParameterWithName:kLanguageRestrictionParamName];
100}
101
102- (void)setLocation:(NSString *)str {
103  [self addCustomParameterWithName:kLocationParamName
104                             value:str];
105}
106
107- (NSString *)location {
108  return [self valueForParameterWithName:kLocationParamName];
109}
110
111- (void)setLocationRadius:(NSString *)str {
112  [self addCustomParameterWithName:kLocationRadiusParamName
113                             value:str];
114}
115
116- (NSString *)locationRadius {
117  return [self valueForParameterWithName:kLocationRadiusParamName];
118}
119
120- (void)setHasCaptions:(BOOL)flag {
121  [self addCustomParameterWithName:kCaptionParamName
122                         boolValue:flag
123                      defaultValue:NO];
124}
125
126- (BOOL)hasCaptions {
127  return [self boolValueForParameterWithName:kCaptionParamName
128                                defaultValue:NO];
129}
130
131- (void)setShouldRequire3D:(BOOL)flag {
132  [self addCustomParameterWithName:k3DParamName
133                         boolValue:flag
134                      defaultValue:NO];
135}
136
137- (BOOL)shouldRequire3D {
138  return [self boolValueForParameterWithName:k3DParamName
139                                defaultValue:NO];
140}
141
142- (void)setShouldInline:(BOOL)flag {
143  [self addCustomParameterWithName:kInlineParamName
144                         boolValue:flag
145                      defaultValue:NO];
146}
147
148- (BOOL)shouldInline {
149  return [self boolValueForParameterWithName:kInlineParamName
150                                defaultValue:NO];
151}
152
153- (void)setUploader:(NSString *)str {
154  [self addCustomParameterWithName:kUploaderParamName
155                             value:str];
156}
157
158- (NSString *)uploader {
159  return [self valueForParameterWithName:kUploaderParamName];
160}
161
162- (void)setSafeSearch:(NSString *)str {
163  [self addCustomParameterWithName:kSafeSearchParamName
164                             value:str];
165}
166
167- (NSString *)safeSearch {
168  return [self valueForParameterWithName:kSafeSearchParamName];
169}
170
171@end
172
173#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE