1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 #ifndef INCLUDED_FILTER_SOURCE_SVG_SPIRIT_SUPPLEMENTS_HXX
10 #define INCLUDED_FILTER_SOURCE_SVG_SPIRIT_SUPPLEMENTS_HXX
12 # ifndef USE_MODERN_SPIRIT
13 # include <boost/spirit.hpp>
15 namespace boost
{ namespace spirit
18 class assign_actor
< std::pair
<const char*,const char*> >
21 explicit assign_actor(std::pair
<const char*,const char*>& ref_
)
24 template <typename T2
>
25 void operator()(T2
const& val
) const
28 template <typename IteratorT
>
29 void operator()(IteratorT
const& f
, IteratorT
const& l
) const
31 ref
.first
= f
, ref
.second
= l
;
35 std::pair
<const char*,const char*>& ref
;
38 template<typename Target
, typename Value
> struct assigner
40 assigner( Target
& rTarget
, Value aValue
) :
41 mrTarget(rTarget
), maValue(aValue
)
44 void assign() const { mrTarget
=maValue
; }
46 void operator()() const { assign(); }
47 template<typename T1
> void operator()(T1
) const { assign(); }
48 template<typename T1
,typename T2
> void operator()(T1
,T2
) const { assign(); }
49 template<typename T1
,typename T2
,typename T3
> void operator()(T1
,T2
,T3
) const { assign(); }
55 template<typename Target
, typename Value
> inline assigner
<Target
,Value
>
56 assign_a( Target
& rTarget
, Value aValue
)
58 return assigner
<Target
,Value
>(rTarget
,aValue
);
61 template <typename Target
> inline assign_actor
<Target
>
62 assign_a(Target
& rTarget
)
64 return assign_actor
<Target
>(rTarget
);
67 template<typename Target
, typename Value
> struct back_pusher
69 back_pusher( Target
& rTarget
, const Value
& rValue
) :
70 mrTarget(rTarget
), mrValue(rValue
)
73 void push_back() const { mrTarget
.push_back(mrValue
); }
75 void operator()() const { push_back(); }
76 template<typename T1
> void operator()(T1
) const { push_back(); }
77 template<typename T1
,typename T2
> void operator()(T1
,T2
) const { push_back(); }
78 template<typename T1
,typename T2
,typename T3
> void operator()(T1
,T2
,T3
) const { push_back(); }
84 template<typename Target
, typename Value
> inline back_pusher
<Target
,Value
>
85 push_back_a( Target
& rTarget
, const Value
& rValue
)
87 return back_pusher
<Target
,Value
>(rTarget
,rValue
);
90 template<typename Target
> struct value_back_pusher
92 explicit value_back_pusher( Target
& rTarget
) :
95 template<typename T1
> void operator()(T1 val
) const { mrTarget
.push_back(val
); }
100 template<typename Target
> inline value_back_pusher
<Target
>
101 push_back_a( Target
& rTarget
)
103 return value_back_pusher
<Target
>(rTarget
);
110 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */