comphelper/Library_comphelper.mk | 1 comphelper/source/misc/sequence.cxx | 42 ------------------------------------ include/comphelper/sequence.hxx | 16 +++++++++++-- 3 files changed, 13 insertions(+), 46 deletions(-)
New commits: commit 8c01d962ee98138acc1a61512f3775610be529be Author: Mike Kaganski <mike.kagan...@collabora.com> AuthorDate: Wed Aug 21 13:58:45 2019 +0200 Commit: Mike Kaganski <mike.kagan...@collabora.com> CommitDate: Wed Aug 21 16:38:20 2019 +0200 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.kagan...@collabora.com> diff --git a/comphelper/Library_comphelper.mk b/comphelper/Library_comphelper.mk index 62b59e0f72de..727766a1ec0c 100644 --- a/comphelper/Library_comphelper.mk +++ b/comphelper/Library_comphelper.mk @@ -126,7 +126,6 @@ $(eval $(call gb_Library_add_exception_objects,comphelper,\ comphelper/source/misc/random \ comphelper/source/misc/SelectionMultiplex \ comphelper/source/misc/sequenceashashmap \ - comphelper/source/misc/sequence \ comphelper/source/misc/servicedecl \ comphelper/source/misc/serviceinfohelper \ comphelper/source/misc/sharedmutex \ diff --git a/comphelper/source/misc/sequence.cxx b/comphelper/source/misc/sequence.cxx deleted file mode 100644 index 81079de2223c..000000000000 --- a/comphelper/source/misc/sequence.cxx +++ /dev/null @@ -1,42 +0,0 @@ -/* -*- 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/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <comphelper/sequence.hxx> - -namespace comphelper -{ -sal_Int32 findValue(const css::uno::Sequence< OUString >& _rList, const OUString& _rValue) -{ - sal_Int32 nLength = _rList.getLength(); - - // at which position do I find the value? - const OUString* pTArray = _rList.getConstArray(); - for (sal_Int32 i = 0; i < nLength; ++i, ++pTArray) - { - if( *pTArray == _rValue ) - { - return i; - } - } - - return -1; -} -} // namespace comphelper - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 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> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits