Qt
Internal/Contributor docs for the Qt SDK. Note: These are NOT official API docs; those are found at https://doc.qt.io/
Loading...
Searching...
No Matches
cjs_object.cpp
Go to the documentation of this file.
1// Copyright 2014 The PDFium Authors
2// Use of this source code is governed by a BSD-style license that can be
3// found in the LICENSE file.
4
5// Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com
6
7#include "fxjs/cjs_object.h"
8
9#include "fxjs/cfxjs_engine.h"
10
11// static
13 uint32_t nObjDefnID,
14 pdfium::span<const JSConstSpec> consts) {
15 for (const auto& item : consts) {
16 pEngine->DefineObjConst(
17 nObjDefnID, item.pName,
18 item.eType == JSConstSpec::Number
19 ? pEngine->NewNumber(item.number).As<v8::Value>()
20 : pEngine->NewString(item.pStr).As<v8::Value>());
21 }
22}
23
24// static
26 uint32_t nObjDefnID,
27 pdfium::span<const JSPropertySpec> props) {
28 for (const auto& item : props)
29 pEngine->DefineObjProperty(nObjDefnID, item.pName, item.pPropGet,
30 item.pPropPut);
31}
32
33// static
35 uint32_t nObjDefnID,
36 pdfium::span<const JSMethodSpec> methods) {
37 for (const auto& item : methods)
38 pEngine->DefineObjMethod(nObjDefnID, item.pName, item.pMethodCall);
39}
40
41CJS_Object::CJS_Object(v8::Local<v8::Object> pObject, CJS_Runtime* pRuntime)
43
44CJS_Object::~CJS_Object() = default;
static void DefineProps(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSPropertySpec > consts)
static void DefineConsts(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSConstSpec > consts)
virtual ~CJS_Object()
CJS_Object(v8::Local< v8::Object > pObject, CJS_Runtime *pRuntime)
static void DefineMethods(CFXJS_Engine *pEngine, uint32_t nObjDefnID, pdfium::span< const JSMethodSpec > consts)