From e4ec3264baffdd89b3df958fa2a6209a6f21665b Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 16:15:08 -0500 Subject: [PATCH 1/7] doxygen: set MULTILINE_CPP_IS_BRIEF = YES --- Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index b722e328e2..41f699c532 100644 --- a/Doxyfile +++ b/Doxyfile @@ -237,7 +237,7 @@ QT_AUTOBRIEF = NO # not recognized any more. # The default value is: NO. -MULTILINE_CPP_IS_BRIEF = NO +MULTILINE_CPP_IS_BRIEF = YES # By default Python docstrings are displayed as preformatted text and doxygen's # special commands cannot be used. By setting PYTHON_DOCSTRING to NO the From 722f240bea3c223a3e5410c4b72159e9e3cc0295 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 16:15:09 -0500 Subject: [PATCH 2/7] doxygen: set ENUM_VALUES_PER_LINE = 1 --- Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index 41f699c532..34b2b2b9ab 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1726,7 +1726,7 @@ FULL_SIDEBAR = NO # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. -ENUM_VALUES_PER_LINE = 4 +ENUM_VALUES_PER_LINE = 1 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. From f48c792105be2f564e41cb18abc3ed85e7a2911a Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 16:15:09 -0500 Subject: [PATCH 3/7] Fix reference to bsoncxx::v_noabi::bson_value::view --- .../include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp index 7112fbf4b5..f14006005f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp @@ -42,7 +42,7 @@ namespace bson_value { /// For accessors into this type and to extract the various BSON types out, /// please use bson_value::view. /// -/// @see bsoncxx::v_noabi::bson_value::view +/// @see @ref bsoncxx::v_noabi::types::bson_value::view /// class value { public: From 4722416c1ca0a0089175ae689dbd63114091c544 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 16:15:10 -0500 Subject: [PATCH 4/7] Fix missing brief docs --- .../v_noabi/bsoncxx/types/bson_value/view.hpp | 46 +++++++++---------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp index 8bd9e9f1bd..e54ea06648 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp @@ -83,12 +83,12 @@ class view { /// /// - /// @return The type of the underlying BSON value stored in this object. + /// Returns the type of the underlying BSON value stored in this object. /// BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::type) type() const; /// - /// @return The underlying BSON double value. + /// Returns the underlying BSON double value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -96,7 +96,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_double&) get_double() const; /// - /// @return The underlying BSON UTF-8 string value. + /// Returns the underlying BSON UTF-8 string value. /// /// @deprecated use get_string instead. /// @@ -106,7 +106,7 @@ class view { BSONCXX_DEPRECATED BSONCXX_ABI_EXPORT_CDECL(const b_string&) get_utf8() const; /// - /// @return The underlying BSON UTF-8 string value. + /// Returns the underlying BSON UTF-8 string value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -114,7 +114,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_string&) get_string() const; /// - /// @return The underlying BSON document value. + /// Returns the underlying BSON document value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -122,7 +122,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_document&) get_document() const; /// - /// @return The underlying BSON array value. + /// Returns the underlying BSON array value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -130,7 +130,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_array&) get_array() const; /// - /// @return The underlying BSON binary data value. + /// Returns the underlying BSON binary data value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -138,7 +138,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_binary&) get_binary() const; /// - /// @return The underlying BSON undefined value. + /// Returns the underlying BSON undefined value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -146,7 +146,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_undefined&) get_undefined() const; /// - /// @return The underlying BSON ObjectId value. + /// Returns the underlying BSON ObjectId value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -154,7 +154,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_oid&) get_oid() const; /// - /// @return The underlying BSON boolean value. + /// Returns the underlying BSON boolean value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -162,7 +162,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_bool&) get_bool() const; /// - /// @return The underlying BSON date value. + /// Returns the underlying BSON date value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -170,7 +170,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_date&) get_date() const; /// - /// @return The underlying BSON null value. + /// Returns the underlying BSON null value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -178,7 +178,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_null&) get_null() const; /// - /// @return The underlying BSON regex value. + /// Returns the underlying BSON regex value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -186,7 +186,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_regex&) get_regex() const; /// - /// @return The underlying BSON DBPointer value. + /// Returns the underlying BSON DBPointer value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -194,7 +194,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_dbpointer&) get_dbpointer() const; /// - /// @return The underlying BSON JavaScript code value. + /// Returns the underlying BSON JavaScript code value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -202,7 +202,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_code&) get_code() const; /// - /// @return The underlying BSON symbol value. + /// Returns the underlying BSON symbol value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -210,7 +210,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_symbol&) get_symbol() const; /// - /// @return The underlying BSON JavaScript code with scope value. + /// Returns the underlying BSON JavaScript code with scope value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -218,7 +218,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_codewscope&) get_codewscope() const; /// - /// @return The underlying BSON 32-bit signed integer value. + /// Returns the underlying BSON 32-bit signed integer value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -226,7 +226,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_int32&) get_int32() const; /// - /// @return The underlying BSON replication timestamp value. + /// Returns the underlying BSON replication timestamp value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -234,7 +234,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_timestamp&) get_timestamp() const; /// - /// @return The underlying BSON 64-bit signed integer value. + /// Returns the underlying BSON 64-bit signed integer value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -242,7 +242,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_int64&) get_int64() const; /// - /// @return The underlying BSON Decimal128 value. + /// Returns the underlying BSON Decimal128 value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -250,7 +250,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_decimal128&) get_decimal128() const; /// - /// @return The underlying BSON min-key value. + /// Returns the underlying BSON min-key value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. @@ -258,7 +258,7 @@ class view { BSONCXX_ABI_EXPORT_CDECL(const b_minkey&) get_minkey() const; /// - /// @return The underlying BSON max-key value. + /// Returns the underlying BSON max-key value. /// /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. From 9834e16ff8a0dc529eadfcacae2686be6317c073 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 16:15:10 -0500 Subject: [PATCH 5/7] Replace use of BSONCXX_ENUM in public headers --- .../v_noabi/bsoncxx/exception/error_code.hpp | 62 +++++++++++++++---- .../bsoncxx/v_noabi/bsoncxx/types-fwd.hpp | 54 ++++++++++++---- .../include/bsoncxx/v_noabi/bsoncxx/types.hpp | 62 ++++++++++--------- .../bsoncxx/types/bson_value/value.hpp | 39 ++++++++---- .../v_noabi/bsoncxx/types/bson_value/view.hpp | 44 ++++++++----- .../v_noabi/bsoncxx/types/bson_value/view.cpp | 4 +- 6 files changed, 180 insertions(+), 85 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/error_code.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/error_code.hpp index f330f82c41..6bc49dc45f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/error_code.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/error_code.hpp @@ -43,11 +43,30 @@ enum class error_code : std::int32_t { /// A document operation was performed while building an array. k_cannot_perform_document_operation_on_array, -// @cond DOXYGEN_DISABLE -#define BSONCXX_ENUM(name, value) k_need_element_type_k_##name, -#include -#undef BSONCXX_ENUM - // @endcond DOXYGEN_DISABLE + /// The underlying value does not have the requested type. + /// @{ + k_need_element_type_k_double, + k_need_element_type_k_string, + k_need_element_type_k_document, + k_need_element_type_k_array, + k_need_element_type_k_binary, + k_need_element_type_k_undefined, + k_need_element_type_k_oid, + k_need_element_type_k_bool, + k_need_element_type_k_date, + k_need_element_type_k_null, + k_need_element_type_k_regex, + k_need_element_type_k_dbpointer, + k_need_element_type_k_code, + k_need_element_type_k_symbol, + k_need_element_type_k_codewscope, + k_need_element_type_k_int32, + k_need_element_type_k_timestamp, + k_need_element_type_k_int64, + k_need_element_type_k_decimal128, + k_need_element_type_k_maxkey, + k_need_element_type_k_minkey, + /// @} /// No key was provided when one was needed. k_need_key, @@ -97,13 +116,32 @@ enum class error_code : std::int32_t { /// Invalid type. k_invalid_bson_type_id, -// @cond DOXYGEN_DISABLE -#define BSONCXX_ENUM(name, value) k_cannot_append_##name, -#include -#undef BSONCXX_ENUM - // @endcond DOXYGEN_DISABLE - - /// A value failed to append. + /// Failed to append a value of the given type. + /// @{ + k_cannot_append_double, + k_cannot_append_string, + k_cannot_append_document, + k_cannot_append_array, + k_cannot_append_binary, + k_cannot_append_undefined, + k_cannot_append_oid, + k_cannot_append_bool, + k_cannot_append_date, + k_cannot_append_null, + k_cannot_append_regex, + k_cannot_append_dbpointer, + k_cannot_append_code, + k_cannot_append_symbol, + k_cannot_append_codewscope, + k_cannot_append_int32, + k_cannot_append_timestamp, + k_cannot_append_int64, + k_cannot_append_decimal128, + k_cannot_append_maxkey, + k_cannot_append_minkey, + /// @} + + /// Failed to append a value of the given type. k_cannot_append_utf8 = k_cannot_append_string, /// @deprecated Use `k_need_element_type_k_string` instead. diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp index 0e4e29c01c..a10023ab8f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp @@ -31,12 +31,27 @@ namespace bsoncxx { namespace v_noabi { namespace types { -#pragma push_macro("BSONCXX_ENUM") -#undef BSONCXX_ENUM -#define BSONCXX_ENUM(name, val) struct b_##name; -#include -#undef BSONCXX_ENUM -#pragma pop_macro("BSONCXX_ENUM") +struct b_double; +struct b_string; +struct b_document; +struct b_array; +struct b_binary; +struct b_undefined; +struct b_oid; +struct b_bool; +struct b_date; +struct b_null; +struct b_regex; +struct b_dbpointer; +struct b_code; +struct b_symbol; +struct b_codewscope; +struct b_int32; +struct b_timestamp; +struct b_int64; +struct b_decimal128; +struct b_maxkey; +struct b_minkey; } // namespace types } // namespace v_noabi @@ -52,12 +67,27 @@ using ::bsoncxx::v_noabi::type; namespace bsoncxx { namespace types { -#pragma push_macro("BSONCXX_ENUM") -#undef BSONCXX_ENUM -#define BSONCXX_ENUM(name, val) using ::bsoncxx::v_noabi::types::b_##name; -#include -#undef BSONCXX_ENUM -#pragma pop_macro("BSONCXX_ENUM") +using ::bsoncxx::v_noabi::types::b_double; +using ::bsoncxx::v_noabi::types::b_string; +using ::bsoncxx::v_noabi::types::b_document; +using ::bsoncxx::v_noabi::types::b_array; +using ::bsoncxx::v_noabi::types::b_binary; +using ::bsoncxx::v_noabi::types::b_undefined; +using ::bsoncxx::v_noabi::types::b_oid; +using ::bsoncxx::v_noabi::types::b_bool; +using ::bsoncxx::v_noabi::types::b_date; +using ::bsoncxx::v_noabi::types::b_null; +using ::bsoncxx::v_noabi::types::b_regex; +using ::bsoncxx::v_noabi::types::b_dbpointer; +using ::bsoncxx::v_noabi::types::b_code; +using ::bsoncxx::v_noabi::types::b_symbol; +using ::bsoncxx::v_noabi::types::b_codewscope; +using ::bsoncxx::v_noabi::types::b_int32; +using ::bsoncxx::v_noabi::types::b_timestamp; +using ::bsoncxx::v_noabi::types::b_int64; +using ::bsoncxx::v_noabi::types::b_decimal128; +using ::bsoncxx::v_noabi::types::b_maxkey; +using ::bsoncxx::v_noabi::types::b_minkey; } // namespace types } // namespace bsoncxx diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp index 3995532974..b144b74044 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp @@ -29,9 +29,6 @@ #include -#pragma push_macro("BSONCXX_ENUM") -#undef BSONCXX_ENUM - BSONCXX_PUSH_WARNINGS(); BSONCXX_DISABLE_WARNING(GNU("-Wfloat-equal")); @@ -40,36 +37,46 @@ namespace v_noabi { /// /// An enumeration of each BSON type. -/// These x-macros will expand to be of the form: -/// k_double = 0x01, -/// k_string = 0x02, -/// k_document = 0x03, -/// k_array = 0x04 ... /// enum class type : std::uint8_t { -#define BSONCXX_ENUM(name, val) k_##name = val, -#include -#undef BSONCXX_ENUM - k_utf8 = 0x02, + k_double = 0x01, ///< 64-bit binary floating point. + k_string = 0x02, ///< UTF-8 string. + k_utf8 = 0x02, ///< Equivalent to @ref k_string. @deprecated + k_document = 0x03, ///< Embedded document. + k_array = 0x04, ///< Array. + k_binary = 0x05, ///< Binary data. + k_undefined = 0x06, ///< Undefined value. @deprecated + k_oid = 0x07, ///< ObjectId. + k_bool = 0x08, ///< Boolean. + k_date = 0x09, ///< UTC datetime. + k_null = 0x0A, ///< Null value. + k_regex = 0x0B, ///< Regular expression. + k_dbpointer = 0x0C, ///< DBPointer. @deprecated + k_code = 0x0D, ///< JavaScript code. + k_symbol = 0x0E, ///< Symbol. @deprecated + k_codewscope = 0x0F, ///< JavaScript code with scope. + k_int32 = 0x10, ///< 32-bit integer. + k_timestamp = 0x11, ///< Timestamp. + k_int64 = 0x12, ///< 64-bit integer. + k_decimal128 = 0x13, ///< 128-bit decimal floating point. + k_maxkey = 0x7F, ///< Min key. + k_minkey = 0xFF, ///< Max key. }; /// /// An enumeration of each BSON binary sub type. -/// These x-macros will expand to be of the form: -/// k_binary = 0x00, -/// k_function = 0x01, -/// k_binary_deprecated = 0x02, -/// k_uuid_deprecated = 0x03, -/// k_uuid = 0x04, -/// k_md5 = 0x05, -/// k_encrypted = 0x06, -/// k_column = 0x07, -/// k_user = 0x80 /// enum class binary_sub_type : std::uint8_t { -#define BSONCXX_ENUM(name, val) k_##name = val, -#include -#undef BSONCXX_ENUM + k_binary = 0x00, ///< Generic binary subtype. + k_function = 0x01, ///< Function. + k_binary_deprecated = 0x02, ///< Binary (Old). @deprecated + k_uuid_deprecated = 0x03, ///< UUID (Old). @deprecated + k_uuid = 0x04, ///< UUID. + k_md5 = 0x05, ///< MD5. + k_encrypted = 0x06, ///< Encrypted BSON value. + k_column = 0x07, ///< Compressed BSON column. + k_sensitive = 0x08, ///< Sensitive. + k_user = 0x80, ///< User defined. }; /// @@ -871,11 +878,6 @@ using ::bsoncxx::v_noabi::types::operator!=; } // namespace types } // namespace bsoncxx -#ifdef BSONCXX_ENUM -static_assert(false, "BSONCXX_ENUM must be undef'ed"); -#endif -#pragma pop_macro("BSONCXX_ENUM") - #include /// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp index f14006005f..52a0ba2f6f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value.hpp @@ -46,18 +46,33 @@ namespace bson_value { /// class value { public: -/// -/// Constructor for each BSON type. -/// -/// These x-macros will expand to: -/// value(b_double v); -/// value(b_string v); -/// value(b_document v); -/// value(b_array v); ... -/// -#define BSONCXX_ENUM(name, val) BSONCXX_ABI_EXPORT_CDECL() value(b_##name v); -#include -#undef BSONCXX_ENUM + /// + /// Construct a bson_value::value from the provided BSON type. + /// + /// @{ + BSONCXX_ABI_EXPORT_CDECL() value(b_double v); + BSONCXX_ABI_EXPORT_CDECL() value(b_string v); + BSONCXX_ABI_EXPORT_CDECL() value(b_document v); + BSONCXX_ABI_EXPORT_CDECL() value(b_array v); + BSONCXX_ABI_EXPORT_CDECL() value(b_binary v); + BSONCXX_ABI_EXPORT_CDECL() value(b_undefined v); + BSONCXX_ABI_EXPORT_CDECL() value(b_oid v); + BSONCXX_ABI_EXPORT_CDECL() value(b_bool v); + BSONCXX_ABI_EXPORT_CDECL() value(b_date v); + BSONCXX_ABI_EXPORT_CDECL() value(b_null); + BSONCXX_ABI_EXPORT_CDECL() value(b_regex v); + BSONCXX_ABI_EXPORT_CDECL() value(b_dbpointer v); + BSONCXX_ABI_EXPORT_CDECL() value(b_code v); + BSONCXX_ABI_EXPORT_CDECL() value(b_symbol v); + BSONCXX_ABI_EXPORT_CDECL() value(b_codewscope v); + BSONCXX_ABI_EXPORT_CDECL() value(b_int32 v); + BSONCXX_ABI_EXPORT_CDECL() value(b_timestamp v); + BSONCXX_ABI_EXPORT_CDECL() value(b_int64 v); + BSONCXX_ABI_EXPORT_CDECL() value(b_decimal128 v); + BSONCXX_ABI_EXPORT_CDECL() value(b_maxkey v); + BSONCXX_ABI_EXPORT_CDECL() value(b_minkey v); + /// @} + /// /// /// Constructs a BSON UTF-8 string value. diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp index e54ea06648..4c10d5212f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.hpp @@ -40,23 +40,33 @@ namespace bson_value { /// class view { public: -/// -/// Construct a bson_value::view from any of the various BSON types. Defines -/// constructors of the following form for each type: -/// -/// explicit view(type) noexcept; -/// -/// Like this: -/// -/// explicit view(b_double) noexcept; -/// explicit view(b_string) noexcept; -/// explicit view(b_bool) noexcept; -/// -/// etc. -/// -#define BSONCXX_ENUM(type, val) explicit BSONCXX_ABI_EXPORT_CDECL() view(b_##type) noexcept; -#include -#undef BSONCXX_ENUM + /// + /// Construct a bson_value::view from the provided BSON type. + /// + /// @{ + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_double v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_string v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_document v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_array v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_binary v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_undefined v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_oid v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_bool v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_date v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_null v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_regex v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_dbpointer v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_code v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_symbol v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_codewscope v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_int32 v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_timestamp v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_int64 v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_decimal128 v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_maxkey v) noexcept; + explicit BSONCXX_ABI_EXPORT_CDECL() view(b_minkey v) noexcept; + /// @} + /// /// /// Default constructs a bson_value::view. The resulting view will be initialized diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp index ca16017d83..70ff71c563 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp @@ -46,8 +46,8 @@ view::view() noexcept : view(nullptr) {} // so we can't rely on automatic noexcept propagation. It really is though, so it is OK. #if !defined(BSONCXX_POLY_USE_BOOST) #define BSONCXX_ENUM(name, val) \ - view::view(b_##name value) noexcept \ - : _type(static_cast(val)), _b_##name(std::move(value)) { \ + view::view(b_##name v) noexcept \ + : _type(static_cast(val)), _b_##name(std::move(v)) { \ static_assert(std::is_nothrow_copy_constructible::value, "Copy may throw"); \ static_assert(std::is_nothrow_copy_assignable::value, "Copy may throw"); \ static_assert(std::is_nothrow_destructible::value, "Destruction may throw"); \ From 23ae4f5cb3e0b2607725a6b6f354858afa21537e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 16:45:31 -0500 Subject: [PATCH 6/7] Use \showenumvalues instead of SHOW_ENUM_VALUES --- Doxyfile | 2 +- src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index 34b2b2b9ab..646a652f00 100644 --- a/Doxyfile +++ b/Doxyfile @@ -1726,7 +1726,7 @@ FULL_SIDEBAR = NO # Minimum value: 0, maximum value: 20, default value: 4. # This tag requires that the tag GENERATE_HTML is set to YES. -ENUM_VALUES_PER_LINE = 1 +ENUM_VALUES_PER_LINE = 0 # If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used # to set the initial width (in pixels) of the frame in which the tree is shown. diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp index b144b74044..37cbeacf21 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp @@ -38,6 +38,8 @@ namespace v_noabi { /// /// An enumeration of each BSON type. /// +/// @showenumvalues +/// enum class type : std::uint8_t { k_double = 0x01, ///< 64-bit binary floating point. k_string = 0x02, ///< UTF-8 string. @@ -66,6 +68,8 @@ enum class type : std::uint8_t { /// /// An enumeration of each BSON binary sub type. /// +/// @showenumvalues +/// enum class binary_sub_type : std::uint8_t { k_binary = 0x00, ///< Generic binary subtype. k_function = 0x01, ///< Function. From 20139d2a6626ffd1c43367ad4a35b656ac48966d Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Mon, 16 Sep 2024 11:15:22 -0500 Subject: [PATCH 7/7] Formatting --- .../bsoncxx/v_noabi/bsoncxx/types-fwd.hpp | 24 +++++++++---------- .../v_noabi/bsoncxx/types/bson_value/view.cpp | 4 ++-- 2 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp index a10023ab8f..f6666ba767 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types-fwd.hpp @@ -67,27 +67,27 @@ using ::bsoncxx::v_noabi::type; namespace bsoncxx { namespace types { -using ::bsoncxx::v_noabi::types::b_double; -using ::bsoncxx::v_noabi::types::b_string; -using ::bsoncxx::v_noabi::types::b_document; using ::bsoncxx::v_noabi::types::b_array; using ::bsoncxx::v_noabi::types::b_binary; -using ::bsoncxx::v_noabi::types::b_undefined; -using ::bsoncxx::v_noabi::types::b_oid; using ::bsoncxx::v_noabi::types::b_bool; -using ::bsoncxx::v_noabi::types::b_date; -using ::bsoncxx::v_noabi::types::b_null; -using ::bsoncxx::v_noabi::types::b_regex; -using ::bsoncxx::v_noabi::types::b_dbpointer; using ::bsoncxx::v_noabi::types::b_code; -using ::bsoncxx::v_noabi::types::b_symbol; using ::bsoncxx::v_noabi::types::b_codewscope; +using ::bsoncxx::v_noabi::types::b_date; +using ::bsoncxx::v_noabi::types::b_dbpointer; +using ::bsoncxx::v_noabi::types::b_decimal128; +using ::bsoncxx::v_noabi::types::b_document; +using ::bsoncxx::v_noabi::types::b_double; using ::bsoncxx::v_noabi::types::b_int32; -using ::bsoncxx::v_noabi::types::b_timestamp; using ::bsoncxx::v_noabi::types::b_int64; -using ::bsoncxx::v_noabi::types::b_decimal128; using ::bsoncxx::v_noabi::types::b_maxkey; using ::bsoncxx::v_noabi::types::b_minkey; +using ::bsoncxx::v_noabi::types::b_null; +using ::bsoncxx::v_noabi::types::b_oid; +using ::bsoncxx::v_noabi::types::b_regex; +using ::bsoncxx::v_noabi::types::b_string; +using ::bsoncxx::v_noabi::types::b_symbol; +using ::bsoncxx::v_noabi::types::b_timestamp; +using ::bsoncxx::v_noabi::types::b_undefined; } // namespace types } // namespace bsoncxx diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp index 70ff71c563..a7eefe8e7a 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types/bson_value/view.cpp @@ -46,8 +46,8 @@ view::view() noexcept : view(nullptr) {} // so we can't rely on automatic noexcept propagation. It really is though, so it is OK. #if !defined(BSONCXX_POLY_USE_BOOST) #define BSONCXX_ENUM(name, val) \ - view::view(b_##name v) noexcept \ - : _type(static_cast(val)), _b_##name(std::move(v)) { \ + view::view(b_##name v) noexcept \ + : _type(static_cast(val)), _b_##name(std::move(v)) { \ static_assert(std::is_nothrow_copy_constructible::value, "Copy may throw"); \ static_assert(std::is_nothrow_copy_assignable::value, "Copy may throw"); \ static_assert(std::is_nothrow_destructible::value, "Destruction may throw"); \