Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
M
mpd
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Иван Мажукин
mpd
Commits
61b01f82
Commit
61b01f82
authored
Jan 14, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Mapper: add function map_song_detach()
Make the DetachedSong(Song) conversion constructor private. Everybody should use map_song_detach() which will take over more responsibilities soon.
parent
75b84713
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
27 additions
and
5 deletions
+27
-5
DatabasePlaylist.cxx
src/DatabasePlaylist.cxx
+3
-1
DatabaseQueue.cxx
src/DatabaseQueue.cxx
+3
-1
DatabaseSong.cxx
src/DatabaseSong.cxx
+2
-1
DetachedSong.hxx
src/DetachedSong.hxx
+4
-2
Mapper.cxx
src/Mapper.cxx
+6
-0
Mapper.hxx
src/Mapper.hxx
+8
-0
PlaylistEdit.cxx
src/PlaylistEdit.cxx
+1
-0
No files found.
src/DatabasePlaylist.cxx
View file @
61b01f82
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "DatabaseGlue.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
#include "DatabasePlugin.hxx"
#include "DetachedSong.hxx"
#include "DetachedSong.hxx"
#include "Mapper.hxx"
#include <functional>
#include <functional>
...
@@ -31,7 +32,8 @@ static bool
...
@@ -31,7 +32,8 @@ static bool
AddSong
(
const
char
*
playlist_path_utf8
,
AddSong
(
const
char
*
playlist_path_utf8
,
Song
&
song
,
Error
&
error
)
Song
&
song
,
Error
&
error
)
{
{
return
spl_append_song
(
playlist_path_utf8
,
DetachedSong
(
song
),
error
);
return
spl_append_song
(
playlist_path_utf8
,
map_song_detach
(
song
),
error
);
}
}
bool
bool
...
...
src/DatabaseQueue.cxx
View file @
61b01f82
...
@@ -24,6 +24,7 @@
...
@@ -24,6 +24,7 @@
#include "Partition.hxx"
#include "Partition.hxx"
#include "util/Error.hxx"
#include "util/Error.hxx"
#include "DetachedSong.hxx"
#include "DetachedSong.hxx"
#include "Mapper.hxx"
#include <functional>
#include <functional>
...
@@ -31,7 +32,8 @@ static bool
...
@@ -31,7 +32,8 @@ static bool
AddToQueue
(
Partition
&
partition
,
const
Song
&
song
,
Error
&
error
)
AddToQueue
(
Partition
&
partition
,
const
Song
&
song
,
Error
&
error
)
{
{
PlaylistResult
result
=
PlaylistResult
result
=
partition
.
playlist
.
AppendSong
(
partition
.
pc
,
DetachedSong
(
song
),
partition
.
playlist
.
AppendSong
(
partition
.
pc
,
map_song_detach
(
song
),
nullptr
);
nullptr
);
if
(
result
!=
PlaylistResult
::
SUCCESS
)
{
if
(
result
!=
PlaylistResult
::
SUCCESS
)
{
error
.
Set
(
playlist_domain
,
int
(
result
),
"Playlist error"
);
error
.
Set
(
playlist_domain
,
int
(
result
),
"Playlist error"
);
...
...
src/DatabaseSong.cxx
View file @
61b01f82
...
@@ -22,6 +22,7 @@
...
@@ -22,6 +22,7 @@
#include "DatabaseGlue.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
#include "DatabasePlugin.hxx"
#include "DetachedSong.hxx"
#include "DetachedSong.hxx"
#include "Mapper.hxx"
DetachedSong
*
DetachedSong
*
DatabaseDetachSong
(
const
char
*
uri
,
Error
&
error
)
DatabaseDetachSong
(
const
char
*
uri
,
Error
&
error
)
...
@@ -34,7 +35,7 @@ DatabaseDetachSong(const char *uri, Error &error)
...
@@ -34,7 +35,7 @@ DatabaseDetachSong(const char *uri, Error &error)
if
(
tmp
==
nullptr
)
if
(
tmp
==
nullptr
)
return
nullptr
;
return
nullptr
;
DetachedSong
*
song
=
new
DetachedSong
(
*
tmp
);
DetachedSong
*
song
=
new
DetachedSong
(
map_song_detach
(
*
tmp
)
);
db
->
ReturnSong
(
tmp
);
db
->
ReturnSong
(
tmp
);
return
song
;
return
song
;
}
}
src/DetachedSong.hxx
View file @
61b01f82
...
@@ -32,6 +32,8 @@
...
@@ -32,6 +32,8 @@
struct
Song
;
struct
Song
;
class
DetachedSong
{
class
DetachedSong
{
friend
DetachedSong
map_song_detach
(
const
Song
&
song
);
/**
/**
* An UTF-8-encoded URI referring to the song file. This can
* An UTF-8-encoded URI referring to the song file. This can
* be one of:
* be one of:
...
@@ -60,6 +62,8 @@ class DetachedSong {
...
@@ -60,6 +62,8 @@ class DetachedSong {
*/
*/
unsigned
end_ms
;
unsigned
end_ms
;
explicit
DetachedSong
(
const
Song
&
other
);
public
:
public
:
explicit
DetachedSong
(
const
DetachedSong
&
other
)
explicit
DetachedSong
(
const
DetachedSong
&
other
)
:
uri
(
other
.
uri
),
:
uri
(
other
.
uri
),
...
@@ -67,8 +71,6 @@ public:
...
@@ -67,8 +71,6 @@ public:
mtime
(
other
.
mtime
),
mtime
(
other
.
mtime
),
start_ms
(
other
.
start_ms
),
end_ms
(
other
.
end_ms
)
{}
start_ms
(
other
.
start_ms
),
end_ms
(
other
.
end_ms
)
{}
explicit
DetachedSong
(
const
Song
&
other
);
explicit
DetachedSong
(
const
char
*
_uri
)
explicit
DetachedSong
(
const
char
*
_uri
)
:
uri
(
_uri
),
:
uri
(
_uri
),
mtime
(
0
),
start_ms
(
0
),
end_ms
(
0
)
{}
mtime
(
0
),
start_ms
(
0
),
end_ms
(
0
)
{}
...
...
src/Mapper.cxx
View file @
61b01f82
...
@@ -217,6 +217,12 @@ map_detached_song_fs(const char *uri_utf8)
...
@@ -217,6 +217,12 @@ map_detached_song_fs(const char *uri_utf8)
return
AllocatedPath
::
Build
(
music_dir_fs
,
uri_fs
);
return
AllocatedPath
::
Build
(
music_dir_fs
,
uri_fs
);
}
}
DetachedSong
map_song_detach
(
const
Song
&
song
)
{
return
DetachedSong
(
song
);
}
AllocatedPath
AllocatedPath
map_song_fs
(
const
Song
&
song
)
map_song_fs
(
const
Song
&
song
)
{
{
...
...
src/Mapper.hxx
View file @
61b01f82
...
@@ -107,6 +107,14 @@ AllocatedPath
...
@@ -107,6 +107,14 @@ AllocatedPath
map_directory_child_fs
(
const
Directory
&
directory
,
const
char
*
name
);
map_directory_child_fs
(
const
Directory
&
directory
,
const
char
*
name
);
/**
/**
* "Detach" the #Song object, i.e. convert it to a #DetachedSong
* instance.
*/
gcc_pure
DetachedSong
map_song_detach
(
const
Song
&
song
);
/**
* Determines the file system path of a song. This must not be a
* Determines the file system path of a song. This must not be a
* remote song.
* remote song.
*
*
...
...
src/PlaylistEdit.cxx
View file @
61b01f82
...
@@ -31,6 +31,7 @@
...
@@ -31,6 +31,7 @@
#include "util/Error.hxx"
#include "util/Error.hxx"
#include "Song.hxx"
#include "Song.hxx"
#include "DetachedSong.hxx"
#include "DetachedSong.hxx"
#include "Mapper.hxx"
#include "Idle.hxx"
#include "Idle.hxx"
#include "DatabaseSong.hxx"
#include "DatabaseSong.hxx"
#include "Log.hxx"
#include "Log.hxx"
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment