DatabaseSelection: use std::string
This commit is contained in:
parent
a6aa0e4cbf
commit
2d5413fc3b
|
@ -22,7 +22,7 @@
|
||||||
|
|
||||||
#include "Compiler.h"
|
#include "Compiler.h"
|
||||||
|
|
||||||
#include <assert.h>
|
#include <string>
|
||||||
|
|
||||||
class SongFilter;
|
class SongFilter;
|
||||||
struct Song;
|
struct Song;
|
||||||
|
@ -30,10 +30,9 @@ struct Song;
|
||||||
struct DatabaseSelection {
|
struct DatabaseSelection {
|
||||||
/**
|
/**
|
||||||
* The base URI of the search (UTF-8). Must not begin or end
|
* The base URI of the search (UTF-8). Must not begin or end
|
||||||
* with a slash. nullptr or an empty string searches the whole
|
* with a slash. An empty string searches the whole database.
|
||||||
* database.
|
|
||||||
*/
|
*/
|
||||||
const char *uri;
|
std::string uri;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Recursively search all sub directories?
|
* Recursively search all sub directories?
|
||||||
|
@ -45,7 +44,6 @@ struct DatabaseSelection {
|
||||||
DatabaseSelection(const char *_uri, bool _recursive,
|
DatabaseSelection(const char *_uri, bool _recursive,
|
||||||
const SongFilter *_filter=nullptr)
|
const SongFilter *_filter=nullptr)
|
||||||
:uri(_uri), recursive(_recursive), filter(_filter) {
|
:uri(_uri), recursive(_recursive), filter(_filter) {
|
||||||
assert(uri != nullptr);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gcc_pure
|
gcc_pure
|
||||||
|
|
|
@ -398,7 +398,7 @@ ProxyDatabase::Visit(const DatabaseSelection &selection,
|
||||||
// TODO: match
|
// TODO: match
|
||||||
// TODO: auto-reconnect
|
// TODO: auto-reconnect
|
||||||
|
|
||||||
return ::Visit(connection, selection.uri, selection.recursive,
|
return ::Visit(connection, selection.uri.c_str(), selection.recursive,
|
||||||
visit_directory, visit_song, visit_playlist,
|
visit_directory, visit_song, visit_playlist,
|
||||||
error);
|
error);
|
||||||
}
|
}
|
||||||
|
|
|
@ -239,10 +239,10 @@ SimpleDatabase::Visit(const DatabaseSelection &selection,
|
||||||
{
|
{
|
||||||
ScopeDatabaseLock protect;
|
ScopeDatabaseLock protect;
|
||||||
|
|
||||||
const Directory *directory = root->LookupDirectory(selection.uri);
|
const Directory *directory = root->LookupDirectory(selection.uri.c_str());
|
||||||
if (directory == nullptr) {
|
if (directory == nullptr) {
|
||||||
if (visit_song) {
|
if (visit_song) {
|
||||||
Song *song = root->LookupSong(selection.uri);
|
Song *song = root->LookupSong(selection.uri.c_str());
|
||||||
if (song != nullptr)
|
if (song != nullptr)
|
||||||
return !selection.Match(*song) ||
|
return !selection.Match(*song) ||
|
||||||
visit_song(*song, error);
|
visit_song(*song, error);
|
||||||
|
|
Loading…
Reference in New Issue