netmsg.h

来自「SQLBig5BugTool 宽字符操作问题」· C头文件 代码 · 共 64 行

H
64
字号

//netmsg.h

#ifndef _netmsg_h

#pragma once
#include "BaseFunc.h"
#include "NetworkDef.h"

#include "MyObject.h"

typedef std::pair<std::string,std::string> STD_PAIR_STRING_STRING;

//#define	MSGHEAD_DEFINE unsigned short	unMsgSize;unsigned short	unMsgType;

class CNetMsg
{
public:	
	DECL_CLASS(CNetMsg,CNetMsg);

	CNetMsg();
	virtual ~CNetMsg();

	void	Init(void);
	void	Reset(void)	{Init();}

	const unsigned short	GetType	(void)		{return m_unMsgType;}
	const unsigned short	GetSize	(void)		{return m_unMsgSize;}

	char*	GetBuf(void)	{return m_bufMsg;}

public:	
	virtual BOOL			Create		(char* pMsgBuf, DWORD dwSize);
	virtual BOOL			IsValid		(void);
//	virtual void			Send		(void);
	virtual void			Process		(void *pInfo);

public:
	static int	GetMaxSize	(void)		{return _MAX_MSGSIZE;}
	static unsigned short	GetType		(char* pbufMsg, DWORD dwMsgSize);
	static unsigned short	GetSize		(char* pbufMsg, DWORD dwMsgSize);

	static CNetMsg*	CreateMsg	(char* pbufMsg, DWORD dwMsgSize);

protected:
	union
	{
		char	m_bufMsg[_MAX_MSGSIZE];
		struct
		{
			unsigned short	m_unMsgSize;
			unsigned short	m_unMsgType;
		};
	};

public:	
	static const char* GetMsgIdName(const long lMsgID);
	
};

//CNetMsg* CreateNetMsgFromId(const long lId);


#endif

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?