PSQL 01.11.2024

This commit is contained in:
krivoshein
2024-11-01 11:45:13 +03:00
parent 024cd38bd6
commit 9422c5e257
274 changed files with 3223 additions and 3102 deletions

View File

@@ -0,0 +1,45 @@
#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;
}