Timetabler
program.cpp
1 #include "fields/program.h"
2 
3 #include <string>
4 #include "global.h"
5 
13 Program::Program(std::string name, CourseType courseType) {
14  this->name = name;
15  this->courseType = courseType;
16 }
17 
26 bool Program::operator==(const Program &other) {
27  return ((this->name == other.name) && (this->courseType == other.courseType));
28 }
29 
35 FieldType Program::getType() { return FieldType::program; }
36 
42 std::string Program::getName() { return name; }
43 
49 bool Program::isCoreProgram() { return courseType == CourseType::core; }
50 
56 std::string Program::getTypeName() { return "Program"; }
57 
65  if (courseType == CourseType::core) {
66  return "Core";
67  }
68  return "Elective";
69 }
70 
77 std::string Program::getNameWithType() {
78  return name + " " + getCourseTypeName();
79 }
Class for a program.
Definition: program.h:27
bool operator==(const Program &other)
Checks if two Program objects are identical, which is whether they have the same name and course type...
Definition: program.cpp:26
FieldType getType()
Gets the type under the FieldType enum.
Definition: program.cpp:35
Program(std::string, CourseType)
Constructs the Program object.
Definition: program.cpp:13
std::string getName()
Gets the name of the Program.
Definition: program.cpp:42
FieldType
Enum that represents all the field types.
Definition: global.h:9
std::string getNameWithType()
Gets the name with type. The result is the program name, followed by a space, and followed by its typ...
Definition: program.cpp:77
std::string getTypeName()
Gets the type name, which is "Program".
Definition: program.cpp:56
bool isCoreProgram()
Determines if the Program has a Course as core.
Definition: program.cpp:49
std::string getCourseTypeName()
Gets the course type name as a string.
Definition: program.cpp:64
CourseType
Enum Class for course type.
Definition: program.h:13