Avoid potential negative array index access to cached text.
[LibreOffice.git] / writerperfect / inc / DirectoryStream.hxx
blobc45209333bf513d4257a9d63b5f9fa31353a1188
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 */
10 #pragma once
12 #include <librevenge-stream/librevenge-stream.h>
13 #include <com/sun/star/uno/Reference.h>
14 #include "writerperfectdllapi.h"
15 #include <tools/long.hxx>
16 #include <memory>
18 namespace com::sun::star::ucb
20 class XContent;
23 namespace writerperfect
25 class WRITERPERFECT_DLLPUBLIC DirectoryStream final : public librevenge::RVNGInputStream
27 struct Impl;
29 public:
30 explicit DirectoryStream(const css::uno::Reference<css::ucb::XContent>& xContent);
31 virtual ~DirectoryStream() override;
33 static bool isDirectory(const css::uno::Reference<css::ucb::XContent>& xContent);
34 static std::unique_ptr<DirectoryStream>
35 createForParent(const css::uno::Reference<css::ucb::XContent>& xContent);
37 css::uno::Reference<css::ucb::XContent> getContent() const;
39 virtual bool isStructured() override;
40 SAL_DLLPRIVATE virtual unsigned subStreamCount() override;
41 SAL_DLLPRIVATE virtual const char* subStreamName(unsigned id) override;
42 SAL_DLLPRIVATE virtual bool existsSubStream(const char* name) override;
43 SAL_DLLPRIVATE virtual librevenge::RVNGInputStream*
44 getSubStreamByName(const char* name) override;
45 SAL_DLLPRIVATE virtual librevenge::RVNGInputStream* getSubStreamById(unsigned id) override;
47 virtual const unsigned char* read(unsigned long numBytes, unsigned long& numBytesRead) override;
48 virtual int seek(long offset, librevenge::RVNG_SEEK_TYPE seekType) override;
49 virtual long tell() override;
50 virtual bool isEnd() override;
52 private:
53 std::unique_ptr<Impl> m_pImpl;
57 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */