tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sd / source / ui / remotecontrol / BufferedStreamSocket.hxx
blobd675f3d9acc00382daedaedd32df2d3635184661
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 */
9 #pragma once
11 #include "IBluetoothSocket.hxx"
12 #include <osl/socket_decl.hxx>
13 #include <vector>
15 #define MAX_LINE_LENGTH 20000
17 namespace sd
20 /**
21 * [A wrapper for an osl StreamSocket to allow reading lines.]
23 * Currently wraps either an osl StreamSocket or a standard c socket,
24 * allowing reading and writing for our purposes. Should eventually be
25 * returned to being a StreamSocket wrapper if/when Bluetooth is
26 * integrated into osl Sockets.
28 class BufferedStreamSocket final :
29 public IBluetoothSocket,
30 private ::osl::StreamSocket
32 public:
33 /**
34 * Create a BufferedStreamSocket on top of an
35 * osl::StreamSocket.
37 explicit BufferedStreamSocket( const osl::StreamSocket &aSocket );
38 /**
39 * Create a BufferedStreamSocket on top of a POSIX or WinSock socket.
41 explicit BufferedStreamSocket( int aSocket );
42 BufferedStreamSocket( const BufferedStreamSocket &aSocket );
44 ~BufferedStreamSocket();
46 /**
47 * Blocks until a line is read.
48 * Returns whatever the last call of recv returned, i.e. 0 or less
49 * if there was a problem in communications.
51 virtual sal_Int32 readLine( OString& aLine ) override;
53 virtual sal_Int32 write( const void* pBuffer, sal_uInt32 n ) override;
55 virtual void close() override;
57 void getPeerAddr(osl::SocketAddr&);
58 private:
59 sal_Int32 aRead;
60 std::vector<char> aBuffer;
61 int mSocket;
62 bool usingCSocket;
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */