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
1d819d59
Commit
1d819d59
authored
Sep 23, 2015
by
Hugo Beauzée-Luyssen
Browse files
IFile: Expose a file type getter/setter
parent
bd21b0c6
Changes
3
Hide whitespace changes
Inline
Side-by-side
include/IFile.h
View file @
1d819d59
...
...
@@ -24,6 +24,8 @@ class IFile
virtual
~
IFile
()
{}
virtual
unsigned
int
id
()
const
=
0
;
virtual
Type
type
()
=
0
;
virtual
bool
setType
(
Type
type
)
=
0
;
virtual
AlbumTrackPtr
albumTrack
()
=
0
;
virtual
bool
setAlbumTrack
(
AlbumTrackPtr
albumTrack
)
=
0
;
virtual
unsigned
int
duration
()
const
=
0
;
...
...
src/File.cpp
View file @
1d819d59
...
...
@@ -243,6 +243,23 @@ unsigned int File::id() const
return
m_id
;
}
IFile
::
Type
File
::
type
()
{
return
m_type
;
}
bool
File
::
setType
(
Type
type
)
{
static
const
std
::
string
req
=
"UPDATE "
+
policy
::
FileTable
::
Name
+
" SET type = ? WHERE id_file = ?"
;
// We need to convert to an integer representation for the sqlite traits to work properly
using
type_t
=
std
::
underlying_type
<
Type
>::
type
;
if
(
sqlite
::
Tools
::
executeUpdate
(
m_dbConnection
,
req
,
static_cast
<
type_t
>
(
type
),
m_id
)
==
false
)
return
false
;
m_type
=
type
;
return
true
;
}
bool
File
::
createTable
(
DBConnection
connection
)
{
std
::
string
req
=
"CREATE TABLE IF NOT EXISTS "
+
policy
::
FileTable
::
Name
+
"("
...
...
src/File.h
View file @
1d819d59
...
...
@@ -46,6 +46,8 @@ class File : public IFile, public Cache<File, IFile, policy::FileTable, policy::
static
bool
createTable
(
DBConnection
connection
);
virtual
unsigned
int
id
()
const
;
virtual
Type
type
()
override
;
virtual
bool
setType
(
Type
type
)
override
;
virtual
AlbumTrackPtr
albumTrack
();
virtual
bool
setAlbumTrack
(
AlbumTrackPtr
albumTrack
);
virtual
unsigned
int
duration
()
const
;
...
...
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