124acc546SAndrew Rist /************************************************************** 2cdf0e10cSrcweir * 324acc546SAndrew Rist * Licensed to the Apache Software Foundation (ASF) under one 424acc546SAndrew Rist * or more contributor license agreements. See the NOTICE file 524acc546SAndrew Rist * distributed with this work for additional information 624acc546SAndrew Rist * regarding copyright ownership. The ASF licenses this file 724acc546SAndrew Rist * to you under the Apache License, Version 2.0 (the 824acc546SAndrew Rist * "License"); you may not use this file except in compliance 924acc546SAndrew Rist * with the License. You may obtain a copy of the License at 1024acc546SAndrew Rist * 1124acc546SAndrew Rist * http://www.apache.org/licenses/LICENSE-2.0 1224acc546SAndrew Rist * 1324acc546SAndrew Rist * Unless required by applicable law or agreed to in writing, 1424acc546SAndrew Rist * software distributed under the License is distributed on an 1524acc546SAndrew Rist * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 1624acc546SAndrew Rist * KIND, either express or implied. See the License for the 1724acc546SAndrew Rist * specific language governing permissions and limitations 1824acc546SAndrew Rist * under the License. 1924acc546SAndrew Rist * 2024acc546SAndrew Rist *************************************************************/ 2124acc546SAndrew Rist 2224acc546SAndrew Rist 23cdf0e10cSrcweir 24cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 25cdf0e10cSrcweir #include "precompiled_forms.hxx" 26cdf0e10cSrcweir 27cdf0e10cSrcweir #include "sal/config.h" 28cdf0e10cSrcweir 29cdf0e10cSrcweir #include "findpos.hxx" 30cdf0e10cSrcweir 31cdf0e10cSrcweir #include "com/sun/star/uno/Sequence.hxx" 32cdf0e10cSrcweir #include "comphelper/types.hxx" 33cdf0e10cSrcweir #include "rtl/ustring.hxx" 34cdf0e10cSrcweir #include "sal/types.h" 35cdf0e10cSrcweir 36cdf0e10cSrcweir #include <algorithm> 37cdf0e10cSrcweir 38*bd656f79SPedro Giffuni namespace forms_detail { 39cdf0e10cSrcweir findPos(const::rtl::OUString & aStr,const::com::sun::star::uno::Sequence<::rtl::OUString> & rList)40cdf0e10cSrcweirsal_Int32 findPos( 41cdf0e10cSrcweir const ::rtl::OUString& aStr, 42cdf0e10cSrcweir const ::com::sun::star::uno::Sequence< ::rtl::OUString >& rList) 43cdf0e10cSrcweir { 44cdf0e10cSrcweir const ::rtl::OUString* pStrList = rList.getConstArray(); 45cdf0e10cSrcweir const ::rtl::OUString* pResult = ::std::lower_bound( 46cdf0e10cSrcweir pStrList, pStrList + rList.getLength(), aStr ); 47cdf0e10cSrcweir if ( ( pResult != pStrList + rList.getLength() ) && ( *pResult == aStr ) ) 48cdf0e10cSrcweir return ( pResult - pStrList ); 49cdf0e10cSrcweir 50cdf0e10cSrcweir return -1; 51cdf0e10cSrcweir } 52cdf0e10cSrcweir 53cdf0e10cSrcweir } 54