Remove .gitignore do nothing is ignored.
[synfig.git] / synfig-core / trunk / src / synfig / time.h
index 86f66e7..5acc15e 100644 (file)
@@ -2,10 +2,11 @@
 /*!    \file time.h
 **     \brief Template Header
 **
-**     $Id: time.h,v 1.1.1.1 2005/01/04 01:23:15 darco Exp $
+**     $Id$
 **
 **     \legal
 **     Copyright (c) 2002-2005 Robert B. Quattlebaum Jr., Adrian Bentley
+**     Copyright (c) 2007 Chris Moore
 **
 **     This package is free software; you can redistribute it and/or
 **     modify it under the terms of the GNU General Public License as
@@ -54,15 +55,16 @@ public:
                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)
+
                FORMAT_END=(1<<4)               //!< \internal Not used
        }; // END of enum Format
 
 private:
        value_type value_;
 
-       static const value_type epsilon_() { return static_cast<value_type>(0.0005); }
+       static value_type epsilon_() { return static_cast<value_type>(0.0005); }
 
 public:
        Time() { }
@@ -75,7 +77,7 @@ public:
 
        //! Constructs Time from the given string.
        /*!     \note If the string references frames, then the
-       **      frame rate (\afps) should be provided from the
+       **      frame rate (\a fps) should be provided from the
        **      correct source. (Which is most likely the RendDesc
        **      of the current Canvas)
        **      The frame count will be ignored if the
@@ -84,30 +86,34 @@ public:
 
        //! Marks the exclusive negative boundary of time
        static const Time begin() { return static_cast<synfig::Time>(-32767.0f*512.0f); }
-       
+
        //! Marks the exclusive positive boundary of time
        static const Time end() { return static_cast<synfig::Time>(32767.0f*512.0f); }
 
        //! Marks zero time
        static const Time zero() { return static_cast<synfig::Time>(0); }
-       
+
        //! The amount of allowable error in calculations
        static const Time epsilon() { return static_cast<synfig::Time>(epsilon_()); }
-       
+
        //! Returns a string describing the current time value
        /*!     \see Format */
        String get_string(float fps=0, Time::Format format=FORMAT_NORMAL)const;
-       
+
+#ifdef _DEBUG
+       const char *c_str()const;
+#endif
+
        //! \writeme
        bool is_valid()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_(); }
-       
+
        operator double()const { return value_; }
 
        template<typename U> bool operator<(const U& rhs)const { return value_<rhs; }
@@ -132,7 +138,7 @@ public:
        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; }
@@ -142,7 +148,7 @@ public:
        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); }
-       
+
        Time operator-()const { return -value_; }
 }; // END of class Time
 
@@ -159,7 +165,7 @@ inline bool operator<=(Time::Format lhs, Time::Format rhs)
 { return (static_cast<int>(lhs) & static_cast<int>(rhs))==static_cast<int>(rhs); }
 
 }; // END of namespace synfig
-       
+
 /* === E N D =============================================================== */
 
 #endif