10 #ifndef SRC_INCLUDE_SMASH_INPUTFUNCTIONS_H_
11 #define SRC_INCLUDE_SMASH_INPUTFUNCTIONS_H_
43 return message +
" (on line " + std::to_string(line.
number) +
": \"" +
56 build_vector_<Line>
line_parser(
const std::string &input);
65 ") at the remainder of the line.",
80 inline std::string
read_all(std::istream &&input) {
81 return {std::istreambuf_iterator<char>{input},
82 std::istreambuf_iterator<char>{}};
92 if (in.find(
"\r\n") != std::string::npos) {
void ensure_all_read(std::istream &input, const Line &line)
Makes sure that nothing is left to read from this line.
build_vector_< Line > line_parser(const std::string &input)
Helper function for parsing particles.txt and decaymodes.txt.
bool has_crlf_line_ending(const std::string in)
Check if a line in the string ends with \r\n.
std::string read_all(std::istream &&input)
Utility function to read a complete input stream (e.g.
std::string build_error_string(std::string message, const Line &line)
Builds a meaningful error message.
Line consists of a line number and the contents of that line.
std::string text
Line content.
Line()=default
Initialize line with empty string and number.
Line(int n, std::string &&t)
Initialize a line with line number n and text t.