Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r53733 - in branches/quickbook-1.5: . detail
From: daniel_james_at_[hidden]
Date: 2009-06-07 16:34:09


Author: danieljames
Date: 2009-06-07 16:34:08 EDT (Sun, 07 Jun 2009)
New Revision: 53733
URL: http://svn.boost.org/trac/boost/changeset/53733

Log:
Put the quickbook version numbers in a single header, along with convenience
functions for using them in spirit grammars.
Added:
   branches/quickbook-1.5/detail/quickbook.hpp (contents, props changed)
Text files modified:
   branches/quickbook-1.5/detail/actions.cpp | 1 +
   branches/quickbook-1.5/detail/actions.hpp | 3 ---
   branches/quickbook-1.5/detail/quickbook.cpp | 1 +
   branches/quickbook-1.5/doc_info.hpp | 3 +--
   4 files changed, 3 insertions(+), 5 deletions(-)

Modified: branches/quickbook-1.5/detail/actions.cpp
==============================================================================
--- branches/quickbook-1.5/detail/actions.cpp (original)
+++ branches/quickbook-1.5/detail/actions.cpp 2009-06-07 16:34:08 EDT (Sun, 07 Jun 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: branches/quickbook-1.5/detail/actions.hpp
==============================================================================
--- branches/quickbook-1.5/detail/actions.hpp (original)
+++ branches/quickbook-1.5/detail/actions.hpp 2009-06-07 16:34:08 EDT (Sun, 07 Jun 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: branches/quickbook-1.5/detail/quickbook.cpp
==============================================================================
--- branches/quickbook-1.5/detail/quickbook.cpp (original)
+++ branches/quickbook-1.5/detail/quickbook.cpp 2009-06-07 16:34:08 EDT (Sun, 07 Jun 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: branches/quickbook-1.5/detail/quickbook.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-1.5/detail/quickbook.hpp 2009-06-07 16:34:08 EDT (Sun, 07 Jun 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: branches/quickbook-1.5/doc_info.hpp
==============================================================================
--- branches/quickbook-1.5/doc_info.hpp (original)
+++ branches/quickbook-1.5/doc_info.hpp 2009-06-07 16:34:08 EDT (Sun, 07 Jun 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