-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDKJSON.h
More file actions
61 lines (41 loc) · 1.5 KB
/
Copy pathDKJSON.h
File metadata and controls
61 lines (41 loc) · 1.5 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
// =======================================================================================
//
// DKJSON.h
// Duck Object Library -- See LICENSE for legal information.
//
// Copyright (c) 2014-2026 Derek W. Nylen
//
// =======================================================================================
#ifndef _DK_JSON_H_
#define _DK_JSON_H_
#ifdef __cplusplus
extern "C"
{
#endif
enum
{
DKJSONWritePretty = (1 << 0),
DKJSONWriteSorted = (1 << 1),
DKJSONVectorSyntaxExtension = (1 << 2),
DKJSONVectorRead32BitTypes = (1 << 3),
DKJSONObjectSerialization = (1 << 4)
};
DK_API int DKJSONWrite( DKStreamRef stream, DKObjectRef object, int options );
DK_API DKObjectRef DKJSONParseEx( DKStringRef json, int options, DKStringRef * error );
#define DKJSONParse( json, options ) DKJSONParseEx( json, options, NULL )
// JSON Serialization
DK_API DKDeclareInterfaceSelector( JSONSerialization );
#define DKJSONSerializationClassNameKey DKSTR( "__class__" )
typedef DKObjectRef (*DKInitWithJSONObjectMethod)( DKObjectRef _self, DKDictionaryRef jsonObject );
typedef void (*DKWriteJSONObjectMethod)( DKObjectRef _self, DKMutableDictionaryRef jsonObject );
struct DKJSONSerializationInterface
{
const DKInterface _interface;
DKInitWithJSONObjectMethod initWithJSONObject;
DKWriteJSONObjectMethod writeJSONObject;
};
typedef const struct DKJSONSerializationInterface * DKJSONSerializationInterfaceRef;
#ifdef __cplusplus
}
#endif
#endif // _DK_JSON_H_