delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
LineScanner.cpp
Go to the documentation of this file.
1
9
11#include "delpi/util/logging.h"
12
13namespace delpi {
14
15bool LineScanner::ParseFile(const std::string &filename) {
16 try {
17 filename_ = filename;
18 MappedFileSource src(filename.c_str());
19 ParseLines(src);
20 } catch (const boost::interprocess::interprocess_exception &e) {
21 DELPI_ERROR_FMT("Error reading file '{}': {}", filename, e.what());
22 return false;
23 }
24 return true;
25}
26
27bool LineScanner::ParseString(const std::string_view input) {
28 BufferLineSource src{input};
29 ParseLines(src);
30 return true;
31}
32
33} // namespace delpi
A class that provides a source for lines of text buffered in memory.
bool ParseFile(const std::string &filename)
Parse an MPS file from disk.
virtual bool ParseLines(BufferLineSource &src)=0
Parse all lines from a line-oriented source.
bool ParseString(std::string_view input)
Parse an MPS file from an in-memory string.
std::string filename_
Name of the file being parsed, used for error reporting.
Definition LineScanner.h:49
A memory-mapped file source for efficiently reading files line by line.
Global namespace for the delpi library.