delpi  0.0.1
DElta-complete LP solver
Loading...
Searching...
No Matches
LineScanner.h
Go to the documentation of this file.
1
8#pragma once
9
10#include <string>
11#include <string_view>
12
13namespace delpi {
14
15// Forward declaration
17
22class LineScanner {
23 public:
24 LineScanner() : filename_{}, line_no_{0} {}
25 virtual ~LineScanner() = default;
26
32 bool ParseFile(const std::string& filename);
33
39 bool ParseString(std::string_view input);
40
41 protected:
47 virtual bool ParseLines(BufferLineSource& src) = 0;
48
49 std::string filename_;
50 std::size_t line_no_;
51};
52
53} // 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.
std::size_t line_no_
Current line number, used for error reporting.
Definition LineScanner.h:50
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
Global namespace for the delpi library.