LibreOffice Module basic (master) 1
iosys.cxx
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
20#include <string.h>
21#include <vcl/svapp.hxx>
22#include <vcl/weld.hxx>
23#include <osl/file.hxx>
24
25#include <runtime.hxx>
26
27#include <rtl/strbuf.hxx>
28#include <sal/log.hxx>
29
31#include <comphelper/string.hxx>
32
33#include <com/sun/star/uno/Sequence.hxx>
34#include <com/sun/star/ucb/SimpleFileAccess.hpp>
35#include <com/sun/star/ucb/UniversalContentBroker.hpp>
36#include <com/sun/star/io/XInputStream.hpp>
37#include <com/sun/star/io/XOutputStream.hpp>
38#include <com/sun/star/io/XStream.hpp>
39#include <com/sun/star/io/XSeekable.hpp>
40
41using namespace com::sun::star::uno;
42using namespace com::sun::star::lang;
43using namespace com::sun::star::ucb;
44using namespace com::sun::star::io;
45using namespace com::sun::star::bridge;
46
47#include <iosys.hxx>
48
49namespace {
50
51class SbiInputDialog : public weld::GenericDialogController
52{
53 std::unique_ptr<weld::Entry> m_xInput;
54 std::unique_ptr<weld::Button> m_xOk;
55 std::unique_ptr<weld::Button> m_xCancel;
56 std::unique_ptr<weld::Label> m_xPromptText;
57 OUString m_aText;
58 DECL_LINK(Ok, weld::Button&, void);
59 DECL_LINK(Cancel, weld::Button&, void);
60public:
61 SbiInputDialog(weld::Window*, const OUString&);
62 const OUString& GetInput() const { return m_aText; }
63};
64
65}
66
67SbiInputDialog::SbiInputDialog(weld::Window* pParent, const OUString& rPrompt)
68 : GenericDialogController(pParent, "svt/ui/inputbox.ui", "InputBox")
69 , m_xInput(m_xBuilder->weld_entry("entry"))
70 , m_xOk(m_xBuilder->weld_button("ok"))
71 , m_xCancel(m_xBuilder->weld_button("cancel"))
72 , m_xPromptText(m_xBuilder->weld_label("prompt"))
73{
74 m_xDialog->set_title(rPrompt);
75 m_xPromptText->set_label(rPrompt);
76 m_xOk->connect_clicked( LINK( this, SbiInputDialog, Ok ) );
77 m_xCancel->connect_clicked( LINK( this, SbiInputDialog, Cancel ) );
78}
79
80IMPL_LINK_NOARG( SbiInputDialog, Ok, weld::Button&, void )
81{
82 m_aText = m_xInput->get_text();
83 m_xDialog->response(RET_OK);
84}
85
86IMPL_LINK_NOARG( SbiInputDialog, Cancel, weld::Button&, void )
87{
88 m_xDialog->response(RET_CANCEL);
89}
90
92 : nExpandOnWriteTo(0)
93 , nLine(0)
94 , nLen(0)
95 , nMode(SbiStreamFlags::NONE)
96 , nError(0)
97{
98}
99
101{
102}
103
104// map an SvStream-error to StarBASIC-code
105
107{
108 if( !pStrm )
109 return;
110
111 ErrCode nEC = pStrm->GetError();
112 if (nEC == ERRCODE_NONE)
114 else if (nEC == SVSTREAM_FILE_NOT_FOUND)
116 else if (nEC ==SVSTREAM_PATH_NOT_FOUND)
118 else if (nEC ==SVSTREAM_TOO_MANY_OPEN_FILES)
120 else if (nEC ==SVSTREAM_ACCESS_DENIED)
122 else if (nEC ==SVSTREAM_INVALID_PARAMETER)
124 else if (nEC ==SVSTREAM_OUTOFMEMORY)
126 else
128}
129
130// Returns sal_True if UNO is available, otherwise the old file
131// system implementation has to be used
132// #89378 New semantic: Don't just ask for UNO but for UCB
133bool hasUno()
134{
135 static const bool bRetVal = [] {
137 if( !xContext.is() )
138 {
139 // No service manager at all
140 return false;
141 }
142 else
143 {
144 Reference< XUniversalContentBroker > xManager = UniversalContentBroker::create(xContext);
145
146 if ( !( xManager->queryContentProvider( "file:///" ).is() ) )
147 {
148 // No UCB
149 return false;
150 }
151 }
152 return true;
153 }();
154 return bRetVal;
155}
156
157namespace {
158
159class OslStream : public SvStream
160{
161 osl::File maFile;
162
163public:
164 OslStream( const OUString& rName, StreamMode nStrmMode );
165 virtual ~OslStream() override;
166 virtual std::size_t GetData(void* pData, std::size_t nSize) override;
167 virtual std::size_t PutData(const void* pData, std::size_t nSize) override;
168 virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
169 virtual void FlushData() override;
170 virtual void SetSize( sal_uInt64 nSize) override;
171};
172
173}
174
175OslStream::OslStream( const OUString& rName, StreamMode nStrmMode )
176 : maFile( rName )
177{
178 sal_uInt32 nFlags;
179
180 if( (nStrmMode & (StreamMode::READ | StreamMode::WRITE)) == (StreamMode::READ | StreamMode::WRITE) )
181 {
182 nFlags = osl_File_OpenFlag_Read | osl_File_OpenFlag_Write;
183 }
184 else if( nStrmMode & StreamMode::WRITE )
185 {
186 nFlags = osl_File_OpenFlag_Write;
187 }
188 else //if( nStrmMode & StreamMode::READ )
189 {
190 nFlags = osl_File_OpenFlag_Read;
191 }
192
193 osl::FileBase::RC nRet = maFile.open( nFlags );
194 if( nRet == osl::FileBase::E_NOENT && nFlags != osl_File_OpenFlag_Read )
195 {
196 nFlags |= osl_File_OpenFlag_Create;
197 nRet = maFile.open( nFlags );
198 }
199
200 if( nRet != osl::FileBase::E_None )
201 {
202 SetError( ERRCODE_IO_GENERAL );
203 }
204}
205
206
207OslStream::~OslStream()
208{
209 maFile.close();
210}
211
212std::size_t OslStream::GetData(void* pData, std::size_t nSize)
213{
214 sal_uInt64 nBytesRead = nSize;
215 maFile.read( pData, nBytesRead, nBytesRead );
216 return nBytesRead;
217}
218
219std::size_t OslStream::PutData(const void* pData, std::size_t nSize)
220{
221 sal_uInt64 nBytesWritten;
222 maFile.write( pData, nSize, nBytesWritten );
223 return nBytesWritten;
224}
225
226sal_uInt64 OslStream::SeekPos( sal_uInt64 nPos )
227{
228 ::osl::FileBase::RC rc = ::osl::FileBase::E_None;
229 // check if a truncated STREAM_SEEK_TO_END was passed
230 assert(nPos != SAL_MAX_UINT32);
231 if( nPos == STREAM_SEEK_TO_END )
232 {
233 rc = maFile.setPos( osl_Pos_End, 0 );
234 }
235 else
236 {
237 rc = maFile.setPos( osl_Pos_Absolut, nPos );
238 }
239 OSL_VERIFY(rc == ::osl::FileBase::E_None);
240 sal_uInt64 nRealPos(0);
241 rc = maFile.getPos( nRealPos );
242 OSL_VERIFY(rc == ::osl::FileBase::E_None);
243 return nRealPos;
244}
245
246void OslStream::FlushData()
247{
248}
249
250void OslStream::SetSize( sal_uInt64 nSize )
251{
252 maFile.setSize( nSize );
253}
254
255namespace {
256
257class UCBStream : public SvStream
258{
262public:
263 explicit UCBStream( Reference< XInputStream > const & xIS );
264 explicit UCBStream( Reference< XStream > const & xS );
265 virtual ~UCBStream() override;
266 virtual std::size_t GetData( void* pData, std::size_t nSize ) override;
267 virtual std::size_t PutData( const void* pData, std::size_t nSize ) override;
268 virtual sal_uInt64 SeekPos( sal_uInt64 nPos ) override;
269 virtual void FlushData() override;
270 virtual void SetSize( sal_uInt64 nSize ) override;
271};
272
273}
274
275UCBStream::UCBStream( Reference< XInputStream > const & rStm )
276 : xIS( rStm )
277 , xSeek( rStm, UNO_QUERY )
278{
279}
280
281UCBStream::UCBStream( Reference< XStream > const & rStm )
282 : xS( rStm )
283 , xSeek( rStm, UNO_QUERY )
284{
285}
286
287
288UCBStream::~UCBStream()
289{
290 try
291 {
292 if( xIS.is() )
293 {
294 xIS->closeInput();
295 }
296 else if( xS.is() )
297 {
298 Reference< XInputStream > xIS_ = xS->getInputStream();
299 if( xIS_.is() )
300 {
301 xIS_->closeInput();
302 }
303 }
304 }
305 catch(const Exception & )
306 {
307 SetError( ERRCODE_IO_GENERAL );
308 }
309}
310
311std::size_t UCBStream::GetData(void* pData, std::size_t nSize)
312{
313 try
314 {
316 if( xIS.is() )
317 {
319 nSize = xIS->readBytes( aData, nSize );
320 memcpy( pData, aData.getConstArray(), nSize );
321 return nSize;
322 }
323 else if( xS.is() && (xISFromS = xS->getInputStream()).is() )
324 {
326 nSize = xISFromS->readBytes( aData, nSize );
327 memcpy(pData, aData.getConstArray(), nSize );
328 return nSize;
329 }
330 else
331 {
332 SetError( ERRCODE_IO_GENERAL );
333 }
334 }
335 catch(const Exception & )
336 {
337 SetError( ERRCODE_IO_GENERAL );
338 }
339 return 0;
340}
341
342std::size_t UCBStream::PutData(const void* pData, std::size_t nSize)
343{
344 try
345 {
347 if( xS.is() && (xOSFromS = xS->getOutputStream()).is() )
348 {
349 Sequence<sal_Int8> aData( static_cast<const sal_Int8 *>(pData), nSize );
350 xOSFromS->writeBytes( aData );
351 return nSize;
352 }
353 else
354 {
355 SetError( ERRCODE_IO_GENERAL );
356 }
357 }
358 catch(const Exception & )
359 {
360 SetError( ERRCODE_IO_GENERAL );
361 }
362 return 0;
363}
364
365sal_uInt64 UCBStream::SeekPos( sal_uInt64 nPos )
366{
367 try
368 {
369 if( xSeek.is() )
370 {
371 sal_uInt64 nLen = static_cast<sal_uInt64>( xSeek->getLength() );
372 if( nPos > nLen )
373 {
374 nPos = nLen;
375 }
376 xSeek->seek( nPos );
377 return nPos;
378 }
379 else
380 {
381 SetError( ERRCODE_IO_GENERAL );
382 }
383 }
384 catch(const Exception & )
385 {
386 SetError( ERRCODE_IO_GENERAL );
387 }
388 return 0;
389}
390
391void UCBStream::FlushData()
392{
393 try
394 {
396 if( xS.is() && (xOSFromS = xS->getOutputStream()).is() )
397 {
398 xOSFromS->flush();
399 }
400 else
401 {
402 SetError( ERRCODE_IO_GENERAL );
403 }
404 }
405 catch(const Exception & )
406 {
407 SetError( ERRCODE_IO_GENERAL );
408 }
409}
410
411void UCBStream::SetSize( sal_uInt64 )
412{
413 SAL_WARN("basic", "UCBStream::SetSize not allowed to call from basic" );
414 SetError( ERRCODE_IO_GENERAL );
415}
416
417
419( std::string_view rName, StreamMode nStrmMode, SbiStreamFlags nFlags, short nL )
420{
421 nMode = nFlags;
422 nLen = nL;
423 nLine = 0;
425 if( ( nStrmMode & ( StreamMode::READ|StreamMode::WRITE ) ) == StreamMode::READ )
426 {
427 nStrmMode |= StreamMode::NOCREATE;
428 }
429 OUString aStr(OStringToOUString(rName, osl_getThreadTextEncoding()));
430 OUString aNameStr = getFullPath( aStr );
431
432 if( hasUno() )
433 {
435 try
436 {
437
438 // #??? For write access delete file if it already exists (not for appending)
439 if( (nStrmMode & StreamMode::WRITE) && !IsAppend() && !IsBinary() && !IsRandom() &&
440 xSFI->exists( aNameStr ) && !xSFI->isFolder( aNameStr ) )
441 {
442 xSFI->kill( aNameStr );
443 }
444
445 if( (nStrmMode & (StreamMode::READ | StreamMode::WRITE)) == (StreamMode::READ | StreamMode::WRITE) )
446 {
447 Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
448 pStrm.reset( new UCBStream( xIS ) );
449 }
450 else if( nStrmMode & StreamMode::WRITE )
451 {
452 Reference< XStream > xIS = xSFI->openFileReadWrite( aNameStr );
453 pStrm.reset( new UCBStream( xIS ) );
454 }
455 else //if( nStrmMode & StreamMode::READ )
456 {
457 Reference< XInputStream > xIS = xSFI->openFileRead( aNameStr );
458 pStrm.reset( new UCBStream( xIS ) );
459 }
460
461 }
462 catch(const Exception & )
463 {
465 }
466 }
467
468 if( !pStrm )
469 {
470 pStrm.reset( new OslStream( aNameStr, nStrmMode ) );
471 }
472 if( IsAppend() )
473 {
474 pStrm->Seek( STREAM_SEEK_TO_END );
475 }
476 MapError();
477 if( nError )
478 {
479 pStrm.reset();
480 }
481 return nError;
482}
483
485{
486 if( pStrm )
487 {
488 MapError();
489 pStrm.reset();
490 }
491 return nError;
492}
493
494ErrCode SbiStream::Read(OString& rBuf, sal_uInt16 n, bool bForceReadingPerByte)
495{
497 if( !bForceReadingPerByte && IsText() )
498 {
499 pStrm->ReadLine(rBuf);
500 nLine++;
501 }
502 else
503 {
504 if( !n )
505 {
506 n = nLen;
507 }
508 if( !n )
509 {
511 }
512 OStringBuffer aBuffer(read_uInt8s_ToOString(*pStrm, n));
513 //Pad it out with ' ' to the requested length on short read
514 sal_Int32 nRequested = sal::static_int_cast<sal_Int32>(n);
516 rBuf = aBuffer.makeStringAndClear();
517 }
518 MapError();
519 if( !nError && pStrm->eof() )
520 {
522 }
523 return nError;
524}
525
526ErrCode const & SbiStream::Read( char& ch )
527{
529 if (aLine.isEmpty())
530 {
531 Read( aLine );
532 aLine += "\n";
533 }
534 ch = aLine[0];
535 aLine = aLine.copy(1);
536 return nError;
537}
538
540{
541 if ( !nExpandOnWriteTo )
542 return;
543
544 sal_uInt64 nCur = pStrm->Seek(STREAM_SEEK_TO_END);
545 if( nCur < nExpandOnWriteTo )
546 {
547 sal_uInt64 nDiff = nExpandOnWriteTo - nCur;
548 while( nDiff-- )
549 {
550 pStrm->WriteChar( 0 );
551 }
552 }
553 else
554 {
555 pStrm->Seek( nExpandOnWriteTo );
556 }
558}
559
560namespace
561{
562 void WriteLines(SvStream &rStream, const OString& rStr)
563 {
564 OString aStr(convertLineEnd(rStr, rStream.GetLineDelimiter()) );
565 write_uInt8s_FromOString(rStream, aStr);
566 endl( rStream );
567 }
568}
569
570ErrCode SbiStream::Write( const OString& rBuf )
571{
572 ExpandFile();
573 if( IsAppend() )
574 {
575 pStrm->Seek( STREAM_SEEK_TO_END );
576 }
577 if( IsText() )
578 {
579 aLine += rBuf;
580 // Get it out, if the end is an LF, but strip CRLF before,
581 // because the SvStream adds a CRLF!
582 sal_Int32 nLineLen = aLine.getLength();
583 if (nLineLen && aLine[--nLineLen] == 0x0A)
584 {
585 aLine = aLine.copy(0, nLineLen);
586 if (nLineLen && aLine[--nLineLen] == 0x0D)
587 {
588 aLine = aLine.copy(0, nLineLen);
589 }
590 WriteLines(*pStrm, aLine);
591 aLine.clear();
592 }
593 }
594 else
595 {
596 if( !nLen )
597 {
599 }
600 pStrm->WriteBytes(rBuf.getStr(), nLen);
601 MapError();
602 }
603 return nError;
604}
605
606
608{
609 for(SbiStream* & i : pChan)
610 {
611 i = nullptr;
612 }
613 nChan = 0;
615}
616
617SbiIoSystem::~SbiIoSystem() COVERITY_NOEXCEPT_FALSE
618{
619 Shutdown();
620}
621
623{
624 ErrCode n = nError;
626 return n;
627}
628
629void SbiIoSystem::Open(short nCh, std::string_view rName, StreamMode nMode, SbiStreamFlags nFlags, short nLen)
630{
632 if( nCh >= CHANNELS || !nCh )
633 {
635 }
636 else if( pChan[ nCh ] )
637 {
639 }
640 else
641 {
642 pChan[ nCh ] = new SbiStream;
643 nError = pChan[ nCh ]->Open( rName, nMode, nFlags, nLen );
644 if( nError )
645 {
646 delete pChan[ nCh ];
647 pChan[ nCh ] = nullptr;
648 }
649 }
650 nChan = 0;
651}
652
653
655{
656 if( !nChan )
657 {
659 }
660 else if( !pChan[ nChan ] )
661 {
663 }
664 else
665 {
666 nError = pChan[ nChan ]->Close();
667 delete pChan[ nChan ];
668 pChan[ nChan ] = nullptr;
669 }
670 nChan = 0;
671}
672
673
675{
676 for( short i = 1; i < CHANNELS; i++ )
677 {
678 if( pChan[ i ] )
679 {
680 ErrCode n = pChan[ i ]->Close();
681 delete pChan[ i ];
682 pChan[ i ] = nullptr;
683 if( n && !nError )
684 {
685 nError = n;
686 }
687 }
688 }
689 nChan = 0;
690 // anything left to PRINT?
691 if( !aOut.isEmpty() )
692 {
693 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(Application::GetDefDialogParent(), VclMessageType::Warning,
694 VclButtonsType::Ok, aOut));
695 xBox->run();
696 }
697 aOut.clear();
698}
699
700
701void SbiIoSystem::Read(OString& rBuf)
702{
703 if( !nChan )
704 {
705 ReadCon( rBuf );
706 }
707 else if( !pChan[ nChan ] )
708 {
710 }
711 else
712 {
713 nError = pChan[ nChan ]->Read( rBuf );
714 }
715}
716
718{
719 char ch = ' ';
720 if( !nChan )
721 {
722 if( aIn.isEmpty() )
723 {
724 ReadCon( aIn );
725 aIn += "\n";
726 }
727 ch = aIn[0];
728 aIn = aIn.copy(1);
729 }
730 else if( !pChan[ nChan ] )
731 {
733 }
734 else
735 {
736 nError = pChan[ nChan ]->Read( ch );
737 }
738 return ch;
739}
740
741void SbiIoSystem::Write(std::u16string_view rBuf)
742{
743 if( !nChan )
744 {
745 WriteCon( rBuf );
746 }
747 else if( !pChan[ nChan ] )
748 {
750 }
751 else
752 {
753 nError = pChan[ nChan ]->Write( OUStringToOString(rBuf, osl_getThreadTextEncoding()) );
754 }
755}
756
757// nChannel == 0..CHANNELS-1
758
759SbiStream* SbiIoSystem::GetStream( short nChannel ) const
760{
761 SbiStream* pRet = nullptr;
762 if( nChannel >= 0 && nChannel < CHANNELS )
763 {
764 pRet = pChan[ nChannel ];
765 }
766 return pRet;
767}
768
770{
771 for( short i = 1; i < CHANNELS; i++ )
772 {
773 if( pChan[ i ] )
774 {
775 ErrCode n = pChan[ i ]->Close();
776 delete pChan[ i ];
777 pChan[ i ] = nullptr;
778 if( n && !nError )
779 {
780 nError = n;
781 }
782 }
783 }
784}
785
786void SbiIoSystem::ReadCon(OString& rIn)
787{
788 OUString aPromptStr(OStringToOUString(aPrompt, osl_getThreadTextEncoding()));
789 SbiInputDialog aDlg(nullptr, aPromptStr);
790 if (aDlg.run() == RET_OK)
791 {
792 rIn = OUStringToOString(aDlg.GetInput(), osl_getThreadTextEncoding());
793 }
794 else
795 {
797 }
798 aPrompt.clear();
799}
800
801// output of a MessageBox, if there's a CR in the console-buffer
802
803void SbiIoSystem::WriteCon(std::u16string_view rText)
804{
805 aOut += rText;
806 sal_Int32 n1 = aOut.indexOf('\n');
807 sal_Int32 n2 = aOut.indexOf('\r');
808 if( n1 == -1 && n2 == -1 )
809 return;
810
811 if( n1 == -1 )
812 {
813 n1 = n2;
814 }
815 else if( n2 == -1 )
816 {
817 n2 = n1;
818 }
819 if( n1 > n2 )
820 {
821 n1 = n2;
822 }
823 OUString s(aOut.copy(0, n1));
824 aOut = aOut.copy(n1);
825 while ( !aOut.isEmpty() && (aOut[0] == '\n' || aOut[0] == '\r') )
826 {
827 aOut = aOut.copy(1);
828 }
829 {
830 SolarMutexGuard aSolarGuard;
831
832 std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(Application::GetDefDialogParent(), VclMessageType::Warning,
833 VclButtonsType::OkCancel, s));
834 xBox->set_default_response(RET_OK);
835 if (!xBox->run())
836 {
838 }
839 }
840}
841
842/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
Reference< XExecutableDialog > m_xDialog
static weld::MessageDialog * CreateMessageDialog(weld::Widget *pParent, VclMessageType eMessageType, VclButtonsType eButtonType, const OUString &rPrimaryMessage, const ILibreOfficeKitNotifier *pNotifier=nullptr)
static weld::Window * GetDefDialogParent()
~SbiIoSystem() COVERITY_NOEXCEPT_FALSE
Definition: iosys.cxx:617
void Write(std::u16string_view)
Definition: iosys.cxx:741
char Read()
Definition: iosys.cxx:717
ErrCode nError
Definition: iosys.hxx:89
OString aIn
Definition: iosys.hxx:86
SbiIoSystem()
Definition: iosys.cxx:607
SbiStream * GetStream(short nChannel) const
Definition: iosys.cxx:759
short nChan
Definition: iosys.hxx:88
OUString aOut
Definition: iosys.hxx:87
void WriteCon(std::u16string_view)
Definition: iosys.cxx:803
ErrCode GetError()
Definition: iosys.cxx:622
void Shutdown()
Definition: iosys.cxx:674
void Open(short, std::string_view, StreamMode, SbiStreamFlags, short)
Definition: iosys.cxx:629
void CloseAll()
Definition: iosys.cxx:769
void Close()
Definition: iosys.cxx:654
SbiStream * pChan[CHANNELS]
Definition: iosys.hxx:84
OString aPrompt
Definition: iosys.hxx:85
void ReadCon(OString &)
Definition: iosys.cxx:786
~SbiStream()
Definition: iosys.cxx:100
sal_uInt64 nExpandOnWriteTo
Definition: iosys.hxx:52
bool IsRandom() const
Definition: iosys.hxx:70
bool IsText() const
Definition: iosys.hxx:69
short nLen
Definition: iosys.hxx:55
bool IsAppend() const
Definition: iosys.hxx:73
SbiStreamFlags nMode
Definition: iosys.hxx:56
ErrCode const & Close()
Definition: iosys.cxx:484
OString aLine
Definition: iosys.hxx:53
ErrCode nError
Definition: iosys.hxx:57
SbiStream()
Definition: iosys.cxx:91
ErrCode const & Open(std::string_view, StreamMode, SbiStreamFlags, short)
Definition: iosys.cxx:419
bool IsBinary() const
Definition: iosys.hxx:71
void MapError()
Definition: iosys.cxx:106
void ExpandFile()
Definition: iosys.cxx:539
sal_uInt64 nLine
Definition: iosys.hxx:54
ErrCode Read(OString &, sal_uInt16=0, bool bForceReadingPerByte=false)
Definition: iosys.cxx:494
ErrCode Write(const OString &)
Definition: iosys.cxx:570
std::unique_ptr< SvStream > pStrm
Definition: iosys.hxx:51
virtual sal_uInt64 SeekPos(sal_uInt64 nPos)
virtual void SetSize(sal_uInt64 nSize)
LineEnd GetLineDelimiter() const
virtual std::size_t GetData(void *pData, std::size_t nSize)
virtual std::size_t PutData(const void *pData, std::size_t nSize)
virtual void FlushData()
DECL_LINK(CheckNameHdl, SvxNameDialog &, bool)
#define SVSTREAM_TOO_MANY_OPEN_FILES
#define SVSTREAM_OUTOFMEMORY
#define SVSTREAM_ACCESS_DENIED
#define SVSTREAM_INVALID_PARAMETER
#define SVSTREAM_PATH_NOT_FOUND
#define ERRCODE_IO_GENERAL
#define ERRCODE_NONE
#define SVSTREAM_FILE_NOT_FOUND
bool hasUno()
Definition: iosys.cxx:133
IMPL_LINK_NOARG(SbiInputDialog, Ok, weld::Button &, void)
Definition: iosys.cxx:80
SbiStreamFlags
Definition: iosys.hxx:36
#define CHANNELS
Definition: iosys.hxx:33
sal_Int64 n
TOOLS_DLLPUBLIC OString convertLineEnd(const OString &rIn, LineEnd eLineEnd)
sal_uInt16 nPos
#define SAL_WARN(area, stream)
aStr
int n2
int n1
constexpr OUStringLiteral aData
NONE
@ Exception
OStringBuffer & padToLength(OStringBuffer &rBuffer, sal_Int32 nLength, char cFill='\0')
Reference< XComponentContext > getProcessComponentContext()
int i
OString OUStringToOString(std::u16string_view str, ConnectionSettings const *settings)
Reference< XInputStream > m_xInput
OUString getFullPath(const OUString &aRelPath)
#define ERRCODE_BASIC_USER_ABORT
Definition: sberrors.hxx:61
#define ERRCODE_BASIC_TOO_MANY_FILES
Definition: sberrors.hxx:76
#define ERRCODE_BASIC_ACCESS_DENIED
Definition: sberrors.hxx:78
#define ERRCODE_BASIC_FILE_NOT_FOUND
Definition: sberrors.hxx:67
#define ERRCODE_BASIC_PATH_NOT_FOUND
Definition: sberrors.hxx:83
#define ERRCODE_BASIC_NO_MEMORY
Definition: sberrors.hxx:57
#define ERRCODE_BASIC_BAD_ARGUMENT
Definition: sberrors.hxx:26
#define ERRCODE_BASIC_READ_PAST_EOF
Definition: sberrors.hxx:74
#define ERRCODE_BASIC_FILE_ALREADY_OPEN
Definition: sberrors.hxx:69
#define ERRCODE_BASIC_IO_ERROR
Definition: sberrors.hxx:70
#define ERRCODE_BASIC_BAD_RECORD_LENGTH
Definition: sberrors.hxx:72
#define ERRCODE_BASIC_BAD_CHANNEL
Definition: sberrors.hxx:66
TOOLS_DLLPUBLIC OString read_uInt8s_ToOString(SvStream &rStrm, std::size_t nUnits)
#define STREAM_SEEK_TO_END
StreamMode
std::size_t write_uInt8s_FromOString(SvStream &rStrm, std::string_view rStr, std::size_t nUnits)
TOOLS_DLLPUBLIC SvStream & endl(SvStream &rStr)
signed char sal_Int8
RET_OK
RET_CANCEL
std::unique_ptr< char[]> aBuffer
int SetError()