27 Stream &strm, uint32_t dump_mask) {
45 Args args(value.str());
57 if (argc >= 3 && (((argc - 1) & 1) == 0)) {
61 error.SetErrorStringWithFormat(
62 "invalid file list index %s, index must be 0 through %u",
66 for (
size_t i = 1; i < argc; idx++, i += 2) {
76 std::string previousError =
77 error.Fail() ? std::string(
error.AsCString()) +
"\n" :
"";
78 error.SetErrorStringWithFormat(
79 "%sthe replacement path doesn't exist: \"%s\"",
80 previousError.c_str(), replace_path);
87 error.SetErrorString(
"replace operation takes an array index followed by "
88 "one or more path pairs");
93 if (argc < 2 || (argc & 1)) {
94 error.SetErrorString(
"assign operation takes one or more path pairs");
101 if (argc < 2 || (argc & 1)) {
102 error.SetErrorString(
"append operation takes one or more path pairs");
105 bool changed =
false;
106 for (
size_t i = 0; i < argc; i += 2) {
114 std::string previousError =
115 error.Fail() ? std::string(
error.AsCString()) +
"\n" :
"";
116 error.SetErrorStringWithFormat(
117 "%sthe replacement path doesn't exist: \"%s\"",
118 previousError.c_str(), replace_path);
130 if (argc >= 3 && (((argc - 1) & 1) == 0)) {
134 error.SetErrorStringWithFormat(
135 "invalid file list index %s, index must be 0 through %u",
138 bool changed =
false;
141 for (
size_t i = 1; i < argc; i += 2) {
150 std::string previousError =
151 error.Fail() ? std::string(
error.AsCString()) +
"\n" :
"";
152 error.SetErrorStringWithFormat(
153 "%sthe replacement path doesn't exist: \"%s\"",
154 previousError.c_str(), replace_path);
161 error.SetErrorString(
"insert operation takes an array index followed by "
162 "one or more path pairs");
168 std::vector<int> remove_indexes;
169 for (
size_t i = 0; i < argc; ++i) {
173 error.SetErrorStringWithFormat(
174 "invalid array index '%s', aborting remove operation",
178 remove_indexes.push_back(idx);
182 llvm::sort(remove_indexes);
183 for (
auto index : llvm::reverse(remove_indexes))
187 error.SetErrorString(
"remove operation takes one or more array index");
static llvm::raw_ostream & error(Stream &strm)
static bool VerifyPathExists(const char *path)
A command line argument class.
size_t GetArgumentCount() const
Gets the number of arguments left in this command object.
const char * GetArgumentAtIndex(size_t idx) const
Gets the NULL terminated C string argument pointer for the argument at index idx.
"lldb/Target/ExecutionContext.h" A class that contains an execution context.
bool Exists(const FileSpec &file_spec) const
Returns whether the given file exists.
static FileSystem & Instance()
llvm::json::Value ToJSON(const ExecutionContext *exe_ctx) override
PathMappingList m_path_mappings
Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign) override
void DumpValue(const ExecutionContext *exe_ctx, Stream &strm, uint32_t dump_mask) override
virtual Status SetValueFromString(llvm::StringRef value, VarSetOperationType op=eVarSetOperationAssign)
void NotifyValueChanged()
virtual const char * GetTypeAsCString() const
bool Remove(size_t index, bool notify)
bool Replace(llvm::StringRef path, llvm::StringRef replacement, bool notify)
void Insert(llvm::StringRef path, llvm::StringRef replacement, uint32_t insert_idx, bool notify)
void Append(llvm::StringRef path, llvm::StringRef replacement, bool notify)
llvm::json::Value ToJSON()
void Dump(Stream *s, int pair_index=-1)
A stream class that can stream formatted output to a file.
size_t Printf(const char *format,...) __attribute__((format(printf
Output printf formatted output to the stream.
A class that represents a running process on the host machine.
VarSetOperationType
Settable state variable types.
@ eVarSetOperationReplace
@ eVarSetOperationInvalid
@ eVarSetOperationInsertBefore
@ eVarSetOperationInsertAfter