-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathclassdesc_access.h
49 lines (42 loc) · 1.68 KB
/
classdesc_access.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
/*
@copyright Russell Standish 2000-2013
@author Russell Standish
This file is part of Classdesc
Open source licensed under the MIT license. See LICENSE for details.
*/
#ifndef CLASSDESC_ACCESS
/**\file
\brief descriptor access to a class's privates
*/
namespace classdesc
{
template <class T> struct base_cast;
}
namespace classdesc_access
{
template <class T> struct access_pack;
template <class T> struct access_unpack;
template <class T> struct access_xml_pack;
template <class T> struct access_xml_unpack;
template <class T, class Enable> struct access_json_pack;
template <class T, class Enable> struct access_json_unpack;
template <class T> struct access_random_init;
}
/// add friend statements for each accessor function
/**
This declaration is necessary for classes with private/protected
parts and descriptors where -respect_private has not been specified
@param type the name of the enclosing class
*/
#define CLASSDESC_ACCESS(type) \
template <class _CD_ARG_TYPE> friend struct classdesc::base_cast; \
friend struct classdesc_access::access_pack<type>; \
friend struct classdesc_access::access_unpack<type>; \
friend struct classdesc_access::access_xml_pack<type>; \
friend struct classdesc_access::access_xml_unpack<type>; \
friend struct classdesc_access::access_json_pack<type,void>; \
friend struct classdesc_access::access_json_unpack<type,void>; \
friend struct classdesc_access::access_random_init<type>
// for backward compatibility. Deprecated.
#define CLASSDESC_ACCESS_TEMPLATE(type) CLASSDESC_ACCESS(type)
#endif