/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. // GDataFinanceSymbol.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_FINANCE_SERVICE
  19. #import "GDataFinanceSymbol.h"
  20. #import "GDataMoneyElements.h"
  21. #import "GDataDateTime.h"
  22. #import "GDataEntryFinancePortfolio.h" // for namespaces
  23. // exchange symbol, like
  24. // <gf:symbol exchange='NASDAQ' fullName='Google Inc.' symbol='GOOG'/>
  25. static NSString* const kExchangeAttr = @"exchange";
  26. static NSString* const kFullNameAttr = @"fullName";
  27. static NSString* const kSymbolAttr = @"symbol";
  28. @implementation GDataFinanceSymbol
  29. + (NSString *)extensionElementPrefix { return kGDataNamespaceFinancePrefix; }
  30. + (NSString *)extensionElementURI { return kGDataNamespaceFinance; }
  31. + (NSString *)extensionElementLocalName { return @"symbol"; }
  32. + (GDataFinanceSymbol *)symbolWithSymbol:(NSString *)symbol
  33. fullName:(NSString *)fullName
  34. exchange:(NSString *)exchange {
  35. GDataFinanceSymbol *obj = [self object];
  36. [obj setSymbol:symbol];
  37. [obj setFullName:fullName];
  38. [obj setExchange:exchange];
  39. return obj;
  40. }
  41. - (void)addParseDeclarations {
  42. NSArray *attrs = [NSArray arrayWithObjects:
  43. kSymbolAttr, kExchangeAttr, kFullNameAttr, nil];
  44. [self addLocalAttributeDeclarations:attrs];
  45. }
  46. #pragma mark -
  47. - (NSString *)exchange {
  48. return [self stringValueForAttribute:kExchangeAttr];
  49. }
  50. - (void)setExchange:(NSString *)str {
  51. [self setStringValue:str forAttribute:kExchangeAttr];
  52. }
  53. - (NSString *)fullName {
  54. return [self stringValueForAttribute:kFullNameAttr];
  55. }
  56. - (void)setFullName:(NSString *)str {
  57. [self setStringValue:str forAttribute:kFullNameAttr];
  58. }
  59. - (NSString *)symbol {
  60. return [self stringValueForAttribute:kSymbolAttr];
  61. }
  62. - (void)setSymbol:(NSString *)str {
  63. [self setStringValue:str forAttribute:kSymbolAttr];
  64. }
  65. @end
  66. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_FINANCE_SERVICE