40#ifndef GEOGRAM_BASIC_COMMAND_LINE
41#define GEOGRAM_BASIC_COMMAND_LINE
92 const std::string& filename,
93 bool auto_create_args =
false
122 const std::string& filename,
const std::string& program_name =
"*"
180 const std::string& name,
181 const std::string& description,
205 const std::string& name,
207 const std::string& default_value,
208 const std::string& description,
244 const std::string& name,
245 const std::string& default_value,
246 const std::string& description,
263 const std::string& name,
264 const char* default_value,
265 const std::string& description,
282 const std::string& name,
284 const std::string& description,
288 name,
ARG_INT, String::to_string(default_value),
301 const std::string& name,
302 double default_value,
303 const std::string& description,
307 name,
ARG_DOUBLE, String::to_string(default_value),
320 const std::string& name,
322 const std::string& description,
326 name,
ARG_BOOL, default_value ?
"true" :
"false",
341 const std::string& name,
342 double default_value,
343 const std::string& description =
"...",
347 name,
ARG_PERCENT, String::to_string(default_value) +
"%",
391 int argc,
char**
argv, std::vector<std::string>& unparsed_args,
392 const std::string& additional_arg_specs =
""
416 typedef char** charptrptr;
441 const std::string& additional_args =
"",
442 bool advanced =
false
452 std::string GEOGRAM_API
get_arg(
const std::string& name);
509 const std::string& name,
double reference
537 const std::string& name,
const std::string& value
552 inline bool set_arg(
const std::string& name,
const char* value) {
553 return set_arg(name, std::string(value));
618 void GEOGRAM_API
set_arg(
const std::string& name,
double value);
630 void GEOGRAM_API
set_arg(
const std::string& name,
bool value);
660 const std::string& group,
661 std::vector<std::string>& arg_names
672 void GEOGRAM_API
get_args(std::vector<std::string>& args);
708 const std::string& title,
709 const std::string& short_title =
""
760 const std::string& message,
773 const std::string& message
805 const std::string& task_name,
index_t val,
806 index_t percent,
bool clear =
true
821 const std::string& task_name,
822 double elapsed,
bool clear =
true
838 const std::string& task_name,
839 double elapsed,
index_t percent,
bool clear =
true
870 const std::string& feature,
bool show =
true
885 void GEOGRAM_API set_android_app(android_app* app);
891 android_app* GEOGRAM_API get_android_app();
Assertion checking mechanism.
Common include file, providing basic definitions. Should be included before anything else by all head...
std::string ui_feature(const std::string &feature, bool show=true)
Formats a Logger feature name.
void ui_progress_canceled(const std::string &task_name, double elapsed, index_t percent, bool clear=true)
Displays the time elapsed for a canceled task.
bool config_file_loaded()
Tests whether the configuration file was loaded.
void show_usage(const std::string &additional_args="", bool advanced=false)
Displays program help.
void declare_arg(const std::string &name, ArgType type, const std::string &default_value, const std::string &description, ArgFlags flags=ARG_FLAGS_DEFAULT)
Declares an argument.
bool get_arg_bool(const std::string &name)
Gets an argument value as a boolean.
void declare_arg_percent(const std::string &name, double default_value, const std::string &description="...", ArgFlags flags=ARG_FLAGS_DEFAULT)
Declares an argument of type percentage.
int argc()
Gets the number of arguments of the command line.
std::string get_config_file_name()
Gets the name of the configuration file.
void load_config(const std::string &filename, const std::string &program_name="*")
Loads command line argument values from a file.
charptrptr argv()
Gets the command line arguments.
bool parse(int argc, char **argv, std::vector< std::string > &unparsed_args, const std::string &additional_arg_specs="")
Parses the command line arguments.
bool set_arg(const std::string &name, const std::string &value)
Sets an argument value from a string.
void save_config(const std::string &filename)
Saves command line argument values to a file.
void ui_close_separator()
Closes an opened separator.
ArgFlags
Command line group or argument flags.
void get_arg_groups(std::vector< std::string > &groups)
Lists all group names.
void ui_separator()
Outputs a separator without a title on the console.
double get_arg_percent(const std::string &name, double reference)
Gets an argument value as a percentage.
void initialize()
Initializes the command line framework.
void ui_clear_line()
Clears the last line.
index_t ui_terminal_width()
Gets the width of the console.
void get_arg_names_in_group(const std::string &group, std::vector< std::string > &arg_names)
Lists all arg names in a a group.
void ui_progress_time(const std::string &task_name, double elapsed, bool clear=true)
Displays the time elapsed for a completed task.
std::string get_arg(const std::string &name)
Gets an argument value.
bool arg_is_declared(const std::string &name)
Checks if an argument exists.
int get_arg_int(const std::string &name)
Gets an argument value as an integer.
double get_arg_double(const std::string &name)
Gets an argument value as a floating point.
void get_args(std::vector< std::string > &args)
Gets the value of all arguments.
ArgType get_arg_type(const std::string &name)
Gets the type of an argument.
ArgType
Command line argument types.
void declare_arg_group(const std::string &name, const std::string &description, ArgFlags flags=ARG_FLAGS_DEFAULT)
Declares an argument group.
void ui_progress(const std::string &task_name, index_t val, index_t percent, bool clear=true)
Displays a progress bar.
unsigned int get_arg_uint(const std::string &name)
Gets an argument value as an unsigned integer.
std::string get_arg_desc(const std::string &name)
Gets the description of an argument.
void ui_message(const std::string &message, index_t wrap_margin)
Outputs a message on the console.
void set_config_file_name(const std::string &filename, bool auto_create_args=false)
Defines the name of the configuration file.
void terminate()
Cleans up the command line framework.
void set_arg_percent(const std::string &name, double value)
Sets an argument value from a percentage.
Global Vorpaline namespace.
geo_index_t index_t
The type for storing and manipulating indices.
Types and functions for numbers manipulation.
Functions for string manipulation.