fullquottel
Classes | Typedefs | Functions | Variables
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>

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. More...
 
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 More...
 
bool isSubString (const string &needle, const string &haystack)
 returns true if substring is part of string More...
 
string ltrim (const string &text)
 cuts leading whitespace More...
 
string rtrim (const string &text)
 cuts trailing whitespace More...
 
string trim (const string &text)
 cuts leading and trailing whitespace More...
 
TextLines loadTextLines (istream &istr)
 loads a file into a TextLines class. More...
 
MultiMap multiMapFromTextLines (const TextLines &lines)
 
string expandTildeToHome (string file)
 expands leading ~ to $HOME More...
 
void showTextLines (const TextLines &tl, bool addEndl=false)
 Testing purposes: Return TextLines on cout. More...
 
void showMultiMap (const MultiMap &mm)
 Testing purposes. More...
 
bool isQuotedLine (const string &line, const string &quoteChars)
 returns true, if the line begins with the specified Quotestrings More...
 
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. More...
 
TextLines::size_type quotedLines (const TextLines &body, const string &quoteChars)
 counts quoted lines More...
 
bool ownSig (const TextLines &body, const TextLines &signature)
 returns true if the signature is found within the body. More...
 
unsigned quotedLinesBottom (const TextLines &bodyNoSig, const string &quoteChars)
 returns the amount of quoted lines at the bottom of the message More...
 
unsigned quoteBlockCount (const TextLines &bodyNoSig, const string &quoteChars)
 Returns the number of the quote blocks. More...
 
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.5"
 
const char * argp_program_bug_address = "<toast@toastfreeware.priv.at>"
 

Typedef Documentation

◆ TextLines

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.

◆ MultiMap

typedef multimap<string, string> MultiMap

Function Documentation

◆ setStringOptionFromMultiMap()

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

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

◆ setDoubleOptionFromMultiMap()

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

◆ setIntOptionFromMultiMap()

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

◆ setBoolOptionFromMultiMap()

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

◆ useConfig()

void useConfig ( Options options,
const MultiMap mm 
)

incorporates the multimap to the options

◆ isSubString()

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

returns true if substring is part of string

◆ ltrim()

string ltrim ( const string &  text)

cuts leading whitespace

◆ rtrim()

string rtrim ( const string &  text)

cuts trailing whitespace

◆ trim()

string trim ( const string &  text)

cuts leading and trailing whitespace

◆ loadTextLines()

TextLines loadTextLines ( istream &  istr)

loads a file into a TextLines class.

◆ multiMapFromTextLines()

MultiMap multiMapFromTextLines ( const TextLines lines)

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.

◆ expandTildeToHome()

string expandTildeToHome ( string  file)

expands leading ~ to $HOME

◆ showTextLines()

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

Testing purposes: Return TextLines on cout.

◆ showMultiMap()

void showMultiMap ( const MultiMap mm)

Testing purposes.

◆ isQuotedLine()

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

returns true, if the line begins with the specified Quotestrings

◆ cutSignature()

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.

◆ quotedLines()

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

counts quoted lines

◆ ownSig()

bool ownSig ( const TextLines body,
const TextLines signature 
)

returns true if the signature is found within the body.

◆ quotedLinesBottom()

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

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

◆ quoteBlockCount()

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

Returns the number of the quote blocks.

◆ microsoftAttributionLineNumber()

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.

◆ main()

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

Variable Documentation

◆ err_noinput

const int err_noinput = 255

◆ err_nosigfile

const int err_nosigfile = 254

◆ err_options

const int err_options = 253

◆ argp_program_version

const char* argp_program_version = "fullquottel 0.1.5"

◆ argp_program_bug_address

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