1 // boost/filesystem/detail/macro_value.hpp -------------------------------------------//
3 // (C) Copyright John Maddock 2001 - 2003
4 // (C) Copyright Jens Maurer 2001
5 // (C) Copyright Peter Dimov 2001
6 // (C) Copyright Darin Adler 2001
7 // (C) Copyright Beman Dawes 2002
9 // Distributed under the Boost Software License, Version 1.0.
10 // See http://www.boost.org/LICENSE_1_0.txt
12 // Library home page: http://www.boost.org/libs/filesystem
14 //--------------------------------------------------------------------------------------//
16 #ifndef BOOST_FILESYSTEM_MACRO_VALUE_HPP
17 #define BOOST_FILESYSTEM_MACRO_VALUE_HPP
19 #include <boost/config.hpp>
20 #include <boost/assert.hpp>
27 inline const char* macro_value(const char* name, const char* value)
29 static const char* no_value = "[no value]";
30 static const char* not_defined = "[not defined]";
32 BOOST_ASSERT_MSG(name, "name argument must not be a null pointer");
33 BOOST_ASSERT_MSG(value, "value argument must not be a null pointer");
35 return strcmp(name, value + 1)
36 ? ((*value && *(value+1)) ? (value+1) : no_value)
37 : not_defined; // name == value+1 so the macro is not defined
42 #define BOOST_MACRO_VALUE(X) boost::detail::macro_value(#X, BOOST_STRINGIZE(=X))
44 #endif // BOOST_FILESYSTEM_MACRO_VALUE_HPP