fullquottel.cpp File Reference

#include <cstdlib>
#include <string>
#include <vector>
#include <map>
#include <fstream>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <stdexcept>
#include <cctype>
#include <argp.h>

Namespaces

namespace  std

Classes

struct  RatingBase
 Base class of structures that store informations about the rating/test of mail properties. More...
struct  RatioRating
 structure to store the rating of an ratio test: More...
struct  IntegerRating
 Structure to store the rating of an integer test:. More...
struct  BoolRating
 Structure to store the rating of an integer test:. More...
struct  SigRating
 Structure for signature test options. More...
struct  Options
 Structure to store the program options. More...

Typedefs

typedef vector< string > TextLines
typedef multimap< string,
string > 
MultiMap

Functions

void setStringOptionFromMultiMap (const MultiMap &mm, const string &key, string &option)
 searches for key within the multimap. If found, its value is assigned to option.
void setDoubleOptionFromMultiMap (const MultiMap &mm, const string &key, double &option)
void setIntOptionFromMultiMap (const MultiMap &mm, const string &key, int &option)
void setBoolOptionFromMultiMap (const MultiMap &mm, const string &key, bool &option)
void useConfig (Options &options, const MultiMap &mm)
 incorporates the multimap to the options
bool isSubString (const string &needle, const string &haystack)
 returns true if substring is part of string
string ltrim (const string &text)
 cuts leading whitespace
string rtrim (const string &text)
 cuts trailing whitespace
string trim (const string &text)
 cuts leading and trailing whitespace
TextLines loadTextLines (istream &istr)
 loads a file into a TextLines class.
MultiMap multiMapFromTextLines (const TextLines &lines) throw (runtime_error)
string expandTildeToHome (string file)
 expands leading ~ to $HOME
void showTextLines (const TextLines &tl, bool addEndl=false)
 Testing purposes: Return TextLines on cout.
void showMultiMap (const MultiMap &mm)
 Testing purposes.
bool isQuotedLine (const string &line, const string &quoteChars)
 returns true, if the line begins with the specified Quotestrings
bool cutSignature (TextLines &body, const string &quoteChars)
 cuts the signature out of the body and returns true. If the signature is not found, it returns false and leaves the body untouched.
TextLines::size_type quotedLines (const TextLines &body, const string &quoteChars)
 counts quoted lines
bool ownSig (const TextLines &body, const TextLines &signature)
 returns true if the signature is found within the body.
unsigned quotedLinesBottom (const TextLines &bodyNoSig, const string &quoteChars)
 returns the amount of quoted lines at the bottom of the message
unsigned quoteBlockCount (const TextLines &bodyNoSig, const string &quoteChars)
 Returns the number of the quote blocks.
unsigned microsoftAttributionLineNumber (const TextLines &bodyNoSig, const TextLines &attributionLines)
int main (int argc, char *argv[])

Variables

const int err_noinput = 255
const int err_nosigfile = 254
const int err_options = 253
const char * argp_program_version = "fullquottel 0.1.2"
const char * argp_program_bug_address = "<toast@toastfreeware.priv.at>"

Typedef Documentation

typedef vector<string> TextLines

This type represents text seperated in lines. Line delimiters should be preserved so that the unseperated text can be easily reconstructed.

typedef multimap<string, string> MultiMap


Function Documentation

void setStringOptionFromMultiMap ( const MultiMap mm,
const string &  key,
string &  option 
)

searches for key within the multimap. If found, its value is assigned to option.

void setDoubleOptionFromMultiMap ( const MultiMap mm,
const string &  key,
double &  option 
)

void setIntOptionFromMultiMap ( const MultiMap mm,
const string &  key,
int &  option 
)

void setBoolOptionFromMultiMap ( const MultiMap mm,
const string &  key,
bool &  option 
)

void useConfig ( Options options,
const MultiMap mm 
)

incorporates the multimap to the options

bool isSubString ( const string &  needle,
const string &  haystack 
)

returns true if substring is part of string

string ltrim ( const string &  text  ) 

cuts leading whitespace

string rtrim ( const string &  text  ) 

cuts trailing whitespace

string trim ( const string &  text  ) 

cuts leading and trailing whitespace

TextLines loadTextLines ( istream &  istr  ) 

loads a file into a TextLines class.

MultiMap multiMapFromTextLines ( const TextLines lines  )  throw (runtime_error)

Loads a key=value file (lines starting with # or empty lines are ignored) Multiple values for one key are allowed If an syntax error occurs, an exception is thrown.

string expandTildeToHome ( string  file  ) 

expands leading ~ to $HOME

void showTextLines ( const TextLines tl,
bool  addEndl = false 
)

Testing purposes: Return TextLines on cout.

void showMultiMap ( const MultiMap mm  ) 

Testing purposes.

bool isQuotedLine ( const string &  line,
const string &  quoteChars 
)

returns true, if the line begins with the specified Quotestrings

bool cutSignature ( TextLines body,
const string &  quoteChars 
)

cuts the signature out of the body and returns true. If the signature is not found, it returns false and leaves the body untouched.

TextLines::size_type quotedLines ( const TextLines body,
const string &  quoteChars 
)

counts quoted lines

bool ownSig ( const TextLines body,
const TextLines signature 
)

returns true if the signature is found within the body.

unsigned quotedLinesBottom ( const TextLines bodyNoSig,
const string &  quoteChars 
)

returns the amount of quoted lines at the bottom of the message

unsigned quoteBlockCount ( const TextLines bodyNoSig,
const string &  quoteChars 
)

Returns the number of the quote blocks.

unsigned microsoftAttributionLineNumber ( const TextLines bodyNoSig,
const TextLines attributionLines 
)

Searches for a line from Outlook-like programs that shows the beginning of the reply (like -----Original Message-----) and returns the line number if it is found, 0 otherwise.

int main ( int  argc,
char *  argv[] 
)


Variable Documentation

const int err_noinput = 255

const int err_nosigfile = 254

const int err_options = 253

const char* argp_program_version = "fullquottel 0.1.2"

const char* argp_program_bug_address = "<toast@toastfreeware.priv.at>"


Generated on Mon Apr 2 00:02:38 2007 for fullquottel by  doxygen 1.5.1