Version 5.4.3.2, tag libreoffice-5.4.3.2
[LibreOffice.git] / include / tools / pathutils.hxx
blob3fa5cc0d1e9d3dce73748db9917802c38a209317
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 .
19 #ifndef INCLUDED_TOOLS_PATHUTILS_HXX
20 #define INCLUDED_TOOLS_PATHUTILS_HXX
22 #include <sal/config.h>
24 #if defined(_WIN32)
25 #include <cstddef>
26 #define WIN32_LEAN_AND_MEAN
27 #include <windows.h>
29 // The compiled code is not part of the tl dynamic library, but is delivered as
30 // pathutils-obj and pathutils-slo objects (it is linked into special
31 // executables and dynamic libraries that do not link against OOo libraries):
32 namespace tools {
34 /** Determine the filename part of a path.
35 @param path
36 A non-NULL pointer to a null-terminated path.
37 @return
38 A pointer to the trailing filename part of the given path.
40 WCHAR * filename(WCHAR * path);
42 /** Concatenate two paths.
44 Either the first path is empty and the second path is an absolute path. Or
45 the first path is an absolute path that ends in a backslash and the second
46 path is a relative path. In the latter case, to avoid paths that grow too
47 long, leading .. segments of the second path are removed together with
48 trailing segments from the first path. This should not cause problems as long
49 as there are no symbolic links on Windows (as with symbolic links, x\y\.. and
50 x might denote different directories).
52 @param path
53 An output parameter taking the resulting path; must point at a valid
54 range of memory of size at least MAX_PATH. If NULL is returned, the
55 content is unspecified.
56 @param frontBegin, frontEnd
57 Forms a valid range [frontBegin .. frontEnd) of less than MAX_PATH size.
58 @param backBegin, backLength
59 Forms a valid range [backBegin .. backBegin + backLength) of less than
60 MAX_PATH size.
61 @return
62 A pointer to the terminating null character of the concatenation, or NULL
63 if a failure occurred.
65 WCHAR * buildPath(
66 WCHAR * path, WCHAR const * frontBegin, WCHAR const * frontEnd,
67 WCHAR const * backBegin, std::size_t backLength);
71 #endif
72 #endif
74 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */