File indexing completed on 2024-05-05 04:51:31

0001 /*
0002     SPDX-FileCopyrightText: 1998-2009 Sebastian Trueg <trueg@k3b.org>
0003     SPDX-License-Identifier: GPL-2.0-or-later
0004 */
0005 
0006 #ifndef K3BTOC_H
0007 #define K3BTOC_H
0008 
0009 #include "k3bdevice_export.h"
0010 #include "k3bmsf.h"
0011 #include "k3btrack.h"
0012 
0013 #include <QList>
0014 
0015 namespace K3b {
0016     namespace Device
0017     {
0018         enum ContentsType {
0019             DATA,
0020             AUDIO,
0021             MIXED,
0022             NONE // no tracks
0023         };
0024 
0025         /**
0026          * A list of Tracks that represents the contents
0027          * of a cd.
0028          * The Toc deletes all its tracks when it is deleted and
0029          * deletes removed tracks.
0030          */
0031         class LIBK3BDEVICE_EXPORT Toc : public QList<Track>
0032         {
0033         public:
0034             Toc();
0035             /** deep copy */
0036             Toc( const Toc& );
0037             /** deletes all tracks */
0038             ~Toc();
0039             /** deep copy */
0040             Toc& operator=( const Toc& );
0041 
0042             /**
0043              * CDDB disc Id
0044              */
0045             unsigned int discId() const;
0046 
0047             QByteArray mcn() const;
0048 
0049             /**
0050              * determine the contents type based on the tracks' types.
0051              * Audio, Data, or Mixed
0052              */
0053             ContentsType contentType() const;
0054 
0055             /**
0056              * \return the number of sessions in this TOC.
0057              */
0058             int sessions() const;
0059 
0060             /**
0061              * The first track's first sector could differ from the disc's
0062              * first sector if there is a pregap before index 1
0063              */
0064             K3b::Msf firstSector() const;
0065             K3b::Msf lastSector() const;
0066             K3b::Msf length() const;
0067 
0068             void setMcn( const QByteArray& mcn );
0069 
0070             void clear();
0071 
0072             bool operator==( const Toc& ) const;
0073             bool operator!=( const Toc& ) const;
0074 
0075         private:
0076             QByteArray m_mcn;
0077         };
0078     }
0079 }
0080 
0081 LIBK3BDEVICE_EXPORT QDebug operator<<( QDebug s, const K3b::Device::Toc& );
0082 
0083 #endif