GraphTool
 All Classes Files Functions Variables Typedefs
Classes | Typedefs | Functions | Variables
main.cpp File Reference
#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 Documentation

typedef list<string> WordList

Function Documentation

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.

Parameters
optionthe option
optionValuesits values
vector<string> getAllArgs ( int  argc,
char **  argv 
)

converts the program arguments to one arry

Parameters
argcargument count
argvarguments
Returns
array with all arguments
string getFileExtension ( string  filename)

Returns the extension of a filename.

Parameters
filenamethe filename
Returns
the file ext.
vector<string> getUsedOptionsFromArg ( const vector< string > &  allArgs)

Extracts als used options in arguments.

Parameters
allArgsall program arguments
Returns
an array of all options
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!

Parameters
optionan option
argsall arguments (from main **argv)
Returns
an array with all values of the given option
bool hasOnlyDigits ( const string  s)

checks whether a string contains only digits

Parameters
sthe string
Returns
true, if string only contains digits
void justifyLine ( string  line,
int  pageWidth,
int  indent 
)
void justifyText ( const string &  text,
int  pageWidth,
int  indent 
)

justifies the given text.

Parameters
textthe text
pageWidththe page width
indentthe 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.

Parameters
strformatted string
vector<string> replaceLongWithShortNames ( vector< string >  args)

Replace all long name options with their corresponding short name

Parameters
argsarray with arguments
Returns
array with shorten options
void showHelp ( void  )

prints out the help page.

WordList splitTextIntoWords ( const string &  text)
int str2int ( string  number)

Converts a string to a int

Parameters
numberstring with a number ([0-9]*)
Returns
string as int

Variable Documentation

const int indention = 32

number of columns for indention

const char separator = ' '

fill character

bool verbose = false

switch for verbose mode