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
7e5ce623
Commit
7e5ce623
authored
Oct 28, 2016
by
Max Kellermann
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
db/simple: throw C++ exception on init error
parent
e17805f2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
25 deletions
+13
-25
SimpleDatabasePlugin.cxx
src/db/plugins/simple/SimpleDatabasePlugin.cxx
+12
-24
SimpleDatabasePlugin.hxx
src/db/plugins/simple/SimpleDatabasePlugin.hxx
+1
-1
No files found.
src/db/plugins/simple/SimpleDatabasePlugin.cxx
View file @
7e5ce623
...
...
@@ -51,14 +51,20 @@
static
constexpr
Domain
simple_db_domain
(
"simple_db"
);
inline
SimpleDatabase
::
SimpleDatabase
()
inline
SimpleDatabase
::
SimpleDatabase
(
const
ConfigBlock
&
block
)
:
Database
(
simple_db_plugin
),
path
(
AllocatedPath
::
Null
(
)),
path
(
block
.
GetPath
(
"path"
)),
#ifdef ENABLE_ZLIB
compress
(
true
),
compress
(
block
.
GetBlockValue
(
"compress"
,
true
)
),
#endif
cache_path
(
AllocatedPath
::
Null
()),
prefixed_light_song
(
nullptr
)
{}
cache_path
(
block
.
GetPath
(
"cache_directory"
)),
prefixed_light_song
(
nullptr
)
{
if
(
path
.
IsNull
())
throw
std
::
runtime_error
(
"No
\"
path
\"
parameter specified"
);
path_utf8
=
path
.
ToUTF8
();
}
inline
SimpleDatabase
::
SimpleDatabase
(
AllocatedPath
&&
_path
,
#ifndef ENABLE_ZLIB
...
...
@@ -80,25 +86,7 @@ SimpleDatabase::Create(gcc_unused EventLoop &loop,
gcc_unused
DatabaseListener
&
listener
,
const
ConfigBlock
&
block
,
Error
&
)
{
SimpleDatabase
*
db
=
new
SimpleDatabase
();
db
->
Configure
(
block
);
return
db
;
}
void
SimpleDatabase
::
Configure
(
const
ConfigBlock
&
block
)
{
path
=
block
.
GetPath
(
"path"
);
if
(
path
.
IsNull
())
throw
std
::
runtime_error
(
"No
\"
path
\"
parameter specified"
);
path_utf8
=
path
.
ToUTF8
();
cache_path
=
block
.
GetPath
(
"cache_directory"
);
#ifdef ENABLE_ZLIB
compress
=
block
.
GetBlockValue
(
"compress"
,
compress
);
#endif
return
new
SimpleDatabase
(
block
);
}
void
...
...
src/db/plugins/simple/SimpleDatabasePlugin.hxx
View file @
7e5ce623
...
...
@@ -67,7 +67,7 @@ class SimpleDatabase : public Database {
mutable
unsigned
borrowed_song_count
;
#endif
SimpleDatabase
();
SimpleDatabase
(
const
ConfigBlock
&
block
);
SimpleDatabase
(
AllocatedPath
&&
_path
,
bool
_compress
);
...
...
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