Kagome
Polkadot Runtime Engine in C++17
hexutil.hpp File Reference
#include <string_view>
#include <vector>
#include <gsl/span>
#include "outcome/outcome.hpp"
Include dependency graph for hexutil.hpp:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Namespaces

 kagome::common
 

Enumerations

enum  kagome::common::UnhexError {
  kagome::common::UnhexError::NOT_ENOUGH_INPUT = 1, kagome::common::UnhexError::NON_HEX_INPUT, kagome::common::UnhexError::VALUE_OUT_OF_RANGE, kagome::common::UnhexError::MISSING_0X_PREFIX,
  kagome::common::UnhexError::UNKNOWN
}
 error codes for exceptions that may occur during unhexing More...
 

Functions

std::string kagome::common::int_to_hex (uint64_t n, size_t fixed_width=2) noexcept
 Converts an integer to an uppercase hex representation. More...
 
std::string kagome::common::hex_upper (gsl::span< const uint8_t > bytes) noexcept
 Converts bytes to uppercase hex representation. More...
 
std::string kagome::common::hex_lower (gsl::span< const uint8_t > bytes) noexcept
 Converts bytes to hex representation. More...
 
std::string kagome::common::hex_lower_0x (gsl::span< const uint8_t > bytes) noexcept
 Converts bytes to hex representation with prefix 0x. More...
 
std::string kagome::common::hex_lower_0x (const uint8_t *data, size_t size) noexcept
 Adapter for ptr+size. More...
 
outcome::result< std::vector< uint8_t > > kagome::common::unhex (std::string_view hex)
 Converts hex representation to bytes. More...
 
outcome::result< std::vector< uint8_t > > kagome::common::unhexWith0x (std::string_view hex)
 Unhex hex-string with 0x in the begining. More...
 
template<class T , typename = std::enable_if<std::is_unsigned_v<T>>>
outcome::result< T > kagome::common::unhexNumber (std::string_view value)
 unhex hex-string with 0x or without it in the beginning More...
 
 OUTCOME_HPP_DECLARE_ERROR (kagome::common, UnhexError)
 

Function Documentation

OUTCOME_HPP_DECLARE_ERROR ( kagome::common  ,
UnhexError   
)