mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 00:12:44 +00:00 
			
		
		
		
	 4298ba25c3
			
		
	
	
		4298ba25c3
		
	
	
	
	
		
			
			The C_OBJECT macro now also inserts a static construct(...) helper into
the class. Now we can make the constructor(s) private and instead call:
    auto socket = CTCPSocket::construct(arguments);
construct() returns an ObjectPtr<T>, which we'll later switch to being
a NonnullRefPtr<T>, once everything else in in place for ref-counting.
		
	
			
		
			
				
	
	
		
			16 lines
		
	
	
	
		
			312 B
		
	
	
	
		
			C++
		
	
	
	
	
	
			
		
		
	
	
			16 lines
		
	
	
	
		
			312 B
		
	
	
	
		
			C++
		
	
	
	
	
	
| #pragma once
 | |
| 
 | |
| #include <AK/Badge.h>
 | |
| #include <LibCore/CSocket.h>
 | |
| 
 | |
| class CTCPServer;
 | |
| 
 | |
| class CTCPSocket final : public CSocket {
 | |
|     C_OBJECT(CTCPSocket)
 | |
| public:
 | |
|     virtual ~CTCPSocket() override;
 | |
| 
 | |
| private:
 | |
|     CTCPSocket(int fd, CObject* parent = nullptr);
 | |
|     explicit CTCPSocket(CObject* parent = nullptr);
 | |
| };
 |