libnick 2025.7.3
A cross-platform base for native Nickvision applications.
Loading...
Searching...
No Matches
datafilebase.h
Go to the documentation of this file.
1
22
23#ifndef DATAFILEBASE_H
24#define DATAFILEBASE_H
25
26#include <filesystem>
27#include <string>
28#include <boost/json.hpp>
29#include "events/event.h"
30
31namespace Nickvision::App
32{
37 {
38 public:
47 DataFileBase(const std::string& key, const std::string& appName, bool isPortable);
51 virtual ~DataFileBase() = default;
56 const std::string& getKey() const;
66 bool save();
67
68 protected:
69 mutable boost::json::object m_json;
70
71 private:
72 std::string m_key;
73 std::filesystem::path m_path;
75 };
76}
77
78#endif //DATAFILEBASE_H
const std::string & getKey() const
Events::Event< Events::EventArgs > & saved()
Gets the Saved event.
DataFileBase(const std::string &key, const std::string &appName, bool isPortable)
Constructs a DataFileBase, loading the file from disk.
boost::json::object m_json
Definition datafilebase.h:69
virtual ~DataFileBase()=default
Destructs a DataFileBase.
bool save()
Saves the config file to disk.
An event that can have handlers subscribe to it, which in turn will be called when the event is invok...
Definition event.h:49
Definition appinfo.h:32