PageRenderTime 26ms CodeModel.GetById 15ms app.highlight 9ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Media/GDataMediaRestriction.m

http://macfuse.googlecode.com/
Objective C | 83 lines | 45 code | 18 blank | 20 comment | 2 complexity | 399d30879ac34c266f9ed467d45f9442 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//  GDataMediaRestriction.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_PHOTOS_SERVICE \
21  || GDATA_INCLUDE_YOUTUBE_SERVICE
22
23#import "GDataMediaRestriction.h"
24#import "GDataMediaGroup.h"
25
26static NSString* const kRelationshipAttr = @"relationship";
27static NSString* const kTypeAttr = @"type";
28
29@implementation GDataMediaRestriction
30// like <media:restriction relationship="allow" type="country">au us</media:restriction>
31//
32// http://search.yahoo.com/mrss
33
34+ (NSString *)extensionElementURI       { return kGDataNamespaceMedia; }
35+ (NSString *)extensionElementPrefix    { return kGDataNamespaceMediaPrefix; }
36+ (NSString *)extensionElementLocalName { return @"restriction"; }
37
38+ (GDataMediaRestriction *)mediaRestrictionWithString:(NSString *)str
39                                         relationship:(NSString *)rel
40                                                 type:(NSString *)type {
41  GDataMediaRestriction* obj = [self object];
42  [obj setStringValue:str];
43  [obj setRelationship:rel];
44  [obj setType:type];
45  return obj;
46}
47
48- (void)addParseDeclarations {
49  
50  NSArray *attrs = [NSArray arrayWithObjects: 
51                    kRelationshipAttr, kTypeAttr, nil];
52  
53  [self addLocalAttributeDeclarations:attrs];
54  
55  [self addContentValueDeclaration];
56}
57
58- (NSString *)relationship {
59  return [self stringValueForAttribute:kRelationshipAttr];
60}
61
62- (void)setRelationship:(NSString *)str {
63  [self setStringValue:str forAttribute:kRelationshipAttr];
64}
65
66- (NSString *)type {
67  return [self stringValueForAttribute:kTypeAttr];
68}
69
70- (void)setType:(NSString *)str {
71  [self setStringValue:str forAttribute:kTypeAttr];
72}
73
74- (NSString *)stringValue {
75  return [self contentStringValue];
76}
77
78- (void)setStringValue:(NSString *)str {
79  [self setContentStringValue:str];
80}
81@end
82
83#endif // #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_*_SERVICE