]> git.tdb.fi Git - libs/core.git/commitdiff
Move the generic file-based Asset implementation to a generic directory
authorMikko Rasa <tdb@tdb.fi>
Thu, 13 Nov 2014 20:46:14 +0000 (22:46 +0200)
committerMikko Rasa <tdb@tdb.fi>
Thu, 13 Nov 2014 20:46:14 +0000 (22:46 +0200)
Build
source/io/generic/asset.cpp [new file with mode: 0644]
source/io/unix/asset.cpp [deleted file]

diff --git a/Build b/Build
index fb10fd448ee77676890b733a5553d3c61e5763e3..d940f4a695ce976c886be6341c08d85ed9a5bade 100644 (file)
--- a/Build
+++ b/Build
@@ -62,6 +62,7 @@ package "mspcore"
                {
                        overlay "unix";
                };
+               overlay "generic";
                install true;
                install_map
                {
diff --git a/source/io/generic/asset.cpp b/source/io/generic/asset.cpp
new file mode 100644 (file)
index 0000000..7971f1b
--- /dev/null
@@ -0,0 +1,47 @@
+#include <msp/fs/dir.h>
+#include "asset.h"
+#include "file.h"
+
+using namespace std;
+
+namespace Msp {
+namespace IO {
+
+struct Asset::Private
+{
+       Seekable *file;
+};
+
+Asset::Asset(const string &name)
+{
+       Seekable *file = new BufferedFile((FS::get_sys_data_dir()/name).str());
+
+       priv = new Private;
+       priv->file = file;
+
+       priv->file->signal_flush_required.connect(signal_flush_required);
+}
+
+Asset::~Asset()
+{
+       delete priv->file;
+       delete priv;
+}
+
+unsigned Asset::do_read(char *buf, unsigned size)
+{
+       return priv->file->read(buf, size);
+}
+
+SeekOffset Asset::seek(SeekOffset off, SeekType type)
+{
+       return priv->file->seek(off, type);
+}
+
+SeekOffset Asset::tell() const
+{
+       return priv->file->tell();
+}
+
+} // namespace IO
+} // namespace Msp
diff --git a/source/io/unix/asset.cpp b/source/io/unix/asset.cpp
deleted file mode 100644 (file)
index 7971f1b..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-#include <msp/fs/dir.h>
-#include "asset.h"
-#include "file.h"
-
-using namespace std;
-
-namespace Msp {
-namespace IO {
-
-struct Asset::Private
-{
-       Seekable *file;
-};
-
-Asset::Asset(const string &name)
-{
-       Seekable *file = new BufferedFile((FS::get_sys_data_dir()/name).str());
-
-       priv = new Private;
-       priv->file = file;
-
-       priv->file->signal_flush_required.connect(signal_flush_required);
-}
-
-Asset::~Asset()
-{
-       delete priv->file;
-       delete priv;
-}
-
-unsigned Asset::do_read(char *buf, unsigned size)
-{
-       return priv->file->read(buf, size);
-}
-
-SeekOffset Asset::seek(SeekOffset off, SeekType type)
-{
-       return priv->file->seek(off, type);
-}
-
-SeekOffset Asset::tell() const
-{
-       return priv->file->tell();
-}
-
-} // namespace IO
-} // namespace Msp