30 const uint32_t size =
m_values.size();
42 for (uint32_t i = 0; i < size; ++i) {
48 switch (array_element_type) {
55 m_values[i]->DumpValue(exe_ctx, strm, dump_mask | extra_dump_options);
88 llvm::json::Array json_array;
89 const uint32_t size =
m_values.size();
90 for (uint32_t i = 0; i < size; ++i)
91 json_array.emplace_back(
m_values[i]->ToJSON(exe_ctx));
97 Args args(value.str());
107 if (name.empty() || name.front() !=
'[') {
109 "invalid value path '%s', %s values only support '[<index>]' subvalues "
110 "where <index> is a positive or negative array index",
115 name = name.drop_front();
116 llvm::StringRef index, sub_value;
117 std::tie(index, sub_value) = name.split(
']');
118 if (index.size() == name.size()) {
123 const size_t array_count =
m_values.size();
125 if (index.getAsInteger(0, idx))
131 new_idx = array_count - idx;
137 if (new_idx < array_count) {
139 if (!sub_value.empty())
140 return m_values[new_idx]->GetSubValue(exe_ctx, sub_value,
error);
145 if (array_count == 0)
147 "index %i is not valid for an empty array", idx);
150 "index %i out of range, valid values are 0 through %" PRIu64, idx,
151 (uint64_t)(array_count - 1));
155 "valid values are -1 through "
157 idx, (uint64_t)array_count);
164 const uint32_t size =
m_values.size();
165 for (uint32_t i = 0; i < size; ++i) {
166 auto string_value =
m_values[i]->GetValueAs<llvm::StringRef>();
186 const uint32_t count =
GetSize();
189 "invalid insert array index %s, index must be 0 through %u",
194 for (
size_t i = 1; i < argc; ++i, ++idx) {
206 "array of complex types must subclass OptionValueArray");
213 "insert operation takes an array index followed by "
214 "one or more values");
220 const uint32_t size =
m_values.size();
221 std::vector<int> remove_indexes;
222 bool all_indexes_valid =
true;
224 for (i = 0; i < argc; ++i) {
227 all_indexes_valid =
false;
230 remove_indexes.push_back(idx);
233 if (all_indexes_valid) {
234 size_t num_remove_indexes = remove_indexes.size();
235 if (num_remove_indexes) {
237 if (num_remove_indexes > 1) {
238 llvm::sort(remove_indexes);
239 for (std::vector<int>::const_reverse_iterator
240 pos = remove_indexes.rbegin(),
241 end = remove_indexes.rend();
252 "invalid array index '%s', aborting remove operation",
257 "remove operation takes one or more array indices");
268 const uint32_t count =
GetSize();
271 "invalid replace array index %s, index must be 0 through %u",
274 for (
size_t i = 1; i < argc; ++i, ++idx) {
286 "array of complex types must subclass OptionValueArray");
293 "replace operation takes an array index followed by "
294 "one or more values");
303 for (
size_t i = 0; i < argc; ++i) {
313 "array of complex types must subclass OptionValueArray");
329 for (
auto &value : array_value_ptr->m_values)
330 value = value->DeepCopy(copy_sp);
static llvm::raw_ostream & error(Stream &strm)
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
void AppendArgument(llvm::StringRef arg_str, char quote_char='\0')
Appends a new argument to the end of the list argument list.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
void Clear()
Clear the arguments.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool AppendValue(const lldb::OptionValueSP &value_sp)
Status SetArgs(const Args &args, VarSetOperationType op)
OptionValue::Type GetType() const override
lldb::OptionValueSP GetSubValue(const ExecutionContext *exe_ctx, llvm::StringRef name, Status &error) const override
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
lldb::OptionValueSP DeepCopy(const lldb::OptionValueSP &new_parent) const override
OptionValueArray(uint32_t type_mask=UINT32_MAX, bool raw_value_dump=false)
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) const override
size_t GetArgs(Args &args) const
static lldb::OptionValueSP CreateValueFromCStringForTypeMask(const char *value_cstr, uint32_t type_mask, Status &error)
static OptionValue::Type ConvertTypeMaskToType(uint32_t type_mask)
virtual lldb::OptionValueSP DeepCopy(const lldb::OptionValueSP &new_parent) const
static const char * GetBuiltinTypeAsCString(Type t)
void NotifyValueChanged()
virtual const char * GetTypeAsCString() const
@ eDumpOptionDefaultValue
static Status FromErrorStringWithFormat(const char *format,...) __attribute__((format(printf
static Status FromErrorString(const char *str)
A stream class that can stream formatted output to a file.
size_t Indent(llvm::StringRef s="")
Indent the current line in the stream.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
size_t PutCString(llvm::StringRef cstr)
Output a C string to the stream.
size_t EOL()
Output and End of Line character to the stream.
void IndentLess(unsigned amount=2)
Decrement the current indentation level.
void IndentMore(unsigned amount=2)
Increment the current indentation level.
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.
@ eVarSetOperationReplace
@ eVarSetOperationInvalid
@ eVarSetOperationInsertBefore
@ eVarSetOperationInsertAfter
std::shared_ptr< lldb_private::OptionValue > OptionValueSP