PageRenderTime 26ms CodeModel.GetById 16ms app.highlight 8ms RepoModel.GetById 1ms app.codeStats 0ms

/Source/externals/GData/Source/Media/GDataMediaPlayer.m

http://google-email-uploader-mac.googlecode.com/
Objective C | 82 lines | 42 code | 20 blank | 20 comment | 2 complexity | f9ac4274b9099f512de5090efae2585a 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//  GDataMediaPlayer.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE \
21  || GDATA_INCLUDE_YOUTUBE_SERVICE
22
23#import "GDataMediaPlayer.h"
24#import "GDataMediaGroup.h"
25
26static NSString* const kURLAttr = @"url";
27static NSString* const kHeightAttr = @"height";
28static NSString* const kWidthAttr = @"width";
29
30@implementation GDataMediaPlayer
31// like  <media:player url="http://www.foo.com/player?id=1111" height="200" width="400" />
32//
33// http://search.yahoo.com/mrss
34
35+ (NSString *)extensionElementURI       { return kGDataNamespaceMedia; }
36+ (NSString *)extensionElementPrefix    { return kGDataNamespaceMediaPrefix; }
37+ (NSString *)extensionElementLocalName { return @"player"; }
38
39+ (GDataMediaPlayer *)mediaPlayerWithURLString:(NSString *)str {
40  GDataMediaPlayer* obj = [self object];
41  [obj setURLString:str];
42  return obj;
43}
44
45- (void)addParseDeclarations {
46  
47  NSArray *attrs = [NSArray arrayWithObjects: 
48                    kURLAttr, kHeightAttr, kWidthAttr, nil];
49  
50  [self addLocalAttributeDeclarations:attrs];
51}
52
53#pragma mark -
54
55- (NSString *)URLString {
56  return [self stringValueForAttribute:kURLAttr];
57}
58
59- (void)setURLString:(NSString *)str {
60  [self setStringValue:str forAttribute:kURLAttr];
61}
62
63- (NSNumber *)height {
64  return [self intNumberForAttribute:kHeightAttr];
65}
66
67- (void)setHeight:(NSNumber *)num {
68  [self setStringValue:[num stringValue] forAttribute:kHeightAttr];
69}
70
71- (NSNumber *)width {
72  return [self intNumberForAttribute:kWidthAttr];
73}
74
75- (void)setWidth:(NSNumber *)num {
76  [self setStringValue:[num stringValue] forAttribute:kWidthAttr];
77}
78
79
80@end
81
82#endif // #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE