Skip to content

Instantly share code, notes, and snippets.

View calindotgabriel's full-sized avatar
🦁
typing...

Calin Gabriel calindotgabriel

🦁
typing...
  • Endava
  • Cluj-Napoca
View GitHub Profile
1 3
2 0
3 5
#ifndef PRODUCTREPO_H
#define PRODUCTREPO_H
#include <string>
#include <vector>
#include <mutex>
#include <thread>
#include "product.h"
#include "productrepo.h"
#include <iostream>
#include <fstream>
ProductRepo::ProductRepo()
{
}
#include "mainwindow.h"
#include <QApplication>
#include <assert.h>
#include <string>
#include <iostream>
#include "product.h"
#include "productrepo.h"
void testEntity() {
Product* ProductRepo::findByID(int id) {
for (Product* p : products) {
if (p->getId() == id)
return p;
}
return NULL;
}
#ifndef PRODUCTREPO_H
#define PRODUCTREPO_H
#include <string>
#include <vector>
#include <mutex>
#include <thread>
#include "product.h"
#include "productrepo.h"
#include <iostream>
#include <fstream>
#include <exception>
ProductRepo::ProductRepo()
{
}
#include "mainwindow.h"
#include <QApplication>
#include <assert.h>
#include <string>
#include <iostream>
#include "product.h"
#include "productrepo.h"
void testEntity() {
ProductRepo::ProductRepo(std::string fIdName,
std::string fNameQty)
: fIdName(fIdName), fNameQty(fNameQty)
{
std::thread load(&ProductRepo::_load, this);
load.join();
}
void ProductRepo::_load(){
// ****** {id}, {name} ******
if (getFileNameIdName().empty()) {
return;
}
std::ifstream loaderIdNameProducts(getFileNameIdName());
if (!loaderIdNameProducts) {