libqi-api  release-2.5.3-2016-11-18
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
Macros
macro.hpp File Reference

Various macros for qi. (deprecated, export API, disallow copy, ..) . More...

#include <qi/preproc.hpp>

Go to the source code of this file.

Macros

#define _QI_MACRO_HPP_
 
#define QI_API_DEPRECATED
 Compiler flags to mark a function as deprecated. It will generate a compiler warning. More...
 
#define QI_API_DEPRECATED_MSG(msg__)
 Compiler flags to mark a function as deprecated. It will generate a compiler warning. More...
 
#define QI_NORETURN
 Portable noreturn attribute, used to declare that a function does not return. More...
 
#define QI_HAS_VARIABLE_LENGTH_ARRAY   0
 Mark compilers supporting variable length array (VLA) More...
 
#define QI_LIB_API(libname)   _QI_LIB_API(BOOST_PP_CAT(libname, _EXPORTS), BOOST_PP_CAT(libname, _STATIC_BUILD))
 
#define _QI_LIB_API(IS_BUILDING_LIB, IS_LIB_STATIC_BUILD)   QI_LIB_API_NORMALIZED(_QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_ , IS_BUILDING_LIB)), _QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_, IS_LIB_STATIC_BUILD)))
 
#define QI_IMPORT_API
 Compiler flags to import a function or a class. More...
 
#define QI_EXPORT_API
 Compiler flags to export a function or a class. More...
 
#define QI_LIB_API_NORMALIZED(a, b)
 Each platform must provide a QI_LIB_API_NORMALIZED(isBuilding, isStatic) More...
 
#define QI_COMPILER_WARNING(x)   QI_MSG_PRAGMA("Warning: " #x)
 Generate a compiler warning. More...
 
#define QI_DEPRECATED_HEADER(x)
 Generate a compiler warning stating a header is deprecated. add a message to explain what user should do. More...
 
#define QI_DEPRECATE_MACRO(name)   QI_COMPILER_WARNING(name macro is deprecated.)
 A macro used to deprecate another macro. Generate a compiler warning when the given macro is used. More...
 
#define QI_DISALLOW_COPY_AND_ASSIGN(type)
 A macro to disallow copy constructor and operator=. More...
 
#define QI_WARN_UNUSED_RESULT
 This macro tags a result as unused. More...
 
#define QI_ATTR_UNUSED
 This macro tags a attribute as unused. More...
 
#define QI_UNUSED(x)
 This macro tags a parameter as unused. More...
 
#define _QI_UNIQ_DEF_LEVEL2(A, B)   A ## __uniq__ ## B
 
#define _QI_UNIQ_DEF_LEVEL1(A, B)   _QI_UNIQ_DEF_LEVEL2(A, B)
 
#define QI_UNIQ_DEF(A)   _QI_UNIQ_DEF_LEVEL1(A, __LINE__)
 A macro to append the line number of the parent macro usage, to define a function in or a variable and avoid name collision. More...
 
#define QI_NOEXCEPT(cond)
 Specify that a function may throw or not. More...
 

Detailed Description

Various macros for qi. (deprecated, export API, disallow copy, ..) .

* This header file contains various macros for qi.
*
* - import/export symbol (:cpp:macro:`QI_IMPORT_API`,
*   :cpp:macro:`QI_EXPORT_API`)
* - mark function and header as deprecated (:cpp:macro:`QI_DEPRECATED_HEADER`,
*   :cpp:macro:`QI_API_DEPRECATED`)
* - generate compiler warning (:cpp:macro:`QI_COMPILER_WARNING`)
* - disallow copy and assign (:cpp:macro:`QI_DISALLOW_COPY_AND_ASSIGN`)
* 

Definition in file macro.hpp.

Macro Definition Documentation

#define _QI_LIB_API (   IS_BUILDING_LIB,
  IS_LIB_STATIC_BUILD 
)    QI_LIB_API_NORMALIZED(_QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_ , IS_BUILDING_LIB)), _QI_IS_ONE_OR_EMPTY(BOOST_PP_CAT(_, IS_LIB_STATIC_BUILD)))

Definition at line 102 of file macro.hpp.

#define _QI_MACRO_HPP_

Definition at line 25 of file macro.hpp.

#define _QI_UNIQ_DEF_LEVEL1 (   A,
 
)    _QI_UNIQ_DEF_LEVEL2(A, B)

Definition at line 285 of file macro.hpp.

#define _QI_UNIQ_DEF_LEVEL2 (   A,
 
)    A ## __uniq__ ## B

Definition at line 284 of file macro.hpp.

#define QI_API_DEPRECATED

Compiler flags to mark a function as deprecated. It will generate a compiler warning.

Definition at line 39 of file macro.hpp.

#define QI_API_DEPRECATED_MSG (   msg__)

Compiler flags to mark a function as deprecated. It will generate a compiler warning.

Parameters
msg__A message providing a workaround.

Definition at line 53 of file macro.hpp.

#define QI_ATTR_UNUSED

This macro tags a attribute as unused.

Definition at line 260 of file macro.hpp.

#define QI_COMPILER_WARNING (   x)    QI_MSG_PRAGMA("Warning: " #x)

Generate a compiler warning.

Parameters
xThe string displayed as the warning.

Definition at line 164 of file macro.hpp.

#define QI_DEPRECATE_MACRO (   name)    QI_COMPILER_WARNING(name macro is deprecated.)

A macro used to deprecate another macro. Generate a compiler warning when the given macro is used.

Parameters
nameThe name of the macro.
* Example:
*
* .. code-block:: cpp
*
*     #define MAX(x,y)(QI_DEPRECATE_MACRO(MAX), x > y ?  x : y)
* 

Definition at line 201 of file macro.hpp.

#define QI_DEPRECATED_HEADER (   x)

Generate a compiler warning stating a header is deprecated. add a message to explain what user should do.

Definition at line 173 of file macro.hpp.

#define QI_DISALLOW_COPY_AND_ASSIGN (   type)
Value:
type(type const &); \
void operator=(type const &); \
using _qi_not_clonable = int; \
template<typename U> friend struct ::qi::IsClonable
#define QI_DEPRECATE_MACRO(name)
A macro used to deprecate another macro. Generate a compiler warning when the given macro is used...
Definition: macro.hpp:201
#define QI_DISALLOW_COPY_AND_ASSIGN(type)
A macro to disallow copy constructor and operator=.
Definition: macro.hpp:235

A macro to disallow copy constructor and operator=.

Deprecated:
Use boost::noncopyable instead.
* Example:
*
* .. code-block:: cpp
*
*     class Foo : private boost::nonpyable
*     {};
* 
Parameters
typeThe class name of which we want to forbid copy.
* .. note::
*     This macro should always be in the private (or protected) section of a
*     class.
*
* Example:
*
* .. code-block:: cpp
*
*     class Foo {
*         Foo();
*     private:
*         QI_DISALLOW_COPY_AND_ASSIGN(Foo);
*     };
* 

Definition at line 235 of file macro.hpp.

#define QI_EXPORT_API

Compiler flags to export a function or a class.

Definition at line 133 of file macro.hpp.

#define QI_HAS_VARIABLE_LENGTH_ARRAY   0

Mark compilers supporting variable length array (VLA)

Definition at line 76 of file macro.hpp.

#define QI_IMPORT_API

Compiler flags to import a function or a class.

Definition at line 132 of file macro.hpp.

#define QI_LIB_API (   libname)    _QI_LIB_API(BOOST_PP_CAT(libname, _EXPORTS), BOOST_PP_CAT(libname, _STATIC_BUILD))
Returns
the proper type specification for import/export
Parameters
libnamethe name of your library. This macro will use two preprocessor defines: libname_EXPORTS (cmake convention) and libname_STATIC_BUILD. Those macro can be unset or set to 0 to mean false, or set to empty or 1 to mean true. The first one must be true if the current compilation unit is within the library. The second must be true if the library was built as a static archive. The proper way to use this macro is to:
  • Have your buildsystem set mylib_EXPORTS when building MYLIB
  • Have your buildsystem produce a config.h file that #define mylib_STATIC_BUILD to 1 or empty if it is a static build, and not define mylib_STATIC_BUILD or define it to 0 otherwise In one header, write #include <mylib/config.h> #define MYLIB_API QI_LIB_API(mylib)

Definition at line 100 of file macro.hpp.

#define QI_LIB_API_NORMALIZED (   a,
 
)

Each platform must provide a QI_LIB_API_NORMALIZED(isBuilding, isStatic)

Definition at line 134 of file macro.hpp.

#define QI_NOEXCEPT (   cond)

Specify that a function may throw or not.

Definition at line 305 of file macro.hpp.

#define QI_NORETURN

Portable noreturn attribute, used to declare that a function does not return.

Definition at line 66 of file macro.hpp.

#define QI_UNIQ_DEF (   A)    _QI_UNIQ_DEF_LEVEL1(A, __LINE__)

A macro to append the line number of the parent macro usage, to define a function in or a variable and avoid name collision.

Definition at line 286 of file macro.hpp.

#define QI_UNUSED (   x)

This macro tags a parameter as unused.

* Example:
*
* .. code-block:: cpp
*
*     int zero(int QI_UNUSED(x))
*     {
*       return 0;
*     }
* 

Definition at line 277 of file macro.hpp.

#define QI_WARN_UNUSED_RESULT

This macro tags a result as unused.

Definition at line 250 of file macro.hpp.