From 3e8437ae559487362fae3525beb79c534c213a51 Mon Sep 17 00:00:00 2001 From: 单军华 Date: Thu, 12 Jul 2018 13:44:34 +0800 Subject: [PATCH] bug修复和功能优化 --- screendisplay/Pods/MJExtension/MJExtension/MJPropertyType.m | 74 +++++++++++++++++++++++++++++++++++++ 1 files changed, 74 insertions(+), 0 deletions(-) diff --git a/screendisplay/Pods/MJExtension/MJExtension/MJPropertyType.m b/screendisplay/Pods/MJExtension/MJExtension/MJPropertyType.m new file mode 100755 index 0000000..012b448 --- /dev/null +++ b/screendisplay/Pods/MJExtension/MJExtension/MJPropertyType.m @@ -0,0 +1,74 @@ +// +// MJPropertyType.m +// MJExtension +// +// Created by mj on 14-1-15. +// Copyright (c) 2014��� ���������. All rights reserved. +// + +#import "MJPropertyType.h" +#import "MJExtension.h" +#import "MJFoundation.h" +#import "MJExtensionConst.h" + +@implementation MJPropertyType + ++ (instancetype)cachedTypeWithCode:(NSString *)code +{ + MJExtensionAssertParamNotNil2(code, nil); + + static NSMutableDictionary *types; + static dispatch_once_t onceToken; + dispatch_once(&onceToken, ^{ + types = [NSMutableDictionary dictionary]; + }); + + MJExtensionSemaphoreCreate + MJExtensionSemaphoreWait + MJPropertyType *type = types[code]; + if (type == nil) { + type = [[self alloc] init]; + type.code = code; + types[code] = type; + } + MJExtensionSemaphoreSignal + return type; +} + +#pragma mark - ������������ +- (void)setCode:(NSString *)code +{ + _code = code; + + MJExtensionAssertParamNotNil(code); + + if ([code isEqualToString:MJPropertyTypeId]) { + _idType = YES; + } else if (code.length == 0) { + _KVCDisabled = YES; + } else if (code.length > 3 && [code hasPrefix:@"@\""]) { + // ������@"���"������������������������������ + _code = [code substringWithRange:NSMakeRange(2, code.length - 3)]; + _typeClass = NSClassFromString(_code); + _fromFoundation = [MJFoundation isClassFromFoundation:_typeClass]; + _numberType = [_typeClass isSubclassOfClass:[NSNumber class]]; + + } else if ([code isEqualToString:MJPropertyTypeSEL] || + [code isEqualToString:MJPropertyTypeIvar] || + [code isEqualToString:MJPropertyTypeMethod]) { + _KVCDisabled = YES; + } + + // ��������������������� + NSString *lowerCode = _code.lowercaseString; + NSArray *numberTypes = @[MJPropertyTypeInt, MJPropertyTypeShort, MJPropertyTypeBOOL1, MJPropertyTypeBOOL2, MJPropertyTypeFloat, MJPropertyTypeDouble, MJPropertyTypeLong, MJPropertyTypeLongLong, MJPropertyTypeChar]; + if ([numberTypes containsObject:lowerCode]) { + _numberType = YES; + + if ([lowerCode isEqualToString:MJPropertyTypeBOOL1] + || [lowerCode isEqualToString:MJPropertyTypeBOOL2]) { + _boolType = YES; + } + } +} +@end -- Gitblit v1.8.0