Remove unused file_ptr

This commit is contained in:
patrick96 2021-09-21 21:30:38 +02:00 committed by Patrick Ziegler
parent 3b6a950380
commit fa1240f4b6
2 changed files with 0 additions and 54 deletions

View File

@ -6,26 +6,6 @@
POLYBAR_NS 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 { class file_descriptor {
public: public:
explicit file_descriptor(const string& path, int flags = 0, bool autoclose = true); explicit file_descriptor(const string& path, int flags = 0, bool autoclose = true);

View File

@ -17,40 +17,6 @@
POLYBAR_NS 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<const file_ptr&>(*this);
}
file_ptr::operator bool() const {
return m_ptr != nullptr;
}
file_ptr::operator FILE*() {
return static_cast<const file_ptr&>(*this);
}
file_ptr::operator FILE*() const {
return m_ptr;
}
file_ptr::operator int() {
return static_cast<const file_ptr&>(*this);
}
file_ptr::operator int() const {
return fileno(*this);
}
// }}}
// implementation of file_descriptor {{{ // implementation of file_descriptor {{{
file_descriptor::file_descriptor(const string& path, int flags, bool autoclose) : m_autoclose(autoclose) { file_descriptor::file_descriptor(const string& path, int flags, bool autoclose) : m_autoclose(autoclose) {