You've already forked libopenshot
mirror of
https://github.com/OpenShot/libopenshot.git
synced 2026-03-02 08:53:52 -08:00
Add operator<< for Coordinate, Fraction, Point
This commit is contained in:
@@ -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<class charT, class traits>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& o, const openshot::Coordinate& co) {
|
||||
std::basic_ostringstream<charT, traits> s;
|
||||
s.flags(o.flags());
|
||||
s.imbue(o.getloc());
|
||||
s.precision(o.precision());
|
||||
s << "(" << co.X << ", " << co.Y << ")";
|
||||
return o << s.str();
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
@@ -84,7 +84,16 @@ namespace openshot {
|
||||
Fraction Reciprocal() const;
|
||||
};
|
||||
|
||||
|
||||
// Stream output operator for openshot::Fraction
|
||||
template<class charT, class traits>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& o, const openshot::Fraction& frac) {
|
||||
std::basic_ostringstream<charT, traits> s;
|
||||
s.flags(o.flags());
|
||||
s.imbue(o.getloc());
|
||||
s.precision(o.precision());
|
||||
s << "Fraction(" << frac.num << ", " << frac.den << ")";
|
||||
return o << s.str();
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
25
src/Point.h
25
src/Point.h
@@ -126,6 +126,31 @@ namespace openshot
|
||||
|
||||
};
|
||||
|
||||
// Stream output operator for openshot::Point
|
||||
template<class charT, class traits>
|
||||
std::basic_ostream<charT, traits>&
|
||||
operator<<(std::basic_ostream<charT, traits>& o, const openshot::Point& p) {
|
||||
std::basic_ostringstream<charT, traits> 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
|
||||
|
||||
Reference in New Issue
Block a user