#include "main.h"
#include <iostream>
#include <boost/algorithm/string.hpp>
#include <boost/algorithm/cxx11/any_of.hpp>
#include <boost/format.hpp>
#include <iomanip>
#include <cstdarg>
Classes | |
struct | optionItem |
Typedefs | |
typedef list< string > | WordList |
Functions | |
int | main (int argc, char **argv) |
void | print_result (string key, int value) |
void | print_result (string key, string value) |
void | print_result (string key, bool value) |
void | call_getNumberOfNodes (const vector< string > &allArgs, Graph *currentGraph) |
void | call_getNumberOfEdges (const vector< string > &allArgs, Graph *currentGraph) |
void | call_hasCycle (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isComplete (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isDirected (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isFreeOfLoops (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isMultigraph (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isRegular (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isSimple (const vector< string > &allArgs, Graph *currentGraph) |
void | call_getInDeg (const vector< string > &allArgs, Graph *currentGraph) |
void | call_isForest (const vector< string > &allArgs, Graph *currentGraph) |
void | call_getOutDeg (const vector< string > &allArgs, Graph *currentGraph) |
void | call_areNeighbours (const vector< string > &allArgs, Graph *currentGraph) |
void | call_hasConnectivity (const vector< string > &allArgs, Graph *currentGraph) |
void | call_hasEdge (const vector< string > &allArgs, Graph *currentGraph) |
void | call_hasPath (const vector< string > &allArgs, Graph *currentGraph) |
int | str2int (string number) |
WordList | splitTextIntoWords (const string &text) |
void | justifyLine (string line, int pageWidth, int indent) |
void | justifyText (const string &text, int pageWidth, int indent) |
void | showHelp (void) |
void | checkNumberOfRequiredArguments (string option, vector< string > optionValues) |
vector< string > | getValues (string option, vector< string > args) |
string | getFileExtension (string filename) |
vector< string > | replaceLongWithShortNames (vector< string > args) |
void | printv (const char *fstr,...) |
vector< string > | getUsedOptionsFromArg (const vector< string > &allArgs) |
bool | hasOnlyDigits (const string s) |
vector< string > | getAllArgs (int argc, char **argv) |
Variables | |
bool | verbose = false |
const int | indention = 32 |
const char | separator = ' ' |
typedef list<string> WordList |
void call_areNeighbours | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_getInDeg | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_getNumberOfEdges | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_getNumberOfNodes | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_getOutDeg | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_hasConnectivity | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_hasCycle | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_hasEdge | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_hasPath | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isComplete | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isDirected | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isForest | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isFreeOfLoops | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isMultigraph | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isRegular | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void call_isSimple | ( | const vector< string > & | allArgs, |
Graph * | currentGraph | ||
) |
void checkNumberOfRequiredArguments | ( | string | option, |
vector< string > | optionValues | ||
) |
checks whether there are enough arguments for a certain option.
option | the option |
optionValues | its values |
vector<string> getAllArgs | ( | int | argc, |
char ** | argv | ||
) |
converts the program arguments to one arry
argc | argument count |
argv | arguments |
string getFileExtension | ( | string | filename | ) |
Returns the extension of a filename.
filename | the filename |
vector<string> getUsedOptionsFromArg | ( | const vector< string > & | allArgs | ) |
Extracts als used options in arguments.
allArgs | all program arguments |
vector<string> getValues | ( | string | option, |
vector< string > | args | ||
) |
Extracts all values corresponding to a given option.
e.g. we have a command line like "-a foo1 foo2 foo3 -b ffoo" and call getOptionValues("a", "-a foo1 foo2 foo3 -b ffoo") ==> returns an array with {"foo1", "foo2", "foo3"}
checks only short names of options!
option | an option |
args | all arguments (from main **argv) |
bool hasOnlyDigits | ( | const string | s | ) |
checks whether a string contains only digits
s | the string |
void justifyLine | ( | string | line, |
int | pageWidth, | ||
int | indent | ||
) |
void justifyText | ( | const string & | text, |
int | pageWidth, | ||
int | indent | ||
) |
justifies the given text.
text | the text |
pageWidth | the page width |
indent | the indention |
int main | ( | int | argc, |
char ** | argv | ||
) |
void print_result | ( | string | key, |
int | value | ||
) |
void print_result | ( | string | key, |
string | value | ||
) |
void print_result | ( | string | key, |
bool | value | ||
) |
void printv | ( | const char * | fstr, |
... | |||
) |
Printf wrapper for verbose mode. Prints a formatted string and the corresponding number of values.
str | formatted string |
vector<string> replaceLongWithShortNames | ( | vector< string > | args | ) |
Replace all long name options with their corresponding short name
args | array with arguments |
void showHelp | ( | void | ) |
prints out the help page.
WordList splitTextIntoWords | ( | const string & | text | ) |
int str2int | ( | string | number | ) |
Converts a string to a int
number | string with a number ([0-9]*) |
const int indention = 32 |
number of columns for indention
const char separator = ' ' |
fill character
bool verbose = false |
switch for verbose mode