Advertisement
Guest User

Untitled

a guest
Dec 22nd, 2019
255
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. #ifndef RESOURCE_H_INCLUDED
  2. #define RESOURCE_H_INCLUDED
  3. #include <sstream>
  4. #include <iostream>
  5. #include <vector>
  6. #include <set>
  7. #include <map>
  8. #include "ResourceType.h"
  9.  
  10. using SoftUni::ResourceType;
  11.  
  12. using namespace std;
  13.  
  14. namespace SoftUni
  15. {
  16.  
  17. class Resource
  18. {
  19. private:
  20. int id = 0 ;
  21. //std::string type;
  22. ResourceType type;
  23. std::string link ;
  24. public:
  25. Resource(){}
  26.  
  27. //std::string getType() ???
  28. enum ResourceType getType(std::ostream& type , enum ResourceType t) // ????
  29. const
  30. {
  31. std::ostringstream Type ;
  32. Type << t ;
  33. return Type ;
  34. return this -> type ;
  35. }
  36. std::string getLink()
  37. const
  38. {
  39. return this -> link ;
  40. }
  41. int getId()
  42. const
  43. {
  44. return this -> id ;
  45. }
  46.  
  47.  
  48. bool operator<( const Resource& resource )
  49. const
  50. {
  51. return ( this-> id ) < resource.id ;
  52. }
  53.  
  54. friend std::istream& operator>> ( std::istream & in , Resource & r ) ;
  55. friend std::ostream& operator<< ( std::ostream & out, Resource & r ) ;
  56. };
  57. std::istream & operator>> ( std::istream &in , Resource &r )
  58. {
  59. std::stringstream ostr ;
  60. in >> r.id ;
  61. std::string word = "Demo";
  62.  
  63. in >> word ;
  64. ostr<<word;
  65. in >> r.link ;
  66. //in >> r.id >> r.type >> r.link ;
  67. // return in ;
  68. }
  69.  
  70. std::ostream& operator<< ( std::ostream &out, const Resource & r )
  71. {
  72. return out << r.getId() << " " << r.getType() << " " << r.getLink() ;
  73. }
  74.  
  75.  
  76.  
  77. }
  78.  
  79. #endif // RESOURCE_H_INCLUDED
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement