Bump version to 6.0-36
[LibreOffice.git] / slideshow / source / engine / activities / accumulation.hxx
blob02a19815af1bcf4c030358ada4657ec6c3513864
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
21 #define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
23 #include <sal/types.h>
24 #include <rtl/ustring.hxx>
27 namespace slideshow
29 namespace internal
31 /** Generic accumulation.
33 This template handles value accumulation across repeated
34 effect runs: returned is the end value times the repeat
35 count, plus the current value.
37 @param rEndValue
38 End value of the simple animation.
40 @param nRepeatCount
41 Number of completed repeats (i.e. 0 during the first
42 effect run)
44 @param rCurrValue
45 Current animation value
47 template< typename ValueType > ValueType accumulate( const ValueType& rEndValue,
48 sal_uInt32 nRepeatCount,
49 const ValueType& rCurrValue )
51 return nRepeatCount*rEndValue + rCurrValue;
54 /// Specialization for non-addable enums/constant values
55 template<> sal_Int16 accumulate< sal_Int16 >( const sal_Int16&,
56 sal_uInt32,
57 const sal_Int16& rCurrValue )
59 // always return rCurrValue, it's forbidden to add enums/constant values...
60 return rCurrValue;
63 /// Specialization for non-addable strings
64 template<> OUString accumulate< OUString >( const OUString&,
65 sal_uInt32,
66 const OUString& rCurrValue )
68 // always return rCurrValue, it's impossible to add strings...
69 return rCurrValue;
72 /// Specialization for non-addable bools
73 template<> bool accumulate< bool >( const bool&,
74 sal_uInt32,
75 const bool& bCurrValue )
77 // always return bCurrValue, SMIL spec requires to ignore
78 // cumulative behaviour for bools.
79 return bCurrValue;
84 #endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
86 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */