2021-11-01 13:47:03 +01:00
|
|
|
#ifndef USERTABLE_H
|
|
|
|
#define USERTABLE_H
|
2021-10-27 15:15:47 +02:00
|
|
|
|
|
|
|
#include <iostream>
|
|
|
|
|
|
|
|
#include "User.h"
|
|
|
|
|
2024-11-27 17:25:14 +01:00
|
|
|
class UserTable {
|
|
|
|
public:
|
2021-10-27 15:15:47 +02:00
|
|
|
UserTable();
|
2024-11-27 17:25:14 +01:00
|
|
|
UserTable(const std::string &);
|
|
|
|
~UserTable() { delete[] users; }
|
2021-10-27 15:15:47 +02:00
|
|
|
|
2024-11-27 17:25:14 +01:00
|
|
|
void addUser(const User &);
|
2021-10-27 15:15:47 +02:00
|
|
|
User find(int) const;
|
|
|
|
User find(std::string) const;
|
|
|
|
|
2024-11-27 17:25:14 +01:00
|
|
|
int getNbrUsers() const { return n; }
|
2021-10-27 15:15:47 +02:00
|
|
|
|
2024-11-27 17:25:14 +01:00
|
|
|
void print(std::ostream &) const;
|
2021-10-27 15:15:47 +02:00
|
|
|
|
|
|
|
static const User user_not_found;
|
2024-11-27 17:25:14 +01:00
|
|
|
|
|
|
|
private:
|
2021-10-27 15:15:47 +02:00
|
|
|
int capacity{1000};
|
|
|
|
void ensureCapacity(int);
|
|
|
|
int n{0};
|
2024-11-27 17:25:14 +01:00
|
|
|
User *users;
|
2021-10-27 15:15:47 +02:00
|
|
|
|
|
|
|
friend int testFindNbr(const UserTable ut);
|
|
|
|
};
|
|
|
|
#endif
|