crashpad::ToolSupport Class Reference

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

`#include "tools/tool_support.h"`

## Static Public Member Functions

static void | Version (const base::FilePath &me)
| Handles `--version`. More...
static void | UsageTail (const base::FilePath &me)
| Prints the footer for `--help`. More...
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. More...
static void | Version (const std::string &me)
| Handles `--version`. More...
static void | UsageTail (const std::string &me)
| Prints the footer for `--help`. More...
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. More...
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. More...
static base::FilePath::StringType | CommandLineArgumentToFilePathStringType (const base::StringPiece &arg)
| Converts a command line argument to the string type suitable for base::FilePath. More...
static std::string | FilePathToCommandLineArgument (const base::FilePath &file_path)
| Converts a base::FilePath to a command line argument. More...

## 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] | me | The tool’s name, the basename of `argv[0]`.
  [in] | hint | A 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] | me | The tool’s name, the basename of `argv[0]`.
  [in] | hint | A 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] | me | The 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] | me | The tool’s name, the basename of `argv[0]`.

## Version() [1/2]

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

static

Handles `--version`.

Parameters

  [in] | me | The 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] | me | The tool’s name, the basename of `argv[0]`.

## Wmain()

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

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:

- tools/tool_support.h
- tools/tool_support.cc