diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/xmlpatterns/qapplicationargument.cpp | 5 | ||||
-rw-r--r-- | tools/xmlpatterns/qapplicationargument_p.h | 1 | ||||
-rw-r--r-- | tools/xmlpatterns/qapplicationargumentparser.cpp | 23 |
3 files changed, 10 insertions, 19 deletions
diff --git a/tools/xmlpatterns/qapplicationargument.cpp b/tools/xmlpatterns/qapplicationargument.cpp index 92a8e9e..c0b672d 100644 --- a/tools/xmlpatterns/qapplicationargument.cpp +++ b/tools/xmlpatterns/qapplicationargument.cpp @@ -151,6 +151,11 @@ bool QApplicationArgument::operator==(const QApplicationArgument &other) const return name() == other.name(); } +bool QApplicationArgument::operator<(const QApplicationArgument &other) const +{ + return name() < other.name(); +} + /*! \fn qHash(const QApplicationArgument &); \internal diff --git a/tools/xmlpatterns/qapplicationargument_p.h b/tools/xmlpatterns/qapplicationargument_p.h index acdd075..aef216b 100644 --- a/tools/xmlpatterns/qapplicationargument_p.h +++ b/tools/xmlpatterns/qapplicationargument_p.h @@ -57,6 +57,7 @@ public: ~QApplicationArgument(); QApplicationArgument &operator=(const QApplicationArgument &other); bool operator==(const QApplicationArgument &other) const; + bool operator<(const QApplicationArgument &other) const; void setName(const QString &newName); QString name() const; diff --git a/tools/xmlpatterns/qapplicationargumentparser.cpp b/tools/xmlpatterns/qapplicationargumentparser.cpp index f441b93..8aaae31 100644 --- a/tools/xmlpatterns/qapplicationargumentparser.cpp +++ b/tools/xmlpatterns/qapplicationargumentparser.cpp @@ -40,6 +40,8 @@ #include "qapplicationargumentparser_p.h" +#include <algorithm> + QT_BEGIN_NAMESPACE /*! @@ -291,23 +293,6 @@ void QApplicationArgumentParserPrivate::displayVersion() const << endl; } -/*! - \internal - \relates QApplicationArgument - - qLess() functor for QApplicationArgument that considers the name. - */ -template<> -class qLess <QApplicationArgument> -{ -public: - inline bool operator()(const QApplicationArgument &o1, - const QApplicationArgument &o2) const - { - return o1.name().compare(o2.name()) < 0; - } -}; - void QApplicationArgumentParserPrivate::displayHelp() const { enum Constants @@ -334,7 +319,7 @@ void QApplicationArgumentParserPrivate::displayHelp() const /* Sort them, such that we get the nameless options at the end, and it * generally looks tidy. */ - qSort(args); + std::sort(args.begin(), args.end()); /* This is the basic approach: * Switches: @@ -353,7 +338,7 @@ void QApplicationArgumentParserPrivate::displayHelp() const int maxWidth = 0; QList<QApplicationArgument> nameless(declaredNamelessArguments); - qSort(nameless); + std::sort(nameless.begin(), nameless.end()); /* Note, here the nameless arguments appear last, but are sorted * with themselves. */ |