-
Notifications
You must be signed in to change notification settings - Fork 32
/
Copy pathCommon.h
78 lines (55 loc) · 1.65 KB
/
Common.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
#ifndef COMMON_H_
#define COMMON_H_
#include "include/internal/cef_types.h"
#include <string>
#include <list>
#include <chrono>
namespace cefpdf {
std::string getCurrentWorkingDirectory();
std::string getTempDirectory();
namespace constants {
// cef-pdf version number
const std::string version = "0.3.0";
// Internal scheme
const std::string scheme = "cefpdf";
// Default page size
const std::string pageSize = "A4";
// Default character encoding
const std::string encoding = "utf-8";
// Max number of concurrent processes (browsers)
const int maxProcesses = 10;
// Default host name
const std::string serverHost = "127.0.0.1";
// Default TCP server port
const std::string serverPort = "9288";
// Current working directory
const std::string cwd = getCurrentWorkingDirectory();
// Temp directory including trailing slash
const std::string temp = getTempDirectory();
}
struct PageSize
{
std::string name;
int width, height;
};
typedef cef_pdf_print_margin_type_t PageMarginType;
struct PageMargin
{
PageMarginType type;
int top, right, bottom, left;
};
enum struct PageOrientation {
PORTRAIT, LANDSCAPE
};
typedef std::list<PageSize> PageSizesMap;
extern PageSizesMap pageSizesMap;
std::string strtolower(std::string s);
PageSize getPageSize(const CefString& str);
PageMargin getPageMargin(const CefString& str);
std::chrono::microseconds::rep microtime();
std::string pathToUri(const std::string&);
std::string reserveTempFile();
std::string loadTempFile(const std::string&, bool remove = true);
bool deleteTempFile(const std::string&);
} // namespace cefpdf
#endif // COMMON_H_