Loading...
Searching...
No Matches
juce_RelativeTime.h
/*
==============================================================================
This file is part of the JUCE library.
Copyright (c) 2022 - Raw Material Software Limited
JUCE is an open source library subject to commercial or open-source
licensing.
The code included in this file is provided under the terms of the ISC license
http://www.isc.org/downloads/software-support-policy/isc-license. Permission
To use, copy, modify, and/or distribute this software for any purpose with or
without fee is hereby granted provided that the above copyright notice and
this permission notice appear in all copies.
JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
DISCLAIMED.
==============================================================================
*/
namespace juce
{
//==============================================================================
class JUCE_API RelativeTime
{
public:
//==============================================================================
explicit RelativeTime (double seconds = 0.0) noexcept;
RelativeTime (const RelativeTime& other) noexcept;
RelativeTime& operator= (const RelativeTime& other) noexcept;
~RelativeTime() noexcept;
//==============================================================================
static RelativeTime milliseconds (int milliseconds) noexcept;
static RelativeTime milliseconds (int64 milliseconds) noexcept;
static RelativeTime seconds (double seconds) noexcept;
static RelativeTime minutes (double numberOfMinutes) noexcept;
static RelativeTime hours (double numberOfHours) noexcept;
static RelativeTime days (double numberOfDays) noexcept;
static RelativeTime weeks (double numberOfWeeks) noexcept;
//==============================================================================
int64 inMilliseconds() const noexcept;
double inSeconds() const noexcept { return numSeconds; }
double inMinutes() const noexcept;
double inHours() const noexcept;
double inDays() const noexcept;
double inWeeks() const noexcept;
String getDescription (const String& returnValueForZeroTime = "0") const;
//==============================================================================
String getApproximateDescription() const;
//==============================================================================
RelativeTime operator+= (RelativeTime timeToAdd) noexcept;
RelativeTime operator-= (RelativeTime timeToSubtract) noexcept;
RelativeTime operator+= (double secondsToAdd) noexcept;
RelativeTime operator-= (double secondsToSubtract) noexcept;
private:
//==============================================================================
double numSeconds;
};
//==============================================================================
JUCE_API bool JUCE_CALLTYPE operator== (RelativeTime t1, RelativeTime t2) noexcept;
JUCE_API bool JUCE_CALLTYPE operator!= (RelativeTime t1, RelativeTime t2) noexcept;
JUCE_API bool JUCE_CALLTYPE operator> (RelativeTime t1, RelativeTime t2) noexcept;
JUCE_API bool JUCE_CALLTYPE operator< (RelativeTime t1, RelativeTime t2) noexcept;
JUCE_API bool JUCE_CALLTYPE operator>= (RelativeTime t1, RelativeTime t2) noexcept;
JUCE_API bool JUCE_CALLTYPE operator<= (RelativeTime t1, RelativeTime t2) noexcept;
//==============================================================================
JUCE_API RelativeTime JUCE_CALLTYPE operator+ (RelativeTime t1, RelativeTime t2) noexcept;
JUCE_API RelativeTime JUCE_CALLTYPE operator- (RelativeTime t1, RelativeTime t2) noexcept;
} // namespace juce
juce::RelativeTime
Definition juce_RelativeTime.h:37
juce::RelativeTime::inMilliseconds
int64 inMilliseconds() const noexcept
Definition juce_RelativeTime.cpp:40
juce::RelativeTime::minutes
static RelativeTime minutes(double numberOfMinutes) noexcept
Definition juce_RelativeTime.cpp:34
juce::RelativeTime::milliseconds
static RelativeTime milliseconds(int milliseconds) noexcept
Definition juce_RelativeTime.cpp:31
juce::RelativeTime::inSeconds
double inSeconds() const noexcept
Definition juce_RelativeTime.h:101
juce::RelativeTime::hours
static RelativeTime hours(double numberOfHours) noexcept
Definition juce_RelativeTime.cpp:35
juce::RelativeTime::days
static RelativeTime days(double numberOfDays) noexcept
Definition juce_RelativeTime.cpp:36
juce::RelativeTime::weeks
static RelativeTime weeks(double numberOfWeeks) noexcept
Definition juce_RelativeTime.cpp:37
juce::RelativeTime::seconds
static RelativeTime seconds(double seconds) noexcept
Definition juce_RelativeTime.cpp:33
juce::RelativeTime::RelativeTime
RelativeTime(double seconds=0.0) noexcept
Definition juce_RelativeTime.cpp:26
juce::String
Definition juce_String.h:53