1 //===-- SBFileSpec.h --------------------------------------------*- C++ -*-===//
2 //
3 //                     The LLVM Compiler Infrastructure
4 //
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
7 //
8 //===----------------------------------------------------------------------===//
9 
10 #ifndef LLDB_SBFileSpec_h_
11 #define LLDB_SBFileSpec_h_
12 
13 #include "lldb/API/SBDefines.h"
14 
15 namespace lldb {
16 
17 class LLDB_API SBFileSpec {
18 public:
19   SBFileSpec();
20 
21   SBFileSpec(const lldb::SBFileSpec &rhs);
22 
23   SBFileSpec(const char *path); // Deprecated, use SBFileSpec (const char *path,
24                                 // bool resolve)
25 
26   SBFileSpec(const char *path, bool resolve);
27 
28   ~SBFileSpec();
29 
30   const SBFileSpec &operator=(const lldb::SBFileSpec &rhs);
31 
32   bool IsValid() const;
33 
34   bool Exists() const;
35 
36   bool ResolveExecutableLocation();
37 
38   const char *GetFilename() const;
39 
40   const char *GetDirectory() const;
41 
42   void SetFilename(const char *filename);
43 
44   void SetDirectory(const char *directory);
45 
46   uint32_t GetPath(char *dst_path, size_t dst_len) const;
47 
48   static int ResolvePath(const char *src_path, char *dst_path, size_t dst_len);
49 
50   bool GetDescription(lldb::SBStream &description) const;
51 
52   void AppendPathComponent(const char *file_or_directory);
53 
54 private:
55   friend class SBAttachInfo;
56   friend class SBBlock;
57   friend class SBCommandInterpreter;
58   friend class SBCompileUnit;
59   friend class SBDeclaration;
60   friend class SBFileSpecList;
61   friend class SBHostOS;
62   friend class SBInitializerOptions;
63   friend class SBLaunchInfo;
64   friend class SBLineEntry;
65   friend class SBModule;
66   friend class SBModuleSpec;
67   friend class SBPlatform;
68   friend class SBProcess;
69   friend class SBProcessInfo;
70   friend class SBSourceManager;
71   friend class SBTarget;
72   friend class SBThread;
73 
74   SBFileSpec(const lldb_private::FileSpec &fspec);
75 
76   void SetFileSpec(const lldb_private::FileSpec &fspec);
77 
78   const lldb_private::FileSpec *operator->() const;
79 
80   const lldb_private::FileSpec *get() const;
81 
82   const lldb_private::FileSpec &operator*() const;
83 
84   const lldb_private::FileSpec &ref() const;
85 
86   std::unique_ptr<lldb_private::FileSpec> m_opaque_ap;
87 };
88 
89 } // namespace lldb
90 
91 #endif // LLDB_SBFileSpec_h_
92