-** This software and associated documentation
-** are CONFIDENTIAL and PROPRIETARY property of
-** the above-mentioned copyright holder.
+** This package is free software; you can redistribute it and/or
+** modify it under the terms of the GNU General Public License as
+** published by the Free Software Foundation; either version 2 of
+** the License, or (at your option) any later version.
-** You may not copy, print, publish, or in any
-** other way distribute this software without
-** a prior written agreement with
-** the copyright holder.
+** This package is distributed in the hope that it will be useful,
+** but WITHOUT ANY WARRANTY; without even the implied warranty of
+** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+** General Public License for more details.
** \endlegal
*/
/* ========================================================================= */
/* === S T A R T =========================================================== */
** \endlegal
*/
/* ========================================================================= */
/* === S T A R T =========================================================== */
FORMAT_NORMAL=0, //!< Represents the default method of printing the time
FORMAT_NOSPACES=(1<<0), //!< Remove any whitespace
FORMAT_FULL=(1<<1), //!< Do not remove units that have "zero" value
FORMAT_NORMAL=0, //!< Represents the default method of printing the time
FORMAT_NOSPACES=(1<<0), //!< Remove any whitespace
FORMAT_FULL=(1<<1), //!< Do not remove units that have "zero" value
- FORMAT_VIDEO=(1<<2), //!< Use the HH:MM:SS.ff format
-
+ FORMAT_VIDEO=(1<<2), //!< Use the HH:MM:SS.FF format
+ FORMAT_FRAMES=(1<<3), //!< Use the FF format (frames only)
+
//! Constructs Time from the given string.
/*! \note If the string references frames, then the
//! Constructs Time from the given string.
/*! \note If the string references frames, then the
** correct source. (Which is most likely the RendDesc
** of the current Canvas)
** The frame count will be ignored if the
** correct source. (Which is most likely the RendDesc
** of the current Canvas)
** The frame count will be ignored if the
Time(const String &string, float fps=0);
//! Marks the exclusive negative boundary of time
Time(const String &string, float fps=0);
//! Marks the exclusive negative boundary of time
//! Returns a string describing the current time value
/*! \see Format */
String get_string(float fps=0, Time::Format format=FORMAT_NORMAL)const;
//! Returns a string describing the current time value
/*! \see Format */
String get_string(float fps=0, Time::Format format=FORMAT_NORMAL)const;
//! Rounds time to the nearest frame for the given frame rate, \a fps
Time round(float fps)const;
bool is_equal(const Time& rhs)const { return (value_>rhs.value_)?value_-rhs.value_<=epsilon_():rhs.value_-value_<=epsilon_(); }
bool is_less_than(const Time& rhs)const { return rhs.value_-value_ > epsilon_(); }
bool is_more_than(const Time& rhs)const { return value_-rhs.value_ > epsilon_(); }
//! Rounds time to the nearest frame for the given frame rate, \a fps
Time round(float fps)const;
bool is_equal(const Time& rhs)const { return (value_>rhs.value_)?value_-rhs.value_<=epsilon_():rhs.value_-value_<=epsilon_(); }
bool is_less_than(const Time& rhs)const { return rhs.value_-value_ > epsilon_(); }
bool is_more_than(const Time& rhs)const { return value_-rhs.value_ > epsilon_(); }
operator double()const { return value_; }
template<typename U> bool operator<(const U& rhs)const { return value_<rhs; }
operator double()const { return value_; }
template<typename U> bool operator<(const U& rhs)const { return value_<rhs; }
bool operator==(const Time& rhs)const { return is_equal(rhs); }
bool operator!=(const Time& rhs)const { return !is_equal(rhs); }
#endif
bool operator==(const Time& rhs)const { return is_equal(rhs); }
bool operator!=(const Time& rhs)const { return !is_equal(rhs); }
#endif
template<typename U> const Time& operator+=(const U &rhs) { value_+=static_cast<value_type>(rhs); return *this; }
template<typename U> const Time& operator-=(const U &rhs) { value_-=static_cast<value_type>(rhs); return *this; }
template<typename U> const Time& operator*=(const U &rhs) { value_*=static_cast<value_type>(rhs); return *this; }
template<typename U> const Time& operator+=(const U &rhs) { value_+=static_cast<value_type>(rhs); return *this; }
template<typename U> const Time& operator-=(const U &rhs) { value_-=static_cast<value_type>(rhs); return *this; }
template<typename U> const Time& operator*=(const U &rhs) { value_*=static_cast<value_type>(rhs); return *this; }
template<typename U> Time operator-(const U &rhs)const { return value_-static_cast<value_type>(rhs); }
template<typename U> Time operator*(const U &rhs)const { return value_*static_cast<value_type>(rhs); }
template<typename U> Time operator/(const U &rhs)const { return value_/static_cast<value_type>(rhs); }
template<typename U> Time operator-(const U &rhs)const { return value_-static_cast<value_type>(rhs); }
template<typename U> Time operator*(const U &rhs)const { return value_*static_cast<value_type>(rhs); }
template<typename U> Time operator/(const U &rhs)const { return value_/static_cast<value_type>(rhs); }
inline bool operator<=(Time::Format lhs, Time::Format rhs)
{ return (static_cast<int>(lhs) & static_cast<int>(rhs))==static_cast<int>(rhs); }
inline bool operator<=(Time::Format lhs, Time::Format rhs)
{ return (static_cast<int>(lhs) & static_cast<int>(rhs))==static_cast<int>(rhs); }