bump product version to 6.3.0.0.beta1
[LibreOffice.git] / sd / source / ui / remotecontrol / BufferedStreamSocket.hxx
blob9144ebfcdc4a8eab5065495979574f414a729f59
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 #ifndef INCLUDED_SD_SOURCE_UI_REMOTECONTROL_BUFFEREDSTREAMSOCKET_HXX
10 #define INCLUDED_SD_SOURCE_UI_REMOTECONTROL_BUFFEREDSTREAMSOCKET_HXX
12 #include "IBluetoothSocket.hxx"
13 #include <osl/socket_decl.hxx>
14 #include <vector>
16 #define CHARSET RTL_TEXTENCODING_UTF8
17 #define MAX_LINE_LENGTH 20000
19 namespace sd
22 /**
23 * [A wrapper for an osl StreamSocket to allow reading lines.]
25 * Currently wraps either an osl StreamSocket or a standard c socket,
26 * allowing reading and writing for our purposes. Should eventually be
27 * returned to being a StreamSocket wrapper if/when Bluetooth is
28 * integrated into osl Sockets.
30 class BufferedStreamSocket :
31 public IBluetoothSocket,
32 private ::osl::StreamSocket
34 public:
35 /**
36 * Create a BufferedStreamSocket on top of an
37 * osl::StreamSocket.
39 explicit BufferedStreamSocket( const osl::StreamSocket &aSocket );
40 /**
41 * Create a BufferedStreamSocket on top of a POSIX or WinSock socket.
43 explicit BufferedStreamSocket( int aSocket );
44 BufferedStreamSocket( const BufferedStreamSocket &aSocket );
45 /**
46 * Blocks until a line is read.
47 * Returns whatever the last call of recv returned, i.e. 0 or less
48 * if there was a problem in communications.
50 virtual sal_Int32 readLine( OString& aLine ) override;
52 virtual sal_Int32 write( const void* pBuffer, sal_uInt32 n ) override;
54 virtual void close() override;
56 void getPeerAddr(osl::SocketAddr&);
57 private:
58 sal_Int32 aRet, aRead;
59 std::vector<char> aBuffer;
60 int mSocket;
61 bool const usingCSocket;
65 #endif // INCLUDED_SD_SOURCE_UI_REMOTECONTROL_BUFFEREDSTREAMSOCKET_HXX
66 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */