PageRenderTime 32ms CodeModel.GetById 20ms app.highlight 10ms RepoModel.GetById 1ms app.codeStats 0ms

/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/Finance/GDataFinanceSymbol.m

http://macfuse.googlecode.com/
Objective C | 89 lines | 47 code | 23 blank | 19 comment | 1 complexity | 3f49a03f7f72f4330c28e1dcda9df6fd 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//  GDataFinanceSymbol.m
18//
19
20#if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_FINANCE_SERVICE
21
22#import "GDataFinanceSymbol.h"
23
24#import "GDataMoneyElements.h"
25#import "GDataDateTime.h"
26#import "GDataEntryFinancePortfolio.h" // for namespaces
27
28
29// exchange symbol, like
30//  <gf:symbol exchange='NASDAQ' fullName='Google Inc.' symbol='GOOG'/>
31
32static NSString* const kExchangeAttr = @"exchange";
33static NSString* const kFullNameAttr = @"fullName";
34static NSString* const kSymbolAttr = @"symbol";
35
36@implementation GDataFinanceSymbol 
37
38+ (NSString *)extensionElementPrefix { return kGDataNamespaceFinancePrefix; }
39+ (NSString *)extensionElementURI { return kGDataNamespaceFinance; }
40+ (NSString *)extensionElementLocalName { return @"symbol"; }
41
42+ (GDataFinanceSymbol *)symbolWithSymbol:(NSString *)symbol
43                                fullName:(NSString *)fullName
44                                exchange:(NSString *)exchange {
45  
46  GDataFinanceSymbol *obj = [self object];
47  [obj setSymbol:symbol];
48  [obj setFullName:fullName];
49  [obj setExchange:exchange];
50  return obj;
51}
52
53- (void)addParseDeclarations {
54  
55  NSArray *attrs = [NSArray arrayWithObjects: 
56                    kSymbolAttr, kExchangeAttr, kFullNameAttr, nil];
57  
58  [self addLocalAttributeDeclarations:attrs];
59}
60
61#pragma mark -
62
63- (NSString *)exchange {
64  return [self stringValueForAttribute:kExchangeAttr]; 
65}
66
67- (void)setExchange:(NSString *)str {
68  [self setStringValue:str forAttribute:kExchangeAttr];
69}
70
71- (NSString *)fullName {
72  return [self stringValueForAttribute:kFullNameAttr]; 
73}
74
75- (void)setFullName:(NSString *)str {
76  [self setStringValue:str forAttribute:kFullNameAttr];
77}
78
79- (NSString *)symbol {
80  return [self stringValueForAttribute:kSymbolAttr]; 
81}
82
83- (void)setSymbol:(NSString *)str {
84  [self setStringValue:str forAttribute:kSymbolAttr];
85}
86
87@end
88
89#endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_FINANCE_SERVICE