LookinAttribute.m 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. #ifdef SHOULD_COMPILE_LOOKIN_SERVER
  2. //
  3. // LookinAttribute.m
  4. // qmuidemo
  5. //
  6. // Created by Li Kai on 2018/11/17.
  7. // Copyright © 2018 QMUI Team. All rights reserved.
  8. //
  9. #import "LookinAttribute.h"
  10. #import "LookinDisplayItem.h"
  11. @implementation LookinAttribute
  12. #pragma mark - <NSCopying>
  13. - (id)copyWithZone:(NSZone *)zone {
  14. LookinAttribute *newAttr = [[LookinAttribute allocWithZone:zone] init];
  15. newAttr.identifier = self.identifier;
  16. newAttr.displayTitle = self.displayTitle;
  17. newAttr.value = self.value;
  18. newAttr.attrType = self.attrType;
  19. newAttr.extraValue = self.extraValue;
  20. newAttr.customSetterID = self.customSetterID;
  21. return newAttr;
  22. }
  23. #pragma mark - <NSCoding>
  24. - (void)encodeWithCoder:(NSCoder *)aCoder {
  25. [aCoder encodeObject:self.displayTitle forKey:@"displayTitle"];
  26. [aCoder encodeObject:self.identifier forKey:@"identifier"];
  27. [aCoder encodeInteger:self.attrType forKey:@"attrType"];
  28. [aCoder encodeObject:self.value forKey:@"value"];
  29. [aCoder encodeObject:self.extraValue forKey:@"extraValue"];
  30. [aCoder encodeObject:self.customSetterID forKey:@"customSetterID"];
  31. }
  32. - (instancetype)initWithCoder:(NSCoder *)aDecoder {
  33. if (self = [super init]) {
  34. self.displayTitle = [aDecoder decodeObjectForKey:@"displayTitle"];
  35. self.identifier = [aDecoder decodeObjectForKey:@"identifier"];
  36. self.attrType = [aDecoder decodeIntegerForKey:@"attrType"];
  37. self.value = [aDecoder decodeObjectForKey:@"value"];
  38. self.extraValue = [aDecoder decodeObjectForKey:@"extraValue"];
  39. self.customSetterID = [aDecoder decodeObjectForKey:@"customSetterID"];
  40. }
  41. return self;
  42. }
  43. + (BOOL)supportsSecureCoding {
  44. return YES;
  45. }
  46. - (BOOL)isUserCustom {
  47. return [self.identifier isEqualToString:LookinAttr_UserCustom];
  48. }
  49. @end
  50. #endif /* SHOULD_COMPILE_LOOKIN_SERVER */