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
9d312ab2
Commit
9d312ab2
authored
Jan 04, 2013
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
PlaylistFile: reuse classes PlaylistInfo and PlaylistVector
.. instead of rolling own classes.
parent
06be0a19
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
15 additions
and
16 deletions
+15
-16
OtherCommands.cxx
src/OtherCommands.cxx
+1
-1
PlaylistCommands.cxx
src/PlaylistCommands.cxx
+2
-1
PlaylistFile.cxx
src/PlaylistFile.cxx
+6
-4
PlaylistFile.hxx
src/PlaylistFile.hxx
+3
-10
PlaylistInfo.hxx
src/PlaylistInfo.hxx
+2
-0
PlaylistVector.hxx
src/PlaylistVector.hxx
+1
-0
No files found.
src/OtherCommands.cxx
View file @
9d312ab2
...
...
@@ -57,7 +57,7 @@ extern "C" {
#include <string.h>
static
void
print_spl_list
(
Client
*
client
,
const
Playlist
FileList
&
list
)
print_spl_list
(
Client
*
client
,
const
Playlist
Vector
&
list
)
{
for
(
const
auto
&
i
:
list
)
{
client_printf
(
client
,
"playlist: %s
\n
"
,
i
.
name
.
c_str
());
...
...
src/PlaylistCommands.cxx
View file @
9d312ab2
...
...
@@ -24,6 +24,7 @@
#include "PlaylistPrint.hxx"
#include "PlaylistSave.hxx"
#include "PlaylistFile.hxx"
#include "PlaylistVector.hxx"
#include "PlaylistQueue.hxx"
#include "TimePrint.hxx"
#include "ClientInternal.hxx"
...
...
@@ -40,7 +41,7 @@ extern "C" {
#include <stdlib.h>
static
void
print_spl_list
(
Client
*
client
,
const
Playlist
FileList
&
list
)
print_spl_list
(
Client
*
client
,
const
Playlist
Vector
&
list
)
{
for
(
const
auto
&
i
:
list
)
{
client_printf
(
client
,
"playlist: %s
\n
"
,
i
.
name
.
c_str
());
...
...
src/PlaylistFile.cxx
View file @
9d312ab2
...
...
@@ -20,6 +20,8 @@
#include "config.h"
#include "PlaylistFile.hxx"
#include "PlaylistSave.hxx"
#include "PlaylistInfo.hxx"
#include "PlaylistVector.hxx"
#include "DatabasePlugin.hxx"
#include "DatabaseGlue.hxx"
#include "song.h"
...
...
@@ -140,7 +142,7 @@ playlist_errno(GError **error_r)
}
static
bool
LoadPlaylistFileInfo
(
Playlist
File
Info
&
info
,
LoadPlaylistFileInfo
(
PlaylistInfo
&
info
,
const
char
*
parent_path_fs
,
const
char
*
name_fs
)
{
size_t
name_length
=
strlen
(
name_fs
);
...
...
@@ -172,10 +174,10 @@ LoadPlaylistFileInfo(PlaylistFileInfo &info,
return
true
;
}
Playlist
FileList
Playlist
Vector
ListPlaylistFiles
(
GError
**
error_r
)
{
Playlist
FileList
list
;
Playlist
Vector
list
;
const
char
*
parent_path_fs
=
spl_map
(
error_r
);
if
(
parent_path_fs
==
NULL
)
...
...
@@ -187,7 +189,7 @@ ListPlaylistFiles(GError **error_r)
return
list
;
}
Playlist
File
Info
info
;
PlaylistInfo
info
;
struct
dirent
*
ent
;
while
((
ent
=
readdir
(
dir
))
!=
NULL
)
{
if
(
LoadPlaylistFileInfo
(
info
,
parent_path_fs
,
ent
->
d_name
))
...
...
src/PlaylistFile.hxx
View file @
9d312ab2
...
...
@@ -20,7 +20,6 @@
#ifndef MPD_PLAYLIST_FILE_HXX
#define MPD_PLAYLIST_FILE_HXX
#include <list>
#include <vector>
#include <string>
...
...
@@ -28,14 +27,8 @@
#include <time.h>
struct
song
;
struct
PlaylistFileInfo
{
std
::
string
name
;
time_t
mtime
;
};
typedef
std
::
list
<
PlaylistFileInfo
>
PlaylistFileList
;
struct
PlaylistInfo
;
class
PlaylistVector
;
typedef
std
::
vector
<
std
::
string
>
PlaylistFileContents
;
...
...
@@ -60,7 +53,7 @@ spl_valid_name(const char *name_utf8);
* Returns a list of stored_playlist_info struct pointers. Returns
* NULL if an error occurred.
*/
Playlist
FileList
Playlist
Vector
ListPlaylistFiles
(
GError
**
error_r
);
PlaylistFileContents
...
...
src/PlaylistInfo.hxx
View file @
9d312ab2
...
...
@@ -50,6 +50,8 @@ struct PlaylistInfo {
}
};
PlaylistInfo
()
=
default
;
template
<
typename
N
>
PlaylistInfo
(
N
&&
_name
,
time_t
_mtime
)
:
name
(
std
::
forward
<
N
>
(
_name
)),
mtime
(
_mtime
)
{}
...
...
src/PlaylistVector.hxx
View file @
9d312ab2
...
...
@@ -37,6 +37,7 @@ public:
using
std
::
list
<
PlaylistInfo
>::
empty
;
using
std
::
list
<
PlaylistInfo
>::
begin
;
using
std
::
list
<
PlaylistInfo
>::
end
;
using
std
::
list
<
PlaylistInfo
>::
push_back
;
using
std
::
list
<
PlaylistInfo
>::
erase
;
/**
...
...
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