]>
Commit | Line | Data |
---|---|---|
23324ae1 | 1 | ///////////////////////////////////////////////////////////////////////////// |
7c913512 | 2 | // Name: defs.h |
e54c96f1 | 3 | // Purpose: interface of global functions |
7c913512 FM |
4 | // Author: wxWidgets team |
5 | // RCS-ID: $Id$ | |
6 | // Licence: wxWindows license | |
7 | ///////////////////////////////////////////////////////////////////////////// | |
8 | ||
9 | //@{ | |
23324ae1 | 10 | /** |
4cc4bfaf | 11 | These macros will swap the bytes of the @a value variable from little |
23324ae1 FM |
12 | endian to big endian or vice versa unconditionally, i.e. independently of the |
13 | current platform. | |
14 | */ | |
15 | wxInt32 wxINT32_SWAP_ALWAYS(wxInt32 value); | |
7c913512 FM |
16 | wxUint32 wxUINT32_SWAP_ALWAYS(wxUint32 value); |
17 | wxInt16 wxINT16_SWAP_ALWAYS(wxInt16 value); | |
18 | wxUint16 wxUINT16_SWAP_ALWAYS(wxUint16 value); | |
23324ae1 FM |
19 | //@} |
20 | ||
21 | ||
7c913512 | 22 | //@{ |
23324ae1 | 23 | /** |
4cc4bfaf | 24 | This macro will swap the bytes of the @a value variable from little |
23324ae1 FM |
25 | endian to big endian or vice versa if the program is compiled on a |
26 | little-endian architecture (such as Intel PCs). If the program has | |
27 | been compiled on a big-endian architecture, the value will be unchanged. | |
23324ae1 FM |
28 | Use these macros to read data from and write data to a file that stores |
29 | data in big-endian format. | |
30 | */ | |
31 | wxInt32 wxINT32_SWAP_ON_LE(wxInt32 value); | |
7c913512 FM |
32 | wxUint32 wxUINT32_SWAP_ON_LE(wxUint32 value); |
33 | wxInt16 wxINT16_SWAP_ON_LE(wxInt16 value); | |
34 | wxUint16 wxUINT16_SWAP_ON_LE(wxUint16 value); | |
23324ae1 FM |
35 | //@} |
36 | ||
37 | /** | |
e54c96f1 | 38 | This macro is similar to wxDEPRECATED() but can be used |
4cc4bfaf | 39 | to not only declare the function @a func as deprecated but to also provide |
23324ae1 | 40 | its (inline) implementation @e body. |
23324ae1 | 41 | It can be used as following: |
7c913512 | 42 | |
23324ae1 FM |
43 | @code |
44 | class wxFoo | |
45 | { | |
46 | public: | |
47 | // OldMethod() is deprecated, use NewMethod() instead | |
48 | void NewMethod(); | |
49 | wxDEPRECATED_INLINE( void OldMethod(), NewMethod() ); | |
50 | }; | |
51 | @endcode | |
52 | */ | |
4cc4bfaf | 53 | #define wxDEPRECATED_INLINE(func, body) /* implementation is private */ |
23324ae1 FM |
54 | |
55 | /** | |
56 | @c wxEXPLICIT is a macro which expands to the C++ @c explicit keyword if | |
57 | the compiler supports it or nothing otherwise. Thus, it can be used even in the | |
58 | code which might have to be compiled with an old compiler without support for | |
59 | this language feature but still take advantage of it when it is available. | |
60 | */ | |
61 | ||
62 | ||
63 | /** | |
64 | GNU C++ compiler gives a warning for any class whose destructor is private | |
65 | unless it has a friend. This warning may sometimes be useful but it doesn't | |
66 | make sense for reference counted class which always delete themselves (hence | |
67 | destructor should be private) but don't necessarily have any friends, so this | |
4cc4bfaf | 68 | macro is provided to disable the warning in such case. The @a name parameter |
23324ae1 FM |
69 | should be the name of the class but is only used to construct a unique friend |
70 | class name internally. Example of using the macro: | |
4cc4bfaf | 71 | |
23324ae1 FM |
72 | @code |
73 | class RefCounted | |
74 | { | |
75 | public: | |
76 | RefCounted() { m_nRef = 1; } | |
77 | void IncRef() { m_nRef++ ; } | |
78 | void DecRef() { if ( !--m_nRef ) delete this; } | |
7c913512 | 79 | |
23324ae1 FM |
80 | private: |
81 | ~RefCounted() { } | |
7c913512 | 82 | |
23324ae1 FM |
83 | wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted) |
84 | }; | |
85 | @endcode | |
7c913512 | 86 | |
23324ae1 FM |
87 | Notice that there should be no semicolon after this macro. |
88 | */ | |
89 | #define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name) /* implementation is private */ | |
90 | ||
91 | //@{ | |
92 | /** | |
4cc4bfaf | 93 | This macro will swap the bytes of the @a value variable from little |
23324ae1 FM |
94 | endian to big endian or vice versa if the program is compiled on a |
95 | big-endian architecture (such as Sun work stations). If the program has | |
96 | been compiled on a little-endian architecture, the value will be unchanged. | |
23324ae1 FM |
97 | Use these macros to read data from and write data to a file that stores |
98 | data in little-endian (for example Intel i386) format. | |
99 | */ | |
100 | wxInt32 wxINT32_SWAP_ON_BE(wxInt32 value); | |
7c913512 FM |
101 | wxUint32 wxUINT32_SWAP_ON_BE(wxUint32 value); |
102 | wxInt16 wxINT16_SWAP_ON_BE(wxInt16 value); | |
103 | wxUint16 wxUINT16_SWAP_ON_BE(wxUint16 value); | |
23324ae1 FM |
104 | //@} |
105 | ||
106 | /** | |
107 | This macro can be used around a function declaration to generate warnings | |
108 | indicating that this function is deprecated (i.e. obsolete and planned to be | |
109 | removed in the future) when it is used. Only Visual C++ 7 and higher and g++ | |
110 | compilers currently support this functionality. | |
23324ae1 | 111 | Example of use: |
7c913512 | 112 | |
23324ae1 FM |
113 | @code |
114 | // old function, use wxString version instead | |
115 | wxDEPRECATED( void wxGetSomething(char *buf, size_t len) ); | |
7c913512 | 116 | |
23324ae1 FM |
117 | // ... |
118 | wxString wxGetSomething(); | |
119 | @endcode | |
120 | */ | |
121 | ||
122 | ||
123 | /** | |
124 | This macro is the same as the standard C99 @c va_copy for the compilers | |
125 | which support it or its replacement for those that don't. It must be used to | |
126 | preserve the value of a @c va_list object if you need to use it after | |
127 | passing it to another function because it can be modified by the latter. | |
23324ae1 FM |
128 | As with @c va_start, each call to @c wxVaCopy must have a matching |
129 | @c va_end. | |
130 | */ | |
131 | void wxVaCopy(va_list argptrDst, va_list argptrSrc); | |
132 | ||
133 | /** | |
e54c96f1 | 134 | This is a special version of wxDEPRECATED() macro which |
23324ae1 FM |
135 | only does something when the deprecated function is used from the code outside |
136 | wxWidgets itself but doesn't generate warnings when it is used from wxWidgets. | |
137 | It is used with the virtual functions which are called by the library itself -- | |
138 | even if such function is deprecated the library still has to call it to ensure | |
139 | that the existing code overriding it continues to work, but the use of this | |
140 | macro ensures that a deprecation warning will be generated if this function is | |
141 | used from the user code or, in case of Visual C++, even when it is simply | |
142 | overridden. | |
143 | */ | |
144 | ||
145 |