summaryrefslogtreecommitdiff
path: root/include/comphelper/sequence.hxx
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2019-08-21 13:58:45 +0200
committerMike Kaganski <mike.kaganski@collabora.com>2019-08-21 16:38:20 +0200
commit8c01d962ee98138acc1a61512f3775610be529be (patch)
tree897353d624d5b95fbd77a4af0b3796dcac1b034b /include/comphelper/sequence.hxx
parent193180164a66927999616fdc976dbaa6710d0344 (diff)
Make comphelper::findValue inline template and drop sequence.cxx
Change-Id: Ibee3424b9a957d5d62e66c3257a4050a2ebc207b Reviewed-on: https://gerrit.libreoffice.org/77881 Tested-by: Jenkins Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'include/comphelper/sequence.hxx')
-rw-r--r--include/comphelper/sequence.hxx16
1 files changed, 13 insertions, 3 deletions
diff --git a/include/comphelper/sequence.hxx b/include/comphelper/sequence.hxx
index 3c448cd6573a..6eadc5e917cb 100644
--- a/include/comphelper/sequence.hxx
+++ b/include/comphelper/sequence.hxx
@@ -22,17 +22,27 @@
#include <com/sun/star/uno/Sequence.hxx>
#include <osl/diagnose.h>
-#include <comphelper/comphelperdllapi.h>
#include <algorithm>
#include <vector>
namespace comphelper
{
- /** Search the given string within the given sequence, return the position of the first occurrence.
+ /** Search the given value within the given sequence, return the position of the first occurrence.
Returns -1 if nothing found.
*/
- COMPHELPER_DLLPUBLIC sal_Int32 findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue);
+ template <class T1, class T2>
+ inline sal_Int32 findValue(const css::uno::Sequence<T1>& _rList, const T2& _rValue)
+ {
+ // at which position do I find the value?
+ for (sal_Int32 i = 0; i < _rList.getLength(); ++i)
+ {
+ if (_rList[i] == _rValue)
+ return i;
+ }
+
+ return -1;
+ }
/// concat several sequences
template <class T, class... Ss>