Переглянути джерело

LibCore: Make it possible to pass a parent to CFile constructors

Andreas Kling 6 роки тому
батько
коміт
8aa3b74f80
2 змінених файлів з 8 додано та 4 видалено
  1. 3 2
      Libraries/LibCore/CFile.cpp
  2. 5 2
      Libraries/LibCore/CFile.h

+ 3 - 2
Libraries/LibCore/CFile.cpp

@@ -4,8 +4,9 @@
 #include <stdio.h>
 #include <unistd.h>
 
-CFile::CFile(const StringView& filename)
-    : m_filename(filename)
+CFile::CFile(const StringView& filename, CObject* parent)
+    : CIODevice(parent)
+    , m_filename(filename)
 {
 }
 

+ 5 - 2
Libraries/LibCore/CFile.h

@@ -6,8 +6,11 @@
 class CFile final : public CIODevice {
     C_OBJECT(CFile)
 public:
-    CFile() {}
-    explicit CFile(const StringView&);
+    CFile(CObject* parent = nullptr)
+        : CIODevice(parent)
+    {
+    }
+    explicit CFile(const StringView&, CObject* parent = nullptr);
     virtual ~CFile() override;
 
     String filename() const { return m_filename; }