fullquottel
|
#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. | |
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 "eChars) |
returns true, if the line begins with the specified Quotestrings | |
bool | cutSignature (TextLines &body, const string "eChars) |
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 "eChars) |
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 "eChars) |
returns the amount of quoted lines at the bottom of the message | |
unsigned | quoteBlockCount (const TextLines &bodyNoSig, const string "eChars) |
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.3" |
const char * | argp_program_bug_address = "<toast@toastfreeware.priv.at>" |
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 |
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 | ||
) |
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.
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
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[] | ||
) |
const int err_noinput = 255 |
const int err_nosigfile = 254 |
const int err_options = 253 |
const char* argp_program_version = "fullquottel 0.1.3" |
const char* argp_program_bug_address = "<toast@toastfreeware.priv.at>" |