is_identifier.hpp 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. // (C) Copyright Edward Diener 2011-2015
  2. // Use, modification and distribution are subject to the Boost Software License,
  3. // Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  4. // http://www.boost.org/LICENSE_1_0.txt).
  5. #if !defined(BOOST_VMD_IS_IDENTIFIER_HPP)
  6. #define BOOST_VMD_IS_IDENTIFIER_HPP
  7. #include <boost/vmd/detail/setup.hpp>
  8. #if BOOST_PP_VARIADICS
  9. #include <boost/vmd/detail/is_identifier.hpp>
  10. /*
  11. The succeeding comments in this file are in doxygen format.
  12. */
  13. /** \file
  14. */
  15. /** \def BOOST_VMD_IS_IDENTIFIER(...)
  16. \brief Tests whether a parameter is an identifier.
  17. ... = variadic parameters
  18. The first variadic parameter is required and it is the input to test.
  19. Further variadic parameters are optional and are identifiers to match.
  20. The data may take one of two forms; it is either one or more single identifiers
  21. or a single Boost PP tuple of identifiers.
  22. @code
  23. returns = 1 if the parameter is an identifier, otherwise 0.
  24. If the parameter is not an identifier,
  25. or if optional identifiers are specified and the identifier
  26. does not match any of the optional identifiers, the macro returns 0.
  27. @endcode
  28. Identifiers are registered in VMD with:
  29. @code
  30. #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
  31. @endcode
  32. The identifier must be registered to be found.
  33. Identifiers are pre-detected in VMD with:
  34. @code
  35. #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
  36. @endcode
  37. If you specify optional identifiers and have not specified the detection
  38. of an optional identifier, that optional identifier will never match the input.
  39. If the input is not a VMD data type this macro could lead to
  40. a preprocessor error. This is because the macro
  41. uses preprocessor concatenation to determine if the input
  42. is an identifier once it is determined that the input does not
  43. start with parenthesis. If the data being concatenated would
  44. lead to an invalid preprocessor token the compiler can issue
  45. a preprocessor error.
  46. */
  47. #define BOOST_VMD_IS_IDENTIFIER(...) \
  48. BOOST_VMD_DETAIL_IS_IDENTIFIER(__VA_ARGS__) \
  49. /**/
  50. /** \def BOOST_VMD_IS_IDENTIFIER_D(d,...)
  51. \brief Tests whether a parameter is an identifier. Re-entrant version.
  52. d = The next available BOOST_PP_WHILE iteration. <br/>
  53. ... = variadic parameters
  54. The first variadic parameter is required and it is the input to test.
  55. Further variadic parameters are optional and are identifiers to match.
  56. The data may take one of two forms; it is either one or more single identifiers
  57. or a single Boost PP tuple of identifiers.
  58. @code
  59. returns = 1 if the parameter is an identifier, otherwise 0.
  60. If the parameter is not an identifier,
  61. or if optional identifiers are specified and the identifier
  62. does not match any of the optional identifiers, the macro returns 0.
  63. @endcode
  64. Identifiers are registered in VMD with:
  65. @code
  66. #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
  67. @endcode
  68. The identifier must be registered to be found.
  69. Identifiers are pre-detected in VMD with:
  70. @code
  71. #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
  72. @endcode
  73. If you specify optional identifiers and have not specified the detection
  74. of an optional identifier, that optional identifier will never match the input.
  75. If the input is not a VMD data type this macro could lead to
  76. a preprocessor error. This is because the macro
  77. uses preprocessor concatenation to determine if the input
  78. is an identifier once it is determined that the input does not
  79. start with parenthesis. If the data being concatenated would
  80. lead to an invalid preprocessor token the compiler can issue
  81. a preprocessor error.
  82. */
  83. #define BOOST_VMD_IS_IDENTIFIER_D(d,...) \
  84. BOOST_VMD_DETAIL_IS_IDENTIFIER_D(d,__VA_ARGS__) \
  85. /**/
  86. #endif /* BOOST_PP_VARIADICS */
  87. #endif /* BOOST_VMD_IS_IDENTIFIER_HPP */