provide operator<< for Timecode::Time

git-svn-id: svn://localhost/ardour2/branches/3.0@6208 d708f5d6-7413-0410-9779-e7cbd77b26cf
This commit is contained in:
Paul Davis 2009-11-29 22:06:51 +00:00
parent 515d19c745
commit 34773ee5c0
2 changed files with 18 additions and 0 deletions

View File

@ -19,6 +19,7 @@
#ifndef __ardour_timecode_h__
#define __ardour_timecode_h__
#include <ostream>
#include <inttypes.h>
namespace Timecode {
@ -51,6 +52,15 @@ struct Time {
subframes = 0;
rate = a_rate;
}
std::ostream& print (std::ostream& ostr) const {
if (negative) {
ostr << '-';
}
ostr << hours << ':' << minutes << ':' << seconds << ':' << frames << '.' << subframes << " @" << rate << (drop ? " drop" : " nondrop");
return ostr;
}
};
Wrap increment( Time& timecode, uint32_t );
@ -67,4 +77,6 @@ void hours_floor( Time& timecode );
} // namespace Timecode
std::ostream& operator<<(std::ostream& ostr, const Timecode::Time& t);
#endif // __ardour_timecode_h__

View File

@ -426,3 +426,9 @@ hours_floor( Time& timecode )
} // namespace Timecode
std::ostream&
operator<<(std::ostream& ostr, const Timecode::Time& t)
{
return t.print (ostr);
}