Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Menu
Open sidebar
VideoLAN
medialibrary
Commits
02e563cb
Commit
02e563cb
authored
Apr 28, 2016
by
Hugo Beauzée-Luyssen
Browse files
Provide a std::to_string replacement for android
parent
94b830c0
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/ToString.h
0 → 100644
View file @
02e563cb
/*****************************************************************************
* Media Library
*****************************************************************************
* Copyright (C) 2015 Hugo Beauzée-Luyssen, Videolabs
*
* Authors: Hugo Beauzée-Luyssen<hugo@beauzee.fr>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU Lesser General Public License as published by
* the Free Software Foundation; either version 2.1 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 Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser 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.
*****************************************************************************/
#pragma once
#include
<string>
#ifndef __ANDROID__
template
<
typename
T
>
inline
std
::
string
toString
(
T
t
)
{
static_assert
(
std
::
is_fundamental
<
T
>::
value
,
"This only supports fundamental types"
);
return
std
::
to_string
(
t
);
}
#else
#include
<sstream>
template
<
typename
T
>
inline
std
::
string
toString
(
T
t
)
{
static_assert
(
std
::
is_fundamental
<
T
>::
value
,
"This only supports fundamental types"
);
std
::
ostringstream
ss
;
ss
<<
std
::
forward
<
T
>
(
t
);
return
ss
.
str
();
}
#endif
src/History.cpp
View file @
02e563cb
...
...
@@ -23,6 +23,7 @@
#include
"History.h"
#include
"database/SqliteTools.h"
#include
"ToString.h"
namespace
policy
{
...
...
@@ -56,7 +57,7 @@ bool History::createTable( DBConnection dbConnection )
" BEGIN "
"DELETE FROM "
+
policy
::
HistoryTable
::
Name
+
" WHERE id_record in "
"(SELECT id_record FROM "
+
policy
::
HistoryTable
::
Name
+
" ORDER BY insertion_date DESC LIMIT -1 OFFSET "
+
std
::
to_s
tring
(
MaxEntries
)
+
");"
" ORDER BY insertion_date DESC LIMIT -1 OFFSET "
+
toS
tring
(
MaxEntries
)
+
");"
" END"
;
return
sqlite
::
Tools
::
executeRequest
(
dbConnection
,
req
)
&&
sqlite
::
Tools
::
executeRequest
(
dbConnection
,
triggerReq
);
...
...
src/database/SqliteErrors.h
View file @
02e563cb
...
...
@@ -24,6 +24,7 @@
#include
<string>
#include
<exception>
#include
"ToString.h"
namespace
sqlite
{
...
...
@@ -52,8 +53,8 @@ class ColumnOutOfRange : public std::exception
public:
ColumnOutOfRange
(
unsigned
int
idx
,
unsigned
int
nbColumns
)
{
m_reason
=
"Attempting to extract column at index "
+
std
::
to_s
tring
(
idx
)
+
" from a request with "
+
std
::
to_s
tring
(
nbColumns
)
+
" columns"
;
m_reason
=
"Attempting to extract column at index "
+
toS
tring
(
idx
)
+
" from a request with "
+
toS
tring
(
nbColumns
)
+
" columns"
;
}
virtual
const
char
*
what
()
const
noexcept
override
...
...
src/metadata_services/MetadataParser.cpp
View file @
02e563cb
...
...
@@ -28,6 +28,7 @@
#include
"Genre.h"
#include
"Media.h"
#include
"Show.h"
#include
"ToString.h"
#include
"utils/Filename.h"
#include
"utils/ModificationsNotifier.h"
...
...
@@ -318,7 +319,7 @@ std::shared_ptr<AlbumTrack> MetadataParser::handleTrack( std::shared_ptr<Album>
if
(
task
.
trackNumber
!=
0
)
{
title
=
"Track #"
;
title
+=
std
::
to_s
tring
(
task
.
trackNumber
);
title
+=
toS
tring
(
task
.
trackNumber
);
}
}
if
(
title
.
empty
()
==
false
)
...
...
src/metadata_services/vlc/VLCThumbnailer.cpp
View file @
02e563cb
...
...
@@ -42,6 +42,7 @@
#include
"logging/Logger.h"
#include
"MediaLibrary.h"
#include
"utils/VLCInstance.h"
#include
"ToString.h"
VLCThumbnailer
::
VLCThumbnailer
()
:
m_instance
(
VLCInstance
::
get
()
)
...
...
@@ -276,7 +277,7 @@ parser::Task::Status VLCThumbnailer::compress( std::shared_ptr<Media> media, std
{
auto
path
=
m_ml
->
thumbnailPath
();
path
+=
"/"
;
path
+=
std
::
to_s
tring
(
media
->
id
()
)
+
path
+=
toS
tring
(
media
->
id
()
)
+
#ifdef WITH_EVAS
".png"
;
#else
...
...
Thomas Guillem
@tguillem
mentioned in commit
0e16449e
·
Aug 26, 2016
mentioned in commit
0e16449e
mentioned in commit 0e16449e07aedce2d7b5bb97333f7a8c2a747729
Toggle commit list
Write
Preview
Supports
Markdown
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