8#ifndef INCLUDED_BDLJSN_JSONNUMBER
9#define INCLUDED_BDLJSN_JSONNUMBER
367#include <bdlscm_version.h>
389#include <bsl_iosfwd.h>
390#include <bsl_string.h>
607 int asInt(
int *result)
const;
609 int asUint (
unsigned int *result)
const;
640#if defined(BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT)
646 explicit operator float()
const;
647 explicit operator double()
const;
674 bsl::ostream&
print(bsl::ostream& stream,
676 int spacesPerLevel = 4)
const;
704template <
class HASHALG>
736: d_value(1,
'0', allocator)
743: d_value(text, allocator)
751: d_value(text, allocator)
819: d_value(
bslmf::MovableRefUtil::move(text))
827: d_value(
bslmf::MovableRefUtil::move(text), allocator)
835: d_value(original.d_value, allocator)
850: d_value(
bslmf::MovableRefUtil::move(
851 bslmf::MovableRefUtil::access(original).d_value),
860 d_value = rhs.d_value;
989 return static_cast<float>(
asDouble());
1014#if defined(BSLS_COMPILERFEATURES_SUPPORT_OPERATOR_EXPLICIT)
1018JsonNumber::operator float()
const
1024JsonNumber::operator double()
const
1032 return asDecimal64();
1056 return object.print(stream, 0, -1);
1074template <
class HASHALG>
Definition bdldfp_decimal.h:1834
Definition bdljsn_jsonnumber.h:408
JsonNumber()
Definition bdljsn_jsonnumber.h:729
JsonNumber & operator=(const JsonNumber &rhs)
Definition bdljsn_jsonnumber.h:858
@ k_INEXACT
Definition bdljsn_jsonnumber.h:428
@ k_UNDERFLOW
Definition bdljsn_jsonnumber.h:424
@ k_NOT_INTEGRAL
Definition bdljsn_jsonnumber.h:425
@ k_OVERFLOW
Definition bdljsn_jsonnumber.h:423
static bool isValidNumber(const bsl::string_view &text)
Definition bdljsn_jsonnumber.h:722
int asUint64(bsls::Types::Uint64 *result) const
Definition bdljsn_jsonnumber.h:981
allocator_type get_allocator() const
Return the allocator used by this object to supply memory.
Definition bdljsn_jsonnumber.h:1044
friend void swap(JsonNumber &, JsonNumber &)
BSLMF_NESTED_TRAIT_DECLARATION(JsonNumber, bslmf::IsBitwiseMoveable)
int asInt(int *result) const
Definition bdljsn_jsonnumber.h:963
int asDecimal64Exact(bdldfp::Decimal64 *result) const
Definition bdljsn_jsonnumber.h:1007
const bsl::string & value() const
Return the textual representation of this JsonNumber.
Definition bdljsn_jsonnumber.h:952
float asFloat() const
Definition bdljsn_jsonnumber.h:987
int asInt64(bsls::Types::Int64 *result) const
Definition bdljsn_jsonnumber.h:969
bsl::allocator allocator_type
Definition bdljsn_jsonnumber.h:435
bdldfp::Decimal64 asDecimal64() const
Definition bdljsn_jsonnumber.h:999
bool isEqual(const JsonNumber &other) const
Definition bdljsn_jsonnumber.h:940
bslma::Allocator *BSLS_ANNOTATION_DEPRECATED allocator() const
Definition bdljsn_jsonnumber.h:1038
int asUint(unsigned int *result) const
Definition bdljsn_jsonnumber.h:975
double asDouble() const
Definition bdljsn_jsonnumber.h:993
bool isIntegral() const
Definition bdljsn_jsonnumber.h:946
bsl::ostream & print(bsl::ostream &stream, int level=0, int spacesPerLevel=4) const
Definition bslma_bslallocator.h:580
BloombergLP::bslma::Allocator * mechanism() const
Definition bslma_bslallocator.h:1126
Definition bslstl_stringview.h:441
Definition bslstl_string.h:1281
allocator_type get_allocator() const BSLS_KEYWORD_NOEXCEPT
Return the allocator used by this string to supply memory.
Definition bslstl_string.h:6723
static void swap(T *a, T *b)
Definition bslalg_swaputil.h:194
Definition bslma_allocator.h:457
Definition bslmf_movableref.h:751
#define BSLS_ANNOTATION_DEPRECATED
Definition bsls_annotation.h:324
#define BSLS_ASSERT(X)
Definition bsls_assert.h:1804
#define BSLS_IDENT(str)
Definition bsls_ident.h:195
#define BSLS_KEYWORD_NOEXCEPT
Definition bsls_keyword.h:632
void hashAppend(HASH_ALGORITHM &hashAlg, const baljsn::EncoderTestAddress &object)
Definition baljsn_encoder_testtypes.h:9236
Decimal_Type64 Decimal64
Definition bdldfp_decimal.h:715
Definition bdljsn_error.h:143
bool operator!=(const Error &lhs, const Error &rhs)
void swap(Error &a, Error &b)
bool operator==(const Error &lhs, const Error &rhs)
bsl::ostream & operator<<(bsl::ostream &stream, const Error &object)
void hashAppend(HASHALG &hashAlgorithm, const Error &object)
Definition bdlbb_blob.h:576
static bool isNan(float number)
static bool isInfinite(float number)
static bool isNan(Decimal32 x)
static bool isInf(Decimal32 x)
Definition bdljsn_numberutil.h:186
static bool isIntegralNumber(const bsl::string_view &value)
static int asUint64(Uint64 *result, const bsl::string_view &value)
static int asDecimal64Exact(bdldfp::Decimal64 *result, const bsl::string_view &value)
static bool isValidNumber(const bsl::string_view &value)
static int asUint(unsigned int *result, const bsl::string_view &value)
Definition bdljsn_numberutil.h:501
static double asDouble(const bsl::string_view &value)
Definition bdljsn_numberutil.h:460
static void stringify(bsl::string *result, Int64 value)
@ k_UNDERFLOW
Definition bdljsn_numberutil.h:196
@ k_NOT_INTEGRAL
Definition bdljsn_numberutil.h:197
@ k_INEXACT
Definition bdljsn_numberutil.h:200
@ k_OVERFLOW
Definition bdljsn_numberutil.h:195
static bool areEqual(const bsl::string_view &lhs, const bsl::string_view &rhs)
static bdldfp::Decimal64 asDecimal64(const bsl::string_view &value)
static int asInt(int *result, const bsl::string_view &value)
Definition bdljsn_numberutil.h:489
static int asInt64(Int64 *result, const bsl::string_view &value)
Definition bdljsn_numberutil.h:495
Definition bslmf_isbitwisemoveable.h:718
static MovableRef< t_TYPE > move(t_TYPE &reference) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1060
static t_TYPE & access(t_TYPE &ref) BSLS_KEYWORD_NOEXCEPT
Definition bslmf_movableref.h:1032
unsigned long long Uint64
Definition bsls_types.h:137
long long Int64
Definition bsls_types.h:132