Go to the documentation of this file.
32 const std::string &_optstring,
35 const std::string &program)
36 : parse_result(cmdline.parse(
39 (std::string(
"?h(help)") + _optstring).c_str())),
40 ui_message_handler(cmdline, program),
41 log(ui_message_handler)
62 auto const suggestions =
64 if(!suggestions.empty())
67 if(suggestions.size() > 1)
114 catch(
const std::string &e)
130 catch(
const std::bad_alloc &)
135 catch(
const std::exception &e)
153 const std::string &front_end)
156 <<
sizeof(
void *) * CHAR_BIT <<
"-bit "
163 auto const total_length = std::size_t{63};
164 auto const border = std::string{
"* *"};
166 total_length - std::min(total_length, 2 * border.size() + text.size());
167 auto const fill_right = fill / 2;
168 auto const fill_left = fill - fill_right;
169 return border + std::string(fill_left,
' ') + text +
170 std::string(fill_right,
' ') + border;
176 const std::string version_str = front_end +
" " + version +
" " +
184 const std::string &option,
185 const std::string &description,
186 const std::size_t left_margin,
187 const std::size_t width)
202 if(option.length() >= left_margin - 1)
204 result =
" " + option +
"\n";
205 result +=
wrap_line(description, left_margin, width) +
"\n";
210 std::string padding(left_margin - option.length() - 1,
' ');
211 result =
" " + option + padding;
213 if(description.length() <= (width - left_margin))
215 return result + description +
"\n";
218 auto it = description.cbegin() + (width - left_margin);
219 auto rit = std::reverse_iterator<decltype(it)>(it) - 1;
221 auto rit_space = std::find(rit, description.crend(),
' ');
222 auto it_space = rit_space.base() - 1;
225 result.append(description.cbegin(), it_space);
229 wrap_line(it_space + 1, description.cend(), left_margin, width) +
"\n";
std::string wrap_line(const std::string &line, const std::size_t left_margin, const std::size_t width)
Wrap line at spaces to not extend past the right margin, and include given padding with spaces to the...
virtual bool isset(char option) const
void unknown_option_msg()
Print an error message mentioning the option that was not recognized when parsing the command line.
#define CHECK_RETURN(CONDITION)
#define CPROVER_EXIT_INTERNAL_OUT_OF_MEMORY
Memory allocation has failed and this has been detected within the program.
mstreamt & status() const
A logic error, augmented with a distinguished field to hold a backtrace.
#define CPROVER_EXIT_EXCEPTION
An (unanticipated) exception was thrown during computation.
void log_version_and_architecture(const std::string &front_end)
Write version and system architecture to log.status().
std::string to_string(const string_not_contains_constraintt &expr)
Used for debug printing.
virtual void usage_error()
std::string what() const override
A human readable description of what went wrong.
const char * CBMC_VERSION
std::string banner_string(const std::string &front_end, const std::string &version)
Stream & join_strings(Stream &&os, const It b, const It e, const Delimiter &delimiter, TransformFunc &&transform_func)
Prints items to an stream, separated by a constant delimiter.
#define PRECONDITION(CONDITION)
static irep_idt this_operating_system()
std::string help_entry(const std::string &option, const std::string &description, const std::size_t left_margin, const std::size_t width)
parse_options_baset(const std::string &optstring, int argc, const char **argv, const std::string &program)
static irep_idt this_architecture()
void install_signal_catcher()
virtual std::string what() const
A human readable description of what went wrong.
#define CPROVER_EXIT_USAGE_ERROR
A usage error is returned when the command line is invalid or conflicting.
virtual std::string what() const noexcept
std::vector< std::string > get_argument_suggestions(const std::string &unknown_argument)
Thrown when users pass incorrect command line arguments, for example passing no files to analysis or ...
std::string align_center_with_border(const std::string &text)
Utility for displaying help centered messages borderered by "* *".
Base class for exceptions thrown in the cprover project.