|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r55910 - in trunk/tools/quickbook: . detail
From: daniel_james_at_[hidden]
Date: 2009-08-31 07:37:18
Author: danieljames
Date: 2009-08-31 07:37:17 EDT (Mon, 31 Aug 2009)
New Revision: 55910
URL: http://svn.boost.org/trac/boost/changeset/55910
Log:
Put the quickbook version numbers in a single header, along with convenience
functions for using them in spirit grammars.
Added:
trunk/tools/quickbook/detail/quickbook.hpp (contents, props changed)
Text files modified:
trunk/tools/quickbook/detail/actions.cpp | 1 +
trunk/tools/quickbook/detail/actions.hpp | 3 ---
trunk/tools/quickbook/detail/quickbook.cpp | 1 +
trunk/tools/quickbook/doc_info.hpp | 3 +--
4 files changed, 3 insertions(+), 5 deletions(-)
Modified: trunk/tools/quickbook/detail/actions.cpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.cpp (original)
+++ trunk/tools/quickbook/detail/actions.cpp 2009-08-31 07:37:17 EDT (Mon, 31 Aug 2009)
@@ -14,6 +14,7 @@
#include <boost/filesystem/convenience.hpp>
#include <boost/filesystem/fstream.hpp>
#include <boost/lexical_cast.hpp>
+#include "./quickbook.hpp"
#include "./actions.hpp"
#include "./utils.hpp"
#include "./markups.hpp"
Modified: trunk/tools/quickbook/detail/actions.hpp
==============================================================================
--- trunk/tools/quickbook/detail/actions.hpp (original)
+++ trunk/tools/quickbook/detail/actions.hpp 2009-08-31 07:37:17 EDT (Mon, 31 Aug 2009)
@@ -41,9 +41,6 @@
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<std::string> include_path;
// forward declarations
Modified: trunk/tools/quickbook/detail/quickbook.cpp
==============================================================================
--- trunk/tools/quickbook/detail/quickbook.cpp (original)
+++ trunk/tools/quickbook/detail/quickbook.cpp 2009-08-31 07:37:17 EDT (Mon, 31 Aug 2009)
@@ -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"
Added: trunk/tools/quickbook/detail/quickbook.hpp
==============================================================================
--- (empty file)
+++ trunk/tools/quickbook/detail/quickbook.hpp 2009-08-31 07:37:17 EDT (Mon, 31 Aug 2009)
@@ -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 <typename Arg>
+ 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
Modified: trunk/tools/quickbook/doc_info.hpp
==============================================================================
--- trunk/tools/quickbook/doc_info.hpp (original)
+++ trunk/tools/quickbook/doc_info.hpp 2009-08-31 07:37:17 EDT (Mon, 31 Aug 2009)
@@ -11,6 +11,7 @@
#define BOOST_SPIRIT_QUICKBOOK_DOC_INFO_HPP
#include "./phrase.hpp"
+#include "./detail/quickbook.hpp"
#include <boost/spirit/include/classic_core.hpp>
#include <boost/spirit/include/classic_actor.hpp>
#include <boost/spirit/include/classic_loops.hpp>
@@ -19,8 +20,6 @@
namespace quickbook
{
using namespace boost::spirit::classic;
- extern unsigned qbk_major_version;
- extern unsigned qbk_minor_version;
template <typename Actions>
struct doc_info_grammar
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk