BRAAAAAAAAAAAAAAAPAPAPAPAPAAAAPPAAPAPAPA

This commit is contained in:
Kbz-8
2024-01-21 12:31:52 +01:00
parent 6377c9e096
commit 9ae6ad183b
4 changed files with 21 additions and 27 deletions

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/20 10:09:02 by maldavid #+# #+# */ /* Created: 2024/01/20 10:09:02 by maldavid #+# #+# */
/* Updated: 2024/01/20 19:12:42 by maldavid ### ########.fr */ /* Updated: 2024/01/21 12:27:07 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -43,7 +43,6 @@ namespace unstd
void safeRelease(); void safeRelease();
private: private:
static std::map<void*, bits::RefCount*> _refs;
T* _ptr; T* _ptr;
bits::RefCount* _ref; bits::RefCount* _ref;
}; };

View File

@@ -15,17 +15,7 @@ namespace unstd
template <typename T> template <typename T>
SharedPtr<T>::SharedPtr(T* ptr) : _ptr(ptr) SharedPtr<T>::SharedPtr(T* ptr) : _ptr(ptr)
{ {
typename std::map<void*, bits::RefCount*>::iterator it = _refs.find(static_cast<void*>(ptr)); _ref = new bits::RefCount(1, 0);
if(it == _refs.end())
{
_ref = new bits::RefCount(1, 0);
_refs[static_cast<void*>(ptr)] = _ref;
}
else
{
_ref = it->second;
_ref->shared++;
}
} }
template <typename T> template <typename T>
@@ -100,17 +90,7 @@ namespace unstd
{ {
safeRelease(); safeRelease();
_ptr = ptr; _ptr = ptr;
typename std::map<void*, bits::RefCount*>::iterator it = _refs.find(static_cast<void*>(ptr)); _ref = new bits::RefCount(1, 0);
if(it == _refs.end())
{
_ref = new bits::RefCount(1, 0);
_refs[static_cast<void*>(ptr)] = _ref;
}
else
{
_ref = it->second;
_ref->shared++;
}
} }
template <typename T> template <typename T>

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/20 09:27:04 by maldavid #+# #+# */ /* Created: 2024/01/20 09:27:04 by maldavid #+# #+# */
/* Updated: 2024/01/21 10:31:26 by maldavid ### ########.fr */ /* Updated: 2024/01/21 12:16:41 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -26,7 +26,7 @@ int main(int ac, char** av)
} }
if(av[1] == NULL || av[2] == NULL) if(av[1] == NULL || av[2] == NULL)
irc::logs::report(irc::log_fatal_error, "invalid argv, one is NULL (wtf)"); irc::logs::report(irc::log_fatal_error, "invalid argv, argv[1] or argv[2] is NULL (wtf)");
char* end; char* end;
long port = std::strtol(av[1], &end, 10); long port = std::strtol(av[1], &end, 10);

View File

@@ -6,7 +6,7 @@
/* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */ /* By: maldavid <kbz_8.dev@akel-engine.com> +#+ +:+ +#+ */
/* +#+#+#+#+#+ +#+ */ /* +#+#+#+#+#+ +#+ */
/* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */ /* Created: 2024/01/21 09:31:17 by maldavid #+# #+# */
/* Updated: 2024/01/21 10:38:12 by maldavid ### ########.fr */ /* Updated: 2024/01/21 12:13:51 by maldavid ### ########.fr */
/* */ /* */
/* ************************************************************************** */ /* ************************************************************************** */
@@ -14,6 +14,21 @@
#include <client.hpp> #include <client.hpp>
#include <channel.hpp> #include <channel.hpp>
/** Commands to handle
* NICK
* USER
* QUIT
* PART
* JOIN
* PRIVMSG
* NOTICE
* KICK
* MOTD
* TOPIC
* PING
* MODE
*/
namespace irc namespace irc
{ {
Server::Server(int port, const std::string& password) : _password(password), _port(port) Server::Server(int port, const std::string& password) : _password(password), _port(port)