// // Print Job // #include #include using namespace std ; #include "Time.h" #include "Priority.h" #include "PrintJob.h" // Pre - output stream and object to print // Post - put into "FILENAME.EXT TIME (PRIORITY)" format ostream & operator<<(ostream & out, const PrintJob & other) // overloaded << { // print out in the following format // Example 1: // Homework3.doc 3:42 PM (HIGH) // Example 2: // Lecture12.pdf 7:12 AM (LOW) // Example 3: // Syllabus.txt 11:22 AM (MEDIUM) out << other.FileName << "." << other.Extension << " " ; out << other.PrintTime << " (" << other.p << ")" ; return out ; } // Pre - none // Post - set to "file1.txt 12:01 AM (LOW)" PrintJob::PrintJob() // default constructor { this->FileName = "file1" ; // default to 'file1' as filename this->Extension = "txt" ; // default to 'txt' extension string def = "12:01 AM" ; this->PrintTime = def ; // default to 12:01 am this->p = Priority::LOW ; // default to low priority } // Pre - filename, extension, printtime, and priority are all filled // Post - puts the filename, extension, printtime, and priority into 'this' object PrintJob::PrintJob(string filename, string extension, Time printtime, Priority p) // fancy constructor 1 { this->FileName = filename ; this->Extension = extension ; this->PrintTime = printtime ; this->p = p ; } // Pre - filename, extension, printtime, and priority are all filled // Post - puts the filename, extension, printtime, and priority into 'this' object PrintJob::PrintJob(string filename, string extension, Time printtime, const int p) // fancy constructor 2 { this->FileName = filename ; this->Extension = extension ; this->PrintTime = printtime ; this->p = p ; } // Pre - filename, extension, printtime, and priority are all filled // Post - puts the filename, extension, printtime, and priority into 'this' object PrintJob::PrintJob(string filename, string extension, string printtime, Priority p) // fancy constructor 3 { this->FileName = filename ; this->Extension = extension ; this->PrintTime = printtime ; this->p = p ; } // Pre - filename, extension, printtime, and priority are all filled // Post - puts the filename, extension, printtime, and priority into 'this' object PrintJob::PrintJob(string filename, string extension, string printtime, const int p) // fancy constructor 4 { this->FileName = filename ; this->Extension = extension ; this->PrintTime = printtime ; this->p = p ; } // Pre - other is an existing object // Post - copies 'other' into 'this' object PrintJob::PrintJob(const PrintJob & other) // copy constructor { this->FileName = other.FileName ; this->Extension = other.Extension ; this->PrintTime = other.PrintTime ; this->p = other.p ; } // Pre - none // Post - none PrintJob::~PrintJob() // destructor { // nothing to do ... no pointers } // Pre - none // Post - return priority Priority PrintJob::GetPriority() const { return this->p ; } // Pre - none // Post - return time Time PrintJob::GetPrintTime() const { return this->PrintTime ; } // Pre - other is an existing object // Post - copies 'other' into 'this' object PrintJob & PrintJob::operator=(const PrintJob & other) // overloaded = { this->FileName = other.FileName ; this->Extension = other.Extension ; this->PrintTime = other.PrintTime ; this->p = other.p ; return *this ; } // Pre - other is an existing object // Post - compares 'other' to 'this' object bool PrintJob::operator==(const PrintJob & other) const // overloaded == { return (this->FileName == other.FileName && this->Extension == other.Extension && this->PrintTime == other.PrintTime && this->p == other.p) ; } // Pre - other is an existing object // Post - compares 'other' to 'this' object bool PrintJob::operator!=(const PrintJob& other) const // overloaded != { return !(this->FileName == other.FileName && this->Extension == other.Extension && this->PrintTime == other.PrintTime && this->p == other.p) ; }