Update of /cvsroot/boost/boost/tools/quickbook/detail
In directory sc8-pr-cvs3.sourceforge.net:/tmp/cvs-serv16055/detail
Modified Files:
actions.cpp actions.hpp actions_class.cpp actions_class.hpp
Log Message:
Conditional Generation
Index: actions.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.cpp,v
retrieving revision 1.53
retrieving revision 1.54
diff -u -d -r1.53 -r1.54
--- actions.cpp 5 Jul 2007 01:56:15 -0000 1.53
+++ actions.cpp 28 Jul 2007 08:13:20 -0000 1.54
@@ -116,6 +116,31 @@
out << post;
}
+ void cond_phrase_action_pre::operator()(iterator first, iterator last)
const
+ {
+ std::string str(first, last);
+ conditions.push_back(find(macro, str.c_str()));
+ out.push(); // save the stream
+ }
+
+ void cond_phrase_action_post::operator()(iterator first, iterator last)
const
+ {
+ bool symbol_found = conditions.back();
+ conditions.pop_back();
+
+ if (first == last || !symbol_found)
+ {
+ out.pop(); // restore the stream
+ }
+ else
+ {
+ std::string save;
+ out.swap(save);
+ out.pop(); // restore the stream
+ out << save; // print the body
+ }
+ }
+
void list_action::operator()(iterator first, iterator last) const
{
BOOST_ASSERT(!list_marks.empty()); // there must be at least one item
in the stack
Index: actions.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions.hpp,v
retrieving revision 1.36
retrieving revision 1.37
diff -u -d -r1.36 -r1.37
--- actions.hpp 27 Feb 2007 15:22:15 -0000 1.36
+++ actions.hpp 28 Jul 2007 08:13:20 -0000 1.37
@@ -159,6 +159,44 @@
string_symbols const& macro;
};
+ struct cond_phrase_action_pre
+ {
+ // Handles conditional phrases
+
+ cond_phrase_action_pre(
+ collector& out
+ , std::vector<bool>& conditions
+ , string_symbols const& macro)
+ : out(out)
+ , conditions(conditions)
+ , macro(macro) {}
+
+ void operator()(iterator first, iterator last) const;
+
+ collector& out;
+ std::vector<bool>& conditions;
+ string_symbols const& macro;
+ };
+
+ struct cond_phrase_action_post
+ {
+ // Handles conditional phrases
+
+ cond_phrase_action_post(
+ collector& out
+ , std::vector<bool>& conditions
+ , string_symbols const& macro)
+ : out(out)
+ , conditions(conditions)
+ , macro(macro) {}
+
+ void operator()(iterator first, iterator last) const;
+
+ collector& out;
+ std::vector<bool>& conditions;
+ string_symbols const& macro;
+ };
+
struct list_action
{
// Handles lists
Index: actions_class.cpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.cpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- actions_class.cpp 5 Jul 2007 01:56:15 -0000 1.10
+++ actions_class.cpp 28 Jul 2007 08:13:20 -0000 1.11
@@ -93,6 +93,8 @@
, plain_char(phrase)
, raw_char(phrase)
, image(phrase)
+ , cond_phrase_pre(phrase, conditions, macro)
+ , cond_phrase_post(phrase, conditions, macro)
, list(out, list_buffer, list_indent, list_marks)
, list_format(list_buffer, list_indent, list_marks)
Index: actions_class.hpp
===================================================================
RCS file: /cvsroot/boost/boost/tools/quickbook/detail/actions_class.hpp,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -d -r1.10 -r1.11
--- actions_class.hpp 5 Jul 2007 01:56:15 -0000 1.10
+++ actions_class.hpp 28 Jul 2007 08:13:20 -0000 1.11
@@ -85,6 +85,7 @@
std::string macro_id;
std::stack<mark_type> list_marks;
int list_indent;
+ std::vector<bool> conditions;
string_list template_info;
int template_depth;
bool template_escape;
@@ -114,6 +115,8 @@
plain_char_action plain_char;
raw_char_action raw_char;
image_action image;
+ cond_phrase_action_pre cond_phrase_pre;
+ cond_phrase_action_post cond_phrase_post;
list_action list;
list_format_action list_format;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc.
Still grepping through log files to find problems? Stop.
Now Search log events and configuration files using AJAX and a browser.
Download your FREE copy of Splunk now >> http://get.splunk.com/
_______________________________________________
Boost-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/boost-cvs