mirror of
https://github.com/outbackdingo/sysadm.git
synced 2026-01-27 10:20:26 +00:00
remove unnecessary <string> include, delete the QFile once we're done
with it. Add in a constructor that initializes the port cache, and add in a destructor to delete the cache if portlookup is deleted.
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#include "portlookup.h"
|
||||
#include <QtCore>
|
||||
#include <string>
|
||||
|
||||
using namespace sysadm;
|
||||
PortLookUp::PortInfo PortLookUp::LookUpPort(int portNumber)
|
||||
{
|
||||
@@ -67,6 +67,16 @@ PortLookUp::PortInfo PortLookUp::LookUpPort(int portNumber)
|
||||
|
||||
}
|
||||
|
||||
PortLookUp::PortLookUp()
|
||||
{
|
||||
readServiceFile();
|
||||
}
|
||||
|
||||
PortLookUp::~PortLookUp()
|
||||
{
|
||||
delete portStrings;
|
||||
}
|
||||
|
||||
void PortLookUp::readServicesFile()
|
||||
{
|
||||
portStrings = new QStringList();
|
||||
@@ -88,5 +98,6 @@ void PortLookUp::readServicesFile()
|
||||
portStrings->append(line);
|
||||
}
|
||||
services->close();
|
||||
delete services;
|
||||
}
|
||||
|
||||
|
||||
@@ -30,6 +30,7 @@ public:
|
||||
* @ErrorConditions Port Number is set to -1 and a description of the error is stored in the description variable
|
||||
*/
|
||||
PortInfo LookUpPort(int portNumber);
|
||||
~PortLookUp();
|
||||
|
||||
private:
|
||||
void readServicesFile();
|
||||
|
||||
Reference in New Issue
Block a user