MCPcopy Create free account
hub / github.com/crawl/crawl / _parse_text_db

Function _parse_text_db

crawl-ref/source/database.cc:512–553  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

510}
511
512static void _parse_text_db(LineInput &inf, DBM *db)
513{
514 string key;
515 string value;
516
517 bool in_entry = false;
518 while (!inf.eof())
519 {
520 string line = inf.get_line();
521
522 if (!line.empty() && line[0] == '#')
523 continue;
524
525 if (!line.compare(0, 4, "%%%%"))
526 {
527 if (!key.empty())
528 _add_entry(db, key, value);
529 key.clear();
530 value.clear();
531 in_entry = true;
532 continue;
533 }
534
535 if (!in_entry)
536 continue;
537
538 if (key.empty())
539 {
540 key = line;
541 trim_string(key);
542 lowercase(key);
543 }
544 else
545 {
546 trim_string_right(line);
547 value += line + "\n";
548 }
549 }
550
551 if (!key.empty())
552 _add_entry(db, key, value);
553}
554
555static void _store_text_db(const string &in, DBM *db)
556{

Callers 1

_store_text_dbFunction · 0.85

Calls 6

_add_entryFunction · 0.85
eofMethod · 0.45
get_lineMethod · 0.45
emptyMethod · 0.45
compareMethod · 0.45
clearMethod · 0.45

Tested by

no test coverage detected