]> git.saurik.com Git - wxWidgets.git/blob - include/wx/cpp.h
WXIMPORT must specify default visibility too, otherwise things like typeinfo may...
[wxWidgets.git] / include / wx / cpp.h
1 /*
2 * Name: wx/cpp.h
3 * Purpose: Various preprocessor helpers
4 * Author: Vadim Zeitlin
5 * Created: 2006-09-30
6 * RCS-ID: $Id$
7 * Copyright: (c) 2006 Vadim Zeitlin <vadim@wxwindows.org>
8 * Licence: wxWindows licence
9 */
10
11 /* THIS IS A C FILE, DON'T USE C++ FEATURES (IN PARTICULAR COMMENTS) IN IT */
12
13 #ifndef _WX_CPP_H_
14 #define _WX_CPP_H_
15
16 /* wxCONCAT works like preprocessor ## operator but also works with macros */
17 #define wxCONCAT_HELPER(text, line) text ## line
18 #define wxCONCAT(text, line) wxCONCAT_HELPER(text, line)
19
20 /* wxSTRINGIZE works as the preprocessor # operator but also works with macros */
21 #define wxSTRINGIZE_HELPER(x) #x
22 #define wxSTRINGIZE(x) wxSTRINGIZE_HELPER(x)
23
24 /* a Unicode-friendly version of wxSTRINGIZE_T */
25 #define wxSTRINGIZE_T(x) wxAPPLY_T(wxSTRINGIZE(x))
26
27 /*
28 Helper macros for wxMAKE_UNIQUE_NAME: normally this works by appending the
29 current line number to the given identifier to reduce the probability of the
30 conflict (it may still happen if this is used in the headers, hence you
31 should avoid doing it or provide unique prefixes then) but we have to do it
32 differently for VC++
33 */
34 #if defined(__VISUALC__) && (__VISUALC__ >= 1300)
35 /*
36 __LINE__ handling is completely broken in VC++ when using "Edit and
37 Continue" (/ZI option) and results in preprocessor errors if we use it
38 inside the macros. Luckily VC7 has another standard macro which can be
39 used like this and is even better than __LINE__ because it is globally
40 unique.
41 */
42 # define wxCONCAT_LINE(text) wxCONCAT(text, __COUNTER__)
43 #else /* normal compilers */
44 # define wxCONCAT_LINE(text) wxCONCAT(text, __LINE__)
45 #endif
46
47 /* Create a "unique" name with the given prefix */
48 #define wxMAKE_UNIQUE_NAME(text) wxCONCAT_LINE(text)
49
50 /*
51 This macro can be passed as argument to another macro when you don't have
52 anything to pass in fact.
53 */
54 #define wxEMPTY_PARAMETER_VALUE /* Fake macro parameter value */
55
56 #endif /* _WX_CPP_H_ */
57