blob: 51e1981d03fc667de3d7947353ded916321a3ce4 [file] [log] [blame]
Dan Sinclair3a8051c2016-03-15 15:42:31 -04001// 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
dsinclair43554682016-09-29 17:29:48 -07007#ifndef FXJS_CFXJSE_ARGUMENTS_H_
8#define FXJS_CFXJSE_ARGUMENTS_H_
Dan Sinclair3a8051c2016-03-15 15:42:31 -04009
dsinclair769b1372016-06-08 13:12:41 -070010#include <memory>
11
dsinclair43554682016-09-29 17:29:48 -070012#include "fxjs/fxjse.h"
Dan Sinclair3a8051c2016-03-15 15:42:31 -040013
dsinclair769b1372016-06-08 13:12:41 -070014class CFXJSE_Class;
15
Dan Sinclair3a8051c2016-03-15 15:42:31 -040016class CFXJSE_Arguments {
17 public:
tsepez4ee98cd2016-06-01 16:58:24 -070018 CFXJSE_Arguments(const v8::FunctionCallbackInfo<v8::Value>* pInfo,
19 CFXJSE_Value* pRetValue)
20 : m_pInfo(pInfo), m_pRetValue(pRetValue) {}
21
dsinclairec3da5b2016-05-25 16:42:05 -070022 v8::Isolate* GetRuntime() const;
Dan Sinclair3a8051c2016-03-15 15:42:31 -040023 int32_t GetLength() const;
dsinclair86fad992016-05-31 11:34:04 -070024 std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const;
tsepez304bb912016-11-03 06:10:26 -070025 bool GetBoolean(int32_t index) const;
Dan Sinclair3a8051c2016-03-15 15:42:31 -040026 int32_t GetInt32(int32_t index) const;
27 FX_FLOAT GetFloat(int32_t index) const;
28 CFX_ByteString GetUTF8String(int32_t index) const;
tsepez2334e9e2016-06-09 09:32:44 -070029 CFXJSE_HostObject* GetObject(int32_t index,
30 CFXJSE_Class* pClass = nullptr) const;
dsinclair12a6b0c2016-05-26 11:14:08 -070031 CFXJSE_Value* GetReturnValue();
tsepez4ee98cd2016-06-01 16:58:24 -070032
33 private:
34 const v8::FunctionCallbackInfo<v8::Value>* m_pInfo;
35 CFXJSE_Value* m_pRetValue;
Dan Sinclair3a8051c2016-03-15 15:42:31 -040036};
37
dsinclair43554682016-09-29 17:29:48 -070038#endif // FXJS_CFXJSE_ARGUMENTS_H_