Loading...
Searching...
No Matches
bsoncxx::decimal128 Class Reference

`#include <bsoncxx/v_noabi/bsoncxx/decimal128.hpp>`

## Description

Represents a MongoDB BSON Decimal128.

This type implements the Decimal Arithmetic Encodings (IEEE 754-2008) specification, with certain exceptions around value integrity and the coefficient encoding. When a value cannot be represented exactly, the value will be rejected.

See also
  - BSON Types (MongoDB Manual)
  - BSON Decimal128 (MongoDB Specifications)

## Public Member Functions

| decimal128 ()=default
| Constructs a BSON Decimal128 value representing zero.
| decimal128 (std::uint64_t high, std::uint64_t low)
| Constructs a BSON Decimal128 from high and low 64-bit big-endian parts.
| decimal128 (v1::decimal128 const &d128) noexcept
| Construct with the bsoncxx::v1 equivalent.
| decimal128 (v1::stdx::string_view str)
| Constructs a BSON Decimal128 from a string.
std::uint64_t | high () const
| Accessor for high 64 bits.
std::uint64_t | low () const
| Accessor for low 64 bits.
| operator v1::decimal128 () const noexcept
| Convert to the bsoncxx::v1 equivalent.
std::string | to_string () const
| Converts this decimal128 value to a string representation.

## Related Symbols

(Note that these are not member symbols.)
bool | operator!= (decimal128 const &lhs, decimal128 const &rhs)
| Equality comparison operator.
bool | operator== (decimal128 const &lhs, decimal128 const &rhs)
| Equality comparison operator.

## Constructor & Destructor Documentation

## decimal128() [1/4]

bsoncxx::v_noabi::decimal128::decimal128 | ( |  | ) |

default

Constructs a BSON Decimal128 value representing zero.

## decimal128() [2/4]

bsoncxx::v_noabi::decimal128::decimal128 | ( | v1::decimal128 const & | d128 | ) |

inline noexcept

Construct with the bsoncxx::v1 equivalent.

## decimal128() [3/4]

bsoncxx::v_noabi::decimal128::decimal128 | ( | std::uint64_t | high,
|  | std::uint64_t | low )

inline

Constructs a BSON Decimal128 from high and low 64-bit big-endian parts.

Parameters

  high | The high 64-bits.
  low | The low 64-bits.

## decimal128() [4/4]

bsoncxx::v_noabi::decimal128::decimal128 | ( | v1::stdx::string_view | str | ) |

explicit

Constructs a BSON Decimal128 from a string.

Parameters

  str | A string representation of a decimal number.

Exceptions

  bsoncxx::v_noabi::exception | if the string isn't a valid BSON Decimal128 representation.

## Member Function Documentation

## high()

std::uint64_t bsoncxx::v_noabi::decimal128::high | ( |  | ) | const

inline

Accessor for high 64 bits.

## low()

std::uint64_t bsoncxx::v_noabi::decimal128::low | ( |  | ) | const

inline

Accessor for low 64 bits.

## operator v1::decimal128()

bsoncxx::v_noabi::decimal128::operator v1::decimal128 | ( |  | ) | const

inline explicit noexcept

Convert to the bsoncxx::v1 equivalent.

## to_string()

std::string bsoncxx::v_noabi::decimal128::to_string | ( |  | ) | const

inline

Converts this decimal128 value to a string representation.

Returns
  A string representation of a IEEE 754-2008 decimal number.

## Friends And Related Symbol Documentation

## operator!=

bool operator!= | ( | decimal128 const & | lhs,
|  | decimal128 const & | rhs )

friend

Equality comparison operator.

## operator==

bool operator== | ( | decimal128 const & | lhs,
|  | decimal128 const & | rhs )

friend

Equality comparison operator.

The documentation for this class was generated from the following file:

- bsoncxx/v_noabi/bsoncxx/decimal128.hpp