summaryrefslogtreecommitdiff
path: root/Runtime/BaseClasses/NamedObject.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2019-08-14 22:50:43 +0800
committerchai <chaifix@163.com>2019-08-14 22:50:43 +0800
commit15740faf9fe9fe4be08965098bbf2947e096aeeb (patch)
treea730ec236656cc8cab5b13f088adfaed6bb218fb /Runtime/BaseClasses/NamedObject.cpp
+Unity Runtime codeHEADmaster
Diffstat (limited to 'Runtime/BaseClasses/NamedObject.cpp')
-rw-r--r--Runtime/BaseClasses/NamedObject.cpp33
1 files changed, 33 insertions, 0 deletions
diff --git a/Runtime/BaseClasses/NamedObject.cpp b/Runtime/BaseClasses/NamedObject.cpp
new file mode 100644
index 0000000..41acc3a
--- /dev/null
+++ b/Runtime/BaseClasses/NamedObject.cpp
@@ -0,0 +1,33 @@
+#include "UnityPrefix.h"
+#include "Runtime/Serialize/TransferFunctions/SerializeTransfer.h"
+#include "NamedObject.h"
+#include "Runtime/Containers/ConstantStringSerialization.h"
+
+NamedObject::NamedObject (MemLabelId label, ObjectCreationMode mode)
+: Super(label, mode)
+{
+}
+
+NamedObject::~NamedObject ()
+{
+}
+
+template<class TransferFunction>
+void NamedObject::Transfer (TransferFunction& transfer)
+{
+ Super::Transfer (transfer);
+ TransferConstantString(m_Name, "m_Name", kHideInEditorMask, GetMemoryLabel(), transfer);
+}
+
+void NamedObject::SetName (char const* name)
+{
+ if (strcmp (m_Name.c_str (), name) != 0)
+ {
+ m_Name.assign (name, GetMemoryLabel());
+ SetDirty ();
+ }
+}
+
+IMPLEMENT_CLASS (NamedObject)
+IMPLEMENT_OBJECT_SERIALIZE (NamedObject)
+INSTANTIATE_TEMPLATE_TRANSFER_EXPORTED(NamedObject) \ No newline at end of file