Browse Source

Fixed spelling. Added a few simple methods to Random, BigInteger and var.

tags/2021-05-28
jules 12 years ago
parent
commit
293aedac2f
10 changed files with 34 additions and 5 deletions
  1. +1
    -1
      modules/juce_core/containers/juce_SparseSet.h
  2. +5
    -0
      modules/juce_core/containers/juce_Variant.cpp
  3. +3
    -0
      modules/juce_core/containers/juce_Variant.h
  4. +6
    -0
      modules/juce_core/maths/juce_BigInteger.cpp
  5. +6
    -1
      modules/juce_core/maths/juce_BigInteger.h
  6. +5
    -0
      modules/juce_core/maths/juce_Random.cpp
  7. +5
    -0
      modules/juce_core/maths/juce_Random.h
  8. +1
    -1
      modules/juce_core/network/juce_URL.h
  9. +1
    -1
      modules/juce_core/zip/juce_GZIPCompressorOutputStream.h
  10. +1
    -1
      modules/juce_gui_extra/embedding/juce_UIViewComponent.h

+ 1
- 1
modules/juce_core/containers/juce_SparseSet.h View File

@@ -38,7 +38,7 @@
ranges of values. It's quite a specialised class, mostly useful for things ranges of values. It's quite a specialised class, mostly useful for things
like keeping the set of selected rows in a listbox. 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. int64, etc.
*/ */
template <class Type> template <class Type>


+ 5
- 0
modules/juce_core/containers/juce_Variant.cpp View File

@@ -489,6 +489,11 @@ bool var::equalsWithSameType (const var& other) const noexcept
return type == other.type && equals (other); 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 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; } bool operator== (const var& v1, const String& v2) { return v1.toString() == v2; }


+ 3
- 0
modules/juce_core/containers/juce_Variant.h View File

@@ -149,6 +149,9 @@ public:
*/ */
bool equalsWithSameType (const var& other) const noexcept; 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 is an array, this returns the number of elements.
If the var isn't actually an array, this will return 0. If the var isn't actually an array, this will return 0.


+ 6
- 0
modules/juce_core/maths/juce_BigInteger.cpp View File

@@ -157,6 +157,12 @@ int BigInteger::toInteger() const noexcept
return negative ? -n : n; 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 BigInteger::getBitRange (int startBit, int numBits) const
{ {
BigInteger r; BigInteger r;


+ 6
- 1
modules/juce_core/maths/juce_BigInteger.h View File

@@ -94,11 +94,16 @@ public:
/** Returns true if the value is 1. */ /** Returns true if the value is 1. */
bool isOne() const noexcept; 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. If the value is bigger than the integer limits, this will return only the lower bits.
*/ */
int toInteger() const noexcept; 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. */ /** Resets the value to 0. */
void clear(); void clear();


+ 5
- 0
modules/juce_core/maths/juce_Random.cpp View File

@@ -81,6 +81,11 @@ int Random::nextInt (const int maxValue) noexcept
return (int) ((((unsigned int) nextInt()) * (uint64) maxValue) >> 32); 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 int64 Random::nextInt64() noexcept
{ {
return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt(); return (((int64) nextInt()) << 32) | (int64) (uint64) (uint32) nextInt();


+ 5
- 0
modules/juce_core/maths/juce_Random.h View File

@@ -69,6 +69,11 @@ public:
*/ */
int nextInt (int maxValue) noexcept; 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 the next 64-bit random number.
@returns a random integer from the full range 0x8000000000000000 to 0x7fffffffffffffff @returns a random integer from the full range 0x8000000000000000 to 0x7fffffffffffffff
*/ */


+ 1
- 1
modules/juce_core/network/juce_URL.h View File

@@ -230,7 +230,7 @@ public:
/** Attempts to open a stream that can read from this URL. /** 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 @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'. URL and do a 'GET'.
@param progressCallback if this is non-zero, it lets you supply a callback function @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 to keep track of the operation's progress. This can be useful


+ 1
- 1
modules/juce_core/zip/juce_GZIPCompressorOutputStream.h View File

@@ -78,7 +78,7 @@ public:
bool setPosition (int64) override; bool setPosition (int64) override;
bool write (const void*, size_t) 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. For more info about this, see the zlib documentation for its windowBits parameter.
*/ */
enum WindowBitsValues enum WindowBitsValues


+ 1
- 1
modules/juce_gui_extra/embedding/juce_UIViewComponent.h View File

@@ -32,7 +32,7 @@
An iOS-specific class that can create and embed an UIView inside itself. 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 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. moved and resized to follow the movements of this component.
Of course, since the view is a native object, it'll obliterate any Of course, since the view is a native object, it'll obliterate any


Loading…
Cancel
Save