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"
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
int
|
||||
main(int argc, char** argv)
|
||||
{
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#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 int DEFAULT_HTTP_CLIENT_TIMEOUT=900;
|
||||
static const int CONTINUE_EXECUTION=-1;
|
||||
|
|
|
@ -27,6 +27,8 @@ static bool fCreateBlank;
|
|||
static std::map<std::string,UniValue> registers;
|
||||
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
|
||||
// CONTINUE_EXECUTION when it's expected to continue further.
|
||||
|
|
|
@ -19,6 +19,8 @@
|
|||
|
||||
#include <stdio.h>
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
/* Introduction text for doxygen: */
|
||||
|
||||
/*! \mainpage Developer documentation
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <zcash/address/sapling.hpp>
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace Consensus {
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@
|
|||
#include <memenv.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <boost/scoped_ptr.hpp>
|
||||
|
||||
static leveldb::Options GetOptions(size_t nCacheSize)
|
||||
{
|
||||
leveldb::Options options;
|
||||
|
|
|
@ -6,6 +6,8 @@
|
|||
|
||||
#include "librustzcash.h"
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
struct ECCryptoClosure
|
||||
{
|
||||
ECCVerifyHandle handle;
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
#include "primitives/block.h"
|
||||
|
||||
#include <boost/optional.hpp>
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#include <stdint.h>
|
||||
|
||||
class CBlockIndex;
|
||||
|
|
|
@ -12,6 +12,8 @@
|
|||
#include <stdint.h>
|
||||
#include <string>
|
||||
|
||||
#include <boost/signals2/connection.hpp>
|
||||
|
||||
static bool noui_ThreadSafeMessageBox(const std::string& message, const std::string& caption, unsigned int style)
|
||||
{
|
||||
bool fSecure = style & CClientUIInterface::SECURE;
|
||||
|
|
|
@ -31,6 +31,8 @@
|
|||
|
||||
#include "librustzcash.h"
|
||||
|
||||
const std::function<std::string(const char*)> G_TRANSLATION_FUN = nullptr;
|
||||
|
||||
CClientUIInterface uiInterface; // Declared but not defined in ui_interface.h
|
||||
|
||||
TracingHandle* pTracingHandle = nullptr;
|
||||
|
|
|
@ -105,8 +105,6 @@ bool fDebug = false;
|
|||
bool fDaemon = false;
|
||||
bool fServer = false;
|
||||
|
||||
CTranslationInterface translationInterface;
|
||||
|
||||
/** Interpret string as boolean, for argument parsing */
|
||||
static bool InterpretBool(const std::string& strValue)
|
||||
{
|
||||
|
|
21
src/util.h
21
src/util.h
|
@ -27,37 +27,28 @@
|
|||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <boost/signals2/signal.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::vector<std::string> > mapMultiArgs;
|
||||
extern bool fDebug;
|
||||
extern bool fServer;
|
||||
|
||||
extern CTranslationInterface translationInterface;
|
||||
|
||||
[[noreturn]] extern void new_handler_terminate();
|
||||
|
||||
extern const char * const BITCOIN_CONF_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.
|
||||
* If no translation slot is registered, nothing is returned, and simply return the input.
|
||||
* Translation function.
|
||||
* If no translation function is set, simply return the input.
|
||||
*/
|
||||
inline std::string _(const char* psz)
|
||||
{
|
||||
boost::optional<std::string> rv = translationInterface.Translate(psz);
|
||||
return rv ? (*rv) : psz;
|
||||
return G_TRANSLATION_FUN ? (G_TRANSLATION_FUN)(psz) : psz;
|
||||
}
|
||||
|
||||
void SetupEnvironment();
|
||||
|
|
|
@ -4,6 +4,8 @@
|
|||
#include "serialize.h"
|
||||
#include "uint256.h"
|
||||
|
||||
#include <boost/variant.hpp>
|
||||
|
||||
namespace libzcash {
|
||||
|
||||
const unsigned char G1_PREFIX_MASK = 0x02;
|
||||
|
|
|
@ -80,6 +80,7 @@ EXPECTED_BOOST_INCLUDES=(
|
|||
boost/scope_exit.hpp
|
||||
boost/scoped_ptr.hpp
|
||||
boost/shared_ptr.hpp
|
||||
boost/signals2/connection.hpp
|
||||
boost/signals2/last_value.hpp
|
||||
boost/signals2/signal.hpp
|
||||
boost/test/data/test_case.hpp
|
||||
|
|
Loading…
Reference in New Issue