consolidate all repos to one for archive
This commit is contained in:
46
semester_2/programiranje_2/naloga1001/Gallery.h
Normal file
46
semester_2/programiranje_2/naloga1001/Gallery.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef NALOGA0201_GALLERY_H
|
||||
#define NALOGA0201_GALLERY_H
|
||||
|
||||
#include "Artwork.h"
|
||||
#include "Painting.h"
|
||||
#include "Literature.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
|
||||
struct PrintIfPainting{
|
||||
void operator()(Artwork* e){
|
||||
if(auto* derived = dynamic_cast<Painting*> (e)){
|
||||
std::cout << derived->toString() << "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class Gallery {
|
||||
private:
|
||||
std::string name;
|
||||
std::vector<Artwork *> artworks;
|
||||
public:
|
||||
Gallery() = default;
|
||||
|
||||
explicit Gallery(std::string name);
|
||||
|
||||
~Gallery() = default;
|
||||
|
||||
void addArtwork(Artwork *artwork);
|
||||
|
||||
void printArtworks() const;
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
void sort(bool (*c)(Artwork*, Artwork*));
|
||||
|
||||
void printArtworks(PrintIfPainting i);
|
||||
|
||||
Artwork* find(bool (*c)(Artwork*));
|
||||
|
||||
std::vector<Artwork *> filteredVector(bool (*c)(Artwork*));
|
||||
};
|
||||
|
||||
#endif //NALOGA0201_GALLERY_H
|
||||
|
||||
Reference in New Issue
Block a user