LLDB  mainline
TildeExpressionResolver.h
Go to the documentation of this file.
1 //===--------------------- TildeExpressionResolver.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_UTILITY_TILDEEXPRESSIONRESOLVER_H
10 #define LLDB_UTILITY_TILDEEXPRESSIONRESOLVER_H
11 
12 #include "llvm/ADT/StringRef.h"
13 #include "llvm/ADT/StringSet.h"
14 
15 namespace llvm {
16 template <typename T> class SmallVectorImpl;
17 }
18 
19 namespace lldb_private {
21 public:
22  virtual ~TildeExpressionResolver();
23 
24  /// Resolve a Tilde Expression contained according to bash rules.
25  ///
26  /// \param Expr Contains the tilde expression to resolve. A valid tilde
27  /// expression must begin with a tilde and contain only non
28  /// separator characters.
29  ///
30  /// \param Output Contains the resolved tilde expression, or the original
31  /// input if the tilde expression could not be resolved.
32  ///
33  /// \returns true if \p Expr was successfully resolved, false otherwise.
34  virtual bool ResolveExact(llvm::StringRef Expr,
35  llvm::SmallVectorImpl<char> &Output) = 0;
36 
37  /// Auto-complete a tilde expression with all matching values.
38  ///
39  /// \param Expr Contains the tilde expression prefix to resolve. See
40  /// ResolveExact() for validity rules.
41  ///
42  /// \param Output Contains all matching home directories, each one
43  /// itself unresolved (i.e. you need to call ResolveExact
44  /// on each item to turn it into a real path).
45  ///
46  /// \returns true if there were any matches, false otherwise.
47  virtual bool ResolvePartial(llvm::StringRef Expr,
48  llvm::StringSet<> &Output) = 0;
49 
50  /// Resolve an entire path that begins with a tilde expression, replacing
51  /// the username portion with the matched result.
52  bool ResolveFullPath(llvm::StringRef Expr,
54 };
55 
57 public:
58  bool ResolveExact(llvm::StringRef Expr,
59  llvm::SmallVectorImpl<char> &Output) override;
60  bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override;
61 };
62 }
63 
64 #endif // LLDB_UTILITY_TILDEEXPRESSIONRESOLVER_H
llvm
Definition: Debugger.h:49
lldb_private::StandardTildeExpressionResolver
Definition: TildeExpressionResolver.h:56
lldb_private::TildeExpressionResolver::ResolveExact
virtual bool ResolveExact(llvm::StringRef Expr, llvm::SmallVectorImpl< char > &Output)=0
Resolve a Tilde Expression contained according to bash rules.
lldb_private::TildeExpressionResolver::ResolvePartial
virtual bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output)=0
Auto-complete a tilde expression with all matching values.
lldb_private::TildeExpressionResolver::ResolveFullPath
bool ResolveFullPath(llvm::StringRef Expr, llvm::SmallVectorImpl< char > &Output)
Resolve an entire path that begins with a tilde expression, replacing the username portion with the m...
Definition: TildeExpressionResolver.cpp:76
lldb_private::TildeExpressionResolver::~TildeExpressionResolver
virtual ~TildeExpressionResolver()
lldb_private::StandardTildeExpressionResolver::ResolveExact
bool ResolveExact(llvm::StringRef Expr, llvm::SmallVectorImpl< char > &Output) override
Resolve a Tilde Expression contained according to bash rules.
Definition: TildeExpressionResolver.cpp:32
lldb_private
A class that represents a running process on the host machine.
Definition: SBCommandInterpreterRunOptions.h:16
llvm::SmallVectorImpl
Definition: Disassembler.h:42
lldb_private::StandardTildeExpressionResolver::ResolvePartial
bool ResolvePartial(llvm::StringRef Expr, llvm::StringSet<> &Output) override
Auto-complete a tilde expression with all matching values.
Definition: TildeExpressionResolver.cpp:42
lldb_private::TildeExpressionResolver
Definition: TildeExpressionResolver.h:20