1
0
Fork 0
mirror of https://github.com/polybar/polybar.git synced 2024-10-20 05:22:21 -04:00
polybar/include/utils/streams.hpp
Michael Carlberg 39d3f61497 refactor(core): Clean-up
- use "#pragma once" instead of the regular include guard
- fix errors and warnings reported by cppcheck
2016-06-02 01:32:06 +02:00

46 lines
744 B
C++

#if 0
#pragma once
#include <iostream>
#include <streambuf>
#include <cstdio>
#include <unistd.h>
namespace streams
{
class fdoutbuf : public std::streambuf
{
protected:
int fd;
virtual int_type overflow(int_type c)
{
if (c != EOF) {
char z = c;
if (write (fd, &z, 1) != 1)
return EOF;
}
return c;
}
virtual std::streamsize xsputn(const char* s, std::streamsize num) {
return write(fd,s,num);
}
public:
fdoutbuf(int _fd) : fd(_fd) {}
};
class fdout : public std::ostream
{
protected:
fdoutbuf buf;
public:
fdout(int fd) : std::ostream(0), buf(fd) {
rdbuf(&buf);
}
};
}
#endif