opencv::prelude

Trait CommandLineParserTraitConst

Source
pub trait CommandLineParserTraitConst {
Show 26 methods // Required method fn as_raw_CommandLineParser(&self) -> *const c_void; // Provided methods fn get_path_to_application(&self) -> Result<String> { ... } fn get_bool(&self, name: &str, space_delete: bool) -> Result<bool> { ... } fn get_bool_def(&self, name: &str) -> Result<bool> { ... } fn get_i32(&self, name: &str, space_delete: bool) -> Result<i32> { ... } fn get_i32_def(&self, name: &str) -> Result<i32> { ... } fn get_f64(&self, name: &str, space_delete: bool) -> Result<f64> { ... } fn get_f64_def(&self, name: &str) -> Result<f64> { ... } fn get_str(&self, name: &str, space_delete: bool) -> Result<String> { ... } fn get_str_def(&self, name: &str) -> Result<String> { ... } fn get_u64(&self, name: &str, space_delete: bool) -> Result<u64> { ... } fn get_u64_def(&self, name: &str) -> Result<u64> { ... } fn get_bool_idx(&self, index: i32, space_delete: bool) -> Result<bool> { ... } fn get_bool_idx_def(&self, index: i32) -> Result<bool> { ... } fn get_i32_idx(&self, index: i32, space_delete: bool) -> Result<i32> { ... } fn get_i32_idx_def(&self, index: i32) -> Result<i32> { ... } fn get_f64_idx(&self, index: i32, space_delete: bool) -> Result<f64> { ... } fn get_f64_idx_def(&self, index: i32) -> Result<f64> { ... } fn get_str_idx(&self, index: i32, space_delete: bool) -> Result<String> { ... } fn get_str_idx_def(&self, index: i32) -> Result<String> { ... } fn get_u64_idx(&self, index: i32, space_delete: bool) -> Result<u64> { ... } fn get_u64_idx_def(&self, index: i32) -> Result<u64> { ... } fn has(&self, name: &str) -> Result<bool> { ... } fn check(&self) -> Result<bool> { ... } fn print_message(&self) -> Result<()> { ... } fn print_errors(&self) -> Result<()> { ... }
}
Expand description

Constant methods for core::CommandLineParser

Required Methods§

Provided Methods§

Source

fn get_path_to_application(&self) -> Result<String>

Returns application path

This method returns the path to the executable from the command line (argv[0]).

For example, if the application has been started with such a command:

$ ./bin/my-executable

this method will return ./bin.

Source

fn get_bool(&self, name: &str, space_delete: bool) -> Result<bool>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
§C++ default parameters
  • space_delete: true
Source

fn get_bool_def(&self, name: &str) -> Result<bool>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
Source

fn get_i32(&self, name: &str, space_delete: bool) -> Result<i32>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
§C++ default parameters
  • space_delete: true
Source

fn get_i32_def(&self, name: &str) -> Result<i32>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
Source

fn get_f64(&self, name: &str, space_delete: bool) -> Result<f64>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
§C++ default parameters
  • space_delete: true
Source

fn get_f64_def(&self, name: &str) -> Result<f64>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
Source

fn get_str(&self, name: &str, space_delete: bool) -> Result<String>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
§C++ default parameters
  • space_delete: true
Source

fn get_str_def(&self, name: &str) -> Result<String>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
Source

fn get_u64(&self, name: &str, space_delete: bool) -> Result<u64>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
§C++ default parameters
  • space_delete: true
Source

fn get_u64_def(&self, name: &str) -> Result<u64>

Access arguments by name

Returns argument converted to selected type. If the argument is not known or can not be converted to selected type, the error flag is set (can be checked with [check]).

For example, define:

String keys = "{N count||}";

Call:

$ ./my-app -N=20
# or
$ ./my-app --count=20

Access:

int N = parser.get<int>("N");
§Parameters
  • name: name of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible

Note: You can access positional arguments by their @-prefixed name:

parser.get<String>("@image");
Source

fn get_bool_idx(&self, index: i32, space_delete: bool) -> Result<bool>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
§C++ default parameters
  • space_delete: true
Source

fn get_bool_idx_def(&self, index: i32) -> Result<bool>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
Source

fn get_i32_idx(&self, index: i32, space_delete: bool) -> Result<i32>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
§C++ default parameters
  • space_delete: true
Source

fn get_i32_idx_def(&self, index: i32) -> Result<i32>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
Source

fn get_f64_idx(&self, index: i32, space_delete: bool) -> Result<f64>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
§C++ default parameters
  • space_delete: true
Source

fn get_f64_idx_def(&self, index: i32) -> Result<f64>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
Source

fn get_str_idx(&self, index: i32, space_delete: bool) -> Result<String>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
§C++ default parameters
  • space_delete: true
Source

fn get_str_idx_def(&self, index: i32) -> Result<String>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
Source

fn get_u64_idx(&self, index: i32, space_delete: bool) -> Result<u64>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
§C++ default parameters
  • space_delete: true
Source

fn get_u64_idx_def(&self, index: i32) -> Result<u64>

Access positional arguments by index

Returns argument converted to selected type. Indexes are counted from zero.

For example, define:

String keys = "{@arg1||}{@arg2||}"

Call:

./my-app abc qwe

Access arguments:

String val_1 = parser.get<String>(0); // returns "abc", arg1
String val_2 = parser.get<String>(1); // returns "qwe", arg2
§Parameters
  • index: index of the argument
  • space_delete: remove spaces from the left and right of the string @tparam T the argument will be converted to this type if possible
Source

fn has(&self, name: &str) -> Result<bool>

Check if field was provided in the command line

§Parameters
  • name: argument name to check
Source

fn check(&self) -> Result<bool>

Check for parsing errors

Returns false if error occurred while accessing the parameters (bad conversion, missing arguments, etc.). Call [printErrors] to print error messages list.

Source

fn print_message(&self) -> Result<()>

Print help message

This method will print standard help message containing the about message and arguments description.

§See also

about

Source

fn print_errors(&self) -> Result<()>

Print list of errors occurred

§See also

check

Implementors§