Added new API to SBStructuredData class

Summary:
 - Added API to access data types
    -- integer, double, array, string, boolean and dictionary data types
    -- Earlier user had to parse through the string output to get these
       values

 - Added Test cases for API testing

 - Added new StructuredDataType enum in public include file
   -- Replaced locally-defined enum in StructuredData.h with this new
      one       
   -- Modified other internal files using this locally-defined enum

Signed-off-by: Abhishek Aggarwal <abhishek.a.aggarwal@intel.com>

Reviewers: clayborg, lldb-commits

Reviewed By: clayborg

Subscribers: labath

Differential Revision: https://reviews.llvm.org/D33434

llvm-svn: 304138
diff --git a/lldb/source/API/SBStructuredData.cpp b/lldb/source/API/SBStructuredData.cpp
index 971c4ab..5402239 100644
--- a/lldb/source/API/SBStructuredData.cpp
+++ b/lldb/source/API/SBStructuredData.cpp
@@ -46,7 +46,7 @@
   StructuredData::ObjectSP json_obj = StructuredData::ParseJSON(json_str);
   m_impl_up->SetObjectSP(json_obj);
 
-  if (!json_obj || json_obj->GetType() != StructuredData::Type::eTypeDictionary)
+  if (!json_obj || json_obj->GetType() != eStructuredDataTypeDictionary)
     error.SetErrorString("Invalid Syntax");
   return error;
 }
@@ -67,3 +67,45 @@
   sb_error.SetError(error);
   return sb_error;
 }
+
+StructuredDataType SBStructuredData::GetType() const {
+  return (m_impl_up ? m_impl_up->GetType() : eStructuredDataTypeInvalid);
+}
+
+size_t SBStructuredData::GetSize() const {
+  return (m_impl_up ? m_impl_up->GetSize() : 0);
+}
+
+lldb::SBStructuredData SBStructuredData::GetValueForKey(const char *key) const {
+  if (!m_impl_up)
+    return SBStructuredData();
+
+  SBStructuredData result;
+  result.m_impl_up->SetObjectSP(m_impl_up->GetValueForKey(key));
+  return result;
+}
+
+lldb::SBStructuredData SBStructuredData::GetItemAtIndex(size_t idx) const {
+  if (!m_impl_up)
+    return SBStructuredData();
+
+  SBStructuredData result;
+  result.m_impl_up->SetObjectSP(m_impl_up->GetItemAtIndex(idx));
+  return result;
+}
+
+uint64_t SBStructuredData::GetIntegerValue(uint64_t fail_value) const {
+  return (m_impl_up ? m_impl_up->GetIntegerValue(fail_value) : fail_value);
+}
+
+double SBStructuredData::GetFloatValue(double fail_value) const {
+  return (m_impl_up ? m_impl_up->GetFloatValue(fail_value) : fail_value);
+}
+
+bool SBStructuredData::GetBooleanValue(bool fail_value) const {
+  return (m_impl_up ? m_impl_up->GetBooleanValue(fail_value) : fail_value);
+}
+
+size_t SBStructuredData::GetStringValue(char *dst, size_t dst_len) const {
+  return (m_impl_up ? m_impl_up->GetStringValue(dst, dst_len) : 0);
+}