wavelength 1.0.0
Loading...
Searching...
No Matches
joinchatroomresultmsg.h
Go to the documentation of this file.
1#pragma once
2
3#include "msg/message.h"
5#include "os/mem.h"
6
14
22public:
30
38 explicit JoinChatroomResultMsg(int nResult) : mResult(nResult) {
39 }
40
49 JoinChatroomResultMsg(int nResult, const NetChatroomInfo &chatroom)
50 : mResult(nResult), mChatroom(chatroom) {
51 }
52
59 void *operator new(size_t nSize) {
60 return PoolMemAlloc(static_cast<int>(nSize), "JoinChatroomResultMsg", 0);
61 }
62
68 void operator delete(void *pBlock) {
69 PoolMemFree(pBlock);
70 }
71
77 Message *Clone() override {
78 return new JoinChatroomResultMsg(*this);
79 }
80
86 int Type() override {
88 }
89
95 const char *GetName() const override {
96 return "JoinChatroomResultMsg";
97 }
98
106 void PrintExtra(PrnStream &stream) const override;
107
110 return mChatroom;
111 }
112
114 int GetResult() const {
115 return mResult;
116 }
117
118private:
119 int mResult;
120 NetChatroomInfo mChatroom;
121};
int Type() override
Report this message's registered identity.
Definition joinchatroomresultmsg.h:86
Result
Values of mResult.
Definition joinchatroomresultmsg.h:24
@ kResultNameExists
Definition joinchatroomresultmsg.h:27
@ kResultFailed
Definition joinchatroomresultmsg.h:26
@ kResultVulgarName
Definition joinchatroomresultmsg.h:25
@ kResultSuccess
Definition joinchatroomresultmsg.h:28
JoinChatroomResultMsg(int nResult, const NetChatroomInfo &chatroom)
Construct a result with the room joined.
Definition joinchatroomresultmsg.h:49
int GetResult() const
Definition joinchatroomresultmsg.h:114
Message * Clone() override
Produce a heap copy of this message.
Definition joinchatroomresultmsg.h:77
const NetChatroomInfo & GetChatroom() const
Definition joinchatroomresultmsg.h:109
void PrintExtra(PrnStream &stream) const override
Write the result, and the room after a success.
const char * GetName() const override
Report this message's class name.
Definition joinchatroomresultmsg.h:95
JoinChatroomResultMsg(int nResult)
Construct a failure, whose room has the identifier -1.
Definition joinchatroomresultmsg.h:38
Base of every event the game passes between a MsgSource and a MsgSink.
Definition message.h:40
Text output stream.
Definition prnstream.h:16
int g_nJoinChatroomResultMsgType
Identity that JoinChatroomResultMsg::Type() reports.
void * PoolMemAlloc(int nSize, const char *pszTag, int nAlign)
Allocate a block from the pool heaps and bill it to a tag.
void PoolMemFree(void *pBlock)
Return a block PoolMemAlloc() handed out to the pool heap that owns it.
The description of one chat room of the online lobby.
Definition netchatroominfo.h:11