openshot-audio  0.1.4
juce_RelativeTime.h
Go to the documentation of this file.
1 /*
2  ==============================================================================
3 
4  This file is part of the juce_core module of the JUCE library.
5  Copyright (c) 2015 - ROLI Ltd.
6 
7  Permission to use, copy, modify, and/or distribute this software for any purpose with
8  or without fee is hereby granted, provided that the above copyright notice and this
9  permission notice appear in all copies.
10 
11  THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD
12  TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN
13  NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
14  DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
15  IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN
16  CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 
18  ------------------------------------------------------------------------------
19 
20  NOTE! This permissive ISC license applies ONLY to files within the juce_core module!
21  All other JUCE modules are covered by a dual GPL/commercial license, so if you are
22  using any other modules, be sure to check that you also comply with their license.
23 
24  For more details, visit www.juce.com
25 
26  ==============================================================================
27 */
28 
29 #ifndef JUCE_RELATIVETIME_H_INCLUDED
30 #define JUCE_RELATIVETIME_H_INCLUDED
31 
32 
33 //==============================================================================
42 {
43 public:
44  //==============================================================================
50  explicit RelativeTime (double seconds = 0.0) noexcept;
51 
53  RelativeTime (const RelativeTime& other) noexcept;
54 
56  RelativeTime& operator= (const RelativeTime& other) noexcept;
57 
60 
61  //==============================================================================
65  static RelativeTime milliseconds (int milliseconds) noexcept;
66 
70  static RelativeTime milliseconds (int64 milliseconds) noexcept;
71 
75  static RelativeTime seconds (double seconds) noexcept;
76 
80  static RelativeTime minutes (double numberOfMinutes) noexcept;
81 
85  static RelativeTime hours (double numberOfHours) noexcept;
86 
90  static RelativeTime days (double numberOfDays) noexcept;
91 
95  static RelativeTime weeks (double numberOfWeeks) noexcept;
96 
97  //==============================================================================
101  int64 inMilliseconds() const noexcept;
102 
106  double inSeconds() const noexcept { return numSeconds; }
107 
111  double inMinutes() const noexcept;
112 
116  double inHours() const noexcept;
117 
121  double inDays() const noexcept;
122 
126  double inWeeks() const noexcept;
127 
143  String getDescription (const String& returnValueForZeroTime = "0") const;
144 
145 
146  //==============================================================================
148  RelativeTime operator+= (RelativeTime timeToAdd) noexcept;
150  RelativeTime operator-= (RelativeTime timeToSubtract) noexcept;
151 
153  RelativeTime operator+= (double secondsToAdd) noexcept;
155  RelativeTime operator-= (double secondsToSubtract) noexcept;
156 
157 private:
158  //==============================================================================
159  double numSeconds;
160 };
161 
162 //==============================================================================
175 
176 //==============================================================================
181 
182 
183 
184 #endif // JUCE_RELATIVETIME_H_INCLUDED
bool operator!=(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:61
bool operator>(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:62
#define noexcept
Definition: juce_CompilerSupport.h:141
bool operator>=(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:64
bool operator<=(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:65
Definition: juce_RelativeTime.h:41
Definition: juce_String.h:43
double inSeconds() const noexcept
Definition: juce_RelativeTime.h:106
#define JUCE_API
Definition: juce_StandardHeader.h:139
RelativeTime operator+(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:57
long long int64
Definition: juce_MathsFunctions.h:60
bool operator==(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:60
RelativeTime operator-(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:58
bool operator<(RelativeTime t1, RelativeTime t2) noexcept
Definition: juce_RelativeTime.cpp:63