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
174 const std::string& name,
175 const std::string& description,
199 const std::string& name,
201 const std::string& default_value,
202 const std::string& description,
230 const std::string& name,
231 const std::string& default_value,
232 const std::string& description,
249 const std::string& name,
250 const char* default_value,
251 const std::string& description,
268 const std::string& name,
270 const std::string& description,
274 name,
ARG_INT, String::to_string(default_value),
287 const std::string& name,
288 double default_value,
289 const std::string& description,
293 name,
ARG_DOUBLE, String::to_string(default_value),
306 const std::string& name,
308 const std::string& description,
312 name,
ARG_BOOL, default_value ?
"true" :
"false",
327 const std::string& name,
328 double default_value,
329 const std::string& description =
"...",
333 name,
ARG_PERCENT, String::to_string(default_value) +
"%",
377 int argc,
char**
argv, std::vector<std::string>& unparsed_args,
378 const std::string& additional_arg_specs =
""
402 typedef char** charptrptr;
427 const std::string& additional_args =
"",
428 bool advanced =
false
438 std::string GEOGRAM_API
get_arg(
const std::string& name);
495 const std::string& name,
double reference
523 const std::string& name,
const std::string& value
538 inline bool set_arg(
const std::string& name,
const char* value) {
539 return set_arg(name, std::string(value));
604 void GEOGRAM_API
set_arg(
const std::string& name,
double value);
616 void GEOGRAM_API
set_arg(
const std::string& name,
bool value);
640 void GEOGRAM_API
get_args(std::vector<std::string>& args);
676 const std::string& title,
677 const std::string& short_title =
""
728 const std::string& message,
741 const std::string& message
773 const std::string& task_name,
index_t val,
789 const std::string& task_name,
790 double elapsed,
bool clear =
true
806 const std::string& task_name,
838 const std::string& feature,
bool show =
true
844 #ifdef GEO_OS_ANDROID
853 void GEOGRAM_API set_android_app(android_app* app);
859 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...
void ui_separator(const std::string &title, const std::string &short_title="")
Outputs a separator with a title on the console.
std::string ui_feature(const std::string &feature, bool show=true)
Formats a Logger feature name.
void load_config(const std::string &filename, const std::string &program_name)
Loads command line argument values from a file.
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.
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 ui_close_separator()
Closes an opened separator.
ArgFlags
Command line group or argument flags.
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 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.
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.
void clear(void *addr, size_t size)
Clears a memory block.
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.