Browse Source

fix definition of noDigitRegex

master
Brad Parker 10 years ago
parent
commit
e64c045405
  1. 8
      wireless.cpp
  2. 2
      wireless.h

8
wireless.cpp

@ -13,7 +13,6 @@ extern "C" {
#include "utils.h" #include "utils.h"
#include <iostream> #include <iostream>
#include <QStringList> #include <QStringList>
#include <QRegularExpression>
#define BIT(x) (1ULL<<(x)) #define BIT(x) (1ULL<<(x))
@ -95,6 +94,8 @@ struct nl_interfaceCallback {
\brief The Wireless class is used to manage 802.11 wireless information associated with an interface. Currently this class makes the assumption that it will only be used within the United States FCC regulatory domain. Only drivers supporting the Linux kernel nl80211 interface are supported. \brief The Wireless class is used to manage 802.11 wireless information associated with an interface. Currently this class makes the assumption that it will only be used within the United States FCC regulatory domain. Only drivers supporting the Linux kernel nl80211 interface are supported.
*/ */
static QRegularExpression s_noDigitRegex("[^\\d]");
/*! /*!
Constructs a Wireless object. All operations will be limited to the specified \a interface. Constructs a Wireless object. All operations will be limited to the specified \a interface.
*/ */
@ -103,7 +104,6 @@ QObject(0),
m_interface(interface), m_interface(interface),
m_interfaceType(), m_interfaceType(),
m_bands(), m_bands(),
m_noDigitRegex("[^\\d]"),
m_isValid(false), m_isValid(false),
m_isNL80211(false), m_isNL80211(false),
m_iftype(NL80211_IFTYPE_UNSPECIFIED) m_iftype(NL80211_IFTYPE_UNSPECIFIED)
@ -406,7 +406,7 @@ int Wireless::ChanToFreq(int channel) {
*/ */
QString Wireless::ChanToFreq(QString channel, QString outputFormat) { QString Wireless::ChanToFreq(QString channel, QString outputFormat) {
QString freq; QString freq;
channel = channel.replace(m_noDigitRegex, ""); channel = channel.replace(s_noDigitRegex, "");
if(outputFormat.isEmpty()) { if(outputFormat.isEmpty()) {
bool ok = false; bool ok = false;
@ -442,7 +442,7 @@ int Wireless::FreqToChan(int frequency) {
*/ */
QString Wireless::FreqToChan(QString frequency, QString outputFormat) { QString Wireless::FreqToChan(QString frequency, QString outputFormat) {
QString chan; QString chan;
frequency = frequency.replace(m_noDigitRegex, ""); frequency = frequency.replace(s_noDigitRegex, "");
if(frequency.length() < 4) { if(frequency.length() < 4) {
for(int i = frequency.length() + 1; i <= 4; ++i) { for(int i = frequency.length() + 1; i <= 4; ++i) {

2
wireless.h

@ -5,6 +5,7 @@
#include <QMap> #include <QMap>
#include "libip_global.h" #include "libip_global.h"
#include <linux/nl80211.h> #include <linux/nl80211.h>
#include <QRegularExpression>
class LIBIP_EXPORT Wireless : public QObject { class LIBIP_EXPORT Wireless : public QObject {
Q_OBJECT Q_OBJECT
@ -97,7 +98,6 @@ private:
QString m_interface; QString m_interface;
QString m_interfaceType; QString m_interfaceType;
QList<BandInfo> m_bands; QList<BandInfo> m_bands;
QRegularExpression m_noDigitRegex;
bool m_isValid; bool m_isValid;
bool m_isNL80211; bool m_isNL80211;
nl80211_iftype m_iftype; nl80211_iftype m_iftype;

Loading…
Cancel
Save