Line data Source code
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 : #ifndef INCLUDED_JVMFWK_SOURCE_FWKUTIL_HXX
20 : #define INCLUDED_JVMFWK_SOURCE_FWKUTIL_HXX
21 :
22 : #include <config_features.h>
23 : #include <config_folders.h>
24 :
25 : #include "sal/config.h"
26 : #include "osl/mutex.hxx"
27 : #include "rtl/bootstrap.hxx"
28 : #include "rtl/instance.hxx"
29 : #include "rtl/ustrbuf.hxx"
30 : #include "rtl/byteseq.hxx"
31 : #include "osl/thread.hxx"
32 :
33 : namespace jfw
34 : {
35 :
36 : /** Returns the file URL of the directory where the framework library
37 : (this library) resides.
38 : */
39 : OUString getLibraryLocation();
40 :
41 : /** provides a bootstrap class which already knows the values from the
42 : jvmfkwrc file.
43 : */
44 : struct Bootstrap :
45 : public ::rtl::StaticWithInit< const rtl::Bootstrap *, Bootstrap > {
46 77 : const rtl::Bootstrap * operator () () {
47 77 : OUStringBuffer buf(256);
48 77 : buf.append(getLibraryLocation());
49 : #ifdef MACOSX
50 : // For some reason the jvmfwk3rc file is traditionally in
51 : // LIBO_URE_ETC_FOLDER
52 : buf.appendAscii( "/../" LIBO_URE_ETC_FOLDER );
53 : #endif
54 77 : buf.appendAscii(SAL_CONFIGFILE("/jvmfwk3"));
55 154 : OUString sIni = buf.makeStringAndClear();
56 77 : ::rtl::Bootstrap * bootstrap = new ::rtl::Bootstrap(sIni);
57 : SAL_INFO("jfw.level2", "Using configuration file " << sIni);
58 154 : return bootstrap;
59 : }
60 : };
61 :
62 : struct FwkMutex: public ::rtl::Static<osl::Mutex, FwkMutex> {};
63 :
64 : rtl::ByteSequence encodeBase16(const rtl::ByteSequence& rawData);
65 : rtl::ByteSequence decodeBase16(const rtl::ByteSequence& data);
66 :
67 : OUString getPlatform();
68 :
69 :
70 : OUString getDirFromFile(const OUString& usFilePath);
71 :
72 : enum FileStatus
73 : {
74 : FILE_OK,
75 : FILE_DOES_NOT_EXIST,
76 : FILE_INVALID
77 : };
78 :
79 : /** checks if the URL is a file.
80 :
81 : If it is a link to a file than
82 : it is resolved. Assuming that the argument
83 : represents a relative URL then FILE_INVALID
84 : is returned.
85 :
86 :
87 : @return
88 : one of the values of FileStatus.
89 :
90 : @exception
91 : Errors occurred during determining if the file exists
92 : */
93 : FileStatus checkFileURL(const OUString & path);
94 :
95 : bool isAccessibilitySupportDesired();
96 :
97 : OUString retrieveClassPath( OUString const & macro );
98 : }
99 : #endif
100 :
101 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|