LibreOffice Module sd (master) 1
Public Member Functions | Private Attributes | List of all members
sd::BufferedStreamSocket Class Referencefinal

[A wrapper for an osl StreamSocket to allow reading lines. More...

#include <BufferedStreamSocket.hxx>

Inheritance diagram for sd::BufferedStreamSocket:
[legend]
Collaboration diagram for sd::BufferedStreamSocket:
[legend]

Public Member Functions

 BufferedStreamSocket (const osl::StreamSocket &aSocket)
 Create a BufferedStreamSocket on top of an osl::StreamSocket. More...
 
 BufferedStreamSocket (int aSocket)
 Create a BufferedStreamSocket on top of a POSIX or WinSock socket. More...
 
 BufferedStreamSocket (const BufferedStreamSocket &aSocket)
 
 ~BufferedStreamSocket ()
 
virtual sal_Int32 readLine (OString &aLine) override
 Blocks until a line is read. More...
 
virtual sal_Int32 write (const void *pBuffer, sal_uInt32 n) override
 Write a number of bytes. More...
 
virtual void close () override
 
void getPeerAddr (osl::SocketAddr &)
 
- Public Member Functions inherited from sd::IBluetoothSocket
 IBluetoothSocket ()=default
 
virtual ~IBluetoothSocket ()
 
 IBluetoothSocket (const IBluetoothSocket &)=delete
 
IBluetoothSocketoperator= (const IBluetoothSocket &)=delete
 
virtual sal_Int32 readLine (OString &aLine)=0
 Blocks until a line is read. More...
 
virtual sal_Int32 write (const void *pBuffer, sal_uInt32 n)=0
 Write a number of bytes. More...
 
virtual void close ()
 

Private Attributes

sal_Int32 aRet
 
sal_Int32 aRead
 
std::vector< char > aBuffer
 
int mSocket
 
bool usingCSocket
 

Detailed Description

[A wrapper for an osl StreamSocket to allow reading lines.

]

Currently wraps either an osl StreamSocket or a standard c socket, allowing reading and writing for our purposes. Should eventually be returned to being a StreamSocket wrapper if/when Bluetooth is integrated into osl Sockets.

Definition at line 28 of file BufferedStreamSocket.hxx.

Constructor & Destructor Documentation

◆ BufferedStreamSocket() [1/3]

BufferedStreamSocket::BufferedStreamSocket ( const osl::StreamSocket &  aSocket)
explicit

Create a BufferedStreamSocket on top of an osl::StreamSocket.

Definition at line 29 of file BufferedStreamSocket.cxx.

◆ BufferedStreamSocket() [2/3]

BufferedStreamSocket::BufferedStreamSocket ( int  aSocket)
explicit

Create a BufferedStreamSocket on top of a POSIX or WinSock socket.

Definition at line 38 of file BufferedStreamSocket.cxx.

◆ BufferedStreamSocket() [3/3]

sd::BufferedStreamSocket::BufferedStreamSocket ( const BufferedStreamSocket aSocket)

◆ ~BufferedStreamSocket()

BufferedStreamSocket::~BufferedStreamSocket ( )

Definition at line 46 of file BufferedStreamSocket.cxx.

References close().

Member Function Documentation

◆ close()

void BufferedStreamSocket::close ( )
overridevirtual

Reimplemented from sd::IBluetoothSocket.

Definition at line 71 of file BufferedStreamSocket.cxx.

References close(), mSocket, and usingCSocket.

Referenced by close(), and ~BufferedStreamSocket().

◆ getPeerAddr()

void BufferedStreamSocket::getPeerAddr ( osl::SocketAddr &  rAddr)

Definition at line 50 of file BufferedStreamSocket.cxx.

References usingCSocket.

Referenced by sd::RemoteServer::handleAcceptedConnection().

◆ readLine()

sal_Int32 BufferedStreamSocket::readLine ( OString &  aLine)
overridevirtual

Blocks until a line is read.

Returns whatever the last call of recv returned, i.e. 0 or less if there was a problem in communications.

Implements sd::IBluetoothSocket.

Definition at line 86 of file BufferedStreamSocket.cxx.

References aBuffer, aRead, aRet, find(), MAX_LINE_LENGTH, mSocket, SAL_INFO, and usingCSocket.

Referenced by sd::RemoteServer::handleAcceptedConnection().

◆ write()

sal_Int32 BufferedStreamSocket::write ( const void *  pBuffer,
sal_uInt32  n 
)
overridevirtual

Write a number of bytes.

Returns
number of bytes actually written

Implements sd::IBluetoothSocket.

Definition at line 56 of file BufferedStreamSocket.cxx.

References mSocket, n, and usingCSocket.

Referenced by sd::RemoteServer::handleAcceptedConnection().

Member Data Documentation

◆ aBuffer

std::vector<char> sd::BufferedStreamSocket::aBuffer
private

Definition at line 60 of file BufferedStreamSocket.hxx.

Referenced by readLine().

◆ aRead

sal_Int32 sd::BufferedStreamSocket::aRead
private

Definition at line 59 of file BufferedStreamSocket.hxx.

Referenced by readLine().

◆ aRet

sal_Int32 sd::BufferedStreamSocket::aRet
private

Definition at line 59 of file BufferedStreamSocket.hxx.

Referenced by readLine().

◆ mSocket

int sd::BufferedStreamSocket::mSocket
private

Definition at line 61 of file BufferedStreamSocket.hxx.

Referenced by close(), readLine(), and write().

◆ usingCSocket

bool sd::BufferedStreamSocket::usingCSocket
private

Definition at line 62 of file BufferedStreamSocket.hxx.

Referenced by close(), getPeerAddr(), readLine(), and write().


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