nixd
Toggle main menu visibility
Loading...
Searching...
No Matches
nixd
lspserver
include
lspserver
Path.h
Go to the documentation of this file.
1
//===--- Path.h - Helper typedefs --------------------------------*- C++-*-===//
2
//
3
// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4
// See https://llvm.org/LICENSE.txt for license information.
5
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6
//
7
//===----------------------------------------------------------------------===//
8
9
#pragma once
10
11
#include "llvm/ADT/StringRef.h"
12
#include "llvm/Support/Path.h"
13
#include <string>
14
15
/// Whether current platform treats paths case insensitively.
16
#if defined(_WIN32) || defined(__APPLE__)
17
#define CLANGD_PATH_CASE_INSENSITIVE
18
#endif
19
20
namespace
lspserver
{
21
22
/// A typedef to represent a file path. Used solely for more descriptive
23
/// signatures.
24
using
Path
= std::string;
25
/// A typedef to represent a ref to file path. Used solely for more descriptive
26
/// signatures.
27
using
PathRef
= llvm::StringRef;
28
29
// For platforms where paths are case-insensitive (but case-preserving),
30
// we need to do case-insensitive comparisons and use lowercase keys.
31
// FIXME: Make Path a real class with desired semantics instead.
32
std::string
maybeCaseFoldPath
(
PathRef
Path
);
33
bool
pathEqual
(
PathRef
,
PathRef
);
34
35
/// Checks if \p Ancestor is a proper ancestor of \p Path. This is just a
36
/// smarter lexical prefix match, e.g: foo/bar/baz doesn't start with foo/./bar.
37
/// Both \p Ancestor and \p Path must be absolute.
38
bool
pathStartsWith
(
39
PathRef
Ancestor,
PathRef
Path
,
40
llvm::sys::path::Style Style = llvm::sys::path::Style::native);
41
42
/// Variant of parent_path that operates only on absolute paths.
43
/// Unlike parent_path doesn't consider C: a parent of C:\.
44
PathRef
absoluteParent
(
PathRef
Path
);
45
}
// namespace lspserver
lspserver
Whether current platform treats paths case insensitively.
Definition
Connection.h:11
lspserver::Path
std::string Path
Definition
Path.h:24
lspserver::absoluteParent
PathRef absoluteParent(PathRef Path)
lspserver::pathEqual
bool pathEqual(PathRef, PathRef)
lspserver::maybeCaseFoldPath
std::string maybeCaseFoldPath(PathRef Path)
lspserver::PathRef
llvm::StringRef PathRef
Definition
Path.h:27
lspserver::pathStartsWith
bool pathStartsWith(PathRef Ancestor, PathRef Path, llvm::sys::path::Style Style=llvm::sys::path::Style::native)
Generated by
1.17.0