Boost logo

Boost-Commit :

Subject: [Boost-commit] svn:boost r75619 - in branches/quickbook-dev/tools/quickbook: src test/unit
From: dnljms_at_[hidden]
Date: 2011-11-22 18:47:04


Author: danieljames
Date: 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
New Revision: 75619
URL: http://svn.boost.org/trac/boost/changeset/75619

Log:
Quickbook: Better string names for `value`.

`value` doesn't track what a string is encoded as, and sometimes it's
plain text not boostbook. It would be nice to track the encoding and
automatically do the right thing, but I'm not sure if it's worth the
effort just now.
Text files modified:
   branches/quickbook-dev/tools/quickbook/src/actions.cpp | 72 +++++++++---------
   branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp | 4
   branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 4
   branches/quickbook-dev/tools/quickbook/src/values.cpp | 160 ++++++++++++++++++++--------------------
   branches/quickbook-dev/tools/quickbook/src/values.hpp | 23 ++++-
   branches/quickbook-dev/tools/quickbook/src/values_parse.hpp | 2
   branches/quickbook-dev/tools/quickbook/test/unit/values_test.cpp | 26 +++---
   7 files changed, 150 insertions(+), 141 deletions(-)

Modified: branches/quickbook-dev/tools/quickbook/src/actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions.cpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -232,7 +232,7 @@
         detail::markup markup = detail::get_markup(block.get_tag());
 
         value_consumer values = block;
- actions.out << markup.pre << values.consume().get_boostbook() << markup.post;
+ actions.out << markup.pre << values.consume().get_encoded() << markup.post;
         values.finish();
     }
 
@@ -251,7 +251,7 @@
         detail::markup markup = detail::get_markup(phrase.get_tag());
 
         value_consumer values = phrase;
- actions.phrase << markup.pre << values.consume().get_boostbook() << markup.post;
+ actions.phrase << markup.pre << values.consume().get_encoded() << markup.post;
         values.finish();
     }
 
@@ -265,7 +265,7 @@
         detail::print_string(values.consume().get_quickbook(), actions.phrase.get());
         actions.phrase
             << "\">"
- << values.consume().get_boostbook()
+ << values.consume().get_encoded()
             << "</phrase>";
         values.finish();
     }
@@ -279,7 +279,7 @@
             << "<footnote id=\""
             << actions.ids.add_id("f", id_category::numbered)
             << "\"><para>"
- << values.consume().get_boostbook()
+ << values.consume().get_encoded()
             << "</para></footnote>";
         values.finish();
     }
@@ -384,7 +384,7 @@
                 id_category::explicit_id);
 
             write_bridgehead(actions, level,
- content.get_boostbook(), anchor, self_linked_headers);
+ content.get_encoded(), anchor, self_linked_headers);
         }
         else if (!generic && actions.ids.compatibility_version() < 103) // version 1.2 and below
         {
@@ -392,11 +392,11 @@
             // version and the generation version are less then 103u.
 
             std::string anchor = actions.ids.old_style_id(
- detail::make_identifier(content.get_boostbook()),
+ detail::make_identifier(content.get_encoded()),
                 id_category::generated_heading);
 
             write_bridgehead(actions, level,
- content.get_boostbook(), anchor, false);
+ content.get_encoded(), anchor, false);
 
         }
         else
@@ -405,12 +405,12 @@
                 detail::make_identifier(
                     actions.ids.compatibility_version() >= 106 ?
                         content.get_quickbook() :
- content.get_boostbook()
+ content.get_encoded()
                 ),
                 id_category::generated_heading);
 
             write_bridgehead(actions, level,
- content.get_boostbook(), anchor, self_linked_headers);
+ content.get_encoded(), anchor, self_linked_headers);
         }
     }
 
@@ -433,7 +433,7 @@
         values.finish();
 
         out << markup.pre;
- out << content.get_boostbook();
+ out << content.get_encoded();
         out << markup.post;
     }
 
@@ -528,7 +528,7 @@
         BOOST_FOREACH(value item, list)
         {
             actions.out << "<listitem>";
- actions.out << item.get_boostbook();
+ actions.out << item.get_encoded();
             actions.out << "</listitem>";
         }
 
@@ -542,7 +542,7 @@
         // Note: anchor_id is never encoded as boostbook. If it
         // is encoded, it's just things like escapes.
         add_anchor(actions, anchor_id.is_encoded() ?
- anchor_id.get_boostbook() : anchor_id.get_quickbook());
+ anchor_id.get_encoded() : anchor_id.get_quickbook());
         values.finish();
     }
 
@@ -706,7 +706,7 @@
         // Need to think about uri encoding.
         
         std::string fileref = attributes["fileref"].is_encoded() ?
- attributes["fileref"].get_boostbook() :
+ attributes["fileref"].get_encoded() :
             attributes["fileref"].get_quickbook();
 
         // Check for windows paths, then convert.
@@ -753,7 +753,7 @@
 
         attribute_map::iterator alt_pos = attributes.find("alt");
         std::string alt_text = alt_pos == attributes.end() ? stem :
- alt_pos->second.is_encoded() ? alt_pos->second.get_boostbook() :
+ alt_pos->second.is_encoded() ? alt_pos->second.get_encoded() :
             alt_pos->second.get_quickbook();
         attributes.erase("alt");
 
@@ -772,7 +772,7 @@
            //
 
            attributes.insert(attribute_map::value_type("format",
- bbk_value("SVG")));
+ encoded_value("SVG")));
 
            //
            // Image paths are relative to the html subdirectory:
@@ -807,7 +807,7 @@
            if(a != std::string::npos)
            {
               attributes.insert(std::make_pair(
- "contentwidth", bbk_value(std::string(
+ "contentwidth", encoded_value(std::string(
                     svg_text.begin() + a + 1, svg_text.begin() + b))
                 ));
            }
@@ -818,7 +818,7 @@
            if(a != std::string::npos)
            {
               attributes.insert(std::make_pair(
- "contentdepth", bbk_value(std::string(
+ "contentdepth", encoded_value(std::string(
                     svg_text.begin() + a + 1, svg_text.begin() + b))
                 ));
            }
@@ -834,7 +834,7 @@
 
             if (attr.second.is_encoded())
             {
- detail::print_string(attr.second.get_boostbook(),
+ detail::print_string(attr.second.get_encoded(),
                     actions.phrase.get());
             }
             else {
@@ -866,7 +866,7 @@
     {
         value_consumer values = macro_definition;
         std::string macro_id = values.consume().get_quickbook();
- std::string phrase = values.consume().get_boostbook();
+ std::string phrase = values.consume().get_encoded();
         values.finish();
 
         std::string* existing_macro =
@@ -1017,12 +1017,12 @@
                         find_seperator(begin, end);
                     if (pos.second == end) break;
                     value new_arg(
- qbk_value_ref(last_arg.get_file(),
+ qbk_value(last_arg.get_file(),
                             pos.second, end, template_tags::phrase));
     
                     // TODO: Make sure that this is overwriting a reference, not
                     // a value.
- args.back() = qbk_value_ref(last_arg.get_file(),
+ args.back() = qbk_value(last_arg.get_file(),
                         begin, pos.first, last_arg.get_tag());
                     args.push_back(new_arg);
                 }
@@ -1096,11 +1096,11 @@
             if (symbol->content.get_tag() == template_tags::block)
             {
                 actions.paragraph();
- actions.out << symbol->content.get_boostbook();
+ actions.out << symbol->content.get_encoded();
             }
             else
             {
- actions.phrase << symbol->content.get_boostbook();
+ actions.phrase << symbol->content.get_encoded();
             }
 
             return;
@@ -1213,7 +1213,7 @@
             code += "<co id=\"" + callout_id1 + "\" ";
             code += "linkends=\"" + callout_id2 + "\" />";
 
- args.push_back(bbk_value(code, template_tags::phrase));
+ args.push_back(encoded_value(code, template_tags::phrase));
             callout_ids.push_back(callout_id1);
             callout_ids.push_back(callout_id2);
         }
@@ -1308,7 +1308,7 @@
 
             if (symbol->content.is_encoded())
             {
- actions.phrase << symbol->content.get_boostbook();
+ actions.phrase << symbol->content.get_encoded();
             }
             else
             {
@@ -1397,7 +1397,7 @@
         // Note: dst is never actually encoded as boostbook, which
         // is why the result is called with 'print_string' later.
         std::string dst = dst_value.is_encoded() ?
- dst_value.get_boostbook() : dst_value.get_quickbook();
+ dst_value.get_encoded() : dst_value.get_quickbook();
         
         actions.phrase << markup.pre;
         detail::print_string(dst, actions.phrase.get());
@@ -1406,7 +1406,7 @@
         if (content.empty())
             detail::print_string(dst, actions.phrase.get());
         else
- actions.phrase << content.get_boostbook();
+ actions.phrase << content.get_encoded();
 
         actions.phrase << markup.post;
     }
@@ -1429,13 +1429,13 @@
             
             if(entry.check()) {
                 actions.out << "<term>";
- actions.out << entry.consume().get_boostbook();
+ actions.out << entry.consume().get_encoded();
                 actions.out << "</term>";
             }
             
             if(entry.check()) {
                 actions.out << "<listitem>";
- BOOST_FOREACH(value phrase, entry) actions.out << phrase.get_boostbook();
+ BOOST_FOREACH(value phrase, entry) actions.out << phrase.get_encoded();
                 actions.out << "</listitem>";
             }
 
@@ -1497,7 +1497,7 @@
                 detail::print_string(title.get_quickbook(), actions.out.get());
             }
             else {
- actions.out << title.get_boostbook();
+ actions.out << title.get_encoded();
             }
             actions.out << "</title>";
         }
@@ -1515,7 +1515,7 @@
         {
             actions.out << "<thead>" << "<row>";
             BOOST_FOREACH(value cell, values.consume()) {
- actions.out << "<entry>" << cell.get_boostbook() << "</entry>";
+ actions.out << "<entry>" << cell.get_encoded() << "</entry>";
             }
             actions.out << "</row>\n" << "</thead>\n";
         }
@@ -1525,7 +1525,7 @@
         BOOST_FOREACH(value row, values) {
             actions.out << "<row>";
             BOOST_FOREACH(value cell, row) {
- actions.out << "<entry>" << cell.get_boostbook() << "</entry>";
+ actions.out << "<entry>" << cell.get_encoded() << "</entry>";
             }
             actions.out << "</row>\n";
         }
@@ -1569,13 +1569,13 @@
         if (self_linked_headers && actions.ids.compatibility_version() >= 103)
         {
             actions.out << "<link linkend=\"" << full_id << "\">"
- << content.get_boostbook()
+ << content.get_encoded()
                 << "</link>"
                 ;
         }
         else
         {
- actions.out << content.get_boostbook();
+ actions.out << content.get_encoded();
         }
         
         actions.out << "</title>\n";
@@ -1682,7 +1682,7 @@
 
     fs::path check_path(value const& path, quickbook::actions& actions)
     {
- std::string path_text = path.is_encoded() ? path.get_boostbook() :
+ std::string path_text = path.is_encoded() ? path.get_encoded() :
             path.get_quickbook();
 
         if(path_text.find('\\') != std::string::npos)
@@ -1948,7 +1948,7 @@
             actions.phrase.swap(value);
         }
 
- actions.values.builder.insert(qbk_bbk_value(
+ actions.values.builder.insert(encoded_qbk_value(
             actions.current_file, first.base(), last.base(), value, tag));
     }
     

Modified: branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -455,7 +455,7 @@
             "``[[callout" + boost::lexical_cast<std::string>(callout_id) + "]]``",
             first);
     
- snippet_stack->callouts.insert(qbk_value_ref(source_file, mark_begin, mark_end, template_tags::block));
+ snippet_stack->callouts.insert(qbk_value(source_file, mark_begin, mark_end, template_tags::block));
         ++callout_id;
     }
 
@@ -525,7 +525,7 @@
 
         value_builder builder;
         builder.set_tag(template_tags::snippet);
- builder.insert(qbk_value_ref(body, body->source.begin(), body->source.end(),
+ builder.insert(qbk_value(body, body->source.begin(), body->source.end(),
             template_tags::block));
         builder.insert(callouts);
 

Modified: branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -32,7 +32,7 @@
             return value;
         }
         else {
- return p.get_boostbook();
+ return p.get_encoded();
         }
     }
 
@@ -155,7 +155,7 @@
 
                 // Create a fake document info block in order to continue.
                 doc_type = "article";
- doc_title = qbk_value_ref(actions.current_file,
+ doc_title = qbk_value(actions.current_file,
                     pos.base(), pos.base(),
                     doc_info_tags::type);
                 use_doc_info = true;

Modified: branches/quickbook-dev/tools/quickbook/src/values.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/values.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/values.cpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -51,7 +51,7 @@
         string_iterator value_node::get_position() const { UNDEFINED_ERROR(); }
         int value_node::get_int() const { UNDEFINED_ERROR(); }
         string_ref value_node::get_quickbook() const { UNDEFINED_ERROR(); }
- std::string value_node::get_boostbook() const { UNDEFINED_ERROR(); }
+ std::string value_node::get_encoded() const { UNDEFINED_ERROR(); }
         value_node* value_node::get_list() const { UNDEFINED_ERROR(); }
 
         bool value_node::empty() const { return false; }
@@ -102,19 +102,19 @@
 
     namespace detail
     {
- struct value_empty_impl : public value_node
+ struct empty_value_impl : public value_node
         {
             static value_node* new_(value::tag_type t);
 
         protected:
- explicit value_empty_impl(value::tag_type t)
+ explicit empty_value_impl(value::tag_type t)
                 : value_node(t) {}
 
         private:
             char const* type_name() const { return "empty"; }
         
             virtual value_node* clone() const
- { return new value_empty_impl(tag_); }
+ { return new empty_value_impl(tag_); }
 
             virtual bool empty() const
                 { return true; }
@@ -128,12 +128,12 @@
             friend value quickbook::empty_value(value::tag_type);
         };
     
- struct value_nil_impl : public value_empty_impl
+ struct value_nil_impl : public empty_value_impl
         {
             static value_nil_impl instance;
         private:
             value_nil_impl()
- : value_empty_impl(value::default_tag)
+ : empty_value_impl(value::default_tag)
             {
                 intrusive_ptr_add_ref(&instance);
                 next_ = &value_list_end_impl::instance;
@@ -142,7 +142,7 @@
 
         value_nil_impl value_nil_impl::instance;
 
- value_node* value_empty_impl::new_(value::tag_type t) {
+ value_node* empty_value_impl::new_(value::tag_type t) {
             // The return value from this function is always placed in an
             // intrusive_ptr which will manage the memory correctly.
             // Note that value_nil_impl increments its reference count
@@ -152,13 +152,13 @@
             if (t == value::default_tag)
                 return &value_nil_impl::instance;
             else
- return new value_empty_impl(t);
+ return new empty_value_impl(t);
         }
     }
 
     value empty_value(value::tag_type t)
     {
- return value(detail::value_empty_impl::new_(t));
+ return value(detail::empty_value_impl::new_(t));
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -234,15 +234,15 @@
 
     namespace detail
     {
- struct value_int_impl : public value_node
+ struct int_value_impl : public value_node
         {
         public:
- explicit value_int_impl(int, value::tag_type);
+ explicit int_value_impl(int, value::tag_type);
         private:
             char const* type_name() const { return "integer"; }
             virtual value_node* clone() const;
             virtual int get_int() const;
- virtual std::string get_boostbook() const;
+ virtual std::string get_encoded() const;
             virtual bool empty() const;
             virtual bool is_encoded() const;
             virtual bool equals(value_node*) const;
@@ -250,37 +250,37 @@
             int value_;
         };
 
- value_int_impl::value_int_impl(int v, value::tag_type t)
+ int_value_impl::int_value_impl(int v, value::tag_type t)
             : value_node(t)
             , value_(v)
         {}
 
- value_node* value_int_impl::clone() const
+ value_node* int_value_impl::clone() const
         {
- return new value_int_impl(value_, tag_);
+ return new int_value_impl(value_, tag_);
         }
 
- int value_int_impl::get_int() const
+ int int_value_impl::get_int() const
         {
             return value_;
         }
 
- std::string value_int_impl::get_boostbook() const
+ std::string int_value_impl::get_encoded() const
         {
             return boost::lexical_cast<std::string>(value_);
         }
 
- bool value_int_impl::empty() const
+ bool int_value_impl::empty() const
         {
             return false;
         }
 
- bool value_int_impl::is_encoded() const
+ bool int_value_impl::is_encoded() const
         {
             return true;
         }
 
- bool value_int_impl::equals(value_node* other) const {
+ bool int_value_impl::equals(value_node* other) const {
             try {
                 return value_ == other->get_int();
             }
@@ -292,7 +292,7 @@
 
     value int_value(int v, value::tag_type t)
     {
- return value(new detail::value_int_impl(v, t));
+ return value(new detail::int_value_impl(v, t));
     }
 
     ////////////////////////////////////////////////////////////////////////////
@@ -300,16 +300,16 @@
 
     namespace detail
     {
- struct value_string_impl : public value_node
+ struct encoded_value_impl : public value_node
         {
         public:
- explicit value_string_impl(std::string const&, value::tag_type);
+ explicit encoded_value_impl(std::string const&, value::tag_type);
         private:
- char const* type_name() const { return "boostbook"; }
+ char const* type_name() const { return "encoded text"; }
 
- virtual ~value_string_impl();
+ virtual ~encoded_value_impl();
             virtual value_node* clone() const;
- virtual std::string get_boostbook() const;
+ virtual std::string get_encoded() const;
             virtual bool empty() const;
             virtual bool is_encoded() const;
             virtual bool equals(value_node*) const;
@@ -317,10 +317,10 @@
             std::string value_;
         };
     
- struct value_qbk_ref_impl : public value_node
+ struct qbk_value_impl : public value_node
         {
         public:
- explicit value_qbk_ref_impl(
+ explicit qbk_value_impl(
                     file_ptr const&,
                     string_iterator begin,
                     string_iterator end,
@@ -328,7 +328,7 @@
         private:
             char const* type_name() const { return "quickbook"; }
 
- virtual ~value_qbk_ref_impl();
+ virtual ~qbk_value_impl();
             virtual value_node* clone() const;
             virtual file_ptr get_file() const;
             virtual string_iterator get_position() const;
@@ -341,21 +341,21 @@
             string_iterator end_;
         };
     
- struct value_qbk_bbk_impl : public value_node
+ struct encoded_qbk_value_impl : public value_node
         {
         private:
- char const* type_name() const { return "quickbook/boostbook"; }
+ char const* type_name() const { return "encoded text with quickbook reference"; }
 
- value_qbk_bbk_impl(file_ptr const&,
+ encoded_qbk_value_impl(file_ptr const&,
                     string_iterator, string_iterator,
                     std::string const&, value::tag_type);
     
- virtual ~value_qbk_bbk_impl();
+ virtual ~encoded_qbk_value_impl();
             virtual value_node* clone() const;
             virtual file_ptr get_file() const;
             virtual string_iterator get_position() const;
             virtual string_ref get_quickbook() const;
- virtual std::string get_boostbook() const;
+ virtual std::string get_encoded() const;
             virtual bool empty() const;
             virtual bool is_encoded() const;
             virtual bool equals(value_node*) const;
@@ -363,16 +363,16 @@
             file_ptr file_;
             string_iterator begin_;
             string_iterator end_;
- std::string bbk_value_;
+ std::string encoded_value_;
             
- friend quickbook::value quickbook::qbk_bbk_value(
+ friend quickbook::value quickbook::encoded_qbk_value(
                     file_ptr const&, string_iterator, string_iterator,
                     std::string const&, quickbook::value::tag_type);
         };
 
- // value_string_impl
+ // encoded_value_impl
     
- value_string_impl::value_string_impl(
+ encoded_value_impl::encoded_value_impl(
                 std::string const& val,
                 value::tag_type tag
             )
@@ -380,36 +380,36 @@
         {
         }
     
- value_string_impl::~value_string_impl()
+ encoded_value_impl::~encoded_value_impl()
         {
         }
 
- value_node* value_string_impl::clone() const
+ value_node* encoded_value_impl::clone() const
         {
- return new value_string_impl(value_, tag_);
+ return new encoded_value_impl(value_, tag_);
         }
     
- std::string value_string_impl::get_boostbook() const
+ std::string encoded_value_impl::get_encoded() const
             { return value_; }
 
- bool value_string_impl::empty() const
+ bool encoded_value_impl::empty() const
             { return value_.empty(); }
 
- bool value_string_impl::is_encoded() const
+ bool encoded_value_impl::is_encoded() const
             { return true; }
 
- bool value_string_impl::equals(value_node* other) const {
+ bool encoded_value_impl::equals(value_node* other) const {
             try {
- return value_ == other->get_boostbook();
+ return value_ == other->get_encoded();
             }
             catch(value_undefined_method&) {
                 return false;
             }
         }
 
- // value_qbk_ref_impl
+ // qbk_value_impl
     
- value_qbk_ref_impl::value_qbk_ref_impl(
+ qbk_value_impl::qbk_value_impl(
                 file_ptr const& f,
                 string_iterator begin,
                 string_iterator end,
@@ -418,28 +418,28 @@
         {
         }
     
- value_qbk_ref_impl::~value_qbk_ref_impl()
+ qbk_value_impl::~qbk_value_impl()
         {
         }
     
- value_node* value_qbk_ref_impl::clone() const
+ value_node* qbk_value_impl::clone() const
         {
- return new value_qbk_ref_impl(file_, begin_, end_, tag_);
+ return new qbk_value_impl(file_, begin_, end_, tag_);
         }
 
- file_ptr value_qbk_ref_impl::get_file() const
+ file_ptr qbk_value_impl::get_file() const
             { return file_; }
 
- string_iterator value_qbk_ref_impl::get_position() const
+ string_iterator qbk_value_impl::get_position() const
             { return begin_; }
 
- string_ref value_qbk_ref_impl::get_quickbook() const
+ string_ref qbk_value_impl::get_quickbook() const
             { return string_ref(begin_, end_); }
 
- bool value_qbk_ref_impl::empty() const
+ bool qbk_value_impl::empty() const
             { return begin_ == end_; }
     
- bool value_qbk_ref_impl::equals(value_node* other) const {
+ bool qbk_value_impl::equals(value_node* other) const {
             try {
                 return this->get_quickbook() == other->get_quickbook();
             }
@@ -448,60 +448,60 @@
             }
         }
 
- // value_qbk_bbk_impl
+ // encoded_qbk_value_impl
     
- value_qbk_bbk_impl::value_qbk_bbk_impl(
+ encoded_qbk_value_impl::encoded_qbk_value_impl(
                 file_ptr const& f,
                 string_iterator begin,
                 string_iterator end,
- std::string const& bbk,
+ std::string const& encoded,
                 value::tag_type tag)
             : value_node(tag)
             , file_(f)
             , begin_(begin)
             , end_(end)
- , bbk_value_(bbk)
+ , encoded_value_(encoded)
             
         {
         }
     
- value_qbk_bbk_impl::~value_qbk_bbk_impl()
+ encoded_qbk_value_impl::~encoded_qbk_value_impl()
         {
         }
 
- value_node* value_qbk_bbk_impl::clone() const
+ value_node* encoded_qbk_value_impl::clone() const
         {
- return new value_qbk_bbk_impl(
- file_, begin_, end_, bbk_value_, tag_);
+ return new encoded_qbk_value_impl(
+ file_, begin_, end_, encoded_value_, tag_);
         }
 
- file_ptr value_qbk_bbk_impl::get_file() const
+ file_ptr encoded_qbk_value_impl::get_file() const
             { return file_; }
 
- string_iterator value_qbk_bbk_impl::get_position() const
+ string_iterator encoded_qbk_value_impl::get_position() const
             { return begin_; }
 
- string_ref value_qbk_bbk_impl::get_quickbook() const
+ string_ref encoded_qbk_value_impl::get_quickbook() const
             { return string_ref(begin_, end_); }
 
- std::string value_qbk_bbk_impl::get_boostbook() const
- { return bbk_value_; }
+ std::string encoded_qbk_value_impl::get_encoded() const
+ { return encoded_value_; }
 
         // Should this test the quickbook, the boostbook or both?
- bool value_qbk_bbk_impl::empty() const
- { return bbk_value_.empty(); }
+ bool encoded_qbk_value_impl::empty() const
+ { return encoded_value_.empty(); }
 
- bool value_qbk_bbk_impl::is_encoded() const
+ bool encoded_qbk_value_impl::is_encoded() const
             { return true; }
 
- bool value_qbk_bbk_impl::equals(value_node* other) const {
+ bool encoded_qbk_value_impl::equals(value_node* other) const {
             try {
                 return this->get_quickbook() == other->get_quickbook();
             }
             catch(value_undefined_method&) {}
 
             try {
- return this->get_boostbook() == other->get_boostbook();
+ return this->get_encoded() == other->get_encoded();
             }
             catch(value_undefined_method&) {}
 
@@ -509,21 +509,21 @@
         }
     }
 
- value qbk_value_ref(file_ptr const& f, string_iterator x, string_iterator y, value::tag_type t)
+ value qbk_value(file_ptr const& f, string_iterator x, string_iterator y, value::tag_type t)
     {
- return value(new detail::value_qbk_ref_impl(f, x, y, t));
+ return value(new detail::qbk_value_impl(f, x, y, t));
     }
 
- value bbk_value(std::string const& x, value::tag_type t)
+ value encoded_value(std::string const& x, value::tag_type t)
     {
- return value(new detail::value_string_impl(x, t));
+ return value(new detail::encoded_value_impl(x, t));
     }
 
- value qbk_bbk_value(
+ value encoded_qbk_value(
             file_ptr const& f, string_iterator x, string_iterator y,
             std::string const& z, value::tag_type t)
     {
- return value(new detail::value_qbk_bbk_impl(f,x,y,z,t));
+ return value(new detail::encoded_qbk_value_impl(f,x,y,z,t));
     }
 
     //////////////////////////////////////////////////////////////////////////

Modified: branches/quickbook-dev/tools/quickbook/src/values.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/values.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/values.hpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -52,7 +52,7 @@
             virtual file_ptr get_file() const;
             virtual string_iterator get_position() const;
             virtual string_ref get_quickbook() const;
- virtual std::string get_boostbook() const;
+ virtual std::string get_encoded() const;
             virtual int get_int() const;
 
             virtual bool check() const;
@@ -115,8 +115,8 @@
             { return value_->get_position(); }
             string_ref get_quickbook() const
             { return value_->get_quickbook(); }
- std::string get_boostbook() const
- { return value_->get_boostbook(); }
+ std::string get_encoded() const
+ { return value_->get_encoded(); }
             int get_int() const
             { return value_->get_int(); }
 
@@ -239,12 +239,21 @@
     // Integers
     value int_value(int, value::tag_type = value::default_tag);
 
- // Boostbook and quickbook strings
- value qbk_value_ref(file_ptr const&, string_iterator, string_iterator, value::tag_type = value::default_tag);
- value bbk_value(std::string const&, value::tag_type = value::default_tag);
- value qbk_bbk_value(file_ptr const&, string_iterator, string_iterator, std::string const&,
+ // String types
+
+ // Quickbook strings contain a reference to the original quickbook source.
+ value qbk_value(file_ptr const&, string_iterator, string_iterator,
+ value::tag_type = value::default_tag);
+
+ // Encoded strings are either plain text or boostbook.
+ value encoded_value(std::string const&,
             value::tag_type = value::default_tag);
 
+ // An encoded quickbook string is an encoded string that contains a
+ // reference to the quickbook source it was generated from.
+ value encoded_qbk_value(file_ptr const&, string_iterator, string_iterator,
+ std::string const&, value::tag_type = value::default_tag);
+
     ////////////////////////////////////////////////////////////////////////////
     // Value Builder
     //

Modified: branches/quickbook-dev/tools/quickbook/src/values_parse.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/values_parse.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/values_parse.hpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -63,7 +63,7 @@
         void operator()(parse_iterator begin, parse_iterator end,
                 value::tag_type tag = value::default_tag) const
         {
- b.insert(qbk_value_ref(*current_file, begin.base(), end.base(), tag));
+ b.insert(qbk_value(*current_file, begin.base(), end.base(), tag));
         }
 
         void operator()(int v,

Modified: branches/quickbook-dev/tools/quickbook/test/unit/values_test.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/test/unit/values_test.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/test/unit/values_test.cpp 2011-11-22 18:47:02 EST (Tue, 22 Nov 2011)
@@ -30,7 +30,7 @@
     {
         quickbook::file_ptr fake_file = new quickbook::file(
             "(fake file)", source, 105u);
- q = quickbook::qbk_value_ref(
+ q = quickbook::qbk_value(
             fake_file,
             fake_file->source.begin(),
             fake_file->source.end());
@@ -41,14 +41,14 @@
 void sort_test()
 {
     quickbook::value_builder b;
- b.insert(quickbook::bbk_value("a", 10));
- b.insert(quickbook::bbk_value("b", 2));
- b.insert(quickbook::bbk_value("c", 5));
- b.insert(quickbook::bbk_value("d", 8));
+ b.insert(quickbook::encoded_value("a", 10));
+ b.insert(quickbook::encoded_value("b", 2));
+ b.insert(quickbook::encoded_value("c", 5));
+ b.insert(quickbook::encoded_value("d", 8));
     b.sort_list();
     
     quickbook::value_consumer c = b.release();
- BOOST_TEST(c.check(2)); BOOST_TEST_EQ(c.consume(2).get_boostbook(), "b");
+ BOOST_TEST(c.check(2)); BOOST_TEST_EQ(c.consume(2).get_encoded(), "b");
     BOOST_TEST(c.check(5)); c.consume(5);
     BOOST_TEST(c.check(8)); c.consume(8);
     BOOST_TEST(c.check(10)); c.consume(10);
@@ -60,29 +60,29 @@
     quickbook::value_builder list1;
     quickbook::value_builder list2;
 
- list1.insert(quickbook::bbk_value("b", 10));
+ list1.insert(quickbook::encoded_value("b", 10));
 
     {
- quickbook::value p1 = quickbook::bbk_value("a", 5);
+ quickbook::value p1 = quickbook::encoded_value("a", 5);
         list1.insert(p1);
         list2.insert(p1);
     }
 
- list2.insert(quickbook::bbk_value("c", 3));
+ list2.insert(quickbook::encoded_value("c", 3));
 
     quickbook::value_consumer l1 = list1.release();
     quickbook::value_consumer l2 = list2.release();
 
     BOOST_TEST(l1.check(10));
- BOOST_TEST_EQ(l1.consume(10).get_boostbook(), "b");
+ BOOST_TEST_EQ(l1.consume(10).get_encoded(), "b");
     BOOST_TEST(l1.check(5));
- BOOST_TEST_EQ(l1.consume(5).get_boostbook(), "a");
+ BOOST_TEST_EQ(l1.consume(5).get_encoded(), "a");
     BOOST_TEST(!l1.check());
 
     BOOST_TEST(l2.check(5));
- BOOST_TEST_EQ(l2.consume(5).get_boostbook(), "a");
+ BOOST_TEST_EQ(l2.consume(5).get_encoded(), "a");
     BOOST_TEST(l2.check(3));
- BOOST_TEST_EQ(l2.consume(3).get_boostbook(), "c");
+ BOOST_TEST_EQ(l2.consume(3).get_encoded(), "c");
     BOOST_TEST(!l2.check());
 }
 


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