Bitcoin
|
#include <util/strencodings.h>
#include <tinyformat.h>
#include <algorithm>
#include <cstdlib>
#include <cstring>
#include <errno.h>
#include <limits>
Functions | |
std::string | SanitizeString (const std::string &str, int rule) |
signed char | HexDigit (char c) |
bool | IsHex (const std::string &str) |
bool | IsHexNumber (const std::string &str) |
std::vector< unsigned char > | ParseHex (const char *psz) |
std::vector< unsigned char > | ParseHex (const std::string &str) |
void | SplitHostPort (std::string in, int &portOut, std::string &hostOut) |
std::string | EncodeBase64 (const unsigned char *pch, size_t len) |
std::string | EncodeBase64 (const std::string &str) |
std::vector< unsigned char > | DecodeBase64 (const char *p, bool *pf_invalid) |
std::string | DecodeBase64 (const std::string &str, bool *pf_invalid) |
std::string | EncodeBase32 (const unsigned char *pch, size_t len) |
std::string | EncodeBase32 (const std::string &str) |
std::vector< unsigned char > | DecodeBase32 (const char *p, bool *pf_invalid) |
std::string | DecodeBase32 (const std::string &str, bool *pf_invalid) |
static NODISCARD 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 | ParseUInt32 (const std::string &str, uint32_t *out) |
bool | ParseUInt64 (const std::string &str, uint64_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) |
void | Downcase (std::string &str) |
std::string | Capitalize (std::string str) |
Variables | |
static const std::string | CHARS_ALPHA_NUM = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789" |
static const std::string | SAFE_CHARS [] |
const signed char | p_util_hexdigit [256] |
static const int64_t | UPPER_BOUND = 1000000000000000000LL - 1LL |
int atoi | ( | const std::string & | str | ) |
int64_t atoi64 | ( | const char * | psz | ) |
int64_t atoi64 | ( | const std::string & | str | ) |
std::string Capitalize | ( | std::string | str | ) |
Capitalizes the first character of the given string. This function is locale independent. It only capitalizes the first character of the argument if it has an uppercase equivalent in the standard 7-bit ASCII range.
[in] | str | the string to capitalize. |
std::vector<unsigned char> DecodeBase32 | ( | const char * | p, |
bool * | pf_invalid | ||
) |
std::string DecodeBase32 | ( | const std::string & | str, |
bool * | pf_invalid | ||
) |
std::vector<unsigned char> DecodeBase64 | ( | const char * | p, |
bool * | pf_invalid | ||
) |
std::string DecodeBase64 | ( | const std::string & | str, |
bool * | pf_invalid | ||
) |
void Downcase | ( | std::string & | str | ) |
Converts the given string to its lowercase equivalent. This function is locale independent. It only converts uppercase characters in the standard 7-bit ASCII range.
[in,out] | str | the string to convert to lowercase. |
std::string EncodeBase32 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
std::string EncodeBase32 | ( | const std::string & | str | ) |
std::string EncodeBase64 | ( | const unsigned char * | pch, |
size_t | len | ||
) |
std::string EncodeBase64 | ( | const std::string & | str | ) |
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.
signed char HexDigit | ( | char | c | ) |
std::string i64tostr | ( | int64_t | n | ) |
bool IsHex | ( | const std::string & | str | ) |
bool IsHexNumber | ( | const std::string & | str | ) |
Return true if the string is a hex number, optionally prefixed with "0x"
std::string itostr | ( | int | n | ) |
bool ParseDouble | ( | const std::string & | str, |
double * | out | ||
) |
Convert string to double with strict parse error feedback.
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
std::vector<unsigned char> ParseHex | ( | const char * | psz | ) |
std::vector<unsigned char> ParseHex | ( | const std::string & | str | ) |
bool ParseInt32 | ( | const std::string & | str, |
int32_t * | out | ||
) |
Convert string to signed 32-bit integer with strict parse error feedback.
bool ParseInt64 | ( | const std::string & | str, |
int64_t * | out | ||
) |
Convert string to signed 64-bit integer with strict parse error feedback.
|
static |
bool ParseUInt32 | ( | const std::string & | str, |
uint32_t * | out | ||
) |
Convert decimal string to unsigned 32-bit integer with strict parse error feedback.
bool ParseUInt64 | ( | const std::string & | str, |
uint64_t * | out | ||
) |
Convert decimal string to unsigned 64-bit integer with strict parse error feedback.
|
inlinestatic |
Helper function for ParseFixedPoint
std::string SanitizeString | ( | const std::string & | str, |
int | rule = SAFE_CHARS_DEFAULT |
||
) |
Remove unsafe chars. Safe chars chosen to allow simple messages/URLs/email addresses, but avoid anything even possibly remotely dangerous like & or >
[in] | str | The string to sanitize |
[in] | rule | The set of safe chars to choose (default: least restrictive) |
void SplitHostPort | ( | std::string | in, |
int & | portOut, | ||
std::string & | hostOut | ||
) |
|
static |
const signed char p_util_hexdigit[256] |
|
static |
|
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)