/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * * This file incorporates work covered by the following license notice: * * Licensed to the Apache Software Foundation (ASF) under one or more * contributor license agreements. See the NOTICE file distributed * with this work for additional information regarding copyright * ownership. The ASF licenses this file to you under the Apache * License, Version 2.0 (the "License"); you may not use this file * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ #ifndef INCLUDED_COMPHELPER_SEQSTREAM_HXX #define INCLUDED_COMPHELPER_SEQSTREAM_HXX #include #include #include #include #include #include #include #include #include #include namespace comphelper { // SequenceInputStream // stream for reading data from a sequence of bytes class COMPHELPER_DLLPUBLIC SequenceInputStream final : public ::cppu::WeakImplHelper< css::io::XInputStream, css::io::XSeekable >, public comphelper::ByteReader { std::mutex m_aMutex; css::uno::Sequence const m_aData; sal_Int32 m_nPos; public: SequenceInputStream(css::uno::Sequence const & rData); // css::io::XInputStream virtual sal_Int32 SAL_CALL readBytes( css::uno::Sequence& aData, sal_Int32 nBytesToRead ) override; virtual sal_Int32 SAL_CALL readSomeBytes( css::uno::Sequence& aData, sal_Int32 nMaxBytesToRead ) override; virtual void SAL_CALL skipBytes( sal_Int32 nBytesToSkip ) override; virtual sal_Int32 SAL_CALL available( ) override; virtual void SAL_CALL closeInput( ) override; virtual void SAL_CALL seek( sal_Int64 location ) override; virtual sal_Int64 SAL_CALL getPosition( ) override; virtual sal_Int64 SAL_CALL getLength( ) override; // comphelper::ByteReader virtual sal_Int32 readSomeBytes( sal_Int8* pData, sal_Int32 nBytesToRead ) override; private: sal_Int32 avail(); }; // don't export to avoid duplicate WeakImplHelper definitions with MSVC class SAL_DLLPUBLIC_TEMPLATE OSequenceOutputStream_Base : public ::cppu::WeakImplHelper< css::io::XOutputStream > {}; class UNLESS_MERGELIBS(COMPHELPER_DLLPUBLIC) OSequenceOutputStream final : public OSequenceOutputStream_Base { private: css::uno::Sequence< sal_Int8 >& m_rSequence; double m_nResizeFactor; sal_Int32 const m_nMinimumResize; sal_Int32 m_nSize; // the size of the virtual stream. This is not the size of the sequence, but the number of bytes written // into the stream at a given moment. bool m_bConnected; // closeOutput has been called ? std::mutex m_aMutex; void finalizeOutput(); virtual ~OSequenceOutputStream() override { if (m_bConnected) finalizeOutput(); } public: /** constructs the object. Everything written into the stream through the XOutputStream methods will be forwarded to the sequence, reallocating it if necessary. Writing will start at offset 0 within the sequence. @param _rSeq a reference to the sequence which will be used for output. The caller is responsible for taking care of the lifetime of the stream object and the sequence. If you're in doubt about this, use closeOutput before destroying the sequence @param _nResizeFactor the factor which is used for resizing the sequence when necessary. In every resize step, the new sequence size will be calculated by multiplying the current size with this factor, rounded off to the next multiple of 4. @param _nMinimumResize the minimal number of bytes which is additionally allocated on resizing @see closeOutput */ OSequenceOutputStream( css::uno::Sequence< sal_Int8 >& _rSeq, double _nResizeFactor = 1.3, sal_Int32 _nMinimumResize = 128 ); /// same as XOutputStream::writeBytes (as expected :) virtual void SAL_CALL writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) override; /// this is a dummy in this implementation, no buffering is used virtual void SAL_CALL flush( ) override; /** closes the output stream. In the case of this class, this means that the sequence used for writing is resized to the really used size and not used any further, every subsequent call to one of the XOutputStream methods will throw a NotConnectedException. */ virtual void SAL_CALL closeOutput( ) override; }; } // namespace comphelper #endif // INCLUDED_COMPHELPER_SEQSTREAM_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ n> LibreOffice 核心代码仓库文档基金会
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2016-04-13loplugin:passstuffbyref in sfx2Noel Grandin
Change-Id: I8c9d6e972f74ee04c8befda3b4cabb6e9b6b2054
2016-04-06Avoid reserved identifierStephan Bergmann
Change-Id: Ica4dc147a49525f0ec65241c2a9f1d3eb75b7285
2016-02-17use consistent #define checks for the Windows platformNoel Grandin
stage 2 of replacing usage of various checks for the windows platform with the compiler-defined '_WIN32' macro In this stage we focus on replacing usage of the WIN macro Change-Id: Ie8a4a63198a6de96bd158ecd707dadafb9c8ea84 Reviewed-on: https://gerrit.libreoffice.org/22393 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2016-01-13loplugin:unusedmethods unused return value in include/sfx2Noel Grandin
Change-Id: Id4017bdfe18f8224d28a9f787865c7a880aeeed8
2015-11-18use unique_ptr for pImpl in sfx2/Noel Grandin
Change-Id: I564fa80a2642a4849127f3c25236634289b5b93d
2015-11-115th step to remove tools/rtti.hxxOliver Specht
tools/rtti.hxx removed completed the interface of some Sdr.* Items and removed pseudo items Change-Id: I0cdcd01494be35b97a27d5985aa908affa96048a Reviewed-on: https://gerrit.libreoffice.org/19837 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Oliver Specht <oliver.specht@cib.de>
2015-10-27inline SvBaseLinkRef typedefNoel Grandin
Change-Id: I0684db21c260e38d1d2e32eb5924cf7e25212b4d
2015-10-23com::sun::star->css in include/linguistic to include/sfx2Noel Grandin
Change-Id: Id69e293fda98ee6cf2cc3d3296a0cd2e06bd847e Reviewed-on: https://gerrit.libreoffice.org/19527 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
2015-10-21remove untyped Link<>Noel Grandin
Change-Id: I809f9e10309ceadda0a82c3818277323b34ec61b Reviewed-on: https://gerrit.libreoffice.org/19491 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-09-16convert Link<> to typedNoel Grandin
Change-Id: I2573b42143078c4e72ab201392c69ee296f4974e
2015-09-16convert Link<> to typedNoel Grandin
Change-Id: Ic978fd8f03705c341ecb44685d840a6a240fee2d
2015-07-16loplugin:unusedmethods sfx2Noel Grandin
Change-Id: I98c455d89f76fbcacf74929a4e8775b4da697f62 Reviewed-on: https://gerrit.libreoffice.org/17069 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
2015-04-30Gradually typed LinkStephan Bergmann
Turn the Link class into a template abstracting over the link's argument and return types, but provide default template arguments that keep the generic, unsafe "void* in, sal_IntPtr out" behvior. That way, individual uses of the Link class can be updated over time. All the related macros are duplicated with ..._TYPED counterparts, that additionally take the RetType (except for LINK_TYPED, which manages to infer the relevant types from the supplied Member). (It would have been attractive to change the "untyped" LinkStubs from taking a void* to a properly typed ArgType parameter, too, but that would cause -fsanitize=function to flag uses of "untyped" Link::Call.) Change-Id: I3b0140378bad99abbf240140ebb4a46a05d2d2f8
2015-03-24convert sfxlink to enum classNoel Grandin
Change-Id: I4466af8d40e7860b20a26c5ccf2265ee40c5a9ab
2015-03-18create new 'enum class' SotClipboardFormatId to unify typesNoel Grandin
of which there are several. There are some issues here I am unsure of - the SW and SC and CHART2 modules essentially ignore the enum values and assign their own ids Perhaps I should change them to use the common values and create new enum values where necessary? - the sc/qa/ and sq/qa/ and starmath/qa/ code was doing some dodgy stuff. I translated the code to pass down the stuff numeric values to the underlying code, but perhaps further fixing is necessary? Change-Id: Ic06d723e404481e3f1bca67c43b70321b764d923
2014-12-08callcatcher: update unused codeCaolán McNamara
Change-Id: I3cd65d112339fa9c67ed462fe39acbbef91d4d8d
2014-09-23fdo#82577: Handle WindowNoel Grandin
Put the VCL Window class in the vcl namespace. Avoids clash with the X11 Window typedef. Change-Id: Ib1beb7ab4ad75562a42aeb252732a073d25eff1a
2014-06-17improve the inlinesimplememberfunctions clang pluginNoel Grandin
Change-Id: I6d5a952901648e01904ef5c37f953c517304d31e
2014-04-07Replace SV_DECL/IMPL_REF macros with SvRef templateStephan Bergmann
Change-Id: I0ef2e67f6d61e0ce118c0f5e926b8194ef9d8058
2014-03-18sfx2: sal_Bool->boolNoel Grandin
Change-Id: I01a33e255b0dd2a0045f6eed52e6b31305750599
2013-10-23fixincludeguards.sh: include/s*Thomas Arnhold
Change-Id: I57fcfd442d2b5815e7c07a9cbd660f3698168dee
2013-09-25Related: fdo#38838 remove UniString::EqualsIgnoreCaseAsciiCaolán McNamara
Change-Id: Ib5c3a2daa4a48bc286b14fa2cebb3306ea0012bc
2013-08-29convert includes/sfx2/lnkbase.hxx from String to OUStringNoel Grandin
Change-Id: I3816ec77dd334823100421dab90d4bc8b67542e3
2013-07-04module sot: String, bool and other clean-upNorbert Thiebaud
Change-Id: Ibe2bfdf20c500e9fd98c3baef66d36aa79ca4b52 Reviewed-on: https://gerrit.libreoffice.org/4710 Tested-by: LibreOffice gerrit bot <gerrit@libreoffice.org> Reviewed-by: Fridrich Strba <fridrich@documentfoundation.org> Tested-by: Fridrich Strba <fridrich@documentfoundation.org>
2013-04-23execute move of global headersBjoern Michaelsen
see https://gerrit.libreoffice.org/#/c/3367/ and Change-Id: I00c96fa77d04b33a6f8c8cd3490dfcd9bdc9e84a for details Change-Id: I199a75bc4042af20817265d5ef85b1134a96ff5a