LibreOffice
LibreOffice 7.1 SDK C/C++ API Reference
pipe_decl.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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 * This file incorporates work covered by the following license notice:
10 *
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 */
19#ifndef INCLUDED_OSL_PIPE_DECL_HXX
20#define INCLUDED_OSL_PIPE_DECL_HXX
21
22#include "osl/pipe.h"
23#include "osl/security.hxx"
24#include "rtl/ustring.hxx"
25
26namespace osl
27{
28class StreamPipe;
29
32class Pipe
33{
34protected:
36
37public:
41 inline Pipe();
42
47 inline Pipe(const ::rtl::OUString& strName, oslPipeOptions Options);
48
54 inline Pipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security& rSecurity);
55
58 inline Pipe(const Pipe& pipe);
59
60#if defined LIBO_INTERNAL_ONLY
61 inline Pipe(Pipe&& other) noexcept;
62#endif
63
66 inline Pipe(oslPipe pipe, __sal_NoAcquire noacquire);
67
71 inline Pipe(oslPipe Pipe);
72
75 inline ~Pipe();
76
77 inline bool SAL_CALL is() const;
78
87 inline bool create(const ::rtl::OUString& strName, oslPipeOptions Options,
88 const Security& rSec);
89
98 inline bool create(const ::rtl::OUString& strName, oslPipeOptions Options = osl_Pipe_OPEN);
99
102 inline void SAL_CALL clear();
103
107 inline Pipe& SAL_CALL operator=(const Pipe& pipe);
108
109#if defined LIBO_INTERNAL_ONLY
110 inline Pipe& operator=(Pipe&& other) noexcept;
111#endif
112
116 inline Pipe& SAL_CALL operator=(const oslPipe pipe);
117
121 inline bool SAL_CALL isValid() const;
122
123 inline bool SAL_CALL operator==(const Pipe& rPipe) const;
124
127 inline void SAL_CALL close();
128
131 inline oslPipeError SAL_CALL accept(StreamPipe& Connection);
132
138 inline oslPipeError SAL_CALL getError() const;
139
140 inline oslPipe SAL_CALL getHandle() const;
141};
142
145class StreamPipe : public Pipe
146{
147public:
152 inline StreamPipe();
153
158 inline StreamPipe(oslPipe Pipe);
159
165 inline StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options = osl_Pipe_OPEN);
166
173 inline StreamPipe(const ::rtl::OUString& strName, oslPipeOptions Options, const Security& rSec);
174
177 inline StreamPipe(oslPipe pipe, __sal_NoAcquire noacquire);
178
185 inline StreamPipe& SAL_CALL operator=(oslPipe Pipe);
186
189 inline StreamPipe& SAL_CALL operator=(const Pipe& pipe);
190
200 inline sal_Int32 SAL_CALL recv(void* pBuffer, sal_Int32 BytesToRead) const;
201
210 inline sal_Int32 SAL_CALL send(const void* pBuffer, sal_Int32 BytesToSend) const;
211
222 inline sal_Int32 SAL_CALL read(void* pBuffer, sal_Int32 n) const;
223
233 sal_Int32 SAL_CALL write(const void* pBuffer, sal_Int32 n) const;
234};
235}
236#endif
237
238/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
__sal_NoAcquire
Definition: types.h:349
oslPipeError
Definition: pipe.h:34
sal_uInt32 oslPipeOptions
Pipe creation options.
Definition: pipe.h:53
#define osl_Pipe_OPEN
Definition: pipe.h:54
struct oslPipeImpl * oslPipe
Definition: pipe.h:57
Definition: component.hxx:30
Represents a pipe.
Definition: pipe_decl.hxx:33
bool is() const
Definition: pipe.hxx:121
bool isValid() const
Checks if the pipe is valid.
Pipe()
Does not create a pipe.
Definition: pipe.hxx:31
~Pipe()
Destructor.
Definition: pipe.hxx:72
oslPipeError getError() const
Delivers a constant describing the last error for the pipe system.
Definition: pipe.hxx:159
Pipe & operator=(const Pipe &pipe)
Assignment operator.
Definition: pipe.hxx:93
oslPipe m_handle
Definition: pipe_decl.hxx:35
oslPipe getHandle() const
Definition: pipe.hxx:165
void close()
Closes the pipe.
Definition: pipe.hxx:133
oslPipeError accept(StreamPipe &Connection)
Accept connection on an existing pipe.
Definition: pipe.hxx:149
bool operator==(const Pipe &rPipe) const
Definition: pipe.hxx:127
bool create(const ::rtl::OUString &strName, oslPipeOptions Options, const Security &rSec)
Creates an insecure pipe that is accessible for all users with the given attributes.
Definition: pipe.hxx:79
void clear()
releases the underlying handle
Definition: pipe.hxx:139
A pipe to send or receive a stream of data.
Definition: pipe_decl.hxx:146
StreamPipe()
Creates an unattached pipe.
Definition: pipe.hxx:171
sal_Int32 write(const void *pBuffer, sal_Int32 n) const
Writes n bytes from pBuffer to the stream.
Definition: pipe.hxx:200
sal_Int32 recv(void *pBuffer, sal_Int32 BytesToRead) const
Tries to receives BytesToRead data from the connected pipe,.
Definition: pipe.hxx:206
sal_Int32 read(void *pBuffer, sal_Int32 n) const
Retrieves n bytes from the stream and copies them into pBuffer.
Definition: pipe.hxx:194
sal_Int32 send(const void *pBuffer, sal_Int32 BytesToSend) const
Tries to sends BytesToSend data from the connected pipe.
Definition: pipe.hxx:212
StreamPipe & operator=(const Pipe &pipe)
Assignment operator.
StreamPipe & operator=(oslPipe Pipe)
Attaches the oslPipe to this object.
Encapsulate security information for one user.
Definition: security_decl.hxx:35