mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Build: Replace JUCE_NODISCARD with [[nodiscard]]
This commit is contained in:
parent
045214c986
commit
8b8ae10059
20 changed files with 167 additions and 167 deletions
|
|
@ -185,7 +185,7 @@ public:
|
|||
findPanel = (1 << 2)
|
||||
};
|
||||
|
||||
JUCE_NODISCARD AdditionalComponents with (Type t)
|
||||
[[nodiscard]] AdditionalComponents with (Type t)
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.componentTypes |= t;
|
||||
|
|
|
|||
|
|
@ -102,13 +102,13 @@ public:
|
|||
double getEffectiveRate() const { return pulldown ? (double) base / 1.001 : (double) base; }
|
||||
|
||||
/** Returns a copy of this object with the specified base rate. */
|
||||
JUCE_NODISCARD FrameRate withBaseRate (int x) const { return with (&FrameRate::base, x); }
|
||||
[[nodiscard]] FrameRate withBaseRate (int x) const { return with (&FrameRate::base, x); }
|
||||
|
||||
/** Returns a copy of this object with drop frames enabled or disabled, as specified. */
|
||||
JUCE_NODISCARD FrameRate withDrop (bool x = true) const { return with (&FrameRate::drop, x); }
|
||||
[[nodiscard]] FrameRate withDrop (bool x = true) const { return with (&FrameRate::drop, x); }
|
||||
|
||||
/** Returns a copy of this object with pulldown enabled or disabled, as specified. */
|
||||
JUCE_NODISCARD FrameRate withPullDown (bool x = true) const { return with (&FrameRate::pulldown, x); }
|
||||
[[nodiscard]] FrameRate withPullDown (bool x = true) const { return with (&FrameRate::pulldown, x); }
|
||||
|
||||
/** Returns true if this instance is equal to other. */
|
||||
bool operator== (const FrameRate& other) const
|
||||
|
|
|
|||
|
|
@ -1361,8 +1361,8 @@ protected:
|
|||
|
||||
void addBus (bool isInput, const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true);
|
||||
|
||||
JUCE_NODISCARD BusesProperties withInput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
JUCE_NODISCARD BusesProperties withOutput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
[[nodiscard]] BusesProperties withInput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
[[nodiscard]] BusesProperties withOutput (const String& name, const AudioChannelSet& defaultLayout, bool isActivatedByDefault = true) const;
|
||||
};
|
||||
|
||||
/** Callback to query if adding/removing buses currently possible.
|
||||
|
|
|
|||
|
|
@ -78,7 +78,7 @@ public:
|
|||
|
||||
@see latencyChanged
|
||||
*/
|
||||
JUCE_NODISCARD ChangeDetails withLatencyChanged (bool b) const noexcept { return with (&ChangeDetails::latencyChanged, b); }
|
||||
[[nodiscard]] ChangeDetails withLatencyChanged (bool b) const noexcept { return with (&ChangeDetails::latencyChanged, b); }
|
||||
|
||||
/** Indicates that some attributes of the AudioProcessor's parameters have changed.
|
||||
|
||||
|
|
@ -88,7 +88,7 @@ public:
|
|||
|
||||
@see parameterInfoChanged
|
||||
*/
|
||||
JUCE_NODISCARD ChangeDetails withParameterInfoChanged (bool b) const noexcept { return with (&ChangeDetails::parameterInfoChanged, b); }
|
||||
[[nodiscard]] ChangeDetails withParameterInfoChanged (bool b) const noexcept { return with (&ChangeDetails::parameterInfoChanged, b); }
|
||||
|
||||
/** Indicates that the loaded program has changed.
|
||||
|
||||
|
|
@ -97,7 +97,7 @@ public:
|
|||
|
||||
@see programChanged
|
||||
*/
|
||||
JUCE_NODISCARD ChangeDetails withProgramChanged (bool b) const noexcept { return with (&ChangeDetails::programChanged, b); }
|
||||
[[nodiscard]] ChangeDetails withProgramChanged (bool b) const noexcept { return with (&ChangeDetails::programChanged, b); }
|
||||
|
||||
/** Indicates that the plugin state has changed (but not its parameters!).
|
||||
|
||||
|
|
@ -110,7 +110,7 @@ public:
|
|||
|
||||
@see nonParameterStateChanged
|
||||
*/
|
||||
JUCE_NODISCARD ChangeDetails withNonParameterStateChanged (bool b) const noexcept { return with (&ChangeDetails::nonParameterStateChanged, b); }
|
||||
[[nodiscard]] ChangeDetails withNonParameterStateChanged (bool b) const noexcept { return with (&ChangeDetails::nonParameterStateChanged, b); }
|
||||
|
||||
/** Returns the default set of flags that will be used when
|
||||
AudioProcessor::updateHostDisplay() is called with no arguments.
|
||||
|
|
|
|||
|
|
@ -71,34 +71,34 @@ public:
|
|||
using Category = AudioProcessorParameter::Category;
|
||||
|
||||
/** An optional label for the parameter's value */
|
||||
JUCE_NODISCARD auto withLabel (String x) const { return withMember (*this, &This::label, std::move (x)); }
|
||||
[[nodiscard]] auto withLabel (String x) const { return withMember (*this, &This::label, std::move (x)); }
|
||||
|
||||
/** The semantics of this parameter */
|
||||
JUCE_NODISCARD auto withCategory (Category x) const { return withMember (*this, &This::category, std::move (x)); }
|
||||
[[nodiscard]] auto withCategory (Category x) const { return withMember (*this, &This::category, std::move (x)); }
|
||||
|
||||
/** @see AudioProcessorParameter::isMetaParameter() */
|
||||
JUCE_NODISCARD auto withMeta (bool x) const { return withMember (*this, &This::meta, std::move (x)); }
|
||||
[[nodiscard]] auto withMeta (bool x) const { return withMember (*this, &This::meta, std::move (x)); }
|
||||
|
||||
/** @see AudioProcessorParameter::isAutomatable() */
|
||||
JUCE_NODISCARD auto withAutomatable (bool x) const { return withMember (*this, &This::automatable, std::move (x)); }
|
||||
[[nodiscard]] auto withAutomatable (bool x) const { return withMember (*this, &This::automatable, std::move (x)); }
|
||||
|
||||
/** @see AudioProcessorParameter::isOrientationInverted() */
|
||||
JUCE_NODISCARD auto withInverted (bool x) const { return withMember (*this, &This::inverted, std::move (x)); }
|
||||
[[nodiscard]] auto withInverted (bool x) const { return withMember (*this, &This::inverted, std::move (x)); }
|
||||
|
||||
/** An optional label for the parameter's value */
|
||||
JUCE_NODISCARD auto getLabel() const { return label; }
|
||||
[[nodiscard]] auto getLabel() const { return label; }
|
||||
|
||||
/** The semantics of this parameter */
|
||||
JUCE_NODISCARD auto getCategory() const { return category; }
|
||||
[[nodiscard]] auto getCategory() const { return category; }
|
||||
|
||||
/** @see AudioProcessorParameter::isMetaParameter() */
|
||||
JUCE_NODISCARD auto getMeta() const { return meta; }
|
||||
[[nodiscard]] auto getMeta() const { return meta; }
|
||||
|
||||
/** @see AudioProcessorParameter::isAutomatable() */
|
||||
JUCE_NODISCARD auto getAutomatable() const { return automatable; }
|
||||
[[nodiscard]] auto getAutomatable() const { return automatable; }
|
||||
|
||||
/** @see AudioProcessorParameter::isOrientationInverted() */
|
||||
JUCE_NODISCARD auto getInverted() const { return inverted; }
|
||||
[[nodiscard]] auto getInverted() const { return inverted; }
|
||||
|
||||
private:
|
||||
String label;
|
||||
|
|
|
|||
|
|
@ -42,38 +42,38 @@ class AudioProcessorValueTreeStateParameterAttributes
|
|||
|
||||
public:
|
||||
/** @see RangedAudioParameterAttributes::withStringFromValueFunction() */
|
||||
JUCE_NODISCARD auto withStringFromValueFunction (StringFromValue x) const { return withMember (*this, &This::attributes, attributes.withStringFromValueFunction (std::move (x))); }
|
||||
[[nodiscard]] auto withStringFromValueFunction (StringFromValue x) const { return withMember (*this, &This::attributes, attributes.withStringFromValueFunction (std::move (x))); }
|
||||
/** @see RangedAudioParameterAttributes::withValueFromStringFunction() */
|
||||
JUCE_NODISCARD auto withValueFromStringFunction (ValueFromString x) const { return withMember (*this, &This::attributes, attributes.withValueFromStringFunction (std::move (x))); }
|
||||
[[nodiscard]] auto withValueFromStringFunction (ValueFromString x) const { return withMember (*this, &This::attributes, attributes.withValueFromStringFunction (std::move (x))); }
|
||||
/** @see RangedAudioParameterAttributes::withLabel() */
|
||||
JUCE_NODISCARD auto withLabel (String x) const { return withMember (*this, &This::attributes, attributes.withLabel (std::move (x))); }
|
||||
[[nodiscard]] auto withLabel (String x) const { return withMember (*this, &This::attributes, attributes.withLabel (std::move (x))); }
|
||||
/** @see RangedAudioParameterAttributes::withCategory() */
|
||||
JUCE_NODISCARD auto withCategory (Category x) const { return withMember (*this, &This::attributes, attributes.withCategory (std::move (x))); }
|
||||
[[nodiscard]] auto withCategory (Category x) const { return withMember (*this, &This::attributes, attributes.withCategory (std::move (x))); }
|
||||
/** @see RangedAudioParameterAttributes::withMeta() */
|
||||
JUCE_NODISCARD auto withMeta (bool x) const { return withMember (*this, &This::attributes, attributes.withMeta (std::move (x))); }
|
||||
[[nodiscard]] auto withMeta (bool x) const { return withMember (*this, &This::attributes, attributes.withMeta (std::move (x))); }
|
||||
/** @see RangedAudioParameterAttributes::withAutomatable() */
|
||||
JUCE_NODISCARD auto withAutomatable (bool x) const { return withMember (*this, &This::attributes, attributes.withAutomatable (std::move (x))); }
|
||||
[[nodiscard]] auto withAutomatable (bool x) const { return withMember (*this, &This::attributes, attributes.withAutomatable (std::move (x))); }
|
||||
/** @see RangedAudioParameterAttributes::withInverted() */
|
||||
JUCE_NODISCARD auto withInverted (bool x) const { return withMember (*this, &This::attributes, attributes.withInverted (std::move (x))); }
|
||||
[[nodiscard]] auto withInverted (bool x) const { return withMember (*this, &This::attributes, attributes.withInverted (std::move (x))); }
|
||||
|
||||
/** Pass 'true' if this parameter has discrete steps, or 'false' if the parameter is continuous.
|
||||
|
||||
Using an AudioParameterChoice or AudioParameterInt might be a better choice than setting this flag.
|
||||
*/
|
||||
JUCE_NODISCARD auto withDiscrete (bool x) const { return withMember (*this, &This::discrete, std::move (x)); }
|
||||
[[nodiscard]] auto withDiscrete (bool x) const { return withMember (*this, &This::discrete, std::move (x)); }
|
||||
|
||||
/** Pass 'true' if this parameter only has two valid states.
|
||||
|
||||
Using an AudioParameterBool might be a better choice than setting this flag.
|
||||
*/
|
||||
JUCE_NODISCARD auto withBoolean (bool x) const { return withMember (*this, &This::boolean, std::move (x)); }
|
||||
[[nodiscard]] auto withBoolean (bool x) const { return withMember (*this, &This::boolean, std::move (x)); }
|
||||
|
||||
/** @returns all attributes that might also apply to an AudioParameterFloat */
|
||||
JUCE_NODISCARD const auto& getAudioParameterFloatAttributes() const { return attributes; }
|
||||
[[nodiscard]] const auto& getAudioParameterFloatAttributes() const { return attributes; }
|
||||
/** @returns 'true' if this parameter has discrete steps, or 'false' if the parameter is continuous. */
|
||||
JUCE_NODISCARD const auto& getDiscrete() const { return discrete; }
|
||||
[[nodiscard]] const auto& getDiscrete() const { return discrete; }
|
||||
/** @returns 'true' if this parameter only has two valid states. */
|
||||
JUCE_NODISCARD const auto& getBoolean() const { return boolean; }
|
||||
[[nodiscard]] const auto& getBoolean() const { return boolean; }
|
||||
|
||||
private:
|
||||
AudioParameterFloatAttributes attributes;
|
||||
|
|
|
|||
|
|
@ -49,34 +49,34 @@ public:
|
|||
using ValueFromString = std::function<Value (const String&)>;
|
||||
|
||||
/** An optional lambda function that converts a non-normalised value to a string with a maximum length. This may be used by hosts to display the parameter's value. */
|
||||
JUCE_NODISCARD auto withStringFromValueFunction (StringFromValue x) const { return withMember (asDerived(), &Derived::stringFromValue, std::move (x)); }
|
||||
[[nodiscard]] auto withStringFromValueFunction (StringFromValue x) const { return withMember (asDerived(), &Derived::stringFromValue, std::move (x)); }
|
||||
|
||||
/** An optional lambda function that parses a string and converts it into a non-normalised value. Some hosts use this to allow users to type in parameter values. */
|
||||
JUCE_NODISCARD auto withValueFromStringFunction (ValueFromString x) const { return withMember (asDerived(), &Derived::valueFromString, std::move (x)); }
|
||||
[[nodiscard]] auto withValueFromStringFunction (ValueFromString x) const { return withMember (asDerived(), &Derived::valueFromString, std::move (x)); }
|
||||
|
||||
/** See AudioProcessorParameterWithIDAttributes::withLabel() */
|
||||
JUCE_NODISCARD auto withLabel (String x) const { return withMember (asDerived(), &Derived::attributes, attributes.withLabel (std::move (x))); }
|
||||
[[nodiscard]] auto withLabel (String x) const { return withMember (asDerived(), &Derived::attributes, attributes.withLabel (std::move (x))); }
|
||||
|
||||
/** See AudioProcessorParameterWithIDAttributes::withCategory() */
|
||||
JUCE_NODISCARD auto withCategory (Category x) const { return withMember (asDerived(), &Derived::attributes, attributes.withCategory (std::move (x))); }
|
||||
[[nodiscard]] auto withCategory (Category x) const { return withMember (asDerived(), &Derived::attributes, attributes.withCategory (std::move (x))); }
|
||||
|
||||
/** See AudioProcessorParameter::isMetaParameter() */
|
||||
JUCE_NODISCARD auto withMeta (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withMeta (std::move (x))); }
|
||||
[[nodiscard]] auto withMeta (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withMeta (std::move (x))); }
|
||||
|
||||
/** See AudioProcessorParameter::isAutomatable() */
|
||||
JUCE_NODISCARD auto withAutomatable (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withAutomatable (std::move (x))); }
|
||||
[[nodiscard]] auto withAutomatable (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withAutomatable (std::move (x))); }
|
||||
|
||||
/** See AudioProcessorParameter::isOrientationInverted() */
|
||||
JUCE_NODISCARD auto withInverted (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withInverted (std::move (x))); }
|
||||
[[nodiscard]] auto withInverted (bool x) const { return withMember (asDerived(), &Derived::attributes, attributes.withInverted (std::move (x))); }
|
||||
|
||||
/** An optional lambda function that converts a non-normalised value to a string with a maximum length. This may be used by hosts to display the parameter's value. */
|
||||
JUCE_NODISCARD const auto& getStringFromValueFunction() const { return stringFromValue; }
|
||||
[[nodiscard]] const auto& getStringFromValueFunction() const { return stringFromValue; }
|
||||
|
||||
/** An optional lambda function that parses a string and converts it into a non-normalised value. Some hosts use this to allow users to type in parameter values. */
|
||||
JUCE_NODISCARD const auto& getValueFromStringFunction() const { return valueFromString; }
|
||||
[[nodiscard]] const auto& getValueFromStringFunction() const { return valueFromString; }
|
||||
|
||||
/** Gets attributes that would also apply to an AudioProcessorParameterWithID */
|
||||
JUCE_NODISCARD const auto& getAudioProcessorParameterWithIDAttributes() const { return attributes; }
|
||||
[[nodiscard]] const auto& getAudioProcessorParameterWithIDAttributes() const { return attributes; }
|
||||
|
||||
private:
|
||||
auto& asDerived() const { return *static_cast<const Derived*> (this); }
|
||||
|
|
|
|||
|
|
@ -63,14 +63,14 @@ public:
|
|||
}
|
||||
|
||||
/** Returns a range with a given start and length. */
|
||||
JUCE_NODISCARD static Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept
|
||||
[[nodiscard]] static Range withStartAndLength (const ValueType startValue, const ValueType length) noexcept
|
||||
{
|
||||
jassert (length >= ValueType());
|
||||
return Range (startValue, startValue + length);
|
||||
}
|
||||
|
||||
/** Returns a range with the specified start position and a length of zero. */
|
||||
JUCE_NODISCARD constexpr static Range emptyRange (const ValueType start) noexcept
|
||||
[[nodiscard]] constexpr static Range emptyRange (const ValueType start) noexcept
|
||||
{
|
||||
return Range (start, start);
|
||||
}
|
||||
|
|
@ -104,13 +104,13 @@ public:
|
|||
If the new start position is higher than the current end of the range, the end point
|
||||
will be pushed along to equal it, returning an empty range at the new position.
|
||||
*/
|
||||
JUCE_NODISCARD constexpr Range withStart (const ValueType newStart) const noexcept
|
||||
[[nodiscard]] constexpr Range withStart (const ValueType newStart) const noexcept
|
||||
{
|
||||
return Range (newStart, jmax (newStart, end));
|
||||
}
|
||||
|
||||
/** Returns a range with the same length as this one, but moved to have the given start position. */
|
||||
JUCE_NODISCARD constexpr Range movedToStartAt (const ValueType newStart) const noexcept
|
||||
[[nodiscard]] constexpr Range movedToStartAt (const ValueType newStart) const noexcept
|
||||
{
|
||||
return Range (newStart, end + (newStart - start));
|
||||
}
|
||||
|
|
@ -130,13 +130,13 @@ public:
|
|||
If the new end position is below the current start of the range, the start point
|
||||
will be pushed back to equal the new end point.
|
||||
*/
|
||||
JUCE_NODISCARD constexpr Range withEnd (const ValueType newEnd) const noexcept
|
||||
[[nodiscard]] constexpr Range withEnd (const ValueType newEnd) const noexcept
|
||||
{
|
||||
return Range (jmin (start, newEnd), newEnd);
|
||||
}
|
||||
|
||||
/** Returns a range with the same length as this one, but moved to have the given end position. */
|
||||
JUCE_NODISCARD constexpr Range movedToEndAt (const ValueType newEnd) const noexcept
|
||||
[[nodiscard]] constexpr Range movedToEndAt (const ValueType newEnd) const noexcept
|
||||
{
|
||||
return Range (start + (newEnd - end), newEnd);
|
||||
}
|
||||
|
|
@ -152,7 +152,7 @@ public:
|
|||
/** Returns a range with the same start as this one, but a different length.
|
||||
Lengths less than zero are treated as zero.
|
||||
*/
|
||||
JUCE_NODISCARD constexpr Range withLength (const ValueType newLength) const noexcept
|
||||
[[nodiscard]] constexpr Range withLength (const ValueType newLength) const noexcept
|
||||
{
|
||||
return Range (start, start + newLength);
|
||||
}
|
||||
|
|
@ -161,7 +161,7 @@ public:
|
|||
given amount.
|
||||
@returns The returned range will be (start - amount, end + amount)
|
||||
*/
|
||||
JUCE_NODISCARD constexpr Range expanded (ValueType amount) const noexcept
|
||||
[[nodiscard]] constexpr Range expanded (ValueType amount) const noexcept
|
||||
{
|
||||
return Range (start - amount, end + amount);
|
||||
}
|
||||
|
|
@ -231,21 +231,21 @@ public:
|
|||
|
||||
/** Returns the range that is the intersection of the two ranges, or an empty range
|
||||
with an undefined start position if they don't overlap. */
|
||||
JUCE_NODISCARD constexpr Range getIntersectionWith (Range other) const noexcept
|
||||
[[nodiscard]] constexpr Range getIntersectionWith (Range other) const noexcept
|
||||
{
|
||||
return Range (jmax (start, other.start),
|
||||
jmin (end, other.end));
|
||||
}
|
||||
|
||||
/** Returns the smallest range that contains both this one and the other one. */
|
||||
JUCE_NODISCARD constexpr Range getUnionWith (Range other) const noexcept
|
||||
[[nodiscard]] constexpr Range getUnionWith (Range other) const noexcept
|
||||
{
|
||||
return Range (jmin (start, other.start),
|
||||
jmax (end, other.end));
|
||||
}
|
||||
|
||||
/** Returns the smallest range that contains both this one and the given value. */
|
||||
JUCE_NODISCARD constexpr Range getUnionWith (const ValueType valueToInclude) const noexcept
|
||||
[[nodiscard]] constexpr Range getUnionWith (const ValueType valueToInclude) const noexcept
|
||||
{
|
||||
return Range (jmin (valueToInclude, start),
|
||||
jmax (valueToInclude, end));
|
||||
|
|
|
|||
|
|
@ -144,7 +144,7 @@ public:
|
|||
|
||||
@see withNewSubPath
|
||||
*/
|
||||
JUCE_NODISCARD URL withNewDomainAndPath (const String& newFullPath) const;
|
||||
[[nodiscard]] URL withNewDomainAndPath (const String& newFullPath) const;
|
||||
|
||||
/** Returns a new version of this URL with a different sub-path.
|
||||
|
||||
|
|
@ -153,7 +153,7 @@ public:
|
|||
|
||||
@see withNewDomainAndPath
|
||||
*/
|
||||
JUCE_NODISCARD URL withNewSubPath (const String& newPath) const;
|
||||
[[nodiscard]] URL withNewSubPath (const String& newPath) const;
|
||||
|
||||
/** Attempts to return a URL which is the parent folder containing this URL.
|
||||
|
||||
|
|
@ -186,7 +186,7 @@ public:
|
|||
|
||||
@see getParameterNames, getParameterValues
|
||||
*/
|
||||
JUCE_NODISCARD URL withParameter (const String& parameterName,
|
||||
[[nodiscard]] URL withParameter (const String& parameterName,
|
||||
const String& parameterValue) const;
|
||||
|
||||
/** Returns a copy of this URL, with a set of GET or POST parameters added.
|
||||
|
|
@ -195,7 +195,7 @@ public:
|
|||
|
||||
@see withParameter
|
||||
*/
|
||||
JUCE_NODISCARD URL withParameters (const StringPairArray& parametersToAdd) const;
|
||||
[[nodiscard]] URL withParameters (const StringPairArray& parametersToAdd) const;
|
||||
|
||||
/** Returns a copy of this URL, with a file-upload type parameter added to it.
|
||||
|
||||
|
|
@ -208,7 +208,7 @@ public:
|
|||
|
||||
@see withDataToUpload
|
||||
*/
|
||||
JUCE_NODISCARD URL withFileToUpload (const String& parameterName,
|
||||
[[nodiscard]] URL withFileToUpload (const String& parameterName,
|
||||
const File& fileToUpload,
|
||||
const String& mimeType) const;
|
||||
|
||||
|
|
@ -222,7 +222,7 @@ public:
|
|||
|
||||
@see withFileToUpload
|
||||
*/
|
||||
JUCE_NODISCARD URL withDataToUpload (const String& parameterName,
|
||||
[[nodiscard]] URL withDataToUpload (const String& parameterName,
|
||||
const String& filename,
|
||||
const MemoryBlock& fileContentToUpload,
|
||||
const String& mimeType) const;
|
||||
|
|
@ -261,7 +261,7 @@ public:
|
|||
If no HTTP command is set when calling createInputStream() to read from
|
||||
this URL and some data has been set, it will do a POST request.
|
||||
*/
|
||||
JUCE_NODISCARD URL withPOSTData (const String& postData) const;
|
||||
[[nodiscard]] URL withPOSTData (const String& postData) const;
|
||||
|
||||
/** Returns a copy of this URL, with a block of data to send as the POST data.
|
||||
|
||||
|
|
@ -271,7 +271,7 @@ public:
|
|||
If no HTTP command is set when calling createInputStream() to read from
|
||||
this URL and some data has been set, it will do a POST request.
|
||||
*/
|
||||
JUCE_NODISCARD URL withPOSTData (const MemoryBlock& postData) const;
|
||||
[[nodiscard]] URL withPOSTData (const MemoryBlock& postData) const;
|
||||
|
||||
/** Returns the data that was set using withPOSTData(). */
|
||||
String getPostData() const { return postData.toString(); }
|
||||
|
|
@ -334,36 +334,36 @@ public:
|
|||
|
||||
This can be useful for lengthy POST operations, so that you can provide user feedback.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withProgressCallback (std::function<bool (int bytesSent, int totalBytes)> progressCallback) const;
|
||||
[[nodiscard]] InputStreamOptions withProgressCallback (std::function<bool (int bytesSent, int totalBytes)> progressCallback) const;
|
||||
|
||||
/** A string that will be appended onto the headers that are used for the request.
|
||||
|
||||
It must be a valid set of HTML header directives, separated by newlines.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withExtraHeaders (const String& extraHeaders) const;
|
||||
[[nodiscard]] InputStreamOptions withExtraHeaders (const String& extraHeaders) const;
|
||||
|
||||
/** Specifies a timeout for the request in milliseconds.
|
||||
|
||||
If 0, this will use whatever default setting the OS chooses. If a negative
|
||||
number, it will be infinite.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withConnectionTimeoutMs (int connectionTimeoutMs) const;
|
||||
[[nodiscard]] InputStreamOptions withConnectionTimeoutMs (int connectionTimeoutMs) const;
|
||||
|
||||
/** If this is non-null, all the (key, value) pairs received as headers
|
||||
in the response will be stored in this array.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withResponseHeaders (StringPairArray* responseHeaders) const;
|
||||
[[nodiscard]] InputStreamOptions withResponseHeaders (StringPairArray* responseHeaders) const;
|
||||
|
||||
/** If this is non-null, it will get set to the http status code, if one
|
||||
is known, or 0 if a code isn't available.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withStatusCode (int* statusCode) const;
|
||||
[[nodiscard]] InputStreamOptions withStatusCode (int* statusCode) const;
|
||||
|
||||
/** Specifies the number of redirects that will be followed before returning a response.
|
||||
|
||||
N.B. This will be ignored on Android which follows up to 5 redirects.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withNumRedirectsToFollow (int numRedirectsToFollow) const;
|
||||
[[nodiscard]] InputStreamOptions withNumRedirectsToFollow (int numRedirectsToFollow) const;
|
||||
|
||||
/** Specifies which HTTP request command to use.
|
||||
|
||||
|
|
@ -372,7 +372,7 @@ public:
|
|||
via withPOSTData(), withFileToUpload(), or withDataToUpload(). Otherwise it
|
||||
will be GET.
|
||||
*/
|
||||
JUCE_NODISCARD InputStreamOptions withHttpRequestCmd (const String& httpRequestCmd) const;
|
||||
[[nodiscard]] InputStreamOptions withHttpRequestCmd (const String& httpRequestCmd) const;
|
||||
|
||||
//==============================================================================
|
||||
ParameterHandling getParameterHandling() const noexcept { return parameterHandling; }
|
||||
|
|
@ -456,7 +456,7 @@ public:
|
|||
bool usePost = false;
|
||||
|
||||
/** Specifies headers to add to the request. */
|
||||
JUCE_NODISCARD auto withExtraHeaders (String value) const { return with (&DownloadTaskOptions::extraHeaders, std::move (value)); }
|
||||
[[nodiscard]] auto withExtraHeaders (String value) const { return with (&DownloadTaskOptions::extraHeaders, std::move (value)); }
|
||||
|
||||
/** On iOS, specifies the container where the downloaded file will be stored.
|
||||
|
||||
|
|
@ -465,17 +465,17 @@ public:
|
|||
|
||||
This is currently unused on other platforms.
|
||||
*/
|
||||
JUCE_NODISCARD auto withSharedContainer (String value) const { return with (&DownloadTaskOptions::sharedContainer, std::move (value)); }
|
||||
[[nodiscard]] auto withSharedContainer (String value) const { return with (&DownloadTaskOptions::sharedContainer, std::move (value)); }
|
||||
|
||||
/** Specifies an observer for the download task. */
|
||||
JUCE_NODISCARD auto withListener (DownloadTaskListener* value) const { return with (&DownloadTaskOptions::listener, std::move (value)); }
|
||||
[[nodiscard]] auto withListener (DownloadTaskListener* value) const { return with (&DownloadTaskOptions::listener, std::move (value)); }
|
||||
|
||||
/** Specifies whether a post command should be used. */
|
||||
JUCE_NODISCARD auto withUsePost (bool value) const { return with (&DownloadTaskOptions::usePost, value); }
|
||||
[[nodiscard]] auto withUsePost (bool value) const { return with (&DownloadTaskOptions::usePost, value); }
|
||||
|
||||
private:
|
||||
template <typename Member, typename Value>
|
||||
JUCE_NODISCARD DownloadTaskOptions with (Member&& member, Value&& value) const
|
||||
[[nodiscard]] DownloadTaskOptions with (Member&& member, Value&& value) const
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.*member = std::forward<Value> (value);
|
||||
|
|
|
|||
|
|
@ -144,8 +144,8 @@ public:
|
|||
int lineWrapLength = 60; /**< A maximum line length before wrapping is done. (If newLineChars is nullptr, this is ignored) */
|
||||
const char* newLineChars = "\r\n"; /**< Allows the newline characters to be set. If you set this to nullptr, then the whole XML document will be placed on a single line. */
|
||||
|
||||
JUCE_NODISCARD TextFormat singleLine() const; /**< returns a copy of this format with newLineChars set to nullptr. */
|
||||
JUCE_NODISCARD TextFormat withoutHeader() const; /**< returns a copy of this format with the addDefaultHeader flag set to false. */
|
||||
[[nodiscard]] TextFormat singleLine() const; /**< returns a copy of this format with newLineChars set to nullptr. */
|
||||
[[nodiscard]] TextFormat withoutHeader() const; /**< returns a copy of this format with the addDefaultHeader flag set to false. */
|
||||
};
|
||||
|
||||
/** Returns a text version of this XML element.
|
||||
|
|
|
|||
|
|
@ -299,35 +299,35 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a copy of this colour with a different hue. */
|
||||
JUCE_NODISCARD Colour withHue (float newHue) const noexcept;
|
||||
[[nodiscard]] Colour withHue (float newHue) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different saturation. */
|
||||
JUCE_NODISCARD Colour withSaturation (float newSaturation) const noexcept;
|
||||
[[nodiscard]] Colour withSaturation (float newSaturation) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different saturation in the HSL colour space. */
|
||||
JUCE_NODISCARD Colour withSaturationHSL (float newSaturation) const noexcept;
|
||||
[[nodiscard]] Colour withSaturationHSL (float newSaturation) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different brightness.
|
||||
@see brighter, darker, withMultipliedBrightness
|
||||
*/
|
||||
JUCE_NODISCARD Colour withBrightness (float newBrightness) const noexcept;
|
||||
[[nodiscard]] Colour withBrightness (float newBrightness) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with a different lightness.
|
||||
@see lighter, darker, withMultipliedLightness
|
||||
*/
|
||||
JUCE_NODISCARD Colour withLightness (float newLightness) const noexcept;
|
||||
[[nodiscard]] Colour withLightness (float newLightness) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its hue rotated.
|
||||
The new colour's hue is ((this->getHue() + amountToRotate) % 1.0)
|
||||
@see brighter, darker, withMultipliedBrightness
|
||||
*/
|
||||
JUCE_NODISCARD Colour withRotatedHue (float amountToRotate) const noexcept;
|
||||
[[nodiscard]] Colour withRotatedHue (float amountToRotate) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its saturation multiplied by the given value.
|
||||
The new colour's saturation is (this->getSaturation() * multiplier)
|
||||
(the result is clipped to legal limits).
|
||||
*/
|
||||
JUCE_NODISCARD Colour withMultipliedSaturation (float multiplier) const noexcept;
|
||||
[[nodiscard]] Colour withMultipliedSaturation (float multiplier) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its saturation multiplied by the given value.
|
||||
The new colour's saturation is (this->getSaturation() * multiplier)
|
||||
|
|
@ -335,19 +335,19 @@ public:
|
|||
|
||||
This will be in the HSL colour space.
|
||||
*/
|
||||
JUCE_NODISCARD Colour withMultipliedSaturationHSL (float multiplier) const noexcept;
|
||||
[[nodiscard]] Colour withMultipliedSaturationHSL (float multiplier) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its brightness multiplied by the given value.
|
||||
The new colour's brightness is (this->getBrightness() * multiplier)
|
||||
(the result is clipped to legal limits).
|
||||
*/
|
||||
JUCE_NODISCARD Colour withMultipliedBrightness (float amount) const noexcept;
|
||||
[[nodiscard]] Colour withMultipliedBrightness (float amount) const noexcept;
|
||||
|
||||
/** Returns a copy of this colour with its lightness multiplied by the given value.
|
||||
The new colour's lightness is (this->lightness() * multiplier)
|
||||
(the result is clipped to legal limits).
|
||||
*/
|
||||
JUCE_NODISCARD Colour withMultipliedLightness (float amount) const noexcept;
|
||||
[[nodiscard]] Colour withMultipliedLightness (float amount) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a brighter version of this colour.
|
||||
|
|
@ -355,14 +355,14 @@ public:
|
|||
where 0 is unchanged, and higher values make it brighter
|
||||
@see withMultipliedBrightness
|
||||
*/
|
||||
JUCE_NODISCARD Colour brighter (float amountBrighter = 0.4f) const noexcept;
|
||||
[[nodiscard]] Colour brighter (float amountBrighter = 0.4f) const noexcept;
|
||||
|
||||
/** Returns a darker version of this colour.
|
||||
@param amountDarker how much darker to make it - a value greater than or equal to 0,
|
||||
where 0 is unchanged, and higher values make it darker
|
||||
@see withMultipliedBrightness
|
||||
*/
|
||||
JUCE_NODISCARD Colour darker (float amountDarker = 0.4f) const noexcept;
|
||||
[[nodiscard]] Colour darker (float amountDarker = 0.4f) const noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a colour that will be clearly visible against this colour.
|
||||
|
|
@ -372,7 +372,7 @@ public:
|
|||
that's just a little bit lighter; Colours::black.contrasting (1.0f) will
|
||||
return white; Colours::white.contrasting (1.0f) will return black, etc.
|
||||
*/
|
||||
JUCE_NODISCARD Colour contrasting (float amount = 1.0f) const noexcept;
|
||||
[[nodiscard]] Colour contrasting (float amount = 1.0f) const noexcept;
|
||||
|
||||
/** Returns a colour that is as close as possible to a target colour whilst
|
||||
still being in contrast to this one.
|
||||
|
|
@ -381,20 +381,20 @@ public:
|
|||
nudged up or down so that it differs from the luminosity of this colour
|
||||
by at least the amount specified by minLuminosityDiff.
|
||||
*/
|
||||
JUCE_NODISCARD Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept;
|
||||
[[nodiscard]] Colour contrasting (Colour targetColour, float minLuminosityDiff) const noexcept;
|
||||
|
||||
/** Returns a colour that contrasts against two colours.
|
||||
Looks for a colour that contrasts with both of the colours passed-in.
|
||||
Handy for things like choosing a highlight colour in text editors, etc.
|
||||
*/
|
||||
JUCE_NODISCARD static Colour contrasting (Colour colour1,
|
||||
[[nodiscard]] static Colour contrasting (Colour colour1,
|
||||
Colour colour2) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns an opaque shade of grey.
|
||||
@param brightness the level of grey to return - 0 is black, 1.0 is white
|
||||
*/
|
||||
JUCE_NODISCARD static Colour greyLevel (float brightness) noexcept;
|
||||
[[nodiscard]] static Colour greyLevel (float brightness) noexcept;
|
||||
|
||||
//==============================================================================
|
||||
/** Returns a stringified version of this colour.
|
||||
|
|
@ -403,7 +403,7 @@ public:
|
|||
String toString() const;
|
||||
|
||||
/** Reads the colour from a string that was created with toString(). */
|
||||
JUCE_NODISCARD static Colour fromString (StringRef encodedColourString);
|
||||
[[nodiscard]] static Colour fromString (StringRef encodedColourString);
|
||||
|
||||
/** Returns the colour as a hex string in the form RRGGBB or AARRGGBB. */
|
||||
String toDisplayString (bool includeAlphaValue) const;
|
||||
|
|
|
|||
|
|
@ -154,7 +154,7 @@ public:
|
|||
/** Returns a copy of this font with a new typeface style.
|
||||
@see getAvailableStyles()
|
||||
*/
|
||||
JUCE_NODISCARD Font withTypefaceStyle (const String& newStyle) const;
|
||||
[[nodiscard]] Font withTypefaceStyle (const String& newStyle) const;
|
||||
|
||||
/** Returns a list of the styles that this font can use. */
|
||||
StringArray getAvailableStyles() const;
|
||||
|
|
@ -204,10 +204,10 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a copy of this font with a new height. */
|
||||
JUCE_NODISCARD Font withHeight (float height) const;
|
||||
[[nodiscard]] Font withHeight (float height) const;
|
||||
|
||||
/** Returns a copy of this font with a new height, specified in points. */
|
||||
JUCE_NODISCARD Font withPointHeight (float heightInPoints) const;
|
||||
[[nodiscard]] Font withPointHeight (float heightInPoints) const;
|
||||
|
||||
/** Changes the font's height.
|
||||
@see getHeight, withHeight, setHeightWithoutChangingWidth
|
||||
|
|
@ -271,7 +271,7 @@ public:
|
|||
@param styleFlags a bitwise-or'ed combination of values from the FontStyleFlags enum.
|
||||
@see FontStyleFlags, getStyleFlags
|
||||
*/
|
||||
JUCE_NODISCARD Font withStyle (int styleFlags) const;
|
||||
[[nodiscard]] Font withStyle (int styleFlags) const;
|
||||
|
||||
/** Changes the font's style.
|
||||
@param newFlags a bitwise-or'ed combination of values from the FontStyleFlags enum.
|
||||
|
|
@ -286,7 +286,7 @@ public:
|
|||
/** Returns a copy of this font with the bold attribute set.
|
||||
If the font does not have a bold version, this will return the default font.
|
||||
*/
|
||||
JUCE_NODISCARD Font boldened() const;
|
||||
[[nodiscard]] Font boldened() const;
|
||||
|
||||
/** Returns true if the font is bold. */
|
||||
bool isBold() const noexcept;
|
||||
|
|
@ -294,7 +294,7 @@ public:
|
|||
/** Makes the font italic or non-italic. */
|
||||
void setItalic (bool shouldBeItalic);
|
||||
/** Returns a copy of this font with the italic attribute set. */
|
||||
JUCE_NODISCARD Font italicised() const;
|
||||
[[nodiscard]] Font italicised() const;
|
||||
/** Returns true if the font is italic. */
|
||||
bool isItalic() const noexcept;
|
||||
|
||||
|
|
@ -317,7 +317,7 @@ public:
|
|||
narrower, greater than 1.0 will be stretched out.
|
||||
@see getHorizontalScale
|
||||
*/
|
||||
JUCE_NODISCARD Font withHorizontalScale (float scaleFactor) const;
|
||||
[[nodiscard]] Font withHorizontalScale (float scaleFactor) const;
|
||||
|
||||
/** Changes the font's horizontal scale factor.
|
||||
@param scaleFactor a value of 1.0 is the normal scale, less than this will be
|
||||
|
|
@ -353,7 +353,7 @@ public:
|
|||
normal spacing, positive values spread the letters out,
|
||||
negative values make them closer together.
|
||||
*/
|
||||
JUCE_NODISCARD Font withExtraKerningFactor (float extraKerning) const;
|
||||
[[nodiscard]] Font withExtraKerningFactor (float extraKerning) const;
|
||||
|
||||
/** Changes the font's kerning.
|
||||
@param extraKerning a multiple of the font's height that will be added
|
||||
|
|
|
|||
|
|
@ -217,41 +217,41 @@ public:
|
|||
void setVerticalRange (Range<ValueType> range) noexcept { pos.y = range.getStart(); h = range.getLength(); }
|
||||
|
||||
/** Returns a rectangle which has the same size and y-position as this one, but with a different x-position. */
|
||||
JUCE_NODISCARD Rectangle withX (ValueType newX) const noexcept { return { newX, pos.y, w, h }; }
|
||||
[[nodiscard]] Rectangle withX (ValueType newX) const noexcept { return { newX, pos.y, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same size and x-position as this one, but with a different y-position. */
|
||||
JUCE_NODISCARD Rectangle withY (ValueType newY) const noexcept { return { pos.x, newY, w, h }; }
|
||||
[[nodiscard]] Rectangle withY (ValueType newY) const noexcept { return { pos.x, newY, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same size and y-position as this one, but whose right-hand edge has the given position. */
|
||||
JUCE_NODISCARD Rectangle withRightX (ValueType newRightX) const noexcept { return { newRightX - w, pos.y, w, h }; }
|
||||
[[nodiscard]] Rectangle withRightX (ValueType newRightX) const noexcept { return { newRightX - w, pos.y, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same size and x-position as this one, but whose bottom edge has the given position. */
|
||||
JUCE_NODISCARD Rectangle withBottomY (ValueType newBottomY) const noexcept { return { pos.x, newBottomY - h, w, h }; }
|
||||
[[nodiscard]] Rectangle withBottomY (ValueType newBottomY) const noexcept { return { pos.x, newBottomY - h, w, h }; }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new position. */
|
||||
JUCE_NODISCARD Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return { newX, newY, w, h }; }
|
||||
[[nodiscard]] Rectangle withPosition (ValueType newX, ValueType newY) const noexcept { return { newX, newY, w, h }; }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new position. */
|
||||
JUCE_NODISCARD Rectangle withPosition (Point<ValueType> newPos) const noexcept { return { newPos.x, newPos.y, w, h }; }
|
||||
[[nodiscard]] Rectangle withPosition (Point<ValueType> newPos) const noexcept { return { newPos.x, newPos.y, w, h }; }
|
||||
|
||||
/** Returns a rectangle whose size is the same as this one, but whose top-left position is (0, 0). */
|
||||
JUCE_NODISCARD Rectangle withZeroOrigin() const noexcept { return { w, h }; }
|
||||
[[nodiscard]] Rectangle withZeroOrigin() const noexcept { return { w, h }; }
|
||||
|
||||
/** Returns a rectangle with the same size as this one, but a new centre position. */
|
||||
JUCE_NODISCARD Rectangle withCentre (Point<ValueType> newCentre) const noexcept { return { newCentre.x - w / (ValueType) 2,
|
||||
[[nodiscard]] Rectangle withCentre (Point<ValueType> newCentre) const noexcept { return { newCentre.x - w / (ValueType) 2,
|
||||
newCentre.y - h / (ValueType) 2, w, h }; }
|
||||
|
||||
/** Returns a rectangle which has the same position and height as this one, but with a different width. */
|
||||
JUCE_NODISCARD Rectangle withWidth (ValueType newWidth) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), h }; }
|
||||
[[nodiscard]] Rectangle withWidth (ValueType newWidth) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), h }; }
|
||||
|
||||
/** Returns a rectangle which has the same position and width as this one, but with a different height. */
|
||||
JUCE_NODISCARD Rectangle withHeight (ValueType newHeight) const noexcept { return { pos.x, pos.y, w, jmax (ValueType(), newHeight) }; }
|
||||
[[nodiscard]] Rectangle withHeight (ValueType newHeight) const noexcept { return { pos.x, pos.y, w, jmax (ValueType(), newHeight) }; }
|
||||
|
||||
/** Returns a rectangle with the same top-left position as this one, but a new size. */
|
||||
JUCE_NODISCARD Rectangle withSize (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), jmax (ValueType(), newHeight) }; }
|
||||
[[nodiscard]] Rectangle withSize (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x, pos.y, jmax (ValueType(), newWidth), jmax (ValueType(), newHeight) }; }
|
||||
|
||||
/** Returns a rectangle with the same centre position as this one, but a new size. */
|
||||
JUCE_NODISCARD Rectangle withSizeKeepingCentre (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x + (w - newWidth) / (ValueType) 2,
|
||||
[[nodiscard]] Rectangle withSizeKeepingCentre (ValueType newWidth, ValueType newHeight) const noexcept { return { pos.x + (w - newWidth) / (ValueType) 2,
|
||||
pos.y + (h - newHeight) / (ValueType) 2, newWidth, newHeight }; }
|
||||
|
||||
/** Moves the x position, adjusting the width so that the right-hand edge remains in the same place.
|
||||
|
|
@ -264,7 +264,7 @@ public:
|
|||
If the new x is beyond the right of the current right-hand edge, the width will be set to zero.
|
||||
@see setLeft
|
||||
*/
|
||||
JUCE_NODISCARD Rectangle withLeft (ValueType newLeft) const noexcept { return { newLeft, pos.y, jmax (ValueType(), pos.x + w - newLeft), h }; }
|
||||
[[nodiscard]] Rectangle withLeft (ValueType newLeft) const noexcept { return { newLeft, pos.y, jmax (ValueType(), pos.x + w - newLeft), h }; }
|
||||
|
||||
/** Moves the y position, adjusting the height so that the bottom edge remains in the same place.
|
||||
If the y is moved to be below the current bottom edge, the height will be set to zero.
|
||||
|
|
@ -276,7 +276,7 @@ public:
|
|||
If the new y is beyond the bottom of the current rectangle, the height will be set to zero.
|
||||
@see setTop
|
||||
*/
|
||||
JUCE_NODISCARD Rectangle withTop (ValueType newTop) const noexcept { return { pos.x, newTop, w, jmax (ValueType(), pos.y + h - newTop) }; }
|
||||
[[nodiscard]] Rectangle withTop (ValueType newTop) const noexcept { return { pos.x, newTop, w, jmax (ValueType(), pos.y + h - newTop) }; }
|
||||
|
||||
/** Adjusts the width so that the right-hand edge of the rectangle has this new value.
|
||||
If the new right is below the current X value, the X will be pushed down to match it.
|
||||
|
|
@ -288,7 +288,7 @@ public:
|
|||
If the new right edge is below the current left-hand edge, the width will be set to zero.
|
||||
@see setRight
|
||||
*/
|
||||
JUCE_NODISCARD Rectangle withRight (ValueType newRight) const noexcept { return { jmin (pos.x, newRight), pos.y, jmax (ValueType(), newRight - pos.x), h }; }
|
||||
[[nodiscard]] Rectangle withRight (ValueType newRight) const noexcept { return { jmin (pos.x, newRight), pos.y, jmax (ValueType(), newRight - pos.x), h }; }
|
||||
|
||||
/** Adjusts the height so that the bottom edge of the rectangle has this new value.
|
||||
If the new bottom is lower than the current Y value, the Y will be pushed down to match it.
|
||||
|
|
@ -300,19 +300,19 @@ public:
|
|||
If the new y is beyond the bottom of the current rectangle, the height will be set to zero.
|
||||
@see setBottom
|
||||
*/
|
||||
JUCE_NODISCARD Rectangle withBottom (ValueType newBottom) const noexcept { return { pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y) }; }
|
||||
[[nodiscard]] Rectangle withBottom (ValueType newBottom) const noexcept { return { pos.x, jmin (pos.y, newBottom), w, jmax (ValueType(), newBottom - pos.y) }; }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its left-hand edge. */
|
||||
JUCE_NODISCARD Rectangle withTrimmedLeft (ValueType amountToRemove) const noexcept { return withLeft (pos.x + amountToRemove); }
|
||||
[[nodiscard]] Rectangle withTrimmedLeft (ValueType amountToRemove) const noexcept { return withLeft (pos.x + amountToRemove); }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its right-hand edge. */
|
||||
JUCE_NODISCARD Rectangle withTrimmedRight (ValueType amountToRemove) const noexcept { return withWidth (w - amountToRemove); }
|
||||
[[nodiscard]] Rectangle withTrimmedRight (ValueType amountToRemove) const noexcept { return withWidth (w - amountToRemove); }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its top edge. */
|
||||
JUCE_NODISCARD Rectangle withTrimmedTop (ValueType amountToRemove) const noexcept { return withTop (pos.y + amountToRemove); }
|
||||
[[nodiscard]] Rectangle withTrimmedTop (ValueType amountToRemove) const noexcept { return withTop (pos.y + amountToRemove); }
|
||||
|
||||
/** Returns a version of this rectangle with the given amount removed from its bottom edge. */
|
||||
JUCE_NODISCARD Rectangle withTrimmedBottom (ValueType amountToRemove) const noexcept { return withHeight (h - amountToRemove); }
|
||||
[[nodiscard]] Rectangle withTrimmedBottom (ValueType amountToRemove) const noexcept { return withHeight (h - amountToRemove); }
|
||||
|
||||
//==============================================================================
|
||||
/** Moves the rectangle's position by adding amount to its x and y coordinates. */
|
||||
|
|
|
|||
|
|
@ -50,73 +50,73 @@ public:
|
|||
|
||||
@see isCheckable
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); }
|
||||
[[nodiscard]] AccessibleState withCheckable() const noexcept { return withFlag (Flags::checkable); }
|
||||
|
||||
/** Sets the checked flag and returns the new state.
|
||||
|
||||
@see isChecked
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); }
|
||||
[[nodiscard]] AccessibleState withChecked() const noexcept { return withFlag (Flags::checked); }
|
||||
|
||||
/** Sets the collapsed flag and returns the new state.
|
||||
|
||||
@see isCollapsed
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); }
|
||||
[[nodiscard]] AccessibleState withCollapsed() const noexcept { return withFlag (Flags::collapsed); }
|
||||
|
||||
/** Sets the expandable flag and returns the new state.
|
||||
|
||||
@see isExpandable
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); }
|
||||
[[nodiscard]] AccessibleState withExpandable() const noexcept { return withFlag (Flags::expandable); }
|
||||
|
||||
/** Sets the expanded flag and returns the new state.
|
||||
|
||||
@see isExpanded
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); }
|
||||
[[nodiscard]] AccessibleState withExpanded() const noexcept { return withFlag (Flags::expanded); }
|
||||
|
||||
/** Sets the focusable flag and returns the new state.
|
||||
|
||||
@see isFocusable
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); }
|
||||
[[nodiscard]] AccessibleState withFocusable() const noexcept { return withFlag (Flags::focusable); }
|
||||
|
||||
/** Sets the focused flag and returns the new state.
|
||||
|
||||
@see isFocused
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); }
|
||||
[[nodiscard]] AccessibleState withFocused() const noexcept { return withFlag (Flags::focused); }
|
||||
|
||||
/** Sets the ignored flag and returns the new state.
|
||||
|
||||
@see isIgnored
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); }
|
||||
[[nodiscard]] AccessibleState withIgnored() const noexcept { return withFlag (Flags::ignored); }
|
||||
|
||||
/** Sets the selectable flag and returns the new state.
|
||||
|
||||
@see isSelectable
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); }
|
||||
[[nodiscard]] AccessibleState withSelectable() const noexcept { return withFlag (Flags::selectable); }
|
||||
|
||||
/** Sets the multiSelectable flag and returns the new state.
|
||||
|
||||
@see isMultiSelectable
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); }
|
||||
[[nodiscard]] AccessibleState withMultiSelectable() const noexcept { return withFlag (Flags::multiSelectable); }
|
||||
|
||||
/** Sets the selected flag and returns the new state.
|
||||
|
||||
@see isSelected
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); }
|
||||
[[nodiscard]] AccessibleState withSelected() const noexcept { return withFlag (Flags::selected); }
|
||||
|
||||
/** Sets the accessible offscreen flag and returns the new state.
|
||||
|
||||
@see isSelected
|
||||
*/
|
||||
JUCE_NODISCARD AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); }
|
||||
[[nodiscard]] AccessibleState withAccessibleOffscreen() const noexcept { return withFlag (Flags::accessibleOffscreen); }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns true if the UI element is checkable.
|
||||
|
|
@ -208,7 +208,7 @@ private:
|
|||
accessibleOffscreen = (1 << 11)
|
||||
};
|
||||
|
||||
JUCE_NODISCARD AccessibleState withFlag (int flag) const noexcept
|
||||
[[nodiscard]] AccessibleState withFlag (int flag) const noexcept
|
||||
{
|
||||
auto copy = *this;
|
||||
copy.flags |= flag;
|
||||
|
|
|
|||
|
|
@ -163,10 +163,10 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Returns a copy of only the mouse-button flags */
|
||||
JUCE_NODISCARD ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
|
||||
[[nodiscard]] ModifierKeys withOnlyMouseButtons() const noexcept { return ModifierKeys (flags & allMouseButtonModifiers); }
|
||||
|
||||
/** Returns a copy of only the non-mouse flags */
|
||||
JUCE_NODISCARD ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
|
||||
[[nodiscard]] ModifierKeys withoutMouseButtons() const noexcept { return ModifierKeys (flags & ~allMouseButtonModifiers); }
|
||||
|
||||
bool operator== (const ModifierKeys other) const noexcept { return flags == other.flags; }
|
||||
bool operator!= (const ModifierKeys other) const noexcept { return flags != other.flags; }
|
||||
|
|
@ -175,8 +175,8 @@ public:
|
|||
/** Returns the raw flags for direct testing. */
|
||||
inline int getRawFlags() const noexcept { return flags; }
|
||||
|
||||
JUCE_NODISCARD ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept { return ModifierKeys (flags & ~rawFlagsToClear); }
|
||||
JUCE_NODISCARD ModifierKeys withFlags (int rawFlagsToSet) const noexcept { return ModifierKeys (flags | rawFlagsToSet); }
|
||||
[[nodiscard]] ModifierKeys withoutFlags (int rawFlagsToClear) const noexcept { return ModifierKeys (flags & ~rawFlagsToClear); }
|
||||
[[nodiscard]] ModifierKeys withFlags (int rawFlagsToSet) const noexcept { return ModifierKeys (flags | rawFlagsToSet); }
|
||||
|
||||
/** Tests a combination of flags and returns true if any of them are set. */
|
||||
bool testFlags (int flagsToTest) const noexcept { return (flags & flagsToTest) != 0; }
|
||||
|
|
|
|||
|
|
@ -483,8 +483,8 @@ public:
|
|||
|
||||
@see withTargetComponent, withTargetScreenArea
|
||||
*/
|
||||
JUCE_NODISCARD Options withTargetComponent (Component* targetComponent) const;
|
||||
JUCE_NODISCARD Options withTargetComponent (Component& targetComponent) const;
|
||||
[[nodiscard]] Options withTargetComponent (Component* targetComponent) const;
|
||||
[[nodiscard]] Options withTargetComponent (Component& targetComponent) const;
|
||||
|
||||
/** Sets the region of the screen next to which the menu should be displayed.
|
||||
|
||||
|
|
@ -500,7 +500,7 @@ public:
|
|||
|
||||
@see withMousePosition
|
||||
*/
|
||||
JUCE_NODISCARD Options withTargetScreenArea (Rectangle<int> targetArea) const;
|
||||
[[nodiscard]] Options withTargetScreenArea (Rectangle<int> targetArea) const;
|
||||
|
||||
/** Sets the target screen area to match the current mouse position.
|
||||
|
||||
|
|
@ -508,7 +508,7 @@ public:
|
|||
|
||||
@see withTargetScreenArea
|
||||
*/
|
||||
JUCE_NODISCARD Options withMousePosition() const;
|
||||
[[nodiscard]] Options withMousePosition() const;
|
||||
|
||||
/** If the passed component has been deleted when the popup menu exits,
|
||||
the selected item's action will not be called.
|
||||
|
|
@ -517,26 +517,26 @@ public:
|
|||
callback, in the case that the callback needs to access a component that
|
||||
may be deleted.
|
||||
*/
|
||||
JUCE_NODISCARD Options withDeletionCheck (Component& componentToWatchForDeletion) const;
|
||||
[[nodiscard]] Options withDeletionCheck (Component& componentToWatchForDeletion) const;
|
||||
|
||||
/** Sets the minimum width of the popup window. */
|
||||
JUCE_NODISCARD Options withMinimumWidth (int minWidth) const;
|
||||
[[nodiscard]] Options withMinimumWidth (int minWidth) const;
|
||||
|
||||
/** Sets the minimum number of columns in the popup window. */
|
||||
JUCE_NODISCARD Options withMinimumNumColumns (int minNumColumns) const;
|
||||
[[nodiscard]] Options withMinimumNumColumns (int minNumColumns) const;
|
||||
|
||||
/** Sets the maximum number of columns in the popup window. */
|
||||
JUCE_NODISCARD Options withMaximumNumColumns (int maxNumColumns) const;
|
||||
[[nodiscard]] Options withMaximumNumColumns (int maxNumColumns) const;
|
||||
|
||||
/** Sets the default height of each item in the popup menu. */
|
||||
JUCE_NODISCARD Options withStandardItemHeight (int standardHeight) const;
|
||||
[[nodiscard]] Options withStandardItemHeight (int standardHeight) const;
|
||||
|
||||
/** Sets an item which must be visible when the menu is initially drawn.
|
||||
|
||||
This is useful to ensure that a particular item is shown when the menu
|
||||
contains too many items to display on a single screen.
|
||||
*/
|
||||
JUCE_NODISCARD Options withItemThatMustBeVisible (int idOfItemToBeVisible) const;
|
||||
[[nodiscard]] Options withItemThatMustBeVisible (int idOfItemToBeVisible) const;
|
||||
|
||||
/** Sets a component that the popup menu will be drawn into.
|
||||
|
||||
|
|
@ -547,10 +547,10 @@ public:
|
|||
avoid this unwanted behaviour, but with the downside that the menu size
|
||||
will be constrained by the size of the parent component.
|
||||
*/
|
||||
JUCE_NODISCARD Options withParentComponent (Component* parentComponent) const;
|
||||
[[nodiscard]] Options withParentComponent (Component* parentComponent) const;
|
||||
|
||||
/** Sets the direction of the popup menu relative to the target screen area. */
|
||||
JUCE_NODISCARD Options withPreferredPopupDirection (PopupDirection direction) const;
|
||||
[[nodiscard]] Options withPreferredPopupDirection (PopupDirection direction) const;
|
||||
|
||||
/** Sets an item to select in the menu.
|
||||
|
||||
|
|
@ -560,7 +560,7 @@ public:
|
|||
than needing to move the highlighted row down from the top of the menu each time
|
||||
it is opened.
|
||||
*/
|
||||
JUCE_NODISCARD Options withInitiallySelectedItem (int idOfItemToBeSelected) const;
|
||||
[[nodiscard]] Options withInitiallySelectedItem (int idOfItemToBeSelected) const;
|
||||
|
||||
//==============================================================================
|
||||
/** Gets the parent component. This may be nullptr if the Component has been deleted.
|
||||
|
|
|
|||
|
|
@ -41,13 +41,13 @@ public:
|
|||
bool operator== (const PointerState& other) const noexcept { return tie() == other.tie(); }
|
||||
bool operator!= (const PointerState& other) const noexcept { return tie() != other.tie(); }
|
||||
|
||||
JUCE_NODISCARD PointerState withPositionOffset (Point<float> x) const noexcept { return with (&PointerState::position, position + x); }
|
||||
JUCE_NODISCARD PointerState withPosition (Point<float> x) const noexcept { return with (&PointerState::position, x); }
|
||||
JUCE_NODISCARD PointerState withPressure (float x) const noexcept { return with (&PointerState::pressure, x); }
|
||||
JUCE_NODISCARD PointerState withOrientation (float x) const noexcept { return with (&PointerState::orientation, x); }
|
||||
JUCE_NODISCARD PointerState withRotation (float x) const noexcept { return with (&PointerState::rotation, x); }
|
||||
JUCE_NODISCARD PointerState withTiltX (float x) const noexcept { return with (&PointerState::tiltX, x); }
|
||||
JUCE_NODISCARD PointerState withTiltY (float x) const noexcept { return with (&PointerState::tiltY, x); }
|
||||
[[nodiscard]] PointerState withPositionOffset (Point<float> x) const noexcept { return with (&PointerState::position, position + x); }
|
||||
[[nodiscard]] PointerState withPosition (Point<float> x) const noexcept { return with (&PointerState::position, x); }
|
||||
[[nodiscard]] PointerState withPressure (float x) const noexcept { return with (&PointerState::pressure, x); }
|
||||
[[nodiscard]] PointerState withOrientation (float x) const noexcept { return with (&PointerState::orientation, x); }
|
||||
[[nodiscard]] PointerState withRotation (float x) const noexcept { return with (&PointerState::rotation, x); }
|
||||
[[nodiscard]] PointerState withTiltX (float x) const noexcept { return with (&PointerState::tiltX, x); }
|
||||
[[nodiscard]] PointerState withTiltY (float x) const noexcept { return with (&PointerState::tiltY, x); }
|
||||
|
||||
Point<float> position;
|
||||
float pressure = MouseInputSource::defaultPressure;
|
||||
|
|
|
|||
|
|
@ -227,7 +227,7 @@ public:
|
|||
screen. The RefreshCallback returned by the factory will be called every time that screen's
|
||||
display link callback fires.
|
||||
*/
|
||||
JUCE_NODISCARD Connection registerFactory (Factory factory)
|
||||
[[nodiscard]] Connection registerFactory (Factory factory)
|
||||
{
|
||||
const ScopedLock lock (mutex);
|
||||
factories.push_front (std::move (factory));
|
||||
|
|
|
|||
|
|
@ -68,13 +68,13 @@ public:
|
|||
|
||||
//==============================================================================
|
||||
/** Sets the type of icon that should be used for the dialog box. */
|
||||
JUCE_NODISCARD MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); }
|
||||
[[nodiscard]] MessageBoxOptions withIconType (MessageBoxIconType type) const { return with (*this, &MessageBoxOptions::iconType, type); }
|
||||
|
||||
/** Sets the title of the dialog box. */
|
||||
JUCE_NODISCARD MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); }
|
||||
[[nodiscard]] MessageBoxOptions withTitle (const String& boxTitle) const { return with (*this, &MessageBoxOptions::title, boxTitle); }
|
||||
|
||||
/** Sets the message that should be displayed in the dialog box. */
|
||||
JUCE_NODISCARD MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); }
|
||||
[[nodiscard]] MessageBoxOptions withMessage (const String& boxMessage) const { return with (*this, &MessageBoxOptions::message, boxMessage); }
|
||||
|
||||
/** If the string passed in is not empty, this will add a button to the
|
||||
dialog box with the specified text.
|
||||
|
|
@ -82,10 +82,10 @@ public:
|
|||
Generally up to 3 buttons are supported for dialog boxes, so adding any more
|
||||
than this may have no effect.
|
||||
*/
|
||||
JUCE_NODISCARD MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; }
|
||||
[[nodiscard]] MessageBoxOptions withButton (const String& text) const { auto copy = *this; copy.buttons.add (text); return copy; }
|
||||
|
||||
/** The component that the dialog box should be associated with. */
|
||||
JUCE_NODISCARD MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); }
|
||||
[[nodiscard]] MessageBoxOptions withAssociatedComponent (Component* component) const { return with (*this, &MessageBoxOptions::associatedComponent, component); }
|
||||
|
||||
//==============================================================================
|
||||
/** Returns the icon type of the dialog box.
|
||||
|
|
|
|||
|
|
@ -182,7 +182,7 @@ public:
|
|||
/** Sets a custom location for the WebView2Loader.dll that is not a part of the
|
||||
standard system DLL search paths.
|
||||
*/
|
||||
JUCE_NODISCARD WebView2Preferences withDLLLocation (const File& location) const { return with (&WebView2Preferences::dllLocation, location); }
|
||||
[[nodiscard]] WebView2Preferences withDLLLocation (const File& location) const { return with (&WebView2Preferences::dllLocation, location); }
|
||||
|
||||
/** Sets a non-default location for storing user data for the browser instance. */
|
||||
WebView2Preferences withUserDataFolder (const File& folder) const { return with (&WebView2Preferences::userDataFolder, folder); }
|
||||
|
|
@ -190,19 +190,19 @@ public:
|
|||
/** If this is set, the status bar usually displayed in the lower-left of the webview
|
||||
will be disabled.
|
||||
*/
|
||||
JUCE_NODISCARD WebView2Preferences withStatusBarDisabled() const { return with (&WebView2Preferences::disableStatusBar, true); }
|
||||
[[nodiscard]] WebView2Preferences withStatusBarDisabled() const { return with (&WebView2Preferences::disableStatusBar, true); }
|
||||
|
||||
/** If this is set, a blank page will be displayed on error instead of the default
|
||||
built-in error page.
|
||||
*/
|
||||
JUCE_NODISCARD WebView2Preferences withBuiltInErrorPageDisabled() const { return with (&WebView2Preferences::disableBuiltInErrorPage, true); }
|
||||
[[nodiscard]] WebView2Preferences withBuiltInErrorPageDisabled() const { return with (&WebView2Preferences::disableBuiltInErrorPage, true); }
|
||||
|
||||
/** Sets the background colour that WebView2 renders underneath all web content.
|
||||
|
||||
This colour must either be fully opaque or transparent. On Windows 7 this
|
||||
colour must be opaque.
|
||||
*/
|
||||
JUCE_NODISCARD WebView2Preferences withBackgroundColour (const Colour& colour) const
|
||||
[[nodiscard]] WebView2Preferences withBackgroundColour (const Colour& colour) const
|
||||
{
|
||||
// the background colour must be either fully opaque or transparent!
|
||||
jassert (colour.isOpaque() || colour.isTransparent());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue