advgetopt 2.0.47
Parse complex command line arguments and configuration files in C++.
Namespaces | Typedefs | Functions | Variables
utils.h File Reference

A few utility functions that are not specific to an object. More...

#include <set>
#include <string>
#include <vector>
Include dependency graph for utils.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

namespace  advgetopt
 The advgetopt environment to parse command line options.
 

Typedefs

typedef std::vector< std::string > advgetopt::string_list_t
 
typedef std::set< std::string > advgetopt::string_set_t
 

Functions

std::string advgetopt::breakup_line (std::string line, std::size_t const option_width, std::size_t const line_width)
 
std::string advgetopt::default_group_name (std::string const &filename, char const *group_name, char const *project_name, int priority)
 Generate the default filename (the ".../50-...")
 
std::string advgetopt::escape_shell_argument (std::string const &arg)
 Escape special characters from a shell argument.
 
std::string advgetopt::format_usage_string (std::string const &argument, std::string const &help, std::size_t const option_width, std::size_t const line_width)
 
size_t advgetopt::get_screen_height ()
 Retrieve the height of your console.
 
size_t advgetopt::get_screen_width ()
 Retrieve the width of one line in your console.
 
std::string advgetopt::handle_user_directory (std::string const &filename)
 Replace a starting ~/... with the contents of the $HOME variable.
 
string_list_t advgetopt::insert_group_name (std::string const &filename, char const *group_name, char const *project_name, bool add_default_on_empty)
 Insert the group (or project) name in the filename.
 
bool advgetopt::is_false (std::string s)
 Check whether a value represents "false".
 
bool advgetopt::is_true (std::string s)
 Check whether a value represents "true".
 
void advgetopt::less (std::basic_ostream< char > &out, std::string const &data)
 Print out a string to the console or use less.
 
std::string advgetopt::option_with_dashes (std::string const &s)
 Convert the _ found in a string to - instead.
 
std::string advgetopt::option_with_underscores (std::string const &s)
 Converts an option back to using underscores.
 
std::string advgetopt::quote (std::string const &s, char open, char close)
 The converse of unquote.
 
std::string advgetopt::sanitizer_details ()
 Generate a string describing whether we're using the sanitizer.
 
void advgetopt::split_string (std::string const &str, string_list_t &result, string_list_t const &separators)
 Split a string in sub-strings separated by separators.
 
std::string advgetopt::unquote (std::string const &s, std::string const &pairs)
 Remove single (') or double (") quotes from a string.
 

Variables

constexpr int const advgetopt::DEFAULT_PRIORITY = 50
 

Detailed Description

The following are useful functions offered publicly since they may also be useful to others outside of the library.

Definition in file utils.h.

This document is part of the Snap! Websites Project.

Copyright by Made to Order Software Corp.