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
ff582070
Commit
ff582070
authored
Aug 07, 2012
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db_selection: rename to DatabaseSelection
parent
b3d76b7e
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
39 additions
and
64 deletions
+39
-64
Makefile.am
Makefile.am
+1
-1
DatabaseCommands.cxx
src/DatabaseCommands.cxx
+2
-3
DatabaseGlue.cxx
src/DatabaseGlue.cxx
+0
-1
DatabasePlaylist.cxx
src/DatabasePlaylist.cxx
+3
-5
DatabasePlugin.hxx
src/DatabasePlugin.hxx
+4
-4
DatabasePrint.cxx
src/DatabasePrint.cxx
+8
-14
DatabasePrint.hxx
src/DatabasePrint.hxx
+2
-2
DatabaseQueue.cxx
src/DatabaseQueue.cxx
+4
-7
DatabaseSelection.hxx
src/DatabaseSelection.hxx
+8
-18
Stats.cxx
src/Stats.cxx
+2
-3
SimpleDatabasePlugin.cxx
src/db/SimpleDatabasePlugin.cxx
+2
-2
SimpleDatabasePlugin.hxx
src/db/SimpleDatabasePlugin.hxx
+1
-1
DumpDatabase.cxx
test/DumpDatabase.cxx
+2
-3
No files found.
Makefile.am
View file @
ff582070
...
...
@@ -262,7 +262,7 @@ src_mpd_SOURCES = \
src/db_visitor.h
\
src/DatabasePlugin.hxx
\
src/DatabaseVisitor.hxx
\
src/
db_selection.h
\
src/
DatabaseSelection.hxx
\
src/exclude.c
\
src/fd_util.c
\
src/fifo_buffer.c src/fifo_buffer.h
\
...
...
src/DatabaseCommands.cxx
View file @
ff582070
...
...
@@ -22,13 +22,13 @@
#include "DatabaseQueue.hxx"
#include "DatabasePlaylist.hxx"
#include "DatabasePrint.hxx"
#include "DatabaseSelection.hxx"
#include "CommandError.h"
#include "client_internal.h"
#include "tag.h"
#include "uri.h"
extern
"C"
{
#include "db_selection.h"
#include "locate.h"
#include "protocol/result.h"
}
...
...
@@ -47,8 +47,7 @@ handle_lsinfo2(struct client *client, int argc, char *argv[])
/* default is root directory */
uri
=
""
;
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
false
);
const
DatabaseSelection
selection
(
uri
,
false
);
GError
*
error
=
NULL
;
if
(
!
db_selection_print
(
client
,
selection
,
true
,
&
error
))
...
...
src/DatabaseGlue.cxx
View file @
ff582070
...
...
@@ -24,7 +24,6 @@ extern "C" {
#include "database.h"
#include "db_error.h"
#include "db_save.h"
#include "db_selection.h"
#include "db_visitor.h"
#include "stats.h"
#include "conf.h"
...
...
src/DatabasePlaylist.cxx
View file @
ff582070
...
...
@@ -19,11 +19,11 @@
#include "config.h"
#include "DatabasePlaylist.hxx"
#include "DatabaseSelection.hxx"
extern
"C"
{
#include "dbUtils.h"
#include "locate.h"
#include "db_selection.h"
#include "stored_playlist.h"
}
...
...
@@ -43,8 +43,7 @@ bool
addAllInToStoredPlaylist
(
const
char
*
uri_utf8
,
const
char
*
playlist_path_utf8
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri_utf8
,
true
);
const
DatabaseSelection
selection
(
uri_utf8
,
true
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
AddSong
,
playlist_path_utf8
,
_1
,
_2
);
...
...
@@ -65,8 +64,7 @@ search_add_to_playlist(const char *uri, const char *playlist_path_utf8,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
true
);
const
DatabaseSelection
selection
(
uri
,
true
);
struct
locate_item_list
*
new_list
=
locate_item_list_casefold
(
criteria
);
...
...
src/DatabasePlugin.hxx
View file @
ff582070
...
...
@@ -30,7 +30,7 @@
#include "gcc.h"
struct
config_param
;
struct
db_s
election
;
struct
DatabaseS
election
;
struct
db_visitor
;
class
Database
{
...
...
@@ -64,13 +64,13 @@ public:
/**
* Visit the selected entities.
*/
virtual
bool
Visit
(
const
db_s
election
&
selection
,
virtual
bool
Visit
(
const
DatabaseS
election
&
selection
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
GError
**
error_r
)
const
=
0
;
bool
Visit
(
const
db_s
election
&
selection
,
bool
Visit
(
const
DatabaseS
election
&
selection
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
GError
**
error_r
)
const
{
...
...
@@ -78,7 +78,7 @@ public:
VisitPlaylist
(),
error_r
);
}
bool
Visit
(
const
db_s
election
&
selection
,
VisitSong
visit_song
,
bool
Visit
(
const
DatabaseS
election
&
selection
,
VisitSong
visit_song
,
GError
**
error_r
)
const
{
return
Visit
(
selection
,
VisitDirectory
(),
visit_song
,
error_r
);
}
...
...
src/DatabasePrint.cxx
View file @
ff582070
...
...
@@ -19,9 +19,9 @@
#include "config.h"
#include "DatabasePrint.hxx"
#include "DatabaseSelection.hxx"
extern
"C"
{
#include "db_selection.h"
#include "locate.h"
#include "database.h"
#include "client.h"
...
...
@@ -125,7 +125,7 @@ PrintPlaylistFull(struct client *client,
}
bool
db_selection_print
(
struct
client
*
client
,
const
db_s
election
&
selection
,
db_selection_print
(
struct
client
*
client
,
const
DatabaseS
election
&
selection
,
bool
full
,
GError
**
error_r
)
{
using
namespace
std
::
placeholders
;
...
...
@@ -153,8 +153,7 @@ searchForSongsIn(struct client *client, const char *uri,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
true
);
const
DatabaseSelection
selection
(
uri
,
true
);
struct
locate_item_list
*
new_list
=
locate_item_list_casefold
(
criteria
);
...
...
@@ -183,8 +182,7 @@ findSongsIn(struct client *client, const char *uri,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
true
);
const
DatabaseSelection
selection
(
uri
,
true
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
MatchPrintSong
,
client
,
criteria
,
_1
);
...
...
@@ -219,8 +217,7 @@ searchStatsForSongsIn(struct client *client, const char *name,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
name
,
true
);
const
DatabaseSelection
selection
(
name
,
true
);
SearchStats
stats
;
stats
.
numberOfSongs
=
0
;
...
...
@@ -239,8 +236,7 @@ searchStatsForSongsIn(struct client *client, const char *name,
bool
printAllIn
(
struct
client
*
client
,
const
char
*
uri_utf8
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri_utf8
,
true
);
const
DatabaseSelection
selection
(
uri_utf8
,
true
);
return
db_selection_print
(
client
,
selection
,
false
,
error_r
);
}
...
...
@@ -248,8 +244,7 @@ bool
printInfoForAllIn
(
struct
client
*
client
,
const
char
*
uri_utf8
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri_utf8
,
true
);
const
DatabaseSelection
selection
(
uri_utf8
,
true
);
return
db_selection_print
(
client
,
selection
,
true
,
error_r
);
}
...
...
@@ -305,8 +300,7 @@ listAllUniqueTags(struct client *client, int type,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
""
,
true
);
const
DatabaseSelection
selection
(
""
,
true
);
StringSet
set
;
...
...
src/DatabasePrint.hxx
View file @
ff582070
...
...
@@ -27,12 +27,12 @@
struct
client
;
struct
locate_item_list
;
struct
db_s
election
;
struct
DatabaseS
election
;
struct
db_visitor
;
gcc_nonnull
(
1
)
bool
db_selection_print
(
struct
client
*
client
,
const
db_s
election
&
selection
,
db_selection_print
(
struct
client
*
client
,
const
DatabaseS
election
&
selection
,
bool
full
,
GError
**
error_r
);
gcc_nonnull
(
1
,
2
)
...
...
src/DatabaseQueue.cxx
View file @
ff582070
...
...
@@ -19,11 +19,11 @@
#include "config.h"
#include "DatabaseQueue.hxx"
#include "DatabaseSelection.hxx"
extern
"C"
{
#include "dbUtils.h"
#include "locate.h"
#include "db_selection.h"
#include "playlist.h"
}
...
...
@@ -49,8 +49,7 @@ AddToQueue(struct player_control *pc, song &song, GError **error_r)
bool
addAllIn
(
struct
player_control
*
pc
,
const
char
*
uri
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
true
);
const
DatabaseSelection
selection
(
uri
,
true
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
AddToQueue
,
pc
,
_1
,
_2
);
...
...
@@ -70,8 +69,7 @@ bool
findAddIn
(
struct
player_control
*
pc
,
const
char
*
uri
,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
true
);
const
DatabaseSelection
selection
(
uri
,
true
);
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
MatchAddSong
,
pc
,
criteria
,
_1
,
_2
);
...
...
@@ -92,8 +90,7 @@ search_add_songs(struct player_control *pc, const char *uri,
const
struct
locate_item_list
*
criteria
,
GError
**
error_r
)
{
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
uri
,
true
);
const
DatabaseSelection
selection
(
uri
,
true
);
struct
locate_item_list
*
new_list
=
locate_item_list_casefold
(
criteria
);
...
...
src/
db_selection.h
→
src/
DatabaseSelection.hxx
View file @
ff582070
...
...
@@ -17,18 +17,15 @@
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_D
B_SELECTION_H
#define MPD_D
B_SELECTION_H
#ifndef MPD_D
ATABASE_SELECTION_HXX
#define MPD_D
ATABASE_SELECTION_HXX
#include "gcc.h"
#include <assert.h>
#include <stddef.h>
struct
directory
;
struct
song
;
struct
db_selection
{
struct
DatabaseSelection
{
/**
* The base URI of the search (UTF-8). Must not begin or end
* with a slash. NULL or an empty string searches the whole
...
...
@@ -40,18 +37,11 @@ struct db_selection {
* Recursively search all sub directories?
*/
bool
recursive
;
};
gcc_nonnull
(
1
,
2
)
static
inline
void
db_selection_init
(
struct
db_selection
*
selection
,
const
char
*
uri
,
bool
recursive
)
{
assert
(
selection
!=
NULL
);
assert
(
uri
!=
NULL
);
selection
->
uri
=
uri
;
selection
->
recursive
=
recursive
;
}
DatabaseSelection
(
const
char
*
_uri
,
bool
_recursive
)
:
uri
(
_uri
),
recursive
(
_recursive
)
{
assert
(
uri
!=
NULL
);
}
};
#endif
src/Stats.cxx
View file @
ff582070
...
...
@@ -22,7 +22,6 @@
extern
"C"
{
#include "stats.h"
#include "database.h"
#include "db_selection.h"
#include "tag.h"
#include "song.h"
#include "client.h"
...
...
@@ -31,6 +30,7 @@ extern "C" {
#include "client_internal.h"
}
#include "DatabaseSelection.hxx"
#include "DatabaseGlue.hxx"
#include "DatabasePlugin.hxx"
...
...
@@ -99,8 +99,7 @@ void stats_update(void)
stats
.
song_duration
=
0
;
stats
.
artist_count
=
0
;
struct
db_selection
selection
;
db_selection_init
(
&
selection
,
""
,
true
);
const
DatabaseSelection
selection
(
""
,
true
);
StringSet
artists
,
albums
;
using
namespace
std
::
placeholders
;
...
...
src/db/SimpleDatabasePlugin.cxx
View file @
ff582070
...
...
@@ -19,10 +19,10 @@
#include "config.h"
#include "SimpleDatabasePlugin.hxx"
#include "DatabaseSelection.hxx"
extern
"C"
{
#include "db_error.h"
#include "db_selection.h"
#include "db_visitor.h"
#include "db_save.h"
#include "db_lock.h"
...
...
@@ -237,7 +237,7 @@ SimpleDatabase::LookupDirectory(const char *uri) const
}
bool
SimpleDatabase
::
Visit
(
const
db_s
election
&
selection
,
SimpleDatabase
::
Visit
(
const
DatabaseS
election
&
selection
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
...
...
src/db/SimpleDatabasePlugin.hxx
View file @
ff582070
...
...
@@ -60,7 +60,7 @@ public:
virtual
void
Close
()
override
;
virtual
struct
song
*
GetSong
(
const
char
*
uri_utf8
,
GError
**
error_r
)
const
override
;
virtual
bool
Visit
(
const
db_s
election
&
selection
,
virtual
bool
Visit
(
const
DatabaseS
election
&
selection
,
VisitDirectory
visit_directory
,
VisitSong
visit_song
,
VisitPlaylist
visit_playlist
,
...
...
test/DumpDatabase.cxx
View file @
ff582070
...
...
@@ -20,7 +20,7 @@
#include "config.h"
#include "DatabaseRegistry.hxx"
#include "DatabasePlugin.hxx"
#include "
db_selection.h
"
#include "
DatabaseSelection.hxx
"
#include "directory.h"
#include "song.h"
#include "playlist_vector.h"
...
...
@@ -130,8 +130,7 @@ main(int argc, char **argv)
return
EXIT_FAILURE
;
}
db_selection
selection
;
db_selection_init
(
&
selection
,
""
,
true
);
const
DatabaseSelection
selection
(
""
,
true
);
if
(
!
db
->
Visit
(
selection
,
DumpDirectory
,
DumpSong
,
DumpPlaylist
,
&
error
))
{
...
...
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