Lolly
1.4.28
Loading...
Searching...
No Matches
lolly
system
args.cpp
Go to the documentation of this file.
1
2
/******************************************************************************
3
* MODULE : args.cpp
4
* DESCRIPTION: lolly::system::args like nowide::args
5
* COPYRIGHT : (C) 2024 Darcy Shen
6
*******************************************************************************
7
* This software falls under the GNU general public license version 3 or later.
8
* It comes WITHOUT ANY WARRANTY WHATSOEVER. For details, see the file LICENSE
9
* in the root directory or <http://www.gnu.org/licenses/gpl-3.0.html>.
10
******************************************************************************/
11
12
#include "
args.hpp
"
13
#include "
lolly/data/unicode.hpp
"
14
#include "
string.hpp
"
15
16
#if defined(OS_WIN) || defined(OS_MINGW)
17
#include <windows.h>
18
#endif
19
#include <stdio.h>
20
#if defined(OS_WIN) || defined(OS_MINGW)
21
#include <shellapi.h>
22
#endif
23
24
#if defined(OS_MINGW) || defined(OS_WIN)
25
using
lolly::data::wchar_to_utf8;
26
#endif
27
28
namespace
lolly
{
29
namespace
system {
30
#if defined(OS_WIN) || defined(OS_MINGW)
31
void
32
args::fix_args (
int
&
argc
,
char
**&
argv
) {
33
int
wargc
;
34
wchar_t
**
wargv
=
CommandLineToArgvW
(
GetCommandLineW
(), &
wargc
);
35
if
(!
wargv
) {
36
argc
= 0;
37
static
char
*
dummy
= 0;
38
argv
= &
dummy
;
39
return
;
40
}
41
try
{
42
args_
.resize (
wargc
+ 1, 0);
43
arg_values_
.resize (
wargc
);
44
for
(
int
i= 0; i <
wargc
; i++) {
45
arg_values_
[i]= wchar_to_utf8 (
wargv
[i]);
46
args_
[i] =
as_charp
(
arg_values_
[i]);
47
}
48
argc
=
wargc
;
49
argv
= &
args_
[0];
50
}
catch
(...) {
51
LocalFree
(
wargv
);
52
throw
;
53
}
54
LocalFree
(
wargv
);
55
}
56
#endif
57
58
}
// namespace system
59
}
// namespace lolly
args.hpp
list
The list class represents a linked list.
Definition
list.hpp:48
lolly
Definition
lolly_tree_bench.cpp:13
as_charp
char * as_charp(string s)
Definition
string.cpp:256
string.hpp
unicode.hpp
Generated by
1.10.0