mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2024-11-30 18:34:38 +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 delete(void *ptr) noexcept {}
|
||||
|
||||
const SharedPtr<Parent>& GetParent() const { return parent; }
|
||||
|
||||
void SetParent(SharedPtr<Parent> parent)
|
||||
{
|
||||
this->parent = std::move(parent);
|
||||
}
|
||||
const SharedPtr<ParentClass>& GetParent() const { return parent; }
|
||||
|
||||
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 ServerClass = Server;
|
||||
|
||||
void SetClientServerParent()
|
||||
{
|
||||
Parent *par = (Parent *)this;
|
||||
client.SetParent(par);
|
||||
server.SetParentAndClient(par);
|
||||
}
|
||||
|
||||
ClientClass &GetClient() { return client; }
|
||||
ServerClass &GetServer() { return server; }
|
||||
|
||||
protected:
|
||||
|
||||
void SetClientServerParent()
|
||||
{
|
||||
ParentClass *par = (ParentClass *)this;
|
||||
client.parent = par;
|
||||
server.parent = par;
|
||||
}
|
||||
|
||||
ClientClass client{};
|
||||
ServerClass server{};
|
||||
};
|
||||
|
@ -21,16 +21,11 @@ class IServer : public IServerTag {
|
||||
void *operator new(size_t sz) noexcept = delete;
|
||||
void operator delete(void *ptr) noexcept {};
|
||||
|
||||
const SharedPtr<Parent> &GetParent() const { return parent; }
|
||||
|
||||
void SetParentAndClient(SharedPtr<Parent> parent)
|
||||
{
|
||||
this->parent = std::move(parent);
|
||||
}
|
||||
const SharedPtr<ParentClass> &GetParent() const { return parent; }
|
||||
|
||||
protected:
|
||||
|
||||
SharedPtr<Parent> parent{};
|
||||
friend class IClientServerParent<ParentClass, ClientClass, ServerClass>;
|
||||
SharedPtr<ParentClass> parent{};
|
||||
};
|
||||
|
||||
}
|
||||
|
@ -2,7 +2,6 @@
|
||||
|
||||
#include <mesosphere/core/util.hpp>
|
||||
#include <mesosphere/core/Result.hpp>
|
||||
#include <mesosphere/core/KAutoObject.hpp>
|
||||
#include <mesosphere/core/KSynchronizationObject.hpp>
|
||||
#include <mesosphere/interfaces/IClient.hpp>
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user