• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 //===-- SBFileSpec.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_API_SBFILESPEC_H
10 #define LLDB_API_SBFILESPEC_H
11 
12 #include "lldb/API/SBDefines.h"
13 
14 namespace lldb {
15 
16 class LLDB_API SBFileSpec {
17 public:
18   SBFileSpec();
19 
20   SBFileSpec(const lldb::SBFileSpec &rhs);
21 
22   SBFileSpec(const char *path); // Deprecated, use SBFileSpec (const char *path,
23                                 // bool resolve)
24 
25   SBFileSpec(const char *path, bool resolve);
26 
27   ~SBFileSpec();
28 
29   const SBFileSpec &operator=(const lldb::SBFileSpec &rhs);
30 
31   explicit operator bool() const;
32 
33   bool operator==(const SBFileSpec &rhs) const;
34 
35   bool operator!=(const SBFileSpec &rhs) const;
36 
37   bool IsValid() const;
38 
39   bool Exists() const;
40 
41   bool ResolveExecutableLocation();
42 
43   const char *GetFilename() const;
44 
45   const char *GetDirectory() const;
46 
47   void SetFilename(const char *filename);
48 
49   void SetDirectory(const char *directory);
50 
51   uint32_t GetPath(char *dst_path, size_t dst_len) const;
52 
53   static int ResolvePath(const char *src_path, char *dst_path, size_t dst_len);
54 
55   bool GetDescription(lldb::SBStream &description) const;
56 
57   void AppendPathComponent(const char *file_or_directory);
58 
59 private:
60   friend class SBAttachInfo;
61   friend class SBBlock;
62   friend class SBCommandInterpreter;
63   friend class SBCompileUnit;
64   friend class SBDeclaration;
65   friend class SBFileSpecList;
66   friend class SBHostOS;
67   friend class SBLaunchInfo;
68   friend class SBLineEntry;
69   friend class SBModule;
70   friend class SBModuleSpec;
71   friend class SBPlatform;
72   friend class SBProcess;
73   friend class SBProcessInfo;
74   friend class SBSourceManager;
75   friend class SBTarget;
76   friend class SBThread;
77 
78   SBFileSpec(const lldb_private::FileSpec &fspec);
79 
80   void SetFileSpec(const lldb_private::FileSpec &fspec);
81 
82   const lldb_private::FileSpec *operator->() const;
83 
84   const lldb_private::FileSpec *get() const;
85 
86   const lldb_private::FileSpec &operator*() const;
87 
88   const lldb_private::FileSpec &ref() const;
89 
90   std::unique_ptr<lldb_private::FileSpec> m_opaque_up;
91 };
92 
93 } // namespace lldb
94 
95 #endif // LLDB_API_SBFILESPEC_H
96