proxygen
Main Page
Related Pages
Namespaces
Classes
Files
Examples
File List
File Members
LineReader.h
Go to the documentation of this file.
1
/*
2
* Copyright 2013-present Facebook, Inc.
3
*
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
* you may not use this file except in compliance with the License.
6
* You may obtain a copy of the License at
7
*
8
* http://www.apache.org/licenses/LICENSE-2.0
9
*
10
* Unless required by applicable law or agreed to in writing, software
11
* distributed under the License is distributed on an "AS IS" BASIS,
12
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
* See the License for the specific language governing permissions and
14
* limitations under the License.
15
*/
16
17
#pragma once
18
19
#include <cstddef>
20
21
#include <boost/noncopyable.hpp>
22
23
#include <
folly/Range.h
>
24
25
namespace
folly
{
26
namespace
symbolizer {
27
31
class
LineReader
:
private
boost::noncopyable {
32
public
:
37
LineReader
(
int
fd,
char
* buf,
size_t
bufSize);
38
39
enum
State
{
40
kReading
,
41
kEof
,
42
kError
,
43
};
65
State
readLine
(
StringPiece
& line);
66
67
private
:
68
int
const
fd_
;
69
char
*
const
buf_
;
70
char
*
const
bufEnd_
;
71
72
// buf_ <= bol_ <= eol_ <= end_ <= bufEnd_
73
//
74
// [buf_, end_): current buffer contents (read from file)
75
//
76
// [buf_, bol_): free (already processed, can be discarded)
77
// [bol_, eol_): current line, including \n if it exists, eol_ points
78
// 1 character past the \n
79
// [eol_, end_): read, unprocessed
80
// [end_, bufEnd_): free
81
82
char
*
bol_
;
83
char
*
eol_
;
84
char
*
end_
;
85
State
state_
;
86
};
87
}
// namespace symbolizer
88
}
// namespace folly
folly::symbolizer::LineReader::bol_
char * bol_
Definition:
LineReader.h:82
folly::symbolizer::LineReader::fd_
int const fd_
Definition:
LineReader.h:68
folly::symbolizer::LineReader::eol_
char * eol_
Definition:
LineReader.h:83
folly
—— Concurrent Priority Queue Implementation ——
Definition:
AtomicBitSet.h:29
Range.h
folly::symbolizer::LineReader::kEof
Definition:
LineReader.h:41
folly::symbolizer::LineReader::end_
char * end_
Definition:
LineReader.h:84
folly::symbolizer::LineReader::kError
Definition:
LineReader.h:42
folly::symbolizer::LineReader::readLine
State readLine(StringPiece &line)
Definition:
LineReader.cpp:35
folly::symbolizer::LineReader::kReading
Definition:
LineReader.h:40
folly::symbolizer::LineReader
Definition:
LineReader.h:31
folly::Range< const char * >
folly::symbolizer::LineReader::bufEnd_
char *const bufEnd_
Definition:
LineReader.h:70
folly::symbolizer::LineReader::LineReader
LineReader(int fd, char *buf, size_t bufSize)
Definition:
LineReader.cpp:26
folly::symbolizer::LineReader::state_
State state_
Definition:
LineReader.h:85
folly::symbolizer::LineReader::buf_
char *const buf_
Definition:
LineReader.h:69
folly::symbolizer::LineReader::State
State
Definition:
LineReader.h:39
proxygen
folly
folly
experimental
symbolizer
LineReader.h
Generated by
1.8.11