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:
parent
515d19c745
commit
34773ee5c0
@ -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__
|
||||
|
@ -426,3 +426,9 @@ hours_floor( Time& timecode )
|
||||
|
||||
|
||||
} // namespace Timecode
|
||||
|
||||
std::ostream&
|
||||
operator<<(std::ostream& ostr, const Timecode::Time& t)
|
||||
{
|
||||
return t.print (ostr);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user