/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_FILTER_SOURCE_SVG_SPIRIT_SUPPLEMENTS_HXX #define INCLUDED_FILTER_SOURCE_SVG_SPIRIT_SUPPLEMENTS_HXX # ifndef USE_MODERN_SPIRIT # include namespace boost { namespace spirit { template <> class assign_actor< std::pair > { public: explicit assign_actor(std::pair& ref_) : ref(ref_) {} template void operator()(T2 const& val) const { ref = val; } template void operator()(IteratorT const& f, IteratorT const& l) const { ref.first = f, ref.second = l; } private: std::pair& ref; }; template struct assigner { assigner( Target& rTarget, Value aValue ) : mrTarget(rTarget), maValue(aValue) {} void assign() const { mrTarget=maValue; } void operator()() const { assign(); } template void operator()(T1) const { assign(); } template void operator()(T1,T2) const { assign(); } template void operator()(T1,T2,T3) const { assign(); } Target& mrTarget; const Value maValue; }; template inline assigner assign_a( Target& rTarget, Value aValue ) { return assigner(rTarget,aValue); } template inline assign_actor assign_a(Target& rTarget) { return assign_actor(rTarget); } template struct back_pusher { back_pusher( Target& rTarget, const Value& rValue ) : mrTarget(rTarget), mrValue(rValue) {} void push_back() const { mrTarget.push_back(mrValue); } void operator()() const { push_back(); } template void operator()(T1) const { push_back(); } template void operator()(T1,T2) const { push_back(); } template void operator()(T1,T2,T3) const { push_back(); } Target& mrTarget; const Value& mrValue; }; template inline back_pusher push_back_a( Target& rTarget, const Value& rValue ) { return back_pusher(rTarget,rValue); } template struct value_back_pusher { explicit value_back_pusher( Target& rTarget ) : mrTarget(rTarget) {} template void operator()(T1 val) const { mrTarget.push_back(val); } Target& mrTarget; }; template inline value_back_pusher push_back_a( Target& rTarget ) { return value_back_pusher(rTarget); } } } # endif #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */