mirror of
https://gitea.msk.dinamika-avia.ru/Constanta-Design/RRJServer.git
synced 2026-03-27 19:45:43 +03:00
46 lines
1.0 KiB
C++
46 lines
1.0 KiB
C++
#include "computersLocations.h"
|
|
|
|
ComputersLocations::ComputersLocations():
|
|
locations(),
|
|
computers(),
|
|
listComputerInLocation()
|
|
{
|
|
|
|
}
|
|
|
|
void ComputersLocations::addComputer(QString computer, QString location)
|
|
{
|
|
if(!computers.contains(computer))
|
|
{
|
|
computers.append(computer);
|
|
if(!locations.contains(location))
|
|
locations.append(location);
|
|
|
|
computerInLocation comp = {computer, location};
|
|
listComputerInLocation.append(comp);
|
|
}
|
|
}
|
|
|
|
QString ComputersLocations::getLocationOfComputer(QString computer)
|
|
{
|
|
for(computerInLocation compInLoc : listComputerInLocation)
|
|
{
|
|
if(computer == compInLoc.computer)
|
|
return compInLoc.location;
|
|
}
|
|
return QString(QStringLiteral(""));
|
|
}
|
|
|
|
QStringList ComputersLocations::getAllComputersOfLocation(QString location)
|
|
{
|
|
QStringList list;
|
|
|
|
for(computerInLocation compInLoc : listComputerInLocation)
|
|
{
|
|
if(location == compInLoc.location)
|
|
list.append(compInLoc.computer);
|
|
}
|
|
|
|
return list;
|
|
}
|