Skip to content

Commit

Permalink
Removed useless methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Duta-Sebastian committed Nov 23, 2024
1 parent 6a36f7a commit 6952483
Show file tree
Hide file tree
Showing 10 changed files with 1 addition and 49 deletions.
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
generated/** linguist-generated
ext/** linguist-vendored
6 changes: 0 additions & 6 deletions src/Database/Auth.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,3 @@ User Auth::login() const {
throw;
}
}

std::ostream& operator<<(std::ostream& os, const Auth& auth) {
os<< "Auth: " << auth.username << " " << auth.password<<std::endl;
return os;
}

2 changes: 0 additions & 2 deletions src/Database/Auth.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@ class Auth {
[[nodiscard]] User createAccount() const;

[[nodiscard]] User login() const;

friend std::ostream &operator<<(std::ostream &os, const Auth &auth);
};


Expand Down
5 changes: 0 additions & 5 deletions src/Database/Database.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,8 +113,3 @@ User Database::getUserByUsername(std::string &username) const {
throw;
}
}

std::ostream& operator<<(std::ostream & os, const Database & database) {
os << "Database connection string " << database.connection->connection_string() << std::endl;
return os;
}
2 changes: 0 additions & 2 deletions src/Database/Database.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ class Database {
[[nodiscard]] int getNumberOfUsers() const;

User getUserByUsername(std::string &username) const;

friend std::ostream& operator<<(std::ostream &, const Database&);
};


Expand Down
5 changes: 0 additions & 5 deletions src/Logger/Logger.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,3 @@ std::string Logger::generateTimestampedFilename() {
<< ".log";
return oss.str();
}

std::ostream & operator<<(std::ostream & os, const Logger & logger) {
os<<"Logger has been created"<< logger.folderName<<std::endl;
return os;
}
2 changes: 0 additions & 2 deletions src/Logger/Logger.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,6 @@ class Logger {
Logger &operator=(Logger &&) = delete;

void log(LogLevel, const std::string &);

friend std::ostream& operator<<(std::ostream &, const Logger&);
};


Expand Down
16 changes: 0 additions & 16 deletions src/User/User.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,26 +23,10 @@ User::User(std::string username, PasswordHash passwordHash)
User::User(const int userId, std::string username, const std::string &passwordHash, std::string passwordSalt)
: username(std::move(username)), passwordHash(passwordHash, std::move(passwordSalt), false), userId(userId) {}

User::User(const User &otherUser): passwordHash(otherUser.passwordHash) {
this->username = otherUser.username;
this->userId = otherUser.userId;
}

User& User::operator=(const User &otherUser) { // NOLINT(*-use-equals-default)
this->username = otherUser.username;
this->userId = otherUser.userId;
this->passwordHash = otherUser.passwordHash;
return *this;
}

bool User::operator==(const User &other) const {
return this->username == other.username && this->userId == other.userId && this->passwordHash == other.passwordHash;
}

User::~User() {
std::cout<<"User::~User()"<<std::endl;
}

std::string User::getUsername() const {
return this->username;
}
Expand Down
3 changes: 0 additions & 3 deletions src/User/User.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,7 @@ class User {
User(std::string, const std::string&);
User(std::string, PasswordHash);
User(int, std::string, const std::string &, std::string);
User(const User&);
User& operator=(const User&);
bool operator==(const User &) const;
~User();
friend std::ostream& operator<<(std::ostream& os, const User& user);
[[nodiscard]] std::string getUsername() const;
[[nodiscard]] std::string getPasswordHash() const;
Expand Down
8 changes: 0 additions & 8 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,5 @@ int main() {
if(command == "Login") currentUser = auth.login();
else currentUser = auth.createAccount();
std::cout<<*currentUser;
const User copiedUser = *currentUser;
std::cout<<copiedUser;
std::cout<<auth;
const auto &database = Database::getDatabaseInstance();
std::cout<<database;
std::cout<<logger;
constexpr EnvVarManager envVarManager;
std::cout<<&envVarManager;
return 0;
}

0 comments on commit 6952483

Please sign in to comment.