aboutsummaryrefslogtreecommitdiff
path: root/oop2eindopdr/Pokedex.cpp
diff options
context:
space:
mode:
authorlonkaars <loek@pipeframe.xyz>2022-12-24 12:04:17 +0100
committerlonkaars <loek@pipeframe.xyz>2022-12-24 12:04:17 +0100
commit95f1aca8b061e60f81f636349e0b9ff76a114bb0 (patch)
tree845e38420acc126190adf45aa60b05fee8f9fc80 /oop2eindopdr/Pokedex.cpp
parent23d23792e5acb06153f3478958c9070778de8edd (diff)
more WIP
Diffstat (limited to 'oop2eindopdr/Pokedex.cpp')
-rw-r--r--oop2eindopdr/Pokedex.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/oop2eindopdr/Pokedex.cpp b/oop2eindopdr/Pokedex.cpp
index 67bc2dc..24de74b 100644
--- a/oop2eindopdr/Pokedex.cpp
+++ b/oop2eindopdr/Pokedex.cpp
@@ -1,11 +1,15 @@
+#include <fstream>
+
+#include "CacheManager.h"
#include "Pokedex.h"
Pokedex::Pokedex() {
-
+ this->cache = new CacheManager("./cache");
+ this->load_collection_local();
}
Pokedex::~Pokedex() {
-
+ delete this->cache;
}
void Pokedex::load_collection_remote() {
@@ -13,11 +17,16 @@ void Pokedex::load_collection_remote() {
}
void Pokedex::load_collection_local() {
-
+ std::fstream& cache_collection = *cache->cache_get("index");
+ std::string card;
+ while (std::getline(cache_collection, card)) {
+ this->cards.push_back(new PokemonCard::from_cache(cache, card));
+ }
}
void Pokedex::verify_collection() {
-
+ for (PokemonCard* card : this->cards)
+ card->verify_files();
}
std::vector<PokemonCard*> Pokedex::search_cards_by_id(std::string query) {