diff --git a/modules/juce_core/containers/juce_SparseSet.h b/modules/juce_core/containers/juce_SparseSet.h index b0019523ef..86366fce5b 100644 --- a/modules/juce_core/containers/juce_SparseSet.h +++ b/modules/juce_core/containers/juce_SparseSet.h @@ -38,7 +38,7 @@ ranges of values. It's quite a specialised class, mostly useful for things like keeping the set of selected rows in a listbox. - The type used as a template paramter must be an integer type, such as int, short, + The type used as a template parameter must be an integer type, such as int, short, int64, etc. */ template diff --git a/modules/juce_core/containers/juce_Variant.cpp b/modules/juce_core/containers/juce_Variant.cpp index 9ae4ee0132..806b1a758e 100644 --- a/modules/juce_core/containers/juce_Variant.cpp +++ b/modules/juce_core/containers/juce_Variant.cpp @@ -489,6 +489,11 @@ bool var::equalsWithSameType (const var& other) const noexcept return type == other.type && equals (other); } +bool var::hasSameTypeAs (const var& other) const noexcept +{ + return type == other.type; +} + bool operator== (const var& v1, const var& v2) noexcept { return v1.equals (v2); } bool operator!= (const var& v1, const var& v2) noexcept { return ! v1.equals (v2); } bool operator== (const var& v1, const String& v2) { return v1.toString() == v2; } diff --git a/modules/juce_core/containers/juce_Variant.h b/modules/juce_core/containers/juce_Variant.h index 2651c95064..9ad94c37a4 100644 --- a/modules/juce_core/containers/juce_Variant.h +++ b/modules/juce_core/containers/juce_Variant.h @@ -149,6 +149,9 @@ public: */ bool equalsWithSameType (const var& other) const noexcept; + /** Returns true if this var has the same type as the one supplied. */ + bool hasSameTypeAs (const var& other) const noexcept; + //============================================================================== /** If the var is an array, this returns the number of elements. If the var isn't actually an array, this will return 0. diff --git a/modules/juce_core/maths/juce_BigInteger.cpp b/modules/juce_core/maths/juce_BigInteger.cpp index 784bc5ff05..ba37420fc3 100644 --- a/modules/juce_core/maths/juce_BigInteger.cpp +++ b/modules/juce_core/maths/juce_BigInteger.cpp @@ -157,6 +157,12 @@ int BigInteger::toInteger() const noexcept return negative ? -n : n; } +int64 BigInteger::toInt64() const noexcept +{ + const int64 n = (((int64) (values[1] & 0x7fffffff)) << 32) | values[0]; + return negative ? -n : n; +} + BigInteger BigInteger::getBitRange (int startBit, int numBits) const { BigInteger r; diff --git a/modules/juce_core/maths/juce_BigInteger.h b/modules/juce_core/maths/juce_BigInteger.h index cca7b9b078..c212cfd399 100644 --- a/modules/juce_core/maths/juce_BigInteger.h +++ b/modules/juce_core/maths/juce_BigInteger.h @@ -94,11 +94,16 @@ public: /** Returns true if the value is 1. */ bool isOne() const noexcept; - /** Attempts to get the lowest bits of the value as an integer. + /** Attempts to get the lowest 32 bits of the value as an integer. If the value is bigger than the integer limits, this will return only the lower bits. */ int toInteger() const noexcept; + /** Attempts to get the lowest 64 bits of the value as an integer. + If the value is bigger than the integer limits, this will return only the lower bits. + */ + int64 toInt64() const noexcept; + //============================================================================== /** Resets the value to 0. */ void clear(); diff --git a/modules/juce_core/maths/juce_Random.cpp b/modules/juce_core/maths/juce_Random.cpp index a055750cc8..a196256834 100644 --- a/modules/juce_core/maths/juce_Random.cpp +++ b/modules/juce_core/maths/juce_Random.cpp @@ -81,6 +81,11 @@ int Random::nextInt (const int maxValue) noexcept return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32); } +int Random::nextInt (Range range) noexcept +{ + return range.getStart() + nextInt (range.getLength()); +} + int64 Random::nextInt64() noexcept { return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt(); diff --git a/modules/juce_core/maths/juce_Random.h b/modules/juce_core/maths/juce_Random.h index a5a0be153a..19e6d6ef8b 100644 --- a/modules/juce_core/maths/juce_Random.h +++ b/modules/juce_core/maths/juce_Random.h @@ -69,6 +69,11 @@ public: */ int nextInt (int maxValue) noexcept; + /** Returns the next random number, limited to a given range. + @returns a random integer between the range start (inclusive) and its end (exclusive). + */ + int nextInt (Range range) noexcept; + /** Returns the next 64-bit random number. @returns a random integer from the full range 0x8000000000000000 to 0x7fffffffffffffff */ diff --git a/modules/juce_core/network/juce_URL.h b/modules/juce_core/network/juce_URL.h index 82ae5880aa..462ec88d99 100644 --- a/modules/juce_core/network/juce_URL.h +++ b/modules/juce_core/network/juce_URL.h @@ -230,7 +230,7 @@ public: /** Attempts to open a stream that can read from this URL. @param usePostCommand if true, it will try to do use a http 'POST' to pass - the paramters, otherwise it'll encode them into the + the parameters, otherwise it'll encode them into the URL and do a 'GET'. @param progressCallback if this is non-zero, it lets you supply a callback function to keep track of the operation's progress. This can be useful diff --git a/modules/juce_core/zip/juce_GZIPCompressorOutputStream.h b/modules/juce_core/zip/juce_GZIPCompressorOutputStream.h index fe484b08ee..3309486a05 100644 --- a/modules/juce_core/zip/juce_GZIPCompressorOutputStream.h +++ b/modules/juce_core/zip/juce_GZIPCompressorOutputStream.h @@ -78,7 +78,7 @@ public: bool setPosition (int64) override; bool write (const void*, size_t) override; - /** These are preset values that can be used for the constructor's windowBits paramter. + /** These are preset values that can be used for the constructor's windowBits parameter. For more info about this, see the zlib documentation for its windowBits parameter. */ enum WindowBitsValues diff --git a/modules/juce_gui_extra/embedding/juce_UIViewComponent.h b/modules/juce_gui_extra/embedding/juce_UIViewComponent.h index 80d47ea122..eefc1c031d 100644 --- a/modules/juce_gui_extra/embedding/juce_UIViewComponent.h +++ b/modules/juce_gui_extra/embedding/juce_UIViewComponent.h @@ -32,7 +32,7 @@ An iOS-specific class that can create and embed an UIView inside itself. To use it, create one of these, put it in place and make sure it's visible in a - window, then use setView() to assign an NSView to it. The view will then be + window, then use setView() to assign a UIView to it. The view will then be moved and resized to follow the movements of this component. Of course, since the view is a native object, it'll obliterate any