Exemple #1
0
// Processes interactive option
void Installer::processInteractive()
{
    // process all options
    IConfig* config = m_factory->getConfig();
    // before set any new config file option
    // reread config file
    config->load();

    // look for the option
    OptionList options = config->getOptions();
    for (OptionList::iterator i = options.begin();
         i != options.end(); i++)
    {
        const std::string name = (*i)->getName();
        const std::string oldval = (*i)->getValue();

        std::cout << "Option '" << name << "' has the following value: "
                  << oldval << std::endl;

        if (ask("Do you want to change it [N/y]: "))
        {
            std::string value = get("New value: ");
            setOption((*i)->getName(), value);
        }
    }

    if (ask("Do you want to recreate DB [N/y]: "))
    {
        recreateDB();
    }

    // resources detection
    if (ask("Do you want to detect resources [N/y]: "))
    {
        detectResources();
    }
}