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 friend class SBTrace; 78 79 SBFileSpec(const lldb_private::FileSpec &fspec); 80 81 void SetFileSpec(const lldb_private::FileSpec &fspec); 82 83 const lldb_private::FileSpec *operator->() const; 84 85 const lldb_private::FileSpec *get() const; 86 87 const lldb_private::FileSpec &operator*() const; 88 89 const lldb_private::FileSpec &ref() const; 90 91 std::unique_ptr<lldb_private::FileSpec> m_opaque_up; 92 }; 93 94 } // namespace lldb 95 96 #endif // LLDB_API_SBFILESPEC_H 97