MPD: playlist/cue/CueParser.hxx Source File

MPD 0.20.18

CueParser.hxx
Go to the documentation of this file.
1 /*
2 * Copyright 2003-2017 The Music Player Daemon Project
3 * http://www.musicpd.org
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 along
16 * with this program; if not, write to the Free Software Foundation, Inc.,
17 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
18 */
19
20 #ifndef MPD_CUE_PARSER_HXX
21 #define MPD_CUE_PARSER_HXX
22
23 #include "check.h"
24 #include "DetachedSong.hxx"
25 #include "tag/TagBuilder.hxx"
26 #include "Compiler.h"
27
28 #include <string>
29 #include <memory>
30
31 class CueParser {
32 enum {
36 HEADER,
37
41 WAVE,
42
46 IGNORE_FILE,
47
51 TRACK,
52
56 IGNORE_TRACK,
57 } state = HEADER;
58
62 TagBuilder header_tag;
63
69 TagBuilder song_tag;
70
71 std::string filename;
72
76 std::unique_ptr<DetachedSong> current;
77
82 std::unique_ptr<DetachedSong> previous;
83
88 std::unique_ptr<DetachedSong> finished;
89
95 bool ignore_index;
96
101 bool end = false;
102
103 public:
108 void Feed(const char *line) noexcept;
109
115 void Finish() noexcept;
116
124 std::unique_ptr<DetachedSong> Get() noexcept;
125
126 private:
127 gcc_pure
128 TagBuilder *GetCurrentTag() noexcept;
129
135 void Commit() noexcept;
136
137 void Feed2(char *p) noexcept;
138 };
139
140 #endif
check.h
CueParser::Finish
void Finish() noexcept
Tell the parser that the end of the file has been reached.
TagBuilder.hxx
CueParser
Definition: CueParser.hxx:31
TagBuilder
A class that constructs Tag objects.
Definition: TagBuilder.hxx:36
DetachedSong.hxx
CueParser::Feed
void Feed(const char *line) noexcept
Feed a text line from the CUE file into the parser.
CueParser::Get
std::unique_ptr< DetachedSong > Get() noexcept
Check if a song was finished by the last Feed() or Finish() call.
Compiler.h
gcc_pure
#define gcc_pure
Definition: Compiler.h:116