NetResponsibility

class ReportBase

Library: Net Responsibility
Package: Core
Header: ReportBase.h

Description

ReportBase provides basic functionality for making and sending reports, but must be inherited by Report.

Inheritance

Known Derived Classes: Report

Member Summary

Member Functions: generate, getBody, getContentType, getSubject, install, logFinish, name, replaceVar, send, sendCout, sendImprovementData, sendToFile, test, uninstall

Constructors

ReportBase

ReportBase();

Default constructor. Assigns some default values and logs that the creating of a report started.

ReportBase

ReportBase(
    const ReportBase & param3
);

Copy constructor

Destructor

~ReportBase virtual

virtual ~ReportBase();

Member Functions

generate virtual

virtual void generate() = 0;

Override this method in Report to generate nicely formatted reports

getBody

string getBody() const;

Returns the content of the reports body

getContentType

string getContentType() const;

Returns what content-type the email consist of. By default it is "text/plain".

getSubject

string getSubject() const;

Returns the email's subject

install

void install();

Call this function if it is an install report

logFinish

void logFinish();

Logs that the report was successfully created and sent

name virtual

virtual string name() const = 0;

Override this method in Report. Should actually only return the class name, which is "Report".

send virtual

virtual int send(
    bool receiveCopy = false
);

Send the report. Set receiveCopy to true if you wish to send a report to the user as well as the Accountability Partners.

sendCout virtual

virtual void sendCout();

Write the report to stdout instead of mailing it. Useful for debugging but really nothing else.

sendImprovementData

void sendImprovementData();

Sends improvement data to the servers. This is optional for every user.

sendToFile virtual

virtual void sendToFile(
    char * filename
);

Write the report to filename instead of mailing it. Useful for debugging but really nothing else.

test virtual

virtual void test();

Call this function if it is an test report

uninstall

void uninstall();

Call this function if it is an uninstall report

replaceVar protected

void replaceVar(
    string & subject,
    string var,
    string replacement
);

Replace {var} with replacement in subject

Variables

_attachments protected

vector < Path > _attachments;

Attachments to the report. Each Path will be included.

_body protected

stringstream _body;

The body of the report. Use it to build your Report.

_contentType protected

string _contentType;

The content-type of the report. You may change it to "text/html" or whatever suits your purpose.

_db protected

Database * _db;

_logger protected

Logger * _logger;

_options protected

Options * _options;

_reportId protected

int _reportId;

_subject protected

string _subject;

The subject to be shown in the subject line.