forked from lix-project/nix-eval-jobs
21 lines
376 B
C++
21 lines
376 B
C++
|
#pragma once
|
||
|
#include <cstdio>
|
||
|
#include <string>
|
||
|
#include <string_view>
|
||
|
|
||
|
[[nodiscard]] int tryWriteLine(int fd, std::string s);
|
||
|
|
||
|
class LineReader {
|
||
|
public:
|
||
|
LineReader(int fd);
|
||
|
~LineReader();
|
||
|
|
||
|
LineReader(LineReader &&other);
|
||
|
[[nodiscard]] std::string_view readLine();
|
||
|
|
||
|
private:
|
||
|
FILE *stream = nullptr;
|
||
|
char *buffer = nullptr;
|
||
|
size_t len = 0;
|
||
|
};
|