blob: 4744ba3f0167b8c8bb21d58cedc5bc7d8a6120c4 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
|
// Copyright 2016 Yahoo Inc. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
#pragma once
#include <vespa/vespalib/data/input_reader.h>
#include "string.h"
namespace vbench {
using Input = vespalib::Input;
using InputReader = vespalib::InputReader;
/**
* Concrete utility class used to read individual lines of text from
* an underlying input. This class is implemented in terms of the
* ByteInput class.
**/
class LineReader
{
private:
InputReader _input;
public:
/**
* Wrap an Input to read one line at a time.
*
* @param input the underlying Input
**/
LineReader(Input &input);
/**
* Read the next line of input. Lines are separated by '\n'. '\r'
* appearing directly in from of '\n' will be stripped. Empty
* lines will be returned.
*
* @return true if a line could be read,
* false if no more data was available
* @param dst where to store the line that was read
**/
bool readLine(string &dst);
};
} // namespace vbench
|