From def5c50960eea4c112647f88361a3ae7155901a8 Mon Sep 17 00:00:00 2001 From: egor-tensin Date: Tue, 4 Jul 2023 00:48:00 +0000 Subject: =?UTF-8?q?Deploying=20to=20gh-pages=20from=20@=20egor-tensin/wina?= =?UTF-8?q?pi-common@0c196cbe8b4927c78c02b2c7312fc69a507db845=20?= =?UTF-8?q?=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classwinapi_1_1CommandLine.html | 536 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 536 insertions(+) create mode 100644 classwinapi_1_1CommandLine.html (limited to 'classwinapi_1_1CommandLine.html') diff --git a/classwinapi_1_1CommandLine.html b/classwinapi_1_1CommandLine.html new file mode 100644 index 0000000..5c00301 --- /dev/null +++ b/classwinapi_1_1CommandLine.html @@ -0,0 +1,536 @@ + + + + + + + +winapi_common: winapi::CommandLine Class Reference + + + + + + + + + +
+
+ + + + + + +
+
winapi_common +
+
+
+ + + + + + + + +
+
+ + +
+ +
+ + +
+
+ +
+
winapi::CommandLine Class Reference
+
+
+ +

Command line for the current process or for launching new processes. + More...

+ + + + + + + + + + + + + + + + + + + + + + +

+Public Member Functions

 CommandLine ()=default
 
 CommandLine (const std::string &argv0, const std::vector< std::string > &args={})
 
 CommandLine (std::string &&argv0, std::vector< std::string > &&args={})
 
 CommandLine (std::vector< std::string > argv)
 
std::string to_string () const
 
std::string args_to_string () const
 
std::string get_argv0 () const
 
bool has_args () const
 
const std::vector< std::string > & get_args () const
 
std::vector< std::string > get_argv () const
 
+ + + + + + + + + + + +

+Static Public Member Functions

static CommandLine query ()
 
static CommandLine parse (const std::string &src)
 
static CommandLine from_main (int argc, wchar_t *argv[])
 
+static std::string escape (const std::string &)
 
+static std::string escape_cmd (const std::string &)
 
+

Detailed Description

+

Command line for the current process or for launching new processes.

+

This class takes care of proper parsing and stringifying command line arguments so that they are safe to use with CreateProcess, ShellExecute, etc.

+ +

Definition at line 21 of file cmd_line.hpp.

+

Constructor & Destructor Documentation

+ +

◆ CommandLine() [1/4]

+ +
+
+ + + + + +
+ + + + + + + +
winapi::CommandLine::CommandLine ()
+
+default
+
+

Build an empty command line. It won't have neither argv[0], nor any other args.

+ +
+
+ +

◆ CommandLine() [2/4]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
winapi::CommandLine::CommandLine (const std::string & argv0,
const std::vector< std::string > & args = {} 
)
+
+inlineexplicit
+
+

Build a command line.

Parameters
+ + + +
argv0UTF-8 string, argv[0].
argsList of UTF-8 strings, other arguments.
+
+
+ +

Definition at line 50 of file cmd_line.hpp.

+ +
+
+ +

◆ CommandLine() [3/4]

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
winapi::CommandLine::CommandLine (std::string && argv0,
std::vector< std::string > && args = {} 
)
+
+inlineexplicit
+
+

Build a command line.

Parameters
+ + + +
argv0UTF-8 string, argv[0].
argsList of UTF-8 strings, other arguments.
+
+
+ +

Definition at line 58 of file cmd_line.hpp.

+ +
+
+ +

◆ CommandLine() [4/4]

+ +
+
+ + + + + +
+ + + + + + + + +
winapi::CommandLine::CommandLine (std::vector< std::string > argv)
+
+explicit
+
+

Build a command line.

Parameters
+ + +
argvList of UTF-8 strings, including argv[0].
+
+
+ +

Definition at line 89 of file cmd_line.cpp.

+ +
+
+

Member Function Documentation

+ +

◆ query()

+ +
+
+ + + + + +
+ + + + + + + +
CommandLine winapi::CommandLine::query ()
+
+static
+
+

Get the command line used to launch this process.

+ +

Definition at line 75 of file cmd_line.cpp.

+ +
+
+ +

◆ parse()

+ +
+
+ + + + + +
+ + + + + + + + +
CommandLine winapi::CommandLine::parse (const std::string & src)
+
+static
+
+

Parse a command line from a string.

Parameters
+ + +
srcUTF-8 encoded string.
+
+
+ +

Definition at line 79 of file cmd_line.cpp.

+ +
+
+ +

◆ from_main()

+ +
+
+ + + + + +
+ + + + + + + + + + + + + + + + + + +
CommandLine winapi::CommandLine::from_main (int argc,
wchar_t * argv[] 
)
+
+static
+
+

Build a command line from main() arguments.

Parameters
+ + + +
argcLength of the argv array.
argvUTF-16 encoded strings.
+
+
+ +

Definition at line 83 of file cmd_line.cpp.

+ +
+
+ +

◆ to_string()

+ +
+
+ + + + + + + +
std::string winapi::CommandLine::to_string () const
+
+

Build a string that represents this command line.

Returns
UTF-8 string.
+ +

Definition at line 138 of file cmd_line.cpp.

+ +
+
+ +

◆ args_to_string()

+ +
+
+ + + + + + + +
std::string winapi::CommandLine::args_to_string () const
+
+

Build a string that represents this command line, but omit argv[0].

Returns
UTF-8 string.
+ +

Definition at line 142 of file cmd_line.cpp.

+ +
+
+ +

◆ get_argv0()

+ +
+
+ + + + + +
+ + + + + + + +
std::string winapi::CommandLine::get_argv0 () const
+
+inline
+
+

Get argv[0] for this command line.

Returns
UTF-8 string.
+ +

Definition at line 87 of file cmd_line.hpp.

+ +
+
+ +

◆ has_args()

+ +
+
+ + + + + +
+ + + + + + + +
bool winapi::CommandLine::has_args () const
+
+inline
+
+

Test if this command line has any additional arguments besides argv[0].

+ +

Definition at line 90 of file cmd_line.hpp.

+ +
+
+ +

◆ get_args()

+ +
+
+ + + + + +
+ + + + + + + +
const std::vector<std::string>& winapi::CommandLine::get_args () const
+
+inline
+
+

Get list of arguments for this command line beyond argv[0].

Returns
List of UTF-8 strings.
+ +

Definition at line 96 of file cmd_line.hpp.

+ +
+
+ +

◆ get_argv()

+ +
+
+ + + + + + + +
std::vector< std::string > winapi::CommandLine::get_argv () const
+
+

Get list of arguments for this command line.

Returns
List of UTF-8 strings.
+ +

Definition at line 146 of file cmd_line.cpp.

+ +
+
+
The documentation for this class was generated from the following files: +
+ + + + -- cgit v1.2.3