Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1039)

Side by Side Diff: fxjs/include/cfxjse_value.h

Issue 2380713005: Move fxjs/include to fxjs (Closed)
Patch Set: Rebase to master Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « fxjs/include/cfxjse_context.h ('k') | fxjs/include/fxjs_v8.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 PDFium Authors. All rights reserved.
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 #ifndef FXJS_INCLUDE_CFXJSE_VALUE_H_
8 #define FXJS_INCLUDE_CFXJSE_VALUE_H_
9
10 #include "v8/include/v8.h"
11
12 #include "core/fxcrt/fx_string.h"
13 #include "core/fxcrt/fx_system.h"
14 #include "fxjs/cfxjse_isolatetracker.h"
15 #include "fxjs/cfxjse_runtimedata.h"
16
17 class CFXJSE_Class;
18 class CFXJSE_HostObject;
19
20 class CFXJSE_Value {
21 public:
22 explicit CFXJSE_Value(v8::Isolate* pIsolate);
23 ~CFXJSE_Value();
24
25 FX_BOOL IsUndefined() const;
26 FX_BOOL IsNull() const;
27 FX_BOOL IsBoolean() const;
28 FX_BOOL IsString() const;
29 FX_BOOL IsNumber() const;
30 FX_BOOL IsInteger() const;
31 FX_BOOL IsObject() const;
32 FX_BOOL IsArray() const;
33 FX_BOOL IsFunction() const;
34 FX_BOOL IsDate() const;
35 FX_BOOL ToBoolean() const;
36 FX_FLOAT ToFloat() const;
37 double ToDouble() const;
38 int32_t ToInteger() const;
39 CFX_ByteString ToString() const;
40 CFX_WideString ToWideString() const {
41 return CFX_WideString::FromUTF8(ToString().AsStringC());
42 }
43 CFXJSE_HostObject* ToHostObject(CFXJSE_Class* lpClass) const;
44
45 void SetUndefined();
46 void SetNull();
47 void SetBoolean(FX_BOOL bBoolean);
48 void SetInteger(int32_t nInteger);
49 void SetDouble(double dDouble);
50 void SetString(const CFX_ByteStringC& szString);
51 void SetFloat(FX_FLOAT fFloat);
52 void SetJSObject();
53
54 void SetObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* pClass);
55 void SetHostObject(CFXJSE_HostObject* lpObject, CFXJSE_Class* lpClass);
56 void SetArray(uint32_t uValueCount, CFXJSE_Value** rgValues);
57 void SetDate(double dDouble);
58
59 FX_BOOL GetObjectProperty(const CFX_ByteStringC& szPropName,
60 CFXJSE_Value* lpPropValue);
61 FX_BOOL SetObjectProperty(const CFX_ByteStringC& szPropName,
62 CFXJSE_Value* lpPropValue);
63 FX_BOOL GetObjectPropertyByIdx(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
64 FX_BOOL SetObjectProperty(uint32_t uPropIdx, CFXJSE_Value* lpPropValue);
65 FX_BOOL DeleteObjectProperty(const CFX_ByteStringC& szPropName);
66 FX_BOOL HasObjectOwnProperty(const CFX_ByteStringC& szPropName,
67 FX_BOOL bUseTypeGetter);
68 FX_BOOL SetObjectOwnProperty(const CFX_ByteStringC& szPropName,
69 CFXJSE_Value* lpPropValue);
70 FX_BOOL SetFunctionBind(CFXJSE_Value* lpOldFunction, CFXJSE_Value* lpNewThis);
71 FX_BOOL Call(CFXJSE_Value* lpReceiver,
72 CFXJSE_Value* lpRetValue,
73 uint32_t nArgCount,
74 CFXJSE_Value** lpArgs);
75
76 v8::Isolate* GetIsolate() const { return m_pIsolate; }
77 const v8::Global<v8::Value>& DirectGetValue() const { return m_hValue; }
78 void ForceSetValue(v8::Local<v8::Value> hValue) {
79 m_hValue.Reset(m_pIsolate, hValue);
80 }
81 void Assign(const CFXJSE_Value* lpValue) {
82 ASSERT(lpValue);
83 if (lpValue) {
84 m_hValue.Reset(m_pIsolate, lpValue->m_hValue);
85 } else {
86 m_hValue.Reset();
87 }
88 }
89
90 private:
91 friend class CFXJSE_Class;
92 friend class CFXJSE_Context;
93
94 CFXJSE_Value();
95 CFXJSE_Value(const CFXJSE_Value&);
96 CFXJSE_Value& operator=(const CFXJSE_Value&);
97
98 v8::Isolate* m_pIsolate;
99 v8::Global<v8::Value> m_hValue;
100 };
101
102 #endif // FXJS_INCLUDE_CFXJSE_VALUE_H_
OLDNEW
« no previous file with comments | « fxjs/include/cfxjse_context.h ('k') | fxjs/include/fxjs_v8.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698