diff --git a/src/Coordinate.h b/src/Coordinate.h index 0a3ba978..f2b8b5fb 100644 --- a/src/Coordinate.h +++ b/src/Coordinate.h @@ -75,6 +75,18 @@ namespace openshot { void SetJsonValue(const Json::Value root); ///< Load Json::Value into this object }; + /// Stream output operator for openshot::Coordinate + template + std::basic_ostream& + operator<<(std::basic_ostream& o, const openshot::Coordinate& co) { + std::basic_ostringstream s; + s.flags(o.flags()); + s.imbue(o.getloc()); + s.precision(o.precision()); + s << "(" << co.X << ", " << co.Y << ")"; + return o << s.str(); + }; + } #endif diff --git a/src/Fraction.h b/src/Fraction.h index fb36e88b..a09db625 100644 --- a/src/Fraction.h +++ b/src/Fraction.h @@ -84,7 +84,16 @@ namespace openshot { Fraction Reciprocal() const; }; - + // Stream output operator for openshot::Fraction + template + std::basic_ostream& + operator<<(std::basic_ostream& o, const openshot::Fraction& frac) { + std::basic_ostringstream s; + s.flags(o.flags()); + s.imbue(o.getloc()); + s.precision(o.precision()); + s << "Fraction(" << frac.num << ", " << frac.den << ")"; + return o << s.str(); + }; } - #endif diff --git a/src/Point.h b/src/Point.h index 1795c469..2602fb9f 100644 --- a/src/Point.h +++ b/src/Point.h @@ -126,6 +126,31 @@ namespace openshot }; + // Stream output operator for openshot::Point + template + std::basic_ostream& + operator<<(std::basic_ostream& o, const openshot::Point& p) { + std::basic_ostringstream s; + s.flags(o.flags()); + s.imbue(o.getloc()); + s.precision(o.precision()); + s << "co" << p.co; + switch(p.interpolation) { + case(openshot::LINEAR): + s << " interpolation(LINEAR)"; + break; + case(openshot::CONSTANT): + s << " interpolation(CONSTANT)"; + break; + case(openshot::BEZIER): + s << " interpolation(BEZIER)" + << " handle_left" << p.handle_left + << " handle_right" << p.handle_right; + break; + } + return o << s.str(); + }; + } #endif