replace TextFile references with LineReader
This commit is contained in:
parent
f9c4d88b12
commit
8681a3d74c
|
@ -19,7 +19,7 @@
|
|||
|
||||
#include "PlaylistDatabase.hxx"
|
||||
#include "db/PlaylistVector.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "time/ChronoUtil.hxx"
|
||||
#include "util/StringStrip.hxx"
|
||||
|
@ -42,7 +42,7 @@ playlist_vector_save(BufferedOutputStream &os, const PlaylistVector &pv)
|
|||
}
|
||||
|
||||
void
|
||||
playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name)
|
||||
playlist_metadata_load(LineReader &file, PlaylistVector &pv, const char *name)
|
||||
{
|
||||
PlaylistInfo pm(name);
|
||||
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
class PlaylistVector;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
|
||||
void
|
||||
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.
|
||||
*/
|
||||
void
|
||||
playlist_metadata_load(TextFile &file, PlaylistVector &pv, const char *name);
|
||||
playlist_metadata_load(LineReader &file, PlaylistVector &pv,
|
||||
const char *name);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
#include "db/plugins/simple/Song.hxx"
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "TagSave.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "tag/Tag.hxx"
|
||||
|
@ -85,7 +85,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song)
|
|||
}
|
||||
|
||||
DetachedSong
|
||||
song_load(TextFile &file, const char *uri,
|
||||
song_load(LineReader &file, const char *uri,
|
||||
std::string *target_r)
|
||||
{
|
||||
DetachedSong song(uri);
|
||||
|
|
|
@ -28,7 +28,7 @@ struct Song;
|
|||
struct AudioFormat;
|
||||
class DetachedSong;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
|
||||
void
|
||||
song_save(BufferedOutputStream &os, const Song &song);
|
||||
|
@ -43,7 +43,7 @@ song_save(BufferedOutputStream &os, const DetachedSong &song);
|
|||
* Throws on error.
|
||||
*/
|
||||
DetachedSong
|
||||
song_load(TextFile &file, const char *uri,
|
||||
song_load(LineReader &file, const char *uri,
|
||||
std::string *target_r=nullptr);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#include "db/DatabaseLock.hxx"
|
||||
#include "DirectorySave.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "tag/ParseName.hxx"
|
||||
#include "tag/Settings.hxx"
|
||||
#include "fs/Charset.hxx"
|
||||
|
@ -64,7 +64,7 @@ db_save_internal(BufferedOutputStream &os, const Directory &music_root)
|
|||
}
|
||||
|
||||
void
|
||||
db_load_internal(TextFile &file, Directory &music_root)
|
||||
db_load_internal(LineReader &file, Directory &music_root)
|
||||
{
|
||||
char *line;
|
||||
unsigned format = 0;
|
||||
|
|
|
@ -22,7 +22,7 @@
|
|||
|
||||
struct Directory;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
|
||||
void
|
||||
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.
|
||||
*/
|
||||
void
|
||||
db_load_internal(TextFile &file, Directory &root);
|
||||
db_load_internal(LineReader &file, Directory &root);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "SongSave.hxx"
|
||||
#include "song/DetachedSong.hxx"
|
||||
#include "PlaylistDatabase.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "time/ChronoUtil.hxx"
|
||||
#include "util/StringAPI.hxx"
|
||||
|
@ -121,7 +121,7 @@ ParseLine(Directory &directory, const char *line)
|
|||
}
|
||||
|
||||
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)
|
||||
throw FormatRuntimeError("Duplicate subdirectory '%.*s'",
|
||||
|
@ -152,7 +152,7 @@ directory_load_subdir(TextFile &file, Directory &parent, std::string_view name)
|
|||
}
|
||||
|
||||
void
|
||||
directory_load(TextFile &file, Directory &directory)
|
||||
directory_load(LineReader &file, Directory &directory)
|
||||
{
|
||||
const char *line;
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
#define MPD_DIRECTORY_SAVE_HXX
|
||||
|
||||
struct Directory;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
class BufferedOutputStream;
|
||||
|
||||
void
|
||||
|
@ -31,6 +31,6 @@ directory_save(BufferedOutputStream &os, const Directory &directory);
|
|||
* Throws #std::runtime_error on error.
|
||||
*/
|
||||
void
|
||||
directory_load(TextFile &file, Directory &directory);
|
||||
directory_load(LineReader &file, Directory &directory);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
#include "SingleMode.hxx"
|
||||
#include "StateFileConfig.hxx"
|
||||
#include "queue/QueueSave.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "player/Control.hxx"
|
||||
#include "util/CharUtil.hxx"
|
||||
|
@ -102,7 +102,7 @@ playlist_state_save(BufferedOutputStream &os, const struct playlist &playlist,
|
|||
}
|
||||
|
||||
static void
|
||||
playlist_state_load(TextFile &file, const SongLoader &song_loader,
|
||||
playlist_state_load(LineReader &file, const SongLoader &song_loader,
|
||||
struct playlist &playlist)
|
||||
{
|
||||
const char *line = file.ReadLine();
|
||||
|
@ -128,7 +128,7 @@ playlist_state_load(TextFile &file, const SongLoader &song_loader,
|
|||
|
||||
bool
|
||||
playlist_state_restore(const StateFileConfig &config,
|
||||
const char *line, TextFile &file,
|
||||
const char *line, LineReader &file,
|
||||
const SongLoader &song_loader,
|
||||
struct playlist &playlist, PlayerControl &pc)
|
||||
{
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
struct StateFileConfig;
|
||||
struct playlist;
|
||||
class PlayerControl;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
class BufferedOutputStream;
|
||||
class SongLoader;
|
||||
|
||||
|
@ -38,7 +38,7 @@ playlist_state_save(BufferedOutputStream &os, const playlist &playlist,
|
|||
|
||||
bool
|
||||
playlist_state_restore(const StateFileConfig &config,
|
||||
const char *line, TextFile &file,
|
||||
const char *line, LineReader &file,
|
||||
const SongLoader &song_loader,
|
||||
playlist &playlist, PlayerControl &pc);
|
||||
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
#include "song/DetachedSong.hxx"
|
||||
#include "SongSave.hxx"
|
||||
#include "playlist/PlaylistSong.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "util/StringCompare.hxx"
|
||||
#include "Log.hxx"
|
||||
|
@ -74,7 +74,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue)
|
|||
}
|
||||
|
||||
static DetachedSong
|
||||
LoadQueueSong(TextFile &file, const char *line)
|
||||
LoadQueueSong(LineReader &file, const char *line)
|
||||
{
|
||||
std::unique_ptr<DetachedSong> song;
|
||||
|
||||
|
@ -94,7 +94,7 @@ LoadQueueSong(TextFile &file, const char *line)
|
|||
}
|
||||
|
||||
void
|
||||
queue_load_song(TextFile &file, const SongLoader &loader,
|
||||
queue_load_song(LineReader &file, const SongLoader &loader,
|
||||
const char *line, Queue &queue)
|
||||
{
|
||||
if (queue.IsFull())
|
||||
|
|
|
@ -27,7 +27,7 @@
|
|||
|
||||
struct Queue;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
class SongLoader;
|
||||
|
||||
void
|
||||
|
@ -39,7 +39,7 @@ queue_save(BufferedOutputStream &os, const Queue &queue);
|
|||
* Throws on error.
|
||||
*/
|
||||
void
|
||||
queue_load_song(TextFile &file, const SongLoader &loader,
|
||||
queue_load_song(LineReader &file, const SongLoader &loader,
|
||||
const char *line, Queue &queue);
|
||||
|
||||
#endif
|
||||
|
|
|
@ -24,7 +24,7 @@
|
|||
|
||||
#include "StorageState.hxx"
|
||||
#include "lib/fmt/ExceptionFormatter.hxx"
|
||||
#include "fs/io/TextFile.hxx"
|
||||
#include "fs/io/LineReader.hxx"
|
||||
#include "fs/io/BufferedOutputStream.hxx"
|
||||
#include "storage/Registry.hxx"
|
||||
#include "storage/CompositeStorage.hxx"
|
||||
|
@ -73,7 +73,7 @@ storage_state_save(BufferedOutputStream &os, const Instance &instance)
|
|||
}
|
||||
|
||||
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))
|
||||
return false;
|
||||
|
|
|
@ -27,13 +27,14 @@
|
|||
|
||||
struct Instance;
|
||||
class BufferedOutputStream;
|
||||
class TextFile;
|
||||
class LineReader;
|
||||
|
||||
void
|
||||
storage_state_save(BufferedOutputStream &os, const Instance &instance);
|
||||
|
||||
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.
|
||||
|
|
Loading…
Reference in New Issue