Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 1 | // Copyright 2016 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 | |
dsinclair | 4355468 | 2016-09-29 17:29:48 -0700 | [diff] [blame] | 7 | #ifndef FXJS_CFXJSE_ARGUMENTS_H_ |
| 8 | #define FXJS_CFXJSE_ARGUMENTS_H_ |
Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 9 | |
dsinclair | 769b137 | 2016-06-08 13:12:41 -0700 | [diff] [blame] | 10 | #include <memory> |
| 11 | |
dsinclair | 4355468 | 2016-09-29 17:29:48 -0700 | [diff] [blame] | 12 | #include "fxjs/fxjse.h" |
Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 13 | |
dsinclair | 769b137 | 2016-06-08 13:12:41 -0700 | [diff] [blame] | 14 | class CFXJSE_Class; |
| 15 | |
Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 16 | class CFXJSE_Arguments { |
| 17 | public: |
tsepez | 4ee98cd | 2016-06-01 16:58:24 -0700 | [diff] [blame] | 18 | CFXJSE_Arguments(const v8::FunctionCallbackInfo<v8::Value>* pInfo, |
| 19 | CFXJSE_Value* pRetValue) |
| 20 | : m_pInfo(pInfo), m_pRetValue(pRetValue) {} |
| 21 | |
dsinclair | ec3da5b | 2016-05-25 16:42:05 -0700 | [diff] [blame] | 22 | v8::Isolate* GetRuntime() const; |
Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 23 | int32_t GetLength() const; |
dsinclair | 86fad99 | 2016-05-31 11:34:04 -0700 | [diff] [blame] | 24 | std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const; |
tsepez | 304bb91 | 2016-11-03 06:10:26 -0700 | [diff] [blame] | 25 | bool GetBoolean(int32_t index) const; |
Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 26 | int32_t GetInt32(int32_t index) const; |
| 27 | FX_FLOAT GetFloat(int32_t index) const; |
| 28 | CFX_ByteString GetUTF8String(int32_t index) const; |
tsepez | 2334e9e | 2016-06-09 09:32:44 -0700 | [diff] [blame] | 29 | CFXJSE_HostObject* GetObject(int32_t index, |
| 30 | CFXJSE_Class* pClass = nullptr) const; |
dsinclair | 12a6b0c | 2016-05-26 11:14:08 -0700 | [diff] [blame] | 31 | CFXJSE_Value* GetReturnValue(); |
tsepez | 4ee98cd | 2016-06-01 16:58:24 -0700 | [diff] [blame] | 32 | |
| 33 | private: |
| 34 | const v8::FunctionCallbackInfo<v8::Value>* m_pInfo; |
| 35 | CFXJSE_Value* m_pRetValue; |
Dan Sinclair | 3a8051c | 2016-03-15 15:42:31 -0400 | [diff] [blame] | 36 | }; |
| 37 | |
dsinclair | 4355468 | 2016-09-29 17:29:48 -0700 | [diff] [blame] | 38 | #endif // FXJS_CFXJSE_ARGUMENTS_H_ |