C# Класс Jurassic.Library.ObjectInstance

Наследование: System.Runtime.Serialization.IDeserializationCallback
Показать файл Открыть проект Примеры использования класса

Private Properties

Свойство Тип Описание
AddProperty bool
CreateRawObject ObjectInstance
CreateRootObject ObjectInstance
FastSetProperties void
FastSetProperty void
GetDeclarativeProperties List
GetNamedPropertyValue object
GetPrimitiveValue object
GetPrimitiveValuePreES6 object
GetPropertyValue object
HasOwnProperty bool
InitializePrototypeProperties void
IsPrototypeOf bool
PropertyIsEnumerable bool
ToLocaleString string
ToStringJS string
ValueOf ObjectInstance
__STUB__HasOwnProperty object
__STUB__IsPrototypeOf object
__STUB__PropertyIsEnumerable object
__STUB__ToLocaleString object
__STUB__ToStringJS object
__STUB__ValueOf object

Открытые методы

Метод Описание
CallMemberFunction ( string functionName ) : object

Calls the function with the given name. The function must exist on this object or an exception will be thrown.

DefineProperty ( object key, PropertyDescriptor descriptor, bool throwOnError ) : bool

Defines or redefines the value and attributes of a property. The prototype chain is not searched so if the property exists but only in the prototype chain a new property will be created.

Delete ( object key, bool throwOnError ) : bool

Deletes the property with the given name.

Delete ( uint index, bool throwOnError ) : bool

Deletes the property with the given array index.

GetOwnPropertyDescriptor ( object key ) : PropertyDescriptor

Gets a descriptor for the property with the given name.

The prototype chain is not searched.

GetOwnPropertyDescriptor ( uint index ) : PropertyDescriptor

Gets a descriptor for the property with the given array index.

The prototype chain is not searched.

GetPropertyValue ( object key ) : object

Gets the value of the property with the given name.

The prototype chain is searched if the property does not exist directly on this object.

GetPropertyValue ( uint index ) : object

Gets the value of the property with the given array index.

The prototype chain is searched if the property does not exist directly on this object.

HasProperty ( object key ) : bool

Determines if a property with the given name exists.

InlineGetPropertyValue ( string name, int &cachedIndex, object &cacheKey ) : object

Gets the value of the given property plus the information needed to speed up access to the property in future.

InlineSetPropertyValue ( string name, object value, bool throwOnError, int &cachedIndex, object &cacheKey ) : void

Sets the value of the given property plus retrieves the information needed to speed up access to the property in future. If a property with the given name does not exist, or exists in the prototype chain (and is not a setter) then a new property is created.

InlineSetPropertyValueIfExists ( string name, object value, bool throwOnError, int &cachedIndex, object &cacheKey ) : bool

Sets the value of the given property plus retrieves the information needed to speed up access to the property in future. If a property with the given name exists, but only in the prototype chain, then a new property is created (unless the property is a setter, in which case the setter is called and no property is created). If the property does not exist at all, then no property is created and the method returns false.

SetPropertyValue ( object key, object value, bool throwOnError ) : void

Sets the value of the property with the given name. If a property with the given name does not exist, or exists in the prototype chain (and is not a setter) then a new property is created.

SetPropertyValue ( uint index, object value, bool throwOnError ) : void

Sets the value of the property with the given array index. If a property with the given index does not exist, or exists in the prototype chain (and is not a setter) then a new property is created.

SetPropertyValueIfExists ( object key, object value, bool throwOnError ) : bool

Sets the value of the given property. If a property with the given name exists, but only in the prototype chain, then a new property is created (unless the property is a setter, in which case the setter is called and no property is created). If the property does not exist at all, then no property is created and the method returns false. This method is used to set the value of a variable reference within a with statement.

ToString ( ) : string

Returns a string representing this object.

TryCallMemberFunction ( object &result, object key ) : bool

Calls the function with the given name.

this ( int index ) : object

Gets or sets the value of an array-indexed property.

this ( object key ) : object

Gets or sets the value of a named property.

this ( uint index ) : object

Gets or sets the value of an array-indexed property.

Защищенные методы

Метод Описание
GetMissingPropertyValue ( object key ) : object

Retrieves the value of a property which doesn't exist on the object. This method can be overridden to effectively construct properties on the fly. The default behavior is to return undefined.

When overriding, call the base class implementation only if you want to revert to the default behavior.

ObjectInstance ( ObjectInstance prototype ) : System

Called by derived classes to create a new object instance.

ObjectInstance ( ScriptEngine engine ) : System

Creates an Object with the default prototype.

ObjectInstance ( ScriptEngine engine, ObjectInstance prototype ) : System

Called by derived classes to create a new object instance.

PopulateFields ( ) : void

Populates the object with properties by searching a .NET type for fields marked with the [JSField] attribute. Should be called only once at startup.

PopulateFields ( Type type ) : void

Populates the object with properties by searching a .NET type for fields marked with the [JSField] attribute. Should be called only once at startup.

PopulateFunctions ( ) : void

Populates the object with functions by searching a .NET type for methods marked with the [JSFunction] attribute. Should be called only once at startup. Also automatically populates properties marked with the [JSProperty] attribute.

PopulateFunctions ( Type type ) : void

Populates the object with functions by searching a .NET type for methods marked with the [JSFunction] attribute. Should be called only once at startup. Also automatically populates properties marked with the [JSProperty] attribute.

PopulateFunctions ( Type type, BindingFlags bindingFlags ) : void

Populates the object with functions by searching a .NET type for methods marked with the [JSFunction] attribute. Should be called only once at startup. Also automatically populates properties marked with the [JSProperty] attribute.

Приватные методы

Метод Описание
AddProperty ( object key, object value, PropertyAttributes attributes, bool throwOnError ) : bool

Adds a property to this object. The property must not already exist.

CreateRawObject ( ObjectInstance prototype ) : ObjectInstance

Creates an Object instance (use ObjectConstructor.Construct rather than this).

CreateRootObject ( ScriptEngine engine ) : ObjectInstance

Creates an Object with no prototype to serve as the base prototype of all objects.

FastSetProperties ( IEnumerable properties ) : void

Sets up multiple properties at once.

FastSetProperty ( object key, object value, PropertyAttributes attributes = PropertyAttributes.Sealed, bool overwriteAttributes = false ) : void

Sets a property value and attributes, or adds a new property if it doesn't already exist. Any existing attributes are ignored (and not modified).

GetDeclarativeProperties ( ScriptEngine engine ) : List
GetNamedPropertyValue ( object key, ObjectInstance thisValue ) : object

Gets the value of the property with the given name. The name cannot be an array index.

The prototype chain is searched if the property does not exist directly on this object.

GetPrimitiveValue ( PrimitiveTypeHint typeHint ) : object

Returns a primitive value that represents the current object. Used by the addition and equality operators.

GetPrimitiveValuePreES6 ( PrimitiveTypeHint typeHint ) : object

Returns a primitive value that represents the current object, without using the @@toPrimitive symbol.

GetPropertyValue ( uint index, ObjectInstance thisValue ) : object

Gets the value of the property with the given array index.

The prototype chain is searched if the property does not exist directly on this object.

HasOwnProperty ( ScriptEngine engine, object thisObject, object key ) : bool
InitializePrototypeProperties ( ObjectInstance obj, ObjectConstructor constructor ) : void

Initializes the prototype properties.

IsPrototypeOf ( ScriptEngine engine, object thisObject, object obj ) : bool
PropertyIsEnumerable ( ScriptEngine engine, object thisObject, object key ) : bool
ToLocaleString ( ) : string
ToStringJS ( ScriptEngine engine, object thisObject ) : string
ValueOf ( ) : ObjectInstance
__STUB__HasOwnProperty ( ScriptEngine engine, object thisObj, object args ) : object
__STUB__IsPrototypeOf ( ScriptEngine engine, object thisObj, object args ) : object
__STUB__PropertyIsEnumerable ( ScriptEngine engine, object thisObj, object args ) : object
__STUB__ToLocaleString ( ScriptEngine engine, object thisObj, object args ) : object
__STUB__ToStringJS ( ScriptEngine engine, object thisObj, object args ) : object
__STUB__ValueOf ( ScriptEngine engine, object thisObj, object args ) : object

Описание методов

CallMemberFunction() публичный Метод

Calls the function with the given name. The function must exist on this object or an exception will be thrown.
public CallMemberFunction ( string functionName ) : object
functionName string The name of the function to call.
Результат object

DefineProperty() публичный Метод

Defines or redefines the value and attributes of a property. The prototype chain is not searched so if the property exists but only in the prototype chain a new property will be created.
public DefineProperty ( object key, PropertyDescriptor descriptor, bool throwOnError ) : bool
key object The property key of the property to modify.
descriptor PropertyDescriptor The property value and attributes.
throwOnError bool true to throw an exception if the property could not /// be set. This can happen if the property is not configurable or the object is sealed.
Результат bool

Delete() публичный Метод

Deletes the property with the given name.
public Delete ( object key, bool throwOnError ) : bool
key object The property key of the property to delete.
throwOnError bool true to throw an exception if the property could not /// be set because the property was marked as non-configurable.
Результат bool

Delete() публичный Метод

Deletes the property with the given array index.
public Delete ( uint index, bool throwOnError ) : bool
index uint The array index of the property to delete.
throwOnError bool true to throw an exception if the property could not /// be set because the property was marked as non-configurable.
Результат bool

GetMissingPropertyValue() защищенный Метод

Retrieves the value of a property which doesn't exist on the object. This method can be overridden to effectively construct properties on the fly. The default behavior is to return undefined.
When overriding, call the base class implementation only if you want to revert to the default behavior.
protected GetMissingPropertyValue ( object key ) : object
key object The property key of the missing property.
Результат object

GetOwnPropertyDescriptor() публичный Метод

Gets a descriptor for the property with the given name.
The prototype chain is not searched.
public GetOwnPropertyDescriptor ( object key ) : PropertyDescriptor
key object The property key (either a string or a Symbol).
Результат PropertyDescriptor

GetOwnPropertyDescriptor() публичный Метод

Gets a descriptor for the property with the given array index.
The prototype chain is not searched.
public GetOwnPropertyDescriptor ( uint index ) : PropertyDescriptor
index uint The array index of the property.
Результат PropertyDescriptor

GetPropertyValue() публичный Метод

Gets the value of the property with the given name.
The prototype chain is searched if the property does not exist directly on this object.
public GetPropertyValue ( object key ) : object
key object The property key (either a string or a Symbol).
Результат object

GetPropertyValue() публичный Метод

Gets the value of the property with the given array index.
The prototype chain is searched if the property does not exist directly on this object.
public GetPropertyValue ( uint index ) : object
index uint The array index of the property.
Результат object

HasProperty() публичный Метод

Determines if a property with the given name exists.
public HasProperty ( object key ) : bool
key object The property key (either a string or a Symbol).
Результат bool

InlineGetPropertyValue() публичный Метод

Gets the value of the given property plus the information needed to speed up access to the property in future.
public InlineGetPropertyValue ( string name, int &cachedIndex, object &cacheKey ) : object
name string The name of the property.
cachedIndex int Set to a zero-based index that can be used to get or set the /// property value in future (provided the cache key doesn't change).
cacheKey object Set to a value that can be compared with the CacheKey property /// to determine if the cached index needs to be refreshed. Can be set to null to /// prohibit caching.
Результат object

InlineSetPropertyValue() публичный Метод

Sets the value of the given property plus retrieves the information needed to speed up access to the property in future. If a property with the given name does not exist, or exists in the prototype chain (and is not a setter) then a new property is created.
public InlineSetPropertyValue ( string name, object value, bool throwOnError, int &cachedIndex, object &cacheKey ) : void
name string The name of the property to set.
value object The desired value of the property.
throwOnError bool true to throw an exception if the property could not /// be set (i.e. if the property is read-only or if the object is not extensible and a new /// property needs to be created).
cachedIndex int Set to a zero-based index that can be used to get or set the /// property value in future (provided the cache key doesn't change).
cacheKey object Set to a value that can be compared with the CacheKey property /// to determine if the cached index needs to be refreshed. Can be set to null to /// prohibit caching.
Результат void

InlineSetPropertyValueIfExists() публичный Метод

Sets the value of the given property plus retrieves the information needed to speed up access to the property in future. If a property with the given name exists, but only in the prototype chain, then a new property is created (unless the property is a setter, in which case the setter is called and no property is created). If the property does not exist at all, then no property is created and the method returns false.
public InlineSetPropertyValueIfExists ( string name, object value, bool throwOnError, int &cachedIndex, object &cacheKey ) : bool
name string The name of the property to set.
value object The desired value of the property. This must be a javascript /// primitive (double, string, etc) or a class derived from .
throwOnError bool true to throw an exception if the property could not /// be set (i.e. if the property is read-only or if the object is not extensible and a new /// property needs to be created).
cachedIndex int Set to a zero-based index that can be used to get or set the /// property value in future (provided the cache key doesn't change).
cacheKey object Set to a value that can be compared with the CacheKey property /// to determine if the cached index needs to be refreshed. Can be set to null to /// prohibit caching.
Результат bool

ObjectInstance() защищенный Метод

Called by derived classes to create a new object instance.
protected ObjectInstance ( ObjectInstance prototype ) : System
prototype ObjectInstance The next object in the prototype chain. Cannot be null.
Результат System

ObjectInstance() защищенный Метод

Creates an Object with the default prototype.
protected ObjectInstance ( ScriptEngine engine ) : System
engine ScriptEngine The script engine associated with this object.
Результат System

ObjectInstance() защищенный Метод

Called by derived classes to create a new object instance.
protected ObjectInstance ( ScriptEngine engine, ObjectInstance prototype ) : System
engine ScriptEngine The script engine associated with this object.
prototype ObjectInstance The next object in the prototype chain. Can be null.
Результат System

PopulateFields() защищенный Метод

Populates the object with properties by searching a .NET type for fields marked with the [JSField] attribute. Should be called only once at startup.
protected PopulateFields ( ) : void
Результат void

PopulateFields() защищенный Метод

Populates the object with properties by searching a .NET type for fields marked with the [JSField] attribute. Should be called only once at startup.
protected PopulateFields ( Type type ) : void
type System.Type The type to search for fields.
Результат void

PopulateFunctions() защищенный Метод

Populates the object with functions by searching a .NET type for methods marked with the [JSFunction] attribute. Should be called only once at startup. Also automatically populates properties marked with the [JSProperty] attribute.
protected PopulateFunctions ( ) : void
Результат void

PopulateFunctions() защищенный Метод

Populates the object with functions by searching a .NET type for methods marked with the [JSFunction] attribute. Should be called only once at startup. Also automatically populates properties marked with the [JSProperty] attribute.
protected PopulateFunctions ( Type type ) : void
type System.Type The type to search for methods.
Результат void

PopulateFunctions() защищенный Метод

Populates the object with functions by searching a .NET type for methods marked with the [JSFunction] attribute. Should be called only once at startup. Also automatically populates properties marked with the [JSProperty] attribute.
protected PopulateFunctions ( Type type, BindingFlags bindingFlags ) : void
type System.Type The type to search for methods.
bindingFlags BindingFlags The binding flags to use to search for properties and methods.
Результат void

SetPropertyValue() публичный Метод

Sets the value of the property with the given name. If a property with the given name does not exist, or exists in the prototype chain (and is not a setter) then a new property is created.
public SetPropertyValue ( object key, object value, bool throwOnError ) : void
key object The property key of the property to set.
value object The value to set the property to. This must be a javascript /// primitive (double, string, etc) or a class derived from .
throwOnError bool true to throw an exception if the property could not /// be set (i.e. if the property is read-only or if the object is not extensible and a new /// property needs to be created).
Результат void

SetPropertyValue() публичный Метод

Sets the value of the property with the given array index. If a property with the given index does not exist, or exists in the prototype chain (and is not a setter) then a new property is created.
public SetPropertyValue ( uint index, object value, bool throwOnError ) : void
index uint The array index of the property to set.
value object The value to set the property to. This must be a javascript /// primitive (double, string, etc) or a class derived from .
throwOnError bool true to throw an exception if the property could not /// be set. This can happen if the property is read-only or if the object is sealed.
Результат void

SetPropertyValueIfExists() публичный Метод

Sets the value of the given property. If a property with the given name exists, but only in the prototype chain, then a new property is created (unless the property is a setter, in which case the setter is called and no property is created). If the property does not exist at all, then no property is created and the method returns false. This method is used to set the value of a variable reference within a with statement.
public SetPropertyValueIfExists ( object key, object value, bool throwOnError ) : bool
key object The property key (either a string or a Symbol). Cannot be an array index.
value object The desired value of the property. This must be a javascript /// primitive (double, string, etc) or a class derived from .
throwOnError bool true to throw an exception if the property could not /// be set (i.e. if the property is read-only or if the object is not extensible and a new /// property needs to be created).
Результат bool

ToString() публичный Метод

Returns a string representing this object.
public ToString ( ) : string
Результат string

TryCallMemberFunction() публичный Метод

Calls the function with the given name.
public TryCallMemberFunction ( object &result, object key ) : bool
result object The result of calling the function.
key object The name or symbol of the function to call.
Результат bool

this() публичный Метод

Gets or sets the value of an array-indexed property.
public this ( int index ) : object
index int The index of the property to retrieve.
Результат object

this() публичный Метод

Gets or sets the value of a named property.
public this ( object key ) : object
key object The property key (either a string or a Symbol).
Результат object

this() публичный Метод

Gets or sets the value of an array-indexed property.
public this ( uint index ) : object
index uint The index of the property to retrieve.
Результат object