Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #ifndef RESOURCE_H_INCLUDED
- #define RESOURCE_H_INCLUDED
- #include <string>
- #include <iostream>
- namespace SoftUni{
- class Resource {
- int id;
- ResourceType type;
- std::string link;
- public:
- Resource(){
- this->id = 0;
- }
- friend std::istream& operator >> (std::istream& in , Resource & object);
- friend std::ostream& operator << (std::ostream& out ,const Resource & object);
- friend bool operator < (const Resource& left, const Resource& right);
- int getId() const {
- return this->id;
- }
- std::string getLink() const {
- return this->link;
- }
- ResourceType getType() const {
- return this->type;
- }
- };
- std::istream& operator >> (std::istream& in , Resource& object){
- std::string type;
- in>>object.id>>type>>object.link;
- if(type == "Presentation"){
- object.type = PRESENTATION;
- }
- else if(type == "Demo"){
- object.type = DEMO;
- }
- else {
- object.type = VIDEO;
- }
- return in;
- }
- std::ostream& operator<< (std::ostream& out, const Resource& p){
- return out<<p.getId()<<" " << p.getType()<<" "<< p.getLink();
- }
- bool operator < (const Resource& left, const Resource& right){
- return left.getId()<right.getId();
- }
- }
- #endif // RESOURCE_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment