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 "core/fxcrt/unowned_ptr.h"
     13 #include "fxjs/cfxjse_class.h"
     14 #include "fxjs/fxjse.h"
     15 
     16 class CFXJSE_Arguments {
     17  public:
     18   CFXJSE_Arguments(const v8::FunctionCallbackInfo<v8::Value>* pInfo,
     19                    CFXJSE_Value* pRetValue);
     20   ~CFXJSE_Arguments();
     21 
     22   int32_t GetLength() const;
     23   std::unique_ptr<CFXJSE_Value> GetValue(int32_t index) const;
     24   bool GetBoolean(int32_t index) const;
     25   int32_t GetInt32(int32_t index) const;
     26   float GetFloat(int32_t index) const;
     27   ByteString GetUTF8String(int32_t index) const;
     28   CFXJSE_HostObject* GetObject(int32_t index,
     29                                CFXJSE_Class* pClass = nullptr) const;
     30   CFXJSE_Value* GetReturnValue() const;
     31 
     32  private:
     33   const v8::FunctionCallbackInfo<v8::Value>* m_pInfo;
     34   UnownedPtr<CFXJSE_Value> m_pRetValue;
     35 };
     36 
     37 #endif  // FXJS_CFXJSE_ARGUMENTS_H_
     38