Example #1
0
MainWindow::MainWindow(QWidget *parent) : nPort(2323), m_nNextBlockSize(0), QMainWindow(parent),
    ui(new Ui::MainWindow)
{
    ui->setupUi(this);
    InterfaceSettings();
    CreatorConnections();
}
TestingSettings::TestingSettings()
{
    CoreSettings().init();
    InputOutputSettings().init();
    InterfaceSettings().init();
    MPRSettings().init();
    Q2DViewerSettings().init();
    Q3DViewerExtensionSettings().init();
}
Example #3
0
InterfaceSettingsMap readInterfaceSettings(const std::string &filePath)
{
    std::fstream file(filePath);

    if (!file.is_open())
        throw std::system_error(errno, std::generic_category(), "Network error: unable to read file " + filePath + " -");

    std::map<std::string, InterfaceSettings> interfaces;
    InterfaceSettings currentInterface;

    while (file.good())
    {
        std::string line;
        std::getline(file, line);

        if (line.empty())
            continue;

        if (line.find("iface") == 0)
        {
            if (!currentInterface.interface.empty())
            {
                interfaces[currentInterface.interface] = currentInterface;
                currentInterface = InterfaceSettings();
            }

            std::size_t pos = line.find(' ', 6);
            currentInterface.interface = line.substr(6, pos - 6);

            pos = line.find(' ', pos + 1) + 1;
            currentInterface.type = line.substr(pos);
        }
        else if (!currentInterface.interface.empty() && (line.substr(0, 4) == std::string("    ") || line.at(0) == '\t'))
        {
            if (line.substr(0, 4) == std::string("    "))
                line = line.substr(4);
            else
                line = line.substr(1);

            currentInterface.arguments[line.substr(0, line.find(' '))] = line.substr(line.find(' ') + 1);
        }
    }

    if (!currentInterface.interface.empty())
        interfaces[currentInterface.interface] = currentInterface;

    return interfaces;
}