Changeset View
Changeset View
Standalone View
Standalone View
src/utilstrencodings.h
// Copyright (c) 2009-2010 Satoshi Nakamoto | // Copyright (c) 2009-2010 Satoshi Nakamoto | ||||
// Copyright (c) 2009-2016 The Bitcoin Core developers | // Copyright (c) 2009-2016 The Bitcoin Core developers | ||||
// Distributed under the MIT software license, see the accompanying | // Distributed under the MIT software license, see the accompanying | ||||
// file COPYING or http://www.opensource.org/licenses/mit-license.php. | // file COPYING or http://www.opensource.org/licenses/mit-license.php. | ||||
/** | /** | ||||
* Utilities for converting data from/to strings. | * Utilities for converting data from/to strings. | ||||
*/ | */ | ||||
#ifndef BITCOIN_UTILSTRENCODINGS_H | #ifndef BITCOIN_UTILSTRENCODINGS_H | ||||
#define BITCOIN_UTILSTRENCODINGS_H | #define BITCOIN_UTILSTRENCODINGS_H | ||||
#include "amount.h" | |||||
#include <cstdint> | #include <cstdint> | ||||
#include <string> | #include <string> | ||||
#include <vector> | #include <vector> | ||||
#define BEGIN(a) ((char *)&(a)) | #define BEGIN(a) ((char *)&(a)) | ||||
#define END(a) ((char *)&((&(a))[1])) | #define END(a) ((char *)&((&(a))[1])) | ||||
#define UBEGIN(a) ((uint8_t *)&(a)) | #define UBEGIN(a) ((uint8_t *)&(a)) | ||||
#define UEND(a) ((uint8_t *)&((&(a))[1])) | #define UEND(a) ((uint8_t *)&((&(a))[1])) | ||||
▲ Show 20 Lines • Show All 115 Lines • ▼ Show 20 Lines | |||||
/** | /** | ||||
* Parse number as fixed point according to JSON number syntax. | * Parse number as fixed point according to JSON number syntax. | ||||
* See http://json.org/number.gif | * See http://json.org/number.gif | ||||
* @returns true on success, false on error. | * @returns true on success, false on error. | ||||
* @note The result must be in the range (-10^18,10^18), otherwise an overflow | * @note The result must be in the range (-10^18,10^18), otherwise an overflow | ||||
* error will trigger. | * error will trigger. | ||||
*/ | */ | ||||
bool ParseFixedPoint(const std::string &val, int decimals, int64_t *amount_out); | bool ParseFixedPoint(const std::string &val, int decimals, CAmount *amount_out); | ||||
#endif // BITCOIN_UTILSTRENCODINGS_H | #endif // BITCOIN_UTILSTRENCODINGS_H |