fix(commands/cmd): now using NULL instead nullptr

This commit is contained in:
Raphael 2025-05-26 17:55:31 +02:00
parent bcfa001d5e
commit 29a3bb114b
7 changed files with 67 additions and 41 deletions

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 23:31:58 by rparodi #+# #+# */
/* Updated: 2025/05/24 18:21:55 by rparodi ### ########.fr */
/* Updated: 2025/05/26 16:28:58 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -60,7 +60,7 @@ namespace cmd
class Quit;
class Topic;
class Unknown;
class User;
class cmdUser;
};
#include "./commands/commands.tpp"

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:34:30 by rparodi #+# #+# */
/* Updated: 2025/05/24 18:23:26 by rparodi ### ########.fr */
/* Updated: 2025/05/26 16:14:24 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -18,7 +18,7 @@
* @tparam T Type of the list have to be search (have to get an getName() method)
* @param list list to search in
* @param name name of the element to search
* @return pointer to the element found or nullptr if not found
* @return pointer to the element found or NULL if not found
*/
template <typename T>
T cmd::searchList(const std::list<T> &list, const std::string &name) {
@ -26,5 +26,5 @@ T cmd::searchList(const std::list<T> &list, const std::string &name) {
if ((*it)->getName() == name)
return *it;
}
return nullptr;
return NULL;
}

View file

@ -6,7 +6,7 @@
/* By: rparodi <rparodi@student.42.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/24 17:17:31 by rparodi #+# #+# */
/* Updated: 2025/05/24 17:32:43 by rparodi ### ########.fr */
/* Updated: 2025/05/26 16:27:42 by rparodi ### ########.fr */
/* */
/* ************************************************************************** */
@ -16,6 +16,6 @@
class cmd::Invite : public ACommand {
public:
virtual void execute(Server &server, User &client, const std::vector<std::string> &args);
virtual void execute(void);
virtual bool checkArgs();
};

View file

@ -6,7 +6,7 @@
/* By: omoudni <omoudni@student.42paris.fr> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */
/* Created: 2025/05/20 21:57:49 by rparodi #+# #+# */
/* Updated: 2025/05/21 21:16:56 by omoudni ### ########.fr */
/* Updated: 2025/05/26 16:16:01 by rparodi ### ########.fr */
/* */
/******************************************************************************/
@ -16,27 +16,27 @@
class User
{
private:
short unsigned int _fd;
bool _registered;
std::string _nickname;
std::string _hostname;
std::string _read_buffer;
std::string _write_buffer;
std::string _username;
bool _hasNick;
bool _hasUser;
public:
User(short unsigned fd);
short unsigned int getFd() const;
bool isReadyToSend() const;
bool isRegistered() const;
std::string getName() const;
std::string extractFullCommand();
void appendToReadBuffer(const std::string &data);
void appendToWriteBuffer(const std::string &data);
void setNickname(const std::string &nickname);
void setUsername(const std::string &username);
void checkRegistration();
private:
short unsigned int _fd;
bool _registered;
std::string _nickname;
std::string _hostname;
std::string _read_buffer;
std::string _write_buffer;
std::string _username;
bool _hasNick;
bool _hasUser;
public:
User(short unsigned fd);
short unsigned int getFd() const;
bool isReadyToSend() const;
bool isRegistered() const;
std::string getName() const;
std::string extractFullCommand();
void appendToReadBuffer(const std::string &data);
void appendToWriteBuffer(const std::string &data);
void setNickname(const std::string &nickname);
void setUsername(const std::string &username);
void checkRegistration();
};