OInterfaceContainerHelper3 needs to be thread-safe
[LibreOffice.git] / svl / source / items / itemiter.cxx
blobfb00339877c7363c9f4847dc37b1ddcd3b92b3da
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 #include <svl/itemiter.hxx>
21 #include <svl/itemset.hxx>
23 SfxItemIter::SfxItemIter(const SfxItemSet& rItemSet)
24 : m_rSet(rItemSet)
26 if (!m_rSet.m_nCount)
28 m_nStart = 0;
29 m_nEnd = 0;
31 else
33 SfxPoolItem const** ppFnd = m_rSet.m_pItems.get();
35 // Find the first Item that is set
36 for (m_nStart = 0; !*(ppFnd + m_nStart); ++m_nStart)
37 ; // empty loop
38 if (1 < m_rSet.Count())
39 for (m_nEnd = m_rSet.TotalCount(); !*(ppFnd + --m_nEnd);)
40 ; // empty loop
41 else
42 m_nEnd = m_nStart;
45 m_nCurrent = m_nStart;
48 SfxItemIter::~SfxItemIter() {}
50 // Precondition : m_nCurrent < m_nEnd
51 const SfxPoolItem* SfxItemIter::ImplNextItem()
53 SfxPoolItem const** ppFnd = m_rSet.m_pItems.get();
56 m_nCurrent++;
57 } while (m_nCurrent < m_nEnd && !*(ppFnd + m_nCurrent));
58 return *(ppFnd + m_nCurrent);
61 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */