1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 |
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 | #include "PDFIntegerDriver.h"
|
21 | #include "RefCountPtr.h"
|
22 | #include "ConstructorsHolder.h"
|
23 | using namespace v8;
|
24 |
|
25 |
|
26 |
|
27 | DEF_SUBORDINATE_INIT(PDFIntegerDriver::Init)
|
28 | {
|
29 | CREATE_ISOLATE_CONTEXT;
|
30 |
|
31 | Local<FunctionTemplate> t = NEW_FUNCTION_TEMPLATE_EXTERNAL(New);
|
32 |
|
33 | t->SetClassName(NEW_STRING("PDFInteger"));
|
34 | t->InstanceTemplate()->SetInternalFieldCount(1);
|
35 |
|
36 | SET_ACCESSOR_METHOD(t, "value", GetValue);
|
37 | PDFObjectDriver::Init(t);
|
38 |
|
39 | EXPOSE_EXTERNAL_FOR_INIT(ConstructorsHolder, holder)
|
40 | SET_CONSTRUCTOR(holder->PDFInteger_constructor, t);
|
41 | SET_CONSTRUCTOR_TEMPLATE(holder->PDFInteger_constructor_template, t);
|
42 | }
|
43 |
|
44 | METHOD_RETURN_TYPE PDFIntegerDriver::New(const ARGS_TYPE& args)
|
45 | {
|
46 | CREATE_ISOLATE_CONTEXT;
|
47 | CREATE_ESCAPABLE_SCOPE;
|
48 | EXPOSE_EXTERNAL_ARGS(ConstructorsHolder, externalHolder)
|
49 | PDFIntegerDriver* driver = new PDFIntegerDriver();
|
50 | driver->holder = externalHolder;
|
51 | driver->Wrap(args.This());
|
52 | SET_FUNCTION_RETURN_VALUE( args.This())
|
53 | }
|
54 |
|
55 | PDFObject* PDFIntegerDriver::GetObject()
|
56 | {
|
57 | return TheObject.GetPtr();
|
58 | }
|
59 |
|
60 | METHOD_RETURN_TYPE PDFIntegerDriver::GetValue(Local<String> property, const PROPERTY_TYPE &info)
|
61 | {
|
62 | CREATE_ISOLATE_CONTEXT;
|
63 | CREATE_ESCAPABLE_SCOPE;
|
64 |
|
65 | Local<Number> result = NEW_NUMBER(ObjectWrap::Unwrap<PDFIntegerDriver>(info.Holder())->TheObject->GetValue());
|
66 | SET_ACCESSOR_RETURN_VALUE(result)
|
67 | }
|
68 |
|
69 |
|