Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class ORM
- {
- private:
- std::string path;
- AccountList<Account> ListAccount;
- AccountList<AccountSecure> ListAccountSecure;
- public:
- ORM();
- ~ORM();
- template<typename type>
- type* getAccount(const long &INN);
- bool saveToDataBase();
- bool deleteFromDatabase();
- };
- // Класс контейнер аккаунтов
- template<class type>
- class AccountList {
- private:
- // Контейнер для сохранения аккаунта в списке аккаунтов
- struct AccountData {
- type data; // Аккаунт
- AccountData* next; // Указатель на следующий аккаунт
- };
- AccountData *head, *tail; // Голова и хвост
- public:
- AccountList();
- ~AccountList();
- void addAccount( const type &account); // Добавление аккаунта
- void deleteAccount( type &account ); // Удаление аккаунта
- };
- template<>
- AccountList<Account>::AccountList() {
- this->tail = this->head = nullptr;
- }
- template<>
- AccountList<AccountSecure>::AccountList() {
- this->tail = this->head = nullptr;
- }
- template<>
- AccountList<Account>::~AccountList() {
- delete tail;
- delete head;
- }
- template<>
- AccountList<AccountSecure>::~AccountList() {
- delete tail;
- delete head;
- }
RAW Paste Data