![]() |
Dash Core
0.12.2.1
P2P Digital Currency
|
#include "utilstrencodings.h"
#include "tinyformat.h"
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <limits>
Go to the source code of this file.
Functions | |
string | SanitizeString (const string &str, int rule) |
signed char | HexDigit (char c) |
bool | IsHex (const string &str) |
vector< unsigned char > | ParseHex (const char *psz) |
vector< unsigned char > | ParseHex (const string &str) |
string | EncodeBase64 (const unsigned char *pch, size_t len) |
string | EncodeBase64 (const string &str) |
vector< unsigned char > | DecodeBase64 (const char *p, bool *pfInvalid) |
string | DecodeBase64 (const string &str) |
string | EncodeBase32 (const unsigned char *pch, size_t len) |
string | EncodeBase32 (const string &str) |
vector< unsigned char > | DecodeBase32 (const char *p, bool *pfInvalid) |
string | DecodeBase32 (const string &str) |
static bool | ParsePrechecks (const std::string &str) |
bool | ParseInt32 (const std::string &str, int32_t *out) |
bool | ParseInt64 (const std::string &str, int64_t *out) |
bool | ParseDouble (const std::string &str, double *out) |
std::string | FormatParagraph (const std::string &in, size_t width, size_t indent) |
std::string | i64tostr (int64_t n) |
std::string | itostr (int n) |
int64_t | atoi64 (const char *psz) |
int64_t | atoi64 (const std::string &str) |
int | atoi (const std::string &str) |
static bool | ProcessMantissaDigit (char ch, int64_t &mantissa, int &mantissa_tzeros) |
bool | ParseFixedPoint (const std::string &val, int decimals, int64_t *amount_out) |
Variables | |
static const string | CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |
static const string | SAFE_CHARS [] |
const signed char | p_util_hexdigit [256] |
static const int64_t | UPPER_BOUND = 1000000000000000000LL - 1LL |
int atoi | ( | const std::string & | str | ) |
Definition at line 541 of file utilstrencodings.cpp.
Referenced by atoi(), CleanupBlockRevFiles(), CWallet::GetMasternodeOutpointAndKeys(), InterpretBool(), masternode(), MutateTxAddInput(), MutateTxDelInput(), MutateTxDelOutput(), MutateTxSign(), ProcessMessage(), and TorControlConnection::readcb().
int64_t atoi64 | ( | const char * | psz | ) |
Definition at line 523 of file utilstrencodings.cpp.
Referenced by GetArg(), getblocktemplate(), MutateTxLocktime(), MutateTxVersion(), ParseMoney(), ParseScript(), ReadOrderPos(), and CWalletTx::SerializationOp().
int64_t atoi64 | ( | const std::string & | str | ) |
Definition at line 532 of file utilstrencodings.cpp.
vector<unsigned char> DecodeBase32 | ( | const char * | p, |
bool * | pfInvalid | ||
) |
Definition at line 299 of file utilstrencodings.cpp.
Referenced by DecodeBase32(), and CNetAddr::SetSpecial().
string DecodeBase32 | ( | const string & | str | ) |
Definition at line 416 of file utilstrencodings.cpp.
vector<unsigned char> DecodeBase64 | ( | const char * | p, |
bool * | pfInvalid | ||
) |
Definition at line 146 of file utilstrencodings.cpp.
Referenced by DecodeBase64(), CKeePassIntegrator::CKeePassResponse::decrypt(), SignVerifyMessageDialog::on_verifyMessageButton_VM_clicked(), CKeePassIntegrator::CKeePassResponse::parseResponse(), RPCAuthorized(), verifymessage(), and voteraw().
string DecodeBase64 | ( | const string & | str | ) |
Definition at line 229 of file utilstrencodings.cpp.
string EncodeBase32 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
Definition at line 235 of file utilstrencodings.cpp.
Referenced by EncodeBase32(), and CNetAddr::ToStringIP().
string EncodeBase32 | ( | const string & | str | ) |
Definition at line 294 of file utilstrencodings.cpp.
string EncodeBase64 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
Definition at line 95 of file utilstrencodings.cpp.
Referenced by CKeePassIntegrator::CKeePassRequest::addStrParameter(), CallRPC(), CMasternodeBroadcast::CheckSignature(), EncodeBase64(), masternodebroadcast(), SignVerifyMessageDialog::on_signMessageButton_SM_clicked(), signmessage(), and CHashSigner::VerifyHash().
string EncodeBase64 | ( | const string & | str | ) |
Definition at line 141 of file utilstrencodings.cpp.
std::string FormatParagraph | ( | const std::string & | in, |
size_t | width = 79 , |
||
size_t | indent = 0 |
||
) |
Format a paragraph of text to a fixed width, adding spaces for indentation to any added line.
Definition at line 478 of file utilstrencodings.cpp.
Referenced by HelpMessageOpt(), and LicenseInfo().
signed char HexDigit | ( | char | c | ) |
Definition at line 54 of file utilstrencodings.cpp.
Referenced by IsHex(), ParseHex(), and base_blob< 512 >::SetHex().
std::string i64tostr | ( | int64_t | n | ) |
Definition at line 513 of file utilstrencodings.cpp.
Referenced by getblocktemplate(), and WriteOrderPos().
bool IsHex | ( | const string & | str | ) |
Definition at line 59 of file utilstrencodings.cpp.
Referenced by _createmultisig_redeemScript(), DecodeHexBlk(), DecodeHexTx(), DecodeHexVecMnb(), CWallet::GenerateNewHDChain(), gettxoutproof(), importaddress(), importpubkey(), InitParameterInteraction(), lockunspent(), MutateTxAddInput(), MutateTxAddOutData(), ParseHashStr(), ParseHashV(), ParseHexUV(), ParseHexV(), ParseScript(), and rest_getutxos().
std::string itostr | ( | int | n | ) |
Definition at line 518 of file utilstrencodings.cpp.
Referenced by keypoolrefill(), ProcessMessage(), CKeePassIntegrator::rpcAssociate(), CKeePassIntegrator::rpcGetLogins(), CKeePassIntegrator::rpcSetLogin(), and setgenerate().
bool ParseDouble | ( | const std::string & | str, |
double * | out | ||
) |
Convert string to double with strict parse error feedback.
Definition at line 464 of file utilstrencodings.cpp.
Referenced by UniValue::get_real().
bool ParseFixedPoint | ( | const std::string & | val, |
int | decimals, | ||
int64_t * | amount_out | ||
) |
Parse number as fixed point according to JSON number syntax. See http://json.org/number.gif
Definition at line 573 of file utilstrencodings.cpp.
Referenced by AmountFromValue(), and ParsePaymentAmount().
vector<unsigned char> ParseHex | ( | const char * | psz | ) |
Definition at line 69 of file utilstrencodings.cpp.
Referenced by _createmultisig_redeemScript(), TorController::authchallenge_cb(), CSporkMessage::CheckSignature(), CMainParams::CMainParams(), CreateGenesisBlock(), CTestNetParams::CTestNetParams(), DecodeHexBlk(), DecodeHexTx(), DecodeHexVecMnb(), CWallet::GenerateNewHDChain(), CGovernanceObject::GetDataAsString(), gobject(), importaddress(), importpubkey(), MutateTxAddOutData(), ParseHex(), ParseHexUV(), ParseHexV(), ParseScript(), rest_getutxos(), CDBEnv::Salvage(), and CProposalValidator::SetHexData().
vector<unsigned char> ParseHex | ( | const string & | str | ) |
Definition at line 90 of file utilstrencodings.cpp.
bool ParseInt32 | ( | const std::string & | str, |
int32_t * | out | ||
) |
Convert string to signed 32-bit integer with strict parse error feedback.
Definition at line 433 of file utilstrencodings.cpp.
Referenced by UniValue::get_int(), gobject(), LookupSubNet(), rest_getutxos(), SplitHostPort(), MasternodeList::StartAll(), and MasternodeList::updateMyNodeList().
bool ParseInt64 | ( | const std::string & | str, |
int64_t * | out | ||
) |
Convert string to signed 64-bit integer with strict parse error feedback.
Definition at line 449 of file utilstrencodings.cpp.
Referenced by UniValue::get_int64().
|
static |
Definition at line 422 of file utilstrencodings.cpp.
Referenced by ParseDouble(), ParseInt32(), and ParseInt64().
|
inlinestatic |
Helper function for ParseFixedPoint
Definition at line 557 of file utilstrencodings.cpp.
Referenced by ParseFixedPoint().
string SanitizeString | ( | const string & | str, |
int | rule | ||
) |
Definition at line 25 of file utilstrencodings.cpp.
Referenced by AppInit2(), CAlert::Notify(), JSONRequest::parse(), ProcessMessage(), ProcessMessages(), and CConnman::PushMessage().
|
static |
Definition at line 17 of file utilstrencodings.cpp.
const signed char p_util_hexdigit[256] |
Definition at line 36 of file utilstrencodings.cpp.
Referenced by HexDigit().
|
static |
Definition at line 19 of file utilstrencodings.cpp.
Referenced by SanitizeString().
|
static |
Upper bound for mantissa. 10^18-1 is the largest arbitrary decimal that will fit in a signed 64-bit integer. Larger integers cannot consist of arbitrary combinations of 0-9:
999999999999999999 1^18-1 9223372036854775807 (1<<63)-1 (max int64_t) 9999999999999999999 1^19-1 (would overflow)
Definition at line 554 of file utilstrencodings.cpp.
Referenced by ParseFixedPoint(), and ProcessMantissaDigit().