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 .
23 #include <com/sun/star/sdbc/XResultSet.hpp>
24 #include <com/sun/star/ucb/XCommandEnvironment.hpp>
25 #include "dp_misc_api.hxx"
26 #include <ucbhelper/content.hxx>
35 struct DESKTOP_DEPLOYMENTMISC_DLLPUBLIC StrTitle
37 static css::uno::Sequence
< OUString
> getTitleSequence()
39 css::uno::Sequence
<OUString
> aSeq
{ u
"Title"_ustr
};
42 static OUString
getTitle( ::ucbhelper::Content
&rContent
)
44 return rContent
.getPropertyValue(u
"Title"_ustr
).get
<OUString
>();
46 // just return titles - the ucbhelper should have a simpler API for this [!]
47 static css::uno::Reference
< css::sdbc::XResultSet
>
48 createCursor( ::ucbhelper::Content
&rContent
,
49 ucbhelper::ResultSetInclude eInclude
)
51 return rContent
.createCursor( StrTitle::getTitleSequence(), eInclude
);
56 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool create_ucb_content(
57 ::ucbhelper::Content
* ucb_content
,
59 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
60 bool throw_exc
= true );
63 /** @return true if previously non-existing folder has been created
65 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool create_folder(
66 ::ucbhelper::Content
* ucb_content
,
68 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
69 bool throw_exc
= true );
72 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
bool erase_path(
74 css::uno::Reference
<css::ucb::XCommandEnvironment
> const & xCmdEnv
,
75 bool throw_exc
= true );
78 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
79 std::vector
<sal_Int8
> readFile( ::ucbhelper::Content
& ucb_content
);
82 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
83 bool readLine( OUString
* res
, std::u16string_view startingWith
,
84 ::ucbhelper::Content
& ucb_content
, rtl_TextEncoding textenc
);
86 DESKTOP_DEPLOYMENTMISC_DLLPUBLIC
87 bool readProperties( std::vector
< std::pair
< OUString
, OUString
> > & out_result
,
88 ::ucbhelper::Content
& ucb_content
);
94 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */