generated from MaximTiberiu/oop-template
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1915507
commit da6a1cf
Showing
17 changed files
with
56 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,5 @@ | ||
#include <AccountFactory.h> | ||
#include <AccountType.h> | ||
|
||
#include <BankAccount.h> | ||
#include <EmailAccount.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,6 +5,7 @@ | |
#include <memory> | ||
|
||
#include <Account.h> | ||
#include <AccountType.h> | ||
|
||
class AccountFactory { | ||
public: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include <AccountType.h> | ||
#include <BankAccount.h> | ||
|
||
#include <Database.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include <AccountType.h> | ||
#include <EmailAccount.h> | ||
|
||
#include <Database.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
#include <AccountType.h> | ||
#include <SocialMediaAccount.h> | ||
|
||
#include <Database.h> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
13 changes: 9 additions & 4 deletions
13
src/Utils/ShowAccountsCommand.cpp → src/Utils/ShowAccountsCommand.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,24 @@ | ||
#ifndef SHOWACCOUNTSCOMMAND_H | ||
#define SHOWACCOUNTSCOMMAND_H | ||
|
||
#include <AccountType.h> | ||
#include <Database.h> | ||
#include <iostream> | ||
|
||
namespace ShowAccountsCommands { | ||
template<AccountType T> | ||
void showAccountsCommand() { | ||
for (const auto &database = Database::getDatabaseInstance(); | ||
const auto &account: database.getAccountsByType(T)) { | ||
account->show(); | ||
} | ||
} | ||
std::cout << "---------------------------------\n"; | ||
} | ||
} ; | ||
|
||
void showAllAccounts() { | ||
inline void showAllAccounts() { | ||
showAccountsCommand<AccountType::BankAccountType>(); | ||
showAccountsCommand<AccountType::EmailAccountType>(); | ||
showAccountsCommand<AccountType::SocialMediaAccountType>(); | ||
} | ||
} | ||
|
||
#endif //SHOWACCOUNTSCOMMAND_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,10 +1,15 @@ | ||
#ifndef VECTORUTILS_H | ||
#define VECTORUTILS_H | ||
|
||
#include <vector> | ||
|
||
template<typename T> | ||
std::vector<T> operator+(const std::vector<T> &lhs, const std::vector<T> &rhs) { | ||
std::vector<T> operator+(const std::vector<T> &lhs, const std::vector<T> &rhs){ | ||
std::vector<T> result; | ||
result.reserve(lhs.size() + rhs.size()); | ||
result.insert(result.end(), lhs.begin(), lhs.end()); | ||
result.insert(result.end(), rhs.begin(), rhs.end()); | ||
return result; | ||
} | ||
|
||
#endif //VECTORUTILS_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters