OpenShot Audio Library | OpenShotAudio 0.3.2
|
#include <juce_Variant.h>
Classes | |
struct | NativeFunctionArgs |
Public Types | |
using | NativeFunction = std::function< var(const NativeFunctionArgs &)> |
Static Public Member Functions | |
static var | undefined () noexcept |
static var | readFromStream (InputStream &input) |
A variant class, that can be used to hold a range of primitive values.
A var object can hold a range of simple primitive values, strings, or any kind of ReferenceCountedObject. The var class is intended to act like the kind of values used in dynamic scripting languages.
You can save/load var objects either in a small, proprietary binary format using writeToStream()/readFromStream(), or as JSON by using the JSON class.
Definition at line 41 of file juce_Variant.h.
using juce::var::NativeFunction = std::function<var(const NativeFunctionArgs&)> |
Definition at line 57 of file juce_Variant.h.
|
noexcept |
Creates a void variant.
Definition at line 441 of file juce_Variant.cpp.
Referenced by readFromStream(), and undefined().
|
noexcept |
Destructor.
Definition at line 443 of file juce_Variant.cpp.
Definition at line 448 of file juce_Variant.cpp.
|
noexcept |
Definition at line 453 of file juce_Variant.cpp.
|
noexcept |
Definition at line 454 of file juce_Variant.cpp.
|
noexcept |
Definition at line 455 of file juce_Variant.cpp.
|
noexcept |
Definition at line 456 of file juce_Variant.cpp.
Definition at line 460 of file juce_Variant.cpp.
Definition at line 461 of file juce_Variant.cpp.
Definition at line 459 of file juce_Variant.cpp.
Definition at line 458 of file juce_Variant.cpp.
juce::var::var | ( | const StringArray & | value | ) |
Definition at line 465 of file juce_Variant.cpp.
juce::var::var | ( | ReferenceCountedObject * | object | ) |
Definition at line 476 of file juce_Variant.cpp.
|
noexcept |
Definition at line 457 of file juce_Variant.cpp.
Definition at line 462 of file juce_Variant.cpp.
juce::var::var | ( | const MemoryBlock & | binaryData | ) |
Definition at line 463 of file juce_Variant.cpp.
|
noexcept |
Definition at line 531 of file juce_Variant.cpp.
juce::var::var | ( | String && | v | ) |
Definition at line 544 of file juce_Variant.cpp.
juce::var::var | ( | MemoryBlock && | v | ) |
Definition at line 549 of file juce_Variant.cpp.
Definition at line 554 of file juce_Variant.cpp.
Appends an element to the var, converting it to an array if it isn't already one. If the var isn't an array, it will be converted to one, and if its value was non-void, this value will be kept as the first element of the new array. The parameter value will then be appended to it. For more control over the array's contents, you can call getArray() and manipulate it directly as an Array<var>.
Definition at line 737 of file juce_Variant.cpp.
var juce::var::call | ( | const Identifier & | method | ) | const |
Invokes a named method call with no arguments.
Definition at line 658 of file juce_Variant.cpp.
var juce::var::call | ( | const Identifier & | method, |
const var & | arg1 | ||
) | const |
Invokes a named method call with one argument.
Definition at line 663 of file juce_Variant.cpp.
Invokes a named method call with 2 arguments.
Definition at line 668 of file juce_Variant.cpp.
var juce::var::call | ( | const Identifier & | method, |
const var & | arg1, | ||
const var & | arg2, | ||
const var & | arg3 | ||
) |
Invokes a named method call with 3 arguments.
Definition at line 674 of file juce_Variant.cpp.
var juce::var::call | ( | const Identifier & | method, |
const var & | arg1, | ||
const var & | arg2, | ||
const var & | arg3, | ||
const var & | arg4 | ||
) | const |
Invokes a named method call with 4 arguments.
Definition at line 680 of file juce_Variant.cpp.
var juce::var::call | ( | const Identifier & | method, |
const var & | arg1, | ||
const var & | arg2, | ||
const var & | arg3, | ||
const var & | arg4, | ||
const var & | arg5 | ||
) | const |
Invokes a named method call with 5 arguments.
Definition at line 686 of file juce_Variant.cpp.
|
noexcept |
Returns a deep copy of this object. For simple types this just returns a copy, but if the object contains any arrays or DynamicObjects, they will be cloned (recursively).
Definition at line 610 of file juce_Variant.cpp.
Returns true if this var has the same value as the one supplied. Note that this ignores the type, so a string var "123" and an integer var with the value 123 are considered to be equal.
Definition at line 568 of file juce_Variant.cpp.
Returns true if this var has the same value and type as the one supplied. This differs from equals() because e.g. "123" and 123 will be considered different.
Definition at line 573 of file juce_Variant.cpp.
If this variant holds an array, this provides access to it. NOTE: Beware when you use this - the array pointer is only valid for the lifetime of the variant that returned it, so be very careful not to call this method on temporary var objects that are the return-value of a function, and which may go out of scope before you use the array!
Definition at line 507 of file juce_Variant.cpp.
Referenced by indexOf(), operator[](), operator[](), remove(), juce::ValueWithDefault::setValue(), and size().
|
noexcept |
If this variant holds a memory block, this provides access to it. NOTE: Beware when you use this - the MemoryBlock pointer is only valid for the lifetime of the variant that returned it, so be very careful not to call this method on temporary var objects that are the return-value of a function, and which may go out of scope before you use the MemoryBlock!
Definition at line 508 of file juce_Variant.cpp.
|
noexcept |
Definition at line 509 of file juce_Variant.cpp.
var::NativeFunction juce::var::getNativeFunction | ( | ) | const |
If this object is a method, this returns the function pointer.
Definition at line 645 of file juce_Variant.cpp.
|
noexcept |
Definition at line 506 of file juce_Variant.cpp.
var juce::var::getProperty | ( | const Identifier & | propertyName, |
const var & | defaultReturnValue | ||
) | const |
If this variant is an object, this returns one of its properties, or a default fallback value if the property is not set.
Definition at line 629 of file juce_Variant.cpp.
|
noexcept |
Returns true if this variant is an object and if it has the given property.
Definition at line 637 of file juce_Variant.cpp.
Returns true if this var has the same type as the one supplied.
Definition at line 578 of file juce_Variant.cpp.
If the var is an array, this searches it for the first occurrence of the specified value, and returns its index. If the var isn't an array, or if the value isn't found, this returns -1.
Definition at line 758 of file juce_Variant.cpp.
Inserts an element to the var, converting it to an array if it isn't already one. If the var isn't an array, it will be converted to one, and if its value was non-void, this value will be kept as the first element of the new array. The parameter value will then be inserted into it. For more control over the array's contents, you can call getArray() and manipulate it directly as an Array<var>.
Definition at line 748 of file juce_Variant.cpp.
|
noexcept |
Definition at line 495 of file juce_Variant.cpp.
|
noexcept |
Definition at line 496 of file juce_Variant.cpp.
|
noexcept |
Definition at line 491 of file juce_Variant.cpp.
|
noexcept |
Definition at line 492 of file juce_Variant.cpp.
|
noexcept |
Definition at line 489 of file juce_Variant.cpp.
|
noexcept |
Definition at line 490 of file juce_Variant.cpp.
|
noexcept |
Definition at line 497 of file juce_Variant.cpp.
|
noexcept |
Definition at line 494 of file juce_Variant.cpp.
|
noexcept |
Definition at line 493 of file juce_Variant.cpp.
|
noexcept |
Definition at line 488 of file juce_Variant.cpp.
|
noexcept |
Definition at line 487 of file juce_Variant.cpp.
|
noexcept |
Definition at line 501 of file juce_Variant.cpp.
|
noexcept |
Definition at line 503 of file juce_Variant.cpp.
|
noexcept |
Definition at line 502 of file juce_Variant.cpp.
|
noexcept |
Definition at line 499 of file juce_Variant.cpp.
|
noexcept |
Definition at line 500 of file juce_Variant.cpp.
juce::var::operator String | ( | ) | const |
Definition at line 505 of file juce_Variant.cpp.
Definition at line 521 of file juce_Variant.cpp.
Definition at line 527 of file juce_Variant.cpp.
Definition at line 523 of file juce_Variant.cpp.
var & juce::var::operator= | ( | const MemoryBlock & | value | ) |
Definition at line 526 of file juce_Variant.cpp.
Definition at line 525 of file juce_Variant.cpp.
Definition at line 518 of file juce_Variant.cpp.
Definition at line 524 of file juce_Variant.cpp.
Definition at line 522 of file juce_Variant.cpp.
Definition at line 519 of file juce_Variant.cpp.
var & juce::var::operator= | ( | int64 | value | ) |
Definition at line 520 of file juce_Variant.cpp.
var & juce::var::operator= | ( | NativeFunction | method | ) |
Definition at line 529 of file juce_Variant.cpp.
var & juce::var::operator= | ( | ReferenceCountedObject * | object | ) |
Definition at line 528 of file juce_Variant.cpp.
Definition at line 559 of file juce_Variant.cpp.
Definition at line 538 of file juce_Variant.cpp.
If this variant is an object, this returns one of its properties.
Definition at line 624 of file juce_Variant.cpp.
const var & juce::var::operator[] | ( | const Identifier & | propertyName | ) | const |
If this variant is an object, this returns one of its properties.
Definition at line 616 of file juce_Variant.cpp.
If the var is an array, this can be used to return one of its elements. To call this method, you must make sure that the var is actually an array, and that the index is a valid number. If these conditions aren't met, behaviour is undefined. For more control over the array's contents, you can call getArray() and manipulate it directly as an Array<var>.
Definition at line 712 of file juce_Variant.cpp.
If the var is an array, this can be used to return one of its elements. To call this method, you must make sure that the var is actually an array, and that the index is a valid number. If these conditions aren't met, behaviour is undefined. For more control over the array's contents, you can call getArray() and manipulate it directly as an Array<var>.
Definition at line 701 of file juce_Variant.cpp.
Referenced by operator[]().
|
static |
Reads back a stored binary representation of a value. The data in the stream must have been written using writeToStream(), or this will have unpredictable results.
Definition at line 772 of file juce_Variant.cpp.
Referenced by juce::ValueTreeSynchroniser::applyChange(), readFromStream(), and juce::ValueTree::readFromStream().
If the var is an array, this removes one of its elements. If the index is out-of-range or the var isn't an array, nothing will be done. For more control over the array's contents, you can call getArray() and manipulate it directly as an Array<var>.
Definition at line 742 of file juce_Variant.cpp.
Referenced by juce::DynamicObject::removeProperty().
Treating the var as an array, this resizes it to contain the specified number of elements. If the var isn't an array, it will be converted to one, and if its value was non-void, this value will be kept as the first element of the new array before resizing. For more control over the array's contents, you can call getArray() and manipulate it directly as an Array<var>.
Definition at line 753 of file juce_Variant.cpp.
int juce::var::size | ( | ) | const |
If the var is an array, this returns the number of elements. If the var isn't actually an array, this will return 0.
Definition at line 693 of file juce_Variant.cpp.
Definition at line 512 of file juce_Variant.cpp.
String juce::var::toString | ( | ) | const |
Definition at line 504 of file juce_Variant.cpp.
|
staticnoexcept |
Returns a var object that can be used where you need the javascript "undefined" value.
Definition at line 484 of file juce_Variant.cpp.
Referenced by juce::JavascriptEngine::callFunction(), juce::JavascriptEngine::callFunctionObject(), and juce::JavascriptEngine::evaluate().
void juce::var::writeToStream | ( | OutputStream & | output | ) | const |
Writes a binary representation of this value to a stream. The data can be read back later using readFromStream().
Definition at line 767 of file juce_Variant.cpp.