Commit 082592f2 authored by Hugo Beauzée-Luyssen's avatar Hugo Beauzée-Luyssen

File: Make Type available from the interface & constify some methods

parent ca8d6b1f
......@@ -14,14 +14,22 @@ class ITrackInformation;
class IFile
{
public:
enum Type
{
VideoType, // Any video file, not being a tv show episode
AudioType, // Any kind of audio file, not being an album track
ShowEpisodeType,
AlbumTrackType,
UnknownType,
};
virtual ~IFile() {}
virtual unsigned int id() const = 0;
virtual std::shared_ptr<IAlbumTrack> albumTrack() = 0;
virtual unsigned int duration() = 0;
virtual unsigned int duration() const = 0;
virtual std::shared_ptr<IShowEpisode> showEpisode() = 0;
virtual int playCount() = 0;
virtual const std::string& mrl() = 0;
virtual int playCount() const = 0;
virtual const std::string& mrl() const = 0;
virtual bool addLabel( LabelPtr label ) = 0;
virtual bool removeLabel( LabelPtr label ) = 0;
virtual std::vector<std::shared_ptr<ILabel> > labels() = 0;
......
......@@ -59,7 +59,7 @@ std::shared_ptr<IAlbumTrack> File::albumTrack()
return m_albumTrack;
}
unsigned int File::duration()
unsigned int File::duration() const
{
return m_duration;
}
......@@ -83,12 +83,12 @@ std::vector<std::shared_ptr<ILabel> > File::labels()
return labels;
}
int File::playCount()
int File::playCount() const
{
return m_playCount;
}
const std::string& File::mrl()
const std::string& File::mrl() const
{
return m_mrl;
}
......
......@@ -34,14 +34,6 @@ class File : public IFile, public Cache<File, IFile, policy::FileTable, policy::
private:
typedef Cache<File, IFile, policy::FileTable, policy::FileCache> _Cache;
public:
enum Type
{
VideoType, // Any video file, not being a tv show episode
AudioType, // Any kind of audio file, not being an album track
ShowEpisodeType,
AlbumTrackType,
UnknownType,
};
// Those should be private, however the standard states that the expression
// ::new (pv) T(std::forward(args)...)
......@@ -55,13 +47,13 @@ class File : public IFile, public Cache<File, IFile, policy::FileTable, policy::
virtual unsigned int id() const;
virtual std::shared_ptr<IAlbumTrack> albumTrack();
virtual unsigned int duration();
virtual unsigned int duration() const;
virtual std::shared_ptr<IShowEpisode> showEpisode();
virtual bool addLabel( LabelPtr label );
virtual bool removeLabel( LabelPtr label );
virtual std::vector<std::shared_ptr<ILabel> > labels();
virtual int playCount();
virtual const std::string& mrl();
virtual int playCount() const;
virtual const std::string& mrl() const;
private:
sqlite3* m_dbConnection;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment