-
Notifications
You must be signed in to change notification settings - Fork 1.3k
/
Copy pathNSObject+ObjectMap.h
executable file
·56 lines (42 loc) · 1.32 KB
/
NSObject+ObjectMap.h
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
//
// NSObject+ObjectMap.h
/// CSBase
//
// Created by Mr Right on 13-11-13.
// Copyright (c) 2013年 csair. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <objc/runtime.h>
#define OMDateFormat @"yyyy-MM-dd'T'HH:mm:ss.SSS"
#define OMTimeZone @"UTC"
#define EADateFormat @"yyyy-MM-dd HH:mm:ss"
@interface NSObject (ObjectMap)
// Universal Method
-(NSDictionary *)propertyDictionary;
-(NSString *)nameOfClass;
// id -> Object
+(id)objectOfClass:(NSString *)object fromJSON:(NSDictionary *)dict;
+(NSMutableArray *)arrayFromJSON:(NSArray *)jsonArray ofObjects:(NSString *)obj;
//Object -> Data
-(NSDictionary *)objectDictionary;
-(NSData *)JSONData;
-(NSString *)JSONString;
// XML-SOAP
-(NSData *)XMLData;
-(NSString *)XMLString;
-(NSData *)SOAPData;
-(NSString *)SOAPString;
+(id)objectOfClass:(NSString *)object fromXML:(NSString *)xml;
// For mapping an array to properties
-(NSMutableDictionary *)getpropertyArrayMap;
// Copying an NSObject to new memory ref
// (basically initWithObject)
//-(id)initWithObject:(NSObject *)oldObject error:(NSError **)error;
// Base64 Encode/Decode
+(NSString *)encodeBase64WithData:(NSData *)objData;
+(NSData *)base64DataFromString:(NSString *)string;
@end
@interface SOAPObject : NSObject
@property (nonatomic, retain) id Header;
@property (nonatomic, retain) id Body;
@end