NSDictionary+YOHO.h
2.37 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
//
// NSDictionary+YOHO.h
// YH_Marketplace
//
// Created by Liu Xiangchao on 7/15/14.
// Copyright (c) 2014 YOHO. All rights reserved.
//
#import <Foundation/Foundation.h>
@interface NSDictionary (YOHO)
/**
@brief 获取key对应的value对象
@param path key值,可以为嵌套key
@return 指定key对应的对象
@since 3.1
*/
- (id)yh_objectForPath:(NSString *)path;
/**
@brief 获取key对应的字符串对象,支持嵌套路径
@param path 路径
@return 对应字符串
@since 3.1
*/
- (NSString *)yh_stringForPath:(NSString *) path;
/**
@brief 获取key对应的字典对象
@param key key值
@return 对应字典
@since 3.1
*/
- (NSDictionary *)yh_dictForKey:(id)key;
/**
@brief 获取key对应的字典对象
@param key key值
@return 对应字典
@since 3.1
*/
- (NSArray *)yh_arrayForKey:(id)key;
/**
@brief 获取key对应的字符串对象
@param key key值,可以为嵌套key
@return key对应的字符串
@since 3.1
*/
- (NSString *)yh_stringForKey:(id)key;
/**
@brief 获取key对应的bool值
@param key key值,可以为嵌套key
@return key对应的对象bool值
@since 3.1
*/
- (BOOL)yh_boolForKey:(NSString *)key;
/**
@brief 获取key对应的整形值
@param key key值,可以为嵌套key
@return key对应的对象interger值
@since 3.1
*/
- (NSInteger)yh_integerForKey:(NSString *)key;
/**
@brief 获取key对应的long型值
@param key key值,可以为嵌套key
@return key对应的对象long值
@since 3.1
*/
- (long)yh_longForKey:(NSString *)key;
/**
@brief 获取key对应的longlong型值
@param key key值,可以为嵌套key
@return key对应的对象longlong值
@since 3.1
*/
- (long long)yh_longlongForKey:(NSString *)key;
/**
@brief 获取key对应的float值
@param key key值,可以为嵌套key
@return key对应的对象float值
@since 3.1
*/
- (float)yh_floatForKey:(NSString *)key;
/**
@brief 获取key对应的double型值
@param key key值,可以为嵌套key
@return key对应的对象double值
@since 3.1
*/
- (double)yh_doubleForKey:(NSString *)key;
/**
@brief 字典本身深拷贝
@return 拷贝的字典
@since 3.1
*/
- (NSMutableDictionary *)yh_mutableDeepCopy;
/**
@brief 将字段对象转换为json 字符串
@return json字符串
@since 3.1
*/
- (NSString *)yh_asJSONString;
@end