From 77a15f749fd78d371ad51cef31f49f120b2a36ea Mon Sep 17 00:00:00 2001 From: Lu Guanqun Date: Fri, 6 Feb 2015 15:19:22 +0800 Subject: [PATCH] change typedef to using according to preferred coding style --- evmjit/libevmjit/ExecutionEngine.cpp | 2 +- libdevcore/Exceptions.h | 12 ++++++------ libdevcore/RLP.h | 8 ++++---- libdevcore/vector_ref.h | 6 +++--- libdevcrypto/ECDHE.h | 2 +- libethcore/Exceptions.h | 8 ++++---- libethereum/BlockDetails.h | 6 +++--- libevmcore/Assembly.h | 4 ++-- liblll/Parser.cpp | 4 ++-- libp2p/Common.h | 6 +++--- libsolidity/Exceptions.h | 2 +- mix/CodeHighlighter.h | 2 +- mix/Exceptions.h | 8 ++++---- 13 files changed, 35 insertions(+), 35 deletions(-) diff --git a/evmjit/libevmjit/ExecutionEngine.cpp b/evmjit/libevmjit/ExecutionEngine.cpp index 2db125c2d..aae5349d8 100644 --- a/evmjit/libevmjit/ExecutionEngine.cpp +++ b/evmjit/libevmjit/ExecutionEngine.cpp @@ -29,7 +29,7 @@ namespace jit namespace { -typedef ReturnCode(*EntryFuncPtr)(Runtime*); +using EntryFuncPtr = ReturnCode(*)(Runtime*); ReturnCode runEntryFunc(EntryFuncPtr _mainFunc, Runtime* _runtime) { diff --git a/libdevcore/Exceptions.h b/libdevcore/Exceptions.h index e13d41476..f3f9b1bf0 100644 --- a/libdevcore/Exceptions.h +++ b/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; }; // error information to be added to exceptions -typedef boost::error_info errinfo_invalidSymbol; -typedef boost::error_info errinfo_wrongAddress; -typedef boost::error_info errinfo_comment; -typedef boost::error_info errinfo_required; -typedef boost::error_info errinfo_got; -typedef boost::tuple RequirementError; +using errinfo_invalidSymbol = boost::error_info; +using errinfo_wrongAddress = boost::error_info; +using errinfo_comment = boost::error_info; +using errinfo_required = boost::error_info; +using errinfo_got = boost::error_info; +using RequirementError = boost::tuple; } diff --git a/libdevcore/RLP.h b/libdevcore/RLP.h index 2eedbaba2..34a0fc65f 100644 --- a/libdevcore/RLP.h +++ b/libdevcore/RLP.h @@ -37,7 +37,7 @@ namespace dev { class RLP; -typedef std::vector RLPs; +using RLPs = std::vector; template struct intTraits { static const unsigned maxSize = sizeof(_T); }; template <> struct intTraits { static const unsigned maxSize = 20; }; @@ -125,7 +125,7 @@ public: /// @note if used to access items in ascending order, this is efficient. RLP operator[](unsigned _i) const; - typedef RLP element_type; + using element_type = RLP; /// @brief Iterator class for iterating through items of RLP list. class iterator @@ -133,8 +133,8 @@ public: friend class RLP; public: - typedef RLP value_type; - typedef RLP element_type; + using value_type = RLP; + using element_type = RLP; iterator& operator++(); iterator operator++(int) { auto ret = *this; operator++(); return ret; } diff --git a/libdevcore/vector_ref.h b/libdevcore/vector_ref.h index 0cd3f8064..4b1df924d 100644 --- a/libdevcore/vector_ref.h +++ b/libdevcore/vector_ref.h @@ -12,9 +12,9 @@ template class vector_ref { public: - typedef _T value_type; - typedef _T element_type; - typedef typename std::conditional::value, typename std::remove_const<_T>::type, _T>::type mutable_value_type; + using value_type = _T; + using element_type = _T; + using mutable_value_type = typename std::conditional::value, typename std::remove_const<_T>::type, _T>::type; vector_ref(): m_data(nullptr), m_count(0) {} vector_ref(_T* _data, size_t _count): m_data(_data), m_count(_count) {} diff --git a/libdevcrypto/ECDHE.h b/libdevcrypto/ECDHE.h index f77f7fcff..4450aec4b 100644 --- a/libdevcrypto/ECDHE.h +++ b/libdevcrypto/ECDHE.h @@ -31,7 +31,7 @@ namespace crypto { /// Public key of remote and corresponding shared secret. -typedef std::pair AliasSession; +using AliasSession = std::pair; /** * @brief An addressable EC key pair. diff --git a/libethcore/Exceptions.h b/libethcore/Exceptions.h index b53a62562..6127a3d00 100644 --- a/libethcore/Exceptions.h +++ b/libethcore/Exceptions.h @@ -29,10 +29,10 @@ namespace eth { // information to add to exceptions -typedef boost::error_info errinfo_name; -typedef boost::error_info errinfo_field; -typedef boost::error_info errinfo_data; -typedef boost::tuple BadFieldError; +using errinfo_name = boost::error_info; +using errinfo_field = boost::error_info; +using errinfo_data = boost::error_info; +using BadFieldError = boost::tuple; struct DatabaseAlreadyOpen: virtual dev::Exception {}; struct NotEnoughCash: virtual dev::Exception {}; diff --git a/libethereum/BlockDetails.h b/libethereum/BlockDetails.h index bbfd48e56..61b9667c4 100644 --- a/libethereum/BlockDetails.h +++ b/libethereum/BlockDetails.h @@ -70,9 +70,9 @@ struct BlockReceipts TransactionReceipts receipts; }; -typedef std::map BlockDetailsHash; -typedef std::map BlockLogBloomsHash; -typedef std::map BlockReceiptsHash; +using BlockDetailsHash = std::map; +using BlockLogBloomsHash = std::map; +using BlockReceiptsHash = std::map; static const BlockDetails NullBlockDetails; static const BlockLogBlooms NullBlockLogBlooms; diff --git a/libevmcore/Assembly.h b/libevmcore/Assembly.h index 81e4a9ff7..9d9e4093c 100644 --- a/libevmcore/Assembly.h +++ b/libevmcore/Assembly.h @@ -63,8 +63,8 @@ private: u256 m_data; }; -typedef std::vector AssemblyItems; -typedef vector_ref AssemblyItemsConstRef; +using AssemblyItems = std::vector; +using AssemblyItemsConstRef = vector_ref; std::ostream& operator<<(std::ostream& _out, AssemblyItemsConstRef _i); inline std::ostream& operator<<(std::ostream& _out, AssemblyItems const& _i) { return operator<<(_out, AssemblyItemsConstRef(&_i)); } diff --git a/liblll/Parser.cpp b/liblll/Parser.cpp index e94e88e19..df30f3897 100644 --- a/liblll/Parser.cpp +++ b/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_type; using dev::eth::parseTreeLLL_::tagNode; - typedef sp::basic_string symbol_type; - typedef string::const_iterator it; + using symbol_type = sp::basic_string; + using it = string::const_iterator; static const u256 ether = u256(1000000000) * 1000000000; static const u256 finney = u256(1000000000) * 1000000; diff --git a/libp2p/Common.h b/libp2p/Common.h index d46c5eed1..61df1350f 100644 --- a/libp2p/Common.h +++ b/libp2p/Common.h @@ -112,9 +112,9 @@ inline bool isPermanentProblem(DisconnectReason _r) /// @returns the string form of the given disconnection reason. std::string reasonOf(DisconnectReason _r); -typedef std::pair CapDesc; -typedef std::set CapDescSet; -typedef std::vector CapDescs; +using CapDesc = std::pair; +using CapDescSet = std::set; +using CapDescs = std::vector; struct PeerInfo { diff --git a/libsolidity/Exceptions.h b/libsolidity/Exceptions.h index 14f919772..0b25abee1 100644 --- a/libsolidity/Exceptions.h +++ b/libsolidity/Exceptions.h @@ -38,7 +38,7 @@ struct CompilerError: virtual Exception {}; struct InternalCompilerError: virtual Exception {}; struct DocstringParsingError: virtual Exception {}; -typedef boost::error_info errinfo_sourceLocation; +using errinfo_sourceLocation = boost::error_info; } } diff --git a/mix/CodeHighlighter.h b/mix/CodeHighlighter.h index 5083e6c82..3bdff5647 100644 --- a/mix/CodeHighlighter.h +++ b/mix/CodeHighlighter.h @@ -81,7 +81,7 @@ public: int start; int length; }; - typedef std::vector Formats; // Sorted by start position + using Formats = std::vector; // Sorted by start position public: /// Collect highligting information by lexing the source diff --git a/mix/Exceptions.h b/mix/Exceptions.h index 5403879f1..46178bf96 100644 --- a/mix/Exceptions.h +++ b/mix/Exceptions.h @@ -40,10 +40,10 @@ struct FunctionNotFoundException: virtual Exception {}; struct ExecutionStateException: virtual Exception {}; struct ParameterChangedException: virtual Exception {}; -typedef boost::error_info QmlErrorInfo; -typedef boost::error_info FileError; -typedef boost::error_info BlockIndex; -typedef boost::error_info FunctionName; +using QmlErrorInfo = boost::error_info; +using FileError = boost::error_info; +using BlockIndex = boost::error_info; +using FunctionName = boost::error_info; } }