MAIA bb96820c
Multiphysics at AIA
Loading...
Searching...
No Matches
cpptoml::detail Namespace Reference

Functions

std::istream & getline (std::istream &input, std::string &line)
 

Function Documentation

◆ getline()

std::istream & cpptoml::detail::getline ( std::istream &  input,
std::string &  line 
)
inline

Definition at line 1519 of file cpptoml.h.

1519 {
1520 line.clear();
1521
1522 std::istream::sentry sentry{input, true};
1523 auto sb = input.rdbuf();
1524
1525 while(true) {
1526 auto c = sb->sbumpc();
1527 if(c == '\r') {
1528 if(sb->sgetc() == '\n') c = sb->sbumpc();
1529 }
1530
1531 if(c == '\n') return input;
1532
1533 if(c == std::istream::traits_type::eof()) {
1534 if(line.empty()) input.setstate(std::ios::eofbit);
1535 return input;
1536 }
1537
1538 line.push_back(static_cast<char>(c));
1539 }
1540}