|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r67291 - trunk/boost/spirit/home/support/utree
From: hartmut.kaiser_at_[hidden]
Date: 2010-12-17 21:29:51
Author: hkaiser
Date: 2010-12-17 21:29:50 EST (Fri, 17 Dec 2010)
New Revision: 67291
URL: http://svn.boost.org/trac/boost/changeset/67291
Log:
Spirit: whitespace fixes
Text files modified:
trunk/boost/spirit/home/support/utree/utree.hpp | 155 +++++++++++++++++++--------------------
1 files changed, 77 insertions(+), 78 deletions(-)
Modified: trunk/boost/spirit/home/support/utree/utree.hpp
==============================================================================
--- trunk/boost/spirit/home/support/utree/utree.hpp (original)
+++ trunk/boost/spirit/home/support/utree/utree.hpp 2010-12-17 21:29:50 EST (Fri, 17 Dec 2010)
@@ -38,8 +38,8 @@
{
//[utree_exceptions
// All exceptions thrown by utree are derived from utree_exception.
- struct utree_exception : std::exception {};
-
+ struct utree_exception : std::exception {};
+
// bad_type_exception is thrown whenever somebody calls a member function
// which applies to certain stored utree_type's only, but this precondition
// is violated as the utree instance holds some other type.
@@ -51,7 +51,7 @@
}
};
//]
-
+
//[utree_types
struct utree_type
{
@@ -66,12 +66,12 @@
// where F is an unary function object taking a
// scope as it's parameter and returning a
// utree.
-
+
// numeric atoms
bool_type,
int_type,
double_type,
-
+
// text atoms (utf8)
string_type,
string_range_type,
@@ -80,12 +80,12 @@
};
};
//]
-
+
///////////////////////////////////////////////////////////////////////////
// The nil type
///////////////////////////////////////////////////////////////////////////
struct nil {};
-
+
///////////////////////////////////////////////////////////////////////////
// A typed string with parametric Base storage. The storage can be any
// range or (stl container) of chars.
@@ -94,34 +94,34 @@
struct basic_string : Base
{
static utree_type::info const type = type_;
-
+
basic_string()
: Base() {}
-
+
basic_string(Base const& base)
: Base(base) {}
-
+
template <typename Iterator>
basic_string(Iterator bits, std::size_t len)
: Base(bits, bits + len) {}
-
+
template <typename Iterator>
basic_string(Iterator first, Iterator last)
: Base(first, last) {}
-
+
basic_string& operator=(basic_string const& other)
{
Base::operator=(other);
return *this;
}
-
+
basic_string& operator=(Base const& other)
{
Base::operator=(other);
return *this;
}
};
-
+
//[utree_strings
// Binary string
typedef basic_string<
@@ -132,7 +132,7 @@
std::string,
utree_type::binary_type>
binary_string;
-
+
// UTF-8 string
typedef basic_string<
boost::iterator_range<char const*>,
@@ -142,7 +142,7 @@
std::string,
utree_type::string_type>
utf8_string_type;
-
+
// UTF-8 symbol
typedef basic_string<
boost::iterator_range<char const*>,
@@ -153,13 +153,13 @@
utree_type::symbol_type>
utf8_symbol;
//]
-
+
///////////////////////////////////////////////////////////////////////////
// Our function type
///////////////////////////////////////////////////////////////////////////
class utree;
class scope;
-
+
//[utree_function_object_interface
struct function_base
{
@@ -170,7 +170,7 @@
// function_base instance
// that is equal to f.
};
-
+
template <typename F>
struct stored_function : function_base
{
@@ -181,21 +181,21 @@
virtual function_base* clone() const;
};
//]
-
+
///////////////////////////////////////////////////////////////////////////
// Shallow tag. Instructs utree to hold an iterator_range
// as-is without deep copying the range.
///////////////////////////////////////////////////////////////////////////
struct shallow_tag {};
shallow_tag const shallow = {};
-
+
///////////////////////////////////////////////////////////////////////////
// A void* plus type_info
///////////////////////////////////////////////////////////////////////////
class any_ptr
{
public:
-
+
template <typename Ptr>
typename boost::disable_if<
boost::is_polymorphic<
@@ -209,32 +209,32 @@
}
throw std::bad_cast();
}
-
+
template <typename T>
any_ptr(T* p)
: p(p), i(&typeid(T*))
{}
-
+
friend bool operator==(any_ptr const& a, any_ptr const& b)
{
return (a.p == b.p) && (*a.i == *b.i);
}
-
+
private:
-
+
// constructor is private
any_ptr(void* p, std::type_info const* i)
: p(p), i(i) {}
-
+
template <typename UTreeX, typename UTreeY>
friend struct detail::visit_impl;
-
+
friend class utree;
-
+
void* p;
std::type_info const* i;
};
-
+
//[utree
class utree {
public:
@@ -243,40 +243,40 @@
typedef utree const& const_reference;
typedef std::ptrdiff_t difference_type;
typedef std::size_t size_type;
-
+
typedef detail::list::node_iterator<utree>
iterator;
typedef detail::list::node_iterator<utree const>
const_iterator;
typedef detail::list::node_iterator<boost::reference_wrapper<utree> >
ref_iterator;
-
+
typedef boost::iterator_range<iterator> range;
typedef boost::iterator_range<const_iterator> const_range;
-
+
// dtor
~utree();
-
+
////////////////////////////////////////////////////////////////////////
// ctors and assignment operators
-
+
// nil
utree();
-
+
// boolean
utree(bool);
reference operator=(bool);
-
+
// integer
utree(unsigned int);
utree(int);
reference operator=(unsigned int);
reference operator=(int);
-
+
// double
utree(double);
reference operator=(double);
-
+
// string
utree(char);
utree(char const*);
@@ -286,81 +286,81 @@
reference operator=(char);
reference operator=(char const*);
reference operator=(std::string const&);
-
+
// reference
utree(boost::reference_wrapper<utree>);
reference operator=(boost::reference_wrapper<utree>);
-
+
// any
utree(any_ptr const&);
reference operator=(any_ptr const&);
-
+
// range
template <class Iter>
utree(boost::iterator_range<Iter>);
template <class Iter>
reference operator=(boost::iterator_range<Iter>);
-
+
// function object
template <class F>
utree(stored_function<F> const&);
template <class F>
reference operator=(stored_function<F> const&);
-
+
// typed string
template <class Base, utree_type::info type_>
utree(basic_string<Base, type_> const&);
template <class Base, utree_type::info type_>
reference operator=(basic_string<Base, type_> const&);
-
+
// copy
utree(const_reference);
reference operator=(const_reference);
-
+
// range
utree(range, shallow_tag);
utree(const_range, shallow_tag);
-
+
// assign dispatch
template <class Iter>
void assign(Iter, Iter);
-
+
////////////////////////////////////////////////////////////////////////
-
+
////////////////////////////////////////////////////////////////////////
// function object visitation interface
-
+
// single dispatch
template <class F>
typename boost::result_of<F(utree const&)>::type
static visit(utree const&, F);
-
+
template <class F>
typename boost::result_of<F(utree&)>::type
static visit(utree&, F);
-
+
// double dispatch
template <class F>
typename boost::result_of<F(utree const&, utree const&)>::type
static visit(utree const&, utree const&, F);
-
+
template <class F>
typename boost::result_of<F(utree&, utree const&)>::type
static visit(utree&, utree const&, F);
-
+
template <class F>
typename boost::result_of<F(utree const&, utree&)>::type
static visit(utree const&, utree&, F);
-
+
template <class F>
typename boost::result_of<F(utree&, utree&)>::type
static visit(utree&, utree&, F);
-
+
////////////////////////////////////////////////////////////////////////
-
+
////////////////////////////////////////////////////////////////////////
// STL Container interface
-
+
// insertion
template <class T>
void push_back(T const&);
@@ -372,71 +372,70 @@
void insert(iterator, std::size_t, T const&);
template <class Iter>
void insert(iterator, Iter, Iter);
-
+
// erasure
void pop_front();
void pop_back();
iterator erase(iterator);
iterator erase(iterator, iterator);
-
+
// front access
reference front();
const_reference front() const;
iterator begin();
const_iterator begin() const;
ref_iterator ref_begin();
-
+
// back access
reference back();
const_reference back() const;
iterator end();
const_iterator end() const;
ref_iterator ref_end();
-
+
// random access
reference operator[](size_type);
const_reference operator[](size_type) const;
-
+
void clear();
-
+
void swap(utree&);
-
+
bool empty() const;
size_type size() const;
-
+
////////////////////////////////////////////////////////////////////////
-
+
utree_type::info which() const;
-
+
template <class T>
T get() const;
-
+
reference deref();
const_reference deref() const;
-
+
short tag() const;
void tag(short);
-
+
utree eval(scope const&) const;
-
+
//<-
private:
typedef utree_type type;
-
+
template <class UTreeX, class UTreeY>
friend struct detail::visit_impl;
friend struct detail::index_impl;
friend struct detail::assign_impl;
-
+
template <class T>
friend struct detail::get_impl;
-
+
type::info get_type() const;
void set_type(type::info);
void ensure_list_type();
void free();
void copy(const_reference);
-
union {
detail::fast_string s;
@@ -453,7 +452,7 @@
//->
};
//]
-
+
//[utree_scope
class scope: public boost::iterator_range<utree*> {
public:
@@ -472,7 +471,7 @@
return parent;
}
//->
-
+
std::size_t level() const
//<-
{
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