util: Replace boost::signals2 with std::function
Zcash: Added missing imports that were being implicitly included.
This commit is contained in:
parent
df3b6684f2
commit
1ffd2d5fad
|
@ -11,6 +11,8 @@
|
||||||
|
|
||||||
#include "librustzcash.h"
|
#include "librustzcash.h"
|
||||||
|
|
||||||
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
int
|
int
|
||||||
main(int argc, char** argv)
|
main(int argc, char** argv)
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <univalue.h>
|
#include <univalue.h>
|
||||||
|
|
||||||
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
|
static const char DEFAULT_RPCCONNECT[] = "127.0.0.1";
|
||||||
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
|
static const int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
|
||||||
static const int CONTINUE_EXECUTION=-1;
|
static const int CONTINUE_EXECUTION=-1;
|
||||||
|
|
|
@ -27,6 +27,8 @@ static bool fCreateBlank;
|
||||||
static std::map<std::string,UniValue> registers;
|
static std::map<std::string,UniValue> registers;
|
||||||
static const int CONTINUE_EXECUTION=-1;
|
static const int CONTINUE_EXECUTION=-1;
|
||||||
|
|
||||||
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
//
|
//
|
||||||
// This function returns either one of EXIT_ codes when it's expected to stop the process or
|
// This function returns either one of EXIT_ codes when it's expected to stop the process or
|
||||||
// CONTINUE_EXECUTION when it's expected to continue further.
|
// CONTINUE_EXECUTION when it's expected to continue further.
|
||||||
|
|
|
@ -19,6 +19,8 @@
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
/* Introduction text for doxygen: */
|
/* Introduction text for doxygen: */
|
||||||
|
|
||||||
/*! \mainpage Developer documentation
|
/*! \mainpage Developer documentation
|
||||||
|
|
|
@ -12,6 +12,7 @@
|
||||||
#include <zcash/address/sapling.hpp>
|
#include <zcash/address/sapling.hpp>
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
namespace Consensus {
|
namespace Consensus {
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,8 @@
|
||||||
#include <memenv.h>
|
#include <memenv.h>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
|
#include <boost/scoped_ptr.hpp>
|
||||||
|
|
||||||
static leveldb::Options GetOptions(size_t nCacheSize)
|
static leveldb::Options GetOptions(size_t nCacheSize)
|
||||||
{
|
{
|
||||||
leveldb::Options options;
|
leveldb::Options options;
|
||||||
|
|
|
@ -6,6 +6,8 @@
|
||||||
|
|
||||||
#include "librustzcash.h"
|
#include "librustzcash.h"
|
||||||
|
|
||||||
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
struct ECCryptoClosure
|
struct ECCryptoClosure
|
||||||
{
|
{
|
||||||
ECCVerifyHandle handle;
|
ECCVerifyHandle handle;
|
||||||
|
|
|
@ -9,6 +9,7 @@
|
||||||
#include "primitives/block.h"
|
#include "primitives/block.h"
|
||||||
|
|
||||||
#include <boost/optional.hpp>
|
#include <boost/optional.hpp>
|
||||||
|
#include <boost/shared_ptr.hpp>
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
class CBlockIndex;
|
class CBlockIndex;
|
||||||
|
|
|
@ -12,6 +12,8 @@
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
||||||
|
#include <boost/signals2/connection.hpp>
|
||||||
|
|
||||||
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
||||||
{
|
{
|
||||||
bool fSecure = style & CClientUIInterface::SECURE;
|
bool fSecure = style & CClientUIInterface::SECURE;
|
||||||
|
|
|
@ -31,6 +31,8 @@
|
||||||
|
|
||||||
#include "librustzcash.h"
|
#include "librustzcash.h"
|
||||||
|
|
||||||
|
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||||
|
|
||||||
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
||||||
|
|
||||||
TracingHandle* pTracingHandle = nullptr;
|
TracingHandle* pTracingHandle = nullptr;
|
||||||
|
|
|
@ -105,8 +105,6 @@ bool fDebug = false;
|
||||||
bool fDaemon = false;
|
bool fDaemon = false;
|
||||||
bool fServer = false;
|
bool fServer = false;
|
||||||
|
|
||||||
CTranslationInterface translationInterface;
|
|
||||||
|
|
||||||
/** Interpret string as boolean, for argument parsing */
|
/** Interpret string as boolean, for argument parsing */
|
||||||
static bool InterpretBool(const std::string& strValue)
|
static bool InterpretBool(const std::string& strValue)
|
||||||
{
|
{
|
||||||
|
|
21
src/util.h
21
src/util.h
|
@ -27,37 +27,28 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include <boost/signals2/signal.hpp>
|
|
||||||
#include <boost/thread/exceptions.hpp>
|
#include <boost/thread/exceptions.hpp>
|
||||||
|
|
||||||
/** Signals for translation. */
|
|
||||||
class CTranslationInterface
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
/** Translate a message to the native language of the user. */
|
|
||||||
boost::signals2::signal<std::string (const char* psz)> Translate;
|
|
||||||
};
|
|
||||||
|
|
||||||
extern std::map<std::string, std::string> mapArgs;
|
extern std::map<std::string, std::string> mapArgs;
|
||||||
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
|
extern std::map<std::string, std::vector<std::string> > mapMultiArgs;
|
||||||
extern bool fDebug;
|
extern bool fDebug;
|
||||||
extern bool fServer;
|
extern bool fServer;
|
||||||
|
|
||||||
extern CTranslationInterface translationInterface;
|
|
||||||
|
|
||||||
[[noreturn]] extern void new_handler_terminate();
|
[[noreturn]] extern void new_handler_terminate();
|
||||||
|
|
||||||
extern const char * const BITCOIN_CONF_FILENAME;
|
extern const char * const BITCOIN_CONF_FILENAME;
|
||||||
extern const char * const BITCOIN_PID_FILENAME;
|
extern const char * const BITCOIN_PID_FILENAME;
|
||||||
|
|
||||||
|
/** Translate a message to the native language of the user. */
|
||||||
|
const extern std::function<std::string(const char*)> G_TRANSLATION_FUN;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Translation function: Call Translate signal on UI interface, which returns a boost::optional result.
|
* Translation function.
|
||||||
* If no translation slot is registered, nothing is returned, and simply return the input.
|
* If no translation function is set, simply return the input.
|
||||||
*/
|
*/
|
||||||
inline std::string _(const char* psz)
|
inline std::string _(const char* psz)
|
||||||
{
|
{
|
||||||
boost::optional<std::string> rv = translationInterface.Translate(psz);
|
return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;
|
||||||
return rv ? (*rv) : psz;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetupEnvironment();
|
void SetupEnvironment();
|
||||||
|
|
|
@ -4,6 +4,8 @@
|
||||||
#include "serialize.h"
|
#include "serialize.h"
|
||||||
#include "uint256.h"
|
#include "uint256.h"
|
||||||
|
|
||||||
|
#include <boost/variant.hpp>
|
||||||
|
|
||||||
namespace libzcash {
|
namespace libzcash {
|
||||||
|
|
||||||
const unsigned char G1_PREFIX_MASK = 0x02;
|
const unsigned char G1_PREFIX_MASK = 0x02;
|
||||||
|
|
|
@ -80,6 +80,7 @@ EXPECTED_BOOST_INCLUDES=(
|
||||||
boost/scope_exit.hpp
|
boost/scope_exit.hpp
|
||||||
boost/scoped_ptr.hpp
|
boost/scoped_ptr.hpp
|
||||||
boost/shared_ptr.hpp
|
boost/shared_ptr.hpp
|
||||||
|
boost/signals2/connection.hpp
|
||||||
boost/signals2/last_value.hpp
|
boost/signals2/last_value.hpp
|
||||||
boost/signals2/signal.hpp
|
boost/signals2/signal.hpp
|
||||||
boost/test/data/test_case.hpp
|
boost/test/data/test_case.hpp
|
||||||
|
|
Loading…
Reference in New Issue