TapCommon-Unity/Plugins/iOS/TapCommonSDK.framework/Headers/TDSModelHelper.h

92 lines
2.5 KiB
C
Raw Normal View History

2022-07-25 16:02:45 +08:00
//
// TDSModelHelper.h
// TDSCommon
//
// Created by Insomnia on 2020/10/20.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#ifndef __TDSConst__
#define __TDSConst__
extern NSString *const TDSTypeInt;
extern NSString *const TDSTypeFloat;
extern NSString *const TDSTypeDouble;
extern NSString *const TDSTypeLong;
extern NSString *const TDSTypeLongLong;
extern NSString *const TDSTypeChar;
extern NSString *const TDSTypeBOOL;
extern NSString *const TDSTypePointer;
extern NSString *const TDSTypeIvar;
extern NSString *const TDSTypeMethod;
extern NSString *const TDSTypeBlock;
extern NSString *const TDSTypeClass;
extern NSString *const TDSTypeSEL;
extern NSString *const TDSTypeId;
#endif
@interface TDSPropertyType : NSObject
/** 类型标识符 */
@property (nonatomic, copy) NSString *code;
/** 是否为id类型 */
@property (nonatomic, readonly, getter=isIdType) BOOL idType;
/** 对象类型如果是基本数据类型此值为nil */
@property (nonatomic, readonly) Class typeClass;
/** 类型是否来自于Foundation框架比如NSString、NSArray */
@property (nonatomic, readonly, getter = isFromFoundation) BOOL fromFoundation;
/** 类型是否不支持KVC */
@property (nonatomic, readonly, getter = isKVCDisabled) BOOL KVCDisabled;
/**
*
*/
+ (instancetype)cachedTypeWithCode:(NSString *)code;
@end
@interface TDSProperty : NSObject
/** 成员属性 */
@property (nonatomic, assign) objc_property_t property;
/** 成员属性名 */
@property (nonatomic, readonly) NSString *name;
/** 成员变量的类型 */
@property (nonatomic, readonly) TDSPropertyType *type;
/** 成员来源于哪个类(可能是父类) */
@property (nonatomic, assign) Class srcClass;
/**** 同一个成员变量 - 父类和子类的行为可能不一致key、keys、objectClassInArray ****/
/** 对应着字典中的key */
- (void)setKey:(NSString *)key forClass:(Class)c;
- (NSString *)keyFromClass:(Class)c;
/** 对应着字典中的多级key */
- (NSArray *)keysFromClass:(Class)c;
/** 模型数组中的模型类型 */
- (void)setObjectClassInArray:(Class)objectClass forClass:(Class)c;
- (Class)objectClassInArrayFromClass:(Class)c;
/**** 同一个成员变量 - 父类和子类的行为可能不一致key、keys、objectClassInArray ****/
/**
*
*/
- (void)setValue:(id)value forObject:(id)object;
/**
*
*/
- (id)valueFromObject:(id)object;
/**
*
*/
+ (instancetype)cachedPropertyWithProperty:(objc_property_t)property;
@end