Skip to content

Commit

Permalink
cpp: Move output stream operators to evmc::evmc_cpp
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed May 20, 2021
1 parent 1ca2481 commit 6019efb
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 54 deletions.
23 changes: 23 additions & 0 deletions include/evmc/evmc.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#include <functional>
#include <initializer_list>
#include <ostream>
#include <utility>

/// EVMC C++ API - wrappers and bindings for C++
Expand Down Expand Up @@ -337,6 +338,28 @@ constexpr bytes32 operator""_bytes32() noexcept

using namespace literals;


inline const char* to_string(evmc_status_code status_code) noexcept
{
return evmc_status_code_to_string(status_code);
}

inline std::ostream& operator<<(std::ostream& os, evmc_status_code status_code)
{
return os << to_string(status_code);
}

inline const char* to_string(evmc_revision rev) noexcept
{
return evmc_revision_to_string(rev);
}

inline std::ostream& operator<<(std::ostream& os, evmc_revision rev)
{
return os << to_string(rev);
}


/// Alias for evmc_make_result().
constexpr auto make_result = evmc_make_result;

Expand Down
1 change: 0 additions & 1 deletion test/unittests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ target_link_libraries(
evmc::instructions
evmc::evmc_cpp
evmc::tool-commands
evmc::tool-utils
evmc::hex
GTest::gtest_main
)
Expand Down
1 change: 0 additions & 1 deletion tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@

add_subdirectory(commands)
add_subdirectory(evmc)
add_subdirectory(utils)
add_subdirectory(vmtester)
2 changes: 1 addition & 1 deletion tools/commands/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ add_library(tool-commands STATIC commands.hpp run.cpp)
add_library(evmc::tool-commands ALIAS tool-commands)
target_compile_features(tool-commands PUBLIC cxx_std_17)
target_include_directories(tool-commands PUBLIC ${PROJECT_SOURCE_DIR})
target_link_libraries(tool-commands PRIVATE evmc::tool-utils evmc::mocked_host evmc::hex)
target_link_libraries(tool-commands PRIVATE evmc::evmc_cpp evmc::mocked_host evmc::hex)
2 changes: 1 addition & 1 deletion tools/commands/run.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
// Licensed under the Apache License, Version 2.0.

#include "tools/commands/commands.hpp"
#include "tools/utils/utils.hpp"
#include <evmc/hex.hpp>
#include <evmc/evmc.hpp>
#include <evmc/mocked_host.hpp>
#include <chrono>
#include <ostream>
Expand Down
9 changes: 0 additions & 9 deletions tools/utils/CMakeLists.txt

This file was deleted.

21 changes: 0 additions & 21 deletions tools/utils/utils.cpp

This file was deleted.

20 changes: 0 additions & 20 deletions tools/utils/utils.hpp

This file was deleted.

0 comments on commit 6019efb

Please sign in to comment.