File indexing completed on 2024-05-12 04:51:00

0001 /*
0002     SPDX-FileCopyrightText: 1998-2007 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef _K3B_AUDIO_DATA_SOURCE_ITERATOR_H_
0007 #define _K3B_AUDIO_DATA_SOURCE_ITERATOR_H_
0008 
0009 #include "k3b_export.h"
0010 
0011 namespace K3b {
0012     class AudioDataSource;
0013     class AudioTrack;
0014     class AudioDoc;
0015 
0016     /**
0017      * This Iterator iterates over the sources in an audio project
0018      *
0019      * Be aware that this iterator does not properly update when the doc
0020      * changes. A manual update can be issued with first(). This is because
0021      * an update would either involve slots (this being a QObject) which is
0022      * too much overhead or the AudioDoc would need to have knowledge of all
0023      * the iterators which is also overhead that would be overkill.
0024      */
0025     class LIBK3B_EXPORT AudioDataSourceIterator
0026     {
0027     public:
0028         /**
0029          * This will place the iterator on the first source just like first() does.
0030          */
0031         explicit AudioDataSourceIterator( AudioDoc* );
0032 
0033         AudioDataSource* current() const;
0034 
0035         bool hasNext() const;
0036 
0037         /**
0038          * \return the next source or 0 if at end.
0039          */
0040         AudioDataSource* next();
0041 
0042         /**
0043          * Reset the iterator
0044          */
0045         AudioDataSource* first();
0046 
0047     private:
0048         AudioDoc* m_doc;
0049         AudioTrack* m_currentTrack;
0050         AudioDataSource* m_currentSource;
0051     };
0052 }
0053 
0054 #endif