Browse Source

Merge pull request #969 from guanqun/change-to-using

change typedef to using according to preferred coding style
cl-refactor
Gav Wood 10 years ago
parent
commit
a959127623
  1. 2
      evmjit/libevmjit/ExecutionEngine.cpp
  2. 12
      libdevcore/Exceptions.h
  3. 8
      libdevcore/RLP.h
  4. 6
      libdevcore/vector_ref.h
  5. 2
      libdevcrypto/ECDHE.h
  6. 8
      libethcore/Exceptions.h
  7. 6
      libethereum/BlockDetails.h
  8. 4
      libevmcore/Assembly.h
  9. 4
      liblll/Parser.cpp
  10. 6
      libp2p/Common.h
  11. 2
      libsolidity/Exceptions.h
  12. 2
      mix/CodeHighlighter.h
  13. 8
      mix/Exceptions.h

2
evmjit/libevmjit/ExecutionEngine.cpp

@ -29,7 +29,7 @@ namespace jit
namespace namespace
{ {
typedef ReturnCode(*EntryFuncPtr)(Runtime*); using EntryFuncPtr = ReturnCode(*)(Runtime*);
ReturnCode runEntryFunc(EntryFuncPtr _mainFunc, Runtime* _runtime) ReturnCode runEntryFunc(EntryFuncPtr _mainFunc, Runtime* _runtime)
{ {

12
libdevcore/Exceptions.h

@ -44,10 +44,10 @@ struct FileError: virtual Exception {};
struct InterfaceNotSupported: virtual Exception { public: InterfaceNotSupported(std::string _f): m_f("Interface " + _f + " not supported.") {} virtual const char* what() const noexcept { return m_f.c_str(); } private: std::string m_f; }; struct InterfaceNotSupported: virtual Exception { public: InterfaceNotSupported(std::string _f): m_f("Interface " + _f + " not supported.") {} virtual const char* what() const noexcept { return m_f.c_str(); } private: std::string m_f; };
// error information to be added to exceptions // error information to be added to exceptions
typedef boost::error_info<struct tag_invalidSymbol, char> errinfo_invalidSymbol; using errinfo_invalidSymbol = boost::error_info<struct tag_invalidSymbol, char>;
typedef boost::error_info<struct tag_address, std::string> errinfo_wrongAddress; using errinfo_wrongAddress = boost::error_info<struct tag_address, std::string>;
typedef boost::error_info<struct tag_comment, std::string> errinfo_comment; using errinfo_comment = boost::error_info<struct tag_comment, std::string>;
typedef boost::error_info<struct tag_required, bigint> errinfo_required; using errinfo_required = boost::error_info<struct tag_required, bigint>;
typedef boost::error_info<struct tag_got, bigint> errinfo_got; using errinfo_got = boost::error_info<struct tag_got, bigint>;
typedef boost::tuple<errinfo_required, errinfo_got> RequirementError; using RequirementError = boost::tuple<errinfo_required, errinfo_got>;
} }

8
libdevcore/RLP.h

@ -37,7 +37,7 @@ namespace dev
{ {
class RLP; class RLP;
typedef std::vector<RLP> RLPs; using RLPs = std::vector<RLP>;
template <class _T> struct intTraits { static const unsigned maxSize = sizeof(_T); }; template <class _T> struct intTraits { static const unsigned maxSize = sizeof(_T); };
template <> struct intTraits<u160> { static const unsigned maxSize = 20; }; template <> struct intTraits<u160> { static const unsigned maxSize = 20; };
@ -125,7 +125,7 @@ public:
/// @note if used to access items in ascending order, this is efficient. /// @note if used to access items in ascending order, this is efficient.
RLP operator[](unsigned _i) const; RLP operator[](unsigned _i) const;
typedef RLP element_type; using element_type = RLP;
/// @brief Iterator class for iterating through items of RLP list. /// @brief Iterator class for iterating through items of RLP list.
class iterator class iterator
@ -133,8 +133,8 @@ public:
friend class RLP; friend class RLP;
public: public:
typedef RLP value_type; using value_type = RLP;
typedef RLP element_type; using element_type = RLP;
iterator& operator++(); iterator& operator++();
iterator operator++(int) { auto ret = *this; operator++(); return ret; } iterator operator++(int) { auto ret = *this; operator++(); return ret; }

6
libdevcore/vector_ref.h

@ -12,9 +12,9 @@ template <class _T>
class vector_ref class vector_ref
{ {
public: public:
typedef _T value_type; using value_type = _T;
typedef _T element_type; using element_type = _T;
typedef typename std::conditional<std::is_const<_T>::value, typename std::remove_const<_T>::type, _T>::type mutable_value_type; using mutable_value_type = typename std::conditional<std::is_const<_T>::value, typename std::remove_const<_T>::type, _T>::type;
vector_ref(): m_data(nullptr), m_count(0) {} vector_ref(): m_data(nullptr), m_count(0) {}
vector_ref(_T* _data, size_t _count): m_data(_data), m_count(_count) {} vector_ref(_T* _data, size_t _count): m_data(_data), m_count(_count) {}

2
libdevcrypto/ECDHE.h

@ -31,7 +31,7 @@ namespace crypto
{ {
/// Public key of remote and corresponding shared secret. /// Public key of remote and corresponding shared secret.
typedef std::pair<Public,h256> AliasSession; using AliasSession = std::pair<Public,h256>;
/** /**
* @brief An addressable EC key pair. * @brief An addressable EC key pair.

8
libethcore/Exceptions.h

@ -29,10 +29,10 @@ namespace eth
{ {
// information to add to exceptions // information to add to exceptions
typedef boost::error_info<struct tag_field, std::string> errinfo_name; using errinfo_name = boost::error_info<struct tag_field, std::string>;
typedef boost::error_info<struct tag_field, int> errinfo_field; using errinfo_field = boost::error_info<struct tag_field, int>;
typedef boost::error_info<struct tag_data, std::string> errinfo_data; using errinfo_data = boost::error_info<struct tag_data, std::string>;
typedef boost::tuple<errinfo_field, errinfo_data> BadFieldError; using BadFieldError = boost::tuple<errinfo_field, errinfo_data>;
struct DatabaseAlreadyOpen: virtual dev::Exception {}; struct DatabaseAlreadyOpen: virtual dev::Exception {};
struct NotEnoughCash: virtual dev::Exception {}; struct NotEnoughCash: virtual dev::Exception {};

6
libethereum/BlockDetails.h

@ -70,9 +70,9 @@ struct BlockReceipts
TransactionReceipts receipts; TransactionReceipts receipts;
}; };
typedef std::map<h256, BlockDetails> BlockDetailsHash; using BlockDetailsHash = std::map<h256, BlockDetails>;
typedef std::map<h256, BlockLogBlooms> BlockLogBloomsHash; using BlockLogBloomsHash = std::map<h256, BlockLogBlooms>;
typedef std::map<h256, BlockReceipts> BlockReceiptsHash; using BlockReceiptsHash = std::map<h256, BlockReceipts>;
static const BlockDetails NullBlockDetails; static const BlockDetails NullBlockDetails;
static const BlockLogBlooms NullBlockLogBlooms; static const BlockLogBlooms NullBlockLogBlooms;

4
libevmcore/Assembly.h

@ -63,8 +63,8 @@ private:
u256 m_data; u256 m_data;
}; };
typedef std::vector<AssemblyItem> AssemblyItems; using AssemblyItems = std::vector<AssemblyItem>;
typedef vector_ref<AssemblyItem const> AssemblyItemsConstRef; using AssemblyItemsConstRef = vector_ref<AssemblyItem const>;
std::ostream& operator<<(std::ostream& _out, AssemblyItemsConstRef _i); std::ostream& operator<<(std::ostream& _out, AssemblyItemsConstRef _i);
inline std::ostream& operator<<(std::ostream& _out, AssemblyItems const& _i) { return operator<<(_out, AssemblyItemsConstRef(&_i)); } inline std::ostream& operator<<(std::ostream& _out, AssemblyItems const& _i) { return operator<<(_out, AssemblyItemsConstRef(&_i)); }

4
liblll/Parser.cpp

@ -89,8 +89,8 @@ void dev::eth::parseTreeLLL(string const& _s, sp::utree& o_out)
using qi::standard::space; using qi::standard::space;
using qi::standard::space_type; using qi::standard::space_type;
using dev::eth::parseTreeLLL_::tagNode; using dev::eth::parseTreeLLL_::tagNode;
typedef sp::basic_string<std::string, sp::utree_type::symbol_type> symbol_type; using symbol_type = sp::basic_string<std::string, sp::utree_type::symbol_type>;
typedef string::const_iterator it; using it = string::const_iterator;
static const u256 ether = u256(1000000000) * 1000000000; static const u256 ether = u256(1000000000) * 1000000000;
static const u256 finney = u256(1000000000) * 1000000; static const u256 finney = u256(1000000000) * 1000000;

6
libp2p/Common.h

@ -112,9 +112,9 @@ inline bool isPermanentProblem(DisconnectReason _r)
/// @returns the string form of the given disconnection reason. /// @returns the string form of the given disconnection reason.
std::string reasonOf(DisconnectReason _r); std::string reasonOf(DisconnectReason _r);
typedef std::pair<std::string, u256> CapDesc; using CapDesc = std::pair<std::string, u256>;
typedef std::set<CapDesc> CapDescSet; using CapDescSet = std::set<CapDesc>;
typedef std::vector<CapDesc> CapDescs; using CapDescs = std::vector<CapDesc>;
struct PeerInfo struct PeerInfo
{ {

2
libsolidity/Exceptions.h

@ -38,7 +38,7 @@ struct CompilerError: virtual Exception {};
struct InternalCompilerError: virtual Exception {}; struct InternalCompilerError: virtual Exception {};
struct DocstringParsingError: virtual Exception {}; struct DocstringParsingError: virtual Exception {};
typedef boost::error_info<struct tag_sourceLocation, Location> errinfo_sourceLocation; using errinfo_sourceLocation = boost::error_info<struct tag_sourceLocation, Location>;
} }
} }

2
mix/CodeHighlighter.h

@ -81,7 +81,7 @@ public:
int start; int start;
int length; int length;
}; };
typedef std::vector<FormatRange> Formats; // Sorted by start position using Formats = std::vector<FormatRange>; // Sorted by start position
public: public:
/// Collect highligting information by lexing the source /// Collect highligting information by lexing the source

8
mix/Exceptions.h

@ -40,10 +40,10 @@ struct FunctionNotFoundException: virtual Exception {};
struct ExecutionStateException: virtual Exception {}; struct ExecutionStateException: virtual Exception {};
struct ParameterChangedException: virtual Exception {}; struct ParameterChangedException: virtual Exception {};
typedef boost::error_info<struct tagQmlError, QQmlError> QmlErrorInfo; using QmlErrorInfo = boost::error_info<struct tagQmlError, QQmlError>;
typedef boost::error_info<struct tagFileError, std::string> FileError; using FileError = boost::error_info<struct tagFileError, std::string>;
typedef boost::error_info<struct tagBlockIndex, unsigned> BlockIndex; using BlockIndex = boost::error_info<struct tagBlockIndex, unsigned>;
typedef boost::error_info<struct tagFunctionName, std::string> FunctionName; using FunctionName = boost::error_info<struct tagFunctionName, std::string>;
} }
} }

Loading…
Cancel
Save