Ethereum  PoC-8
The C++ Implementation of Ethereum
CommonData.h File Reference
#include <vector>
#include <algorithm>
#include <unordered_set>
#include <type_traits>
#include <cstring>
#include <string>
#include "Common.h"

Go to the source code of this file.

Namespaces

 dev
 

Enumerations

enum  dev::WhenError { dev::WhenError::DontThrow = 0, dev::WhenError::Throw = 1 }
 

Functions

template<class Iterator >
std::string dev::toHex (Iterator _it, Iterator _end, std::string const &_prefix)
 
template<class T >
std::string dev::toHex (T const &_data)
 
template<class T >
std::string dev::toHexPrefixed (T const &_data)
 
bytes dev::fromHex (std::string const &_s, WhenError _throw=WhenError::DontThrow)
 
bool dev::isHex (std::string const &_s) noexcept
 
std::string dev::asString (bytes const &_b)
 
std::string dev::asString (bytesConstRef _b)
 
bytes dev::asBytes (std::string const &_b)
 Converts a string to a byte array containing the string's (byte) data. More...
 
bytes dev::asNibbles (bytesConstRef const &_s)
 
template<class T , class Out >
void dev::toBigEndian (T _val, Out &o_out)
 
template<class T , class _In >
dev::fromBigEndian (_In const &_bytes)
 
std::string dev::toBigEndianString (u256 _val)
 Convenience functions for toBigEndian. More...
 
std::string dev::toBigEndianString (u160 _val)
 
bytes dev::toBigEndian (u256 _val)
 
bytes dev::toBigEndian (u160 _val)
 
template<class T >
bytes dev::toCompactBigEndian (T _val, unsigned _min=0)
 
bytes dev::toCompactBigEndian (byte _val, unsigned _min=0)
 
template<class T >
std::string dev::toCompactBigEndianString (T _val, unsigned _min=0)
 
std::string dev::toCompactHex (u256 _val, unsigned _min=0)
 
std::string dev::toCompactHexPrefixed (u256 _val, unsigned _min=0)
 
std::string dev::escaped (std::string const &_s, bool _all=true)
 
template<class T , class _U >
unsigned dev::commonPrefix (T const &_t, _U const &_u)
 
template<class T >
unsigned dev::bytesRequired (T _i)
 Determine bytes required to encode the given integer value. More...
 
template<class T >
void dev::trimFront (T &_t, unsigned _elements)
 
template<class T , class _U >
void dev::pushFront (T &_t, _U _e)
 
template<class T , class U >
std::vector< T > & dev::operator+= (std::vector< T > &_a, U const &_b)
 Concatenate the contents of a container onto a vector. More...
 
template<class T , class U >
std::set< T > & dev::operator+= (std::set< T > &_a, U const &_b)
 Insert the contents of a container into a set. More...
 
template<class T , class U >
std::unordered_set< T > & dev::operator+= (std::unordered_set< T > &_a, U const &_b)
 Insert the contents of a container into an unordered_set. More...
 
template<class T , class U >
std::set< T > dev::operator+ (std::set< T > _a, U const &_b)
 Insert the contents of a container into a set. More...
 
template<class T , class U >
std::unordered_set< T > dev::operator+ (std::unordered_set< T > _a, U const &_b)
 Insert the contents of a container into an unordered_set. More...
 
template<class T , class U >
std::vector< T > dev::operator+ (std::vector< T > _a, U const &_b)
 Concatenate the contents of a container onto a vector. More...
 
template<class T , class U >
std::vector< T > dev::keysOf (std::map< T, U > const &_m)
 
template<class T , class U >
std::vector< T > dev::keysOf (std::unordered_map< T, U > const &_m)
 
template<class T , class U >
std::vector< U > dev::valuesOf (std::map< T, U > const &_m)
 
template<class T , class U >
std::vector< U > dev::valuesOf (std::unordered_map< T, U > const &_m)
 
template<class T , class V >
bool dev::contains (T const &_t, V const &_v)
 
template<class V >
bool dev::contains (std::unordered_set< V > const &_set, V const &_v)
 
template<class K , class V >
bool dev::contains (std::unordered_map< K, V > const &_map, K const &_k)
 
template<class V >
bool dev::contains (std::set< V > const &_set, V const &_v)
 

Detailed Description

Author
Gav Wood i@gav.nosp@m.wood.nosp@m..com
Date
2014

Shared algorithms and data types.

Definition in file CommonData.h.