My Project
Functions
MyTools.cc File Reference

Implementation of helper functions. More...

#include "MyTools.h"

Functions

bool openFile (ifstream *fin, string filename)
const std::string trim (const std::string &pString, const std::string &pWhitespace)
bool fline_tr (ifstream *fin, vector< string > *fields, string delim)
map< string, vector< string > > getParameters (int argc, char **input)
int lineCount (string filename)

Detailed Description

Implementation of helper functions.


Function Documentation

map< string, vector< string > > getParameters ( int  argc,
char **  input 
)

Return a list of parameter names and values from a string. The names can be preceeded by nothing, a '-' or a '--'. The value then follows an '='. Values that may contain nested flags should be surrounded by single quotes (').

Parameters:
argcnumber of elements in input
inputarray of strings to parse for flags and arguments
Returns:
A map related each flag to its given string value.
int lineCount ( string  filename)

Count the number of lines in a given file

Parameters:
filenameFile to count lines of
bool openFile ( ifstream *  fin,
string  filename 
)

Open an ifstream with some basic checks

Parameters:
finifstream to use to open file
filenamefile to open
Returns:
if open successful
const std::string trim ( const std::string &  pString,
const std::string &  pWhitespace 
)

Remove beginning and trailing "whitespace" from the string

Parameters:
pStringString to trim
pWhitespaceCharacters to trim at the ends of the given strings.
Returns:
string with whitespace characters stripped from beginning and end
 All Classes Files Functions Variables Typedefs