diff options
| author | Sadie Powell <sadie@witchery.services> | 2025-03-11 13:05:43 +0000 |
|---|---|---|
| committer | Sadie Powell <sadie@witchery.services> | 2025-03-12 00:16:15 +0000 |
| commit | 2276c62ff02755f536de7d153368c3b9547beb23 (patch) | |
| tree | 77ad165cb9a1aa590f82b980d80493774e4aafe1 /include | |
| parent | fb0ee27df030547b9f79d4c485c0e6300e1c96bb (diff) | |
Move serialization data type logic from sql.h to the core.
Diffstat (limited to 'include')
| -rw-r--r-- | include/modules/sql.h | 14 | ||||
| -rw-r--r-- | include/serialize.h | 9 |
2 files changed, 6 insertions, 17 deletions
diff --git a/include/modules/sql.h b/include/modules/sql.h index 81af2e597..18d169d81 100644 --- a/include/modules/sql.h +++ b/include/modules/sql.h @@ -19,7 +19,6 @@ namespace SQL public: typedef std::map<Anope::string, std::stringstream *> Map; Map data; - std::map<Anope::string, Serialize::DataType> types; ~Data() { @@ -59,19 +58,6 @@ namespace SQL delete value; this->data.clear(); } - - void SetType(const Anope::string &key, Serialize::DataType dt) override - { - this->types[key] = dt; - } - - Serialize::DataType GetType(const Anope::string &key) const override - { - auto it = this->types.find(key); - if (it != this->types.end()) - return it->second; - return Serialize::DataType::TEXT; - } }; /** A SQL exception, can be thrown at various points diff --git a/include/serialize.h b/include/serialize.h index 1459a1ebd..a4895ac0c 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -28,8 +28,11 @@ namespace Serialize UINT, }; - class Data + class CoreExport Data { + protected: + std::map<Anope::string, Serialize::DataType> types; + public: virtual ~Data() = default; @@ -54,8 +57,8 @@ namespace Serialize virtual size_t Hash() const { throw CoreException("Not supported"); } - virtual void SetType(const Anope::string &key, DataType dt) { } - virtual DataType GetType(const Anope::string &key) const { return DataType::TEXT; } + Serialize::DataType GetType(const Anope::string &key) const; + void SetType(const Anope::string &key, Serialize::DataType dt); }; extern void RegisterTypes(); |
