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   LLDB_DEPRECATED_FIXME(
23       "Use the other constructor to determine if this the file "
24       "spec should be resolved",
25       "SBFileSpec(const char *, bool)")
26   SBFileSpec(const char *path);
27 
28   SBFileSpec(const char *path, bool resolve);
29 
30   ~SBFileSpec();
31 
32   const SBFileSpec &operator=(const lldb::SBFileSpec &rhs);
33 
34   explicit operator bool() const;
35 
36   bool operator==(const SBFileSpec &rhs) const;
37 
38   bool operator!=(const SBFileSpec &rhs) const;
39 
40   bool IsValid() const;
41 
42   bool Exists() const;
43 
44   bool ResolveExecutableLocation();
45 
46   const char *GetFilename() const;
47 
48   const char *GetDirectory() const;
49 
50   void SetFilename(const char *filename);
51 
52   void SetDirectory(const char *directory);
53 
54   uint32_t GetPath(char *dst_path, size_t dst_len) const;
55 
56   static int ResolvePath(const char *src_path, char *dst_path, size_t dst_len);
57 
58   bool GetDescription(lldb::SBStream &description) const;
59 
60   void AppendPathComponent(const char *file_or_directory);
61 
62 private:
63   friend class SBAttachInfo;
64   friend class SBBlock;
65   friend class SBCommandInterpreter;
66   friend class SBCompileUnit;
67   friend class SBDeclaration;
68   friend class SBFileSpecList;
69   friend class SBHostOS;
70   friend class SBLaunchInfo;
71   friend class SBLineEntry;
72   friend class SBModule;
73   friend class SBModuleSpec;
74   friend class SBPlatform;
75   friend class SBProcess;
76   friend class SBProcessInfo;
77   friend class SBSourceManager;
78   friend class SBTarget;
79   friend class SBThread;
80   friend class SBTrace;
81 
82   SBFileSpec(const lldb_private::FileSpec &fspec);
83 
84   void SetFileSpec(const lldb_private::FileSpec &fspec);
85 
86   const lldb_private::FileSpec *operator->() const;
87 
88   const lldb_private::FileSpec *get() const;
89 
90   const lldb_private::FileSpec &operator*() const;
91 
92   const lldb_private::FileSpec &ref() const;
93 
94   std::unique_ptr<lldb_private::FileSpec> m_opaque_up;
95 };
96 
97 } // namespace lldb
98 
99 #endif // LLDB_API_SBFILESPEC_H
100