LibreOffice Module connectivity (master) 1
HStorageMap.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#pragma once
20
21#include <sal/config.h>
22
23#include <map>
24#include <memory>
25
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>
32
33#if defined __clang__
34#pragma clang diagnostic push
35#pragma clang diagnostic ignored "-Wunknown-attributes"
36#endif
37#include <jni.h>
38#if defined __clang__
39#pragma clang diagnostic pop
40#endif
41
42#include <uno/environment.hxx>
43
45 {
47 {
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;
52 public:
53 StreamHelper(const css::uno::Reference< css::io::XStream>& _xStream);
55
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();
59 };
60
61
62 typedef std::map< OUString, std::shared_ptr<StreamHelper> > TStreamMap;
63
64 struct StorageData {
65 css::uno::Reference<css::embed::XStorage> storage;
66 css::uno::Environment storageEnvironment;
67 OUString url;
69
70 css::uno::Reference<css::embed::XStorage> mapStorage() const;
71 };
72
73 typedef std::map<OUString, StorageData> TStorages;
77 {
78 public:
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);
83
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);
87
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);
92 };
93
94} // namespace connectivity::hsqldb
95
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
contains all storages so far accessed.
Definition: HStorageMap.hxx:77
static OUString registerStorage(const css::uno::Reference< css::embed::XStorage > &_xStorage, const OUString &_sURL)
static TStreamMap::mapped_type registerStream(JNIEnv *env, jstring name, jstring key, sal_Int32 _nMode)
static void throwJavaException(const css::uno::Exception &_aException, JNIEnv *env)
static void revokeStorage(const OUString &_sKey, const css::uno::Reference< css::embed::XTransactionListener > &_xListener)
static OUString getRegisteredKey(const css::uno::Reference< css::embed::XStorage > &_xStorage)
static OUString jstring2ustring(JNIEnv *env, jstring jstr)
static OUString removeOldURLPrefix(const OUString &_sURL)
static OUString removeURLPrefix(std::u16string_view _sURL, std::u16string_view _sFileURL)
static void revokeStream(JNIEnv *env, jstring name, jstring key)
static TStreamMap::mapped_type getRegisteredStream(JNIEnv *env, jstring name, jstring key)
static TStorages::mapped_type getRegisteredStorage(const OUString &_sKey)
css::uno::Reference< css::io::XOutputStream > m_xOutputStream
Definition: HStorageMap.hxx:50
css::uno::Reference< css::io::XSeekable > const & getSeek()
Definition: HStorageMap.cxx:94
css::uno::Reference< css::io::XStream > m_xStream
Definition: HStorageMap.hxx:48
css::uno::Reference< css::io::XSeekable > m_xSeek
Definition: HStorageMap.hxx:49
css::uno::Reference< css::io::XInputStream > m_xInputStream
Definition: HStorageMap.hxx:51
css::uno::Reference< css::io::XInputStream > const & getInputStream()
Definition: HStorageMap.cxx:80
StreamHelper(const css::uno::Reference< css::io::XStream > &_xStream)
Definition: HStorageMap.cxx:40
css::uno::Reference< css::io::XOutputStream > const & getOutputStream()
Definition: HStorageMap.cxx:87
const css::uno::Reference< css::xml::crypto::XSecurityEnvironment > & env
std::map< OUString, StorageData > TStorages
Definition: HStorageMap.hxx:73
std::map< OUString, std::shared_ptr< StreamHelper > > TStreamMap
Definition: HStorageMap.hxx:62
OUString name
Definition: pq_statics.cxx:74
css::uno::Reference< css::embed::XStorage > mapStorage() const
css::uno::Reference< css::embed::XStorage > storage
Definition: HStorageMap.hxx:65
css::uno::Environment storageEnvironment
Definition: HStorageMap.hxx:66