aboutsummaryrefslogtreecommitdiff
path: root/oop2eindopdr/PokemonCard.h
diff options
context:
space:
mode:
Diffstat (limited to 'oop2eindopdr/PokemonCard.h')
-rw-r--r--oop2eindopdr/PokemonCard.h25
1 files changed, 16 insertions, 9 deletions
diff --git a/oop2eindopdr/PokemonCard.h b/oop2eindopdr/PokemonCard.h
index 5341866..1ac6708 100644
--- a/oop2eindopdr/PokemonCard.h
+++ b/oop2eindopdr/PokemonCard.h
@@ -4,8 +4,13 @@
#include <string>
#include <vector>
+class PokemonCard; // forward declaration for main.h
+
+#include "main.h"
#include "CacheManager.h"
+class Pokedex;
+
/** @brief single pokemon card */
class PokemonCard {
private:
@@ -14,23 +19,25 @@ private:
virtual void raw_load_json(nlohmann::json raw_data);
virtual void raw_load_cache(const char* cache_path);
- CacheManager* cache_ref = nullptr;
+ Pokedex* pokedex = nullptr;
/** @brief add cache path before filename */
virtual std::string prefix_cache_path(const char* filename);
public:
- PokemonCard(CacheManager* cache_ref = nullptr);
+ PokemonCard(Pokedex* pokedex = nullptr);
virtual ~PokemonCard();
/** @brief string stream output (for printing card) */
friend std::ostream& operator << (std::ostream& output, const PokemonCard& card);
- std::string id; /** @brief pokemon id (with set prefix) */
- std::string name; /** @brief pokemon name */
- unsigned hp; /** @brief pokemon max health points */
- double value; /** @brief pokemon card current market value */
- std::vector<std::string> attacks; /** @brief list of possible attacks */
+ std::string id = ""; /** @brief pokemon id (with set prefix) */
+ std::string name = ""; /** @brief pokemon name */
+ unsigned hp = 0; /** @brief pokemon max health points */
+ double value = 0.f; /** @brief pokemon card current market value */
+ std::vector<std::string> attacks = {}; /** @brief list of possible attacks */
+
+ virtual std::string short_identifier();
/** @brief use API to fetch `this->hp` */
virtual void fetch_market_value();
@@ -44,7 +51,7 @@ public:
struct from_cache;
/** @brief set cache */
- virtual void set_cache(CacheManager* cache_ref);
+ virtual void set_pokedex(Pokedex* pokedex);
};
struct PokemonCard::from_json : public PokemonCard {
@@ -54,7 +61,7 @@ struct PokemonCard::from_json : public PokemonCard {
};
struct PokemonCard::from_cache : public PokemonCard {
- from_cache(CacheManager* cache_ref, std::string cache_path) : PokemonCard(cache_ref) {
+ from_cache(Pokedex* pokedex, std::string cache_path) : PokemonCard(pokedex) {
PokemonCard::raw_load_cache(cache_path.c_str());
}
};