LibreOffice Module slideshow (master) 1
accumulation.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
21#define INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
22
23#include <sal/types.h>
24#include <rtl/ustring.hxx>
25
26
28 {
45 template< typename ValueType > ValueType accumulate( const ValueType& rEndValue,
46 sal_uInt32 nRepeatCount,
47 const ValueType& rCurrValue )
48 {
49 return nRepeatCount*rEndValue + rCurrValue;
50 }
51
53 template<> sal_Int16 accumulate< sal_Int16 >( const sal_Int16&,
54 sal_uInt32,
55 const sal_Int16& rCurrValue )
56 {
57 // always return rCurrValue, it's forbidden to add enums/constant values...
58 return rCurrValue;
59 }
60
62 template<> OUString accumulate< OUString >( const OUString&,
63 sal_uInt32,
64 const OUString& rCurrValue )
65 {
66 // always return rCurrValue, it's impossible to add strings...
67 return rCurrValue;
68 }
69
71 template<> bool accumulate< bool >( const bool&,
72 sal_uInt32,
73 const bool& bCurrValue )
74 {
75 // always return bCurrValue, SMIL spec requires to ignore
76 // cumulative behaviour for bools.
77 return bCurrValue;
78 }
79
80}
81
82#endif // INCLUDED_SLIDESHOW_SOURCE_ENGINE_ACTIVITIES_ACCUMULATION_HXX
83
84/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
ValueType
sal_Int16 accumulate< sal_Int16 >(const sal_Int16 &, sal_uInt32, const sal_Int16 &rCurrValue)
Specialization for non-addable enums/constant values.
bool accumulate< bool >(const bool &, sal_uInt32, const bool &bCurrValue)
Specialization for non-addable bools.
OUString accumulate< OUString >(const OUString &, sal_uInt32, const OUString &rCurrValue)
Specialization for non-addable strings.
ValueType accumulate(const ValueType &rEndValue, sal_uInt32 nRepeatCount, const ValueType &rCurrValue)
Generic accumulation.