Explorar o código

CObject: Add a "name" property.

This will be useful for things like the VisualBuilder code generator.
Andreas Kling %!s(int64=6) %!d(string=hai) anos
pai
achega
b06d2c04dc
Modificáronse 1 ficheiros con 5 adicións e 0 borrados
  1. 5 0
      Libraries/LibCore/CObject.h

+ 5 - 0
Libraries/LibCore/CObject.h

@@ -1,5 +1,6 @@
 #pragma once
 
+#include <AK/AKString.h>
 #include <AK/Function.h>
 #include <AK/StdLibExtras.h>
 #include <AK/Vector.h>
@@ -18,6 +19,9 @@ public:
 
     virtual void event(CEvent&);
 
+    const String& name() const { return m_name; }
+    void set_name(const StringView& name) { m_name = name; }
+
     Vector<CObject*>& children() { return m_children; }
     const Vector<CObject*>& children() const { return m_children; }
 
@@ -58,6 +62,7 @@ protected:
 
 private:
     CObject* m_parent { nullptr };
+    String m_name;
     int m_timer_id { 0 };
     bool m_widget { false };
     Vector<CObject*> m_children;