MCPcopy Create free account
hub / github.com/TheForceEngine/TheForceEngine / parseIniFile

Function parseIniFile

TheForceEngine/TFE_Settings/settings.cpp:648–717  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

646 }
647
648 void parseIniFile(const char* buffer, size_t len)
649 {
650 TFE_Parser parser;
651 parser.init(buffer, len);
652 parser.addCommentString(";");
653 parser.addCommentString("#");
654
655 size_t bufferPos = 0;
656 SectionID curSection = SECTION_INVALID;
657
658 while (bufferPos < len)
659 {
660 const char* line = parser.readLine(bufferPos);
661 if (!line) { break; }
662
663 TokenList tokens;
664 parser.tokenizeLine(line, tokens);
665 if (tokens.size() < 1) { continue; }
666
667 if (tokens.size() == 1)
668 {
669 curSection = parseSectionName(tokens[0].c_str());
670 if (curSection == SECTION_INVALID)
671 {
672 continue;
673 }
674 }
675 else if (tokens.size() == 2)
676 {
677 switch (curSection)
678 {
679 case SECTION_WINDOW:
680 parseWindowSettings(tokens[0].c_str(), tokens[1].c_str());
681 break;
682 case SECTION_GRAPHICS:
683 parseGraphicsSettings(tokens[0].c_str(), tokens[1].c_str());
684 break;
685 case SECTION_ENHANCEMENTS:
686 parseEnhancementsSettings(tokens[0].c_str(), tokens[1].c_str());
687 break;
688 case SECTION_HUD:
689 parseHudSettings(tokens[0].c_str(), tokens[1].c_str());
690 break;
691 case SECTION_SOUND:
692 parseSoundSettings(tokens[0].c_str(), tokens[1].c_str());
693 break;
694 case SECTION_SYSTEM:
695 parseSystemSettings(tokens[0].c_str(), tokens[1].c_str());
696 break;
697 case SECTION_A11Y:
698 parseA11ySettings(tokens[0].c_str(), tokens[1].c_str());
699 break;
700 case SECTION_GAME:
701 parseGame(tokens[0].c_str(), tokens[1].c_str());
702 break;
703 case SECTION_DARK_FORCES:
704 parseDark_ForcesSettings(tokens[0].c_str(), tokens[1].c_str());
705 break;

Callers 1

readFromDiskFunction · 0.85

Calls 15

parseSectionNameFunction · 0.85
parseWindowSettingsFunction · 0.85
parseGraphicsSettingsFunction · 0.85
parseHudSettingsFunction · 0.85
parseSoundSettingsFunction · 0.85
parseSystemSettingsFunction · 0.85
parseA11ySettingsFunction · 0.85
parseGameFunction · 0.85
parseDark_ForcesSettingsFunction · 0.85
parseOutlawsSettingsFunction · 0.85
parseCVarsFunction · 0.85

Tested by

no test coverage detected