mirror of
https://github.com/juce-framework/JUCE.git
synced 2026-01-10 23:44:24 +00:00
Fixed spelling. Added a few simple methods to Random, BigInteger and var.
This commit is contained in:
parent
0796c7afbc
commit
293aedac2f
10 changed files with 34 additions and 5 deletions
|
|
@ -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 <class Type>
|
||||
|
|
|
|||
|
|
@ -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; }
|
||||
|
|
|
|||
|
|
@ -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.
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
|
|
|
|||
|
|
@ -81,6 +81,11 @@ int Random::nextInt (const int maxValue) noexcept
|
|||
return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32);
|
||||
}
|
||||
|
||||
int Random::nextInt (Range<int> range) noexcept
|
||||
{
|
||||
return range.getStart() + nextInt (range.getLength());
|
||||
}
|
||||
|
||||
int64 Random::nextInt64() noexcept
|
||||
{
|
||||
return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt();
|
||||
|
|
|
|||
|
|
@ -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<int> range) noexcept;
|
||||
|
||||
/** Returns the next 64-bit random number.
|
||||
@returns a random integer from the full range 0x8000000000000000 to 0x7fffffffffffffff
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue