|
| 1 | +// |
| 2 | +// other.h |
| 3 | +// MJExtensionExample |
| 4 | +// |
| 5 | +// Created by MJ Lee on 15/1/22. |
| 6 | +// Copyright (c) 2015年 小码哥. All rights reserved. |
| 7 | +// |
| 8 | + |
| 9 | +#ifndef MJExtensionExample_other_h |
| 10 | +#define MJExtensionExample_other_h |
| 11 | + |
| 12 | + |
| 13 | +/** 函数的声明(只用于此示例程序,仅仅是为了演示框架的使用) */ |
| 14 | +void keyValues2object(void); |
| 15 | +void keyValues2object1(void); |
| 16 | +void keyValues2object2(void); |
| 17 | +void keyValues2object3(void); |
| 18 | +void keyValues2object4(void); |
| 19 | +void keyValuesArray2objectArray(void); |
| 20 | +void object2keyValues(void); |
| 21 | +void objectArray2keyValuesArray(void); |
| 22 | +void coreData(void); |
| 23 | +void coding(void); |
| 24 | +void replacedKeyFromPropertyName121(void); |
| 25 | +void newValueFromOldValue(void); |
| 26 | +void logAllProperties(void); |
| 27 | +void execute(void (*fn)(void), NSString *comment); |
| 28 | + |
| 29 | +#endif |
| 30 | + |
| 31 | + |
| 32 | + |
| 33 | +/** |
| 34 | +
|
| 35 | +10:37:46.793352+0800 MJExtensionExample[8319:103189] [******************简单的字典 -> 模型******************开始] |
| 36 | +10:37:46.810547+0800 MJExtensionExample[8319:103189] name=Jack, icon=lufy.png, age=20, height=1.55, money=100.9, sex=1, gay=1 |
| 37 | +10:37:46.810751+0800 MJExtensionExample[8319:103189] [******************简单的字典 -> 模型******************结尾] |
| 38 | +
|
| 39 | +10:37:46.810868+0800 MJExtensionExample[8319:103189] [******************JSON字符串 -> 模型******************开始] |
| 40 | +10:37:46.811514+0800 MJExtensionExample[8319:103189] name=Jack, icon=lufy.png, age=20, height=333333.7 |
| 41 | +10:37:46.811658+0800 MJExtensionExample[8319:103189] [******************JSON字符串 -> 模型******************结尾] |
| 42 | +
|
| 43 | +10:37:46.811810+0800 MJExtensionExample[8319:103189] [******************复杂的字典 -> 模型 (模型里面包含了模型)******************开始] |
| 44 | +10:37:46.812705+0800 MJExtensionExample[8319:103189] text=是啊,今天天气确实不错!, name=Jack, icon=lufy.png |
| 45 | +10:37:46.812868+0800 MJExtensionExample[8319:103189] text2=今天天气真不错!, name2=Rose, icon2=nami.png |
| 46 | +10:37:46.813003+0800 MJExtensionExample[8319:103189] [******************复杂的字典 -> 模型 (模型里面包含了模型)******************结尾] |
| 47 | +
|
| 48 | +10:37:46.813169+0800 MJExtensionExample[8319:103189] [******************复杂的字典 -> 模型 (模型的数组属性里面又装着模型)******************开始] |
| 49 | +10:37:46.814295+0800 MJExtensionExample[8319:103189] totalNumber=2014, previousCursor=13476589, nextCursor=13476599 |
| 50 | +10:37:46.814470+0800 MJExtensionExample[8319:103189] text=今天天气真不错!, name=Rose, icon=nami.png |
| 51 | +10:37:46.814850+0800 MJExtensionExample[8319:103189] text=明天去旅游了, name=Jack, icon=lufy.png |
| 52 | +10:37:46.815104+0800 MJExtensionExample[8319:103189] image=ad01.png, url=http://www.%E5%B0%8F%E7%A0%81%E5%93%A5ad01.com |
| 53 | +10:37:46.815277+0800 MJExtensionExample[8319:103189] image=ad02.png, url=http://www.%E5%B0%8F%E7%A0%81%E5%93%A5ad02.com |
| 54 | +10:37:46.815539+0800 MJExtensionExample[8319:103189] [******************复杂的字典 -> 模型 (模型的数组属性里面又装着模型)******************结尾] |
| 55 | +
|
| 56 | +10:37:46.815705+0800 MJExtensionExample[8319:103189] [******************简单的字典 -> 模型(key替换,比如ID和id,支持多级映射)******************开始] |
| 57 | +10:37:46.817504+0800 MJExtensionExample[8319:103189] ID=20, desc=好孩子, otherName=lufy, oldName=kitty, nowName=lufy, nameChangedTime=2013-08-07 |
| 58 | +10:37:46.817670+0800 MJExtensionExample[8319:103189] bagName=小书包, bagPrice=100.700000 |
| 59 | +10:37:46.817845+0800 MJExtensionExample[8319:103189] [******************简单的字典 -> 模型(key替换,比如ID和id,支持多级映射)******************结尾] |
| 60 | +
|
| 61 | +10:37:46.818092+0800 MJExtensionExample[8319:103189] [******************字典数组 -> 模型数组******************开始] |
| 62 | +10:37:46.818365+0800 MJExtensionExample[8319:103189] name=Jack, icon=lufy.png |
| 63 | +10:37:46.818505+0800 MJExtensionExample[8319:103189] name=Rose, icon=nami.png |
| 64 | +10:37:46.818649+0800 MJExtensionExample[8319:103189] [******************字典数组 -> 模型数组******************结尾] |
| 65 | +
|
| 66 | +10:37:46.818822+0800 MJExtensionExample[8319:103189] [******************模型转字典******************开始] |
| 67 | +10:37:46.819710+0800 MJExtensionExample[8319:103189] { |
| 68 | + text = "\U4eca\U5929\U7684\U5fc3\U60c5\U4e0d\U9519\Uff01"; |
| 69 | + user = { |
| 70 | + age = 0; |
| 71 | + gay = 0; |
| 72 | + icon = "lufy.png"; |
| 73 | + name = Jack; |
| 74 | + sex = 0; |
| 75 | + }; |
| 76 | +} |
| 77 | +10:37:46.819929+0800 MJExtensionExample[8319:103189] { |
| 78 | + text = "\U4eca\U5929\U7684\U5fc3\U60c5\U4e0d\U9519\Uff01"; |
| 79 | +} |
| 80 | +10:37:46.820574+0800 MJExtensionExample[8319:103189] { |
| 81 | + books = ( |
| 82 | + "Good book", |
| 83 | + "Red book" |
| 84 | + ); |
| 85 | + desciption = handsome; |
| 86 | + id = 123; |
| 87 | + name = { |
| 88 | + info = ( |
| 89 | + "<null>", |
| 90 | + { |
| 91 | + nameChangedTime = "2018-09-08"; |
| 92 | + } |
| 93 | + ); |
| 94 | + newName = jack; |
| 95 | + oldName = rose; |
| 96 | + }; |
| 97 | + other = { |
| 98 | + bag = { |
| 99 | + name = "\U5c0f\U4e66\U5305"; |
| 100 | + price = 205; |
| 101 | + }; |
| 102 | + }; |
| 103 | +} |
| 104 | +10:37:46.820878+0800 MJExtensionExample[8319:103189] { |
| 105 | + books = ( |
| 106 | + "Good book", |
| 107 | + "Red book" |
| 108 | + ); |
| 109 | + desciption = handsome; |
| 110 | + id = 123; |
| 111 | + name = { |
| 112 | + info = ( |
| 113 | + "<null>", |
| 114 | + { |
| 115 | + nameChangedTime = "2018-09-08"; |
| 116 | + } |
| 117 | + ); |
| 118 | + }; |
| 119 | +} |
| 120 | +10:37:46.821454+0800 MJExtensionExample[8319:103189] {"id":"123","other":{"bag":{"name":"小书包","price":205}},"books":["Good book","Red book"],"name":{"newName":"jack","oldName":"rose","info":[null,{"nameChangedTime":"2018-09-08"}]},"desciption":"handsome"} |
| 121 | +10:37:46.821841+0800 MJExtensionExample[8319:103189] |
| 122 | +模型转字典时,字典的key参考replacedKeyFromPropertyName等方法: |
| 123 | +{ |
| 124 | + ID = 123; |
| 125 | + bag = { |
| 126 | + name = "\U5c0f\U4e66\U5305"; |
| 127 | + price = 205; |
| 128 | + }; |
| 129 | + books = ( |
| 130 | + "Good book", |
| 131 | + "Red book" |
| 132 | + ); |
| 133 | + desc = handsome; |
| 134 | + nameChangedTime = "2018-09-08"; |
| 135 | + nowName = jack; |
| 136 | + oldName = rose; |
| 137 | +} |
| 138 | +10:37:46.821998+0800 MJExtensionExample[8319:103189] [******************模型转字典******************结尾] |
| 139 | +
|
| 140 | +10:37:46.822140+0800 MJExtensionExample[8319:103189] [******************模型数组 -> 字典数组******************开始] |
| 141 | +10:37:46.822807+0800 MJExtensionExample[8319:103189] ( |
| 142 | + { |
| 143 | + age = 0; |
| 144 | + gay = 0; |
| 145 | + icon = "lufy.png"; |
| 146 | + name = Jack; |
| 147 | + sex = 0; |
| 148 | + }, |
| 149 | + { |
| 150 | + age = 0; |
| 151 | + gay = 0; |
| 152 | + icon = "nami.png"; |
| 153 | + name = Rose; |
| 154 | + sex = 0; |
| 155 | + } |
| 156 | + ) |
| 157 | +10:37:46.823033+0800 MJExtensionExample[8319:103189] [******************模型数组 -> 字典数组******************结尾] |
| 158 | +
|
| 159 | +10:37:46.823381+0800 MJExtensionExample[8319:103189] [******************CoreData示例******************开始] |
| 160 | +10:37:46.823937+0800 MJExtensionExample[8319:103189] name=Jack, icon=lufy.png, age=20, height=1.55, money=100.9, sex=1, gay=1 |
| 161 | +10:37:46.824124+0800 MJExtensionExample[8319:103189] [******************CoreData示例******************结尾] |
| 162 | +
|
| 163 | +10:37:46.824681+0800 MJExtensionExample[8319:103189] [******************NSCoding示例******************开始] |
| 164 | +10:37:46.826849+0800 MJExtensionExample[8319:103189] name=(null), price=200.800000 |
| 165 | +10:37:46.827046+0800 MJExtensionExample[8319:103189] [******************NSCoding示例******************结尾] |
| 166 | +
|
| 167 | +10:37:46.827982+0800 MJExtensionExample[8319:103189] [******************统一转换属性名(比如驼峰转下划线)******************开始] |
| 168 | +10:37:46.828863+0800 MJExtensionExample[8319:103189] nickName=旺财, scalePrice=10.500000 runSpeed=100.900000 |
| 169 | +10:37:46.829026+0800 MJExtensionExample[8319:103189] [******************统一转换属性名(比如驼峰转下划线)******************结尾] |
| 170 | +
|
| 171 | +10:37:46.829150+0800 MJExtensionExample[8319:103189] [******************过滤字典的值(比如字符串日期处理为NSDate、字符串nil处理为@)******************开始] |
| 172 | +10:37:46.832763+0800 MJExtensionExample[8319:103189] name=5分钟突破iOS开发, publisher=, publishedTime=Sat Sep 10 00:00:00 2011 |
| 173 | +10:37:46.832929+0800 MJExtensionExample[8319:103189] [******************过滤字典的值(比如字符串日期处理为NSDate、字符串nil处理为@)******************结尾] |
| 174 | +
|
| 175 | +10:37:46.833046+0800 MJExtensionExample[8319:103189] [******************使用MJExtensionLog打印模型的所有属性******************开始] |
| 176 | +10:37:46.833850+0800 MJExtensionExample[8319:103189] { |
| 177 | + age = 10; |
| 178 | + gay = 0; |
| 179 | + icon = "test.png"; |
| 180 | + name = MJ; |
| 181 | + sex = 0; |
| 182 | +} |
| 183 | +10:37:46.834022+0800 MJExtensionExample[8319:103189] [******************使用MJExtensionLog打印模型的所有属性******************结尾] |
| 184 | +
|
| 185 | + */ |
| 186 | + |
| 187 | + |
| 188 | + |
| 189 | + |
| 190 | + |
| 191 | + |
| 192 | + |
| 193 | + |
0 commit comments