n-Dimensional Fast Methods  0.7
 All Classes Functions Variables Typedefs Pages
console Class Reference

#include <console.h>

Public Member Functions

int parseArguments (int argc, const char **argv, const char *str, double &val)
 

Static Public Member Functions

static int findArguments (int argc, const char **argv, const char *argument_name)
 
static int parseArguments (int argc, const char **argv, const char *str, std::string &val)
 
static int parseArguments (int argc, const char **argv, const char *str, bool &val)
 
static int parseArguments (int argc, const char **argv, const char *str, int &val)
 
static int parseArguments (int argc, const char **argv, const char *str, float &val)
 
static int parseArguments (int argc, const char **argv, const char *str, unsigned int &val)
 
static int parseArguments (int argc, const char **argv, const char *str, char &val)
 
static int parseArguments (int argc, const char **argv, const char *str, std::vector< std::string > &vals)
 
static int parseArguments (int argc, const char **argv, const char *str, std::vector< int > &vals)
 
static void info (const std::string &val)
 
static void warning (const std::string &val)
 
static void error (const std::string &val)
 
static std::string str_info (const std::string &val)
 
static std::string str_warning (const std::string &val)
 
static std::string str_error (const std::string &val)
 

Detailed Description

Todo:
a member method like string but with const char* is missing.

Definition at line 30 of file console.h.

Member Function Documentation

static void console::error ( const std::string &  val)
static

Predefined error message output in the console.

Parameters
valThe string to be shown.
static int console::findArguments ( int  argc,
const char **  argv,
const char *  argument_name 
)
static

Looks for the position index within the command which called the program of the parameter char[] '-whatever' and returns it, or -1 if not found. Its inputs are the same as for the main function.

NOTE: This is an internal function, not recommended to be used as a stand-alone function, it is used in the parseArguments functions of this class. However, it is left public because it could be useful for anybody.

Parameters
argcnumber of parameters given in the command line.
argvarray of char[] with the parameters given in the command line.
Returns
The index of the char searched. -1 if not found.
static void console::info ( const std::string &  val)
static

Predefined information message output in the console.

Parameters
valThe string to be shown.
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
std::string &  val 
)
static

Looks for the argument given in str and stores its value in val, assuming simple input.

Example:

int idx = console::parseArguments (argc, argv, '-t', val);

and the program is run with the command: $ ./test -t 1 The result will be idx = 2 (third position) and val = 1.

Parameters
argcnumber of parameters given in the command line.
argvarray of char[] with the parameters given in the command line.
strargument to look for.
valoutput variable which stores the value of the argument.
Returns
The index position in which the argument value was found.
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
bool &  val 
)
static

Same as the others parseArguments. Bool as output.

See Also
parseArguments()
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
int &  val 
)
static

Same as the others parseArguments. int as output.

See Also
parseArguments()
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
float &  val 
)
static

Same as the others parseArguments. float as output.

See Also
parseArguments()
int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
double &  val 
)

Same as the others parseArguments. double as output.

See Also
parseArguments()
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
unsigned int &  val 
)
static

Same as the others parseArguments. unsigned int as output.

See Also
parseArguments()
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
char &  val 
)
static

Same as the others parseArguments. char as output.

See Also
parseArguments()
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
std::vector< std::string > &  vals 
)
static

Looks for the argument given in str and stores its value in val, assuming multiple input.

Example:

std::vector<std::string> vals;
int idx = int parseArguments (argc, argv, '-t', vals);

and the program is run with the command: $ ./test -input param1 param2 param3 The result will be idx = 2 (third position) and vals = "param1" "param2" "param3".

Parameters
argcnumber of parameters given in the command line.
argvarray of char[] with the parameters given in the command line.
strargument to look for.
valoutput variable which stores the values of the argument, using a std::vector.<>
Returns
The index position in which the argument value was found.
static int console::parseArguments ( int  argc,
const char **  argv,
const char *  str,
std::vector< int > &  vals 
)
static

Same as the others parseArguments. ints as output.

See Also
int parseArguments (int argc, char** argv, const char* str, std::vector<std::string> & vals);
static std::string console::str_error ( const std::string &  val)
static

Predefined error message returned in a std::string. Useful when overloading the ostream operator (<<) or to integrate it withtin other messages.

Parameters
valThe string to be shown.
static std::string console::str_info ( const std::string &  val)
static

Predefined information message returned in a std::string. Useful when overloading the ostream operator (<<) or to integrate it withtin other messages.

Parameters
valThe string to be shown.
static std::string console::str_warning ( const std::string &  val)
static

Predefined warning message returned in a std::string. Useful when overloading the ostream operator (<<) or to integrate it withtin other messages.

Parameters
valThe string to be shown.
static void console::warning ( const std::string &  val)
static

Predefined warning message output in the console.

Parameters
valThe string to be shown.

The documentation for this class was generated from the following file: