From d3301ad9a74fdf693551bd70bc3cf34b311eaa49 Mon Sep 17 00:00:00 2001 From: benmeyer Date: Wed, 13 Nov 2002 16:25:04 +0000 Subject: code cleanup const's placed in code --- (limited to 'noncore/settings/networksettings/interfaces') diff --git a/noncore/settings/networksettings/interfaces/interface.cpp b/noncore/settings/networksettings/interfaces/interface.cpp index 4129b3d..7ffa76f 100644 --- a/noncore/settings/networksettings/interfaces/interface.cpp +++ b/noncore/settings/networksettings/interfaces/interface.cpp @@ -11,7 +11,7 @@ #include #include -Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), status(newSatus), attached(false), hardwareName("Unknown"), moduleOwner(NULL), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"), dhcp(false){ +Interface::Interface(QObject * parent, const char * name, bool newSatus): QObject(parent, name), hardwareName("Unknown"), moduleOwner(NULL), status(newSatus), attached(false), dhcp(false), macAddress(""), ip("0.0.0.0"), broadcast(""), subnetMask("0.0.0.0"){ refresh(); } diff --git a/noncore/settings/networksettings/interfaces/interface.h b/noncore/settings/networksettings/interfaces/interface.h index 989d6d8..d37834a 100644 --- a/noncore/settings/networksettings/interfaces/interface.h +++ b/noncore/settings/networksettings/interfaces/interface.h @@ -16,29 +16,29 @@ signals: public: Interface(QObject * parent=0, const char * name= "unknown", bool status = false); - QString getInterfaceName(){ QString n(this->name()); return n; }; + QString getInterfaceName() const { QString n(this->name()); return n; }; - bool getStatus(){ return status; }; + bool getStatus() const { return status; }; void setStatus(bool newStatus); - bool isAttached(){ return attached; }; + bool isAttached() const { return attached; }; void setAttached(bool isAttached=false); - QString getHardwareName(){ return hardwareName; }; + QString getHardwareName() const { return hardwareName; }; void setHardwareName(const QString &name="Unknown"); - Module* getModuleOwner(){ return moduleOwner; }; + Module* getModuleOwner() const { return moduleOwner; }; void setModuleOwner(Module *owner=NULL); // inet information. - QString getMacAddress(){ return macAddress; }; - QString getIp(){ return ip; }; - QString getSubnetMask(){ return subnetMask; }; - QString getBroadcast(){ return broadcast; }; - bool isDhcp(){ return dhcp; }; - QString getDhcpServerIp(){ return dhcpServerIp; }; - QString getLeaseObtained(){ return leaseObtained; }; - QString getLeaseExpires(){ return leaseExpires; }; + QString getMacAddress() const { return macAddress; }; + QString getIp() const { return ip; }; + QString getSubnetMask() const { return subnetMask; }; + QString getBroadcast() const { return broadcast; }; + bool isDhcp() const { return dhcp; }; + QString getDhcpServerIp() const { return dhcpServerIp; }; + QString getLeaseObtained() const { return leaseObtained; }; + QString getLeaseExpires() const { return leaseExpires; }; public slots: bool refresh(); @@ -48,21 +48,22 @@ public slots: private: // Interface information - bool status; - bool attached; QString hardwareName; Module *moduleOwner; - + bool status; + bool attached; + // Network information - QString macAddress; - QString ip; - QString broadcast; - QString subnetMask; bool dhcp; QString dhcpServerIp; QString leaseObtained; QString leaseExpires; + QString macAddress; + QString ip; + QString broadcast; + QString subnetMask; + }; #endif diff --git a/noncore/settings/networksettings/interfaces/interfaces.cpp b/noncore/settings/networksettings/interfaces/interfaces.cpp index e49998e..8f685fe 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.cpp +++ b/noncore/settings/networksettings/interfaces/interfaces.cpp @@ -71,7 +71,7 @@ QStringList Interfaces::getInterfaceList(){ * @param interface interface to check to see if it is on or not. * @return true is interface is in auto */ -bool Interfaces::isAuto(const QString &interface){ +bool Interfaces::isAuto(const QString &interface) const { QStringList autoLines = interfaces.grep(QRegExp(AUTO)); QStringList awi = autoLines.grep(QRegExp(interface)); if(awi.count() > 1) @@ -139,8 +139,8 @@ bool Interfaces::setInterface(QString interface){ * A quick helper funtion to see if the current interface is set. * @return bool true if set, false otherwise. */ -bool Interfaces::isInterfaceSet(){ - return (currentIface != interfaces.end()); +bool Interfaces::isInterfaceSet() const { + return (interfaces.end() != currentIface); } /** diff --git a/noncore/settings/networksettings/interfaces/interfaces.h b/noncore/settings/networksettings/interfaces/interfaces.h index d662919..bac2a7e 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.h +++ b/noncore/settings/networksettings/interfaces/interfaces.h @@ -25,14 +25,14 @@ public: Interfaces(QString useInterfacesFile = "/etc/network/interfaces"); QStringList getInterfaceList(); - bool isAuto(const QString &interface); + bool isAuto(const QString &interface) const ; bool setAuto(const QString &interface, bool setAuto); bool removeInterface(); bool addInterface(const QString &interface, const QString &family, const QString &method); bool copyInterface(const QString &oldInterface, const QString &newInterface); bool setInterface(QString interface); - bool isInterfaceSet(); + bool isInterfaceSet() const ; QString getInterfaceName(bool &error); bool setInterfaceName(const QString &newName); QString getInterfaceFamily(bool &error); @@ -57,11 +57,11 @@ public: private: bool setStanza(const QString &stanza, const QString &option, QStringList::Iterator &iterator); + bool removeStanza(QStringList::Iterator &stanza); bool setOption(const QStringList::Iterator &start, const QString &option, const QString &value); + bool removeAllOptions(const QStringList::Iterator &start); bool removeOption(const QStringList::Iterator &start, const QString &option, const QString &value); QString getOption(const QStringList::Iterator &start, const QString &option, bool &error); - bool removeStanza(QStringList::Iterator &stanza); - bool removeAllOptions(const QStringList::Iterator &start); QString interfacesFile; QStringList interfaces; diff --git a/noncore/settings/networksettings/interfaces/interfaces.pro b/noncore/settings/networksettings/interfaces/interfaces.pro index 9a024f6..d6b43fb 100644 --- a/noncore/settings/networksettings/interfaces/interfaces.pro +++ b/noncore/settings/networksettings/interfaces/interfaces.pro @@ -1,7 +1,7 @@ TEMPLATE = lib CONFIG += qt warn_on release #CONFIG += qt warn_on debug -DESTDIR = $(QTDIR)/lib$(PROJMAK) +#DESTDIR = $(QTDIR)/lib$(PROJMAK) HEADERS = interface.h interfaceinformationimp.h interfaces.h interfacesetupimp.h SOURCES = interface.cpp interfaces.cpp interfaceinformationimp.cpp interfacesetupimp.cpp INCLUDEPATH += $(OPIEDIR)/include ../ -- cgit v0.9.0.2