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 
34 class QMMP_EXPORT CueParser
35 {
36 public:
40  CueParser();
46  CueParser(const QByteArray &data, const QByteArray &codecName = QByteArray());
50  ~CueParser();
56  void loadData(const QByteArray &data, const QByteArray &codecName = QByteArray());
62  void loadData(const QByteArray &data, QTextCodec *codec);
66  QList<TrackInfo *> createPlayList() const;
70  QList<TrackInfo *> createPlayList(int track) const;
74  const QStringList &files() const;
78  qint64 offset(int track) const;
82  qint64 duration(int track) const;
86  QString file(int track) const;
90  QString url(int track) const;
94  int count() const;
98  bool isEmpty() const;
102  const TrackInfo *info(int track) const;
108  void setDuration(const QString &file, qint64 duration);
113  void setDuration(qint64 duration);
119  void setProperties(const QString &file, const QMap<Qmmp::TrackProperty, QString> &properties);
124  void setProperties(const QMap<Qmmp::TrackProperty, QString> &properties);
131  void setMetaData(int track, Qmmp::MetaData key, const QVariant &value);
138  void setUrl(const QString &scheme, const QString &path);
142  void clear();
143 
144 private:
145  struct CUETrack
146  {
147  TrackInfo info;
148  QString file;
149  qint64 offset = 0;
150  };
151  QList<CUETrack *> m_tracks;
152  QStringList m_files;
153  QStringList splitLine(const QString &line);
154  qint64 getLength(const QString &str);
155 };
156 
157 #endif // CUEPARSER_H
MetaData
Definition: qmmp.h:73
The TrackInfo class stores metadata and other information about track.
Definition: trackinfo.h:31
The CueParser class provides CUE parser.
Definition: cueparser.h:34