diff --git a/detail/actions.cpp b/detail/actions.cpp index a6e6f1a..074e05f 100644 --- a/detail/actions.cpp +++ b/detail/actions.cpp @@ -14,6 +14,7 @@ #include #include #include +#include "./quickbook.hpp" #include "./actions.hpp" #include "./utils.hpp" #include "./markups.hpp" diff --git a/detail/actions.hpp b/detail/actions.hpp index 906776a..f18db05 100644 --- a/detail/actions.hpp +++ b/detail/actions.hpp @@ -41,9 +41,6 @@ namespace quickbook extern tm* current_time; // the current time extern tm* current_gm_time; // the current UTC time extern bool debug_mode; - extern unsigned qbk_major_version; - extern unsigned qbk_minor_version; - extern unsigned qbk_version_n; // qbk_major_version * 100 + qbk_minor_version extern std::vector include_path; // forward declarations diff --git a/detail/quickbook.cpp b/detail/quickbook.cpp index 654162f..5cfe3fb 100644 --- a/detail/quickbook.cpp +++ b/detail/quickbook.cpp @@ -7,6 +7,7 @@ License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) =============================================================================*/ +#include "./quickbook.hpp" #include "./actions_class.hpp" #include "../block.hpp" #include "../doc_info.hpp" diff --git a/detail/quickbook.hpp b/detail/quickbook.hpp new file mode 100644 index 0000000..3aa8852 --- /dev/null +++ b/detail/quickbook.hpp @@ -0,0 +1,47 @@ +/*============================================================================= + Copyright (c) 2009 Daniel James + Copyright (c) 2002 2004 2006 Joel de Guzman + Copyright (c) 2004 Eric Niebler + http://spirit.sourceforge.net/ + + Use, modification and distribution is subject to the Boost Software + License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at + http://www.boost.org/LICENSE_1_0.txt) +=============================================================================*/ + +#if !defined(BOOST_SPIRIT_QUICKBOOK_QUICKBOOK_HPP) +#define BOOST_SPIRIT_QUICKBOOK_QUICKBOOK_HPP + +namespace quickbook +{ + extern unsigned qbk_major_version; + extern unsigned qbk_minor_version; + extern unsigned qbk_version_n; // qbk_major_version * 100 + qbk_minor_version + + struct quickbook_range { + template + struct result + { + typedef bool type; + }; + + quickbook_range(unsigned min, unsigned max) + : min(min), max(max) {} + + bool operator()() const { + return qbk_version_n >= min && qbk_version_n < max; + } + + unsigned min, max; + }; + + inline quickbook_range qbk_since(unsigned min) { + return quickbook_range(min, 999); + } + + inline quickbook_range qbk_before(unsigned max) { + return quickbook_range(0, max); + } +} + +#endif \ No newline at end of file diff --git a/doc_info.hpp b/doc_info.hpp index 0e7791d..7bab42c 100644 --- a/doc_info.hpp +++ b/doc_info.hpp @@ -11,6 +11,7 @@ #define BOOST_SPIRIT_QUICKBOOK_DOC_INFO_HPP #include "./phrase.hpp" +#include "./detail/quickbook.hpp" #include #include #include @@ -19,8 +20,6 @@ namespace quickbook { using namespace boost::spirit::classic; - extern unsigned qbk_major_version; - extern unsigned qbk_minor_version; template struct doc_info_grammar