Debian Codegraph @

podofo/tools/private/MainEntryPoint.cpp

raw symbols SCIP
1 #include <vector>
2 #include <string>
3 #include <iostream>
4
5 #include <utf8cpp/utf8.h>
6 #include <podofo/auxiliary/span.hpp>
7 #include <podofo/main/PdfError.h>
8
9 using namespace std;
10 using namespace PoDoFo;
11
12 extern void Main(const cspan<string_view>& args);
13
14 #ifdef _WIN32
15 int wmain(int argc, wchar_t* argv[])
16 #else // !_WIN32
17 int main(int argc, char* argv[])
18 #endif // _WIN32
19 {
20 vector<string_view> args(argc);
21 #ifdef _WIN32
22 vector<string> args_(argc);
23 for (int i = 0; i < argc; i++)
24 {
25 args_[i] = utf8::utf16to8(u16string_view((const char16_t*)argv[i],
26 char_traits<char16_t>::length((const char16_t*)argv[i])));
27 args[i] = args_[i];
28 }
29 #else // !_WIN32
30 for (int i = 0; i < argc; i++)
31 args[i] = string_view(argv[i], char_traits<char>::length(argv[i]));
32 #endif // _WIN32
33 try
34 {
35 Main(args);
36 }
37 catch (const PdfError& ex)
38 {
39 cerr << "ERROR: An error ocurred during processing the pdf file" << endl;
40 cerr << ex.what() << endl;
41 return (int)ex.GetCode();
42 }
43
44 return 0;
45 }