mirror of
https://github.com/vdemydiuk/mtapi.git
synced 2026-08-20 14:18:22 +00:00
Added thirdparty: boost library
This commit is contained in:
+100
@@ -0,0 +1,100 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_ASSIGN_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that applies the assignment operator.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref = value;
|
||||
// ref = T(first,last);
|
||||
// ref = value_ref;
|
||||
//
|
||||
// Policy name:
|
||||
// assign_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, assign_a( ref );
|
||||
// ref_const_ref_actor, assign_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct assign_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
void act(T& ref_, ValueT const& value_) const
|
||||
{
|
||||
ref_ = value_;
|
||||
}
|
||||
template<
|
||||
typename T,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef T value_type;
|
||||
#ifndef BOOST_NO_TEMPLATED_ITERATOR_CONSTRUCTORS
|
||||
value_type value(first_,last_);
|
||||
#else
|
||||
value_type value;
|
||||
std::copy(first_, last_, std::inserter(value, value.end()));
|
||||
#endif
|
||||
ref_ = value;
|
||||
}
|
||||
};
|
||||
|
||||
// Deprecated. Please use assign_a
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,assign_action> assign(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,assign_action>(ref_);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,assign_action> assign_a(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,assign_action>(ref_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_actor<T,ValueT,assign_action> assign_a(
|
||||
T& ref_,
|
||||
ValueT const& value_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_actor<T,ValueT,assign_action>(ref_,value_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+96
@@ -0,0 +1,96 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_ASSIGN_KEY_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
struct assign_key_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename KeyT
|
||||
>
|
||||
void act(T& ref_, ValueT const& value_, KeyT const& key_) const
|
||||
{
|
||||
ref_[ key_ ] = value_;
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
ValueT const& value_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::key_type key_type;
|
||||
key_type key(first_,last_);
|
||||
|
||||
ref_[key] = value_;
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_value_actor<T,ValueT,assign_key_action>
|
||||
assign_key_a(T& ref_, ValueT const& value_)
|
||||
{
|
||||
return ref_const_ref_value_actor<T,ValueT,assign_key_action>(
|
||||
ref_,
|
||||
value_
|
||||
);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename KeyT
|
||||
>
|
||||
inline ref_const_ref_const_ref_actor<
|
||||
T,
|
||||
ValueT,
|
||||
KeyT,
|
||||
assign_key_action
|
||||
>
|
||||
assign_key_a(
|
||||
T& ref_,
|
||||
ValueT const& value_,
|
||||
KeyT const& key_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_const_ref_actor<
|
||||
T,
|
||||
ValueT,
|
||||
KeyT,
|
||||
assign_key_action
|
||||
>(
|
||||
ref_,
|
||||
value_,
|
||||
key_
|
||||
);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+61
@@ -0,0 +1,61 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_CLEAR_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that calls clear method.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.clear();
|
||||
//
|
||||
// Policy name:
|
||||
// clear_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_actor, clear_a( ref );
|
||||
//
|
||||
// () operators: both.
|
||||
//
|
||||
// See also ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct clear_action
|
||||
{
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
void act(T& ref_) const
|
||||
{
|
||||
ref_.clear();
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// helper method that creates a and_assign_actor.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename T>
|
||||
inline ref_actor<T,clear_action> clear_a(T& ref_)
|
||||
{
|
||||
return ref_actor<T,clear_action>(ref_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_DECREMENT_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_DECREMENT_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that calls the -- operator on a reference.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions:
|
||||
// --ref;
|
||||
//
|
||||
// Policy name:
|
||||
// decrement_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_actor, decrement_a( ref );
|
||||
//
|
||||
// () operators: both.
|
||||
//
|
||||
// See also ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct decrement_action
|
||||
{
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
void act(T& ref_) const
|
||||
{
|
||||
--ref_;
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// helper method that creates a and_assign_actor.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename T>
|
||||
inline ref_actor<T,decrement_action> decrement_a(T& ref_)
|
||||
{
|
||||
return ref_actor<T,decrement_action>(ref_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+89
@@ -0,0 +1,89 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_ERASE_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_ERASE_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that calss the erase method.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.erase( value );
|
||||
// ref.erase( T::key_type(first,last) );
|
||||
// ref.erase( key_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// erase_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, erase_a( ref );
|
||||
// ref_const_ref_actor, erase_a( ref, key_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct erase_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename KeyT
|
||||
>
|
||||
void act(T& ref_, KeyT const& key_) const
|
||||
{
|
||||
ref_.erase(key_);
|
||||
}
|
||||
template<
|
||||
typename T,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::key_type key_type;
|
||||
key_type key(first_,last_);
|
||||
|
||||
ref_.erase(key);
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,erase_action> erase_a(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,erase_action>(ref_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename KeyT
|
||||
>
|
||||
inline ref_const_ref_actor<T,KeyT,erase_action> erase_a(
|
||||
T& ref_,
|
||||
KeyT const& key_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_actor<T,KeyT,erase_action>(ref_,key_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+60
@@ -0,0 +1,60 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_INCREMENT_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_INCREMENT_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that calls the ++ operator on a reference.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions:
|
||||
// ++ref;
|
||||
//
|
||||
// Policy name:
|
||||
// increment_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_actor, increment_a( ref );
|
||||
//
|
||||
// () operators: both.
|
||||
//
|
||||
// See also ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct increment_action
|
||||
{
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
void act(T& ref_) const
|
||||
{
|
||||
++ref_;
|
||||
}
|
||||
};
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// helper method that creates a increment_actor.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<typename T>
|
||||
inline ref_actor<T,increment_action> increment_a(T& ref_)
|
||||
{
|
||||
return ref_actor<T,increment_action>(ref_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+121
@@ -0,0 +1,121 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_INSERT_AT_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_INSERT_AT_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_const_ref_a.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that insert data into an associative
|
||||
// container using a const reference to a key.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.insert( T::value_type(key_ref,value) );
|
||||
// ref.insert( T::value_type(key_ref, T::mapped_type(first,last)));;
|
||||
// ref.insert( T::value_type(key_ref,value_ref) );
|
||||
//
|
||||
// Policy name:
|
||||
// insert_at_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_const_ref_value_actor, insert_at_a( ref, key_ref );
|
||||
// ref_const_ref_const_ref_actor, insert_a( ref, key_ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_const_ref_value_actor and ref_const_ref_const_ref_actor
|
||||
// for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct insert_at_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ReferentT,
|
||||
typename ValueT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
ReferentT const& key_,
|
||||
ValueT const& value_
|
||||
) const
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
ref_.insert( value_type(key_, value_) );
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ReferentT,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
ReferentT const& key_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::mapped_type mapped_type;
|
||||
typedef typename T::value_type value_type;
|
||||
|
||||
mapped_type value(first_,last_);
|
||||
value_type key_value(key_, value);
|
||||
ref_.insert( key_value );
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ReferentT
|
||||
>
|
||||
inline ref_const_ref_value_actor<T,ReferentT,insert_at_action>
|
||||
insert_at_a(
|
||||
T& ref_,
|
||||
ReferentT const& key_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_value_actor<
|
||||
T,
|
||||
ReferentT,
|
||||
insert_at_action
|
||||
>(ref_,key_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ReferentT,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_const_ref_actor<T,ReferentT,ValueT,insert_at_action>
|
||||
insert_at_a(
|
||||
T& ref_,
|
||||
ReferentT const& key_,
|
||||
ValueT const& value_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_const_ref_actor<
|
||||
T,
|
||||
ReferentT,
|
||||
ValueT,
|
||||
insert_at_action
|
||||
>(ref_,key_,value_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_INSERT_KEY_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_value_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that insert data into an associative
|
||||
// container using a const reference to data.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.insert( T::value_type(value,value_ref) );
|
||||
// ref.insert( T::value_type(T::key_type(first,last), value_ref));;
|
||||
//
|
||||
// Policy name:
|
||||
// insert_key_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_const_ref_value_actor, insert_key_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_const_ref_value_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct insert_key_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename ReferentT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
ValueT const& value_,
|
||||
ReferentT const& key_
|
||||
) const
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
value_type key_value(key_, value_);
|
||||
ref_.insert( key_value );
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
ValueT const& value_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::key_type key_type;
|
||||
typedef typename T::value_type value_type;
|
||||
|
||||
key_type key(first_,last_);
|
||||
value_type key_value(key, value_);
|
||||
ref_.insert( key_value );
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_value_actor<T,ValueT,insert_key_action> insert_key_a(
|
||||
T& ref_,
|
||||
ValueT const& value_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_value_actor<
|
||||
T,
|
||||
ValueT,
|
||||
insert_key_action
|
||||
>(ref_,value_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+101
@@ -0,0 +1,101 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_PUSH_BACK_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_PUSH_BACK_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
//
|
||||
// A semantic action policy that appends a value to the back of a
|
||||
// container.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does and what ref, value_ref must support):
|
||||
// ref.push_back( value );
|
||||
// ref.push_back( T::value_type(first,last) );
|
||||
// ref.push_back( value_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// push_back_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, push_back_a( ref );
|
||||
// ref_const_ref_actor, push_back_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct push_back_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
void act(T& ref_, ValueT const& value_) const
|
||||
{
|
||||
ref_.push_back( value_ );
|
||||
}
|
||||
template<
|
||||
typename T,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
value_type value(first_,last_);
|
||||
|
||||
ref_.push_back( value );
|
||||
}
|
||||
};
|
||||
|
||||
// Deprecated interface. Use push_back_a
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,push_back_action>
|
||||
append(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,push_back_action>(ref_);
|
||||
}
|
||||
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,push_back_action>
|
||||
push_back_a(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,push_back_action>(ref_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_actor<T,ValueT,push_back_action>
|
||||
push_back_a(
|
||||
T& ref_,
|
||||
ValueT const& value_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_actor<T,ValueT,push_back_action>(ref_,value_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+91
@@ -0,0 +1,91 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_PUSH_FRONT_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_PUSH_FRONT_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_const_ref_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
//
|
||||
// A semantic action policy that appends a value to the front of a
|
||||
// container.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does and what ref, value_ref must support):
|
||||
// ref.push_front( value );
|
||||
// ref.push_front( T::value_type(first,last) );
|
||||
// ref.push_front( value_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// push_front_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, push_front_a( ref );
|
||||
// ref_const_ref_actor, push_front_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
struct push_front_action
|
||||
{
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
void act(T& ref_, ValueT const& value_) const
|
||||
{
|
||||
ref_.push_front( value_ );
|
||||
}
|
||||
template<
|
||||
typename T,
|
||||
typename IteratorT
|
||||
>
|
||||
void act(
|
||||
T& ref_,
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
typedef typename T::value_type value_type;
|
||||
value_type value(first_,last_);
|
||||
|
||||
ref_.push_front( value );
|
||||
}
|
||||
};
|
||||
|
||||
template<typename T>
|
||||
inline ref_value_actor<T,push_front_action> push_front_a(T& ref_)
|
||||
{
|
||||
return ref_value_actor<T,push_front_action>(ref_);
|
||||
}
|
||||
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT
|
||||
>
|
||||
inline ref_const_ref_actor<T,ValueT,push_front_action> push_front_a(
|
||||
T& ref_,
|
||||
ValueT const& value_
|
||||
)
|
||||
{
|
||||
return ref_const_ref_actor<T,ValueT,push_front_action>(ref_,value_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+70
@@ -0,0 +1,70 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_REF_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_REF_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy holder. This holder stores a reference to ref,
|
||||
// act methods are fead with this reference. The parse result is not used
|
||||
// by this holder.
|
||||
//
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Constructor:
|
||||
// ...(T& ref_);
|
||||
// where ref_ is stored.
|
||||
//
|
||||
// Action calls:
|
||||
// act(ref);
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T,
|
||||
typename ActionT
|
||||
>
|
||||
class ref_actor : public ActionT
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
public:
|
||||
explicit
|
||||
ref_actor(T& ref_)
|
||||
: ref(ref_){}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& /*val*/) const
|
||||
{
|
||||
this->act(ref); // defined in ActionT
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/
|
||||
) const
|
||||
{
|
||||
this->act(ref); // defined in ActionT
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy holder. This holder stores a reference to ref
|
||||
// and a const reference to value_ref.
|
||||
// act methods are feed with ref and value_ref. The parse result is
|
||||
// not used by this holder.
|
||||
//
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Constructor:
|
||||
// ...(T& ref_, ValueT const& value_ref_);
|
||||
// where ref_ and value_ref_ are stored in the holder.
|
||||
//
|
||||
// Action calls:
|
||||
// act(ref, value_ref);
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename ActionT
|
||||
>
|
||||
class ref_const_ref_actor : public ActionT
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
ValueT const& value_ref;
|
||||
public:
|
||||
ref_const_ref_actor(
|
||||
T& ref_,
|
||||
ValueT const& value_ref_
|
||||
)
|
||||
:
|
||||
ref(ref_),
|
||||
value_ref(value_ref_)
|
||||
{}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& /*val*/) const
|
||||
{
|
||||
this->act(ref,value_ref); // defined in ActionT
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/
|
||||
) const
|
||||
{
|
||||
this->act(ref,value_ref); // defined in ActionT
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Vendored
Executable
+87
@@ -0,0 +1,87 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_CONST_REF_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy holder. This holder stores a reference to ref
|
||||
// , a const reference to value1_ref and a const reference to value2_ref.
|
||||
// Typically, value1_ref is a key and value2_ref is value for associative
|
||||
// container operations.
|
||||
// act methods are feed with ref, value1_ref, value2_ref. The parse result
|
||||
// is not used by this holder.
|
||||
//
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Constructor:
|
||||
// ...(
|
||||
// T& ref_,
|
||||
// Value1T const& value1_ref_,
|
||||
// Value2T const& value2_ref_ );
|
||||
// where ref_, value1_ref and value2_ref_ are stored in the holder.
|
||||
//
|
||||
// Action calls:
|
||||
// act(ref, value1_ref, value2_ref);
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T,
|
||||
typename Value1T,
|
||||
typename Value2T,
|
||||
typename ActionT
|
||||
>
|
||||
class ref_const_ref_const_ref_actor : public ActionT
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
Value1T const& value1_ref;
|
||||
Value2T const& value2_ref;
|
||||
public:
|
||||
ref_const_ref_const_ref_actor(
|
||||
T& ref_,
|
||||
Value1T const& value1_ref_,
|
||||
Value2T const& value2_ref_
|
||||
)
|
||||
:
|
||||
ref(ref_),
|
||||
value1_ref(value1_ref_),
|
||||
value2_ref(value2_ref_)
|
||||
{}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& /*val*/) const
|
||||
{
|
||||
this->act(ref,value1_ref,value2_ref); // defined in ActionT
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/
|
||||
) const
|
||||
{
|
||||
this->act(ref,value1_ref,value2_ref); // defined in ActionT
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
Vendored
Executable
+78
@@ -0,0 +1,78 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_REF_CONST_REF_VALUE_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_REF_CONST_REF_VALUE_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy holder. This holder stores a reference to ref
|
||||
// and a const reference to value_ref.
|
||||
// act methods are feed with ref, value_ref and the parse result.
|
||||
//
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Constructor:
|
||||
// ...(T& ref_, ValueT const& value_ref_);
|
||||
// where ref_ and value_ref_ are stored in the holder.
|
||||
//
|
||||
// Action calls:
|
||||
// act(ref, value_ref, value);
|
||||
// act(ref, value_ref, first, last);
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T,
|
||||
typename ValueT,
|
||||
typename ActionT
|
||||
>
|
||||
class ref_const_ref_value_actor : public ActionT
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
ValueT const& value_ref;
|
||||
public:
|
||||
ref_const_ref_value_actor(
|
||||
T& ref_,
|
||||
ValueT const& value_ref_
|
||||
)
|
||||
:
|
||||
ref(ref_),
|
||||
value_ref(value_ref_)
|
||||
{}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& val_) const
|
||||
{
|
||||
this->act(ref,value_ref,val_); // defined in ActionT
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
this->act(ref,value_ref,first_,last_); // defined in ActionT
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+82
@@ -0,0 +1,82 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
Copyright (c) 2011 Bryce Lelbach
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_REF_VALUE_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_REF_VALUE_ACTOR_HPP
|
||||
|
||||
#include <boost/detail/workaround.hpp>
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(push)
|
||||
#pragma warning(disable:4512) //assignment operator could not be generated
|
||||
#endif
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy holder. This holder stores a reference to ref.
|
||||
// act methods are feed with ref and the parse result.
|
||||
//
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Constructor:
|
||||
// ...(T& ref_);
|
||||
// where ref_ is stored.
|
||||
//
|
||||
// Action calls:
|
||||
// act(ref, value);
|
||||
// act(ref, first,last);
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T,
|
||||
typename ActionT
|
||||
>
|
||||
class ref_value_actor : public ActionT
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
public:
|
||||
explicit
|
||||
ref_value_actor(T& ref_)
|
||||
: ref(ref_){}
|
||||
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& val_) const
|
||||
{
|
||||
this->act(ref,val_); // defined in ActionT
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& first_,
|
||||
IteratorT const& last_
|
||||
) const
|
||||
{
|
||||
this->act(ref,first_,last_); // defined in ActionT
|
||||
}
|
||||
};
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
#if BOOST_WORKAROUND(BOOST_MSVC, >= 1400)
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+85
@@ -0,0 +1,85 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2003 Jonathan de Halleux (dehalleux@pelikhan.com)
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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)
|
||||
=============================================================================*/
|
||||
#ifndef BOOST_SPIRIT_ACTOR_SWAP_ACTOR_HPP
|
||||
#define BOOST_SPIRIT_ACTOR_SWAP_ACTOR_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/spirit/home/classic/actor/ref_value_actor.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
// Summary:
|
||||
// A semantic action policy that swaps values.
|
||||
// (This doc uses convention available in actors.hpp)
|
||||
//
|
||||
// Actions (what it does):
|
||||
// ref.swap( value_ref );
|
||||
//
|
||||
// Policy name:
|
||||
// swap_action
|
||||
//
|
||||
// Policy holder, corresponding helper method:
|
||||
// ref_value_actor, swap_a( ref );
|
||||
// ref_const_ref_actor, swap_a( ref, value_ref );
|
||||
//
|
||||
// () operators: both
|
||||
//
|
||||
// See also ref_value_actor and ref_const_ref_actor for more details.
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
class swap_actor
|
||||
{
|
||||
private:
|
||||
T& ref;
|
||||
T& swap_ref;
|
||||
|
||||
public:
|
||||
swap_actor(
|
||||
T& ref_,
|
||||
T& swap_ref_)
|
||||
: ref(ref_), swap_ref(swap_ref_)
|
||||
{};
|
||||
|
||||
template<typename T2>
|
||||
void operator()(T2 const& /*val*/) const
|
||||
{
|
||||
ref.swap(swap_ref);
|
||||
}
|
||||
|
||||
|
||||
template<typename IteratorT>
|
||||
void operator()(
|
||||
IteratorT const& /*first*/,
|
||||
IteratorT const& /*last*/
|
||||
) const
|
||||
{
|
||||
ref.swap(swap_ref);
|
||||
}
|
||||
};
|
||||
|
||||
template<
|
||||
typename T
|
||||
>
|
||||
inline swap_actor<T> swap_a(
|
||||
T& ref_,
|
||||
T& swap_ref_
|
||||
)
|
||||
{
|
||||
return swap_actor<T>(ref_,swap_ref_);
|
||||
}
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}}
|
||||
|
||||
#endif
|
||||
+74
@@ -0,0 +1,74 @@
|
||||
/*=============================================================================
|
||||
Copyright (c) 2006 Tobias Schwinger
|
||||
http://spirit.sourceforge.net/
|
||||
|
||||
Distributed under 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_SPIRIT_ACTOR_TYPEOF_HPP)
|
||||
#define BOOST_SPIRIT_ACTOR_TYPEOF_HPP
|
||||
|
||||
#include <boost/spirit/home/classic/namespace.hpp>
|
||||
#include <boost/typeof/typeof.hpp>
|
||||
|
||||
namespace boost { namespace spirit {
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_BEGIN
|
||||
|
||||
template<typename T, typename ActionT> class ref_actor;
|
||||
|
||||
template<typename T, typename ActionT> class ref_value_actor;
|
||||
|
||||
template<typename T, typename ValueT, typename ActionT>
|
||||
|
||||
class ref_const_ref_actor;
|
||||
template<typename T, typename ValueT, typename ActionT>
|
||||
|
||||
class ref_const_ref_value_actor;
|
||||
template<typename T, typename Value1T, typename Value2T, typename ActionT>
|
||||
|
||||
class ref_const_ref_const_ref_actor;
|
||||
|
||||
struct assign_action;
|
||||
struct clear_action;
|
||||
struct increment_action;
|
||||
struct decrement_action;
|
||||
struct push_back_action;
|
||||
struct push_front_action;
|
||||
struct insert_key_action;
|
||||
struct insert_at_action;
|
||||
struct assign_key_action;
|
||||
|
||||
template<typename T> class swap_actor;
|
||||
|
||||
BOOST_SPIRIT_CLASSIC_NAMESPACE_END
|
||||
|
||||
}} // namespace BOOST_SPIRIT_CLASSIC_NS
|
||||
|
||||
|
||||
#include BOOST_TYPEOF_INCREMENT_REGISTRATION_GROUP()
|
||||
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ref_actor,2)
|
||||
#if !defined(BOOST_SPIRIT_CORE_TYPEOF_HPP)
|
||||
// this part also lives in the core master header and is deprecated there...
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ref_value_actor,2)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ref_const_ref_actor,3)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::assign_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::push_back_action)
|
||||
#endif
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ref_const_ref_value_actor,3)
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::ref_const_ref_const_ref_actor,4)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::clear_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::increment_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::decrement_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::push_front_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::insert_key_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::insert_at_action)
|
||||
BOOST_TYPEOF_REGISTER_TYPE(BOOST_SPIRIT_CLASSIC_NS::assign_key_action)
|
||||
|
||||
BOOST_TYPEOF_REGISTER_TEMPLATE(BOOST_SPIRIT_CLASSIC_NS::swap_actor,1)
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user