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
154e601f
Commit
154e601f
authored
Apr 25, 2014
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/Helpers: split library
parent
4cca75b2
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
99 additions
and
47 deletions
+99
-47
Makefile.am
Makefile.am
+1
-0
Helpers.cxx
src/db/Helpers.cxx
+0
-36
Helpers.hxx
src/db/Helpers.hxx
+0
-11
UniqueTags.cxx
src/db/UniqueTags.cxx
+59
-0
UniqueTags.hxx
src/db/UniqueTags.hxx
+38
-0
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+1
-0
No files found.
Makefile.am
View file @
154e601f
...
...
@@ -590,6 +590,7 @@ libdb_plugins_a_SOURCES = \
src/PlaylistDatabase.cxx src/PlaylistDatabase.hxx
\
src/db/Registry.cxx src/db/Registry.hxx
\
src/db/Helpers.cxx src/db/Helpers.hxx
\
src/db/UniqueTags.cxx src/db/UniqueTags.hxx
\
src/db/plugins/simple/DatabaseSave.cxx
\
src/db/plugins/simple/DatabaseSave.hxx
\
src/db/plugins/simple/DirectorySave.cxx
\
...
...
src/db/Helpers.cxx
View file @
154e601f
...
...
@@ -22,13 +22,9 @@
#include "Interface.hxx"
#include "LightSong.hxx"
#include "tag/Tag.hxx"
#include "tag/TagBuilder.hxx"
#include "tag/Set.hxx"
#include <functional>
#include <set>
#include <assert.h>
#include <string.h>
struct
StringLess
{
...
...
@@ -40,38 +36,6 @@ struct StringLess {
typedef
std
::
set
<
const
char
*
,
StringLess
>
StringSet
;
static
bool
CollectTags
(
TagSet
&
set
,
TagType
tag_type
,
uint32_t
group_mask
,
const
LightSong
&
song
)
{
assert
(
song
.
tag
!=
nullptr
);
const
Tag
&
tag
=
*
song
.
tag
;
set
.
InsertUnique
(
tag
,
tag_type
,
group_mask
);
return
true
;
}
bool
VisitUniqueTags
(
const
Database
&
db
,
const
DatabaseSelection
&
selection
,
TagType
tag_type
,
uint32_t
group_mask
,
VisitTag
visit_tag
,
Error
&
error
)
{
TagSet
set
;
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
CollectTags
,
std
::
ref
(
set
),
tag_type
,
group_mask
,
_1
);
if
(
!
db
.
Visit
(
selection
,
f
,
error
))
return
false
;
for
(
const
auto
&
value
:
set
)
if
(
!
visit_tag
(
value
,
error
))
return
false
;
return
true
;
}
static
void
StatsVisitTag
(
DatabaseStats
&
stats
,
StringSet
&
artists
,
StringSet
&
albums
,
const
Tag
&
tag
)
...
...
src/db/Helpers.hxx
View file @
154e601f
...
...
@@ -20,23 +20,12 @@
#ifndef MPD_MEMORY_DATABASE_PLUGIN_HXX
#define MPD_MEMORY_DATABASE_PLUGIN_HXX
#include "Visitor.hxx"
#include "tag/TagType.h"
#include <stdint.h>
class
Error
;
class
Database
;
struct
DatabaseSelection
;
struct
DatabaseStats
;
bool
VisitUniqueTags
(
const
Database
&
db
,
const
DatabaseSelection
&
selection
,
TagType
tag_type
,
uint32_t
group_mask
,
VisitTag
visit_tag
,
Error
&
error
);
bool
GetStats
(
const
Database
&
db
,
const
DatabaseSelection
&
selection
,
DatabaseStats
&
stats
,
Error
&
error
);
...
...
src/db/UniqueTags.cxx
0 → 100644
View file @
154e601f
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#include "UniqueTags.hxx"
#include "Interface.hxx"
#include "LightSong.hxx"
#include "tag/Set.hxx"
#include <functional>
#include <assert.h>
static
bool
CollectTags
(
TagSet
&
set
,
TagType
tag_type
,
uint32_t
group_mask
,
const
LightSong
&
song
)
{
assert
(
song
.
tag
!=
nullptr
);
const
Tag
&
tag
=
*
song
.
tag
;
set
.
InsertUnique
(
tag
,
tag_type
,
group_mask
);
return
true
;
}
bool
VisitUniqueTags
(
const
Database
&
db
,
const
DatabaseSelection
&
selection
,
TagType
tag_type
,
uint32_t
group_mask
,
VisitTag
visit_tag
,
Error
&
error
)
{
TagSet
set
;
using
namespace
std
::
placeholders
;
const
auto
f
=
std
::
bind
(
CollectTags
,
std
::
ref
(
set
),
tag_type
,
group_mask
,
_1
);
if
(
!
db
.
Visit
(
selection
,
f
,
error
))
return
false
;
for
(
const
auto
&
value
:
set
)
if
(
!
visit_tag
(
value
,
error
))
return
false
;
return
true
;
}
src/db/UniqueTags.hxx
0 → 100644
View file @
154e601f
/*
* Copyright (C) 2003-2014 The Music Player Daemon Project
* http://www.musicpd.org
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/
#ifndef MPD_DB_UNIQUE_TAGS_HXX
#define MPD_DB_UNIQUE_TAGS_HXX
#include "Visitor.hxx"
#include "tag/TagType.h"
#include <stdint.h>
class
Error
;
class
Database
;
struct
DatabaseSelection
;
bool
VisitUniqueTags
(
const
Database
&
db
,
const
DatabaseSelection
&
selection
,
TagType
tag_type
,
uint32_t
group_mask
,
VisitTag
visit_tag
,
Error
&
error
);
#endif
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
154e601f
...
...
@@ -23,6 +23,7 @@
#include "db/DatabasePlugin.hxx"
#include "db/Selection.hxx"
#include "db/Helpers.hxx"
#include "db/UniqueTags.hxx"
#include "db/LightDirectory.hxx"
#include "Directory.hxx"
#include "Song.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