| 510 | } |
| 511 | |
| 512 | static 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 | |
| 555 | static void _store_text_db(const string &in, DBM *db) |
| 556 | { |
no test coverage detected