9#ifndef LLDB_CORE_STRUCTUREDDATAIMPL_H
10#define LLDB_CORE_STRUCTUREDDATAIMPL_H
19#include "llvm/ADT/StringRef.h"
22#pragma mark StructuredDataImpl
77 return plugin_sp->GetDescription(
m_data_sp, stream);
91 dict->AddItem(key, value);
129 auto dict =
m_data_sp->GetAsDictionary();
130 return (dict->GetSize());
133 return (array->GetSize());
140 auto dict =
m_data_sp->GetAsDictionary();
142 return dict->GetValueForKey(llvm::StringRef(key));
151 return array->GetItemAtIndex(idx);
178 llvm::StringRef result =
m_data_sp->GetStringValue();
182 if (!dst || !dst_len) {
184 return (::snprintf(s, 1,
"%s", result.data()));
186 return (::snprintf(dst, dst_len,
"%s", result.data()));
This class handles one or more StructuredData::Dictionary entries that are raised for structured data...
static Status FromErrorString(const char *str)
A stream class that can stream formatted output to a file.
llvm::raw_ostream & AsRawOstream()
Returns a raw_ostream that forwards the data to this Stream object.
StructuredDataImpl(StructuredData::ObjectSP obj)
void SetFloatValue(double value)
double GetFloatValue(double fail_value=0.0) const
Status GetAsJSON(Stream &stream) const
void SetSignedIntegerValue(int64_t value)
StructuredData::ObjectSP GetItemAtIndex(size_t idx) const
int64_t GetIntegerValue(int64_t fail_value=0) const
uint64_t GetIntegerValue(uint64_t fail_value=0) const
lldb::StructuredDataType GetType() const
~StructuredDataImpl()=default
void SetGenericValue(void *value)
StructuredDataImpl(const lldb::EventSP &event_sp)
void SetValueForKey(llvm::StringRef key, const StructuredData::ObjectSP &value)
StructuredData::ObjectSP m_data_sp
StructuredDataImpl & operator=(const StructuredDataImpl &rhs)=default
StructuredData::ObjectSP GetValueForKey(const char *key) const
size_t GetStringValue(char *dst, size_t dst_len) const
StructuredData::ObjectSP GetObjectSP() const
void SetObjectSP(const StructuredData::ObjectSP &obj)
void SetBooleanValue(bool value)
void SetUnsignedIntegerValue(uint64_t value)
void * GetGenericValue() const
void SetStringValue(std::string value)
StructuredData::ObjectSP GetObjectSP()
StructuredDataImpl()=default
bool GetBooleanValue(bool fail_value=false) const
lldb::StructuredDataPluginWP m_plugin_wp
Status GetDescription(Stream &stream) const
StructuredDataImpl(const StructuredDataImpl &rhs)=default
static StructuredData::ObjectSP FromString(std::string value)
static StructuredData::ObjectSP FromFloat(double value)
static ObjectSP FromInteger(T value)
std::shared_ptr< Object > ObjectSP
static StructuredData::ObjectSP FromKeyValue(llvm::StringRef key, const StructuredData::ObjectSP &value_sp)
static StructuredData::ObjectSP FromBoolean(bool value)
static StructuredData::ObjectSP FromGeneric(void *value)
A class that represents a running process on the host machine.
std::weak_ptr< lldb_private::StructuredDataPlugin > StructuredDataPluginWP
std::shared_ptr< lldb_private::StructuredDataPlugin > StructuredDataPluginSP
std::shared_ptr< lldb_private::Event > EventSP
@ eStructuredDataTypeDictionary
@ eStructuredDataTypeInvalid
@ eStructuredDataTypeArray