Commit 8681a3d7 authored by Max Kellermann's avatar Max Kellermann

replace TextFile references with LineReader

parent f9c4d88b
...@@ -19,7 +19,7 @@ ...@@ -19,7 +19,7 @@
#include "PlaylistDatabase.hxx" #include "PlaylistDatabase.hxx"
#include "db/PlaylistVector.hxx" #include "db/PlaylistVector.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "time/ChronoUtil.hxx" #include "time/ChronoUtil.hxx"
#include "util/StringStrip.hxx" #include "util/StringStrip.hxx"
...@@ -42,7 +42,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv) ...@@ -42,7 +42,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv)
} }
void void
playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name) playlist_metadata_load(LineReader &file, PlaylistVector &pv, const char *name)
{ {
PlaylistInfo pm(name); PlaylistInfo pm(name);
......
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
class PlaylistVector; class PlaylistVector;
class BufferedOutputStream; class BufferedOutputStream;
class TextFile; class LineReader;
void void
playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv); playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv);
...@@ -33,6 +33,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv); ...@@ -33,6 +33,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv);
* Throws #std::runtime_error on error. * Throws #std::runtime_error on error.
*/ */
void void
playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name); playlist_metadata_load(LineReader &file, PlaylistVector &pv,
const char *name);
#endif #endif
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
#include "db/plugins/simple/Song.hxx" #include "db/plugins/simple/Song.hxx"
#include "song/DetachedSong.hxx" #include "song/DetachedSong.hxx"
#include "TagSave.hxx" #include "TagSave.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "tag/ParseName.hxx" #include "tag/ParseName.hxx"
#include "tag/Tag.hxx" #include "tag/Tag.hxx"
...@@ -85,7 +85,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song) ...@@ -85,7 +85,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song)
} }
DetachedSong DetachedSong
song_load(TextFile &file, const char *uri, song_load(LineReader &file, const char *uri,
std::string *target_r) std::string *target_r)
{ {
DetachedSong song(uri); DetachedSong song(uri);
......
...@@ -28,7 +28,7 @@ struct Song; ...@@ -28,7 +28,7 @@ struct Song;
struct AudioFormat; struct AudioFormat;
class DetachedSong; class DetachedSong;
class BufferedOutputStream; class BufferedOutputStream;
class TextFile; class LineReader;
void void
song_save(BufferedOutputStream &os, const Song &song); song_save(BufferedOutputStream &os, const Song &song);
...@@ -43,7 +43,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song); ...@@ -43,7 +43,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song);
* Throws on error. * Throws on error.
*/ */
DetachedSong DetachedSong
song_load(TextFile &file, const char *uri, song_load(LineReader &file, const char *uri,
std::string *target_r=nullptr); std::string *target_r=nullptr);
#endif #endif
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#include "db/DatabaseLock.hxx" #include "db/DatabaseLock.hxx"
#include "DirectorySave.hxx" #include "DirectorySave.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "tag/ParseName.hxx" #include "tag/ParseName.hxx"
#include "tag/Settings.hxx" #include "tag/Settings.hxx"
#include "fs/Charset.hxx" #include "fs/Charset.hxx"
...@@ -64,7 +64,7 @@ db_save_internal(BufferedOutputStream &os, const Directory &music_root) ...@@ -64,7 +64,7 @@ db_save_internal(BufferedOutputStream &os, const Directory &music_root)
} }
void void
db_load_internal(TextFile &file, Directory &music_root) db_load_internal(LineReader &file, Directory &music_root)
{ {
char *line; char *line;
unsigned format = 0; unsigned format = 0;
......
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
struct Directory; struct Directory;
class BufferedOutputStream; class BufferedOutputStream;
class TextFile; class LineReader;
void void
db_save_internal(BufferedOutputStream &os, const Directory &root); db_save_internal(BufferedOutputStream &os, const Directory &root);
...@@ -31,6 +31,6 @@ db_save_internal(BufferedOutputStream &os, const Directory &root); ...@@ -31,6 +31,6 @@ db_save_internal(BufferedOutputStream &os, const Directory &root);
* Throws #std::runtime_error on error. * Throws #std::runtime_error on error.
*/ */
void void
db_load_internal(TextFile &file, Directory &root); db_load_internal(LineReader &file, Directory &root);
#endif #endif
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "SongSave.hxx" #include "SongSave.hxx"
#include "song/DetachedSong.hxx" #include "song/DetachedSong.hxx"
#include "PlaylistDatabase.hxx" #include "PlaylistDatabase.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "time/ChronoUtil.hxx" #include "time/ChronoUtil.hxx"
#include "util/StringAPI.hxx" #include "util/StringAPI.hxx"
...@@ -121,7 +121,7 @@ ParseLine(Directory &directory, const char *line) ...@@ -121,7 +121,7 @@ ParseLine(Directory &directory, const char *line)
} }
static Directory * static Directory *
directory_load_subdir(TextFile &file, Directory &parent, std::string_view name) directory_load_subdir(LineReader &file, Directory &parent, std::string_view name)
{ {
if (parent.FindChild(name) != nullptr) if (parent.FindChild(name) != nullptr)
throw FormatRuntimeError("Duplicate subdirectory '%.*s'", throw FormatRuntimeError("Duplicate subdirectory '%.*s'",
...@@ -152,7 +152,7 @@ directory_load_subdir(TextFile &file, Directory &parent, std::string_view name) ...@@ -152,7 +152,7 @@ directory_load_subdir(TextFile &file, Directory &parent, std::string_view name)
} }
void void
directory_load(TextFile &file, Directory &directory) directory_load(LineReader &file, Directory &directory)
{ {
const char *line; const char *line;
......
...@@ -21,7 +21,7 @@ ...@@ -21,7 +21,7 @@
#define MPD_DIRECTORY_SAVE_HXX #define MPD_DIRECTORY_SAVE_HXX
struct Directory; struct Directory;
class TextFile; class LineReader;
class BufferedOutputStream; class BufferedOutputStream;
void void
...@@ -31,6 +31,6 @@ directory_save(BufferedOutputStream &os, const Directory &directory); ...@@ -31,6 +31,6 @@ directory_save(BufferedOutputStream &os, const Directory &directory);
* Throws #std::runtime_error on error. * Throws #std::runtime_error on error.
*/ */
void void
directory_load(TextFile &file, Directory &directory); directory_load(LineReader &file, Directory &directory);
#endif #endif
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
#include "SingleMode.hxx" #include "SingleMode.hxx"
#include "StateFileConfig.hxx" #include "StateFileConfig.hxx"
#include "queue/QueueSave.hxx" #include "queue/QueueSave.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "player/Control.hxx" #include "player/Control.hxx"
#include "util/CharUtil.hxx" #include "util/CharUtil.hxx"
...@@ -102,7 +102,7 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist, ...@@ -102,7 +102,7 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
} }
static void static void
playlist_state_load(TextFile &file, const SongLoader &song_loader, playlist_state_load(LineReader &file, const SongLoader &song_loader,
struct playlist &playlist) struct playlist &playlist)
{ {
const char *line = file.ReadLine(); const char *line = file.ReadLine();
...@@ -128,7 +128,7 @@ playlist_state_load(TextFile &file, const SongLoader &song_loader, ...@@ -128,7 +128,7 @@ playlist_state_load(TextFile &file, const SongLoader &song_loader,
bool bool
playlist_state_restore(const StateFileConfig &config, playlist_state_restore(const StateFileConfig &config,
const char *line, TextFile &file, const char *line, LineReader &file,
const SongLoader &song_loader, const SongLoader &song_loader,
struct playlist &playlist, PlayerControl &pc) struct playlist &playlist, PlayerControl &pc)
{ {
......
...@@ -28,7 +28,7 @@ ...@@ -28,7 +28,7 @@
struct StateFileConfig; struct StateFileConfig;
struct playlist; struct playlist;
class PlayerControl; class PlayerControl;
class TextFile; class LineReader;
class BufferedOutputStream; class BufferedOutputStream;
class SongLoader; class SongLoader;
...@@ -38,7 +38,7 @@ playlist_state_save(BufferedOutputStream &os, const playlist &playlist, ...@@ -38,7 +38,7 @@ playlist_state_save(BufferedOutputStream &os, const playlist &playlist,
bool bool
playlist_state_restore(const StateFileConfig &config, playlist_state_restore(const StateFileConfig &config,
const char *line, TextFile &file, const char *line, LineReader &file,
const SongLoader &song_loader, const SongLoader &song_loader,
playlist &playlist, PlayerControl &pc); playlist &playlist, PlayerControl &pc);
......
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
#include "song/DetachedSong.hxx" #include "song/DetachedSong.hxx"
#include "SongSave.hxx" #include "SongSave.hxx"
#include "playlist/PlaylistSong.hxx" #include "playlist/PlaylistSong.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "util/StringCompare.hxx" #include "util/StringCompare.hxx"
#include "Log.hxx" #include "Log.hxx"
...@@ -74,7 +74,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue) ...@@ -74,7 +74,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue)
} }
static DetachedSong static DetachedSong
LoadQueueSong(TextFile &file, const char *line) LoadQueueSong(LineReader &file, const char *line)
{ {
std::unique_ptr<DetachedSong> song; std::unique_ptr<DetachedSong> song;
...@@ -94,7 +94,7 @@ LoadQueueSong(TextFile &file, const char *line) ...@@ -94,7 +94,7 @@ LoadQueueSong(TextFile &file, const char *line)
} }
void void
queue_load_song(TextFile &file, const SongLoader &loader, queue_load_song(LineReader &file, const SongLoader &loader,
const char *line, Queue &queue) const char *line, Queue &queue)
{ {
if (queue.IsFull()) if (queue.IsFull())
......
...@@ -27,7 +27,7 @@ ...@@ -27,7 +27,7 @@
struct Queue; struct Queue;
class BufferedOutputStream; class BufferedOutputStream;
class TextFile; class LineReader;
class SongLoader; class SongLoader;
void void
...@@ -39,7 +39,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue); ...@@ -39,7 +39,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue);
* Throws on error. * Throws on error.
*/ */
void void
queue_load_song(TextFile &file, const SongLoader &loader, queue_load_song(LineReader &file, const SongLoader &loader,
const char *line, Queue &queue); const char *line, Queue &queue);
#endif #endif
...@@ -24,7 +24,7 @@ ...@@ -24,7 +24,7 @@
#include "StorageState.hxx" #include "StorageState.hxx"
#include "lib/fmt/ExceptionFormatter.hxx" #include "lib/fmt/ExceptionFormatter.hxx"
#include "fs/io/TextFile.hxx" #include "fs/io/LineReader.hxx"
#include "fs/io/BufferedOutputStream.hxx" #include "fs/io/BufferedOutputStream.hxx"
#include "storage/Registry.hxx" #include "storage/Registry.hxx"
#include "storage/CompositeStorage.hxx" #include "storage/CompositeStorage.hxx"
...@@ -73,7 +73,7 @@ storage_state_save(BufferedOutputStream &os, const Instance &instance) ...@@ -73,7 +73,7 @@ storage_state_save(BufferedOutputStream &os, const Instance &instance)
} }
bool bool
storage_state_restore(const char *line, TextFile &file, Instance &instance) storage_state_restore(const char *line, LineReader &file, Instance &instance)
{ {
if (!StringStartsWith(line, MOUNT_STATE_BEGIN)) if (!StringStartsWith(line, MOUNT_STATE_BEGIN))
return false; return false;
......
...@@ -27,13 +27,14 @@ ...@@ -27,13 +27,14 @@
struct Instance; struct Instance;
class BufferedOutputStream; class BufferedOutputStream;
class TextFile; class LineReader;
void void
storage_state_save(BufferedOutputStream &os, const Instance &instance); storage_state_save(BufferedOutputStream &os, const Instance &instance);
bool bool
storage_state_restore(const char *line, TextFile &file, Instance &instance); storage_state_restore(const char *line, LineReader &file,
Instance &instance);
/** /**
* Generates a hash number for the current state of the composite storage. * Generates a hash number for the current state of the composite storage.
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment