openshot-audio  0.1.4
Public Types | Public Member Functions | List of all members
juce::DynamicObject Class Reference

#include <juce_core.h>

Inheritance diagram for juce::DynamicObject:
juce::ReferenceCountedObject juce::JavascriptEngine::RootObject juce::JavascriptEngine::RootObject::ArrayClass juce::JavascriptEngine::RootObject::FunctionObject juce::JavascriptEngine::RootObject::IntegerClass juce::JavascriptEngine::RootObject::JSONClass juce::JavascriptEngine::RootObject::MathClass juce::JavascriptEngine::RootObject::ObjectClass juce::JavascriptEngine::RootObject::StringClass

Public Types

typedef ReferenceCountedObjectPtr< DynamicObjectPtr
 

Public Member Functions

 DynamicObject ()
 
 DynamicObject (const DynamicObject &)
 
 ~DynamicObject ()
 
virtual bool hasProperty (const Identifier &propertyName) const
 
virtual const vargetProperty (const Identifier &propertyName) const
 
virtual void setProperty (const Identifier &propertyName, const var &newValue)
 
virtual void removeProperty (const Identifier &propertyName)
 
virtual bool hasMethod (const Identifier &methodName) const
 
virtual var invokeMethod (Identifier methodName, const var::NativeFunctionArgs &args)
 
void setMethod (Identifier methodName, var::NativeFunction function)
 
void clear ()
 
NamedValueSetgetProperties () noexcept
 
void cloneAllProperties ()
 
virtual Ptr clone ()
 
virtual void writeAsJSON (OutputStream &, int indentLevel, bool allOnOneLine)
 
- Public Member Functions inherited from juce::ReferenceCountedObject
void incReferenceCount () noexcept
 
void decReferenceCount () noexcept
 
bool decReferenceCountWithoutDeleting () noexcept
 
int getReferenceCount () const noexcept
 

Additional Inherited Members

- Protected Member Functions inherited from juce::ReferenceCountedObject
 ReferenceCountedObject ()
 
virtual ~ReferenceCountedObject ()
 
void resetReferenceCount () noexcept
 

Detailed Description

Represents a dynamically implemented object.

This class is primarily intended for wrapping scripting language objects, but could be used for other purposes.

An instance of a DynamicObject can be used to store named properties, and by subclassing hasMethod() and invokeMethod(), you can give your object methods.

Member Typedef Documentation

◆ Ptr

Constructor & Destructor Documentation

◆ DynamicObject() [1/2]

DynamicObject::DynamicObject ( )

◆ DynamicObject() [2/2]

DynamicObject::DynamicObject ( const DynamicObject other)

◆ ~DynamicObject()

DynamicObject::~DynamicObject ( )

Member Function Documentation

◆ clear()

void DynamicObject::clear ( )

Removes all properties and methods from the object.

◆ clone()

DynamicObject::Ptr DynamicObject::clone ( )
virtual

Returns a clone of this object. The default implementation of this method just returns a new DynamicObject with a (deep) copy of all of its properties. Subclasses can override this to implement their own custom copy routines.

Reimplemented in juce::JavascriptEngine::RootObject::FunctionObject.

◆ cloneAllProperties()

void DynamicObject::cloneAllProperties ( )

Calls var::clone() on all the properties that this object contains.

◆ getProperties()

NamedValueSet& juce::DynamicObject::getProperties ( )
inlinenoexcept

Returns the NamedValueSet that holds the object's properties.

◆ getProperty()

const var & DynamicObject::getProperty ( const Identifier propertyName) const
virtual

Returns a named property. This returns var::null if no such property exists.

◆ hasMethod()

bool DynamicObject::hasMethod ( const Identifier methodName) const
virtual

Checks whether this object has the specified method.

The default implementation of this just checks whether there's a property with this name that's actually a method, but this can be overridden for building objects with dynamic invocation.

◆ hasProperty()

bool DynamicObject::hasProperty ( const Identifier propertyName) const
virtual

Returns true if the object has a property with this name. Note that if the property is actually a method, this will return false.

◆ invokeMethod()

var DynamicObject::invokeMethod ( Identifier  methodName,
const var::NativeFunctionArgs args 
)
virtual

Invokes a named method on this object.

The default implementation looks up the named property, and if it's a method call, then it invokes it.

This method is virtual to allow more dynamic invocation to used for objects where the methods may not already be set as properies.

◆ removeProperty()

void DynamicObject::removeProperty ( const Identifier propertyName)
virtual

Removes a named property.

◆ setMethod()

void DynamicObject::setMethod ( Identifier  methodName,
var::NativeFunction  function 
)

Adds a method to the class.

This is basically the same as calling setProperty (methodName, (var::NativeFunction) myFunction), but helps to avoid accidentally invoking the wrong type of var constructor. It also makes the code easier to read,

◆ setProperty()

void DynamicObject::setProperty ( const Identifier propertyName,
const var newValue 
)
virtual

Sets a named property.

◆ writeAsJSON()

void DynamicObject::writeAsJSON ( OutputStream out,
int  indentLevel,
bool  allOnOneLine 
)
virtual

Writes this object to a text stream in JSON format. This method is used by JSON::toString and JSON::writeToStream, and you should never need to call it directly, but it's virtual so that custom object types can stringify themselves appropriately.

Reimplemented in juce::JavascriptEngine::RootObject::FunctionObject.


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