Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/bsoncxx/include/bsoncxx/v1/array/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class value {
///
/// Return a view of the BSON bytes as an array.
///
v1::array::view view() const {
[[nodiscard]] v1::array::view view() const {
return v1::array::view{_value.data()};
}

Expand Down Expand Up @@ -171,7 +171,7 @@ class value {
}

/// @copydoc v1::array::view::operator[](std::uint32_t i) const
v1::element::view operator[](std::uint32_t i) const {
[[nodiscard]] v1::element::view operator[](std::uint32_t i) const {
return this->view()[i];
}

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/include/bsoncxx/v1/array/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ class view {
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::document::view::errc::invalid_data if this operation
/// failed due to invalid BSON bytes.
///
v1::element::view operator[](std::uint32_t i) const {
[[nodiscard]] v1::element::view operator[](std::uint32_t i) const {
return *(this->find(i));
}

Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/include/bsoncxx/v1/document/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -374,7 +374,7 @@ class value {
///
/// Return a view of the BSON bytes as a document.
///
v1::document::view view() const {
[[nodiscard]] v1::document::view view() const {
return v1::document::view{_data.get()};
}

Expand Down Expand Up @@ -411,7 +411,7 @@ class value {
}

/// @copydoc v1::document::view::operator[](v1::stdx::string_view key) const
v1::element::view operator[](v1::stdx::string_view key) const {
[[nodiscard]] v1::element::view operator[](v1::stdx::string_view key) const {
return this->view()[key];
}

Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/include/bsoncxx/v1/document/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ class view {
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::document::view::errc::invalid_data if this operation
/// failed due to invalid BSON bytes.
///
v1::element::view operator[](v1::stdx::string_view key) const;
[[nodiscard]] v1::element::view operator[](v1::stdx::string_view key) const;

///
/// Compare equal when the BSON bytes represented by `lhs` and `rhs` compare equal.
Expand Down
12 changes: 6 additions & 6 deletions src/bsoncxx/include/bsoncxx/v1/element/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -155,15 +155,15 @@ class view {
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::element::view::errc::invalid_view if this element is
/// invalid.
///
BSONCXX_ABI_EXPORT_CDECL(v1::types::id) type_id() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::types::id) type_id() const;

///
/// Return the key.
///
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::element::view::errc::invalid_view if this element is
/// invalid.
///
BSONCXX_ABI_EXPORT_CDECL(v1::stdx::string_view) key() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::stdx::string_view) key() const;

#pragma push_macro("X")
#undef X
Expand All @@ -189,15 +189,15 @@ class view {
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::element::view::errc::invalid_view if this element is
/// invalid.
///
BSONCXX_ABI_EXPORT_CDECL(v1::types::view) type_view() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::types::view) type_view() const;

///
/// Return a deep copy of the underlying BSON type value.
///
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::element::view::errc::invalid_view if this element is
/// invalid.
///
BSONCXX_ABI_EXPORT_CDECL(v1::types::value) type_value() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::types::value) type_value() const;

///
/// Return the first element within the represented BSON document whose key compares equal to `key`.
Expand All @@ -211,7 +211,7 @@ class view {
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::element::view::errc::invalid_data if this operation
/// failed due to invalid BSON bytes.
///
BSONCXX_ABI_EXPORT_CDECL(v1::element::view) operator[](v1::stdx::string_view key) const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::element::view) operator[](v1::stdx::string_view key) const;

///
/// Return the first element within the represented BSON array whose key compares equal to `i`.
Expand All @@ -225,7 +225,7 @@ class view {
/// @exception bsoncxx::v1::exception with @ref bsoncxx::v1::element::view::errc::invalid_data if this operation
/// failed due to invalid BSON bytes.
///
BSONCXX_ABI_EXPORT_CDECL(v1::element::view) operator[](std::uint32_t idx) const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::element::view) operator[](std::uint32_t idx) const;

///
/// Errors codes which may be returned by @ref bsoncxx::v1::element::view.
Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/include/bsoncxx/v1/types/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -244,12 +244,12 @@ class value {
///
/// Return the type of the underlying BSON type value.
///
BSONCXX_ABI_EXPORT_CDECL(v1::types::id) type_id() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::types::id) type_id() const;

///
/// Return a view of the underlying BSON type value.
///
BSONCXX_ABI_EXPORT_CDECL(v1::types::view) view() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::types::view) view() const;

///
/// Implicitly convert to `this->view()`.
Expand Down
2 changes: 1 addition & 1 deletion src/bsoncxx/include/bsoncxx/v1/types/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ struct b_document {
return value;
}

v1::document::view view() {
[[nodiscard]] v1::document::view view() {
return value;
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ namespace v_noabi {
///
/// Convert to the @ref bsoncxx::v1 equivalent of `v`.
///
inline v1::element::view to_v1(v_noabi::array::element const& v) {
[[nodiscard]] inline v1::element::view to_v1(v_noabi::array::element const& v) {
return v1::element::view{v};
}

Expand Down
4 changes: 2 additions & 2 deletions src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ class value {
}

/// @copydoc bsoncxx::v_noabi::array::view::operator[](std::uint32_t i) const
v_noabi::document::element operator[](std::uint32_t i) const {
[[nodiscard]] v_noabi::document::element operator[](std::uint32_t i) const {
return _value.operator[](i);
}

Expand Down Expand Up @@ -213,7 +213,7 @@ class value {
///
/// Get a view over the array owned by this value.
///
v_noabi::array::view view() const noexcept {
[[nodiscard]] v_noabi::array::view view() const noexcept {
return {_value.data(), _length};
}

Expand Down
6 changes: 3 additions & 3 deletions src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ class view {
///
/// @return The element if it exists, or the invalid element.
///
v_noabi::array::element operator[](std::uint32_t i) const;
[[nodiscard]] v_noabi::array::element operator[](std::uint32_t i) const;

///
/// Access the raw bytes of the underlying array.
Expand Down Expand Up @@ -248,14 +248,14 @@ namespace v_noabi {
///
/// Convert to the @ref bsoncxx::v_noabi equivalent of `v`.
///
inline v_noabi::array::view from_v1(v1::array::view const& v) {
[[nodiscard]] inline v_noabi::array::view from_v1(v1::array::view const& v) {
return {v};
}

///
/// Convert to the @ref bsoncxx::v1 equivalent of `v`.
///
inline v1::array::view to_v1(v_noabi::array::view const& v) {
[[nodiscard]] inline v1::array::view to_v1(v_noabi::array::view const& v) {
return v1::array::view{v};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ class array : public sub_array {
///
/// @return A view of the BSON array.
///
v_noabi::array::view view() const {
[[nodiscard]] v_noabi::array::view view() const {
return _core.view_array();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ class document : public sub_document {
///
/// @return A view of the BSON document.
///
v_noabi::document::view view() const {
[[nodiscard]] v_noabi::document::view view() const {
return _core.view_document();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ struct concatenate_doc {
///
/// @return A view of the wrapped concatenate document.
///
document::view view() const {
[[nodiscard]] document::view view() const {
return doc;
}
};
Expand Down Expand Up @@ -80,7 +80,7 @@ struct concatenate_array {
///
/// @return A view of the wrapped concatenate array.
///
array::view view() const {
[[nodiscard]] array::view view() const {
return array;
}
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -651,7 +651,7 @@ class core {
///
/// @throws bsoncxx::v_noabi::exception if the precondition is violated.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::document::view) view_document() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::document::view) view_document() const;

///
/// Gets a view over the array.
Expand All @@ -664,7 +664,7 @@ class core {
///
/// @throws bsoncxx::v_noabi::exception if the precondition is violated.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::array::view) view_array() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::array::view) view_array() const;

///
/// Transfers ownership of the underlying document to the caller.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ class list {
/// @see
/// - @ref bsoncxx::v_noabi::types::bson_value::view.
///
types::bson_value::view view() {
[[nodiscard]] types::bson_value::view view() {
return val.view();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ class array : public array_context<> {
///
/// @return A view of the BSON array.
///
v_noabi::array::view view() const {
[[nodiscard]] v_noabi::array::view view() const {
return _core.view_array();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ class document : public key_context<> {
///
/// @return A view of the BSON document.
///
v_noabi::document::view view() const {
[[nodiscard]] v_noabi::document::view view() const {
return _core.view_document();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ class element {
///
/// @throws bsoncxx::v_noabi::exception if this element is invalid.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::type) type() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::type) type() const;

///
/// Getter for the element's key.
Expand All @@ -134,7 +134,7 @@ class element {
///
/// @throws bsoncxx::v_noabi::exception if this element is invalid.
///
BSONCXX_ABI_EXPORT_CDECL(v1::stdx::string_view) key() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v1::stdx::string_view) key() const;

#pragma push_macro("X")
#undef X
Expand All @@ -159,7 +159,7 @@ class element {
///
/// @return the element's value.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::view) get_value() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::view) get_value() const;

///
/// Getter for a types::bson_value::value variant wrapper of the value portion of
Expand All @@ -169,21 +169,21 @@ class element {
///
/// @return an owning version of the element's value.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::value) get_owning_value() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::value) get_owning_value() const;

///
/// Equivalent to @ref get_value() const.
///
/// To support incremental migration to @ref bsoncxx::v1::element::view::type_view() const.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::view) type_view() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::view) type_view() const;

///
/// Equivalent to @ref get_owning_value() const.
///
/// To support incremental migration to @ref bsoncxx::v1::element::view::type_value() const.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::value) type_value() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::types::bson_value::value) type_value() const;

///
/// If this element is a document, finds the first element of the document
Expand All @@ -199,7 +199,7 @@ class element {
///
/// @return The matching element, if found, or an invalid element.
///
BSONCXX_ABI_EXPORT_CDECL(element) operator[](v1::stdx::string_view key) const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(element) operator[](v1::stdx::string_view key) const;

///
/// If this element is an array, indexes into this BSON array. If the
Expand All @@ -215,7 +215,7 @@ class element {
///
/// @return The element if it exists, or an invalid element.
///
BSONCXX_ABI_EXPORT_CDECL(v_noabi::array::element) operator[](std::uint32_t i) const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(v_noabi::array::element) operator[](std::uint32_t i) const;
};

///
Expand Down Expand Up @@ -261,7 +261,7 @@ namespace v_noabi {
///
/// Convert to the @ref bsoncxx::v1 equivalent of `v`.
///
inline v1::element::view to_v1(v_noabi::document::element const& v) {
[[nodiscard]] inline v1::element::view to_v1(v_noabi::document::element const& v) {
return v1::element::view{v};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ class value {
///
/// @return The matching element, if found, or the invalid element.
///
v_noabi::document::element operator[](v1::stdx::string_view key) const {
[[nodiscard]] v_noabi::document::element operator[](v1::stdx::string_view key) const {
return _value.operator[](key);
}

Expand Down Expand Up @@ -273,7 +273,7 @@ class value {
///
/// Get a view over the document owned by this value.
///
v_noabi::document::view view() const noexcept {
[[nodiscard]] v_noabi::document::view view() const noexcept {
return {_value.data(), _length}; // Do NOT use _value.view().
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class view {
///
/// @return The matching element, if found, or the invalid element.
///
v_noabi::document::element operator[](v1::stdx::string_view key) const;
[[nodiscard]] v_noabi::document::element operator[](v1::stdx::string_view key) const;

///
/// Access the raw bytes of the underlying document.
Expand Down Expand Up @@ -279,14 +279,14 @@ namespace v_noabi {
///
/// Convert to the @ref bsoncxx::v_noabi equivalent of `v`.
///
inline v_noabi::document::view from_v1(v1::document::view const& v) {
[[nodiscard]] inline v_noabi::document::view from_v1(v1::document::view const& v) {
return {v};
}

///
/// Convert to the @ref bsoncxx::v1 equivalent of `v`.
///
inline v1::document::view to_v1(v_noabi::document::view const& v) {
[[nodiscard]] inline v1::document::view to_v1(v_noabi::document::view const& v) {
return v1::document::view{v};
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class view_or_value : public v_noabi::view_or_value<stdx::string_view, std::stri
///
/// @return A new view_or_value object.
///
BSONCXX_ABI_EXPORT_CDECL(view_or_value) terminated() const;
[[nodiscard]] BSONCXX_ABI_EXPORT_CDECL(view_or_value) terminated() const;

///
/// Call data() on this view_or_value's string_view. This method is not
Expand Down
Loading