started work on the interface of chat_messages
This commit is contained in:
		
							
								
								
									
										36
									
								
								chat_messages.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										36
									
								
								chat_messages.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,36 @@
 | 
				
			|||||||
 | 
					#pragma once
 | 
				
			||||||
 | 
					#include <string>
 | 
				
			||||||
 | 
					#include <boost/asio.hpp>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					enum class message
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    HELLO = 1, NEPTUN = 2, PASSW = 3,
 | 
				
			||||||
 | 
					    SERVER_DIRECTION = 4, MESSAGE = 5,
 | 
				
			||||||
 | 
					    PING = 6, PONG = 7, BYE = 8,
 | 
				
			||||||
 | 
					    LOGIN = 9, LOGOUT = 10
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class chat_message
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					    virtual message get_command() = 0;
 | 
				
			||||||
 | 
					    virtual std::string get_content() = 0;
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class client_message : public chat_message
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    void send(boost::asio::ip::tcp::socket& socket);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					class server_message : public chat_message
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					public:
 | 
				
			||||||
 | 
					    void receive(boost::asio::ip::tcp::socket& socket);
 | 
				
			||||||
 | 
					};
 | 
				
			||||||
		Reference in New Issue
	
	Block a user