Crashpad
 
All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
Loading...
Searching...
No Matches
crashpad::ToolSupport Class Reference

Common functions used by command line tools. More...

#include "tools/tool_support.h"

Public Member Functions

 ToolSupport (const ToolSupport &)=delete
 
ToolSupportoperator= (const ToolSupport &)=delete
 

Static Public Member Functions

static void Version (const base::FilePath &me)
 Handles --version.
 
static void UsageTail (const base::FilePath &me)
 Prints the footer for --help.
 
static void UsageHint (const base::FilePath &me, const char *hint)
 Suggests using --help when a command line tool can’t make sense of its arguments.
 
static void Version (const std::string &me)
 Handles --version.
 
static void UsageTail (const std::string &me)
 Prints the footer for --help.
 
static void UsageHint (const std::string &me, const char *hint)
 Suggests using --help when a command line tool can’t make sense of its arguments.
 
static int Wmain (int argc, wchar_t *argv[], int(*entry)(int, char *[]))
 Converts argv wchar_t UTF-16 to UTF-8, and passes onwards to a UTF-8 entry point.
 
static base::FilePath::StringType CommandLineArgumentToFilePathStringType (const base::StringPiece &arg)
 Converts a command line argument to the string type suitable for base::FilePath.
 
static std::string FilePathToCommandLineArgument (const base::FilePath &file_path)
 Converts a base::FilePath to a command line argument.
 

Detailed Description

Common functions used by command line tools.

Member Function Documentation

◆ CommandLineArgumentToFilePathStringType()

base::FilePath::StringType crashpad::ToolSupport::CommandLineArgumentToFilePathStringType ( const base::StringPiece & arg)
static

Converts a command line argument to the string type suitable for base::FilePath.

On POSIX, this is a no-op. On Windows, assumes that Wmain() was used, and the input argument was converted from UTF-16 in a wchar_t* to UTF-8 in a char*. This undoes that transformation.

See also
Wmain()
FilePathToCommandLineArgument()

◆ FilePathToCommandLineArgument()

std::string crashpad::ToolSupport::FilePathToCommandLineArgument ( const base::FilePath & file_path)
static

Converts a base::FilePath to a command line argument.

On POSIX, this is a no-op. On Windows, this undoes the transformation done by CommandLineArgumentToFilePathStringType() in the same manner as Wmain().

◆ UsageHint() [1/2]

void crashpad::ToolSupport::UsageHint ( const base::FilePath & me,
const char * hint )
static

Suggests using --help when a command line tool can’t make sense of its arguments.

Parameters
[in]meThe tool’s name, the basename of argv[0].
[in]hintA hint to display before the suggestion to try --help. Optional, may be nullptr, in which case no hint will be presented.

◆ UsageHint() [2/2]

static void crashpad::ToolSupport::UsageHint ( const std::string & me,
const char * hint )
static

Suggests using --help when a command line tool can’t make sense of its arguments.

Parameters
[in]meThe tool’s name, the basename of argv[0].
[in]hintA hint to display before the suggestion to try --help. Optional, may be nullptr, in which case no hint will be presented.

◆ UsageTail() [1/2]

void crashpad::ToolSupport::UsageTail ( const base::FilePath & me)
static

Prints the footer for --help.

Parameters
[in]meThe tool’s name, the basename of argv[0].

◆ UsageTail() [2/2]

static void crashpad::ToolSupport::UsageTail ( const std::string & me)
static

Prints the footer for --help.

Parameters
[in]meThe tool’s name, the basename of argv[0].

◆ Version() [1/2]

void crashpad::ToolSupport::Version ( const base::FilePath & me)
static

Handles --version.

Parameters
[in]meThe tool’s name, the basename of argv[0].

◆ Version() [2/2]

static void crashpad::ToolSupport::Version ( const std::string & me)
static

Handles --version.

Parameters
[in]meThe tool’s name, the basename of argv[0].

◆ Wmain()

static int crashpad::ToolSupport::Wmain ( int argc,
wchar_t * argv[],
int(* entry )(int, char *[]) )
static

Converts argv wchar_t UTF-16 to UTF-8, and passes onwards to a UTF-8 entry point.

Returns
The return value of entry.

The documentation for this class was generated from the following files: