Warning, file /office/calligra/libs/main/KoFilterChainLinkList.cpp was not indexed or was modified since last indexation (in which case cross-reference links may be missing, inaccurate or erroneous).

0001 /* This file is part of the Calligra libraries
0002    Copyright (C) 2009 Boudewijn Rempt <boud@valdyas.org>
0003 
0004 This library is free software; you can redistribute it and/or
0005 modify it under the terms of the GNU Library General Public
0006 License as published by the Free Software Foundation; either
0007 version 2 of the License, or (at your option) any later version.
0008 
0009 This library is distributed in the hope that it will be useful,
0010 but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
0012 Library General Public License for more details.
0013 
0014 You should have received a copy of the GNU Library General Public License
0015 along with this library; see the file COPYING.LIB.  If not, write to
0016 the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
0017 Boston, MA 02110-1301, USA.
0018 */
0019 #include "KoFilterChainLinkList.h"
0020 #include "KoFilterChainLink.h"
0021 
0022 namespace CalligraFilter {
0023 
0024     ChainLinkList::ChainLinkList() {}
0025 
0026     ChainLinkList::~ChainLinkList()
0027     {
0028         deleteAll();
0029     }
0030 
0031     void ChainLinkList::deleteAll()
0032     {
0033         while(!m_chainLinks.isEmpty()) {
0034             delete m_chainLinks.takeFirst();
0035         }
0036     }
0037 
0038     int ChainLinkList::count() const
0039     {
0040         return m_chainLinks.count();
0041     }
0042 
0043     ChainLink* ChainLinkList::current() const
0044     {
0045         // use value() because m_current might be out of range for m_chainLinks
0046         return m_chainLinks.value(m_current);
0047     }
0048 
0049     ChainLink* ChainLinkList::first()
0050     {
0051         m_current = 0;
0052         return current();
0053     }
0054 
0055     ChainLink* ChainLinkList::next()
0056     {
0057         ++m_current;
0058         return current();
0059     }
0060 
0061     void ChainLinkList::prepend(ChainLink* link)
0062     {
0063         Q_ASSERT(link);
0064         m_chainLinks.prepend(link);
0065         m_current = 0;
0066     }
0067 
0068     void ChainLinkList::append(ChainLink* link)
0069     {
0070         Q_ASSERT(link);
0071         m_chainLinks.append(link);
0072         m_current = m_chainLinks.count() -1;
0073     }
0074 }