blob: ef1f47077e5821a135c0300479694c4592459e87 (
plain) (
blame)
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
|
// license:BSD-3-Clause
// copyright-holders:Couriersud
#include "pmain.h"
namespace plib {
app::app()
: std_out(&std::cout)
, std_err(&std::cerr)
{
}
int app::main_utfX(const std::vector<putf8string> &argv)
{
auto r = this->parse(argv);
if (r != argv.size())
{
this->std_err("Error parsing {}\n", argv[r]);
this->std_err(this->usage_short());
return 1;
}
return this->execute();
}
int app::main_utfX(int argc, char *argv[])
{
std::vector<putf8string> arg;
for (std::size_t i = 0; i < narrow_cast<std::size_t>(argc); i++)
arg.emplace_back(putf8string(argv[i]));
return main_utfX(arg);
}
int app::main_utfX(int argc, wchar_t *argv[])
{
std::vector<putf8string> arg;
for (std::size_t i = 0; i < narrow_cast<std::size_t>(argc); i++)
arg.emplace_back(putf8string(pwstring(argv[i])));
return main_utfX(arg);
}
} // namespace plib
|