From fa1240f4b6d4dd4e0b645127f4add89019606ec3 Mon Sep 17 00:00:00 2001 From: patrick96 Date: Tue, 21 Sep 2021 21:30:38 +0200 Subject: [PATCH] Remove unused file_ptr --- include/utils/file.hpp | 20 -------------------- src/utils/file.cpp | 34 ---------------------------------- 2 files changed, 54 deletions(-) diff --git a/include/utils/file.hpp b/include/utils/file.hpp index 515b9084..c0d5b251 100644 --- a/include/utils/file.hpp +++ b/include/utils/file.hpp @@ -6,26 +6,6 @@ POLYBAR_NS -class file_ptr { - public: - explicit file_ptr(const string& path, const string& mode = "a+"); - ~file_ptr(); - - explicit operator bool(); - operator bool() const; - - explicit operator FILE*(); - operator FILE*() const; - - explicit operator int(); - operator int() const; - - private: - FILE* m_ptr = nullptr; - string m_path; - string m_mode; -}; - class file_descriptor { public: explicit file_descriptor(const string& path, int flags = 0, bool autoclose = true); diff --git a/src/utils/file.cpp b/src/utils/file.cpp index b14569cc..dc8de71d 100644 --- a/src/utils/file.cpp +++ b/src/utils/file.cpp @@ -17,40 +17,6 @@ POLYBAR_NS -// implementation of file_ptr {{{ - -file_ptr::file_ptr(const string& path, const string& mode) : m_path(string(path)), m_mode(string(mode)) { - m_ptr = fopen(m_path.c_str(), m_mode.c_str()); -} - -file_ptr::~file_ptr() { - if (m_ptr != nullptr) { - fclose(m_ptr); - } -} - -file_ptr::operator bool() { - return static_cast(*this); -} -file_ptr::operator bool() const { - return m_ptr != nullptr; -} - -file_ptr::operator FILE*() { - return static_cast(*this); -} -file_ptr::operator FILE*() const { - return m_ptr; -} - -file_ptr::operator int() { - return static_cast(*this); -} -file_ptr::operator int() const { - return fileno(*this); -} - -// }}} // implementation of file_descriptor {{{ file_descriptor::file_descriptor(const string& path, int flags, bool autoclose) : m_autoclose(autoclose) {