MCPcopy Create free account
hub / github.com/Geode-solutions/OpenGeode / goto_keyword_if_it_exists

Function goto_keyword_if_it_exists

src/geode/basic/file.cpp:94–110  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

92 }
93
94 std::optional< std::string > goto_keyword_if_it_exists(
95 std::ifstream& file, std::string_view word )
96 {
97 std::optional< std::string > line{ std::in_place };
98 while( std::getline( file, line.value() ) )
99 {
100 if( string_starts_with( line.value(), word ) )
101 {
102 return line;
103 }
104 }
105 geode::Logger::debug( "[goto_keyword_if_it_exists] Couldn't find word ",
106 word, " in the file, returning to file begin." );
107 file.clear();
108 file.seekg( std::ios::beg );
109 return std::nullopt;
110 }
111
112 std::optional< std::string > next_keyword_if_it_exists(
113 std::ifstream& file, std::string_view word )

Callers

nothing calls this directly

Calls 4

string_starts_withFunction · 0.85
debugFunction · 0.85
valueMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected