2008-03-08 13:52:38 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
2008-03-08 14:43:31 +00:00
|
|
|
// Name: defs.h
|
2008-03-10 15:24:38 +00:00
|
|
|
// Purpose: interface of global functions
|
2008-03-08 14:43:31 +00:00
|
|
|
// Author: wxWidgets team
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Licence: wxWindows license
|
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
2008-03-15 03:14:51 +00:00
|
|
|
/** @ingroup group_funcmacro_byteorder */
|
2008-03-08 14:43:31 +00:00
|
|
|
//@{
|
2008-03-15 03:14:51 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-03-15 03:14:51 +00:00
|
|
|
This macro will swap the bytes of the @a value variable from little endian
|
|
|
|
to big endian or vice versa unconditionally, i.e. independently of the
|
2008-03-08 13:52:38 +00:00
|
|
|
current platform.
|
2008-03-15 03:14:51 +00:00
|
|
|
|
|
|
|
@header{wx/defs.h}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-15 03:14:51 +00:00
|
|
|
#define wxINT32_SWAP_ALWAYS( wxInt32 value )
|
|
|
|
#define wxUINT32_SWAP_ALWAYS( wxUint32 value )
|
|
|
|
#define wxINT16_SWAP_ALWAYS( wxInt16 value )
|
|
|
|
#define wxUINT16_SWAP_ALWAYS( wxUint16 value )
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
2008-03-15 03:14:51 +00:00
|
|
|
/** @ingroup group_funcmacro_byteorder */
|
|
|
|
//@{
|
|
|
|
|
|
|
|
/**
|
|
|
|
This macro will swap the bytes of the @a value variable from little endian
|
|
|
|
to big endian or vice versa if the program is compiled on a big-endian
|
|
|
|
architecture (such as Sun work stations). If the program has been compiled
|
|
|
|
on a little-endian architecture, the value will be unchanged.
|
|
|
|
|
|
|
|
Use these macros to read data from and write data to a file that stores
|
|
|
|
data in little-endian (for example Intel i386) format.
|
|
|
|
|
|
|
|
@header{wx/defs.h}
|
|
|
|
*/
|
|
|
|
#define wxINT32_SWAP_ON_BE( wxInt32 value )
|
|
|
|
#define wxUINT32_SWAP_ON_BE( wxUint32 value )
|
|
|
|
#define wxINT16_SWAP_ON_BE( wxInt16 value )
|
|
|
|
#define wxUINT16_SWAP_ON_BE( wxUint16 value )
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-15 03:14:51 +00:00
|
|
|
//@}
|
|
|
|
|
|
|
|
/** @ingroup group_funcmacro_byteorder */
|
2008-03-08 14:43:31 +00:00
|
|
|
//@{
|
2008-03-15 03:14:51 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-03-15 03:14:51 +00:00
|
|
|
This macro will swap the bytes of the @a value variable from little endian
|
|
|
|
to big endian or vice versa if the program is compiled on a little-endian
|
|
|
|
architecture (such as Intel PCs). If the program has been compiled on a
|
|
|
|
big-endian architecture, the value will be unchanged.
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Use these macros to read data from and write data to a file that stores
|
|
|
|
data in big-endian format.
|
2008-03-15 03:14:51 +00:00
|
|
|
|
|
|
|
@header{wx/defs.h}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-15 03:14:51 +00:00
|
|
|
#define wxINT32_SWAP_ON_LE( wxInt32 value )
|
|
|
|
#define wxUINT32_SWAP_ON_LE( wxUint32 value )
|
|
|
|
#define wxINT16_SWAP_ON_LE( wxInt16 value )
|
|
|
|
#define wxUINT16_SWAP_ON_LE( wxUint16 value )
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
//@}
|
|
|
|
|
2008-03-15 03:14:51 +00:00
|
|
|
|
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
/** @ingroup group_funcmacro_misc */
|
|
|
|
//@{
|
2008-03-15 03:14:51 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
/**
|
2008-03-23 18:24:32 +00:00
|
|
|
This macro can be used around a function declaration to generate warnings
|
|
|
|
indicating that this function is deprecated (i.e. obsolete and planned to
|
|
|
|
be removed in the future) when it is used. Only Visual C++ 7 and higher and
|
|
|
|
g++ compilers currently support this functionality.
|
|
|
|
|
|
|
|
Example of use:
|
|
|
|
|
|
|
|
@code
|
|
|
|
// old function, use wxString version instead
|
|
|
|
wxDEPRECATED( void wxGetSomething(char *buf, size_t len) );
|
|
|
|
|
|
|
|
// ...
|
|
|
|
wxString wxGetSomething();
|
|
|
|
@endcode
|
|
|
|
|
|
|
|
@header{wx/defs.h}
|
|
|
|
*/
|
|
|
|
#define wxDEPRECATED(function)
|
|
|
|
|
|
|
|
/**
|
|
|
|
This is a special version of wxDEPRECATED() macro which only does something
|
|
|
|
when the deprecated function is used from the code outside wxWidgets itself
|
|
|
|
but doesn't generate warnings when it is used from wxWidgets.
|
|
|
|
|
|
|
|
It is used with the virtual functions which are called by the library
|
|
|
|
itself -- even if such function is deprecated the library still has to call
|
|
|
|
it to ensure that the existing code overriding it continues to work, but
|
|
|
|
the use of this macro ensures that a deprecation warning will be generated
|
|
|
|
if this function is used from the user code or, in case of Visual C++, even
|
|
|
|
when it is simply overridden.
|
|
|
|
|
|
|
|
@header{wx/defs.h}
|
|
|
|
*/
|
|
|
|
#define wxDEPRECATED_BUT_USED_INTERNALLY(function)
|
|
|
|
|
|
|
|
/**
|
|
|
|
This macro is similar to wxDEPRECATED() but can be used to not only declare
|
|
|
|
the function @a function as deprecated but to also provide its (inline)
|
|
|
|
implementation @a body.
|
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
It can be used as following:
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
|
|
|
class wxFoo
|
2008-03-23 18:24:32 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
// OldMethod() is deprecated, use NewMethod() instead
|
|
|
|
void NewMethod();
|
|
|
|
wxDEPRECATED_INLINE( void OldMethod(), NewMethod() );
|
|
|
|
};
|
2008-03-08 13:52:38 +00:00
|
|
|
@endcode
|
2008-03-23 18:24:32 +00:00
|
|
|
|
|
|
|
@header{wx/defs.h}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-23 18:24:32 +00:00
|
|
|
#define wxDEPRECATED_INLINE(func, body)
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
@c wxEXPLICIT is a macro which expands to the C++ @c explicit keyword if
|
2008-03-23 18:24:32 +00:00
|
|
|
the compiler supports it or nothing otherwise. Thus, it can be used even in
|
|
|
|
the code which might have to be compiled with an old compiler without
|
|
|
|
support for this language feature but still take advantage of it when it is
|
|
|
|
available.
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
@header{wx/defs.h}
|
|
|
|
*/
|
|
|
|
#define wxEXPLICIT
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
GNU C++ compiler gives a warning for any class whose destructor is private
|
|
|
|
unless it has a friend. This warning may sometimes be useful but it doesn't
|
2008-03-23 18:24:32 +00:00
|
|
|
make sense for reference counted class which always delete themselves
|
|
|
|
(hence destructor should be private) but don't necessarily have any
|
|
|
|
friends, so this macro is provided to disable the warning in such case. The
|
|
|
|
@a name parameter should be the name of the class but is only used to
|
|
|
|
construct a unique friend class name internally.
|
|
|
|
|
|
|
|
Example of using the macro:
|
2008-03-09 12:33:59 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
@code
|
|
|
|
class RefCounted
|
2008-03-23 18:24:32 +00:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
RefCounted() { m_nRef = 1; }
|
|
|
|
void IncRef() { m_nRef++ ; }
|
|
|
|
void DecRef() { if ( !--m_nRef ) delete this; }
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
private:
|
|
|
|
~RefCounted() { }
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
wxSUPPRESS_GCC_PRIVATE_DTOR(RefCounted)
|
|
|
|
};
|
2008-03-08 13:52:38 +00:00
|
|
|
@endcode
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
Notice that there should be no semicolon after this macro.
|
2008-03-08 14:43:31 +00:00
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
@header{wx/defs.h}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-23 18:24:32 +00:00
|
|
|
#define wxSUPPRESS_GCC_PRIVATE_DTOR_WARNING(name)
|
2008-03-08 13:52:38 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
This macro is the same as the standard C99 @c va_copy for the compilers
|
2008-03-23 18:24:32 +00:00
|
|
|
which support it or its replacement for those that don't. It must be used
|
|
|
|
to preserve the value of a @c va_list object if you need to use it after
|
2008-03-08 13:52:38 +00:00
|
|
|
passing it to another function because it can be modified by the latter.
|
2008-03-23 18:24:32 +00:00
|
|
|
|
2008-03-08 13:52:38 +00:00
|
|
|
As with @c va_start, each call to @c wxVaCopy must have a matching
|
|
|
|
@c va_end.
|
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
@header{wx/defs.h}
|
2008-03-08 13:52:38 +00:00
|
|
|
*/
|
2008-03-23 18:24:32 +00:00
|
|
|
void wxVaCopy(va_list argptrDst, va_list argptrSrc);
|
2008-03-08 13:52:38 +00:00
|
|
|
|
2008-03-23 18:24:32 +00:00
|
|
|
//@}
|
2008-03-08 13:52:38 +00:00
|
|
|
|