From 3879b0904700aff8fe511653b8011336a0a36cb3 Mon Sep 17 00:00:00 2001 From: "FeRD (Frank Dana)" Date: Sun, 4 Aug 2019 22:54:06 -0400 Subject: [PATCH] FrameMapper/KeyFrame/Point: std:: prefixes --- include/FrameMapper.h | 13 +++++-------- include/KeyFrame.h | 11 ++++------- include/Point.h | 6 ++---- src/FrameMapper.cpp | 8 ++++---- src/KeyFrame.cpp | 28 ++++++++++++++-------------- src/Point.cpp | 6 +++--- 6 files changed, 32 insertions(+), 40 deletions(-) diff --git a/include/FrameMapper.h b/include/FrameMapper.h index 78e8944e..f2b030a3 100644 --- a/include/FrameMapper.h +++ b/include/FrameMapper.h @@ -49,9 +49,6 @@ #include "OpenMPUtilities.h" - -using namespace std; - namespace openshot { /** @@ -166,8 +163,8 @@ namespace openshot public: // Init some containers - vector fields; // List of all fields - vector frames; // List of all frames + std::vector fields; // List of all fields + std::vector frames; // List of all frames /// Default constructor for openshot::FrameMapper class FrameMapper(ReaderBase *reader, Fraction target_fps, PulldownType target_pulldown, int target_sample_rate, int target_channels, ChannelLayout target_channel_layout); @@ -199,11 +196,11 @@ namespace openshot bool IsOpen(); /// Return the type name of the class - string Name() { return "FrameMapper"; }; + std::string Name() { return "FrameMapper"; }; /// Get and Set JSON methods - string Json(); ///< Generate JSON string of this object - void SetJson(string value); ///< Load JSON string into this object + std::string Json(); ///< Generate JSON string of this object + void SetJson(std::string value); ///< Load JSON string into this object Json::Value JsonValue(); ///< Generate Json::JsonValue for this object void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object diff --git a/include/KeyFrame.h b/include/KeyFrame.h index 14f519a1..af8a9f3e 100644 --- a/include/KeyFrame.h +++ b/include/KeyFrame.h @@ -42,9 +42,6 @@ #include "Point.h" #include "Json.h" -using namespace std; -using namespace openshot; - namespace openshot { /** @@ -92,8 +89,8 @@ namespace openshot { double Bernstein(int64_t n, int64_t i, double t); public: - vector Points; ///< Vector of all Points - vector Values; ///< Vector of all Values (i.e. the processed coordinates from the curve) + std::vector Points; ///< Vector of all Points + std::vector Values; ///< Vector of all Values (i.e. the processed coordinates from the curve) /// Default constructor for the Keyframe class Keyframe(); @@ -160,9 +157,9 @@ namespace openshot { bool IsIncreasing(int index); /// Get and Set JSON methods - string Json(); ///< Generate JSON string of this object + std::string Json(); ///< Generate JSON string of this object Json::Value JsonValue(); ///< Generate Json::JsonValue for this object - void SetJson(string value); ///< Load JSON string into this object + void SetJson(std::string value); ///< Load JSON string into this object void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object /** diff --git a/include/Point.h b/include/Point.h index d9a5e33d..3fdcd917 100644 --- a/include/Point.h +++ b/include/Point.h @@ -35,8 +35,6 @@ #include "Exceptions.h" #include "Json.h" -using namespace std; - namespace openshot { /** @@ -121,9 +119,9 @@ namespace openshot void Initialize_RightHandle(float x, float y); /// Get and Set JSON methods - string Json(); ///< Generate JSON string of this object + std::string Json(); ///< Generate JSON string of this object Json::Value JsonValue(); ///< Generate Json::JsonValue for this object - void SetJson(string value); ///< Load JSON string into this object + void SetJson(std::string value); ///< Load JSON string into this object void SetJsonValue(Json::Value root); ///< Load Json::JsonValue into this object }; diff --git a/src/FrameMapper.cpp b/src/FrameMapper.cpp index ff7cf1ce..df8d37b1 100644 --- a/src/FrameMapper.cpp +++ b/src/FrameMapper.cpp @@ -675,7 +675,7 @@ void FrameMapper::Close() // Generate JSON string of this object -string FrameMapper::Json() { +std::string FrameMapper::Json() { // Return formatted string return JsonValue().toStyledString(); @@ -693,14 +693,14 @@ Json::Value FrameMapper::JsonValue() { } // Load JSON string into this object -void FrameMapper::SetJson(string value) { +void FrameMapper::SetJson(std::string value) { // Parse JSON string into JSON objects Json::Value root; Json::CharReaderBuilder rbuilder; Json::CharReader* reader(rbuilder.newCharReader()); - string errors; + std::string errors; bool success = reader->parse( value.c_str(), value.c_str() + value.size(), &root, &errors ); delete reader; @@ -820,7 +820,7 @@ void FrameMapper::ResampleMappedAudio(std::shared_ptr frame, int64_t orig if (error_code < 0) { - ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::ResampleMappedAudio ERROR [" + (string)av_err2str(error_code) + "]", "error_code", error_code); + ZmqLogger::Instance()->AppendDebugMethod("FrameMapper::ResampleMappedAudio ERROR [" + (std::string)av_err2str(error_code) + "]", "error_code", error_code); throw ErrorEncodingVideo("Error while resampling audio in frame mapper", frame->number); } diff --git a/src/KeyFrame.cpp b/src/KeyFrame.cpp index 94618135..895104d7 100644 --- a/src/KeyFrame.cpp +++ b/src/KeyFrame.cpp @@ -307,7 +307,7 @@ bool Keyframe::IsIncreasing(int index) int64_t next_repeats = 0; // Loop backwards and look for the next unique value - for (vector::iterator backwards_it = Values.begin() + index; backwards_it != Values.begin(); backwards_it--) { + for (std::vector::iterator backwards_it = Values.begin() + index; backwards_it != Values.begin(); backwards_it--) { previous_value = long(round((*backwards_it).Y)); if (previous_value == current_value) { // Found same value @@ -319,7 +319,7 @@ bool Keyframe::IsIncreasing(int index) } // Loop forwards and look for the next unique value - for (vector::iterator forwards_it = Values.begin() + (index + 1); forwards_it != Values.end(); forwards_it++) { + for (std::vector::iterator forwards_it = Values.begin() + (index + 1); forwards_it != Values.end(); forwards_it++) { next_value = long(round((*forwards_it).Y)); if (next_value == current_value) { // Found same value @@ -340,7 +340,7 @@ bool Keyframe::IsIncreasing(int index) } // Generate JSON string of this object -string Keyframe::Json() { +std::string Keyframe::Json() { // Return formatted string return JsonValue().toStyledString(); @@ -365,14 +365,14 @@ Json::Value Keyframe::JsonValue() { } // Load JSON string into this object -void Keyframe::SetJson(string value) { +void Keyframe::SetJson(std::string value) { // Parse JSON string into JSON objects Json::Value root; Json::CharReaderBuilder rbuilder; Json::CharReader* reader(rbuilder.newCharReader()); - string errors; + std::string errors; bool success = reader->parse( value.c_str(), value.c_str() + value.size(), &root, &errors ); delete reader; @@ -436,7 +436,7 @@ Fraction Keyframe::GetRepeatFraction(int64_t index) int64_t next_repeats = 0; // Loop backwards and look for the next unique value - for (vector::iterator backwards_it = Values.begin() + index; backwards_it != Values.begin(); backwards_it--) { + for (std::vector::iterator backwards_it = Values.begin() + index; backwards_it != Values.begin(); backwards_it--) { previous_value = long(round((*backwards_it).Y)); if (previous_value == current_value) { // Found same value @@ -448,7 +448,7 @@ Fraction Keyframe::GetRepeatFraction(int64_t index) } // Loop forwards and look for the next unique value - for (vector::iterator forwards_it = Values.begin() + (index + 1); forwards_it != Values.end(); forwards_it++) { + for (std::vector::iterator forwards_it = Values.begin() + (index + 1); forwards_it != Values.end(); forwards_it++) { next_value = long(round((*forwards_it).Y)); if (next_value == current_value) { // Found same value @@ -483,7 +483,7 @@ double Keyframe::GetDelta(int64_t index) int64_t next_repeats = 0; // Loop backwards and look for the next unique value - for (vector::iterator backwards_it = Values.begin() + index; backwards_it != Values.begin(); backwards_it--) { + for (std::vector::iterator backwards_it = Values.begin() + index; backwards_it != Values.begin(); backwards_it--) { previous_value = long(round((*backwards_it).Y)); if (previous_value == current_value) { // Found same value @@ -495,7 +495,7 @@ double Keyframe::GetDelta(int64_t index) } // Loop forwards and look for the next unique value - for (vector::iterator forwards_it = Values.begin() + (index + 1); forwards_it != Values.end(); forwards_it++) { + for (std::vector::iterator forwards_it = Values.begin() + (index + 1); forwards_it != Values.end(); forwards_it++) { next_value = long(round((*forwards_it).Y)); if (next_value == current_value) { // Found same value @@ -605,7 +605,7 @@ void Keyframe::PrintPoints() { Process(); cout << fixed << setprecision(4); - for (vector::iterator it = Points.begin(); it != Points.end(); it++) { + for (std::vector::iterator it = Points.begin(); it != Points.end(); it++) { Point p = *it; cout << p.co.X << "\t" << p.co.Y << endl; } @@ -619,7 +619,7 @@ void Keyframe::PrintValues() { cout << fixed << setprecision(4); cout << "Frame Number (X)\tValue (Y)\tIs Increasing\tRepeat Numerator\tRepeat Denominator\tDelta (Y Difference)" << endl; - for (vector::iterator it = Values.begin() + 1; it != Values.end(); it++) { + for (std::vector::iterator it = Values.begin() + 1; it != Values.end(); it++) { Coordinate c = *it; cout << long(round(c.X)) << "\t" << c.Y << "\t" << IsIncreasing(c.X) << "\t" << GetRepeatFraction(c.X).num << "\t" << GetRepeatFraction(c.X).den << "\t" << GetDelta(c.X) << endl; } @@ -722,13 +722,13 @@ void Keyframe::ProcessSegment(int Segment, Point p1, Point p2) { double X_diff = p2.co.X - p1.co.X; double Y_diff = p2.co.Y - p1.co.Y; - vector segment_coordinates; + std::vector segment_coordinates; segment_coordinates.push_back(p1.co); segment_coordinates.push_back(Coordinate(p1.co.X + (p1.handle_right.X * X_diff), p1.co.Y + (p1.handle_right.Y * Y_diff))); segment_coordinates.push_back(Coordinate(p1.co.X + (p2.handle_left.X * X_diff), p1.co.Y + (p2.handle_left.Y * Y_diff))); segment_coordinates.push_back(p2.co); - vector raw_coordinates; + std::vector raw_coordinates; int64_t npts = segment_coordinates.size(); int64_t icount, jcount; double step, t; @@ -904,7 +904,7 @@ void Keyframe::ScalePoints(double scale) void Keyframe::FlipPoints() { // Loop through each point - vector FlippedPoints; + std::vector FlippedPoints; for (int64_t point_index = 0, reverse_index = Points.size() - 1; point_index < Points.size(); point_index++, reverse_index--) { // Flip the points Point p = Points[point_index]; diff --git a/src/Point.cpp b/src/Point.cpp index fd23da55..0ff340d3 100644 --- a/src/Point.cpp +++ b/src/Point.cpp @@ -108,7 +108,7 @@ void Point::Initialize_RightHandle(float x, float y) { } // Generate JSON string of this object -string Point::Json() { +std::string Point::Json() { // Return formatted string return JsonValue().toStyledString(); @@ -132,14 +132,14 @@ Json::Value Point::JsonValue() { } // Load JSON string into this object -void Point::SetJson(string value) { +void Point::SetJson(std::string value) { // Parse JSON string into JSON objects Json::Value root; Json::CharReaderBuilder rbuilder; Json::CharReader* reader(rbuilder.newCharReader()); - string errors; + std::string errors; bool success = reader->parse( value.c_str(), value.c_str() + value.size(), &root, &errors ); delete reader;