Library: Net Responsibility
Package: Core
Header: ReportBase.h
ReportBase provides basic functionality for making and sending reports, but must be inherited by Report.
Known Derived Classes: Report
Member Functions: generate, getBody, getContentType, getSubject, install, logFinish, name, replaceVar, send, sendCout, sendImprovementData, sendToFile, test, uninstall
ReportBase();
Default constructor. Assigns some default values and logs that the creating of a report started.
ReportBase(
const ReportBase & param3
);
Copy constructor
virtual ~ReportBase();
virtual void generate() = 0;
Override this method in Report to generate nicely formatted reports
string getBody() const;
Returns the content of the reports body
string getContentType() const;
Returns what content-type the email consist of. By default it is "text/plain".
string getSubject() const;
Returns the email's subject
void install();
Call this function if it is an install report
void logFinish();
Logs that the report was successfully created and sent
virtual string name() const = 0;
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.
virtual void sendCout();
Write the report to stdout instead of mailing it. Useful for debugging but really nothing else.
void sendImprovementData();
Sends improvement data to the servers. This is optional for every user.
virtual void sendToFile(
char * filename
);
Write the report to filename instead of mailing it. Useful for debugging but really nothing else.
virtual void test();
Call this function if it is an test report
void uninstall();
Call this function if it is an uninstall report
void replaceVar(
string & subject,
string var,
string replacement
);
Replace {var} with replacement in subject
vector < Path > _attachments;
Attachments to the report. Each Path will be included.
stringstream _body;
The body of the report. Use it to build your Report.
string _contentType;
The content-type of the report. You may change it to "text/html" or whatever suits your purpose.
Database * _db;
Logger * _logger;
Options * _options;
int _reportId;
string _subject;
The subject to be shown in the subject line.