| 110 | } |
| 111 | |
| 112 | std::optional< std::string > next_keyword_if_it_exists( |
| 113 | std::ifstream& file, std::string_view word ) |
| 114 | { |
| 115 | std::optional< std::string > line{ std::in_place }; |
| 116 | const auto previous_position = file.tellg(); |
| 117 | std::getline( file, line.value() ); |
| 118 | if( string_starts_with( line.value(), word ) ) |
| 119 | { |
| 120 | return line; |
| 121 | } |
| 122 | file.seekg( previous_position ); |
| 123 | return std::nullopt; |
| 124 | } |
| 125 | } // namespace geode |
nothing calls this directly
no test coverage detected