Update of /cvsroot/boost/boost/tools/quickbook/detail
In directory
sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv31656/tools/quickbook_backend/detail
Modified Files:
Tag: QUICKBOOK_BACKEND
actions.cpp actions.hpp actions_class.cpp actions_class.hpp
Log Message:
Document pre() and post() are now template driven, includes header, doc info,
and footer.
Index: actions.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.cpp,v
retrieving revision 1.49.2.2
retrieving revision 1.49.2.3
diff -u -d -r1.49.2.2 -r1.49.2.3
--- actions.cpp 14 Apr 2007 00:52:21 -0000 1.49.2.2
+++ actions.cpp 17 Apr 2007 00:42:01 -0000 1.49.2.3
@@ -13,7 +13,6 @@
#include <boost/bind.hpp>
#include <boost/filesystem/convenience.hpp>
#include <boost/lexical_cast.hpp>
-#include <boost/assign/list_of.hpp>
#include "./actions.hpp"
#include "./utils.hpp"
#include "./markups.hpp"
@@ -1088,21 +1087,18 @@
for_each(
actions.doc_authors.begin()
, actions.doc_authors.end()
- , xml_author(out));
+ , backend_action("doc_info_author",actions));
if (!actions.doc_copyright_holder.empty())
{
- out << "\n" << " <copyright>\n";
+
backend_action("doc_info_copyright_pre",actions)(std::list<std::string>());
for_each(
actions.doc_copyright_years.begin()
, actions.doc_copyright_years.end()
- , xml_year(out));
-
- out << " <holder>" << actions.doc_copyright_holder <<
"</holder>\n"
- << " </copyright>\n"
- << "\n"
- ;
+ , backend_action("doc_info_copyright_year",actions));
+
+
backend_action("doc_info_copyright_post",actions)(std::list<std::string>());
}
if (qbk_version_n < 103)
@@ -1114,44 +1110,45 @@
if (!actions.doc_license.empty())
{
- out << " <legalnotice>\n"
- << " <para>\n"
- << " " << actions.doc_license << "\n"
- << " </para>\n"
- << " </legalnotice>\n"
- << "\n"
- ;
+ backend_action("doc_info_license",actions)(boost::assign::list_of
+ (actions.doc_license)
+ );
}
if (!actions.doc_purpose.empty())
{
- out << " <" << actions.doc_type << "purpose>\n"
- << " " << actions.doc_purpose
- << " </" << actions.doc_type << "purpose>\n"
- << "\n"
- ;
+ backend_action("doc_info_purpose",actions)(boost::assign::list_of
+ (actions.doc_type)
+ (actions.doc_purpose)
+ );
}
-
+
if (!actions.doc_category.empty())
{
- out << " <" << actions.doc_type << "category name=\"category:"
- << actions.doc_category
- << "\"></" << actions.doc_type << "category>\n"
- << "\n"
- ;
+ backend_action("doc_info_category",actions)(boost::assign::list_of
+ (actions.doc_type)
+ (actions.doc_category)
+ );
}
-
- out << " </" << actions.doc_type << "info>\n"
- << "\n"
- ;
+
+ actions.doc_info_post(boost::assign::list_of
+ (actions.doc_type)
+ (actions.doc_id)
+ );
if (!actions.doc_title.empty())
{
- out << " <title>" << actions.doc_title;
- if (!actions.doc_version.empty())
- out << ' ' << actions.doc_version;
- out << "</title>\n\n\n";
+ backend_action("doc_title",actions)(boost::assign::list_of
+ (actions.doc_title
+ + (!actions.doc_version.empty()
+ ? ( std::string(" ")+actions.doc_version )
+ : ( std::string("") )
+ ))
+ );
}
+
+ actions.out << actions.phrase.str();
+ actions.phrase.clear();
}
void post(collector& out, quickbook::actions& actions, bool ignore_docinfo)
@@ -1164,13 +1161,12 @@
// We've finished generating our output. Here's what we'll do
// *after* everything else.
- actions.doc_info_post(boost::assign::list_of
- (actions.doc_type)
- (actions.doc_id)
- );
actions.doc_post(boost::assign::list_of
(actions.doc_type)
);
+
+ actions.out << actions.phrase.str();
+ actions.phrase.clear();
}
void phrase_to_string_action::operator()(iterator first, iterator last)
const
@@ -1185,25 +1181,4 @@
this->actions.backend_tag+"_"+this->action_name);
do_template_action::operator()(first,last);
}
-
- void backend_action::operator()(std::list<std::string> const & args) const
- {
- actions.template_info.insert(
- actions.template_info.begin(),
- args.begin(),
- args.end()
- );
- actions.template_info.insert(
- actions.template_info.begin(),
- this->actions.backend_tag+"_"+this->action_name
- );
- typedef position_iterator<std::string::const_iterator> iterator_type;
- std::string nothing;
- iterator_type first(
- nothing.begin(), nothing.end(),
- actions.filename.native_file_string().c_str());
- iterator_type last(
- nothing.end(), nothing.end());
- do_template_action::operator()(first,last);
- }
}
Index: actions.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.hpp,v
retrieving revision 1.36.2.2
retrieving revision 1.36.2.3
diff -u -d -r1.36.2.2 -r1.36.2.3
--- actions.hpp 14 Apr 2007 00:52:21 -0000 1.36.2.2
+++ actions.hpp 17 Apr 2007 00:42:01 -0000 1.36.2.3
@@ -21,6 +21,10 @@
#include <boost/filesystem/operations.hpp>
#include <boost/foreach.hpp>
#include <boost/tuple/tuple.hpp>
+#include <boost/assign/list_of.hpp>
+#include <boost/utility/enable_if.hpp>
+#include <boost/mpl/has_xxx.hpp>
+#include <boost/mpl/logical.hpp>
#include "../syntax_highlight.hpp"
#include "./collector.hpp"
#include "./template_stack.hpp"
@@ -697,6 +701,12 @@
collector& phrase;
};
+ namespace detail
+ {
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(iterator)
+ BOOST_MPL_HAS_XXX_TRAIT_DEF(traits_type)
+ }
+
struct backend_action : protected do_template_action
{
backend_action(
@@ -710,7 +720,43 @@
void operator()(iterator first, iterator last) const;
- void operator()(std::list<std::string> const & args) const;
+ template <typename C>
+ void operator()(C const & args,
+ typename boost::enable_if<
+ boost::mpl::and_<
+ detail::has_iterator<C>,
+ boost::mpl::not_< detail::has_traits_type<C> >
+ >
+ >::type * = 0) const
+ {
+ actions.template_info.insert(
+ actions.template_info.begin(),
+ args.begin(),
+ args.end()
+ );
+ actions.template_info.insert(
+ actions.template_info.begin(),
+ this->actions.backend_tag+"_"+this->action_name
+ );
+ typedef position_iterator<std::string::const_iterator>
iterator_type;
+ std::string nothing;
+ iterator_type first(
+ nothing.begin(), nothing.end(),
+ actions.filename.native_file_string().c_str());
+ iterator_type last(
+ nothing.end(), nothing.end());
+ do_template_action::operator()(first,last);
+ }
+
+ inline void operator()(std::pair<std::string,std::string> const &
args) const
+ {
+ (*this)(boost::assign::list_of(args.first)(args.second));
+ }
+
+ inline void operator()(std::string const & arg) const
+ {
+ (*this)(boost::assign::list_of(arg));
+ }
std::string action_name;
};
Index: actions_class.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.cpp,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -d -r1.9.2.2 -r1.9.2.3
--- actions_class.cpp 14 Apr 2007 00:52:21 -0000 1.9.2.2
+++ actions_class.cpp 17 Apr 2007 00:42:01 -0000 1.9.2.3
@@ -172,9 +172,6 @@
, xinclude(out, *this)
, include(*this)
, import(out, *this)
-
- , escape_pre(phrase, escape_pre_)
- , escape_post(phrase, escape_post_)
{
// turn off __FILENAME__ macro on debug mode = true
std::string filename_str = debug_mode ?
Index: actions_class.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.hpp,v
retrieving revision 1.9.2.2
retrieving revision 1.9.2.3
diff -u -d -r1.9.2.2 -r1.9.2.3
--- actions_class.hpp 14 Apr 2007 00:52:21 -0000 1.9.2.2
+++ actions_class.hpp 17 Apr 2007 00:42:01 -0000 1.9.2.3
@@ -195,9 +195,6 @@
xinclude_action xinclude;
include_action include;
import_action import;
-
- markup_action escape_pre;
- markup_action escape_post;
};
}
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs