improved Footage class semantics

Set const functions to const and use DISABLE_COPY_MOVE instead of manually
deleting copy and move constructors.
This commit is contained in:
itsmattkc
2019-12-06 13:28:13 +11:00
parent c32a1c8be2
commit f719ac027a
2 changed files with 17 additions and 34 deletions
+8 -8
View File
@@ -35,7 +35,7 @@ Footage::~Footage()
ClearStreams();
}
const Footage::Status& Footage::status()
const Footage::Status& Footage::status() const
{
return status_;
}
@@ -56,7 +56,7 @@ void Footage::Clear()
set_status(kUnprobed);
}
const QString &Footage::filename()
const QString &Footage::filename() const
{
return filename_;
}
@@ -66,7 +66,7 @@ void Footage::set_filename(const QString &s)
filename_ = s;
}
const QDateTime &Footage::timestamp()
const QDateTime &Footage::timestamp() const
{
return timestamp_;
}
@@ -85,17 +85,17 @@ void Footage::add_stream(StreamPtr s)
streams_.last()->set_footage(this);
}
StreamPtr Footage::stream(int index)
StreamPtr Footage::stream(int index) const
{
return streams_.at(index);
}
const QList<StreamPtr> &Footage::streams()
const QList<StreamPtr> &Footage::streams() const
{
return streams_;
}
int Footage::stream_count()
int Footage::stream_count() const
{
return streams_.size();
}
@@ -105,7 +105,7 @@ Item::Type Footage::type() const
return kFootage;
}
const QString &Footage::decoder()
const QString &Footage::decoder() const
{
return decoder_;
}
@@ -139,7 +139,7 @@ QIcon Footage::icon()
return olive::icon::Image;
}
/* fall through */
/* fall-through */
case kInvalid:
return olive::icon::Error;
}
+9 -26
View File
@@ -24,6 +24,7 @@
#include <QList>
#include <QDateTime>
#include "common/constructors.h"
#include "common/rational.h"
#include "project/item/item.h"
#include "project/item/footage/audiostream.h"
@@ -59,25 +60,7 @@ public:
*/
virtual ~Footage() override;
/**
* @brief Deleted copy constructor
*/
Footage(const Footage& other) = delete;
/**
* @brief Deleted move constructor
*/
Footage(Footage&& other) = delete;
/**
* @brief Deleted copy assignment
*/
Footage& operator=(const Footage& other) = delete;
/**
* @brief Deleted move assignment
*/
Footage& operator=(Footage&& other) = delete;
DISABLE_COPY_MOVE(Footage)
/**
* @brief Check the ready state of this Footage object
@@ -86,7 +69,7 @@ public:
*
* If the Footage has been successfully probed, this will return TRUE.
*/
const Status& status();
const Status& status() const;
/**
* @brief Set ready state
@@ -114,7 +97,7 @@ public:
/**
* @brief Return the current filename of this Footage object
*/
const QString& filename();
const QString& filename() const;
/**
* @brief Set the filename
@@ -134,7 +117,7 @@ public:
* The file's last modified timestamp is stored for potential organization in the ProjectExplorer. It can be
* retrieved here.
*/
const QDateTime& timestamp();
const QDateTime& timestamp() const;
/**
* @brief Set the last modified time/date
@@ -172,17 +155,17 @@ public:
*
* The stream at the index provided
*/
StreamPtr stream(int index);
StreamPtr stream(int index) const;
/**
* @brief Returns a list of the streams in this Footage
*/
const QList<StreamPtr>& streams();
const QList<StreamPtr>& streams() const;
/**
* @brief Retrieve total number of streams in this Footage file
*/
int stream_count();
int stream_count() const;
/**
* @brief Item::Type() override
@@ -198,7 +181,7 @@ public:
*
* A decoder ID
*/
const QString& decoder();
const QString& decoder() const;
/**
* @brief Used by decoders when they Probe to attach itself to this Footage