diff options
author | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
---|---|---|
committer | Kae <80987908+Novaenia@users.noreply.github.com> | 2023-06-20 14:33:09 +1000 |
commit | 6352e8e3196f78388b6c771073f9e03eaa612673 (patch) | |
tree | e23772f79a7fbc41bc9108951e9e136857484bf4 /source/platform/StarStatisticsService.hpp | |
parent | 6741a057e5639280d85d0f88ba26f000baa58f61 (diff) |
everything everywhere
all at once
Diffstat (limited to 'source/platform/StarStatisticsService.hpp')
-rw-r--r-- | source/platform/StarStatisticsService.hpp | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/source/platform/StarStatisticsService.hpp b/source/platform/StarStatisticsService.hpp new file mode 100644 index 0000000..c6afec7 --- /dev/null +++ b/source/platform/StarStatisticsService.hpp @@ -0,0 +1,40 @@ +#ifndef STAR_STATS_BACKEND_HPP +#define STAR_STATS_BACKEND_HPP + +#include "StarJson.hpp" + +namespace Star { + +STAR_CLASS(StatisticsService); + +class StatisticsService { +public: + virtual ~StatisticsService() = default; + + virtual bool initialized() const = 0; + virtual Maybe<String> error() const = 0; + + // The functions below aren't valid unless initialized() returns true and + // error() is empty. + + // setStat should return false for stats or types that aren't known by the + // service, without reporting an error. + // By sending all stats to the StatisticsService, we can configure collection + // of new stats entirely on the service, without any modifications to the game. + virtual bool setStat(String const& name, String const& type, Json const& value) = 0; + virtual Json getStat(String const& name, String const& type, Json def = {}) const = 0; + + // reportEvent should return false if the service doesn't handle this event. + virtual bool reportEvent(String const& name, Json const& fields) = 0; + + virtual bool unlockAchievement(String const& name) = 0; + virtual StringSet achievementsUnlocked() const = 0; + + virtual void refresh() = 0; + virtual void flush() = 0; + virtual bool reset() = 0; +}; + +} + +#endif |