1 | //===-- MockTildeExpressionResolver.h ---------------------------*- 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 | #ifndef LLDB_UNITTESTS_TESTINGSUPPORT_MOCKTILDEEXPRESSIONRESOLVER_H |
10 | #define LLDB_UNITTESTS_TESTINGSUPPORT_MOCKTILDEEXPRESSIONRESOLVER_H |
11 | |
12 | #include "lldb/Utility/TildeExpressionResolver.h" |
13 | |
14 | #include "llvm/ADT/SmallString.h" |
15 | #include "llvm/ADT/StringMap.h" |
16 | |
17 | namespace lldb_private { |
18 | class MockTildeExpressionResolver : public TildeExpressionResolver { |
19 | llvm::StringRef CurrentUser; |
20 | llvm::StringMap<llvm::StringRef> UserDirectories; |
21 | |
22 | public: |
23 | MockTildeExpressionResolver(llvm::StringRef CurrentUser, |
24 | llvm::StringRef HomeDir); |
25 | |
26 | void AddKnownUser(llvm::StringRef User, llvm::StringRef HomeDir); |
27 | void Clear(); |
28 | void SetCurrentUser(llvm::StringRef User); |
29 | |
30 | bool ResolveExact(llvm::StringRef Expr, |
31 | llvm::SmallVectorImpl<char> &Output) override; |
32 | bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override; |
33 | }; |
34 | } // namespace lldb_private |
35 | |
36 | #endif |
37 | |