-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTask.h
More file actions
65 lines (47 loc) · 1.67 KB
/
Task.h
File metadata and controls
65 lines (47 loc) · 1.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
* Task.h
*
* Created on: 27 Nov 2011
* Author: Max Foster
*/
#ifndef TASK_H_
#define TASK_H_
#include <fstream>
#include <ctime>
#include "Record.h"
class Task : public Record
{
public:
static const std::string databaseFilename;
static const int minDescriptionLength, maxDescriptionLength;
static int size();
bool pending;
Task(const int jobId = -1, const time_t date = 0, const char *description = "");
Task(const Task &task);
~Task();
void operator =(const Task &task);
void writeToFile(std::fstream &file) const;
void readFromFile(std::fstream &file);
bool hasMatchingField(const std::string &fieldName, const int searchTerm) const;
bool hasMatchingField(const std::string &fieldName, const time_t searchTerm) const;
bool hasMatchingField(const std::string &fieldName, const char *searchTerm) const;
bool hasMatchingField(const std::string &fieldName, const double searchTerm) const;
bool fieldCompare(const Task &rhs) const;
bool completeCompare(const Task &rhs) const;
int getJobId() const;
void setJobId(const int newJobId);
static bool isValidJobId(const int value, std::string &errorMessage);
time_t getDate() const;
void setDate(const time_t newDate);
static bool isValidDate(const time_t value, std::string &errorMessage);
const char * getDescription() const;
void setDescription(const char *newDescription);
static bool isValidDescription(const char *value, std::string &errorMessage);
void validate() const;
private:
int jobId;
time_t date;
char *description;
};
std::ostream & operator <<(std::ostream &stream, const Task &task);
#endif /* TASK_H_ */