Merge XFA to PDFium master at 4dc95e7 on 10/28/2014
[pdfium.git] / xfa / src / fxjse / src / class.h
1 // Copyright 2014 PDFium Authors. All rights reserved.\r
2 // Use of this source code is governed by a BSD-style license that can be\r
3 // found in the LICENSE file.\r
4 \r
5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com\r
6 \r
7 #ifndef FXJSE_CLASS_H_\r
8 #define FXJSE_CLASS_H_\r
9 class CFXJSE_Context;\r
10 class CFXJSE_Value;\r
11 class CFXJSE_Class : public CFX_Object\r
12 {\r
13 protected:\r
14     CFXJSE_Class(CFXJSE_Context* lpContext) : m_pContext(lpContext) {}\r
15 public:\r
16     inline CFXJSE_Context* GetContext()\r
17     {\r
18         return m_pContext;\r
19     }\r
20     inline v8::Persistent<v8::FunctionTemplate>& GetTemplate()\r
21     {\r
22         return m_hTemplate;\r
23     }\r
24 public:\r
25     static CFXJSE_Class* Create(CFXJSE_Context* pContext, const FXJSE_CLASS* lpClassDefintion, FX_BOOL bIsJSGlobal = FALSE);\r
26     static CFXJSE_Class* GetClassFromContext(CFXJSE_Context* pContext, FX_BSTR szName);\r
27     static void SetUpDynPropHandler(CFXJSE_Context* pContext, CFXJSE_Value* pValue, const FXJSE_CLASS* lpClassDefinition);\r
28     static void SetUpNamedPropHandler(v8::Isolate* pIsolate, v8::Local<v8::ObjectTemplate>& hObjectTemplate, const FXJSE_CLASS* lpClassDefinition);\r
29 protected:\r
30     CFX_ByteString                                                      m_szClassName;\r
31     CFXJSE_Context*                                                     m_pContext;\r
32     v8::Persistent<v8::FunctionTemplate>        m_hTemplate;\r
33     friend class CFXJSE_Context;\r
34     friend class CFXJSE_Value;\r
35 };\r
36 struct CFXJSE_ArgumentsImpl {\r
37     const v8::FunctionCallbackInfo<v8::Value>*  m_pInfo;\r
38     CFXJSE_Value*                                                               m_pRetValue;\r
39 };\r
40 #endif\r