consolidate all repos to one for archive
This commit is contained in:
7
semester_2/programiranje_2/naloga1002/Artist.cpp
Normal file
7
semester_2/programiranje_2/naloga1002/Artist.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "Artist.h"
|
||||
|
||||
Artist::Artist(std::string name, std::string biography, unsigned int day, unsigned int month, unsigned int year) : name(name), biography(biography), dateOfBirth(day, month, year){}
|
||||
|
||||
std::string Artist::toString() const {
|
||||
return name + ", " + biography + ", " + dateOfBirth.toString();
|
||||
}
|
20
semester_2/programiranje_2/naloga1002/Artist.h
Normal file
20
semester_2/programiranje_2/naloga1002/Artist.h
Normal file
@@ -0,0 +1,20 @@
|
||||
#ifndef NALOGA0201_ARTIST_H
|
||||
#define NALOGA0201_ARTIST_H
|
||||
|
||||
#include "Date.h"
|
||||
|
||||
class Artist {
|
||||
private:
|
||||
std::string name, biography;
|
||||
Date dateOfBirth;
|
||||
public:
|
||||
Artist() = default;
|
||||
|
||||
Artist(std::string name, std::string biography, unsigned int day, unsigned int month, unsigned int year);
|
||||
|
||||
~Artist() = default;
|
||||
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
#endif //NALOGA0201_ARTIST_H
|
21
semester_2/programiranje_2/naloga1002/Artwork.cpp
Normal file
21
semester_2/programiranje_2/naloga1002/Artwork.cpp
Normal file
@@ -0,0 +1,21 @@
|
||||
#include "Artwork.h"
|
||||
|
||||
Artwork::Artwork(std::string title, std::string description, int price, int year, std::shared_ptr<Artist>artist, double width, double height, double depth) :
|
||||
title(title), description(description), price(price), year(year), artist(artist), dimension(width, height, depth){}
|
||||
|
||||
std::string Artwork::toString() const {
|
||||
return "Title: " + title +
|
||||
"\nDescription: " + description +
|
||||
"\nPrice: " + std::to_string(price) +
|
||||
" EUR\nYear: " + std::to_string(year) +
|
||||
"\nArtist: " + artist->toString() +
|
||||
"\nDimension: " + dimension.toString() + "\n\n";
|
||||
}
|
||||
|
||||
int Artwork::getPrice() const {
|
||||
return price;
|
||||
}
|
||||
|
||||
int Artwork::getYear() const {
|
||||
return year;
|
||||
}
|
28
semester_2/programiranje_2/naloga1002/Artwork.h
Normal file
28
semester_2/programiranje_2/naloga1002/Artwork.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef NALOGA0201_ARTWORK_H
|
||||
#define NALOGA0201_ARTWORK_H
|
||||
|
||||
#include "Artist.h"
|
||||
#include "Dimension.h"
|
||||
#include <memory>
|
||||
|
||||
class Artwork {
|
||||
protected:
|
||||
std::string title, description;
|
||||
int price, year;
|
||||
std::shared_ptr<Artist> artist;
|
||||
Dimension dimension;
|
||||
public:
|
||||
Artwork() = default;
|
||||
|
||||
Artwork(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth);
|
||||
|
||||
~Artwork() = default;
|
||||
|
||||
virtual std::string toString() const;
|
||||
|
||||
int getPrice() const;
|
||||
|
||||
int getYear() const;
|
||||
};
|
||||
|
||||
#endif //NALOGA0201_ARTWORK_H
|
7
semester_2/programiranje_2/naloga1002/Date.cpp
Normal file
7
semester_2/programiranje_2/naloga1002/Date.cpp
Normal file
@@ -0,0 +1,7 @@
|
||||
#include "Date.h"
|
||||
|
||||
Date::Date(unsigned int day, unsigned int month, unsigned int year) : day(day), month(month), year(year) {}
|
||||
|
||||
std::string Date::toString() const {
|
||||
return std::to_string(day) + ", " + std::to_string(month) + ", " + std::to_string(year);
|
||||
}
|
19
semester_2/programiranje_2/naloga1002/Date.h
Normal file
19
semester_2/programiranje_2/naloga1002/Date.h
Normal file
@@ -0,0 +1,19 @@
|
||||
#ifndef NALOGA0201_DATE_H
|
||||
#define NALOGA0201_DATE_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class Date {
|
||||
private:
|
||||
unsigned int day, month, year;
|
||||
public:
|
||||
Date() = default;
|
||||
|
||||
Date(unsigned int day, unsigned int month, unsigned int year);
|
||||
|
||||
~Date() = default;
|
||||
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
#endif //NALOGA0201_DATE_H
|
9
semester_2/programiranje_2/naloga1002/Dimension.cpp
Normal file
9
semester_2/programiranje_2/naloga1002/Dimension.cpp
Normal file
@@ -0,0 +1,9 @@
|
||||
#include "Dimension.h"
|
||||
|
||||
Dimension::Dimension(double width, double height, double depth) : width(width), height(height), depth(depth) {
|
||||
|
||||
}
|
||||
|
||||
std::string Dimension::toString() const {
|
||||
return std::to_string(width) + " " + std::to_string(height) + " " + std::to_string(depth);
|
||||
}
|
18
semester_2/programiranje_2/naloga1002/Dimension.h
Normal file
18
semester_2/programiranje_2/naloga1002/Dimension.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef NALOGA0201_DIMENSION_H
|
||||
#define NALOGA0201_DIMENSION_H
|
||||
|
||||
#include <string>
|
||||
|
||||
class Dimension {
|
||||
private:
|
||||
double width, height, depth;
|
||||
public:
|
||||
Dimension() = default;
|
||||
Dimension(double width, double height, double depth);
|
||||
~Dimension() = default;
|
||||
|
||||
std::string toString() const;
|
||||
};
|
||||
|
||||
|
||||
#endif //NALOGA0201_DIMENSION_H
|
43
semester_2/programiranje_2/naloga1002/Functions.h
Normal file
43
semester_2/programiranje_2/naloga1002/Functions.h
Normal file
@@ -0,0 +1,43 @@
|
||||
#ifndef NALOGA1001_FUNCTIONS_H
|
||||
#define NALOGA1001_FUNCTIONS_H
|
||||
|
||||
#include "Artwork.h"
|
||||
|
||||
bool ascendingYear(std::shared_ptr<Artwork> i, std::shared_ptr<Artwork> j){
|
||||
std::shared_ptr<Artwork>tmp;
|
||||
if(i->getYear() < j->getYear()){
|
||||
tmp = i;
|
||||
i = j;
|
||||
j = tmp;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
bool descandingYear(std::shared_ptr<Artwork> i, std::shared_ptr<Artwork> j){
|
||||
std::shared_ptr<Artwork>tmp;
|
||||
if(i->getYear() > j->getYear()){
|
||||
tmp = i;
|
||||
i = j;
|
||||
j = tmp;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
bool ascendingPrice(std::shared_ptr<Artwork> i, std::shared_ptr<Artwork> j){
|
||||
std::shared_ptr<Artwork>tmp;
|
||||
if(i->getPrice() > j->getPrice()){
|
||||
tmp = i;
|
||||
i = j;
|
||||
j = tmp;
|
||||
}
|
||||
return true;
|
||||
};
|
||||
|
||||
bool isRenaissanceArt(std::shared_ptr<Artwork> a){
|
||||
return (a->getYear() > 1400 && a->getYear() < 1600);
|
||||
};
|
||||
|
||||
bool isOlderThan2000(std::shared_ptr<Artwork> a){
|
||||
return a->getYear() < 800;
|
||||
}
|
||||
|
||||
#endif //NALOGA1001_FUNCTIONS_H
|
66
semester_2/programiranje_2/naloga1002/Gallery.cpp
Normal file
66
semester_2/programiranje_2/naloga1002/Gallery.cpp
Normal file
@@ -0,0 +1,66 @@
|
||||
#include "Gallery.h"
|
||||
#include <iostream>
|
||||
|
||||
|
||||
Gallery::Gallery(std::string name) : name(name)
|
||||
{
|
||||
}
|
||||
|
||||
void Gallery::addArtwork(std::shared_ptr<Artwork> artwork)
|
||||
{
|
||||
artworks.push_back(artwork);
|
||||
}
|
||||
|
||||
void Gallery::printArtworks() const
|
||||
{
|
||||
for (auto &artwork: artworks)
|
||||
std::cout << artwork->toString() << std::endl;
|
||||
}
|
||||
|
||||
std::string Gallery::toString() const
|
||||
{
|
||||
std::string ret;
|
||||
for (auto &artwork: artworks) ret += artwork->toString() + "\n\n";
|
||||
return ret;
|
||||
}
|
||||
|
||||
int Gallery::getSize() const
|
||||
{
|
||||
return artworks.size();
|
||||
};
|
||||
|
||||
void Gallery::sort(std::function<bool(std::shared_ptr<Artwork>, std::shared_ptr<Artwork>)> c)
|
||||
{
|
||||
for (int i = 0; i < artworks.size(); ++i)
|
||||
{
|
||||
for (int j = 0; j < artworks.size() - i - 1; ++j)
|
||||
{
|
||||
c(artworks[j], artworks[j + 1]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
std::shared_ptr<Artwork> Gallery::find(std::function<bool(std::shared_ptr<Artwork>)> c)
|
||||
{
|
||||
auto it = std::find_if(artworks.begin(), artworks.end(), c);
|
||||
return *it;
|
||||
}
|
||||
|
||||
void Gallery::printArtworks(PrintIfPainting i)
|
||||
{
|
||||
std::for_each(artworks.begin(), artworks.end(), i);
|
||||
}
|
||||
|
||||
void Gallery::filterOut(std::function<bool(std::shared_ptr<Artwork>)> c)
|
||||
{
|
||||
auto it = artworks.begin();
|
||||
for (int i = 0; i < artworks.size(); ++i)
|
||||
{
|
||||
if (c(artworks[i]))
|
||||
{
|
||||
artworks.erase(it);
|
||||
}
|
||||
it++;
|
||||
}
|
||||
}
|
||||
|
57
semester_2/programiranje_2/naloga1002/Gallery.h
Normal file
57
semester_2/programiranje_2/naloga1002/Gallery.h
Normal file
@@ -0,0 +1,57 @@
|
||||
#ifndef NALOGA0201_GALLERY_H
|
||||
#define NALOGA0201_GALLERY_H
|
||||
|
||||
#include "Artwork.h"
|
||||
#include "Painting.h"
|
||||
#include "Literature.h"
|
||||
#include "PaintingLiterature.h"
|
||||
|
||||
#include <vector>
|
||||
#include <algorithm>
|
||||
#include <functional>
|
||||
|
||||
|
||||
struct PrintIfPainting
|
||||
{
|
||||
void operator()(std::shared_ptr<Artwork> e)
|
||||
{
|
||||
std::shared_ptr<Painting> derived;
|
||||
derived = std::dynamic_pointer_cast<Painting>(e);
|
||||
if (derived)
|
||||
{
|
||||
std::cout << derived->toString() << "\n";
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
class Gallery
|
||||
{
|
||||
private:
|
||||
std::string name;
|
||||
std::vector<std::shared_ptr<Artwork>> artworks;
|
||||
public:
|
||||
Gallery() = default;
|
||||
|
||||
explicit Gallery(std::string name);
|
||||
|
||||
~Gallery() = default;
|
||||
|
||||
void addArtwork(std::shared_ptr<Artwork> artwork);
|
||||
|
||||
void printArtworks() const;
|
||||
|
||||
std::string toString() const;
|
||||
|
||||
int getSize() const;
|
||||
|
||||
void sort(std::function<bool(std::shared_ptr<Artwork>, std::shared_ptr<Artwork>)> c);
|
||||
|
||||
std::shared_ptr<Artwork> find(std::function<bool(std::shared_ptr<Artwork>)> c);
|
||||
|
||||
void printArtworks(PrintIfPainting i);
|
||||
|
||||
void filterOut(std::function<bool(std::shared_ptr<Artwork>)> c);
|
||||
};
|
||||
|
||||
#endif //NALOGA0201_GALLERY_H
|
||||
|
55
semester_2/programiranje_2/naloga1002/Literature.cpp
Normal file
55
semester_2/programiranje_2/naloga1002/Literature.cpp
Normal file
@@ -0,0 +1,55 @@
|
||||
#include "Literature.h"
|
||||
|
||||
Literature::Literature(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth, LiteratureType material) :
|
||||
Artwork(title, description, price, year, artist, width, height, depth), material(material)
|
||||
{}
|
||||
|
||||
std::string Literature::getMaterial() const
|
||||
{
|
||||
switch (material)
|
||||
{
|
||||
case LiteratureType::Drama:
|
||||
return "Drama";
|
||||
break;
|
||||
case LiteratureType::Biography:
|
||||
return "Biography";
|
||||
break;
|
||||
case LiteratureType::Poetry:
|
||||
return "Poetry";
|
||||
break;
|
||||
case LiteratureType::Prose:
|
||||
return "Prose";
|
||||
break;
|
||||
case LiteratureType::ScienceFiction:
|
||||
return "Science fiction";
|
||||
break;
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
std::string Literature::toString() const
|
||||
{
|
||||
return "Title: " + title +
|
||||
"\nDescription: " + description +
|
||||
"\nPrice: " + std::to_string(price) +
|
||||
" EUR\nYear: " + std::to_string(year) +
|
||||
"\nArtist: " + artist->toString() +
|
||||
"\nDimension: " + dimension.toString() +
|
||||
"\nLiterature type: " + getMaterial() + "\n\n";
|
||||
}
|
||||
|
||||
void Literature::print() const
|
||||
{
|
||||
std::cout <<
|
||||
"Title: " << title <<
|
||||
"\nDescription: " << description <<
|
||||
"\nPrice: " << std::to_string(price) <<
|
||||
" EUR\nYear: " << std::to_string(year) <<
|
||||
"\nArtist: " << artist->toString() <<
|
||||
"\nDimension: " << dimension.toString() <<
|
||||
"\nLiterature type: " << getMaterial() << "\n\n";
|
||||
}
|
||||
|
||||
Literature::Literature()
|
||||
{}
|
29
semester_2/programiranje_2/naloga1002/Literature.h
Normal file
29
semester_2/programiranje_2/naloga1002/Literature.h
Normal file
@@ -0,0 +1,29 @@
|
||||
#ifndef NALOGA0201_LITERATURE_H
|
||||
#define NALOGA0201_LITERATURE_H
|
||||
|
||||
#include "Artwork.h"
|
||||
#include <iostream>
|
||||
|
||||
enum class LiteratureType
|
||||
{
|
||||
Drama, Biography, Poetry, Prose, ScienceFiction,
|
||||
};
|
||||
|
||||
class Literature : public Artwork
|
||||
{
|
||||
private:
|
||||
LiteratureType material;
|
||||
public:
|
||||
Literature(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth, LiteratureType material);
|
||||
|
||||
Literature();
|
||||
|
||||
std::string getMaterial() const;
|
||||
|
||||
std::string toString() const override;
|
||||
|
||||
void print() const;
|
||||
};
|
||||
|
||||
|
||||
#endif //NALOGA0201_LITERATURE_H
|
35
semester_2/programiranje_2/naloga1002/Painting.cpp
Normal file
35
semester_2/programiranje_2/naloga1002/Painting.cpp
Normal file
@@ -0,0 +1,35 @@
|
||||
#include "Painting.h"
|
||||
|
||||
Painting::Painting(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth, PaintingTechnique technique) :
|
||||
Artwork(title, description, price, year, artist, width, height, depth), technique(technique)
|
||||
{}
|
||||
|
||||
std::string Painting::getTechnique() const
|
||||
{
|
||||
switch (technique)
|
||||
{
|
||||
case PaintingTechnique::Oil:
|
||||
return "Oil";
|
||||
break;
|
||||
case PaintingTechnique::Acrylic:
|
||||
return "Acrylic";
|
||||
break;
|
||||
case PaintingTechnique::Graphite:
|
||||
return "Graphite";
|
||||
break;
|
||||
default:
|
||||
return "?";
|
||||
}
|
||||
}
|
||||
|
||||
std::string Painting::toString() const
|
||||
{
|
||||
return "Title: " + title +
|
||||
"\nDescription: " + description +
|
||||
"\nPrice: " + std::to_string(price) +
|
||||
" EUR\nYear: " + std::to_string(year) +
|
||||
"\nArtist: " + artist->toString() +
|
||||
"\nDimension: " + dimension.toString() +
|
||||
"\nPainting technique: " + getTechnique() + "\n\n";
|
||||
}
|
||||
|
30
semester_2/programiranje_2/naloga1002/Painting.h
Normal file
30
semester_2/programiranje_2/naloga1002/Painting.h
Normal file
@@ -0,0 +1,30 @@
|
||||
#ifndef NALOGA0201_PAINTING_H
|
||||
#define NALOGA0201_PAINTING_H
|
||||
|
||||
#include "Artwork.h"
|
||||
|
||||
enum class PaintingTechnique
|
||||
{
|
||||
Oil,
|
||||
Acrylic,
|
||||
Graphite
|
||||
};
|
||||
|
||||
class Painting : public Artwork
|
||||
{
|
||||
private:
|
||||
PaintingTechnique technique;
|
||||
public:
|
||||
Painting() = default;
|
||||
|
||||
Painting(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth, PaintingTechnique technique);
|
||||
|
||||
~Painting() = default;
|
||||
|
||||
std::string getTechnique() const;
|
||||
|
||||
std::string toString() const override;
|
||||
};
|
||||
|
||||
|
||||
#endif //NALOGA0201_PAINTING_H
|
23
semester_2/programiranje_2/naloga1002/PaintingLiterature.cpp
Normal file
23
semester_2/programiranje_2/naloga1002/PaintingLiterature.cpp
Normal file
@@ -0,0 +1,23 @@
|
||||
//
|
||||
// Created by Nik on 16/05/2022.
|
||||
//
|
||||
|
||||
#include "PaintingLiterature.h"
|
||||
|
||||
PaintingLiterature::PaintingLiterature(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth,
|
||||
PaintingTechnique technique, LiteratureType material) :
|
||||
Painting(title, description, price, year, artist, width, height, depth, technique),
|
||||
Literature(title, description, price, year, artist, width, height, depth, material)
|
||||
{}
|
||||
|
||||
std::string PaintingLiterature::toString() const
|
||||
{
|
||||
return "Title: " + Painting::title +
|
||||
"\nDescription: " + Painting::description +
|
||||
"\nPrice: " + std::to_string(Painting::price) +
|
||||
" EUR\nYear: " + std::to_string(Painting::year) +
|
||||
"\nArtist: " + Painting::artist->toString() +
|
||||
"\nDimension: " + Painting::dimension.toString() +
|
||||
"\nPainting technique: " + getTechnique() +
|
||||
"\nLiterature type: " + getMaterial() + "\n\n";
|
||||
}
|
24
semester_2/programiranje_2/naloga1002/PaintingLiterature.h
Normal file
24
semester_2/programiranje_2/naloga1002/PaintingLiterature.h
Normal file
@@ -0,0 +1,24 @@
|
||||
//
|
||||
// Created by Nik on 16/05/2022.
|
||||
//
|
||||
|
||||
#ifndef NALOGA1002_PAINTINGLITERATURE_H
|
||||
#define NALOGA1002_PAINTINGLITERATURE_H
|
||||
|
||||
#include "Painting.h"
|
||||
#include "Literature.h"
|
||||
|
||||
|
||||
class PaintingLiterature : public Painting, public Literature
|
||||
{
|
||||
public:
|
||||
PaintingLiterature() = default;
|
||||
|
||||
PaintingLiterature(std::string title, std::string description, int price, int year, std::shared_ptr<Artist> artist, double width, double height, double depth, PaintingTechnique technique,
|
||||
LiteratureType material);
|
||||
|
||||
std::string toString() const override;
|
||||
};
|
||||
|
||||
|
||||
#endif //NALOGA1002_PAINTINGLITERATURE_H
|
29
semester_2/programiranje_2/naloga1002/README.md
Normal file
29
semester_2/programiranje_2/naloga1002/README.md
Normal file
@@ -0,0 +1,29 @@
|
||||
Uporabite in razširite nalogo 10.1 po spodnjih navodilih.
|
||||
|
||||
Vse raw kazalce v kodi zamenjajte z std::shared_ptr (naj bo v kombinaciji z std::make_shared in ne new).
|
||||
|
||||
Pri nalogi 10.1 smo uporabili sledečo notacijo funkcije kot paramenter Artwork* find(bool (*c)(Artwork*));. Od verzije C++11 imamo na voljo std::function, ki omogoča, da lahko podamo funkcijo kot parameter kot objekt.
|
||||
|
||||
Torej na primeru metode find bi nova notacija izgledala takole: Artwork* find(std::function<bool(Artwork*)> c);
|
||||
|
||||
V glavnem programu podprite naslednjo vrstico kode, ki iz vektorja artworks odstrani vse umetnine, ki ustrezajo glede na podano funkcijo.
|
||||
|
||||
cout << "\nBefore filter: \n";
|
||||
cout << gallery.toString();
|
||||
gallery.filterOut(isOlderThan2000);
|
||||
cout << "\nAfter filter: \n";
|
||||
cout << gallery.toString();
|
||||
|
||||
V razredu Gallery dodajte in implementirajte metodo filterOut, ki kot parameter prejme funkcijo (uporabite std::function), ki naj ima izhodni tip bool prejme pa std::shared_ptr<Artwork>. Metoda mora odstraniti umetnine iz artworks, ki ustrezajo glede na podano funkcijo.
|
||||
|
||||
Za potrebe metode filterOut dodajte v glavni program še funkcijo bool isOlderThan2000(std::shared_ptr<Artwork> a), ki vrne true, če je slika starejša od leta 2000, sicer vrne false.
|
||||
|
||||
Namesto, da kot parameter podamo že vnaprej spisano funkcijo (tako kot smo npr. isOlderThan2000), lahko uporabimo tudi lambda izraz . Primer lambda izraza pri nalogi 10.1 bi lahko bil pri sort, namesto podane funkcije ascendingYear:
|
||||
|
||||
gallery.sort([](std::shared_ptr<Artwork> i, std::shared_ptr<Artwork> j){
|
||||
return i->getYear() < j->getYear();
|
||||
});
|
||||
|
||||
V glavnem programu kličete metodo filterOut in podate funkcijo kot parameter v obliki lambda izraza. Napiši na takšen način, da boste odstranili umetnine, ki so cenejše od 100€ (torej ne smete imeti posebej deklarirane funkcije).
|
||||
|
||||
Izmislite in implementirajte smiselni primer za večkratno dedovanje (pri tem ni dovoljena uporaba primera s predavanj).
|
71
semester_2/programiranje_2/naloga1002/main.cpp
Normal file
71
semester_2/programiranje_2/naloga1002/main.cpp
Normal file
@@ -0,0 +1,71 @@
|
||||
#include <iostream>
|
||||
|
||||
#include "Gallery.h"
|
||||
#include "Functions.h"
|
||||
|
||||
int main() {
|
||||
Gallery slo("galer");
|
||||
|
||||
std::shared_ptr<Artist> artist1 = std::make_shared<Artist>("Leonardo da Vinci", "biografi", 15, 4, 1452);
|
||||
std::shared_ptr<Artwork> art1 = std::make_shared<Artwork>("Mona Lisa", "desc", 60, 1797, artist1, 32, 56, 94);
|
||||
slo.addArtwork(art1);
|
||||
|
||||
std::shared_ptr<Artist> artist2 = std::make_shared<Artist>("Vincent van Goth", "bio", 30, 3, 1853);
|
||||
std::shared_ptr<Artwork> art2 = std::make_shared<Artwork>("The starry Night", "desc", 256, 1889, artist2, 56, 86, 15);
|
||||
slo.addArtwork(art2);
|
||||
|
||||
std::shared_ptr<Artist> artist3 = std::make_shared<Artist>("Jahannes Vermeer", "biog", 1, 10, 1632);
|
||||
std::shared_ptr<Artwork> art3 = std::make_shared<Artwork>("Girl with a Pearl Erring", "desc", 568, 700, artist3, 59, 56, 1);
|
||||
slo.addArtwork(art3);
|
||||
|
||||
std::shared_ptr<Artist> artist4 = std::make_shared<Artist>("Gustav Klimt", "biog", 14, 7, 1862);
|
||||
std::shared_ptr<Artwork> art4 = std::make_shared<Artwork>("The kiss", "desc", 465, 1907, artist4, 47, 56, 2);
|
||||
slo.addArtwork(art4);
|
||||
|
||||
std::shared_ptr<Artist> artist5 = std::make_shared<Artist>("Sandro Botticelli", "biog", 17, 5, 1510);
|
||||
std::shared_ptr<Artwork> art5 = std::make_shared<Artwork>("The birth of Venus", "desc", 573, 1458, artist5, 56, 89, 3.56);
|
||||
slo.addArtwork(art5);
|
||||
|
||||
std::shared_ptr<Painting> painting1 = std::make_shared<Painting>("itoao", "desc", 1598, 789, artist3, 43, 4, 7, PaintingTechnique::Oil);
|
||||
slo.addArtwork(painting1);
|
||||
|
||||
std::shared_ptr<Painting> painting2 = std::make_shared<Painting>("ito", "de", 1598, 999, artist3, 43, 4, 7, PaintingTechnique::Acrylic);
|
||||
slo.addArtwork(painting2);
|
||||
|
||||
std::shared_ptr<Literature> Liter = std::make_shared<Literature>("liter", "description", 597, 1590, artist2, 56, 86, 15, LiteratureType::Biography);
|
||||
slo.addArtwork(Liter);
|
||||
std::cout << slo.getSize() << "\n";
|
||||
slo.printArtworks();
|
||||
//std::cout << slo.toString();
|
||||
std::cout << "--------------Sort-----------------\n";
|
||||
std::cout << slo.getSize() << "\n";
|
||||
slo.sort(ascendingPrice);
|
||||
slo.printArtworks();
|
||||
|
||||
std::cout << "------------FindRenaissance-------------------\n";
|
||||
std::cout << slo.find(isRenaissanceArt)->toString();
|
||||
|
||||
std::cout << "------------Print paint-------------------\n";
|
||||
PrintIfPainting paint;
|
||||
slo.printArtworks(paint);
|
||||
|
||||
std::cout << "------------filter older-------------------\n";
|
||||
slo.filterOut(isOlderThan2000);
|
||||
std::cout << slo.getSize() << "\n";
|
||||
slo.printArtworks();
|
||||
|
||||
std::cout << "------------filter chip-------------------\n";
|
||||
slo.filterOut([](std::shared_ptr<Artwork> i) {
|
||||
return i->getPrice() < 100;
|
||||
});
|
||||
std::cout << slo.getSize() << "\n";
|
||||
slo.printArtworks();
|
||||
|
||||
std::cout << "------------dedovanje-------------------\n";
|
||||
|
||||
PaintingLiterature ha("title", "descp", 44455, 544, artist1, 55, 56, 89, PaintingTechnique::Oil, LiteratureType::Biography);
|
||||
std::cout << ha.toString();
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
Reference in New Issue
Block a user