void RuleEvaluator::extractSection_(INIFile& file, const String& symbol) { // assemble the section name String section_name(prefix_ + ":" + symbol); // abort if the INI file does not contain the requested section if (!file.hasSection(section_name)) { return; } // create a new entry for symbol if (!rule_map_.has(symbol)) { rule_map_.insert(symbol, list<pair<Expression, String> >()); } // iterate over all lines of the respective section INIFile::LineIterator it = file.getSectionFirstLine(section_name); ++it;//skip section line for (; +it ; it.getSectionNextLine()) { String line(*it); // empty lines or comment lines (starting with ';' or '#') are ignored if (line.has('=') && (line[0] != ';') && (line[0] != '#')) { if (line[0] == '=') { Log.error() << "RuleEvaluator:: invalid rule in line: " << line << endl; continue; } String value = line.before("="); String expression_string; if (line.after("=").isValid()) { expression_string = line.after("="); } expression_string.trim(); value.trim(); // push the expression into the list rule_map_[symbol].push_back(pair<Expression, String>(Expression(expression_string), value)); } } }
void ColoringSettingsDialog::writePreferenceEntries(INIFile& inifile) { PreferencesEntry::writePreferenceEntries(inifile); if (!inifile.hasSection("COLORING_OPTIONS")) { inifile.appendSection("COLORING_OPTIONS"); } String residue_names, residue_name_colors; for (Index i=0; i<residue_table_->rowCount(); ++i) { residue_names += ascii(residue_table_->item(i, 0)->text()) + ";"; residue_name_colors += (String)(static_cast<ColorRGBA>(residue_table_->item(i, 1)->backgroundColor())) + ";"; } inifile.insertValue("COLORING_OPTIONS", "ResidueNames", residue_names); inifile.insertValue("COLORING_OPTIONS", "ResidueNameColors", residue_name_colors); }
void PluginDialog::writePreferenceEntries(INIFile& inifile) { PreferencesEntry::writePreferenceEntries(inifile); for (std::list<PreferencesEntry*>::iterator child_it = child_entries_.begin(); child_it != child_entries_.end(); ++child_it) { (*child_it)->writePreferenceEntries(inifile); } PluginManager& man = PluginManager::instance(); if(!inifile.hasSection(getINIFileSectionName())) { inifile.appendSection(getINIFileSectionName()); } String value; man.getPluginDirectories(value); inifile.insertValue(getINIFileSectionName(), "PluginDirectories", value); inifile.insertValue(getINIFileSectionName(), "ActivePlugins", man.getAutoActivatePlugins().toStdString()); }