Qmmp
cueparser.h
1 /***************************************************************************
2  * Copyright (C) 2008-2020 by Ilya Kotov *
3  * forkotov02@ya.ru *
4  * *
5  * This program is free software; you can redistribute it and/or modify *
6  * it under the terms of the GNU General Public License as published by *
7  * the Free Software Foundation; either version 2 of the License, or *
8  * (at your option) any later version. *
9  * *
10  * This program is distributed in the hope that it will be useful, *
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13  * GNU General Public License for more details. *
14  * *
15  * You should have received a copy of the GNU General Public License *
16  * along with this program; if not, write to the *
17  * Free Software Foundation, Inc., *
18  * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *
19  ***************************************************************************/
20 #ifndef CUEPARSER_H
21 #define CUEPARSER_H
22 
23 #include <QByteArray>
24 #include <QString>
25 #include <QList>
26 #include <QStringList>
27 #include <QTextCodec>
28 #include "trackinfo.h"
29 #include "qmmp_export.h"
30 
31 class QMMP_EXPORT CueParser
32 {
33 public:
34  CueParser();
35  CueParser(const QByteArray &data, const QByteArray &codecName = QByteArray());
36  ~CueParser();
37  void loadData(const QByteArray &data, const QByteArray &codecName = QByteArray());
38  void loadData(const QByteArray &data, QTextCodec *codec);
39  QList<TrackInfo *> createPlayList() const;
40  QList<TrackInfo *> createPlayList(int track) const;
41  const QStringList &files() const;
42  qint64 offset(int track) const;
43  qint64 duration(int track) const;
44  QString file(int track) const;
45  QString url(int track) const;
46  int count() const;
47  bool isEmpty() const;
48  const TrackInfo *info(int track) const;
49  void setDuration(const QString &file, qint64 duration);
50  void setDuration(qint64 duration);
51  void setProperties(const QString &file, const QMap<Qmmp::TrackProperty, QString> &properties);
52  void setProperties(const QMap<Qmmp::TrackProperty, QString> &properties);
53  void setMetaData(int track, Qmmp::MetaData key, const QVariant &value);
54  void setUrl(const QString &scheme, const QString &path);
55  void clear();
56 
57 private:
58  struct CUETrack
59  {
60  TrackInfo info;
61  QString file;
62  qint64 offset = 0;
63  };
64  QList<CUETrack *> m_tracks;
65  QStringList m_files;
66  QStringList splitLine(const QString &line);
67  qint64 getLength(const QString &str);
68 };
69 
70 #endif // CUEPARSER_H
MetaData
Definition: qmmp.h:73
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:31