Add GetDescription() and __repr__ () methods to most API classes, to allow
"print" from inside Python to print out the objects in a more useful
manner.



git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@114321 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFileSpec.cpp b/source/API/SBFileSpec.cpp
index 5ec93f3..1edd946 100644
--- a/source/API/SBFileSpec.cpp
+++ b/source/API/SBFileSpec.cpp
@@ -8,6 +8,7 @@
 //===----------------------------------------------------------------------===//
 
 #include "lldb/API/SBFileSpec.h"
+#include "lldb/API/SBStream.h"
 #include "lldb/Core/FileSpec.h"
 
 using namespace lldb;
@@ -138,3 +139,30 @@
         m_opaque_ap.reset (new FileSpec (fs));
 }
 
+bool
+SBFileSpec::GetDescription (SBStream &description)
+{
+    if (m_opaque_ap.get())
+    {
+        const char *filename = GetFilename();
+        const char *dir_name = GetDirectory();
+        if (!filename && !dir_name)
+            description.Printf ("No value");
+        else if (!dir_name)
+            description.Printf ("%s", filename);
+        else
+            description.Printf ("%s/%s", dir_name, filename);
+    }
+    else
+        description.Printf ("No value");
+    
+    return true;
+}
+
+PyObject *
+SBFileSpec::__repr__ ()
+{
+    SBStream description;
+    GetDescription (description);
+    return PyString_FromString (description.GetData());
+}