node-pdfutils
PdfEngineFactory.h
1 /*
2  * PdfEngineFactory.h
3  * Copyright (C) 2014 tox <tox@rootkit>
4  *
5  * Distributed under terms of the MIT license.
6  */
7 
8 #ifndef PDFENGINEFACTORY_H
9 #define PDFENGINEFACTORY_H
10 
11 #include <v8.h>
12 #include <nan.h>
13 #include <node.h>
14 #include <node_object_wrap.h>
15 #include "PdfEngine.h"
16 
17 #define PDF_ENGINE(n, cls, ...) \
18 PdfEngine *n ## _newInstance() { \
19  return new cls (); \
20 } \
21 void n ## _init__(v8::Handle<v8::Object> exports) { \
22  cls ::Init(); \
23  new PdfEngineFactory(exports, #n, n ## _newInstance, __VA_ARGS__); \
24 } \
25 NODE_MODULE(n ## Engine, n ## _init__)
26 
27 typedef PdfEngine *(*PdfEngineInit)(void);
28 
35 class PdfEngineFactory : public node::ObjectWrap {
36 private:
37  PdfEngineInit init;
38 public:
39  PdfEngineFactory(v8::Handle<v8::Object> &exports,
40  const char *name,
41  const PdfEngineInit pdfInit,
42  // Macro args:
43  const char *license);
44 
45  PdfEngine *newInstance();
46 };
47 
48 #endif /* !PDFENGINEFACTORY_H */
Factory Class for PDF Engines.
Definition: PdfEngineFactory.h:35
Base Class for interaction with a PDF-Engine such as Poppler.
Definition: PdfEngine.h:38