OLD | NEW |
---|---|
1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
6 | 6 |
7 #ifndef XFA_FXJSE_VALUE_H_ | 7 #ifndef XFA_FXJSE_VALUE_H_ |
8 #define XFA_FXJSE_VALUE_H_ | 8 #define XFA_FXJSE_VALUE_H_ |
9 | 9 |
10 #include "xfa/fxjse/scope_inline.h" | 10 #include "xfa/fxjse/scope_inline.h" |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
44 } while (iErrPosMin < iErrPosMax); | 44 } while (iErrPosMin < iErrPosMax); |
45 iErrPos = iErrPosMax; | 45 iErrPos = iErrPosMax; |
46 } | 46 } |
47 double dPow = pow(10.0, iErrPos); | 47 double dPow = pow(10.0, iErrPos); |
48 return fNumber < 0 ? ceil(dNumber * dPow - 0.5) / dPow | 48 return fNumber < 0 ? ceil(dNumber * dPow - 0.5) / dPow |
49 : floor(dNumber * dPow + 0.5) / dPow; | 49 : floor(dNumber * dPow + 0.5) / dPow; |
50 } | 50 } |
51 | 51 |
52 class CFXJSE_Value { | 52 class CFXJSE_Value { |
53 public: | 53 public: |
54 static FX_BOOL IsUndefined(CFXJSE_Value* pValue); | |
Tom Sepez
2016/06/08 17:08:11
why static? To handle nullptr? Is the nullptr so
dsinclair
2016/06/08 19:44:30
Done.
| |
55 static FX_BOOL IsNull(CFXJSE_Value* pValue); | |
56 static FX_BOOL IsBoolean(CFXJSE_Value* pValue); | |
57 static FX_BOOL IsUTF8String(CFXJSE_Value* pValue); | |
58 static FX_BOOL IsNumber(CFXJSE_Value* pValue); | |
59 static FX_BOOL IsObject(CFXJSE_Value* pValue); | |
60 static FX_BOOL IsArray(CFXJSE_Value* pValue); | |
61 static FX_BOOL IsFunction(CFXJSE_Value* pValue); | |
62 | |
54 CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} | 63 CFXJSE_Value(v8::Isolate* pIsolate) : m_pIsolate(pIsolate) {} |
55 | 64 |
56 V8_INLINE FX_BOOL IsUndefined() const { | 65 V8_INLINE FX_BOOL IsUndefined() const { |
57 if (m_hValue.IsEmpty()) { | 66 if (m_hValue.IsEmpty()) { |
58 return FALSE; | 67 return FALSE; |
59 } | 68 } |
60 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); | 69 CFXJSE_ScopeUtil_IsolateHandle scope(m_pIsolate); |
61 v8::Local<v8::Value> hValue = | 70 v8::Local<v8::Value> hValue = |
62 v8::Local<v8::Value>::New(m_pIsolate, m_hValue); | 71 v8::Local<v8::Value>::New(m_pIsolate, m_hValue); |
63 return hValue->IsUndefined(); | 72 return hValue->IsUndefined(); |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
272 | 281 |
273 CFXJSE_Value(); | 282 CFXJSE_Value(); |
274 CFXJSE_Value(const CFXJSE_Value&); | 283 CFXJSE_Value(const CFXJSE_Value&); |
275 CFXJSE_Value& operator=(const CFXJSE_Value&); | 284 CFXJSE_Value& operator=(const CFXJSE_Value&); |
276 | 285 |
277 v8::Isolate* m_pIsolate; | 286 v8::Isolate* m_pIsolate; |
278 v8::Global<v8::Value> m_hValue; | 287 v8::Global<v8::Value> m_hValue; |
279 }; | 288 }; |
280 | 289 |
281 #endif // XFA_FXJSE_VALUE_H_ | 290 #endif // XFA_FXJSE_VALUE_H_ |
OLD | NEW |