Files
boost_preprocessor/include/boost/preprocessor/stringize.hpp

53 lines
1.3 KiB
C++
Raw Normal View History

2001-11-25 18:32:11 +00:00
#ifndef BOOST_PREPROCESSOR_STRINGIZE_HPP
#define BOOST_PREPROCESSOR_STRINGIZE_HPP
/* Copyright (C) 2001
* Housemarque Oy
* http://www.housemarque.com
*
* Permission to copy, use, modify, sell and distribute this software is
* granted provided this copyright notice appears in all copies. This
* software is provided "as is" without express or implied warranty, and
* with no claim as to its suitability for any purpose.
*
* See http://www.boost.org for most recent version.
*/
2002-01-31 14:21:31 +00:00
/** <P>Delays the stringization of X.</P>
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
<P>For example,</P>
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
<PRE>
#define NOTE(STR)\
message(__FILE__ "(" BOOST_PP_STRINGIZE(__LINE__) ") : " STR)
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
// ...
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
#pragma NOTE("TBD!")
</PRE>
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
<P>expands to:</P>
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
<PRE>
2001-11-25 18:32:11 +00:00
#pragma message("examples.cpp" "(" "20" ") : " "TBD!")
2002-01-31 14:21:31 +00:00
</PRE>
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
<P>The use of BOOST_PP_STRINGIZE() above lets the PP expand the __LINE__
before stringizing it. If # would be used directly, the code would
2002-01-31 14:21:31 +00:00
expand to:</P>
2001-11-25 18:32:11 +00:00
2002-01-31 14:21:31 +00:00
<PRE>
2001-11-25 18:32:11 +00:00
#pragma message("examples.cpp" "(" "__LINE__" ") : " "TBD!")
2002-01-31 14:21:31 +00:00
</PRE>
2001-11-25 18:32:11 +00:00
*/
#define BOOST_PP_STRINGIZE(X) BOOST_PP_STRINGIZE_DELAY(X)
2001-11-25 18:32:11 +00:00
#ifndef DOXYGEN_SHOULD_SKIP_THIS
#define BOOST_PP_STRINGIZE_DELAY(X) BOOST_PP_DO_STRINGIZE(X)
#define BOOST_PP_DO_STRINGIZE(X) #X
#endif
2002-01-31 14:21:31 +00:00
/** <P>Obsolete. Use BOOST_PP_STRINGIZE().</P> */
#define BOOST_PREPROCESSOR_STRINGIZE(E) BOOST_PP_STRINGIZE(E)
2001-11-25 18:32:11 +00:00
#endif