mirror of
https://github.com/XRPLF/rippled.git
synced 2025-12-06 17:27:55 +00:00
Simplify strHex:
Problem: - There are several specific overloads with some custom code that can be easily replaced using Boost.Hex. Solution: - Introduce `strHex(itr, itr)` to return a string given a begin and end iterator. - Remove `strHex(itr, size)` in favor of the `strHex(T)` where T is something that has a `begin()` member function. This allows us to remove the strHex overloads for `std::string`, Blob, and Slice.
This commit is contained in:
@@ -38,6 +38,8 @@ private:
|
||||
std::uint8_t buf_[32];
|
||||
|
||||
public:
|
||||
using const_iterator = std::uint8_t const*;
|
||||
|
||||
SecretKey() = default;
|
||||
SecretKey (SecretKey const&) = default;
|
||||
SecretKey& operator= (SecretKey const&) = default;
|
||||
@@ -66,6 +68,30 @@ public:
|
||||
*/
|
||||
std::string
|
||||
to_string() const;
|
||||
|
||||
const_iterator
|
||||
begin() const noexcept
|
||||
{
|
||||
return buf_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
cbegin() const noexcept
|
||||
{
|
||||
return buf_;
|
||||
}
|
||||
|
||||
const_iterator
|
||||
end() const noexcept
|
||||
{
|
||||
return buf_ + sizeof(buf_);
|
||||
}
|
||||
|
||||
const_iterator
|
||||
cend() const noexcept
|
||||
{
|
||||
return buf_ + sizeof(buf_);
|
||||
}
|
||||
};
|
||||
|
||||
inline
|
||||
|
||||
Reference in New Issue
Block a user