is_identifier.hpp 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  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. returns = 1 if the parameter is an identifier, otherwise 0.
  23. If the parameter is not an identifier,
  24. or if optional identifiers are specified and the identifier
  25. does not match any of the optional identifiers, the macro returns 0.
  26. Identifiers are registered in VMD with:
  27. #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
  28. The identifier must be registered to be found.
  29. Identifiers are pre-detected in VMD with:
  30. #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
  31. If you specify optional identifiers and have not specified the detection
  32. of an optional identifier, that optional identifier will never match the input.
  33. If the input is not a VMD data type this macro could lead to
  34. a preprocessor error. This is because the macro
  35. uses preprocessor concatenation to determine if the input
  36. is an identifier once it is determined that the input does not
  37. start with parenthesis. If the data being concatenated would
  38. lead to an invalid preprocessor token the compiler can issue
  39. a preprocessor error.
  40. */
  41. #define BOOST_VMD_IS_IDENTIFIER(...) \
  42. BOOST_VMD_DETAIL_IS_IDENTIFIER(__VA_ARGS__) \
  43. /**/
  44. /** \def BOOST_VMD_IS_IDENTIFIER_D(d,...)
  45. \brief Tests whether a parameter is an identifier. Re-entrant version.
  46. d = The next available BOOST_PP_WHILE iteration.
  47. ... = variadic parameters
  48. The first variadic parameter is required and it is the input to test.
  49. Further variadic parameters are optional and are identifiers to match.
  50. The data may take one of two forms; it is either one or more single identifiers
  51. or a single Boost PP tuple of identifiers.
  52. returns = 1 if the parameter is an identifier, otherwise 0.
  53. If the parameter is not an identifier,
  54. or if optional identifiers are specified and the identifier
  55. does not match any of the optional identifiers, the macro returns 0.
  56. Identifiers are registered in VMD with:
  57. #define BOOST_VMD_REG_XXX (XXX) where XXX is a v-identifier.
  58. The identifier must be registered to be found.
  59. Identifiers are pre-detected in VMD with:
  60. #define BOOST_VMD_DETECT_XXX_XXX where XXX is an identifier.
  61. If you specify optional identifiers and have not specified the detection
  62. of an optional identifier, that optional identifier will never match the input.
  63. If the input is not a VMD data type this macro could lead to
  64. a preprocessor error. This is because the macro
  65. uses preprocessor concatenation to determine if the input
  66. is an identifier once it is determined that the input does not
  67. start with parenthesis. If the data being concatenated would
  68. lead to an invalid preprocessor token the compiler can issue
  69. a preprocessor error.
  70. */
  71. #define BOOST_VMD_IS_IDENTIFIER_D(d,...) \
  72. BOOST_VMD_DETAIL_IS_IDENTIFIER_D(d,__VA_ARGS__) \
  73. /**/
  74. #endif /* BOOST_PP_VARIADICS */
  75. #endif /* BOOST_VMD_IS_IDENTIFIER_HPP */