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/NSObject+MJClass.m |  178 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 178 insertions(+), 0 deletions(-)

diff --git a/screendisplay/Pods/MJExtension/MJExtension/NSObject+MJClass.m b/screendisplay/Pods/MJExtension/MJExtension/NSObject+MJClass.m
new file mode 100644
index 0000000..a978890
--- /dev/null
+++ b/screendisplay/Pods/MJExtension/MJExtension/NSObject+MJClass.m
@@ -0,0 +1,178 @@
+//
+//  NSObject+MJClass.m
+//  MJExtensionExample
+//
+//  Created by MJ Lee on 15/8/11.
+//  Copyright (c) 2015��� ���������. All rights reserved.
+//
+
+#import "NSObject+MJClass.h"
+#import "NSObject+MJCoding.h"
+#import "NSObject+MJKeyValue.h"
+#import "MJFoundation.h"
+#import <objc/runtime.h>
+
+static const char MJAllowedPropertyNamesKey = '\0';
+static const char MJIgnoredPropertyNamesKey = '\0';
+static const char MJAllowedCodingPropertyNamesKey = '\0';
+static const char MJIgnoredCodingPropertyNamesKey = '\0';
+
+@implementation NSObject (MJClass)
+
++ (NSMutableDictionary *)classDictForKey:(const void *)key
+{
+    static NSMutableDictionary *allowedPropertyNamesDict;
+    static NSMutableDictionary *ignoredPropertyNamesDict;
+    static NSMutableDictionary *allowedCodingPropertyNamesDict;
+    static NSMutableDictionary *ignoredCodingPropertyNamesDict;
+    
+    static dispatch_once_t onceToken;
+    dispatch_once(&onceToken, ^{
+        allowedPropertyNamesDict = [NSMutableDictionary dictionary];
+        ignoredPropertyNamesDict = [NSMutableDictionary dictionary];
+        allowedCodingPropertyNamesDict = [NSMutableDictionary dictionary];
+        ignoredCodingPropertyNamesDict = [NSMutableDictionary dictionary];
+    });
+    
+    if (key == &MJAllowedPropertyNamesKey) return allowedPropertyNamesDict;
+    if (key == &MJIgnoredPropertyNamesKey) return ignoredPropertyNamesDict;
+    if (key == &MJAllowedCodingPropertyNamesKey) return allowedCodingPropertyNamesDict;
+    if (key == &MJIgnoredCodingPropertyNamesKey) return ignoredCodingPropertyNamesDict;
+    return nil;
+}
+
++ (void)mj_enumerateClasses:(MJClassesEnumeration)enumeration
+{
+    // 1.������block���������������
+    if (enumeration == nil) return;
+    
+    // 2.���������������������
+    BOOL stop = NO;
+    
+    // 3.������������������������
+    Class c = self;
+    
+    // 4.������������������������
+    while (c && !stop) {
+        // 4.1.������������
+        enumeration(c, &stop);
+        
+        // 4.2.������������
+        c = class_getSuperclass(c);
+        
+        if ([MJFoundation isClassFromFoundation:c]) break;
+    }
+}
+
++ (void)mj_enumerateAllClasses:(MJClassesEnumeration)enumeration
+{
+    // 1.������block���������������
+    if (enumeration == nil) return;
+    
+    // 2.���������������������
+    BOOL stop = NO;
+    
+    // 3.������������������������
+    Class c = self;
+    
+    // 4.������������������������
+    while (c && !stop) {
+        // 4.1.������������
+        enumeration(c, &stop);
+        
+        // 4.2.������������
+        c = class_getSuperclass(c);
+    }
+}
+
+#pragma mark - ���������������������
++ (void)mj_setupIgnoredPropertyNames:(MJIgnoredPropertyNames)ignoredPropertyNames
+{
+    [self mj_setupBlockReturnValue:ignoredPropertyNames key:&MJIgnoredPropertyNamesKey];
+}
+
++ (NSMutableArray *)mj_totalIgnoredPropertyNames
+{
+    return [self mj_totalObjectsWithSelector:@selector(mj_ignoredPropertyNames) key:&MJIgnoredPropertyNamesKey];
+}
+
+#pragma mark - ���������������������������
++ (void)mj_setupIgnoredCodingPropertyNames:(MJIgnoredCodingPropertyNames)ignoredCodingPropertyNames
+{
+    [self mj_setupBlockReturnValue:ignoredCodingPropertyNames key:&MJIgnoredCodingPropertyNamesKey];
+}
+
++ (NSMutableArray *)mj_totalIgnoredCodingPropertyNames
+{
+    return [self mj_totalObjectsWithSelector:@selector(mj_ignoredCodingPropertyNames) key:&MJIgnoredCodingPropertyNamesKey];
+}
+
+#pragma mark - ���������������������
++ (void)mj_setupAllowedPropertyNames:(MJAllowedPropertyNames)allowedPropertyNames;
+{
+    [self mj_setupBlockReturnValue:allowedPropertyNames key:&MJAllowedPropertyNamesKey];
+}
+
++ (NSMutableArray *)mj_totalAllowedPropertyNames
+{
+    return [self mj_totalObjectsWithSelector:@selector(mj_allowedPropertyNames) key:&MJAllowedPropertyNamesKey];
+}
+
+#pragma mark - ���������������������������
++ (void)mj_setupAllowedCodingPropertyNames:(MJAllowedCodingPropertyNames)allowedCodingPropertyNames
+{
+    [self mj_setupBlockReturnValue:allowedCodingPropertyNames key:&MJAllowedCodingPropertyNamesKey];
+}
+
++ (NSMutableArray *)mj_totalAllowedCodingPropertyNames
+{
+    return [self mj_totalObjectsWithSelector:@selector(mj_allowedCodingPropertyNames) key:&MJAllowedCodingPropertyNamesKey];
+}
+
+#pragma mark - block���������������:������block������������
++ (void)mj_setupBlockReturnValue:(id (^)(void))block key:(const char *)key
+{
+    if (block) {
+        objc_setAssociatedObject(self, key, block(), OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    } else {
+        objc_setAssociatedObject(self, key, nil, OBJC_ASSOCIATION_RETAIN_NONATOMIC);
+    }
+    
+    // ������������
+    MJExtensionSemaphoreCreate
+    MJExtensionSemaphoreWait
+    [[self classDictForKey:key] removeAllObjects];
+    MJExtensionSemaphoreSignal
+}
+
++ (NSMutableArray *)mj_totalObjectsWithSelector:(SEL)selector key:(const char *)key
+{
+    MJExtensionSemaphoreCreate
+    MJExtensionSemaphoreWait
+    
+    NSMutableArray *array = [self classDictForKey:key][NSStringFromClass(self)];
+    if (array == nil) {
+        // ���������������
+        [self classDictForKey:key][NSStringFromClass(self)] = array = [NSMutableArray array];
+        
+        if ([self respondsToSelector:selector]) {
+    #pragma clang diagnostic push
+    #pragma clang diagnostic ignored "-Warc-performSelector-leaks"
+            NSArray *subArray = [self performSelector:selector];
+    #pragma clang diagnostic pop
+            if (subArray) {
+                [array addObjectsFromArray:subArray];
+            }
+        }
+        
+        [self mj_enumerateAllClasses:^(__unsafe_unretained Class c, BOOL *stop) {
+            NSArray *subArray = objc_getAssociatedObject(c, key);
+            [array addObjectsFromArray:subArray];
+        }];
+    }
+    
+    MJExtensionSemaphoreSignal
+    
+    return array;
+}
+@end

--
Gitblit v1.8.0