1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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/.
9 * This file incorporates work covered by the following license notice:
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 .
21 #include <sal/config.h>
26 #include <com/sun/star/embed/XStorage.hpp>
27 #include <com/sun/star/embed/XTransactionListener.hpp>
28 #include <com/sun/star/io/XStream.hpp>
29 #include <com/sun/star/io/XOutputStream.hpp>
30 #include <com/sun/star/io/XInputStream.hpp>
31 #include <com/sun/star/io/XSeekable.hpp>
34 #pragma clang diagnostic push
35 #pragma clang diagnostic ignored "-Wunknown-attributes"
39 #pragma clang diagnostic pop
42 #include <uno/environment.hxx>
44 namespace connectivity::hsqldb
48 css::uno::Reference
< css::io::XStream
> m_xStream
;
49 css::uno::Reference
< css::io::XSeekable
> m_xSeek
;
50 css::uno::Reference
< css::io::XOutputStream
> m_xOutputStream
;
51 css::uno::Reference
< css::io::XInputStream
> m_xInputStream
;
53 StreamHelper(const css::uno::Reference
< css::io::XStream
>& _xStream
);
56 css::uno::Reference
< css::io::XInputStream
> const & getInputStream();
57 css::uno::Reference
< css::io::XOutputStream
> const & getOutputStream();
58 css::uno::Reference
< css::io::XSeekable
> const & getSeek();
62 typedef std::map
< OUString
, std::shared_ptr
<StreamHelper
> > TStreamMap
;
65 css::uno::Reference
<css::embed::XStorage
> storage
;
66 css::uno::Environment storageEnvironment
;
70 css::uno::Reference
<css::embed::XStorage
> mapStorage() const;
73 typedef std::map
<OUString
, StorageData
> TStorages
;
74 /** contains all storages so far accessed.
76 class StorageContainer
79 static OUString
registerStorage(const css::uno::Reference
< css::embed::XStorage
>& _xStorage
,const OUString
& _sURL
);
80 static TStorages::mapped_type
getRegisteredStorage(const OUString
& _sKey
);
81 static OUString
getRegisteredKey(const css::uno::Reference
< css::embed::XStorage
>& _xStorage
);
82 static void revokeStorage(const OUString
& _sKey
,const css::uno::Reference
< css::embed::XTransactionListener
>& _xListener
);
84 static TStreamMap::mapped_type
registerStream(JNIEnv
* env
,jstring name
, jstring key
,sal_Int32 _nMode
);
85 static void revokeStream(JNIEnv
* env
,jstring name
, jstring key
);
86 static TStreamMap::mapped_type
getRegisteredStream( JNIEnv
* env
, jstring name
, jstring key
);
88 static OUString
jstring2ustring(JNIEnv
* env
, jstring jstr
);
89 static OUString
removeURLPrefix(std::u16string_view _sURL
, std::u16string_view _sFileURL
);
90 static OUString
removeOldURLPrefix(const OUString
& _sURL
);
91 static void throwJavaException(const css::uno::Exception
& _aException
,JNIEnv
* env
);
94 } // namespace connectivity::hsqldb
97 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */