Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Split wallet.cpp into smaller files #2013

Merged
merged 13 commits into from Oct 2, 2019
4 changes: 3 additions & 1 deletion libraries/wallet/CMakeLists.txt
Expand Up @@ -29,7 +29,9 @@ else()
DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/api_documentation_standin.cpp )
endif()

add_library( graphene_wallet wallet.cpp ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp ${HEADERS} )
file (GLOB SOURCES "*.cpp")

add_library( graphene_wallet ${SOURCES} ${CMAKE_CURRENT_BINARY_DIR}/api_documentation.cpp ${HEADERS} )
target_link_libraries( graphene_wallet PRIVATE graphene_app graphene_net graphene_chain graphene_utilities fc ${CMAKE_DL_LIBS} ${PLATFORM_SPECIFIC_LIBS} )
target_include_directories( graphene_db PUBLIC "${CMAKE_CURRENT_SOURCE_DIR}/include" )

Expand Down
26 changes: 12 additions & 14 deletions libraries/wallet/include/graphene/wallet/reflect_util.hpp
Expand Up @@ -27,8 +27,19 @@
// support the wallet, e.g. allow specifying operations by name
// instead of ID.

#include <string>
#include <vector>
#include <boost/container/flat_map.hpp>
#include <fc/exception/exception.hpp>
#include <fc/variant.hpp>

namespace graphene { namespace wallet {

using std::string;
using std::vector;
using boost::container::flat_map;
using fc::variant;

struct static_variant_map
{
flat_map< string, int > name_to_which;
Expand All @@ -37,20 +48,7 @@ struct static_variant_map

namespace impl {
jmjatlanta marked this conversation as resolved.
Show resolved Hide resolved

std::string clean_name( const std::string& name )
{
const static std::string prefix = "graphene::protocol::";
const static std::string suffix = "_operation";
// graphene::protocol::.*_operation
if( (name.size() >= prefix.size() + suffix.size())
&& (name.substr( 0, prefix.size() ) == prefix)
&& (name.substr( name.size()-suffix.size(), suffix.size() ) == suffix )
)
return name.substr( prefix.size(), name.size() - prefix.size() - suffix.size() );

wlog( "don't know how to clean name: ${name}", ("name", name) );
return name;
}
std::string clean_name( const std::string& name );

struct static_variant_map_visitor
{
Expand Down