/core/externals/update-engine/externals/gdata-objectivec-client/Source/ACL/GDataACLScope.m

http://macfuse.googlecode.com/ · Objective C · 82 lines · 43 code · 18 blank · 21 comment · 3 complexity · 2d7aad9df078d62c0c6909fefbff8c39 MD5 · raw file

  1. /* Copyright (c) 2007 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. // GDataACLScope.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_ACLS \
  19. || GDATA_INCLUDE_CALENDAR_SERVICE || GDATA_INCLUDE_DOCS_SERVICE
  20. #define GDATAACLSCOPE_DEFINE_GLOBALS 1
  21. #import "GDataACLScope.h"
  22. #import "GDataEntryACL.h"
  23. static NSString* const kNameAttr = @"name";
  24. static NSString* const kTypeAttr = @"type";
  25. static NSString* const kValueAttr = @"value";
  26. @implementation GDataACLScope
  27. // an element with type and value attributes, as in
  28. // <gAcl:scope type='user' value='user@gmail.com'></gAcl:scope>
  29. //
  30. // http://code.google.com/apis/calendar/reference.html#gacl_reference
  31. + (NSString *)extensionElementURI { return kGDataNamespaceACL; }
  32. + (NSString *)extensionElementPrefix { return kGDataNamespaceACLPrefix; }
  33. + (NSString *)extensionElementLocalName { return @"scope"; }
  34. + (GDataACLScope *)scopeWithType:(NSString *)type value:(NSString *)value {
  35. GDataACLScope *obj = [self object];
  36. [obj setType:type];
  37. [obj setValue:value];
  38. return obj;
  39. }
  40. - (void)addParseDeclarations {
  41. NSArray *attrs = [NSArray arrayWithObjects:
  42. kTypeAttr, kValueAttr, kNameAttr, nil];
  43. [self addLocalAttributeDeclarations:attrs];
  44. }
  45. - (NSString *)value {
  46. return [self stringValueForAttribute:kValueAttr];
  47. }
  48. - (void)setValue:(NSString *)str {
  49. [self setStringValue:str forAttribute:kValueAttr];
  50. }
  51. - (NSString *)type {
  52. return [self stringValueForAttribute:kTypeAttr];
  53. }
  54. - (void)setType:(NSString *)str {
  55. [self setStringValue:str forAttribute:kTypeAttr];
  56. }
  57. - (NSString *)name {
  58. return [self stringValueForAttribute:kNameAttr];
  59. }
  60. - (void)setName:(NSString *)str {
  61. [self setStringValue:str forAttribute:kNameAttr];
  62. }
  63. @end
  64. #endif // !GDATA_REQUIRE_SERVICE_INCLUDE || GDATA_INCLUDE_*