Bump version to 6.4-15
[LibreOffice.git] / include / unotools / bootstrap.hxx
blob5e16b931d707e5018d7dc44d5567f1cc598bc18a
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/.
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 .
20 #ifndef INCLUDED_UNOTOOLS_BOOTSTRAP_HXX
21 #define INCLUDED_UNOTOOLS_BOOTSTRAP_HXX
23 #include <unotools/unotoolsdllapi.h>
24 #include <rtl/ustring.hxx>
26 namespace utl
28 /** provides configuration information needed for application startup.
30 This class handles the startup information for the office application.
31 It encapsulates knowledge of how to retrieve such information and how
32 to diagnose failures to retrieve required data.
35 class UNOTOOLS_DLLPUBLIC Bootstrap
37 // the static interface
38 public: // some common information items
40 /// retrieve the product key; defaults to executable name (without extension)
41 static OUString getProductKey();
43 /// retrieve the product key; uses the given default, if not found
44 static OUString getProductKey(OUString const& _sDefault);
46 /// retrieve the BUILDID information item; uses the given default, if not found
47 static OUString getBuildIdData(OUString const& _sDefault);
49 /// retrieve the BuildVersion information item; uses the given default, if not found
50 static OUString getBuildVersion(OUString const& _sDefault);
52 /// reload cached data
53 static void reloadData();
55 public: // retrieve path information about the installation location
56 enum PathStatus
58 PATH_EXISTS, // Success: Found a path to an existing file or directory
59 PATH_VALID, // Found a valid path, but the file or directory does not exist
60 DATA_INVALID, // Retrieved a string for this path, that is not a valid file url or system path
61 DATA_MISSING, // Could not retrieve any data for this path
62 DATA_UNKNOWN // No attempt to retrieve data for this path was made
65 /// get a file URL to the common base installation [${insturl}]
66 static PathStatus locateBaseInstallation(OUString& _rURL);
68 /// get a file URL to the user installation [${userurl}]
69 static PathStatus locateUserInstallation(OUString& _rURL);
71 /// get a file URL to the user data directory [default is ${userurl}/user]
72 static PathStatus locateUserData(OUString& _rURL);
74 // the next two items are mainly supported for diagnostic purposes. both items may be unused
75 /// get a file URL to the bootstrap INI file used [e.g. ${insturl}/program/bootraprc]
76 static PathStatus locateBootstrapFile(OUString& _rURL);
77 /// get a file URL to the version locator INI file used [e.g. ${SYSUSERCONFIG}/sversion.ini]
78 static PathStatus locateVersionFile(OUString& _rURL);
80 public: // evaluate the validity of the installation
81 /// high-level status of bootstrap success
82 enum Status
84 DATA_OK, /// user-dir and share-dir do exist, product key found or can be defaulted to exe-name
85 MISSING_USER_INSTALL, /// ${userurl} does not exist; or version-file cannot be found or is invalid
86 INVALID_USER_INSTALL, /// can locate ${userurl}, but user-dir is missing
87 INVALID_BASE_INSTALL /// other failure: e.g. cannot locate share-dir; bootstraprc missing or invalid; no product key
90 /// error code for detailed diagnostics of bootstrap failures
91 enum FailureCode
93 NO_FAILURE, /// bootstrap was successful
94 MISSING_INSTALL_DIRECTORY, /// the shared installation directory could not be located
95 MISSING_BOOTSTRAP_FILE, /// the bootstrap INI file could not be found or read
96 MISSING_BOOTSTRAP_FILE_ENTRY, /// the bootstrap INI is missing a required entry
97 INVALID_BOOTSTRAP_FILE_ENTRY, /// the bootstrap INI contains invalid data
98 MISSING_VERSION_FILE, /// the version locator INI file could not be found or read
99 MISSING_VERSION_FILE_ENTRY, /// the version locator INI has no entry for this version
100 INVALID_VERSION_FILE_ENTRY, /// the version locator INI entry is not a valid directory URL
101 MISSING_USER_DIRECTORY, /// the user installation directory does not exist
102 INVALID_BOOTSTRAP_DATA /// some bootstrap data was invalid in unexpected ways
105 /** Evaluates the status of the installation and returns a diagnostic
106 message and error code corresponding to this status
108 static Status checkBootstrapStatus(OUString& _rDiagnosticMessage, FailureCode& _rErrCode);
110 public:
111 /// get the working directory of the process
112 static bool getProcessWorkingDir(OUString &rUrl);
114 public:
115 // singleton impl-class
116 class Impl;
117 static const Impl& data(); // the data related to the bootstrap.ini file
121 #endif
123 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */