Remove unused file_ptr
This commit is contained in:
parent
3b6a950380
commit
fa1240f4b6
@ -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);
|
||||
|
@ -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<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 {{{
|
||||
|
||||
file_descriptor::file_descriptor(const string& path, int flags, bool autoclose) : m_autoclose(autoclose) {
|
||||
|
Loading…
Reference in New Issue
Block a user