1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-11-11 13:50:56 -05:00
polybar/include/utils/io.hpp

27 lines
691 B
C++
Raw Normal View History

#pragma once
2016-05-19 10:41:06 -04:00
2016-06-14 23:32:35 -04:00
#include "common.hpp"
2016-11-19 00:22:44 -05:00
POLYBAR_NS
2016-06-14 23:32:35 -04:00
namespace io_util {
2016-11-02 15:22:45 -04:00
string read(int read_fd, int bytes_to_read, int& bytes_read_loc, int& status_loc);
string read(int read_fd, int bytes_to_read = -1);
string readline(int read_fd, int& bytes_read);
string readline(int read_fd);
2016-06-14 23:32:35 -04:00
2016-11-02 15:22:45 -04:00
size_t write(int write_fd, string data);
size_t writeline(int write_fd, string data);
2016-05-19 10:41:06 -04:00
2016-11-02 15:22:45 -04:00
void tail(int read_fd, function<void(string)> callback);
void tail(int read_fd, int writeback_fd);
2016-05-19 10:41:06 -04:00
2016-11-02 15:22:45 -04:00
bool poll(int fd, short int events, int timeout_ms = 1);
bool poll_read(int fd, int timeout_ms = 1);
bool poll_write(int fd, int timeout_ms = 1);
2016-05-19 10:41:06 -04:00
2016-11-03 14:01:45 -04:00
bool interrupt_read(int write_fd);
2016-05-19 10:41:06 -04:00
}
2016-06-14 23:32:35 -04:00
2016-11-19 00:22:44 -05:00
POLYBAR_NS_END