blob: d3fae44de8bd73159dbe39fb6434886b95a5ea64 [file] [log] [blame]
Johnny Chen5cb6cab2011-07-19 22:41:47 +00001//===-- SWIG Interface for SBFileSpec ---------------------------*- 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
10namespace lldb {
11
Johnny Chenfd33bac2011-07-20 01:06:37 +000012%feature("docstring",
13"Represents a file specfication that divides the path into a directory and
14basename. The string values of the paths are put into uniqued string pools
15for fast comparisons and efficient memory usage.
16
17For example, the following code
18
19 lineEntry = context.GetLineEntry()
20 self.expect(lineEntry.GetFileSpec().GetDirectory(), 'The line entry should have the correct directory',
21 exe=False,
22 substrs = [self.mydir])
23 self.expect(lineEntry.GetFileSpec().GetFilename(), 'The line entry should have the correct filename',
24 exe=False,
25 substrs = ['main.c'])
26 self.assertTrue(lineEntry.GetLine() == self.line,
27 'The line entry's line number should match ')
28
29gets the line entry from the symbol context when a thread is stopped.
30It gets the file spec corresponding to the line entry and checks that
31the filename and the directory matches wat we expect.
32") SBFileSpec;
Johnny Chen5cb6cab2011-07-19 22:41:47 +000033class SBFileSpec
34{
35public:
36 SBFileSpec ();
37
38 SBFileSpec (const lldb::SBFileSpec &rhs);
39
40 SBFileSpec (const char *path);// Deprected, use SBFileSpec (const char *path, bool resolve)
41
42 SBFileSpec (const char *path, bool resolve);
43
44 ~SBFileSpec ();
45
46 bool
47 IsValid() const;
48
49 bool
50 Exists () const;
51
52 bool
53 ResolveExecutableLocation ();
54
55 const char *
56 GetFilename() const;
57
58 const char *
59 GetDirectory() const;
60
61 uint32_t
62 GetPath (char *dst_path, size_t dst_len) const;
63
64 static int
65 ResolvePath (const char *src_path, char *dst_path, size_t dst_len);
66
67 bool
68 GetDescription (lldb::SBStream &description) const;
Greg Clayton1b925202012-01-29 06:07:39 +000069
70 %pythoncode %{
71 __swig_getmethods__["basename"] = GetFilename
72 if _newclass: x = property(GetFilename, None)
73
74 __swig_getmethods__["dirname"] = GetDirectory
75 if _newclass: x = property(GetDirectory, None)
76
77 __swig_getmethods__["exists"] = Exists
78 if _newclass: x = property(Exists, None)
79 %}
80
Johnny Chen5cb6cab2011-07-19 22:41:47 +000081};
82
83} // namespace lldb