• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 #ifndef FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_JERRYSCRIPT_NATIVE_VALUE_JERRYSCRIPT_NATIVE_VALUE_H
17 #define FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_JERRYSCRIPT_NATIVE_VALUE_JERRYSCRIPT_NATIVE_VALUE_H
18 
19 #include "jerryscript_headers.h"
20 
21 #include "native_engine/native_value.h"
22 
23 #include "jerryscript_native_engine.h"
24 
25 class JerryScriptNativeValue : public NativeValue {
26 public:
27     JerryScriptNativeValue(JerryScriptNativeEngine* engine, jerry_value_t value);
28     virtual ~JerryScriptNativeValue() override;
29 
30     void* GetInterface(const int interfaceId) override;
31 
32     virtual NativeValueType TypeOf() override;
33     virtual bool InstanceOf(NativeValue* obj) override;
34 
35     virtual bool IsArray() override;
36     virtual bool IsArrayBuffer() override;
37     virtual bool IsBuffer() override;
38     virtual bool IsDate() override;
39     virtual bool IsError() override;
40     virtual bool IsTypedArray() override;
41     virtual bool IsDataView() override;
42     virtual bool IsPromise() override;
IsCallable()43     virtual bool IsCallable() override { return false; }
44 
45     virtual bool IsMapIterator() override;
46     virtual bool IsSetIterator() override;
47     virtual bool IsGeneratorObject() override;
48     virtual bool IsModuleNamespaceObject() override;
49     virtual bool IsProxy() override;
50     virtual bool IsRegExp() override;
51     virtual bool IsNumberObject() override;
52     virtual bool IsMap() override;
53     virtual bool IsSet() override;
54     virtual bool IsKeyObject() override;
55     virtual bool IsArgumentsObject() override;
56     virtual bool IsAsyncFunction() override;
57     virtual bool IsBooleanObject() override;
58     virtual bool IsCryptoKey() override;
59     virtual bool IsGeneratorFunction() override;
60     virtual bool IsSharedArrayBuffer() override;
61     virtual bool IsStringObject() override;
62     virtual bool IsSymbolObject() override;
63     virtual bool IsWeakMap() override;
64     virtual bool IsWeakSet() override;
65 
66     virtual NativeValue* ToBoolean() override;
67     virtual NativeValue* ToNumber() override;
68     virtual NativeValue* ToString() override;
69     virtual NativeValue* ToObject() override;
70 
71     virtual bool StrictEquals(NativeValue* value) override;
72 
73 protected:
74     JerryScriptNativeEngine* engine_;
75 };
76 
77 #endif /* FOUNDATION_ACE_NAPI_NATIVE_ENGINE_IMPL_JERRYSCRIPT_NATIVE_VALUE_JERRYSCRIPT_NATIVE_VALUE_H */
78