summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qcommandlineoption.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge remote-tracking branch 'origin/5.7' into devLiang Qi2016-08-091-2/+2
|\ | | | | | | Change-Id: I36e6b890b65d12bf6931757540bcc9c553b5eb8f
| * Merge remote-tracking branch 'origin/5.6' into 5.7Liang Qi2016-08-051-2/+2
| |\ | | | | | | | | | | | | | | | | | | Conflicts: tests/auto/widgets/itemviews/qtreeview/tst_qtreeview.cpp Change-Id: I6f3878b204464313aa2f9d988d3b35121d4d9867
| | * Docs changed to reflect that valueName is required with value parsingKonstantin Shegunov2016-07-291-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | When the option expects a value the valueName parameter of the constructor isn't optional; it must be set. This requirement is made explicit in the documentation. Task-number: QTBUG-54855 Change-Id: I190884aff2fa8e96bc5c5e82cdfed85be761d6e3 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: David Faure <david.faure@kdab.com>
* | | Fix some qdoc-warnings for Qt 5.8.Friedemann Kleint2016-06-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | qtbase/src/corelib/tools/qstring.cpp:8341: warning: Unknown command '\length' qtbase/src/corelib/tools/qstring.cpp:8354: warning: Unknown command '\length' qtbase/src/corelib/tools/qstring.cpp:8366: warning: Unknown command '\length' qtbase/src/corelib/doc/src/animation.qdoc:38: warning: Can't link to 'QAbstractAnimation::updateCurrentValue()' qtbase/src/corelib/io/qdatastream.cpp:529: warning: Undocumented enum item 'Qt_5_8' in QDataStream::Version qtbase/src/corelib/tools/qdatetime.cpp:4377: warning: No documentation for 'QDateTime::currentSecsSinceEpoch()' qtbase/src/corelib/tools/qcommandlineoption.cpp:435: warning: Undocumented parameter 'flags' in QCommandLineOption::setFlags() qtbase/src/network/ssl/qsslconfiguration.cpp:857: warning: Undocumented parameter 'dhparams' in QSslConfiguration::setDiffieHellmanParameters() qtbase/src/network/ssl/qsslconfiguration.cpp:830: warning: Undocumented parameter 'hint' in QSslConfiguration::setPreSharedKeyIdentityHint() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: No such enum item 'ErrorUnsafeParameters' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: No such enum item 'ErrorInvalidInputData' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'UnsafeParametersError' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'NoError' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:225: warning: Undocumented enum item 'InvalidInputDataError' in QSslDiffieHellmanParameters::Error qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:105: warning: Undocumented parameter 'encoding' in QSslDiffieHellmanParameters::QSslDiffieHellmanParameters() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:129: warning: Undocumented parameter 'encoding' in QSslDiffieHellmanParameters::QSslDiffieHellmanParameters() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:208: warning: Can't link to 'clear()' qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:277: warning: Undocumented parameter 'dhparam' in operator<<() qtbase/src/network/ssl/qssldiffiehellmanparameters.cpp:277: warning: No such parameter 'dhparm' in operator<<() qtbase/src/widgets/kernel/qapplication.cpp:999: warning: Cannot find 'QApplication::autoMaximizeThreshold' specified with '\property' in any header file Change-Id: I4ac00f0fc0dbc4d421cf7c0273635d9681962645 Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* | | Add QCommandLineOption::Flags containing HiddenFromHelp and ShortOptionStyleOlivier Goffart2016-03-231-9/+49
|/ / | | | | | | | | | | | | | | | | | | | | | | This patch adds a new option, QCommandLineOption::ShortOptionStyle, which helps applications (such as compilers, so moc and now qdoc) which need to mix long-style and short flags. [ChangeLog][QtCore][QCommandLineOption] Added flags() and setFlags() methods. Added ShortOptionStyle and HiddenFromHelp flags. Change-Id: I944ce56aff2b28ecd6bb9d2d23c4e726e9d06647 Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* / Updated license headersJani Heikkinen2016-01-151-13/+19
|/ | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Fix documentation typoLouai Al-Khanji2015-08-251-1/+1
| | | | | Change-Id: Ic6271a19999555ef2a1dfa90cebfb92b270a3809 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* Fix Clang warning about copy elisionThiago Macieira2015-08-191-1/+1
| | | | | | | | | Found by Clang 3.7: qcommandlineoption.cpp:287:12: error: moving a local object in a return statement prevents copy elision [-Werror,-Wpessimizing-move] Change-Id: I7de033f80b0e4431b7f1ffff13f97fb480001d36 Reviewed-by: David Faure <david.faure@kdab.com>
* QCommandLineOption: prevent aggressive inliningMarc Mutz2015-07-161-0/+1
| | | | | | | | | | | | | Even though we expect very few option names, GCC unrolls the loop calling IsInvalidName::operator() four times. Together with the lead-in/lead-out for size() % 4 != 0, that makes for five inlined copies of the function call operator. I don't know how to prevent the unrolling, but at least I can stop the inlining. Change-Id: Ib9d6c33e8193464a73927a92b8b54c3452cb26a3 Reviewed-by: David Faure <david.faure@kdab.com>
* QCommandLineOption: never inline the warning functionMarc Mutz2015-07-161-0/+2
| | | | | | | | | | We suppose that this function will never be called, yet the compiler still inlines it in all four places. Stop it. Change-Id: If601bc3644cacb77aeab9d615578e4afb349a73e Reviewed-by: David Faure <david.faure@kdab.com>
* QCommandLineOption: add some Q_UNLIKELYMarc Mutz2015-07-161-5/+5
| | | | | | | | | | These are all error conditions, and should not happen in practice. Naturally, there's no savings in executable size, because the compiler just shuffles the layout of the branches around. Change-Id: I52b98cc696fd808735c7d73c1f21e02478ff4f5a Reviewed-by: David Faure <david.faure@kdab.com>
* QCommandLineOption: reduce string dataMarc Mutz2015-07-161-16/+16
| | | | | | | | ... by centralizing the common part of repeated qWarnings() in a single function, passing the variable part through %s. Change-Id: I114d10f41d4b0bbf59ef87f75308dc5b3ccd3967 Reviewed-by: David Faure <david.faure@kdab.com>
* QCommandLineOption: Q_DECL_NOTHROW -> Q_DECL_NOEXCEPTMarc Mutz2015-06-281-1/+1
| | | | | | | | | | In IsInvalidName::operator(), marked as _NOTHROW, we're calling qWarning(), which, of course, _can_ throw. We don't care in that case, but then we musn't use _NOTHROW, which causes UB on MSVC, but _NOEXCEPT, which causes std::terminate to be called. Change-Id: I18f74546ea3b388495fdb173d3abd9a162fb78a9 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineOption: prevent aggressive inliningMarc Mutz2015-06-201-0/+2
| | | | | | | | | | | | | There is a good chance that in every program, command line options that have only one name and those that have multiple names are used. Make better use of the icache by not inlining the Private ctors into the QCommandLineOption ones. Saves 400B in text size on Linux GCC 4.9 C++11 release builds. Change-Id: I6247d4a2330c5fff75d06f5a40223d972b267e85 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineOption: optimize ctorsMarc Mutz2015-06-191-31/+48
| | | | | | | | | | | ...by moving common code into the Private ctor, and catering for C++11 move semantics a bit. Saves ~1.5KiB in text size on Linux GCC 4.9 C++11 release builds. Change-Id: I52ed7e47f76b69500a871844c0920e27fe51a127 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineOption: fix wrong version number in \since tagDavid Faure2015-02-241-2/+2
| | | | | Change-Id: I45249cb07c6d53c82a26e68026ea5c1bb3ec57dc Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* QCommandLineParser: add support for hiding options from --help.David Faure2015-02-231-0/+30
| | | | | | | | | [ChangeLog][QtCore][QCommandLineParser] Added support for hiding options from the --help output, with QCommandLineOption::setHidden(true). Task-number: QTBUG-44298 Change-Id: I62cc2a55428365c0bcc79d2e47c72c0c92104e74 Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-111-6/+6
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-18/+10
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* QCommandLineParser: support extremely concise option configuration in C++11Marc Mutz2014-08-061-0/+47
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The goal of this commit to make the code in the test work: QCommandLineParser parser; parser.addOptions({ { "a", "The A option." }, { { "v", "verbose" }, "The verbose option." }, { { "i", "infile" }, "The input file.", "value" }, }); For this, QCommandLineParser needs a version of addOption that can take a list of options. That's what addOptions() is for. More importantly, the QCommandLineOption ctors mustn't be explicit. OTOH, any implicit conversion from QString or QStringList to QCommandLineOption is also undesirable. To solve this dilemma, add new QCommandLineOption ctors that just take one argument and are explicit, and make the existing ctors implicit. In order to avoid ambiguities, remove the default values of their resp. 2nd arguments. The new ctors are by intention not \since 5.4, as they are completely transparent to the user. Et voila, even better than getopt_long(3). [ChangeLog][QtCore][QCommandLineParser] Added addOptions() method. Change-Id: I5e779f3406cd0f6c8ec6ecbf6c8074af226de300 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: argument(s) was renamed to value(s), adjust QCommandLineOption docsDavid Faure2014-01-301-3/+3
| | | | | | Task-number: QTBUG-36264 Change-Id: I132270f35b93b2b1c5230459f48bf9d047f42ab9 Reviewed-by: Topi Reiniö <topi.reinio@digia.com>
* QCommandLineParser: pluck some low-hanging fruit re: exception safetyMarc Mutz2013-12-061-5/+12
| | | | | | | | | | | | | | | | | Make QCommandLineParser::add{Help,Version}Option() QCommandLineOption::setDefaultValue() QCommandLineOptionPrivate::setNames() have transaction semantics: either they succeed, or they change nothing. It's trivial to provide this guarantee, so do it. Add a test for the surprising property that setDefaultValue("") resets defaultValues() to an empty QStringList instead of one that contains the empty string. Change-Id: I61623019de3c7d2e52c24f42cc2e23ec5fddc4da Reviewed-by: David Faure <david.faure@kdab.com> Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Doc: Add docs for rvalue references and move constructorsGeir Vattekar2013-09-271-0/+8
| | | | | | | | | These members were introduced in 4.8, but left undocumented. Because we consider undocumented API to be internal, the members are \since 5.2. Change-Id: I52e2840a8cfaa7f59f410b3e2a06c0942ea06539 Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Stephen Kelly <stephen.kelly@kdab.com>
* QCommandLineParser: improve implementationDavid Faure2013-09-101-9/+12
| | | | | | | Based on feedback from Thiago. Change-Id: I9a3ce0b90b5d1d680c66351d421874effbd426f8 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* QCommandLineOption: improve runtime warningsDavid Faure2013-09-101-5/+5
| | | | | Change-Id: I48a278acf3a8eb0cfa829deb65cf65dfd8ec23af Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Long live QCommandLineParser!David Faure2013-08-241-0/+308
The QCommandLineParser class provides a means for handling the command line options. QCoreApplication provides the command-line arguments as a simple list of strings. QCommandLineParser provides the ability to define a set of options, parse the command-line arguments, and store which options have actually been used, as well as option values. Done-with: Laszlo Papp <lpapp@kde.org> Change-Id: Ic7bebc10b3f8d8dd06ad0f4bb897c51d566e3b7c Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>