8 #ifndef BOOST_NOWIDE_ARGS_HPP_INCLUDED 9 #define BOOST_NOWIDE_ARGS_HPP_INCLUDED 11 #include <boost/config.hpp> 12 #include <boost/nowide/stackstring.hpp> 15 #include <boost/nowide/windows.hpp> 20 #if !defined(BOOST_WINDOWS) && !defined(BOOST_NOWIDE_DOXYGEN) 23 args(
int &,
char **&) {}
24 args(
int &,
char **&,
char **&){}
48 args(
int &argc,
char **&argv) :
61 args(
int &argc,
char **&argv,
char **&en) :
78 *old_argc_ptr_ = old_argc_;
80 *old_argv_ptr_ = old_argv_;
82 *old_env_ptr_ = old_env_;
85 void fix_args(
int &argc,
char **&argv)
88 wchar_t **wargv = CommandLineToArgvW(GetCommandLineW(),&wargc);
91 static char *dummy = 0;
96 args_.resize(wargc+1,0);
97 arg_values_.resize(wargc);
98 for(
int i=0;i<wargc;i++) {
99 if(!arg_values_[i].convert(wargv[i])) {
103 args_[i] = arg_values_[i].c_str();
114 void fix_env(
char **&en)
116 static char *dummy = 0;
118 wchar_t *wstrings = GetEnvironmentStringsW();
122 wchar_t *wstrings_end = 0;
124 for(wstrings_end = wstrings;*wstrings_end;wstrings_end+=wcslen(wstrings_end)+1)
126 if(env_.convert(wstrings,wstrings_end)) {
127 envp_.resize(count+1,0);
128 char *p=env_.c_str();
130 for(
int i=0;i<count;i++) {
139 FreeEnvironmentStringsW(wstrings);
142 FreeEnvironmentStringsW(wstrings);
146 std::vector<char *> args_;
147 std::vector<short_stackstring> arg_values_;
149 std::vector<char *> envp_;
156 char ***old_argv_ptr_;
157 char ***old_env_ptr_;
args(int &argc, char **&argv, char **&en)
Definition: args.hpp:61
args is a class that fixes standard main() function arguments and changes them to UTF-8 under Microso...
Definition: args.hpp:42
args(int &argc, char **&argv)
Definition: args.hpp:48
~args()
Definition: args.hpp:75