Home | History | Annotate | Download | only in fxjs
      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 
      7 #ifndef FXJS_CFXJSE_ARGUMENTS_H_
      8 #define FXJS_CFXJSE_ARGUMENTS_H_
      9 
     10 #include <memory>
     11 
     12 #include "fxjs/fxjse.h"
     13 
     14 class CFXJSE_Class;
     15 
     16 class CFXJSE_Arguments {
     17  public:
     18   CFXJSE_Arguments(const v8::FunctionCallbackInfo<v8::Value>* pInfo,
     19                    CFXJSE_Value* pRetValue)
     20       : m_pInfo(pInfo), m_pRetValue(pRetValue) {}
     21 
     22   v8::Isolate* GetRuntime() const;
     23   int32_t GetLength() const;
     24   std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const;
     25   bool GetBoolean(int32_t index) const;
     26   int32_t GetInt32(int32_t index) const;
     27   FX_FLOAT GetFloat(int32_t index) const;
     28   CFX_ByteString GetUTF8String(int32_t index) const;
     29   CFXJSE_HostObject* GetObject(int32_t index,
     30                                CFXJSE_Class* pClass = nullptr) const;
     31   CFXJSE_Value* GetReturnValue();
     32 
     33  private:
     34   const v8::FunctionCallbackInfo<v8::Value>* m_pInfo;
     35   CFXJSE_Value* m_pRetValue;
     36 };
     37 
     38 #endif  // FXJS_CFXJSE_ARGUMENTS_H_
     39