diff options
author | Adam <Adam@anope.org> | 2016-11-25 18:03:38 -0500 |
---|---|---|
committer | Adam <Adam@anope.org> | 2016-11-25 18:03:38 -0500 |
commit | a2047d559972df3e3a1e423827c449accbe1ddd1 (patch) | |
tree | 4570dc9072754668cc4ca27de2df11f4d14cf26f /include | |
parent | a635344582a13d935631fbe930d79d3788359c8a (diff) |
sqlite: reference id of referenced type if available instead of objects
Diffstat (limited to 'include')
-rw-r--r-- | include/serialize.h | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/include/serialize.h b/include/serialize.h index f10563507..cec6d225d 100644 --- a/include/serialize.h +++ b/include/serialize.h @@ -98,6 +98,8 @@ class CoreExport Serialize::Object : public Extensible, public virtual Base std::vector<Edge> GetEdges(TypeBase *); public: + static constexpr const char *NAME = "object"; + Object(TypeBase *type); Object(TypeBase *type, ID); @@ -393,6 +395,8 @@ class Serialize::FieldBase : public Service /** Unset this field on the given object */ virtual void UnsetS(Object *) anope_abstract; + + virtual Anope::string GetTypeName() { return ""; } }; template<typename T> @@ -805,6 +809,12 @@ class Serialize::ObjectField : public CommonFieldBase<TypeImpl, T> return anope_dynamic_static_cast<T>(t->Require(id)); } + + Anope::string GetTypeName() override + { + const char* const name = std::remove_pointer<T>::type::NAME; + return name; + } }; template<typename T> |