merge the formfield patch from ooo-build
[ooovba.git] / filter / source / svg / spirit_supplements.hxx
blob43db8e69e2c5e3dc01065abc00b8317808b8d174
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * Author:
6 * Fridrich Strba <fridrich.strba@bluewin.ch>
7 * Thorsten Behrens <tbehrens@novell.com>
9 * Copyright (C) 2008, Novell Inc.
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
14 ************************************************************************/
16 #ifndef INCLUDED_SPIRIT_SUPPLEMENTS_HXX
17 #define INCLUDED_SPIRIT_SUPPLEMENTS_HXX
19 # ifndef USE_MODERN_SPIRIT
20 # include <boost/spirit.hpp>
22 namespace boost { namespace spirit
24 template <>
25 class assign_actor< std::pair<const char*,const char*> >
27 public:
28 explicit assign_actor(std::pair<const char*,const char*>& ref_)
29 : ref(ref_) {}
31 template <typename T2>
32 void operator()(T2 const& val) const
33 { ref = val; }
35 template <typename IteratorT>
36 void operator()(IteratorT const& f, IteratorT const& l) const
38 ref.first = f, ref.second = l;
41 private:
42 std::pair<const char*,const char*>& ref;
45 template<typename Target, typename Value> struct assigner
47 assigner( Target& rTarget, Value aValue ) :
48 mrTarget(rTarget), maValue(aValue)
51 void assign() const { mrTarget=maValue; }
53 void operator()() const { assign(); }
54 template<typename T1> void operator()(T1) const { assign(); }
55 template<typename T1,typename T2> void operator()(T1,T2) const { assign(); }
56 template<typename T1,typename T2,typename T3> void operator()(T1,T2,T3) const { assign(); }
58 Target& mrTarget;
59 const Value maValue;
62 template<typename Target, typename Value> inline assigner<Target,Value>
63 assign_a( Target& rTarget, Value aValue )
65 return assigner<Target,Value>(rTarget,aValue);
68 template <typename Target> inline assign_actor<Target>
69 assign_a(Target& rTarget)
71 return assign_actor<Target>(rTarget);
74 template<typename Target, typename Value> struct back_pusher
76 back_pusher( Target& rTarget, const Value& rValue ) :
77 mrTarget(rTarget), mrValue(rValue)
80 void push_back() const { mrTarget.push_back(mrValue); }
82 void operator()() const { push_back(); }
83 template<typename T1> void operator()(T1) const { push_back(); }
84 template<typename T1,typename T2> void operator()(T1,T2) const { push_back(); }
85 template<typename T1,typename T2,typename T3> void operator()(T1,T2,T3) const { push_back(); }
87 Target& mrTarget;
88 const Value& mrValue;
91 template<typename Target, typename Value> inline back_pusher<Target,Value>
92 push_back_a( Target& rTarget, const Value& rValue )
94 return back_pusher<Target,Value>(rTarget,rValue);
97 template<typename Target> struct value_back_pusher
99 explicit value_back_pusher( Target& rTarget ) :
100 mrTarget(rTarget)
102 template<typename T1> void operator()(T1 val) const { mrTarget.push_back(val); }
104 Target& mrTarget;
107 template<typename Target> inline value_back_pusher<Target>
108 push_back_a( Target& rTarget )
110 return value_back_pusher<Target>(rTarget);
114 # endif
115 #endif