summaryrefslogtreecommitdiff
path: root/include/lldb/Core/StructuredData.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/lldb/Core/StructuredData.h')
-rw-r--r--include/lldb/Core/StructuredData.h86
1 files changed, 44 insertions, 42 deletions
diff --git a/include/lldb/Core/StructuredData.h b/include/lldb/Core/StructuredData.h
index 6cb78dc48ab5..39c2f04bb382 100644
--- a/include/lldb/Core/StructuredData.h
+++ b/include/lldb/Core/StructuredData.h
@@ -13,7 +13,8 @@
#include "llvm/ADT/StringRef.h"
#include "lldb/Utility/ConstString.h"
-#include "lldb/Utility/FileSpec.h" // for FileSpec
+#include "lldb/Utility/FileSpec.h" // for FileSpec
+#include "lldb/lldb-enumerations.h" // for StructuredDataType
#include <functional>
#include <map>
@@ -71,46 +72,38 @@ public:
typedef std::shared_ptr<Dictionary> DictionarySP;
typedef std::shared_ptr<Generic> GenericSP;
- enum class Type {
- eTypeInvalid = -1,
- eTypeNull = 0,
- eTypeGeneric,
- eTypeArray,
- eTypeInteger,
- eTypeFloat,
- eTypeBoolean,
- eTypeString,
- eTypeDictionary
- };
-
class Object : public std::enable_shared_from_this<Object> {
public:
- Object(Type t = Type::eTypeInvalid) : m_type(t) {}
+ Object(lldb::StructuredDataType t = lldb::eStructuredDataTypeInvalid)
+ : m_type(t) {}
virtual ~Object() = default;
virtual bool IsValid() const { return true; }
- virtual void Clear() { m_type = Type::eTypeInvalid; }
+ virtual void Clear() { m_type = lldb::eStructuredDataTypeInvalid; }
- Type GetType() const { return m_type; }
+ lldb::StructuredDataType GetType() const { return m_type; }
- void SetType(Type t) { m_type = t; }
+ void SetType(lldb::StructuredDataType t) { m_type = t; }
Array *GetAsArray() {
- return ((m_type == Type::eTypeArray) ? static_cast<Array *>(this)
- : nullptr);
+ return ((m_type == lldb::eStructuredDataTypeArray)
+ ? static_cast<Array *>(this)
+ : nullptr);
}
Dictionary *GetAsDictionary() {
- return ((m_type == Type::eTypeDictionary)
- ? static_cast<Dictionary *>(this)
- : nullptr);
+ return (
+ (m_type == lldb::eStructuredDataTypeDictionary)
+ ? static_cast<Dictionary *>(this)
+ : nullptr);
}
Integer *GetAsInteger() {
- return ((m_type == Type::eTypeInteger) ? static_cast<Integer *>(this)
- : nullptr);
+ return ((m_type == lldb::eStructuredDataTypeInteger)
+ ? static_cast<Integer *>(this)
+ : nullptr);
}
uint64_t GetIntegerValue(uint64_t fail_value = 0) {
@@ -119,8 +112,9 @@ public:
}
Float *GetAsFloat() {
- return ((m_type == Type::eTypeFloat) ? static_cast<Float *>(this)
- : nullptr);
+ return ((m_type == lldb::eStructuredDataTypeFloat)
+ ? static_cast<Float *>(this)
+ : nullptr);
}
double GetFloatValue(double fail_value = 0.0) {
@@ -129,8 +123,9 @@ public:
}
Boolean *GetAsBoolean() {
- return ((m_type == Type::eTypeBoolean) ? static_cast<Boolean *>(this)
- : nullptr);
+ return ((m_type == lldb::eStructuredDataTypeBoolean)
+ ? static_cast<Boolean *>(this)
+ : nullptr);
}
bool GetBooleanValue(bool fail_value = false) {
@@ -139,8 +134,9 @@ public:
}
String *GetAsString() {
- return ((m_type == Type::eTypeString) ? static_cast<String *>(this)
- : nullptr);
+ return ((m_type == lldb::eStructuredDataTypeString)
+ ? static_cast<String *>(this)
+ : nullptr);
}
llvm::StringRef GetStringValue(const char *fail_value = nullptr) {
@@ -152,8 +148,9 @@ public:
}
Generic *GetAsGeneric() {
- return ((m_type == Type::eTypeGeneric) ? static_cast<Generic *>(this)
- : nullptr);
+ return ((m_type == lldb::eStructuredDataTypeGeneric)
+ ? static_cast<Generic *>(this)
+ : nullptr);
}
ObjectSP GetObjectForDotSeparatedPath(llvm::StringRef path);
@@ -163,12 +160,12 @@ public:
virtual void Dump(Stream &s, bool pretty_print = true) const = 0;
private:
- Type m_type;
+ lldb::StructuredDataType m_type;
};
class Array : public Object {
public:
- Array() : Object(Type::eTypeArray) {}
+ Array() : Object(lldb::eStructuredDataTypeArray) {}
~Array() override = default;
@@ -288,7 +285,8 @@ public:
class Integer : public Object {
public:
- Integer(uint64_t i = 0) : Object(Type::eTypeInteger), m_value(i) {}
+ Integer(uint64_t i = 0)
+ : Object(lldb::eStructuredDataTypeInteger), m_value(i) {}
~Integer() override = default;
@@ -304,7 +302,8 @@ public:
class Float : public Object {
public:
- Float(double d = 0.0) : Object(Type::eTypeFloat), m_value(d) {}
+ Float(double d = 0.0) : Object(lldb::eStructuredDataTypeFloat),
+ m_value(d) {}
~Float() override = default;
@@ -320,7 +319,8 @@ public:
class Boolean : public Object {
public:
- Boolean(bool b = false) : Object(Type::eTypeBoolean), m_value(b) {}
+ Boolean(bool b = false) : Object(lldb::eStructuredDataTypeBoolean),
+ m_value(b) {}
~Boolean() override = default;
@@ -336,9 +336,10 @@ public:
class String : public Object {
public:
- String() : Object(Type::eTypeString) {}
+ String() : Object(lldb::eStructuredDataTypeString) {}
explicit String(llvm::StringRef S)
- : Object(Type::eTypeString), m_value(S) {}
+ : Object(lldb::eStructuredDataTypeString),
+ m_value(S) {}
void SetValue(llvm::StringRef S) { m_value = S; }
@@ -352,7 +353,8 @@ public:
class Dictionary : public Object {
public:
- Dictionary() : Object(Type::eTypeDictionary), m_dict() {}
+ Dictionary() : Object(lldb::eStructuredDataTypeDictionary),
+ m_dict() {}
~Dictionary() override = default;
@@ -522,7 +524,7 @@ public:
class Null : public Object {
public:
- Null() : Object(Type::eTypeNull) {}
+ Null() : Object(lldb::eStructuredDataTypeNull) {}
~Null() override = default;
@@ -534,7 +536,7 @@ public:
class Generic : public Object {
public:
explicit Generic(void *object = nullptr)
- : Object(Type::eTypeGeneric), m_object(object) {}
+ : Object(lldb::eStructuredDataTypeGeneric), m_object(object) {}
void SetValue(void *value) { m_object = value; }