myTinySQL v0.2.0-2-g5000098
A tiny SQL interpreter over fixed-width text files
Loading...
Searching...
No Matches
Public Member Functions | Private Attributes | List of all members
tinysql::anonymous_namespace{Server.cpp}::Socket Class Reference

Owns a socket descriptor and closes it when it goes out of scope (RAII). More...

Public Member Functions

 Socket (int fd)
 Takes ownership of a descriptor.
 
 ~Socket ()
 Closes the descriptor, if there is one.
 
 Socket (const Socket &)=delete
 Not copyable: two copies would close the same descriptor.
 
Socket & operator= (const Socket &)=delete
 Not copyable.
 
 Socket (Socket &&other) noexcept
 Takes over another Socket's descriptor, here to hand a connection to its thread.
 
Socket & operator= (Socket &&)=delete
 Not needed: a Socket is only ever moved into a new Socket, never assigned.
 
int fd () const
 The descriptor, for system calls.
 

Private Attributes

int fd_
 The descriptor, or -1 for none.
 

Detailed Description

Owns a socket descriptor and closes it when it goes out of scope (RAII).

Definition at line 46 of file Server.cpp.

Constructor & Destructor Documentation

◆ Socket() [1/2]

tinysql::anonymous_namespace{Server.cpp}::Socket::Socket ( int  fd)
inlineexplicit

Takes ownership of a descriptor.

Parameters
fdThe descriptor, or -1 for none.

Definition at line 50 of file Server.cpp.

◆ ~Socket()

tinysql::anonymous_namespace{Server.cpp}::Socket::~Socket ( )
inline

Closes the descriptor, if there is one.

Definition at line 53 of file Server.cpp.

◆ Socket() [2/2]

tinysql::anonymous_namespace{Server.cpp}::Socket::Socket ( Socket &&  other)
inlinenoexcept

Takes over another Socket's descriptor, here to hand a connection to its thread.

Parameters
otherThe Socket to take from; it is left empty, so the descriptor is closed exactly once.

Definition at line 65 of file Server.cpp.

Member Function Documentation

◆ fd()

int tinysql::anonymous_namespace{Server.cpp}::Socket::fd ( ) const
inline

The descriptor, for system calls.

Returns
The descriptor, or -1 for none.

Definition at line 70 of file Server.cpp.

Member Data Documentation

◆ fd_

int tinysql::anonymous_namespace{Server.cpp}::Socket::fd_
private

The descriptor, or -1 for none.

Definition at line 73 of file Server.cpp.


The documentation for this class was generated from the following file: