Fix typos
[LibreOffice.git] / include / tools / pathutils.hxx
blob26696da3926034a46045f23b60bb1815bdb485b9
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 #include <string>
25 #include <string_view>
27 #if defined(_WIN32)
28 #include <cstddef>
29 #define WIN32_LEAN_AND_MEAN
30 #include <windows.h>
32 // The compiled code is not part of the tl dynamic library, but is delivered as
33 // pathutils-obj and pathutils-slo objects (it is linked into special
34 // executables and dynamic libraries that do not link against OOo libraries):
35 namespace tools
37 /** Determine the filename part of a path.
38 @param path
39 A non-NULL pointer to a null-terminated path.
40 @return
41 A pointer to the trailing filename part of the given path.
43 WCHAR* filename(WCHAR* path);
45 /** Concatenate two paths.
47 Either the first path is empty and the second path is an absolute path. Or
48 the first path is an absolute path that ends in a backslash and the second
49 path is a relative path. In the latter case, to avoid paths that grow too
50 long, leading .. segments of the second path are removed together with
51 trailing segments from the first path. This should not cause problems as long
52 as there are no symbolic links on Windows (as with symbolic links, x\y\.. and
53 x might denote different directories).
55 @param front
56 First path
57 @param backBegin, backLength
58 Second path
59 @return
60 The concatenation, empty if a failure occurred.
62 std::wstring buildPath(std::wstring_view front, std::wstring_view back);
65 #endif
66 #endif
68 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */