// Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT license. #pragma once //----------------------------------------------------------------------------- // V8ObjectHelpers //----------------------------------------------------------------------------- struct V8ObjectHelpers final: StaticBase { static V8Value GetProperty(const SharedPtr& spHolder, const StdString& name); static void SetProperty(const SharedPtr& spHolder, const StdString& name, const V8Value& value); static bool DeleteProperty(const SharedPtr& spHolder, const StdString& name); static void GetPropertyNames(const SharedPtr& spHolder, std::vector& names); static V8Value GetProperty(const SharedPtr& spHolder, int index); static void SetProperty(const SharedPtr& spHolder, int index, const V8Value& value); static bool DeleteProperty(const SharedPtr& spHolder, int index); static void GetPropertyIndices(const SharedPtr& spHolder, std::vector& indices); static V8Value Invoke(const SharedPtr& spHolder, bool asConstructor, const std::vector& args); static V8Value InvokeMethod(const SharedPtr& spHolder, const StdString& name, const std::vector& args); typedef void ArrayBufferOrViewDataCallback(void* pvData, void* pvArg); static void GetArrayBufferOrViewInfo(const SharedPtr& spHolder, V8Value& arrayBuffer, size_t& offset, size_t& size, size_t& length); static void InvokeWithArrayBufferOrViewData(const SharedPtr& spHolder, ArrayBufferOrViewDataCallback* pCallback, void* pvArg); };