Changeset 11158 in ntrip for trunk/BNC/src/bncmain.cpp


Ignore:
Timestamp:
Nov 3, 2026, 10:53:35 AM (4 days ago)
Author:
stuerze
Message:

deprecated functions exchanged libs updated

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/BNC/src/bncmain.cpp

    r11153 r11158  
    4747#include <QApplication>
    4848#include <QFile>
     49#include <QRegularExpression>
    4950#include <iostream>
    5051#include <QNetworkProxyFactory>
    … …  
    100101// Main Program
    101102/////////////////////////////////////////////////////////////////////////////
     103// Command line argument matches the option pattern, e.g. "--?conf"
     104////////////////////////////////////////////////////////////////////////////
     105static bool isOption(const char* arg, const char* pattern) {
     106  return QRegularExpression(QRegularExpression::anchoredPattern(pattern)).match(arg).hasMatch();
     107}
     108
    102109int main(int argc, char* argv[]) {
    103110
    … …  
    405412
    406413    for (int ii = 1; ii < argc; ii++) {
    407         if (QRegExp("--?help").exactMatch(argv[ii])) {
     414        if (isOption(argv[ii], "--?help")) {
    408415            cout << printHelp.data();
    409416            exit(0);
    410417        }
    411         if (QRegExp("--?nw").exactMatch(argv[ii])) {
     418        if (isOption(argv[ii], "--?nw")) {
    412419            interactive = false;
    413420        }
    414         if (QRegExp("--?version").exactMatch(argv[ii])) {
     421        if (isOption(argv[ii], "--?version")) {
    415422            cout << BNCPGMNAME << endl;
    416423            exit(0);
    417424        }
    418         if (QRegExp("--?display").exactMatch(argv[ii])) {
     425        if (isOption(argv[ii], "--?display")) {
    419426            displaySet = true;
    420427            strcpy(argv[ii], "-display"); // make it "-display" not "--display"
    421428        }
    422429        if (ii + 1 < argc) {
    423             if (QRegExp("--?conf").exactMatch(argv[ii])) {
     430            if (isOption(argv[ii], "--?conf")) {
    424431                confFileName = QString(argv[ii + 1]);
    425432            }
    426             if (QRegExp("--?file").exactMatch(argv[ii])) {
     433            if (isOption(argv[ii], "--?file")) {
    427434                interactive = false;
    428435                rawFileName = QByteArray(argv[ii + 1]);
    … …  
    479486
    480487    for (int ii = 1; ii < argc - 2; ii++) {
    481         if (QRegExp("--?key").exactMatch(argv[ii])) {
     488        if (isOption(argv[ii], "--?key")) {
    482489            QString key(argv[ii + 1]);
    483490            QString val(argv[ii + 2]);
Note: See TracChangeset for help on using the changeset viewer.