mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-12-03 19:57:28 +01:00
meso: Client/server ifaces: use friendship
This commit is contained in:
parent
b6bbc4f3e5
commit
d9c97983a3
@ -21,15 +21,11 @@ class IClient : public IClientTag {
|
|||||||
void *operator new(size_t sz) noexcept = delete;
|
void *operator new(size_t sz) noexcept = delete;
|
||||||
void operator delete(void *ptr) noexcept {}
|
void operator delete(void *ptr) noexcept {}
|
||||||
|
|
||||||
const SharedPtr<Parent>& GetParent() const { return parent; }
|
const SharedPtr<ParentClass>& GetParent() const { return parent; }
|
||||||
|
|
||||||
void SetParent(SharedPtr<Parent> parent)
|
|
||||||
{
|
|
||||||
this->parent = std::move(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SharedPtr<Parent> parent{};
|
friend class IClientServerParent<ParentClass, ClientClass, ServerClass>;
|
||||||
|
SharedPtr<ParentClass> parent{};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -18,18 +18,18 @@ class IClientServerParent : public IClientServerParentTag {
|
|||||||
using ClientClass = Client;
|
using ClientClass = Client;
|
||||||
using ServerClass = Server;
|
using ServerClass = Server;
|
||||||
|
|
||||||
void SetClientServerParent()
|
|
||||||
{
|
|
||||||
Parent *par = (Parent *)this;
|
|
||||||
client.SetParent(par);
|
|
||||||
server.SetParentAndClient(par);
|
|
||||||
}
|
|
||||||
|
|
||||||
ClientClass &GetClient() { return client; }
|
ClientClass &GetClient() { return client; }
|
||||||
ServerClass &GetServer() { return server; }
|
ServerClass &GetServer() { return server; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
|
void SetClientServerParent()
|
||||||
|
{
|
||||||
|
ParentClass *par = (ParentClass *)this;
|
||||||
|
client.parent = par;
|
||||||
|
server.parent = par;
|
||||||
|
}
|
||||||
|
|
||||||
ClientClass client{};
|
ClientClass client{};
|
||||||
ServerClass server{};
|
ServerClass server{};
|
||||||
};
|
};
|
||||||
|
@ -21,16 +21,11 @@ class IServer : public IServerTag {
|
|||||||
void *operator new(size_t sz) noexcept = delete;
|
void *operator new(size_t sz) noexcept = delete;
|
||||||
void operator delete(void *ptr) noexcept {};
|
void operator delete(void *ptr) noexcept {};
|
||||||
|
|
||||||
const SharedPtr<Parent> &GetParent() const { return parent; }
|
const SharedPtr<ParentClass> &GetParent() const { return parent; }
|
||||||
|
|
||||||
void SetParentAndClient(SharedPtr<Parent> parent)
|
|
||||||
{
|
|
||||||
this->parent = std::move(parent);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
friend class IClientServerParent<ParentClass, ClientClass, ServerClass>;
|
||||||
SharedPtr<Parent> parent{};
|
SharedPtr<ParentClass> parent{};
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -2,7 +2,6 @@
|
|||||||
|
|
||||||
#include <mesosphere/core/util.hpp>
|
#include <mesosphere/core/util.hpp>
|
||||||
#include <mesosphere/core/Result.hpp>
|
#include <mesosphere/core/Result.hpp>
|
||||||
#include <mesosphere/core/KAutoObject.hpp>
|
|
||||||
#include <mesosphere/core/KSynchronizationObject.hpp>
|
#include <mesosphere/core/KSynchronizationObject.hpp>
|
||||||
#include <mesosphere/interfaces/IClient.hpp>
|
#include <mesosphere/interfaces/IClient.hpp>
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user