From 8158a1f2fa5998fac89d89c58d00c9dda956cd73 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 3 Jul 2019 06:28:57 -0400 Subject: [PATCH 1/4] Catch-by-reference for tests/Clip_Tests --- tests/Clip_Tests.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/tests/Clip_Tests.cpp b/tests/Clip_Tests.cpp index 6c60bedd..1b520ef6 100644 --- a/tests/Clip_Tests.cpp +++ b/tests/Clip_Tests.cpp @@ -128,7 +128,7 @@ TEST(Clip_Properties) CHECK_EQUAL(true, root["alpha"]["keyframe"].asBool()); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); @@ -153,7 +153,7 @@ TEST(Clip_Properties) CHECK_EQUAL(false, root["alpha"]["keyframe"].asBool()); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); @@ -177,7 +177,7 @@ TEST(Clip_Properties) CHECK_EQUAL(false, root["alpha"]["keyframe"].asBool()); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); @@ -202,7 +202,7 @@ TEST(Clip_Properties) CHECK_EQUAL(true, root["alpha"]["keyframe"].asBool()); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); From cb6ac2121901e8d47c10a850ab7c7cb358b0a1d0 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 3 Jul 2019 06:29:32 -0400 Subject: [PATCH 2/4] src/effects: Catch-by-reference --- src/effects/Bars.cpp | 2 +- src/effects/Blur.cpp | 2 +- src/effects/Brightness.cpp | 2 +- src/effects/ChromaKey.cpp | 2 +- src/effects/ColorShift.cpp | 2 +- src/effects/Crop.cpp | 2 +- src/effects/Deinterlace.cpp | 2 +- src/effects/Hue.cpp | 2 +- src/effects/Mask.cpp | 2 +- src/effects/Negate.cpp | 2 +- src/effects/Pixelate.cpp | 2 +- src/effects/Saturation.cpp | 2 +- src/effects/Shift.cpp | 2 +- src/effects/Wave.cpp | 2 +- 14 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/effects/Bars.cpp b/src/effects/Bars.cpp index 4320e618..a05d9021 100644 --- a/src/effects/Bars.cpp +++ b/src/effects/Bars.cpp @@ -156,7 +156,7 @@ void Bars::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Blur.cpp b/src/effects/Blur.cpp index db036133..be07c386 100644 --- a/src/effects/Blur.cpp +++ b/src/effects/Blur.cpp @@ -293,7 +293,7 @@ void Blur::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Brightness.cpp b/src/effects/Brightness.cpp index 67d45824..eec4b7fe 100644 --- a/src/effects/Brightness.cpp +++ b/src/effects/Brightness.cpp @@ -147,7 +147,7 @@ void Brightness::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/ChromaKey.cpp b/src/effects/ChromaKey.cpp index 397c7ab1..b99da9bb 100644 --- a/src/effects/ChromaKey.cpp +++ b/src/effects/ChromaKey.cpp @@ -140,7 +140,7 @@ void ChromaKey::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/ColorShift.cpp b/src/effects/ColorShift.cpp index f4fab883..d3622634 100644 --- a/src/effects/ColorShift.cpp +++ b/src/effects/ColorShift.cpp @@ -239,7 +239,7 @@ void ColorShift::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Crop.cpp b/src/effects/Crop.cpp index 99f8f124..af372a00 100644 --- a/src/effects/Crop.cpp +++ b/src/effects/Crop.cpp @@ -155,7 +155,7 @@ void Crop::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Deinterlace.cpp b/src/effects/Deinterlace.cpp index c698dbd1..a09a07f0 100644 --- a/src/effects/Deinterlace.cpp +++ b/src/effects/Deinterlace.cpp @@ -134,7 +134,7 @@ void Deinterlace::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Hue.cpp b/src/effects/Hue.cpp index a75b4a1f..43e6c1c0 100644 --- a/src/effects/Hue.cpp +++ b/src/effects/Hue.cpp @@ -141,7 +141,7 @@ void Hue::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Mask.cpp b/src/effects/Mask.cpp index b952ba62..f0e28196 100644 --- a/src/effects/Mask.cpp +++ b/src/effects/Mask.cpp @@ -194,7 +194,7 @@ void Mask::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Negate.cpp b/src/effects/Negate.cpp index 1b9decdc..547bb88d 100644 --- a/src/effects/Negate.cpp +++ b/src/effects/Negate.cpp @@ -95,7 +95,7 @@ void Negate::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Pixelate.cpp b/src/effects/Pixelate.cpp index 95d88b71..b064ceeb 100644 --- a/src/effects/Pixelate.cpp +++ b/src/effects/Pixelate.cpp @@ -152,7 +152,7 @@ void Pixelate::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Saturation.cpp b/src/effects/Saturation.cpp index 4278b0b8..83792f65 100644 --- a/src/effects/Saturation.cpp +++ b/src/effects/Saturation.cpp @@ -152,7 +152,7 @@ void Saturation::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Shift.cpp b/src/effects/Shift.cpp index 0e802c99..666bd479 100644 --- a/src/effects/Shift.cpp +++ b/src/effects/Shift.cpp @@ -172,7 +172,7 @@ void Shift::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/effects/Wave.cpp b/src/effects/Wave.cpp index cfcb70c7..5ffb9300 100644 --- a/src/effects/Wave.cpp +++ b/src/effects/Wave.cpp @@ -155,7 +155,7 @@ void Wave::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); From 25b522589ddfd5e78d261d2c3fba12b06364682f Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 3 Jul 2019 12:58:02 -0400 Subject: [PATCH 3/4] Always catch-by-reference in C++11 --- src/CacheDisk.cpp | 2 +- src/CacheMemory.cpp | 2 +- src/ChunkReader.cpp | 6 +++--- src/Clip.cpp | 4 ++-- src/Color.cpp | 2 +- src/Coordinate.cpp | 2 +- src/DecklinkReader.cpp | 2 +- src/DummyReader.cpp | 2 +- src/EffectBase.cpp | 2 +- src/FFmpegReader.cpp | 2 +- src/FrameMapper.cpp | 2 +- src/ImageReader.cpp | 4 ++-- src/KeyFrame.cpp | 4 ++-- src/Point.cpp | 2 +- src/Profiles.cpp | 4 ++-- src/QtImageReader.cpp | 2 +- src/TextReader.cpp | 2 +- src/Timeline.cpp | 4 ++-- src/WriterBase.cpp | 2 +- 19 files changed, 26 insertions(+), 26 deletions(-) diff --git a/src/CacheDisk.cpp b/src/CacheDisk.cpp index 4d446746..7d71e100 100644 --- a/src/CacheDisk.cpp +++ b/src/CacheDisk.cpp @@ -522,7 +522,7 @@ void CacheDisk::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/CacheMemory.cpp b/src/CacheMemory.cpp index 4de6bb1f..790f3f98 100644 --- a/src/CacheMemory.cpp +++ b/src/CacheMemory.cpp @@ -377,7 +377,7 @@ void CacheMemory::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/ChunkReader.cpp b/src/ChunkReader.cpp index 8d5b466e..97ab0797 100644 --- a/src/ChunkReader.cpp +++ b/src/ChunkReader.cpp @@ -121,7 +121,7 @@ void ChunkReader::load_json() info.audio_timebase.den = root["audio_timebase"]["den"].asInt(); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON could not be parsed (or is invalid).", path); @@ -235,7 +235,7 @@ std::shared_ptr ChunkReader::GetFrame(int64_t requested_frame) local_reader = new FFmpegReader(chunk_video_path); local_reader->Open(); // open reader - } catch (InvalidFile) + } catch (const InvalidFile& e) { // Invalid Chunk (possibly it is not found) throw ChunkNotFound(path, requested_frame, location.number, location.frame); @@ -298,7 +298,7 @@ void ChunkReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Clip.cpp b/src/Clip.cpp index bddcd0c9..93a246af 100644 --- a/src/Clip.cpp +++ b/src/Clip.cpp @@ -123,7 +123,7 @@ void Clip::init_reader_rotation() { try { float rotate_metadata = strtof(reader->info.metadata["rotate"].c_str(), 0); rotation = Keyframe(rotate_metadata); - } catch (exception e) {} + } catch (const std::exception& e) {} } else // Default no rotation @@ -809,7 +809,7 @@ void Clip::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Color.cpp b/src/Color.cpp index 21c3f146..932d31f4 100644 --- a/src/Color.cpp +++ b/src/Color.cpp @@ -125,7 +125,7 @@ void Color::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Coordinate.cpp b/src/Coordinate.cpp index 5baeb5bf..2f2dbaa6 100644 --- a/src/Coordinate.cpp +++ b/src/Coordinate.cpp @@ -88,7 +88,7 @@ void Coordinate::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/DecklinkReader.cpp b/src/DecklinkReader.cpp index 230a6689..b9464301 100644 --- a/src/DecklinkReader.cpp +++ b/src/DecklinkReader.cpp @@ -283,7 +283,7 @@ void DecklinkReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/DummyReader.cpp b/src/DummyReader.cpp index aa1e6a56..28b8f2b0 100644 --- a/src/DummyReader.cpp +++ b/src/DummyReader.cpp @@ -161,7 +161,7 @@ void DummyReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/EffectBase.cpp b/src/EffectBase.cpp index 9bf30986..d6cee206 100644 --- a/src/EffectBase.cpp +++ b/src/EffectBase.cpp @@ -117,7 +117,7 @@ void EffectBase::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/FFmpegReader.cpp b/src/FFmpegReader.cpp index 10d89051..044fb580 100644 --- a/src/FFmpegReader.cpp +++ b/src/FFmpegReader.cpp @@ -2439,7 +2439,7 @@ void FFmpegReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) { + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); } diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index 1f6b7629..3be9f812 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -712,7 +712,7 @@ void FrameMapper::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/ImageReader.cpp b/src/ImageReader.cpp index 62439d82..31afd179 100644 --- a/src/ImageReader.cpp +++ b/src/ImageReader.cpp @@ -67,7 +67,7 @@ void ImageReader::Open() image->backgroundColor(Magick::Color("none")); MAGICK_IMAGE_ALPHA(image, true); } - catch (Magick::Exception e) { + catch (const Magick::Exception& e) { // raise exception throw InvalidFile("File could not be opened.", path); } @@ -174,7 +174,7 @@ void ImageReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 31393d17..75b2c739 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -200,7 +200,7 @@ Point Keyframe::GetPreviousPoint(Point p) { else return Points[0]; - } catch (OutOfBoundsPoint) { + } catch (const OutOfBoundsPoint& e) { // No previous point return Point(-1, -1); } @@ -384,7 +384,7 @@ void Keyframe::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Point.cpp b/src/Point.cpp index b0e85658..8d29b2ac 100644 --- a/src/Point.cpp +++ b/src/Point.cpp @@ -151,7 +151,7 @@ void Point::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Profiles.cpp b/src/Profiles.cpp index 9c2b3014..7d3bbb45 100644 --- a/src/Profiles.cpp +++ b/src/Profiles.cpp @@ -120,7 +120,7 @@ Profile::Profile(string path) { } } - catch (exception e) + catch (const std::exception& e) { // Error parsing profile file throw InvalidFile("Profile could not be found or loaded (or is invalid).", path); @@ -182,7 +182,7 @@ void Profile::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/QtImageReader.cpp b/src/QtImageReader.cpp index bd1c4bc8..b8e17160 100644 --- a/src/QtImageReader.cpp +++ b/src/QtImageReader.cpp @@ -304,7 +304,7 @@ void QtImageReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/TextReader.cpp b/src/TextReader.cpp index 9c664535..b714fb97 100644 --- a/src/TextReader.cpp +++ b/src/TextReader.cpp @@ -235,7 +235,7 @@ void TextReader::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/Timeline.cpp b/src/Timeline.cpp index 7636de7d..359901ac 100644 --- a/src/Timeline.cpp +++ b/src/Timeline.cpp @@ -1045,7 +1045,7 @@ void Timeline::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); @@ -1160,7 +1160,7 @@ void Timeline::ApplyJsonDiff(string value) { } } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); diff --git a/src/WriterBase.cpp b/src/WriterBase.cpp index bc16e7e0..71705529 100644 --- a/src/WriterBase.cpp +++ b/src/WriterBase.cpp @@ -214,7 +214,7 @@ void WriterBase::SetJson(string value) { // Set all values that match SetJsonValue(root); } - catch (exception e) + catch (const std::exception& e) { // Error parsing JSON (or missing keys) throw InvalidJSON("JSON is invalid (missing keys or invalid data types)", ""); From 80765147b9dffd5872d08387eade60c30edc0c9e Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Wed, 3 Jul 2019 13:12:02 -0400 Subject: [PATCH 4/4] Exceptions.h: fixes for noexcept, unused vars, std:: Some fixes for `-Wall`-readiness: * Removed `using namespace std;` from the header and added `std::` prefixes where needed (`std::string`) * Replaced `throw ()` in declarations with `noexcept`, as `throw ()` is [deprecated in c++11][1] * Several exception classes had a `file_path` member variable, despite never using it. Removed the unused class member. [1]: --- include/Exceptions.h | 125 +++++++++++++++++++++---------------------- 1 file changed, 60 insertions(+), 65 deletions(-) diff --git a/include/Exceptions.h b/include/Exceptions.h index 0fb2bb1e..c5228f13 100644 --- a/include/Exceptions.h +++ b/include/Exceptions.h @@ -32,7 +32,6 @@ #define OPENSHOT_EXCEPTIONS_H #include -using namespace std; namespace openshot { @@ -45,11 +44,11 @@ namespace openshot { class BaseException : public std::exception //: public exception { protected: - string m_message; + std::string m_message; public: - BaseException(string message) : m_message(message) { } - virtual ~BaseException() throw () {} - virtual const char* what() const throw () { + BaseException(std::string message) : m_message(message) { } + virtual ~BaseException() noexcept {} + virtual const char* what() const noexcept { // return custom message return m_message.c_str(); } @@ -59,13 +58,12 @@ namespace openshot { class ChunkNotFound : public BaseException { public: - string file_path; int64_t frame_number; int64_t chunk_number; int64_t chunk_frame; - ChunkNotFound(string message, int64_t frame_number, int64_t chunk_number, int64_t chunk_frame) + ChunkNotFound(std::string message, int64_t frame_number, int64_t chunk_number, int64_t chunk_frame) : BaseException(message), frame_number(frame_number), chunk_number(chunk_number), chunk_frame(chunk_frame) { } - virtual ~ChunkNotFound() throw () {} + virtual ~ChunkNotFound() noexcept {} }; @@ -73,132 +71,129 @@ namespace openshot { class DecklinkError : public BaseException { public: - DecklinkError(string message) + DecklinkError(std::string message) : BaseException(message) { } - virtual ~DecklinkError() throw () {} + virtual ~DecklinkError() noexcept {} }; /// Exception when decoding audio packet class ErrorDecodingAudio : public BaseException { public: - string file_path; int64_t frame_number; - ErrorDecodingAudio(string message, int64_t frame_number) + ErrorDecodingAudio(std::string message, int64_t frame_number) : BaseException(message), frame_number(frame_number) { } - virtual ~ErrorDecodingAudio() throw () {} + virtual ~ErrorDecodingAudio() noexcept {} }; /// Exception when encoding audio packet class ErrorEncodingAudio : public BaseException { public: - string file_path; int64_t frame_number; - ErrorEncodingAudio(string message, int64_t frame_number) + ErrorEncodingAudio(std::string message, int64_t frame_number) : BaseException(message), frame_number(frame_number) { } - virtual ~ErrorEncodingAudio() throw () {} + virtual ~ErrorEncodingAudio() noexcept {} }; /// Exception when encoding audio packet class ErrorEncodingVideo : public BaseException { public: - string file_path; int64_t frame_number; - ErrorEncodingVideo(string message, int64_t frame_number) + ErrorEncodingVideo(std::string message, int64_t frame_number) : BaseException(message), frame_number(frame_number) { } - virtual ~ErrorEncodingVideo() throw () {} + virtual ~ErrorEncodingVideo() noexcept {} }; /// Exception when an invalid # of audio channels are detected class InvalidChannels : public BaseException { public: - string file_path; - InvalidChannels(string message, string file_path) + std::string file_path; + InvalidChannels(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidChannels() throw () {} + virtual ~InvalidChannels() noexcept {} }; /// Exception when no valid codec is found for a file class InvalidCodec : public BaseException { public: - string file_path; - InvalidCodec(string message, string file_path) + std::string file_path; + InvalidCodec(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidCodec() throw () {} + virtual ~InvalidCodec() noexcept {} }; /// Exception for files that can not be found or opened class InvalidFile : public BaseException { public: - string file_path; - InvalidFile(string message, string file_path) + std::string file_path; + InvalidFile(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidFile() throw () {} + virtual ~InvalidFile() noexcept {} }; /// Exception when no valid format is found for a file class InvalidFormat : public BaseException { public: - string file_path; - InvalidFormat(string message, string file_path) + std::string file_path; + InvalidFormat(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidFormat() throw () {} + virtual ~InvalidFormat() noexcept {} }; /// Exception for invalid JSON class InvalidJSON : public BaseException { public: - string file_path; - InvalidJSON(string message, string file_path) + std::string file_path; + InvalidJSON(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidJSON() throw () {} + virtual ~InvalidJSON() noexcept {} }; /// Exception when invalid encoding options are used class InvalidOptions : public BaseException { public: - string file_path; - InvalidOptions(string message, string file_path) + std::string file_path; + InvalidOptions(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidOptions() throw () {} + virtual ~InvalidOptions() noexcept {} }; /// Exception when invalid sample rate is detected during encoding class InvalidSampleRate : public BaseException { public: - string file_path; - InvalidSampleRate(string message, string file_path) + std::string file_path; + InvalidSampleRate(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~InvalidSampleRate() throw () {} + virtual ~InvalidSampleRate() noexcept {} }; /// Exception for missing JSON Change key class InvalidJSONKey : public BaseException { public: - string json; - InvalidJSONKey(string message, string json) + std::string json; + InvalidJSONKey(std::string message, std::string json) : BaseException(message), json(json) { } - virtual ~InvalidJSONKey() throw () {} + virtual ~InvalidJSONKey() noexcept {} }; /// Exception when no streams are found in the file class NoStreamsFound : public BaseException { public: - string file_path; - NoStreamsFound(string message, string file_path) + std::string file_path; + NoStreamsFound(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~NoStreamsFound() throw () {} + virtual ~NoStreamsFound() noexcept {} }; /// Exception for frames that are out of bounds. @@ -207,9 +202,9 @@ namespace openshot { public: int64_t FrameRequested; int64_t MaxFrames; - OutOfBoundsFrame(string message, int64_t frame_requested, int64_t max_frames) + OutOfBoundsFrame(std::string message, int64_t frame_requested, int64_t max_frames) : BaseException(message), FrameRequested(frame_requested), MaxFrames(max_frames) { } - virtual ~OutOfBoundsFrame() throw () {} + virtual ~OutOfBoundsFrame() noexcept {} }; /// Exception for an out of bounds key-frame point. @@ -218,59 +213,59 @@ namespace openshot { public: int PointRequested; int MaxPoints; - OutOfBoundsPoint(string message, int point_requested, int max_points) + OutOfBoundsPoint(std::string message, int point_requested, int max_points) : BaseException(message), PointRequested(point_requested), MaxPoints(max_points) { } - virtual ~OutOfBoundsPoint() throw () {} + virtual ~OutOfBoundsPoint() noexcept {} }; /// Exception when memory could not be allocated class OutOfMemory : public BaseException { public: - string file_path; - OutOfMemory(string message, string file_path) + std::string file_path; + OutOfMemory(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~OutOfMemory() throw () {} + virtual ~OutOfMemory() noexcept {} }; /// Exception when a reader is closed, and a frame is requested class ReaderClosed : public BaseException { public: - string file_path; - ReaderClosed(string message, string file_path) + std::string file_path; + ReaderClosed(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~ReaderClosed() throw () {} + virtual ~ReaderClosed() noexcept {} }; /// Exception when resample fails class ResampleError : public BaseException { public: - string file_path; - ResampleError(string message, string file_path) + std::string file_path; + ResampleError(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~ResampleError() throw () {} + virtual ~ResampleError() noexcept {} }; /// Exception when too many seek attempts happen class TooManySeeks : public BaseException { public: - string file_path; - TooManySeeks(string message, string file_path) + std::string file_path; + TooManySeeks(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~TooManySeeks() throw () {} + virtual ~TooManySeeks() noexcept {} }; /// Exception when a writer is closed, and a frame is requested class WriterClosed : public BaseException { public: - string file_path; - WriterClosed(string message, string file_path) + std::string file_path; + WriterClosed(std::string message, std::string file_path) : BaseException(message), file_path(file_path) { } - virtual ~WriterClosed() throw () {} + virtual ~WriterClosed() noexcept {} }; }