openshot-audio  0.1.7
Classes | Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Friends | List of all members
var Class Reference

#include <juce_Variant.h>

Classes

struct  NativeFunctionArgs
 
class  VariantType
 
class  VariantType_Array
 
class  VariantType_Binary
 
class  VariantType_Bool
 
class  VariantType_Double
 
class  VariantType_Int
 
class  VariantType_Int64
 
class  VariantType_Method
 
class  VariantType_Object
 
class  VariantType_String
 
class  VariantType_Undefined
 
class  VariantType_Void
 

Public Types

typedef var(* NativeFunction )(const NativeFunctionArgs &)
 

Public Member Functions

 var () noexcept
 
 ~var () noexcept
 
 var (const var &valueToCopy)
 
 var (int value) noexcept
 
 var (int64 value) noexcept
 
 var (bool value) noexcept
 
 var (double value) noexcept
 
 var (const char *value)
 
 var (const wchar_t *value)
 
 var (const String &value)
 
 var (const Array< var > &value)
 
 var (ReferenceCountedObject *object)
 
 var (NativeFunction method) noexcept
 
 var (const void *binaryData, size_t dataSize)
 
 var (const MemoryBlock &binaryData)
 
varoperator= (const var &valueToCopy)
 
varoperator= (int value)
 
varoperator= (int64 value)
 
varoperator= (bool value)
 
varoperator= (double value)
 
varoperator= (const char *value)
 
varoperator= (const wchar_t *value)
 
varoperator= (const String &value)
 
varoperator= (const Array< var > &value)
 
varoperator= (ReferenceCountedObject *object)
 
varoperator= (NativeFunction method)
 
void swapWith (var &other) noexcept
 
 operator int () const noexcept
 
 operator int64 () const noexcept
 
 operator bool () const noexcept
 
 operator float () const noexcept
 
 operator double () const noexcept
 
 operator String () const
 
String toString () const
 
Array< var > * getArray () const noexcept
 
MemoryBlockgetBinaryData () const noexcept
 
ReferenceCountedObjectgetObject () const noexcept
 
DynamicObjectgetDynamicObject () const noexcept
 
bool isVoid () const noexcept
 
bool isUndefined () const noexcept
 
bool isInt () const noexcept
 
bool isInt64 () const noexcept
 
bool isBool () const noexcept
 
bool isDouble () const noexcept
 
bool isString () const noexcept
 
bool isObject () const noexcept
 
bool isArray () const noexcept
 
bool isBinaryData () const noexcept
 
bool isMethod () const noexcept
 
bool equals (const var &other) const noexcept
 
bool equalsWithSameType (const var &other) const noexcept
 
bool hasSameTypeAs (const var &other) const noexcept
 
var clone () const noexcept
 
int size () const
 
const varoperator[] (int arrayIndex) const
 
varoperator[] (int arrayIndex)
 
void append (const var &valueToAppend)
 
void insert (int index, const var &value)
 
void remove (int index)
 
void resize (int numArrayElementsWanted)
 
int indexOf (const var &value) const
 
const varoperator[] (const Identifier &propertyName) const
 
const varoperator[] (const char *propertyName) const
 
var getProperty (const Identifier &propertyName, const var &defaultReturnValue) const
 
var call (const Identifier &method) const
 
var call (const Identifier &method, const var &arg1) const
 
var call (const Identifier &method, const var &arg1, const var &arg2) const
 
var call (const Identifier &method, const var &arg1, const var &arg2, const var &arg3)
 
var call (const Identifier &method, const var &arg1, const var &arg2, const var &arg3, const var &arg4) const
 
var call (const Identifier &method, const var &arg1, const var &arg2, const var &arg3, const var &arg4, const var &arg5) const
 
var invoke (const Identifier &method, const var *arguments, int numArguments) const
 
NativeFunction getNativeFunction () const
 
void writeToStream (OutputStream &output) const
 

Static Public Member Functions

static var undefined () noexcept
 
static var readFromStream (InputStream &input)
 

Static Public Attributes

static const var null
 

Friends

class VariantType
 
class VariantType_Void
 
class VariantType_Undefined
 
class VariantType_Int
 
class VariantType_Int64
 
class VariantType_Double
 
class VariantType_Bool
 
class VariantType_String
 
class VariantType_Object
 
class VariantType_Array
 
class VariantType_Binary
 
class VariantType_Method
 

Detailed Description

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.

See Also
JSON, DynamicObject

Member Typedef Documentation

typedef var(* var::NativeFunction)(const NativeFunctionArgs &)

Constructor & Destructor Documentation

var::var ( )
noexcept

Creates a void variant.

var::~var ( )
noexcept

Destructor.

var::var ( const var valueToCopy)
var::var ( int  value)
noexcept
var::var ( int64  value)
noexcept
var::var ( bool  value)
noexcept
var::var ( double  value)
noexcept
var::var ( const char *  value)
var::var ( const wchar_t *  value)
var::var ( const String value)
var::var ( const Array< var > &  value)
var::var ( ReferenceCountedObject object)
var::var ( NativeFunction  method)
noexcept
var::var ( const void *  binaryData,
size_t  dataSize 
)
var::var ( const MemoryBlock binaryData)

Member Function Documentation

void var::append ( const var valueToAppend)

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>.

var var::call ( const Identifier method) const

Invokes a named method call with no arguments.

var var::call ( const Identifier method,
const var arg1 
) const

Invokes a named method call with one argument.

var var::call ( const Identifier method,
const var arg1,
const var arg2 
) const

Invokes a named method call with 2 arguments.

var var::call ( const Identifier method,
const var arg1,
const var arg2,
const var arg3 
)

Invokes a named method call with 3 arguments.

var 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.

var 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.

var var::clone ( ) const
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).

bool var::equals ( const var other) const
noexcept

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.

See Also
equalsWithSameType
bool var::equalsWithSameType ( const var other) const
noexcept

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.

See Also
equals
Array< var > * var::getArray ( ) const
noexcept

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!

MemoryBlock * var::getBinaryData ( ) const
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!

DynamicObject * var::getDynamicObject ( ) const
noexcept
var::NativeFunction var::getNativeFunction ( ) const

If this object is a method, this returns the function pointer.

ReferenceCountedObject * var::getObject ( ) const
noexcept
var 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.

bool var::hasSameTypeAs ( const var other) const
noexcept

Returns true if this var has the same type as the one supplied.

int var::indexOf ( const var value) const

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.

void var::insert ( int  index,
const var value 
)

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>.

var var::invoke ( const Identifier method,
const var arguments,
int  numArguments 
) const

Invokes a named method call with a list of arguments.

bool var::isArray ( ) const
noexcept
bool var::isBinaryData ( ) const
noexcept
bool var::isBool ( ) const
noexcept
bool var::isDouble ( ) const
noexcept
bool var::isInt ( ) const
noexcept
bool var::isInt64 ( ) const
noexcept
bool var::isMethod ( ) const
noexcept
bool var::isObject ( ) const
noexcept
bool var::isString ( ) const
noexcept
bool var::isUndefined ( ) const
noexcept
bool var::isVoid ( ) const
noexcept
var::operator bool ( ) const
noexcept
var::operator double ( ) const
noexcept
var::operator float ( ) const
noexcept
var::operator int ( ) const
noexcept
var::operator int64 ( ) const
noexcept
var::operator String ( ) const
var & var::operator= ( const var valueToCopy)
var & var::operator= ( int  value)
var & var::operator= ( int64  value)
var & var::operator= ( bool  value)
var & var::operator= ( double  value)
var & var::operator= ( const char *  value)
var & var::operator= ( const wchar_t *  value)
var & var::operator= ( const String value)
var & var::operator= ( const Array< var > &  value)
var & var::operator= ( ReferenceCountedObject object)
var & var::operator= ( NativeFunction  method)
const var & var::operator[] ( int  arrayIndex) const

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>.

var & var::operator[] ( int  arrayIndex)

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>.

const var & var::operator[] ( const Identifier propertyName) const

If this variant is an object, this returns one of its properties.

const var & var::operator[] ( const char *  propertyName) const

If this variant is an object, this returns one of its properties.

var var::readFromStream ( InputStream input)
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.

See Also
JSON
void var::remove ( int  index)

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>.

void var::resize ( int  numArrayElementsWanted)

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>.

int 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.

void var::swapWith ( var other)
noexcept
String var::toString ( ) const
var var::undefined ( )
staticnoexcept

Returns a var object that can be used where you need the javascript "undefined" value.

void var::writeToStream ( OutputStream output) const

Writes a binary representation of this value to a stream. The data can be read back later using readFromStream().

See Also
JSON

Friends And Related Function Documentation

friend class VariantType
friend
friend class VariantType_Array
friend
friend class VariantType_Binary
friend
friend class VariantType_Bool
friend
friend class VariantType_Double
friend
friend class VariantType_Int
friend
friend class VariantType_Int64
friend
friend class VariantType_Method
friend
friend class VariantType_Object
friend
friend class VariantType_String
friend
friend class VariantType_Undefined
friend
friend class VariantType_Void
friend

Member Data Documentation

const var var::null
static

A static var object that can be used where you need an empty variant object.


The documentation for this class was generated from the following files: