|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r75616 - in branches/quickbook-dev/tools/quickbook: src test/unit
From: dnljms_at_[hidden]
Date: 2011-11-22 18:46:15
Author: danieljames
Date: 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
New Revision: 75616
URL: http://svn.boost.org/trac/boost/changeset/75616
Log:
Quickbook: Use intrusive_ptr for files.
Added:
branches/quickbook-dev/tools/quickbook/src/intrusive_base.hpp (contents, props changed)
Text files modified:
branches/quickbook-dev/tools/quickbook/src/actions.cpp | 15 +++++++--------
branches/quickbook-dev/tools/quickbook/src/actions_class.hpp | 5 +----
branches/quickbook-dev/tools/quickbook/src/actions_state.hpp | 2 +-
branches/quickbook-dev/tools/quickbook/src/code_snippet.cpp | 6 +++---
branches/quickbook-dev/tools/quickbook/src/doc_info_actions.cpp | 2 +-
branches/quickbook-dev/tools/quickbook/src/files.cpp | 35 ++++++++++++++---------------------
branches/quickbook-dev/tools/quickbook/src/files.hpp | 25 +++++++++++++++----------
branches/quickbook-dev/tools/quickbook/src/fwd.hpp | 2 ++
branches/quickbook-dev/tools/quickbook/src/id_manager.cpp | 35 +++++------------------------------
branches/quickbook-dev/tools/quickbook/src/input_path.cpp | 4 ++--
branches/quickbook-dev/tools/quickbook/src/input_path.hpp | 4 ++--
branches/quickbook-dev/tools/quickbook/src/quickbook.cpp | 3 +--
branches/quickbook-dev/tools/quickbook/src/values.cpp | 28 ++++++++++++++--------------
branches/quickbook-dev/tools/quickbook/src/values.hpp | 9 +++++----
branches/quickbook-dev/tools/quickbook/src/values_parse.hpp | 6 +++---
branches/quickbook-dev/tools/quickbook/test/unit/values_test.cpp | 18 +++++++++++-------
16 files changed, 87 insertions(+), 112 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:46:13 EST (Tue, 22 Nov 2011)
@@ -593,15 +593,15 @@
mapped.start(actions.current_file);
mapped.unindent_and_add(first.base(), last.base());
- file const* file_ptr = mapped.release();
+ file_ptr f = mapped.release();
- if (file_ptr->source.empty())
+ if (f->source.empty())
return; // Nothing left to do here. The program is empty.
- parse_iterator first_(file_ptr->source.begin());
- parse_iterator last_(file_ptr->source.end());
+ parse_iterator first_(f->source.begin());
+ parse_iterator last_(f->source.end());
- file const* saved_file = file_ptr;
+ file_ptr saved_file = f;
boost::swap(actions.current_file, saved_file);
// print the code with syntax coloring
@@ -1063,7 +1063,7 @@
, quickbook::actions& actions
)
{
- file const* saved_current_file = actions.current_file;
+ file_ptr saved_current_file = actions.current_file;
actions.current_file = content.get_file();
string_ref source = content.get_quickbook();
@@ -1792,8 +1792,7 @@
qbk_version_n >= 106u ? file_state::scope_callables :
file_state::scope_macros);
- actions.current_file_tmp = load(paths.filename); // Throws load_error
- actions.current_file = actions.current_file_tmp;
+ actions.current_file = load(paths.filename); // Throws load_error
actions.filename_relative = paths.filename_relative;
actions.imported = (load_type == block_tags::import);
Modified: branches/quickbook-dev/tools/quickbook/src/actions_class.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_class.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_class.hpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -46,15 +46,12 @@
bool warned_about_breaks;
bool conditional;
id_manager& ids;
- file* current_file_tmp; // Temporary non-const pointer to new
- // current_file so that the
- // version can be written to.
// state saved for files and templates.
bool imported;
string_symbols macro;
std::string source_mode;
- file const* current_file;
+ file_ptr current_file;
fs::path filename_relative; // for the __FILENAME__ macro.
// (relative to the original file
// or include path).
Modified: branches/quickbook-dev/tools/quickbook/src/actions_state.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/actions_state.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/actions_state.hpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -37,7 +37,7 @@
unsigned qbk_version;
bool imported;
std::string doc_type;
- file const* current_file;
+ file_ptr current_file;
fs::path filename_relative;
fs::path xinclude_base;
std::string source_mode;
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:46:13 EST (Tue, 22 Nov 2011)
@@ -26,7 +26,7 @@
struct code_snippet_actions
{
code_snippet_actions(std::vector<template_symbol>& storage,
- file* source_file,
+ file_ptr source_file,
char const* source_type)
: last_code_pos(source_file->source.begin())
, in_code(false)
@@ -93,7 +93,7 @@
int callout_id;
boost::shared_ptr<snippet_data> snippet_stack;
std::vector<template_symbol>& storage;
- file* source_file;
+ file_ptr source_file;
char const* const source_type;
};
@@ -521,7 +521,7 @@
++i;
}
- file* body = f.release();
+ file_ptr body = f.release();
value_builder builder;
builder.set_tag(template_tags::snippet);
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:46:13 EST (Tue, 22 Nov 2011)
@@ -228,7 +228,7 @@
"Version 1.1 is assumed" << std::endl;
}
- actions.current_file_tmp->version(qbk_version_n);
+ actions.current_file->version(qbk_version_n);
// Compatibility Version
Modified: branches/quickbook-dev/tools/quickbook/src/files.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/files.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/files.cpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -13,14 +13,13 @@
#include <boost/range/algorithm/upper_bound.hpp>
#include <boost/range/algorithm/transform.hpp>
#include <fstream>
-#include <list>
#include <iterator>
namespace quickbook
{
namespace
{
- boost::unordered_map<fs::path, file> files;
+ boost::unordered_map<fs::path, file_ptr> files;
}
// Read the first few bytes in a file to see it starts with a byte order
@@ -100,9 +99,9 @@
}
}
- file* load(fs::path const& filename, unsigned qbk_version)
+ file_ptr load(fs::path const& filename, unsigned qbk_version)
{
- boost::unordered_map<fs::path, file>::iterator pos
+ boost::unordered_map<fs::path, file_ptr>::iterator pos
= files.find(filename);
if (pos == files.end())
@@ -124,15 +123,12 @@
bool inserted;
boost::tie(pos, inserted) = files.emplace(
- boost::unordered::piecewise_construct,
- boost::make_tuple(filename),
- boost::make_tuple(filename, source, qbk_version)
- );
+ filename, new file(filename, source, qbk_version));
assert(inserted);
}
- return &pos->second;
+ return pos->second;
}
file_position relative_position(
@@ -285,11 +281,11 @@
struct mapped_file : file
{
- mapped_file(file const* original) :
+ mapped_file(file_ptr original) :
file(original->path, std::string(), original->version()),
original(original), mapped_sections() {}
- file const* original;
+ file_ptr original;
std::vector<mapped_file_section> mapped_sections;
void add_empty_mapped_file_section(std::string::const_iterator pos) {
@@ -328,36 +324,33 @@
struct mapped_file_builder_data
{
mapped_file_builder_data() { reset(); }
- void reset() { new_file = mapped_files.end(); }
+ void reset() { new_file.reset(); }
- std::list<mapped_file>::iterator new_file;
+ boost::intrusive_ptr<mapped_file> new_file;
};
mapped_file_builder::mapped_file_builder() : data(0) {}
mapped_file_builder::~mapped_file_builder() { delete data; }
- void mapped_file_builder::start(file const* f)
+ void mapped_file_builder::start(file_ptr f)
{
if (!data) {
data = new mapped_file_builder_data;
}
- assert(data->new_file == mapped_files.end());
- mapped_files.push_back(mapped_file(f));
- data->new_file = mapped_files.end();
- --data->new_file;
+ assert(!data->new_file);
+ data->new_file = new mapped_file(f);
}
- file* mapped_file_builder::release()
+ file_ptr mapped_file_builder::release()
{
- file* r = &*data->new_file;
+ file_ptr r = data->new_file;
data->reset();
return r;
}
void mapped_file_builder::clear()
{
- mapped_files.erase(data->new_file);
data->reset();
}
Modified: branches/quickbook-dev/tools/quickbook/src/files.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/files.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/files.hpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -13,18 +13,17 @@
#include <string>
#include <boost/filesystem/v3/path.hpp>
+#include <boost/intrusive_ptr.hpp>
#include <stdexcept>
#include <cassert>
+#include "intrusive_base.hpp"
namespace quickbook {
namespace fs = boost::filesystem;
- struct load_error : std::runtime_error
- {
- explicit load_error(std::string const& arg)
- : std::runtime_error(arg) {}
- };
+ struct file;
+ typedef boost::intrusive_ptr<file> file_ptr;
struct file_position
{
@@ -35,7 +34,7 @@
int column;
};
- struct file
+ struct file : intrusive_base<file>
{
fs::path const path;
std::string source;
@@ -48,7 +47,7 @@
path(path), source(source), qbk_version(qbk_version)
{}
- ~file() {}
+ virtual ~file() {}
unsigned version() const {
assert(qbk_version);
@@ -67,9 +66,15 @@
};
// If version isn't supplied then it must be set later.
- file* load(fs::path const& filename,
+ file_ptr load(fs::path const& filename,
unsigned qbk_version = 0);
+ struct load_error : std::runtime_error
+ {
+ explicit load_error(std::string const& arg)
+ : std::runtime_error(arg) {}
+ };
+
// Interface for creating fake files which are mapped to
// real files, so that the position can be found later.
@@ -83,8 +88,8 @@
mapped_file_builder();
~mapped_file_builder();
- void start(file const*);
- file* release();
+ void start(file_ptr);
+ file_ptr release();
void clear();
bool empty() const;
Modified: branches/quickbook-dev/tools/quickbook/src/fwd.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/fwd.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/fwd.hpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -12,6 +12,7 @@
#define BOOST_SPIRIT_FWD_HPP
#include "iterator.hpp"
+#include <boost/intrusive_ptr.hpp>
namespace quickbook
{
@@ -21,6 +22,7 @@
struct id_manager;
struct section_info;
struct file;
+ typedef boost::intrusive_ptr<file> file_ptr;
typedef std::string::const_iterator string_iterator;
typedef lookback_iterator<string_iterator> parse_iterator;
Modified: branches/quickbook-dev/tools/quickbook/src/id_manager.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/id_manager.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/id_manager.cpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -9,6 +9,7 @@
#include "id_manager.hpp"
#include "utils.hpp"
#include "string_ref.hpp"
+#include "intrusive_base.hpp"
#include <boost/intrusive_ptr.hpp>
#include <boost/unordered_map.hpp>
#include <boost/lexical_cast.hpp>
@@ -31,32 +32,6 @@
static const std::size_t max_size = 32;
//
- // instructive_base
- //
- // I should probably make this a recursive template, or use SFINAE to check
- // the release is correct, or maybe use a virtual destructor. But I'm
- // feeling reckless.
- //
-
- struct intrusive_base
- {
- intrusive_base() : ref_count_(0) {}
- intrusive_base(intrusive_base const&) : ref_count_(0) {}
- intrusive_base& operator=(intrusive_base const&) { return *this; }
- ~intrusive_base() { assert(!ref_count_); }
-
- unsigned ref_count_;
-
- friend void intrusive_ptr_add_ref(intrusive_base* ptr)
- { ++ptr->ref_count_; }
-
- template <typename T>
- friend void intrusive_ptr_release(T* ptr)
- { if(--ptr->ref_count_ == 0) delete ptr; }
- private:
- };
-
- //
// id_placeholder
//
@@ -176,7 +151,7 @@
void restore_section();
};
- struct file_info : intrusive_base
+ struct file_info : intrusive_base<file_info>
{
boost::intrusive_ptr<file_info> parent;
boost::intrusive_ptr<doc_info> document;
@@ -207,7 +182,7 @@
{}
};
- struct doc_info : intrusive_base
+ struct doc_info : intrusive_base<doc_info>
{
boost::intrusive_ptr<section_info> current_section;
std::string last_title_1_1;
@@ -218,7 +193,7 @@
{}
};
- struct section_info : intrusive_base
+ struct section_info : intrusive_base<section_info>
{
boost::intrusive_ptr<section_info> parent;
unsigned compatibility_version;
@@ -820,7 +795,7 @@
// Data used for generating placeholders that have duplicates.
//
- struct id_generation_data : intrusive_base
+ struct id_generation_data : intrusive_base<id_generation_data>
{
id_generation_data(std::string const& src_id)
: child_start(src_id.rfind('.') + 1),
Modified: branches/quickbook-dev/tools/quickbook/src/input_path.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/input_path.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/input_path.cpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -230,7 +230,7 @@
}
}
- ostream& outerr(file const* f, string_iterator pos)
+ ostream& outerr(file_ptr const& f, string_iterator pos)
{
return outerr(f->path, f->position_of(pos).line);
}
@@ -250,7 +250,7 @@
}
}
- ostream& outwarn(file const* f, string_iterator pos)
+ ostream& outwarn(file_ptr const& f, string_iterator pos)
{
return outwarn(f->path, f->position_of(pos).line);
}
Modified: branches/quickbook-dev/tools/quickbook/src/input_path.hpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/input_path.hpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/input_path.hpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -92,8 +92,8 @@
ostream& outerr();
ostream& outerr(fs::path const& file, int line = -1);
ostream& outwarn(fs::path const& file, int line = -1);
- ostream& outerr(file const*, string_iterator);
- ostream& outwarn(file const*, string_iterator);
+ ostream& outerr(file_ptr const&, string_iterator);
+ ostream& outwarn(file_ptr const&, string_iterator);
struct utf8_proxy
{
Added: branches/quickbook-dev/tools/quickbook/src/intrusive_base.hpp
==============================================================================
--- (empty file)
+++ branches/quickbook-dev/tools/quickbook/src/intrusive_base.hpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -0,0 +1,36 @@
+/*=============================================================================
+ Copyright (c) 2011 Daniel James
+
+ 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_QUICKBOOK_INTRUSIVE_BASE_HPP)
+#define BOOST_QUICKBOOK_INTRUSIVE_BASE_HPP
+
+namespace quickbook
+{
+ //
+ // instructive_base
+ //
+
+ template <typename T>
+ struct intrusive_base
+ {
+ intrusive_base() : ref_count_(0) {}
+ intrusive_base(intrusive_base const&) : ref_count_(0) {}
+ intrusive_base& operator=(intrusive_base const&) { return *this; }
+ ~intrusive_base() { assert(!ref_count_); }
+
+ friend void intrusive_ptr_add_ref(T* ptr)
+ { ++ptr->ref_count_; }
+
+ friend void intrusive_ptr_release(T* ptr)
+ { if(--ptr->ref_count_ == 0) delete ptr; }
+ private:
+ unsigned ref_count_;
+ };
+}
+
+#endif
Modified: branches/quickbook-dev/tools/quickbook/src/quickbook.cpp
==============================================================================
--- branches/quickbook-dev/tools/quickbook/src/quickbook.cpp (original)
+++ branches/quickbook-dev/tools/quickbook/src/quickbook.cpp 2011-11-22 18:46:13 EST (Tue, 22 Nov 2011)
@@ -118,8 +118,7 @@
actions actor(filein_, xinclude_base_, buffer, ids);
set_macros(actor);
- actor.current_file_tmp = load(filein_); // Throws load_error
- actor.current_file = actor.current_file_tmp;
+ actor.current_file = load(filein_); // Throws load_error
parse_file(actor);
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:46:13 EST (Tue, 22 Nov 2011)
@@ -47,7 +47,7 @@
value_node::~value_node() {
}
- file const* value_node::get_file() const { UNDEFINED_ERROR(); }
+ file_ptr value_node::get_file() const { UNDEFINED_ERROR(); }
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(); }
@@ -321,7 +321,7 @@
{
public:
explicit value_qbk_ref_impl(
- file const*,
+ file_ptr const&,
string_iterator begin,
string_iterator end,
value::tag_type);
@@ -330,13 +330,13 @@
virtual ~value_qbk_ref_impl();
virtual value_node* clone() const;
- virtual file const* get_file() const;
+ virtual file_ptr get_file() const;
virtual string_iterator get_position() const;
virtual string_ref get_quickbook() const;
virtual bool empty() const;
virtual bool equals(value_node*) const;
- file const* file_;
+ file_ptr file_;
string_iterator begin_;
string_iterator end_;
};
@@ -346,13 +346,13 @@
private:
char const* type_name() const { return "quickbook/boostbook"; }
- value_qbk_bbk_impl(file const*,
+ value_qbk_bbk_impl(file_ptr const&,
string_iterator, string_iterator,
std::string const&, value::tag_type);
virtual ~value_qbk_bbk_impl();
virtual value_node* clone() const;
- virtual file const* get_file() 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;
@@ -360,13 +360,13 @@
virtual bool is_encoded() const;
virtual bool equals(value_node*) const;
- file const* file_;
+ file_ptr file_;
string_iterator begin_;
string_iterator end_;
std::string bbk_value_;
friend quickbook::value quickbook::qbk_bbk_value(
- file const*, string_iterator, string_iterator,
+ file_ptr const&, string_iterator, string_iterator,
std::string const&, quickbook::value::tag_type);
};
@@ -410,7 +410,7 @@
// value_qbk_ref_impl
value_qbk_ref_impl::value_qbk_ref_impl(
- file const* f,
+ file_ptr const& f,
string_iterator begin,
string_iterator end,
value::tag_type tag
@@ -427,7 +427,7 @@
return new value_qbk_ref_impl(file_, begin_, end_, tag_);
}
- file const* value_qbk_ref_impl::get_file() const
+ file_ptr value_qbk_ref_impl::get_file() const
{ return file_; }
string_iterator value_qbk_ref_impl::get_position() const
@@ -451,7 +451,7 @@
// value_qbk_bbk_impl
value_qbk_bbk_impl::value_qbk_bbk_impl(
- file const* f,
+ file_ptr const& f,
string_iterator begin,
string_iterator end,
std::string const& bbk,
@@ -475,7 +475,7 @@
file_, begin_, end_, bbk_value_, tag_);
}
- file const* value_qbk_bbk_impl::get_file() const
+ file_ptr value_qbk_bbk_impl::get_file() const
{ return file_; }
string_iterator value_qbk_bbk_impl::get_position() const
@@ -509,7 +509,7 @@
}
}
- value qbk_value_ref(file const* f, string_iterator x, string_iterator y, value::tag_type t)
+ value qbk_value_ref(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));
}
@@ -520,7 +520,7 @@
}
value qbk_bbk_value(
- file const* f, string_iterator x, string_iterator y,
+ 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));
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:46:13 EST (Tue, 22 Nov 2011)
@@ -19,6 +19,7 @@
#include <stdexcept>
#include "fwd.hpp"
#include "string_ref.hpp"
+#include "files.hpp"
namespace quickbook
{
@@ -48,7 +49,7 @@
virtual char const* type_name() const = 0;
virtual value_node* clone() const = 0;
- virtual file const* get_file() 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;
@@ -108,7 +109,7 @@
// Item accessors
int get_tag() const { return value_->tag_; }
- file const* get_file() const
+ file_ptr get_file() const
{ return value_->get_file(); }
string_iterator get_position() const
{ return value_->get_position(); }
@@ -239,9 +240,9 @@
value int_value(int, value::tag_type = value::default_tag);
// Boostbook and quickbook strings
- value qbk_value_ref(file const*, string_iterator, string_iterator, value::tag_type = value::default_tag);
+ 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 const*, string_iterator, string_iterator, std::string const&,
+ value qbk_bbk_value(file_ptr const&, string_iterator, string_iterator, std::string const&,
value::tag_type = value::default_tag);
////////////////////////////////////////////////////////////////////////////
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:46:13 EST (Tue, 22 Nov 2011)
@@ -57,7 +57,7 @@
typedef void type;
};
- value_entry(value_builder& b, file const** current_file)
+ value_entry(value_builder& b, file_ptr* current_file)
: b(b), current_file(current_file) {}
void operator()(parse_iterator begin, parse_iterator end,
@@ -73,7 +73,7 @@
}
value_builder& b;
- file const** current_file;
+ file_ptr* current_file;
};
struct value_sort
@@ -92,7 +92,7 @@
struct value_parser
{
- value_parser(file const** current_file)
+ value_parser(file_ptr* current_file)
: builder()
, save(builder)
, list(builder)
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:46:13 EST (Tue, 22 Nov 2011)
@@ -25,13 +25,17 @@
void qbk_tests()
{
- quickbook::file fake_file(
- "(fake file)", "Source", 105u);
- quickbook::value q = quickbook::qbk_value_ref(
- &fake_file,
- fake_file.source.begin(),
- fake_file.source.end());
- BOOST_TEST_EQ(q.get_quickbook(), fake_file.source);
+ std::string source = "Source";
+ quickbook::value q;
+ {
+ quickbook::file_ptr fake_file = new quickbook::file(
+ "(fake file)", source, 105u);
+ q = quickbook::qbk_value_ref(
+ fake_file,
+ fake_file->source.begin(),
+ fake_file->source.end());
+ }
+ BOOST_TEST_EQ(q.get_quickbook(), source);
}
void sort_test()
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