1 //===-- SWIG Interface for SBFileSpec ---------------------------*- C++ -*-===//
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
7 //===----------------------------------------------------------------------===//
12 "Represents a file specification that divides the path into a directory and
13 basename. The string values of the paths are put into uniqued string pools
14 for fast comparisons and efficient memory usage.
16 For example, the following code
18 lineEntry = context.GetLineEntry()
19 self.expect(lineEntry.GetFileSpec().GetDirectory(), 'The line entry should have the correct directory',
21 substrs = [self.mydir])
22 self.expect(lineEntry.GetFileSpec().GetFilename(), 'The line entry should have the correct filename',
25 self.assertTrue(lineEntry.GetLine() == self.line,
26 'The line entry's line number should match ')
28 gets the line entry from the symbol context when a thread is stopped.
29 It gets the file spec corresponding to the line entry and checks that
30 the filename and the directory matches what we expect.") SBFileSpec;
36 SBFileSpec (const lldb::SBFileSpec &rhs);
38 SBFileSpec (const char *path);// Deprecated, use SBFileSpec (const char *path, bool resolve)
40 SBFileSpec (const char *path, bool resolve);
44 bool operator==(const SBFileSpec &rhs) const;
46 bool operator!=(const SBFileSpec &rhs) const;
51 explicit operator bool() const;
57 ResolveExecutableLocation ();
66 SetFilename(const char *filename);
69 SetDirectory(const char *directory);
72 GetPath (char *dst_path, size_t dst_len) const;
75 ResolvePath (const char *src_path, char *dst_path, size_t dst_len);
78 GetDescription (lldb::SBStream &description) const;
81 AppendPathComponent (const char *file_or_directory);
83 STRING_EXTENSION(SBFileSpec)
87 def __get_fullpath__(self):
88 spec_dir = self.GetDirectory()
89 spec_file = self.GetFilename()
90 if spec_dir and spec_file:
91 return '%s/%s' % (spec_dir, spec_file)
98 fullpath = property(__get_fullpath__, None, doc='''A read only property that returns the fullpath as a python string.''')
99 basename = property(GetFilename, None, doc='''A read only property that returns the path basename as a python string.''')
100 dirname = property(GetDirectory, None, doc='''A read only property that returns the path directory name as a python string.''')
101 exists = property(Exists, None, doc='''A read only property that returns a boolean value that indicates if the file exists.''')