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

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

## Description

A BSON Decimal128.

## Public Types

enum class | errc
| Errors codes which may be returned by bsoncxx::v1::decimal128. More...

## Public Member Functions

| decimal128 ()=default
| Zero-initialize the byte representation.
| decimal128 (std::uint64_t high, std::uint64_t low)
| Initialize with the given high and low byte representations.
| decimal128 (v1::stdx::string_view str)
| Initialize with the given Decimal128 string representation.
std::uint64_t | high () const
| Return the high-order bytes.
std::uint64_t | low () const
| Return the low-order bytes.
std::string | to_string () const
| Return the string representation.

## Static Public Member Functions

static std::error_category const & | error_category ()
| The error category for bsoncxx::v1::decimal128::errc.

## Friends

std::error_code | make_error_code (errc v)
| Support implicit conversion to std::error_code.
bool | operator== (decimal128 const &lhs, decimal128 const &rhs)
| Compare equal when the byte representations compare equal.
bool | operator!= (decimal128 const &lhs, decimal128 const &rhs)
| Compare equal when the byte representations compare equal.

## Member Enumeration Documentation

## errc

enum class bsoncxx::v1::decimal128::errc

strong

Errors codes which may be returned by bsoncxx::v1::decimal128.

Enumerator
zero | Zero.
empty_string | String must not be empty.
invalid_string_length | Length of string is too long (exceeds INT_MAX).
invalid_string_data | String is not a valid Decimal128 representation.

## Constructor & Destructor Documentation

## decimal128() [1/3]

bsoncxx::v1::decimal128::decimal128 | ( |  | ) |

default

Zero-initialize the byte representation.

Note
  The result is equivalent to "0E-6176", not "0".

## decimal128() [2/3]

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

inline

Initialize with the given high and low byte representations.

## decimal128() [3/3]

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

explicit

Initialize with the given Decimal128 string representation.

Exceptions

  bsoncxx::v1::exception | with bsoncxx::v1::decimal128::errc::empty_string if str is null.
  bsoncxx::v1::exception | with bsoncxx::v1::decimal128::errc::invalid_string_length if the length of str exceeds INT_MAX.
  bsoncxx::v1::exception | with bsoncxx::v1::decimal128::errc::invalid_string_data if str is not a valid Decimal128 string representation.

## Member Function Documentation

## error_category()

std::error_category const & bsoncxx::v1::decimal128::error_category | ( |  | ) |

static

The error category for bsoncxx::v1::decimal128::errc.

## high()

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

inline

Return the high-order bytes.

## low()

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

inline

Return the low-order bytes.

## to_string()

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

Return the string representation.

## Friends And Related Symbol Documentation

## make_error_code

std::error_code make_error_code | ( | errc | v | ) |

friend

Support implicit conversion to std::error_code.

## operator!=

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

friend

Compare equal when the byte representations compare equal.

## operator==

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

friend

Compare equal when the byte representations compare equal.

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

- bsoncxx/v1/decimal128.hpp