diff options
author | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:53:01 +0000 |
---|---|---|
committer | Dimitry Andric <dim@FreeBSD.org> | 2019-10-23 17:53:01 +0000 |
commit | ead246455adf1a215ec2715dad6533073a6beb4e (patch) | |
tree | f3f97a47d77053bf96fe74cdbd6fae74380e8a92 /include/lldb/Utility/Args.h | |
parent | fdb00c4408990a0a63ef7f496d809ce59f263bc5 (diff) |
Notes
Diffstat (limited to 'include/lldb/Utility/Args.h')
-rw-r--r-- | include/lldb/Utility/Args.h | 35 |
1 files changed, 14 insertions, 21 deletions
diff --git a/include/lldb/Utility/Args.h b/include/lldb/Utility/Args.h index 6f258498d5bae..7987787e7af5e 100644 --- a/include/lldb/Utility/Args.h +++ b/include/lldb/Utility/Args.h @@ -35,6 +35,7 @@ public: private: friend class Args; std::unique_ptr<char[]> ptr; + char quote; char *data() { return ptr.get(); } @@ -42,12 +43,12 @@ public: ArgEntry() = default; ArgEntry(llvm::StringRef str, char quote); - llvm::StringRef ref; - char quote; + llvm::StringRef ref() const { return c_str(); } const char *c_str() const { return ptr.get(); } /// Returns true if this argument was quoted in any way. bool IsQuoted() const { return quote != '\0'; } + char GetQuoteChar() const { return quote; } }; /// Construct with an option command string. @@ -121,7 +122,6 @@ public: const char *GetArgumentAtIndex(size_t idx) const; llvm::ArrayRef<ArgEntry> entries() const { return m_entries; } - char GetArgumentQuoteCharAtIndex(size_t idx) const; using const_iterator = std::vector<ArgEntry>::const_iterator; @@ -168,8 +168,8 @@ public: /// Appends a new argument to the end of the list argument list. /// - /// \param[in] arg_cstr - /// The new argument as a NULL terminated C string. + /// \param[in] arg_str + /// The new argument. /// /// \param[in] quote_char /// If the argument was originally quoted, put in the quote char here. @@ -179,30 +179,27 @@ public: void AppendArguments(const char **argv); - /// Insert the argument value at index \a idx to \a arg_cstr. + /// Insert the argument value at index \a idx to \a arg_str. /// /// \param[in] idx /// The index of where to insert the argument. /// - /// \param[in] arg_cstr - /// The new argument as a NULL terminated C string. + /// \param[in] arg_str + /// The new argument. /// /// \param[in] quote_char /// If the argument was originally quoted, put in the quote char here. - /// - /// \return - /// The NULL terminated C string of the copy of \a arg_cstr. void InsertArgumentAtIndex(size_t idx, llvm::StringRef arg_str, char quote_char = '\0'); - /// Replaces the argument value at index \a idx to \a arg_cstr if \a idx is + /// Replaces the argument value at index \a idx to \a arg_str if \a idx is /// a valid argument index. /// /// \param[in] idx /// The index of the argument that will have its value replaced. /// - /// \param[in] arg_cstr - /// The new argument as a NULL terminated C string. + /// \param[in] arg_str + /// The new argument. /// /// \param[in] quote_char /// If the argument was originally quoted, put in the quote char here. @@ -238,12 +235,12 @@ public: /// \see Args::GetArgumentAtIndex (size_t) const void Shift(); - /// Inserts a class owned copy of \a arg_cstr at the beginning of the + /// Inserts a class owned copy of \a arg_str at the beginning of the /// argument vector. /// - /// A copy \a arg_cstr will be made. + /// A copy \a arg_str will be made. /// - /// \param[in] arg_cstr + /// \param[in] arg_str /// The argument to push on the front of the argument stack. /// /// \param[in] quote_char @@ -255,10 +252,6 @@ public: // For re-setting or blanking out the list of arguments. void Clear(); - static const char *StripSpaces(std::string &s, bool leading = true, - bool trailing = true, - bool return_null_if_empty = true); - static bool UInt64ValueIsValidForByteSize(uint64_t uval64, size_t total_byte_size) { if (total_byte_size > 8) |