From d64c46b1d9d657538d6b4625425133a17baf9f78 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:34 -0500 Subject: [PATCH 01/28] Restrict macro guard tests to public headers --- src/bsoncxx/test/CMakeLists.txt | 3 --- src/mongocxx/test/CMakeLists.txt | 7 ++----- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index 603c25e665..4807464bfa 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -125,14 +125,11 @@ if(ENABLE_MACRO_GUARD_TESTS) BSONCXX_RETURNS INCLUDE_PATTERNS "include/*.hpp" # Public headers. - "lib/*.hh" # Private headers. - "test/*.hh" # Test headers. EXCLUDE_REGEXES "include/bsoncxx/doc\.hpp" # Doc header. "(include|lib)/.*/(prelude|postlude)\.(hpp|hh)" # Macro guard headers. "(include|lib)/bsoncxx/v_noabi/bsoncxx/config/.*" # v_noabi config headers. "include/bsoncxx/v_noabi/bsoncxx/enums/.*" # v_noabi X-macro headers. - ".*_symbols.hh" # Symbol headers. ) endif() diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index 75ae1b47d8..b1e59dd662 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -308,13 +308,10 @@ if(ENABLE_MACRO_GUARD_TESTS) MONGOCXX_COMPILER_VERSION INCLUDE_PATTERNS "include/*.hpp" # Public headers. - "lib/*.hh" # Private headers. - "test/*.hh" # Test headers. EXCLUDE_REGEXES "include/mongocxx/doc\.hpp" # Doc header. - "(include|lib)/.*/(prelude|postlude)\.(hpp|hh)" # Macro guard headers. - "(include|lib)/mongocxx/v_noabi/mongocxx/config/.*" # v_noabi config headers. - ".*_symbols.hh" # Symbol headers. + "include/.*/(prelude|postlude)\.(hpp|hh)" # Macro guard headers. + "include/mongocxx/v_noabi/mongocxx/config/.*" # v_noabi config headers. ) endif() From 5115f98e2d5b965264d7039287f5e59f04a2af70 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:34 -0500 Subject: [PATCH 02/28] Redefine export header macros in terms of ABI visibility --- Doxyfile | 31 +++++++++----- src/bsoncxx/CMakeLists.txt | 24 +++++++++-- .../v_noabi/bsoncxx/config/compiler.hpp | 7 +++- .../v_noabi/bsoncxx/config/postlude.hpp | 20 ++++------ .../v_noabi/bsoncxx/config/prelude.hpp | 21 +++++----- .../include/bsoncxx/v_noabi/bsoncxx/fwd.hpp | 40 +++++++++++++++++-- .../bsoncxx/v_noabi/bsoncxx/private/itoa.hh | 2 +- .../bsoncxx/test_util/export_for_testing.hh | 10 +++-- src/bsoncxx/test/CMakeLists.txt | 30 ++++++++++---- src/mongocxx/CMakeLists.txt | 27 +++++++++++-- .../v_noabi/mongocxx/config/compiler.hpp | 14 +++---- .../v_noabi/mongocxx/config/postlude.hpp | 18 ++++----- .../v_noabi/mongocxx/config/prelude.hpp | 17 +++++--- .../include/mongocxx/v_noabi/mongocxx/fwd.hpp | 40 +++++++++++++++++-- .../v_noabi/mongocxx/private/conversions.hh | 6 +-- .../v_noabi/mongocxx/private/libbson.hh | 2 +- .../v_noabi/mongocxx/private/libmongoc.hh | 2 +- .../mongocxx/private/numeric_casting.hh | 12 ++---- .../mongocxx/test_util/export_for_testing.hh | 8 ++-- src/mongocxx/test/CMakeLists.txt | 30 ++++++++++---- 20 files changed, 250 insertions(+), 111 deletions(-) diff --git a/Doxyfile b/Doxyfile index 8cd235ec4f..1615cf618a 100644 --- a/Doxyfile +++ b/Doxyfile @@ -2417,15 +2417,9 @@ INCLUDE_FILE_PATTERNS = # recursively expanded use the := operator instead of the = operator. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -PREDEFINED = BSONCXX_API= \ - BSONCXX_CALL= \ - BSONCXX_DEPRECATED \ - BSONCXX_INLINE=inline \ +PREDEFINED = BSONCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \ BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR= \ - MONGOCXX_API= \ - MONGOCXX_CALL= \ - MONGOCXX_DEPRECATED= \ - MONGOCXX_INLINE=inline \ + MONGOCXX_ABI_EXPORT_CDECL(...)=__VA_ARGS__ \ MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR= # If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this @@ -2435,7 +2429,26 @@ PREDEFINED = BSONCXX_API= \ # definition found in the source code. # This tag requires that the tag ENABLE_PREPROCESSING is set to YES. -EXPAND_AS_DEFINED = +EXPAND_AS_DEFINED = BSONCXX_ABI_CDECL \ + BSONCXX_ABI_EXPORT \ + BSONCXX_ABI_NO_EXPORT \ + BSONCXX_API \ + BSONCXX_CALL \ + BSONCXX_DEPRECATED \ + BSONCXX_DEPRECATED_EXPORT \ + BSONCXX_DEPRECATED_NO_EXPORT \ + BSONCXX_INLINE \ + BSONCXX_PRIVATE \ + MONGOCXX_ABI_CDECL \ + MONGOCXX_ABI_EXPORT \ + MONGOCXX_ABI_NO_EXPORT \ + MONGOCXX_API \ + MONGOCXX_CALL \ + MONGOCXX_DEPRECATED \ + MONGOCXX_DEPRECATED_EXPORT \ + MONGOCXX_DEPRECATED_NO_EXPORT \ + MONGOCXX_INLINE \ + MONGOCXX_PRIVATE # If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will # remove all references to function-like macros that are alone on a line, have diff --git a/src/bsoncxx/CMakeLists.txt b/src/bsoncxx/CMakeLists.txt index 37ae0c214f..d7ec5c316d 100644 --- a/src/bsoncxx/CMakeLists.txt +++ b/src/bsoncxx/CMakeLists.txt @@ -154,12 +154,30 @@ endif() # Generate and install the export header. if(1) function(bsoncxx_install_export_header TARGET) + set(bsoncxx_export_header_custom_content "") + string(APPEND bsoncxx_export_header_custom_content + "\n" + "#if defined(_MSC_VER)\n" + "#define BSONCXX_ABI_CDECL __cdecl\n" + "#else\n" + "#define BSONCXX_ABI_CDECL\n" + "#endif\n" + "\n" + "#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL\n" + "\n" + "// For backward compatibility. Use BSONCXX_ABI_EXPORT_CDECL instead.\n" + "#define BSONCXX_API BSONCXX_ABI_EXPORT\n" + "\n" + "// For backward compatibility. Use BSONCXX_ABI_NO_EXPORT instead.\n" + "#define BSONCXX_PRIVATE BSONCXX_ABI_NO_EXPORT\n" + ) generate_export_header(${TARGET} - BASE_NAME BSONCXX - EXPORT_MACRO_NAME BSONCXX_API - NO_EXPORT_MACRO_NAME BSONCXX_PRIVATE + BASE_NAME BSONCXX_ABI + EXPORT_MACRO_NAME BSONCXX_ABI_EXPORT + DEPRECATED_MACRO_NAME BSONCXX_DEPRECATED EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/bsoncxx/v_noabi/bsoncxx/config/export.hpp STATIC_DEFINE BSONCXX_STATIC + CUSTOM_CONTENT_FROM_VARIABLE bsoncxx_export_header_custom_content ) install(FILES diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp index bb479a3870..ad47bbcfc7 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp @@ -42,8 +42,11 @@ BSONCXX_PUSH_WARNINGS(); BSONCXX_DISABLE_WARNING(MSVC(4251)); BSONCXX_DISABLE_WARNING(MSVC(5275)); -#define BSONCXX_INLINE inline BSONCXX_PRIVATE -#define BSONCXX_CALL BSONCXX_IF_MSVC(__cdecl) +// For backward compatibility. Use `inline` instead. +#define BSONCXX_INLINE inline BSONCXX_ABI_NO_EXPORT + +// For backward compatibility. Use BSONCXX_ABI_EXPORT_CDECL instead. +#define BSONCXX_CALL BSONCXX_ABI_CDECL /// /// @file diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp index 5c09d5f241..17e1035c29 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp @@ -46,22 +46,16 @@ BSONCXX_POP_WARNINGS(); #pragma pop_macro("BSONCXX_VERSION_PATCH") // export.hpp (generated by CMake) -#undef BSONCXX_API_H -#pragma pop_macro("BSONCXX_API_H") -#undef BSONCXX_API +#pragma pop_macro("BSONCXX_ABI_EXPORT_H") +#if !defined(BSONCXX_ABI_EXPORT_H) +#pragma pop_macro("BSONCXX_ABI_EXPORT") +#pragma pop_macro("BSONCXX_ABI_NO_EXPORT") +#pragma pop_macro("BSONCXX_ABI_CDECL") +#pragma pop_macro("BSONCXX_ABI_EXPORT_CDECL") #pragma pop_macro("BSONCXX_API") -#undef BSONCXX_PRIVATE #pragma pop_macro("BSONCXX_PRIVATE") -#undef BSONCXX_DEPRECATED #pragma pop_macro("BSONCXX_DEPRECATED") -#undef BSONCXX_DEPRECATED_EXPORT -#pragma pop_macro("BSONCXX_DEPRECATED_EXPORT") -#undef BSONCXX_DEPRECATED_NO_EXPORT -#pragma pop_macro("BSONCXX_DEPRECATED_NO_EXPORT") -#undef DEFINE_NO_DEPRECATED -#pragma pop_macro("DEFINE_NO_DEPRECATED") -#undef BSONCXX_NO_DEPRECATED -#pragma pop_macro("BSONCXX_NO_DEPRECATED") +#endif // prelude.hpp #undef BSONCXX_UNREACHABLE diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp index cbf9adca6d..23d8bb10f8 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp @@ -89,22 +89,23 @@ #undef BSONCXX_VERSION_PATCH // export.hpp (generated by CMake) -#pragma push_macro("BSONCXX_API_H") -#undef BSONCXX_API_H +#pragma push_macro("BSONCXX_ABI_EXPORT_H") +#if !defined(BSONCXX_ABI_EXPORT_H) +#pragma push_macro("BSONCXX_ABI_EXPORT") +#undef BSONCXX_ABI_EXPORT +#pragma push_macro("BSONCXX_ABI_NO_EXPORT") +#undef BSONCXX_ABI_NO_EXPORT +#pragma push_macro("BSONCXX_ABI_CDECL") +#undef BSONCXX_ABI_CDECL +#pragma push_macro("BSONCXX_ABI_EXPORT_CDECL") +#undef BSONCXX_ABI_EXPORT_CDECL #pragma push_macro("BSONCXX_API") #undef BSONCXX_API #pragma push_macro("BSONCXX_PRIVATE") #undef BSONCXX_PRIVATE #pragma push_macro("BSONCXX_DEPRECATED") #undef BSONCXX_DEPRECATED -#pragma push_macro("BSONCXX_DEPRECATED_EXPORT") -#undef BSONCXX_DEPRECATED_EXPORT -#pragma push_macro("BSONCXX_DEPRECATED_NO_EXPORT") -#undef BSONCXX_DEPRECATED_NO_EXPORT -#pragma push_macro("DEFINE_NO_DEPRECATED") -#undef DEFINE_NO_DEPRECATED -#pragma push_macro("BSONCXX_NO_DEPRECATED") -#undef BSONCXX_NO_DEPRECATED +#endif #include // diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp index 7d9e7a2706..4617582938 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/fwd.hpp @@ -198,7 +198,39 @@ /// /// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Declares the associated entity as part of the ABI. +/// Exports the associated entity as part of the ABI. +/// +/// @warning For internal use only! +/// +#define BSONCXX_ABI_EXPORT + +/// +/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp +/// Excludes the associated entity from being part of the ABI. +/// +/// @warning For internal use only! +/// +#define BSONCXX_ABI_NO_EXPORT + +/// +/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp +/// Expands to `__cdecl` when built with MSVC on Windows. +/// +/// @warning For internal use only! +/// +#define BSONCXX_ABI_CDECL + +/// +/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp +/// Equivalent to @ref BSONCXX_ABI_EXPORT with @ref BSONCXX_ABI_CDECL. +/// +/// @warning For internal use only! +/// +#define BSONCXX_ABI_EXPORT_CDECL(...) BSONCXX_ABI_EXPORT __VA_ARGS__ BSONCXX_ABI_CDECL + +/// +/// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp +/// Equivalent to @ref BSONCXX_ABI_EXPORT. /// /// @warning For internal use only! /// @@ -208,11 +240,11 @@ /// only!" warnings). See [API and ABI /// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/). /// -#define BSONCXX_API +#define BSONCXX_API BSONCXX_ABI_EXPORT /// /// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp -/// Excludes the associated entity from being part of the ABI. +/// Equivalent to `inline` with @ref BSONCXX_ABI_NO_EXPORT. /// /// @warning For internal use only! /// @@ -222,7 +254,7 @@ /// absence of documentation, etc.). See [API and ABI /// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/). /// -#define BSONCXX_PRIVATE +#define BSONCXX_PRIVATE inline BSONCXX_ABI_NO_EXPORT /// /// @ingroup bsoncxx-v_noabi-bsoncxx-config-export-hpp diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh index cd85490e47..9d7d15f97a 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh @@ -23,7 +23,7 @@ namespace bsoncxx { -class BSONCXX_TEST_API itoa { +class BSONCXX_ABI_EXPORT_TESTING itoa { public: explicit itoa(uint32_t i = 0); diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh index a13a5de9d5..daeda50ae9 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh @@ -16,15 +16,17 @@ #include -// The BSONCXX_TEST_API macro is intended to be used for exporting symbols for testing which are not +// The BSONCXX_TESTING macro is intended to be used for exporting symbols for testing which are not // normally exported as part of the bsoncxx library. We currently use this workaround in lieu of // linking standalone unit tests, in order to expose private symbols for unit testing when we build // the shared library. -#ifdef BSONCXX_TESTING -#define BSONCXX_TEST_API BSONCXX_API +#if defined(BSONCXX_TESTING) +#define BSONCXX_ABI_EXPORT_TESTING BSONCXX_ABI_EXPORT +#define BSONCXX_ABI_EXPORT_CDECL_TESTING(...) BSONCXX_ABI_EXPORT_CDECL(__VA_ARGS__) #else -#define BSONCXX_TEST_API +#define BSONCXX_ABI_EXPORT_TESTING +#define BSONCXX_ABI_EXPORT_CDECL_TESTING(...) __VA_ARGS__ #endif #include diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index 4807464bfa..50bc2a33d5 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -80,29 +80,43 @@ if(ENABLE_MACRO_GUARD_TESTS) PROJECT_NAME bsoncxx PROJECT_TEST_PROPERTIES_TARGET bsoncxx::test_properties GUARDED_MACROS - BSONCXX_INLINE # compiler.hpp + # compiler.hpp + BSONCXX_INLINE BSONCXX_CALL - BSONCXX_INLINE_NAMESPACE_BEGIN # config.hpp (generated by CMake) + + # config.hpp (generated by CMake) + BSONCXX_INLINE_NAMESPACE_BEGIN BSONCXX_INLINE_NAMESPACE_END BSONCXX_POLY_USE_MNMLSTC BSONCXX_POLY_USE_SYSTEM_MNMLSTC BSONCXX_POLY_USE_BOOST BSONCXX_POLY_USE_IMPLS BSONCXX_POLY_USE_STD - BSONCXX_VERSION_EXTRA # version.hpp (generated by CMake) + + # version.hpp (generated by CMake) + BSONCXX_VERSION_EXTRA BSONCXX_VERSION_MAJOR BSONCXX_VERSION_MINOR BSONCXX_VERSION_PATCH - BSONCXX_API_H # export.hpp (generated by CMake) + + # export.hpp (generated by CMake) + BSONCXX_ABI_CDECL + BSONCXX_ABI_EXPORT + BSONCXX_ABI_EXPORT_TESTING + BSONCXX_ABI_NO_EXPORT + BSONCXX_ABI_EXPORT_CDECL + BSONCXX_ABI_EXPORT_CDECL_TESTING BSONCXX_API BSONCXX_PRIVATE BSONCXX_DEPRECATED BSONCXX_DEPRECATED_EXPORT BSONCXX_DEPRECATED_NO_EXPORT - DEFINE_NO_DEPRECATED - BSONCXX_NO_DEPRECATED - BSONCXX_UNREACHABLE # prelude.hpp - _bsoncxxDisableWarningImpl_for_GCC # util.hpp + + # prelude.hpp + BSONCXX_UNREACHABLE + + # util.hpp + _bsoncxxDisableWarningImpl_for_GCC _bsoncxxDisableWarningImpl_for_GNU _bsoncxxDisableWarningImpl_for_MSVC _bsoncxxDisableWarningImpl_for_Clang diff --git a/src/mongocxx/CMakeLists.txt b/src/mongocxx/CMakeLists.txt index 44dc5b4381..b0af93c04b 100644 --- a/src/mongocxx/CMakeLists.txt +++ b/src/mongocxx/CMakeLists.txt @@ -101,12 +101,33 @@ endif() # Generate and install the export header. if(1) function(mongocxx_install_export_header TARGET) + set(mongocxx_export_header_custom_content "") + string(APPEND mongocxx_export_header_custom_content + "\n" + "#if defined(_MSC_VER)\n" + "#define MONGOCXX_ABI_CDECL __cdecl\n" + "#else\n" + "#define MONGOCXX_ABI_CDECL\n" + "#endif\n" + "\n" + "#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL\n" + "\n" + "// For backward compatibility. Use MONGOCXX_ABI_EXPORT_CDECL instead.\n" + "#define MONGOCXX_API MONGOCXX_ABI_EXPORT\n" + "\n" + "// For backward compatibility. Use MONGOCXX_ABI_NO_EXPORT instead.\n" + "#define MONGOCXX_PRIVATE MONGOCXX_ABI_NO_EXPORT\n" + "\n" + "// Declare the entity as deprecated.\n" + "#define MONGOCXX_DEPRECATED MONGOCXX_ABI_DEPRECATED\n" + ) generate_export_header(${TARGET} - BASE_NAME MONGOCXX - EXPORT_MACRO_NAME MONGOCXX_API - NO_EXPORT_MACRO_NAME MONGOCXX_PRIVATE + BASE_NAME MONGOCXX_ABI + EXPORT_MACRO_NAME MONGOCXX_ABI_EXPORT + DEPRECATED_MACRO_NAME MONGOCXX_ABI_DEPRECATED EXPORT_FILE_NAME ${PROJECT_BINARY_DIR}/lib/mongocxx/v_noabi/mongocxx/config/export.hpp STATIC_DEFINE MONGOCXX_STATIC + CUSTOM_CONTENT_FROM_VARIABLE mongocxx_export_header_custom_content ) install(FILES diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp index c488777ed8..5c32336858 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp @@ -21,17 +21,13 @@ #pragma warning(push) #pragma warning(disable : 4251 4275) -#define MONGOCXX_INLINE inline MONGOCXX_PRIVATE - -#define MONGOCXX_CALL __cdecl - -#else - -#define MONGOCXX_INLINE inline MONGOCXX_PRIVATE +#endif -#define MONGOCXX_CALL +// For backward compatibility. Use `inline` instead. +#define MONGOCXX_INLINE inline MONGOCXX_ABI_NO_EXPORT -#endif +// For backward compatibility. Use MONGOCXX_ABI_EXPORT_CDECL instead. +#define MONGOCXX_CALL MONGOCXX_ABI_CDECL /// /// @file diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp index 873f44149a..eb5b5f30bc 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp @@ -40,22 +40,18 @@ #pragma pop_macro("MONGOCXX_VERSION_PATCH") // export.hpp (generated by CMake) -#undef MONGOCXX_API_H -#pragma pop_macro("MONGOCXX_API_H") -#undef MONGOCXX_API +#pragma pop_macro("MONGOCXX_ABI_EXPORT_H") +#if !defined(MONGOCXX_ABI_EXPORT_H) +#pragma pop_macro("MONGOCXX_ABI_EXPORT") +#pragma pop_macro("MONGOCXX_ABI_NO_EXPORT") +#pragma pop_macro("MONGOCXX_ABI_CDECL") +#pragma pop_macro("MONGOCXX_ABI_EXPORT_CDECL") #pragma pop_macro("MONGOCXX_API") -#undef MONGOCXX_PRIVATE #pragma pop_macro("MONGOCXX_PRIVATE") -#undef MONGOCXX_DEPRECATED #pragma pop_macro("MONGOCXX_DEPRECATED") -#undef MONGOCXX_DEPRECATED_EXPORT #pragma pop_macro("MONGOCXX_DEPRECATED_EXPORT") -#undef MONGOCXX_DEPRECATED_NO_EXPORT #pragma pop_macro("MONGOCXX_DEPRECATED_NO_EXPORT") -#undef DEFINE_NO_DEPRECATED -#pragma pop_macro("DEFINE_NO_DEPRECATED") -#undef MONGOCXX_NO_DEPRECATED -#pragma pop_macro("MONGOCXX_NO_DEPRECATED") +#endif // prelude.hpp #undef MONGOCXX_UNREACHABLE diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp index 6009b09b7f..d270b71cf3 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/prelude.hpp @@ -37,8 +37,16 @@ #undef MONGOCXX_VERSION_PATCH // export.hpp (generated by CMake) -#pragma push_macro("MONGOCXX_API_H") -#undef MONGOCXX_API_H +#pragma push_macro("MONGOCXX_ABI_EXPORT_H") +#if !defined(MONGOCXX_ABI_EXPORT_H) +#pragma push_macro("MONGOCXX_ABI_EXPORT") +#undef MONGOCXX_ABI_EXPORT +#pragma push_macro("MONGOCXX_ABI_NO_EXPORT") +#undef MONGOCXX_ABI_NO_EXPORT +#pragma push_macro("MONGOCXX_ABI_CDECL") +#undef MONGOCXX_ABI_CDECL +#pragma push_macro("MONGOCXX_ABI_EXPORT_CDECL") +#undef MONGOCXX_ABI_EXPORT_CDECL #pragma push_macro("MONGOCXX_API") #undef MONGOCXX_API #pragma push_macro("MONGOCXX_PRIVATE") @@ -49,10 +57,7 @@ #undef MONGOCXX_DEPRECATED_EXPORT #pragma push_macro("MONGOCXX_DEPRECATED_NO_EXPORT") #undef MONGOCXX_DEPRECATED_NO_EXPORT -#pragma push_macro("DEFINE_NO_DEPRECATED") -#undef DEFINE_NO_DEPRECATED -#pragma push_macro("MONGOCXX_NO_DEPRECATED") -#undef MONGOCXX_NO_DEPRECATED +#endif #include #include diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp index 761fec7bbc..bcd7495c81 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/fwd.hpp @@ -193,7 +193,39 @@ /// /// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Declares the associated entity as part of the ABI. +/// Exports the associated entity as part of the ABI. +/// +/// @warning For internal use only! +/// +#define MONGOCXX_ABI_EXPORT + +/// +/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp +/// Excludes the associated entity from being part of the ABI. +/// +/// @warning For internal use only! +/// +#define MONGOCXX_ABI_NO_EXPORT + +/// +/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp +/// Expands to `__cdecl` when built with MSVC on Windows. +/// +/// @warning For internal use only! +/// +#define MONGOCXX_ABI_CDECL + +/// +/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp +/// Equivalent to @ref MONGOCXX_ABI_EXPORT with @ref MONGOCXX_ABI_CDECL. +/// +/// @warning For internal use only! +/// +#define MONGOCXX_ABI_EXPORT_CDECL(...) MONGOCXX_ABI_EXPORT __VA_ARGS__ MONGOCXX_ABI_CDECL + +/// +/// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp +/// Equivalent to @ref MONGOCXX_ABI_EXPORT. /// /// @warning For internal use only! /// @@ -203,11 +235,11 @@ /// only!" warnings). See [API and ABI /// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/). /// -#define MONGOCXX_API +#define MONGOCXX_API MONGOCXX_ABI_EXPORT /// /// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp -/// Excludes the associated entity from being part of the ABI. +/// Equivalent to `inline` with @ref MONGOCXX_ABI_NO_EXPORT. /// /// @warning For internal use only! /// @@ -217,7 +249,7 @@ /// absence of documentation, etc.). See [API and ABI /// Versioning](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/api-abi-versioning/). /// -#define MONGOCXX_PRIVATE +#define MONGOCXX_PRIVATE inline MONGOCXX_ABI_NO_EXPORT /// /// @ingroup mongocxx-v_noabi-mongocxx-config-export-hpp diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/conversions.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/conversions.hh index da7e9e3a70..9d5f5d3c1d 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/conversions.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/conversions.hh @@ -24,11 +24,11 @@ namespace mongocxx { namespace libmongoc { namespace conversions { -MONGOCXX_TEST_API mongoc_read_mode_t +MONGOCXX_ABI_EXPORT_CDECL_TESTING(mongoc_read_mode_t) read_mode_t_from_read_mode(read_preference::read_mode read_mode); -MONGOCXX_TEST_API read_preference::read_mode read_mode_from_read_mode_t( - mongoc_read_mode_t read_mode); +MONGOCXX_ABI_EXPORT_CDECL_TESTING(read_preference::read_mode) +read_mode_from_read_mode_t(mongoc_read_mode_t read_mode); } // namespace conversions } // namespace libmongoc diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh index 693a4048f7..115bc3da10 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh @@ -45,7 +45,7 @@ namespace libbson { // not call init itself (expecting an already initialized bson_t) then init() could be called // instead. // -class MONGOCXX_TEST_API scoped_bson_t { +class MONGOCXX_ABI_EXPORT_TESTING scoped_bson_t { public: // // Constructs a new scoped_bson_t having a non-initialized internal bson_t. diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh index f431537b75..b02a45e49b 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh @@ -55,7 +55,7 @@ namespace libmongoc { #endif #define MONGOCXX_LIBMONGOC_SYMBOL(name) \ - extern MONGOCXX_TEST_API mongocxx::test_util::mock& name; + extern MONGOCXX_ABI_EXPORT_TESTING mongocxx::test_util::mock& name; #include "libmongoc_symbols.hh" #undef MONGOCXX_LIBMONGOC_SYMBOL diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/numeric_casting.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/numeric_casting.hh index 16e82dad68..b4da202ca7 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/numeric_casting.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/numeric_casting.hh @@ -26,26 +26,22 @@ namespace mongocxx { // size_t_to_int64_safe checks if @in is within the bounds of an int64_t. // If yes, it safely casts into @out and returns true. // If no, @out is not modified and returns false. -MONGOCXX_TEST_API -bool size_t_to_int64_safe(const std::size_t in, int64_t& out); +MONGOCXX_ABI_EXPORT_CDECL_TESTING(bool) size_t_to_int64_safe(const std::size_t in, int64_t& out); // int64_to_int32_safe checks if @in is within the bounds of an int32_t. // If yes, it safely casts into @out and returns true. // If no, @out is not modified and returns false. -MONGOCXX_TEST_API -bool int64_to_int32_safe(const int64_t in, int32_t& out); +MONGOCXX_ABI_EXPORT_CDECL_TESTING(bool) int64_to_int32_safe(const int64_t in, int32_t& out); // int32_to_size_t_safe checks if @in is within the bounds of an size_t. // If yes, it safely casts into @out and returns true. // If no, @out is not modified and returns false. -MONGOCXX_TEST_API -bool int32_to_size_t_safe(const int32_t in, std::size_t& out); +MONGOCXX_ABI_EXPORT_CDECL_TESTING(bool) int32_to_size_t_safe(const int32_t in, std::size_t& out); // int64_to_size_t_safe checks if @in is within the bounds of an size_t. // If yes, it safely casts into @out and returns true. // If no, @out is not modified and returns false. -MONGOCXX_TEST_API -bool int64_to_size_t_safe(const int64_t in, std::size_t& out); +MONGOCXX_ABI_EXPORT_CDECL_TESTING(bool) int64_to_size_t_safe(const int64_t in, std::size_t& out); } // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/export_for_testing.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/export_for_testing.hh index 45ac82e8a2..4a0d149113 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/export_for_testing.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/export_for_testing.hh @@ -19,10 +19,12 @@ // See src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/test_util/export_for_testing.hh for an explanation of // the purpose of this header. -#ifdef MONGOCXX_TESTING -#define MONGOCXX_TEST_API MONGOCXX_API +#if defined(MONGOCXX_TESTING) +#define MONGOCXX_ABI_EXPORT_TESTING MONGOCXX_ABI_EXPORT +#define MONGOCXX_ABI_EXPORT_CDECL_TESTING(...) MONGOCXX_ABI_EXPORT_CDECL(__VA_ARGS__) #else -#define MONGOCXX_TEST_API +#define MONGOCXX_ABI_EXPORT_TESTING +#define MONGOCXX_ABI_EXPORT_CDECL_TESTING(...) __VA_ARGS__ #endif #include diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index b1e59dd662..ac7aad8dae 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -285,25 +285,39 @@ if(ENABLE_MACRO_GUARD_TESTS) PROJECT_NAME mongocxx PROJECT_TEST_PROPERTIES_TARGET mongocxx::test_properties GUARDED_MACROS - MONGOCXX_INLINE # compiler.hpp + # compiler.hpp + MONGOCXX_INLINE MONGOCXX_CALL - MONGOCXX_INLINE_NAMESPACE_BEGIN # config.hpp (generated by CMake) + + # config.hpp (generated by CMake) + MONGOCXX_INLINE_NAMESPACE_BEGIN MONGOCXX_INLINE_NAMESPACE_END - MONGOCXX_VERSION_STRING # version.hpp (generated by CMake) + + # version.hpp (generated by CMake) + MONGOCXX_VERSION_STRING MONGOCXX_VERSION_EXTRA MONGOCXX_VERSION_MAJOR MONGOCXX_VERSION_MINOR MONGOCXX_VERSION_PATCH - MONGOCXX_API_H # export.hpp (generated by CMake) + + # export.hpp (generated by CMake) + MONGOCXX_ABI_CDECL + MONGOCXX_ABI_EXPORT + MONGOCXX_ABI_EXPORT_TESTING + MONGOCXX_ABI_EXPORT_CDECL + MONGOCXX_ABI_EXPORT_CDECL_TESTING + MONGOCXX_ABI_NO_EXPORT MONGOCXX_API MONGOCXX_PRIVATE MONGOCXX_DEPRECATED MONGOCXX_DEPRECATED_EXPORT MONGOCXX_DEPRECATED_NO_EXPORT - DEFINE_NO_DEPRECATED - MONGOCXX_NO_DEPRECATED - MONGOCXX_UNREACHABLE # prelude.hpp - MONGOCXX_ENABLE_SSL # config.hh (generated by CMake) + + # prelude.hpp + MONGOCXX_UNREACHABLE + + # config.hh (generated by CMake) + MONGOCXX_ENABLE_SSL MONGOCXX_COMPILER_ID MONGOCXX_COMPILER_VERSION INCLUDE_PATTERNS From 0f0fe4f3a5327dc30f3bf71af3272404b09086d9 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:35 -0500 Subject: [PATCH 03/28] Address -Wreserved-macro-identifier warnings in macro guard tests --- cmake/MacroGuardTest.cmake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cmake/MacroGuardTest.cmake b/cmake/MacroGuardTest.cmake index e7bee4c846..6ee74e54be 100644 --- a/cmake/MacroGuardTest.cmake +++ b/cmake/MacroGuardTest.cmake @@ -80,8 +80,8 @@ function(add_macro_guard_test) "static_assert(compare_equal(\"abc\", \"abc\"), \"compare_equal() sanity check failed\");\n" "static_assert(!compare_equal(\"abc\", \"def\"), \"compare_equal() sanity check failed\");\n" "\n" - "#define _TO_STR(x) #x\n" - "#define TO_STR(x) _TO_STR(x)\n" + "#define TO_STR_1(x) #x\n" + "#define TO_STR(x) TO_STR_1(x)\n" "\n" ) From bd81578d601bbf0316ac632af219e8f7894bd23e Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:35 -0500 Subject: [PATCH 04/28] Disable -Wunused-macros warning for macro guard tests --- cmake/MacroGuardTest.cmake | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/cmake/MacroGuardTest.cmake b/cmake/MacroGuardTest.cmake index 6ee74e54be..beb02a5ee9 100644 --- a/cmake/MacroGuardTest.cmake +++ b/cmake/MacroGuardTest.cmake @@ -88,6 +88,11 @@ function(add_macro_guard_test) add_library(test_${PARSED_PROJECT_NAME}_macro_guards STATIC EXCLUDE_FROM_ALL) target_link_libraries(test_${PARSED_PROJECT_NAME}_macro_guards PRIVATE ${PARSED_PROJECT_TEST_PROPERTIES_TARGET}) + # Avoid noisy warnings. + target_compile_options(test_${PARSED_PROJECT_NAME}_macro_guards PRIVATE + $<$:-Wno-unused-macros> + ) + # Test each header individually. foreach(header ${GUARDED_HEADERS}) set(MACRO_GUARD_TEST "${MACRO_GUARD_TEST_PRELUDE}") From 2ada79824a18ec66b675c40cfaf36b4f390d5d74 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:35 -0500 Subject: [PATCH 05/28] CXX-3093 Replace BSONCXX_API -> BSONCXX_ABI_EXPORT_CDECL --- .../v_noabi/bsoncxx/array/element-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/array/element.hpp | 20 +-- .../v_noabi/bsoncxx/array/value-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/array/value.hpp | 28 ++-- .../v_noabi/bsoncxx/array/view-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/array/view.hpp | 46 +++---- .../v_noabi/bsoncxx/builder/basic/array.hpp | 10 +- .../bsoncxx/builder/basic/document.hpp | 17 ++- .../v_noabi/bsoncxx/builder/basic/impl.hpp | 12 +- .../v_noabi/bsoncxx/builder/basic/kvp.hpp | 2 +- .../bsoncxx/builder/basic/sub_array.hpp | 6 +- .../bsoncxx/builder/basic/sub_document.hpp | 10 +- .../v_noabi/bsoncxx/builder/concatenate.hpp | 12 +- .../v_noabi/bsoncxx/builder/core-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/builder/core.hpp | 100 +++++++------- .../v_noabi/bsoncxx/builder/stream/array.hpp | 10 +- .../bsoncxx/builder/stream/array_context.hpp | 43 +++--- .../bsoncxx/builder/stream/document.hpp | 10 +- .../bsoncxx/builder/stream/helpers-fwd.hpp | 10 +- .../bsoncxx/builder/stream/key_context.hpp | 22 +-- .../bsoncxx/builder/stream/single_context.hpp | 16 +-- .../bsoncxx/builder/stream/value_context.hpp | 16 +-- .../v_noabi/bsoncxx/decimal128-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/decimal128.hpp | 12 +- .../v_noabi/bsoncxx/document/element-fwd.hpp | 2 +- .../v_noabi/bsoncxx/document/element.hpp | 86 ++++++------ .../v_noabi/bsoncxx/document/value-fwd.hpp | 2 +- .../v_noabi/bsoncxx/document/value.hpp | 60 ++++---- .../v_noabi/bsoncxx/document/view-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/document/view.hpp | 44 +++--- .../v_noabi/bsoncxx/exception/error_code.hpp | 4 +- .../bsoncxx/exception/exception-fwd.hpp | 2 +- .../include/bsoncxx/v_noabi/bsoncxx/json.hpp | 10 +- .../bsoncxx/v_noabi/bsoncxx/oid-fwd.hpp | 2 +- .../include/bsoncxx/v_noabi/bsoncxx/oid.hpp | 26 ++-- .../v_noabi/bsoncxx/string/to_string.hpp | 2 +- .../bsoncxx/string/view_or_value-fwd.hpp | 2 +- .../v_noabi/bsoncxx/string/view_or_value.hpp | 18 +-- .../bsoncxx/v_noabi/bsoncxx/types-fwd.hpp | 2 +- .../include/bsoncxx/v_noabi/bsoncxx/types.hpp | 128 +++++++++--------- .../bsoncxx/types/bson_value/make_value.hpp | 2 +- .../bsoncxx/types/bson_value/value-fwd.hpp | 2 +- .../bsoncxx/types/bson_value/value.hpp | 74 +++++----- .../bsoncxx/types/bson_value/view-fwd.hpp | 2 +- .../v_noabi/bsoncxx/types/bson_value/view.hpp | 82 +++++------ .../bsoncxx/v_noabi/bsoncxx/validate-fwd.hpp | 2 +- .../bsoncxx/v_noabi/bsoncxx/validate.hpp | 28 ++-- .../bsoncxx/v_noabi/bsoncxx/view_or_value.hpp | 40 +++--- .../bsoncxx/v_noabi/bsoncxx/array/element.cpp | 8 +- .../bsoncxx/v_noabi/bsoncxx/array/view.cpp | 8 +- .../bsoncxx/v_noabi/bsoncxx/decimal128.cpp | 4 +- .../v_noabi/bsoncxx/document/element.cpp | 8 +- .../bsoncxx/v_noabi/bsoncxx/document/view.cpp | 8 +- .../v_noabi/bsoncxx/exception/error_code.cpp | 2 +- .../lib/bsoncxx/v_noabi/bsoncxx/json.cpp | 6 +- .../lib/bsoncxx/v_noabi/bsoncxx/oid.cpp | 12 +- .../bsoncxx/v_noabi/bsoncxx/private/itoa.hh | 34 ++--- .../lib/bsoncxx/v_noabi/bsoncxx/types.cpp | 4 +- .../lib/bsoncxx/v_noabi/bsoncxx/validate.cpp | 10 +- 59 files changed, 563 insertions(+), 577 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element-fwd.hpp index 489fafcf51..527fd23f3d 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace array { -class BSONCXX_API element; +class element; } // namespace array } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element.hpp index 4f7ef2cfec..9988a7f93b 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element.hpp @@ -38,7 +38,7 @@ namespace array { /// class element : private document::element { public: - element(); + BSONCXX_ABI_EXPORT_CDECL() element(); using document::element::operator bool; @@ -80,12 +80,12 @@ class element : private document::element { private: friend ::bsoncxx::v_noabi::array::view; - BSONCXX_PRIVATE explicit element(const std::uint8_t* raw, - std::uint32_t length, - std::uint32_t offset, - std::uint32_t keylen); + explicit element(const std::uint8_t* raw, + std::uint32_t length, + std::uint32_t offset, + std::uint32_t keylen); - BSONCXX_PRIVATE explicit element(const stdx::string_view key); + explicit element(const stdx::string_view key); }; /// @@ -96,16 +96,16 @@ class element : private document::element { /// @{ /// @relatesalso bsoncxx::v_noabi::array::element -BSONCXX_API bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v); +BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const element& elem, const types::bson_value::view& v); /// @relatesalso bsoncxx::v_noabi::array::element -BSONCXX_API bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem); +BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const types::bson_value::view& v, const element& elem); /// @relatesalso bsoncxx::v_noabi::array::element -BSONCXX_API bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v); +BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const element& elem, const types::bson_value::view& v); /// @relatesalso bsoncxx::v_noabi::array::element -BSONCXX_API bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem); +BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const types::bson_value::view& v, const element& elem); /// @} /// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value-fwd.hpp index 6b2d0ad85e..531285572c 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace array { -class BSONCXX_API value; +class value; } // namespace array } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp index 2e39555faf..c168c6f742 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp @@ -50,7 +50,7 @@ class value { /// @param dtor /// A user provided deleter. /// - value(std::uint8_t* data, std::size_t length, deleter_type dtor); + BSONCXX_ABI_EXPORT_CDECL() value(std::uint8_t* data, std::size_t length, deleter_type dtor); /// /// Constructs a value from a std::unique_ptr to a buffer. The ownership @@ -61,7 +61,7 @@ class value { /// @param length /// The length of the document. /// - value(unique_ptr_type ptr, std::size_t length); + BSONCXX_ABI_EXPORT_CDECL() value(unique_ptr_type ptr, std::size_t length); /// /// Constructs a value from a view of an array. The data referenced @@ -71,10 +71,10 @@ class value { /// @param view /// A view of another array to copy. /// - explicit value(array::view view); + explicit BSONCXX_ABI_EXPORT_CDECL() value(array::view view); - value(const value&); - value& operator=(const value&); + BSONCXX_ABI_EXPORT_CDECL() value(const value&); + BSONCXX_ABI_EXPORT_CDECL(value&) operator=(const value&); value(value&&) = default; value& operator=(value&&) = default; @@ -82,14 +82,18 @@ class value { /// /// Get a view over the document owned by this value. /// - BSONCXX_INLINE array::view view() const noexcept; + array::view view() const noexcept { + return array::view{static_cast(_data.get()), _length}; + } /// /// Conversion operator that provides a view given a value. /// /// @return A view over the value. /// - BSONCXX_INLINE operator array::view() const noexcept; + operator array::view() const noexcept { + return view(); + } /// /// Transfer ownership of the underlying buffer to the caller. @@ -100,21 +104,13 @@ class value { /// /// @return A std::unique_ptr with ownership of the buffer. /// - unique_ptr_type release(); + BSONCXX_ABI_EXPORT_CDECL(unique_ptr_type) release(); private: unique_ptr_type _data; std::size_t _length{0}; }; -BSONCXX_INLINE array::view value::view() const noexcept { - return array::view{static_cast(_data.get()), _length}; -} - -BSONCXX_INLINE value::operator array::view() const noexcept { - return view(); -} - } // namespace array } // namespace v_noabi } // namespace bsoncxx diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view-fwd.hpp index a55588618b..43daa93eb4 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace array { -class BSONCXX_API view; +class view; } // namespace array } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp index d65265a34e..4f5f911223 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp @@ -35,28 +35,28 @@ namespace array { /// class view { public: - class BSONCXX_API const_iterator; + class const_iterator; using iterator = const_iterator; /// /// @returns A const_iterator to the first element of the array. /// - const_iterator cbegin() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) cbegin() const; /// /// @returns A const_iterator to the past-the-end element of the array. /// - const_iterator cend() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) cend() const; /// /// @returns A const_iterator to the first element of the array. /// - const_iterator begin() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) begin() const; /// /// @returns A const_iterator to the past-the-end element of the array. /// - const_iterator end() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) end() const; /// /// Indexes into this BSON array. If the index is out-of-bounds, a past-the-end iterator @@ -68,7 +68,7 @@ class view { /// /// @return An iterator to the element if it exists, or the past-the-end iterator. /// - const_iterator find(std::uint32_t i) const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) find(std::uint32_t i) const; /// /// Indexes into this BSON array. If the index is out-of-bounds, the invalid array::element @@ -80,13 +80,13 @@ class view { /// /// @return The element if it exists, or the invalid element. /// - element operator[](std::uint32_t i) const; + BSONCXX_ABI_EXPORT_CDECL(element) operator[](std::uint32_t i) const; /// /// Default constructs a view. The resulting view will be initialized to point at /// an empty BSON array. /// - view(); + BSONCXX_ABI_EXPORT_CDECL() view(); /// /// Constructs a view from a buffer. The caller is responsible for ensuring that @@ -97,14 +97,14 @@ class view { /// @param length /// The size of the buffer, in bytes. /// - view(const std::uint8_t* data, std::size_t length); + BSONCXX_ABI_EXPORT_CDECL() view(const std::uint8_t* data, std::size_t length); /// /// Access the raw bytes of the underlying array. /// /// @return A (non-owning) pointer to the view's buffer. /// - const std::uint8_t* data() const; + BSONCXX_ABI_EXPORT_CDECL(const std::uint8_t*) data() const; /// /// Gets the length of the underlying buffer. @@ -114,7 +114,7 @@ class view { /// /// @return The length of the array, in bytes. /// - std::size_t length() const; + BSONCXX_ABI_EXPORT_CDECL(std::size_t) length() const; /// /// Checks if the underlying buffer is empty, i.e. it is equivalent to @@ -122,12 +122,12 @@ class view { /// /// @return true if the underlying document is empty. /// - bool empty() const; + BSONCXX_ABI_EXPORT_CDECL(bool) empty() const; /// /// Conversion operator unwrapping a document::view /// - operator document::view() const; + BSONCXX_ABI_EXPORT_CDECL() operator document::view() const; /// /// @relates bsoncx::v_noabi::document::view @@ -135,8 +135,8 @@ class view { /// Compare two views for (in)-equality /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator==(view, view); - friend BSONCXX_API bool BSONCXX_CALL operator!=(view, view); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(view, view); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(view, view); /// @} /// @@ -161,14 +161,14 @@ class view::const_iterator { using iterator_category = std::forward_iterator_tag; using difference_type = std::ptrdiff_t; - const_iterator(); - explicit const_iterator(const element& element); + BSONCXX_ABI_EXPORT_CDECL() const_iterator(); + BSONCXX_ABI_EXPORT_CDECL(explicit) const_iterator(const element& element); - reference operator*(); - pointer operator->(); + BSONCXX_ABI_EXPORT_CDECL(reference) operator*(); + BSONCXX_ABI_EXPORT_CDECL(pointer) operator->(); - const_iterator& operator++(); - const_iterator operator++(int); + BSONCXX_ABI_EXPORT_CDECL(const_iterator&) operator++(); + BSONCXX_ABI_EXPORT_CDECL(const_iterator) operator++(int); /// /// @relates bsoncxx::v_noabi::array::view::const_iterator @@ -176,8 +176,8 @@ class view::const_iterator { /// Compare two const_iterators for (in)-equality. /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator==(const const_iterator&, const const_iterator&); - friend BSONCXX_API bool BSONCXX_CALL operator!=(const const_iterator&, const const_iterator&); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const const_iterator&, const const_iterator&); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const const_iterator&, const const_iterator&); /// @} /// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/array.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/array.hpp index 003690993f..d81c111519 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/array.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/array.hpp @@ -65,7 +65,7 @@ class array : public sub_array { /// /// @return A view of the BSON array. /// - BSONCXX_INLINE bsoncxx::v_noabi::array::view view() const { + bsoncxx::v_noabi::array::view view() const { return _core.view_array(); } @@ -75,7 +75,7 @@ class array : public sub_array { /// /// @return A view of the current builder contents. /// - BSONCXX_INLINE operator bsoncxx::v_noabi::array::view() const { + operator bsoncxx::v_noabi::array::view() const { return view(); } @@ -88,14 +88,14 @@ class array : public sub_array { /// After calling extract() it is illegal to call any methods /// on this class, unless it is subsequenly moved into. /// - BSONCXX_INLINE bsoncxx::v_noabi::array::value extract() { + bsoncxx::v_noabi::array::value extract() { return _core.extract_array(); } /// /// Reset the underlying BSON to an empty array. /// - BSONCXX_INLINE void clear() { + void clear() { _core.clear(); } @@ -114,7 +114,7 @@ class array : public sub_array { /// A bsoncxx::v_noabi::array::value containing the elements. /// template -bsoncxx::v_noabi::array::value BSONCXX_CALL make_array(Args&&... args) { +bsoncxx::v_noabi::array::value make_array(Args&&... args) { array array; array.append(std::forward(args)...); return array.extract(); diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/document.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/document.hpp index 6b40d85e6f..12a9eede9e 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/document.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/document.hpp @@ -40,20 +40,19 @@ class document : public sub_document { /// /// Default constructor /// - BSONCXX_INLINE document() : sub_document(&_core), _core(false) {} + document() : sub_document(&_core), _core(false) {} ~document() = default; /// /// Move constructor /// - BSONCXX_INLINE document(document&& doc) noexcept - : sub_document(&_core), _core(std::move(doc._core)) {} + document(document&& doc) noexcept : sub_document(&_core), _core(std::move(doc._core)) {} /// /// Move assignment operator /// - BSONCXX_INLINE document& operator=(document&& doc) noexcept { + document& operator=(document&& doc) noexcept { _core = std::move(doc._core); return *this; } @@ -64,7 +63,7 @@ class document : public sub_document { /// /// @return A view of the BSON document. /// - BSONCXX_INLINE bsoncxx::v_noabi::document::view view() const { + bsoncxx::v_noabi::document::view view() const { return _core.view_document(); } @@ -74,7 +73,7 @@ class document : public sub_document { /// /// @return A view of the current builder contents. /// - BSONCXX_INLINE operator bsoncxx::v_noabi::document::view() const { + operator bsoncxx::v_noabi::document::view() const { return view(); } @@ -87,14 +86,14 @@ class document : public sub_document { /// After calling extract() it is illegal to call any methods /// on this class, unless it is subsequently moved into. /// - BSONCXX_INLINE bsoncxx::v_noabi::document::value extract() { + bsoncxx::v_noabi::document::value extract() { return _core.extract_document(); } /// /// Reset the underlying BSON to an empty document. /// - BSONCXX_INLINE void clear() { + void clear() { _core.clear(); } @@ -113,7 +112,7 @@ class document : public sub_document { /// A bsoncxx::v_noabi::document::value containing the elements. /// template -bsoncxx::v_noabi::document::value BSONCXX_CALL make_document(Args&&... args) { +bsoncxx::v_noabi::document::value make_document(Args&&... args) { document document; document.append(std::forward(args)...); return document.extract(); diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/impl.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/impl.hpp index d5195d2bca..a5c2873d52 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/impl.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/impl.hpp @@ -27,7 +27,7 @@ namespace basic { namespace impl { template -BSONCXX_INLINE detail::requires_t> // +detail::requires_t> // generic_append(core* core, T&& func) { core->open_document(); detail::invoke(std::forward(func), sub_document(core)); @@ -35,7 +35,7 @@ generic_append(core* core, T&& func) { } template // placeholder 'void' for VS2015 compat -BSONCXX_INLINE detail::requires_t> // +detail::requires_t> // generic_append(core* core, T&& func) { core->open_array(); detail::invoke(std::forward(func), sub_array(core)); @@ -43,15 +43,15 @@ generic_append(core* core, T&& func) { } template -BSONCXX_INLINE detail::requires_not_t, - detail::is_invocable> +detail::requires_not_t, + detail::is_invocable> generic_append(core* core, T&& t) { core->append(std::forward(t)); } template -BSONCXX_INLINE void value_append(core* core, T&& t) { +void value_append(core* core, T&& t) { generic_append(core, std::forward(t)); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/kvp.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/kvp.hpp index c7c363c02f..1b0823932b 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/kvp.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/kvp.hpp @@ -28,7 +28,7 @@ namespace basic { /// and a BSON value. /// template -BSONCXX_INLINE std::tuple kvp(T&& t, U&& u) { +std::tuple kvp(T&& t, U&& u) { return std::tuple(std::forward(t), std::forward(u)); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_array.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_array.hpp index 5e9fd0ceee..91417bf6e3 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_array.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_array.hpp @@ -43,13 +43,13 @@ class sub_array { /// /// Default constructor /// - BSONCXX_INLINE sub_array(core* core) : _core(core) {} + sub_array(core* core) : _core(core) {} /// /// Appends multiple BSON values. /// template - BSONCXX_INLINE void append(Arg&& a, Args&&... args) { + void append(Arg&& a, Args&&... args) { append_(std::forward(a)); append(std::forward(args)...); } @@ -65,7 +65,7 @@ class sub_array { // Appends a BSON value. // template - BSONCXX_INLINE void append_(T&& t) { + void append_(T&& t) { impl::value_append(_core, std::forward(t)); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_document.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_document.hpp index 694614d5ec..a1b0798698 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_document.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/basic/sub_document.hpp @@ -42,13 +42,13 @@ void value_append(core* core, T&& t); /// class sub_document { public: - BSONCXX_INLINE sub_document(core* core) : _core(core) {} + sub_document(core* core) : _core(core) {} /// /// Appends multiple basic::kvp key-value pairs. /// template - BSONCXX_INLINE void append(Arg&& a, Args&&... args) { + void append(Arg&& a, Args&&... args) { append_(std::forward(a)); append(std::forward(args)...); } @@ -64,7 +64,7 @@ class sub_document { // Appends a basic::kvp where the key is a non-owning string view. // template - BSONCXX_INLINE detail::requires_t> // + detail::requires_t> // append_(std::tuple&& t) { _core->key_view(std::forward(std::get<0>(t))); impl::value_append(_core, std::forward(std::get<1>(t))); @@ -74,7 +74,7 @@ class sub_document { // Appends a basic::kvp where the key is an owning STL string. // template - BSONCXX_INLINE detail::requires_t> // + detail::requires_t> // append_(std::tuple&& t) { _core->key_owned(std::forward(std::get<0>(t))); impl::value_append(_core, std::forward(std::get<1>(t))); @@ -84,7 +84,7 @@ class sub_document { // Appends a basic::kvp where the key is a string literal // template - BSONCXX_INLINE void append_(std::tuple&& t) { + void append_(std::tuple&& t) { _core->key_view(stdx::string_view{std::get<0>(t), n - 1}); impl::value_append(_core, std::forward(std::get<1>(t))); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/concatenate.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/concatenate.hpp index b489dab2b6..3c4bb4fa6d 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/concatenate.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/concatenate.hpp @@ -38,7 +38,7 @@ struct concatenate_doc { /// /// @return A view of the wrapped concatenate document. /// - BSONCXX_INLINE operator document::view() const { + operator document::view() const { return doc; } @@ -48,7 +48,7 @@ struct concatenate_doc { /// /// @return A view of the wrapped concatenate document. /// - BSONCXX_INLINE document::view view() const { + document::view view() const { return doc; } }; @@ -66,7 +66,7 @@ struct concatenate_array { /// /// @return A view of the wrapped concatenate array. /// - BSONCXX_INLINE operator array::view() const { + operator array::view() const { return array; } @@ -76,7 +76,7 @@ struct concatenate_array { /// /// @return A view of the wrapped concatenate array. /// - BSONCXX_INLINE array::view view() const { + array::view view() const { return array; } }; @@ -93,7 +93,7 @@ struct concatenate_array { /// /// @see bsoncxx::v_noabi::builder::concatenate_doc /// -BSONCXX_INLINE concatenate_doc concatenate(document::view_or_value doc) { +inline concatenate_doc concatenate(document::view_or_value doc) { return {std::move(doc)}; } @@ -109,7 +109,7 @@ BSONCXX_INLINE concatenate_doc concatenate(document::view_or_value doc) { /// /// @see bsoncxx::v_noabi::builder::concatenate_doc /// -BSONCXX_INLINE concatenate_array concatenate(array::view_or_value array) { +inline concatenate_array concatenate(array::view_or_value array) { return {std::move(array)}; } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core-fwd.hpp index 0880900c95..2f1a9ddd10 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace builder { -class BSONCXX_API core; +class core; } // namespace builder } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core.hpp index 787c5634e7..c4c5b4b22f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/core.hpp @@ -45,7 +45,7 @@ namespace builder { /// class core { public: - class BSONCXX_PRIVATE impl; + class impl; /// /// Constructs an empty BSON datum. @@ -53,12 +53,12 @@ class core { /// @param is_array /// True if the top-level BSON datum should be an array. /// - explicit core(bool is_array); + explicit BSONCXX_ABI_EXPORT_CDECL() core(bool is_array); - core(core&& rhs) noexcept; - core& operator=(core&& rhs) noexcept; + BSONCXX_ABI_EXPORT_CDECL() core(core&& rhs) noexcept; + BSONCXX_ABI_EXPORT_CDECL(core&) operator=(core&& rhs) noexcept; - ~core(); + BSONCXX_ABI_EXPORT_CDECL() ~core(); core(const core&) = delete; core& operator=(const core&) = delete; @@ -83,7 +83,7 @@ class core { /// @throws bsoncxx::v_noabi::exception if the current BSON datum is an array or if the previous /// value appended to the builder was also a key. /// - core& key_view(stdx::string_view key); + BSONCXX_ABI_EXPORT_CDECL(core&) key_view(stdx::string_view key); /// /// Appends a key passed as an STL string. Transfers ownership of the key to this class. @@ -98,7 +98,7 @@ class core { /// @throws bsoncxx::v_noabi::exception if the current BSON datum is an array or if the previous /// value appended to the builder was a key. /// - core& key_owned(std::string key); + BSONCXX_ABI_EXPORT_CDECL(core&) key_owned(std::string key); /// /// Opens a sub-document within this BSON datum. @@ -111,7 +111,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& open_document(); + BSONCXX_ABI_EXPORT_CDECL(core&) open_document(); /// /// Opens a sub-array within this BSON datum. @@ -124,7 +124,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& open_array(); + BSONCXX_ABI_EXPORT_CDECL(core&) open_array(); /// /// Closes the current sub-document within this BSON datum. @@ -135,7 +135,7 @@ class core { /// /// @throws bsoncxx::v_noabi::exception if the current BSON datum is not an open sub-document. /// - core& close_document(); + BSONCXX_ABI_EXPORT_CDECL(core&) close_document(); /// /// Closes the current sub-array within this BSON datum. @@ -146,7 +146,7 @@ class core { /// /// @throws bsoncxx::v_noabi::exception if the current BSON datum is not an open sub-array. /// - core& close_array(); + BSONCXX_ABI_EXPORT_CDECL(core&) close_array(); /// /// Appends the keys from a BSON document into this BSON datum. @@ -165,7 +165,7 @@ class core { /// @throws /// bsoncxx::v_noabi::exception if one of the keys fails to append. /// - core& concatenate(const bsoncxx::v_noabi::document::view& view); + BSONCXX_ABI_EXPORT_CDECL(core&) concatenate(const bsoncxx::v_noabi::document::view& view); /// /// Appends a BSON double. @@ -179,7 +179,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the double fails to append. /// - core& append(const types::b_double& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_double& value); /// /// Append a BSON UTF-8 string. @@ -193,7 +193,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the string fails to append. /// - core& append(const types::b_string& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_string& value); /// /// Appends a BSON document. @@ -207,7 +207,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the document fails to append. /// - core& append(const types::b_document& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_document& value); /// /// Appends a BSON array. @@ -221,7 +221,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the array fails to append. /// - core& append(const types::b_array& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_array& value); /// /// Appends a BSON binary datum. @@ -235,7 +235,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the binary fails to append. /// - core& append(const types::b_binary& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_binary& value); /// /// Appends a BSON undefined. @@ -249,7 +249,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if undefined fails to append. /// - core& append(const types::b_undefined& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_undefined& value); /// /// Appends a BSON ObjectId. @@ -263,7 +263,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the ObjectId fails to append. /// - core& append(const types::b_oid& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_oid& value); /// /// Appends a BSON boolean. @@ -277,7 +277,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the boolean fails to append. /// - core& append(const types::b_bool& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_bool& value); /// /// Appends a BSON date. @@ -291,7 +291,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the date fails to append. /// - core& append(const types::b_date& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_date& value); /// /// Appends a BSON null. @@ -305,7 +305,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if null fails to append. /// - core& append(const types::b_null& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_null& value); /// /// Appends a BSON regex. @@ -319,7 +319,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the regex fails to append. /// - core& append(const types::b_regex& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_regex& value); /// /// Appends a BSON DBPointer. @@ -333,7 +333,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the DBPointer fails to append. /// - core& append(const types::b_dbpointer& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_dbpointer& value); /// /// Appends a BSON JavaScript code. @@ -347,7 +347,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the JavaScript code fails to append. /// - core& append(const types::b_code& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_code& value); /// /// Appends a BSON symbol. @@ -361,7 +361,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the symbol fails to append. /// - core& append(const types::b_symbol& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_symbol& value); /// /// Appends a BSON JavaScript code with scope. @@ -375,7 +375,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the JavaScript code with scope fails to append. /// - core& append(const types::b_codewscope& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_codewscope& value); /// /// Appends a BSON 32-bit signed integer. @@ -389,7 +389,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the 32-bit signed integer fails to append. /// - core& append(const types::b_int32& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_int32& value); /// /// Appends a BSON replication timestamp. @@ -403,7 +403,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the timestamp fails to append. /// - core& append(const types::b_timestamp& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_timestamp& value); /// /// Appends a BSON 64-bit signed integer. @@ -417,7 +417,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the 64-bit signed integer fails to append. /// - core& append(const types::b_int64& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_int64& value); /// /// Appends a BSON Decimal128. @@ -431,7 +431,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the Decimal128 fails to append. /// - core& append(const types::b_decimal128& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_decimal128& value); /// /// Appends a BSON min-key. @@ -445,7 +445,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the min-key fails to append. /// - core& append(const types::b_minkey& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_minkey& value); /// /// Appends a BSON max-key. @@ -459,7 +459,7 @@ class core { /// key to be appended to start a new key/value pair. /// bsoncxx::v_noabi::exception if the max-key fails to append. /// - core& append(const types::b_maxkey& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::b_maxkey& value); /// /// Appends a BSON variant value. @@ -472,7 +472,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(const types::bson_value::view& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const types::bson_value::view& value); /// /// Appends an STL string as a BSON UTF-8 string. @@ -485,7 +485,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(std::string str); + BSONCXX_ABI_EXPORT_CDECL(core&) append(std::string str); /// /// Appends a string view as a BSON UTF-8 string. @@ -498,7 +498,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(stdx::string_view str); + BSONCXX_ABI_EXPORT_CDECL(core&) append(stdx::string_view str); /// /// Appends a char* or const char*. @@ -514,7 +514,7 @@ class core { /// key to be appended to start a new key/value pair. /// template - BSONCXX_INLINE core& append(T* v) { + core& append(T* v) { static_assert(detail::is_alike::value, "append is disabled for non-char pointer types"); append(types::b_string{v}); @@ -533,7 +533,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(bool value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(bool value); /// /// Appends a native double as a BSON double. @@ -546,7 +546,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(double value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(double value); /// /// Appends a native int32_t as a BSON 32-bit signed integer. @@ -559,7 +559,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(std::int32_t value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(std::int32_t value); /// /// Appends a native int64_t as a BSON 64-bit signed integer. @@ -572,7 +572,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(std::int64_t value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(std::int64_t value); /// /// Appends an oid as a BSON ObjectId. @@ -585,7 +585,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(const oid& value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(const oid& value); /// /// Appends a decimal128 object as a BSON Decimal128. @@ -598,7 +598,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(decimal128 value); + BSONCXX_ABI_EXPORT_CDECL(core&) append(decimal128 value); /// /// Appends the given document view. @@ -611,7 +611,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(bsoncxx::v_noabi::document::view view); + BSONCXX_ABI_EXPORT_CDECL(core&) append(bsoncxx::v_noabi::document::view view); /// /// Appends the given array view. @@ -624,7 +624,7 @@ class core { /// bsoncxx::v_noabi::exception if the current BSON datum is a document that is waiting for a /// key to be appended to start a new key/value pair. /// - core& append(bsoncxx::v_noabi::array::view view); + BSONCXX_ABI_EXPORT_CDECL(core&) append(bsoncxx::v_noabi::array::view view); /// /// Gets a view over the document. @@ -638,7 +638,7 @@ class core { /// /// @throws bsoncxx::v_noabi::exception if the precondition is violated. /// - bsoncxx::v_noabi::document::view view_document() const; + BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) view_document() const; /// /// Gets a view over the array. @@ -651,7 +651,7 @@ class core { /// /// @throws bsoncxx::v_noabi::exception if the precondition is violated. /// - bsoncxx::v_noabi::array::view view_array() const; + BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::array::view) view_array() const; /// /// Transfers ownership of the underlying document to the caller. @@ -669,7 +669,7 @@ class core { /// After calling extract_document() it is illegal to call any methods on this class, unless /// it is subsequenly moved into. /// - bsoncxx::v_noabi::document::value extract_document(); + BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) extract_document(); /// /// Transfers ownership of the underlying document to the caller. @@ -686,13 +686,13 @@ class core { /// After calling extract_array() it is illegal to call any methods on this class, unless it /// is subsequenly moved into. /// - bsoncxx::v_noabi::array::value extract_array(); + BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::array::value) extract_array(); /// /// Deletes the contents of the underlying BSON datum. After calling clear(), the state of this /// class will be the same as it was immediately after construction. /// - void clear(); + BSONCXX_ABI_EXPORT_CDECL(void) clear(); private: std::unique_ptr _impl; diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array.hpp index 645798b052..fecf813a21 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array.hpp @@ -44,19 +44,19 @@ class array : public array_context<> { /// /// Default constructor. /// - BSONCXX_INLINE array() : array_context<>(&_core), _core(true) {} + array() : array_context<>(&_core), _core(true) {} /// /// @return A view of the BSON array. /// - BSONCXX_INLINE bsoncxx::v_noabi::array::view view() const { + bsoncxx::v_noabi::array::view view() const { return _core.view_array(); } /// /// @return A view of the BSON array. /// - BSONCXX_INLINE operator bsoncxx::v_noabi::array::view() const { + operator bsoncxx::v_noabi::array::view() const { return view(); } @@ -69,14 +69,14 @@ class array : public array_context<> { /// After calling extract() it is illegal to call any methods /// on this class, unless it is subsequenly moved into. /// - BSONCXX_INLINE bsoncxx::v_noabi::array::value extract() { + bsoncxx::v_noabi::array::value extract() { return _core.extract_array(); } /// /// Reset the underlying BSON to an empty array. /// - BSONCXX_INLINE void clear() { + void clear() { _core.clear(); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array_context.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array_context.hpp index 5ddd380d93..c1b76bf419 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array_context.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/array_context.hpp @@ -56,7 +56,7 @@ class array_context { /// @param core /// The core builder to orchestrate /// - BSONCXX_INLINE array_context(core* core) : _core(core) {} + array_context(core* core) : _core(core) {} /// /// << operator for accepting a real value and appending it to the core @@ -66,10 +66,10 @@ class array_context { /// The value to append /// template - BSONCXX_INLINE detail::requires_not_t>, - detail::is_invocable, - detail::is_alike> + detail::requires_not_t>, + detail::is_invocable, + detail::is_alike> operator<<(T&& t) { _core->append(std::forward(t)); return *this; @@ -84,11 +84,10 @@ class array_context { /// The callback to invoke /// template - BSONCXX_INLINE - detail::requires_t, - detail::is_invocable>> - operator<<(Func&& func) { + detail::requires_t, + detail::is_invocable>> + operator<<(Func&& func) { detail::invoke(std::forward(func), *this); return *this; } @@ -104,9 +103,9 @@ class array_context { /// @return A value type which holds the complete bson document. /// template - BSONCXX_INLINE detail::requires_t, - detail::is_alike> + detail::requires_t, + detail::is_alike> // VS2015U1 can't resolve the name. operator<<(T&&) { return _core->extract_array(); @@ -117,7 +116,7 @@ class array_context { /// /// The argument must be an open_document_type token (it is otherwise ignored). /// - BSONCXX_INLINE key_context operator<<(const open_document_type) { + key_context operator<<(const open_document_type) { _core->open_document(); return wrap_document(); } @@ -131,7 +130,7 @@ class array_context { /// @param array /// An array to concatenate /// - BSONCXX_INLINE array_context operator<<(concatenate_array array) { + array_context operator<<(concatenate_array array) { _core->concatenate(array.view()); return *this; } @@ -141,7 +140,7 @@ class array_context { /// /// The argument must be an open_document_type token (it is otherwise ignored). /// - BSONCXX_INLINE array_context operator<<(const open_array_type) { + array_context operator<<(const open_array_type) { _core->open_array(); return wrap_array(); } @@ -151,7 +150,7 @@ class array_context { /// /// The argument must be a close_array_type token (it is otherwise ignored). /// - BSONCXX_INLINE base operator<<(const close_array_type) { + base operator<<(const close_array_type) { _core->close_array(); return unwrap(); } @@ -160,7 +159,7 @@ class array_context { /// Conversion operator which provides a rooted array context given any /// stream currently in a nested array_context. /// - BSONCXX_INLINE operator array_context<>() { + operator array_context<>() { return array_context<>(_core); } @@ -169,18 +168,18 @@ class array_context { /// /// @see bsoncxx::v_noabi::builder::stream::single_context /// - BSONCXX_INLINE operator single_context(); + operator single_context(); private: - BSONCXX_INLINE base unwrap() { + base unwrap() { return base(_core); } - BSONCXX_INLINE array_context wrap_array() { + array_context wrap_array() { return array_context(_core); } - BSONCXX_INLINE key_context wrap_document() { + key_context wrap_document() { return key_context(_core); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/document.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/document.hpp index 65bb14c49e..1bf9f4a537 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/document.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/document.hpp @@ -42,19 +42,19 @@ class document : public key_context<> { /// /// Default constructor. /// - BSONCXX_INLINE document() : key_context<>(&_core), _core(false) {} + document() : key_context<>(&_core), _core(false) {} /// /// @return A view of the BSON document. /// - BSONCXX_INLINE bsoncxx::v_noabi::document::view view() const { + bsoncxx::v_noabi::document::view view() const { return _core.view_document(); } /// /// @return A view of the BSON document. /// - BSONCXX_INLINE operator bsoncxx::v_noabi::document::view() const { + operator bsoncxx::v_noabi::document::view() const { return view(); } @@ -67,14 +67,14 @@ class document : public key_context<> { /// After calling extract() it is illegal to call any methods /// on this class, unless it is subsequenly moved into. /// - BSONCXX_INLINE bsoncxx::v_noabi::document::value extract() { + bsoncxx::v_noabi::document::value extract() { return _core.extract_document(); } /// /// Reset the underlying BSON to an empty document. /// - BSONCXX_INLINE void clear() { + void clear() { _core.clear(); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/helpers-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/helpers-fwd.hpp index 007f029dc8..9c8b8fd473 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/helpers-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/helpers-fwd.hpp @@ -21,11 +21,11 @@ namespace v_noabi { namespace builder { namespace stream { -struct BSONCXX_API open_document_type; -struct BSONCXX_API close_document_type; -struct BSONCXX_API open_array_type; -struct BSONCXX_API close_array_type; -struct BSONCXX_API finalize_type; +struct open_document_type; +struct close_document_type; +struct open_array_type; +struct close_array_type; +struct finalize_type; } // namespace stream } // namespace builder diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp index 80a438c6e2..2afaec204c 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/key_context.hpp @@ -69,7 +69,7 @@ class key_context { /// key. /// template - BSONCXX_INLINE value_context operator<<(const char (&v)[n]) { + value_context operator<<(const char (&v)[n]) { _core->key_view(stdx::string_view{v, n - 1}); return value_context(_core); } @@ -84,7 +84,7 @@ class key_context { /// @throws bsoncxx::v_noabi::exception if the previous value appended to the builder was also a /// key. /// - BSONCXX_INLINE value_context operator<<(std::string str) { + value_context operator<<(std::string str) { _core->key_owned(std::move(str)); return value_context(_core); } @@ -99,7 +99,7 @@ class key_context { /// @throws bsoncxx::v_noabi::exception if the previous value appended to the builder was also a /// key. /// - BSONCXX_INLINE value_context operator<<(stdx::string_view str) { + value_context operator<<(stdx::string_view str) { _core->key_view(std::move(str)); return value_context(_core); } @@ -113,7 +113,7 @@ class key_context { /// The callback to invoke /// template - BSONCXX_INLINE detail::requires_t> // + detail::requires_t> // operator<<(T&& func) { detail::invoke(std::forward(func), *this); return *this; @@ -130,9 +130,9 @@ class key_context { /// @return A value type which holds the complete bson document. /// template - BSONCXX_INLINE detail::requires_t, - detail::is_alike> + detail::requires_t, + detail::is_alike> operator<<(T&&) { return _core->extract_document(); } @@ -146,7 +146,7 @@ class key_context { /// @param doc /// A document to concatenate /// - BSONCXX_INLINE key_context operator<<(concatenate_doc doc) { + key_context operator<<(concatenate_doc doc) { _core->concatenate(doc); return *this; } @@ -156,7 +156,7 @@ class key_context { /// /// The argument must be a close_document_type token (it is otherwise ignored). /// - BSONCXX_INLINE base operator<<(const close_document_type) { + base operator<<(const close_document_type) { _core->close_document(); return unwrap(); } @@ -165,12 +165,12 @@ class key_context { /// Conversion operator which provides a rooted document given any stream /// currently in a nested key_context. /// - BSONCXX_INLINE operator key_context<>() { + operator key_context<>() { return key_context<>(_core); } private: - BSONCXX_INLINE base unwrap() { + base unwrap() { return base(_core); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/single_context.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/single_context.hpp index 8ffe155be8..2196b3626f 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/single_context.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/single_context.hpp @@ -43,14 +43,14 @@ class single_context { /// @param core /// The core builder to orchestrate /// - BSONCXX_INLINE single_context(core* core) : _core(core) {} + single_context(core* core) : _core(core) {} /// /// << operator for opening a new subdocument in the core builder. /// /// The argument must be an open_document_type token (it is otherwise ignored). /// - BSONCXX_INLINE key_context<> operator<<(open_document_type) { + key_context<> operator<<(open_document_type) { _core->open_document(); return wrap_document(); @@ -61,7 +61,7 @@ class single_context { /// /// The argument must be an open_array_type token (it is otherwise ignored). /// - BSONCXX_INLINE array_context<> operator<<(open_array_type) { + array_context<> operator<<(open_array_type) { _core->open_array(); return wrap_array(); @@ -75,16 +75,16 @@ class single_context { /// The value to append /// template - BSONCXX_INLINE void operator<<(T&& t) { + void operator<<(T&& t) { _core->append(std::forward(t)); } private: - BSONCXX_INLINE array_context<> wrap_array() { + array_context<> wrap_array() { return array_context<>(_core); } - BSONCXX_INLINE key_context<> wrap_document() { + key_context<> wrap_document() { return key_context<>(_core); } @@ -95,7 +95,7 @@ class single_context { /// Implementation of the single_context conversion operator for array_context. /// template -BSONCXX_INLINE array_context::operator single_context() { +array_context::operator single_context() { return single_context(_core); } @@ -103,7 +103,7 @@ BSONCXX_INLINE array_context::operator single_context() { /// Implementation of the single_context conversion operator for value_context. /// template -BSONCXX_INLINE value_context::operator single_context() { +value_context::operator single_context() { return single_context(_core); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp index 6f5e871fc6..ece22d9b19 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/value_context.hpp @@ -55,7 +55,7 @@ class value_context { /// @param core /// The core builder to orchestrate /// - BSONCXX_INLINE value_context(core* core) : _core(core) {} + value_context(core* core) : _core(core) {} /// /// << operator for accepting a real value and appending it to the core @@ -65,7 +65,7 @@ class value_context { /// The value to append /// template - BSONCXX_INLINE detail::requires_not_t> // + detail::requires_not_t> // operator<<(T&& t) { _core->append(std::forward(t)); return unwrap(); @@ -79,7 +79,7 @@ class value_context { /// The callback to invoke /// template - BSONCXX_INLINE detail::requires_t> // + detail::requires_t> // operator<<(T&& func) { detail::invoke(std::forward(func), *this); return unwrap(); @@ -90,7 +90,7 @@ class value_context { /// /// The argument must be an open_document_type token (it is otherwise ignored). /// - BSONCXX_INLINE key_context operator<<(const open_document_type) { + key_context operator<<(const open_document_type) { _core->open_document(); return wrap_document(); } @@ -100,7 +100,7 @@ class value_context { /// /// The argument must be an open_array_type token (it is otherwise ignored). /// - BSONCXX_INLINE array_context operator<<(const open_array_type) { + array_context operator<<(const open_array_type) { _core->open_array(); return wrap_array(); } @@ -120,15 +120,15 @@ class value_context { #endif private: - BSONCXX_INLINE base unwrap() { + base unwrap() { return base(_core); } - BSONCXX_INLINE array_context wrap_array() { + array_context wrap_array() { return array_context(_core); } - BSONCXX_INLINE key_context wrap_document() { + key_context wrap_document() { return key_context(_core); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128-fwd.hpp index 0bac27c789..c45b9c0c91 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128-fwd.hpp @@ -19,7 +19,7 @@ namespace bsoncxx { namespace v_noabi { -class BSONCXX_API decimal128; +class decimal128; } // namespace v_noabi } // namespace bsoncxx diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128.hpp index 19e9dc72ed..2eb0092137 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128.hpp @@ -55,14 +55,14 @@ class decimal128 { /// @throws bsoncxx::v_noabi::exception if the string isn't a valid BSON Decimal128 /// representation. /// - explicit decimal128(stdx::string_view str); + explicit BSONCXX_ABI_EXPORT_CDECL() decimal128(stdx::string_view str); /// /// Converts this decimal128 value to a string representation. /// /// @return A string representation of a IEEE 754-2008 decimal number. /// - std::string to_string() const; + BSONCXX_ABI_EXPORT_CDECL(std::string) to_string() const; /// /// @relates bsoncxx::v_noabi::decimal128 @@ -70,22 +70,22 @@ class decimal128 { /// Relational operators for decimal128 /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator==(const decimal128& lhs, const decimal128& rhs); - friend BSONCXX_API bool BSONCXX_CALL operator!=(const decimal128& lhs, const decimal128& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const decimal128& lhs, const decimal128& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const decimal128& lhs, const decimal128& rhs); /// @} /// /// /// Accessor for high 64 bits. /// - BSONCXX_INLINE uint64_t high() const { + uint64_t high() const { return _high; } /// /// Accessor for low 64 bits. /// - BSONCXX_INLINE uint64_t low() const { + uint64_t low() const { return _low; } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element-fwd.hpp index 4160723ddf..7f7b8ce25a 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace document { -class BSONCXX_API element; +class element; } // namespace document } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element.hpp index 3a7906c088..96b0d4b31a 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element.hpp @@ -50,34 +50,34 @@ class element { /// This is useful when mapping the end iterator of a document or array /// view. /// - element(); + BSONCXX_ABI_EXPORT_CDECL() element(); /// /// Conversion operator to bool which is true for valid elements /// and false for invalid elements. /// - explicit operator bool() const; + explicit BSONCXX_ABI_EXPORT_CDECL() operator bool() const; /// /// Getter for the raw bson bytes the element points to. /// /// @return a pointer to the raw bson bytes. /// - const std::uint8_t* raw() const; + BSONCXX_ABI_EXPORT_CDECL(const std::uint8_t*) raw() const; /// /// Getter for length of the raw bson bytes the element points to. /// /// @return a pointer to the length of the raw bson bytes. /// - std::uint32_t length() const; + BSONCXX_ABI_EXPORT_CDECL(std::uint32_t) length() const; /// /// Getter for the offset into the raw bson bytes the element points to. /// /// @return the offset into the raw bson bytes. /// - std::uint32_t offset() const; + BSONCXX_ABI_EXPORT_CDECL(std::uint32_t) offset() const; /// /// Getter for the type of the element. @@ -86,7 +86,7 @@ class element { /// /// @throws bsoncxx::v_noabi::exception if this element is invalid. /// - bsoncxx::v_noabi::type type() const; + BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::type) type() const; /// /// Getter for the element's key. @@ -95,14 +95,14 @@ class element { /// /// @throws bsoncxx::v_noabi::exception if this element is invalid. /// - stdx::string_view key() const; + BSONCXX_ABI_EXPORT_CDECL(stdx::string_view) key() const; /// /// Getter for the element's key length. /// /// @return the element's key length. /// - std::uint32_t keylen() const; + BSONCXX_ABI_EXPORT_CDECL(std::uint32_t) keylen() const; /// /// Getter for elements of the b_double type. @@ -111,7 +111,7 @@ class element { /// /// @return the element's value. /// - types::b_double get_double() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_double) get_double() const; /// /// Getter for elements of the b_string type. @@ -122,7 +122,7 @@ class element { /// /// @return the element's value. /// - BSONCXX_DEPRECATED types::b_string get_utf8() const; + BSONCXX_DEPRECATED BSONCXX_ABI_EXPORT_CDECL(types::b_string) get_utf8() const; /// /// Getter for elements of the b_string type. @@ -131,7 +131,7 @@ class element { /// /// @return the element's value. /// - types::b_string get_string() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_string) get_string() const; /// /// Getter for elements of the b_document type. @@ -140,7 +140,7 @@ class element { /// /// @return the element's value. /// - types::b_document get_document() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_document) get_document() const; /// /// Getter for elements of the b_array type. @@ -149,7 +149,7 @@ class element { /// /// @return the element's value. /// - types::b_array get_array() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_array) get_array() const; /// /// Getter for elements of the b_binary type. @@ -158,7 +158,7 @@ class element { /// /// @return the element's value. /// - types::b_binary get_binary() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_binary) get_binary() const; /// /// Getter for elements of the b_undefined type. @@ -167,7 +167,7 @@ class element { /// /// @return the element's value. /// - types::b_undefined get_undefined() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_undefined) get_undefined() const; /// /// Getter for elements of the b_oid type. @@ -176,7 +176,7 @@ class element { /// /// @return the element's value. /// - types::b_oid get_oid() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_oid) get_oid() const; /// /// Getter for elements of the b_bool type. @@ -185,7 +185,7 @@ class element { /// /// @return the element's value. /// - types::b_bool get_bool() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_bool) get_bool() const; /// /// Getter for elements of the b_date type. @@ -194,7 +194,7 @@ class element { /// /// @return the element's value. /// - types::b_date get_date() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_date) get_date() const; /// /// Getter for elements of the b_null type. @@ -203,7 +203,7 @@ class element { /// /// @return the element's value. /// - types::b_null get_null() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_null) get_null() const; /// /// Getter for elements of the b_regex type. @@ -212,7 +212,7 @@ class element { /// /// @return the element's value. /// - types::b_regex get_regex() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_regex) get_regex() const; /// /// Getter for elements of the b_dbpointer type. @@ -221,7 +221,7 @@ class element { /// /// @return the element's value. /// - types::b_dbpointer get_dbpointer() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_dbpointer) get_dbpointer() const; /// /// Getter for elements of the b_code type. @@ -230,7 +230,7 @@ class element { /// /// @return the element's value. /// - types::b_code get_code() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_code) get_code() const; /// /// Getter for elements of the b_symbol type. @@ -239,7 +239,7 @@ class element { /// /// @return the element's value. /// - types::b_symbol get_symbol() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_symbol) get_symbol() const; /// /// Getter for elements of the b_codewscope type. @@ -248,7 +248,7 @@ class element { /// /// @return the element's value. /// - types::b_codewscope get_codewscope() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_codewscope) get_codewscope() const; /// /// Getter for elements of the b_int32 type. @@ -257,7 +257,7 @@ class element { /// /// @return the element's value. /// - types::b_int32 get_int32() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_int32) get_int32() const; /// /// Getter for elements of the b_timestamp type. @@ -266,7 +266,7 @@ class element { /// /// @return the element's value. /// - types::b_timestamp get_timestamp() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_timestamp) get_timestamp() const; /// /// Getter for elements of the b_int64 type. @@ -275,7 +275,7 @@ class element { /// /// @return the element's value. /// - types::b_int64 get_int64() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_int64) get_int64() const; /// /// Getter for elements of the b_decimal128 type. @@ -284,7 +284,7 @@ class element { /// /// @return the element's value. /// - types::b_decimal128 get_decimal128() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_decimal128) get_decimal128() const; /// /// Getter for elements of the b_minkey type. @@ -293,7 +293,7 @@ class element { /// /// @return the element's value. /// - types::b_minkey get_minkey() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_minkey) get_minkey() const; /// /// Getter for elements of the b_maxkey type. @@ -302,7 +302,7 @@ class element { /// /// @return the element's value. /// - types::b_maxkey get_maxkey() const; + BSONCXX_ABI_EXPORT_CDECL(types::b_maxkey) get_maxkey() const; /// /// Getter for a types::bson_value::view variant wrapper of the value portion of the @@ -310,7 +310,7 @@ class element { /// /// @return the element's value. /// - types::bson_value::view get_value() const; + BSONCXX_ABI_EXPORT_CDECL(types::bson_value::view) get_value() const; /// /// Getter for a types::bson_value::value variant wrapper of the value portion of @@ -318,7 +318,7 @@ class element { /// /// @return an owning version of the element's value. /// - types::bson_value::value get_owning_value() const; + BSONCXX_ABI_EXPORT_CDECL(types::bson_value::value) get_owning_value() const; /// /// If this element is a document, finds the first element of the document @@ -334,7 +334,7 @@ class element { /// /// @return The matching element, if found, or an invalid element. /// - element operator[](stdx::string_view key) const; + BSONCXX_ABI_EXPORT_CDECL(element) operator[](stdx::string_view key) const; /// /// If this element is an array, indexes into this BSON array. If the @@ -350,7 +350,7 @@ class element { /// /// @return The element if it exists, or an invalid element. /// - array::element operator[](std::uint32_t i) const; + BSONCXX_ABI_EXPORT_CDECL(array::element) operator[](std::uint32_t i) const; private: /// @@ -365,13 +365,13 @@ class element { /// @param offset /// The element's offset into the buffer. /// - BSONCXX_PRIVATE explicit element(const std::uint8_t* raw, - std::uint32_t length, - std::uint32_t offset, - std::uint32_t keylen); + explicit element(const std::uint8_t* raw, + std::uint32_t length, + std::uint32_t offset, + std::uint32_t keylen); // Construct an invalid element with a key. Useful for exceptions. - BSONCXX_PRIVATE explicit element(const stdx::string_view key); + explicit element(const stdx::string_view key); friend ::bsoncxx::v_noabi::array::element; friend ::bsoncxx::v_noabi::document::view; @@ -394,16 +394,16 @@ class element { /// @{ /// @relatesalso bsoncxx::v_noabi::document::element -BSONCXX_API bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v); +BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const element& elem, const types::bson_value::view& v); /// @relatesalso bsoncxx::v_noabi::document::element -BSONCXX_API bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem); +BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const types::bson_value::view& v, const element& elem); /// @relatesalso bsoncxx::v_noabi::document::element -BSONCXX_API bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v); +BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const element& elem, const types::bson_value::view& v); /// @relatesalso bsoncxx::v_noabi::document::element -BSONCXX_API bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem); +BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const types::bson_value::view& v, const element& elem); /// @} /// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value-fwd.hpp index e5a8402dba..b2fd712237 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace document { -class BSONCXX_API value; +class value; } // namespace document } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp index 6b7aac1180..7b7a5aa76b 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp @@ -52,7 +52,7 @@ class value { /// @param dtor /// A user provided deleter. /// - value(std::uint8_t* data, std::size_t length, deleter_type dtor); + BSONCXX_ABI_EXPORT_CDECL() value(std::uint8_t* data, std::size_t length, deleter_type dtor); /// /// Constructs a value from a std::unique_ptr to a buffer. The ownership @@ -63,7 +63,7 @@ class value { /// @param length /// The length of the document. /// - value(unique_ptr_type ptr, std::size_t length); + BSONCXX_ABI_EXPORT_CDECL() value(unique_ptr_type ptr, std::size_t length); /// /// Constructs a value from a view of a document. The data referenced @@ -73,12 +73,12 @@ class value { /// @param view /// A view of another document to copy. /// - explicit value(document::view view); + explicit BSONCXX_ABI_EXPORT_CDECL() value(document::view view); ~value() = default; - value(const value&); - value& operator=(const value&); + BSONCXX_ABI_EXPORT_CDECL() value(const value&); + BSONCXX_ABI_EXPORT_CDECL(value&) operator=(const value&); value(value&&) = default; value& operator=(value&&) = default; @@ -104,22 +104,22 @@ class value { /// /// @returns A const_iterator to the first element of the document. /// - document::view::const_iterator cbegin() const; + BSONCXX_ABI_EXPORT_CDECL(document::view::const_iterator) cbegin() const; /// /// @returns A const_iterator to the past-the-end element of the document. /// - document::view::const_iterator cend() const; + BSONCXX_ABI_EXPORT_CDECL(document::view::const_iterator) cend() const; /// /// @returns A const_iterator to the first element of the document. /// - document::view::const_iterator begin() const; + BSONCXX_ABI_EXPORT_CDECL(document::view::const_iterator) begin() const; /// /// @returns A const_iterator to the past-the-end element of the document. /// - document::view::const_iterator end() const; + BSONCXX_ABI_EXPORT_CDECL(document::view::const_iterator) end() const; /// /// Finds the first element of the document with the provided key. If there is @@ -136,7 +136,7 @@ class value { /// /// @return An iterator to the matching element, if found, or the past-the-end iterator. /// - document::view::const_iterator find(stdx::string_view key) const; + BSONCXX_ABI_EXPORT_CDECL(document::view::const_iterator) find(stdx::string_view key) const; /// /// Finds the first element of the document with the provided key. If there is no @@ -148,14 +148,14 @@ class value { /// /// @return The matching element, if found, or the invalid element. /// - element operator[](stdx::string_view key) const; + BSONCXX_ABI_EXPORT_CDECL(element) operator[](stdx::string_view key) const; /// /// Access the raw bytes of the underlying document. /// /// @return A pointer to the value's buffer. /// - const std::uint8_t* data() const; + BSONCXX_ABI_EXPORT_CDECL(const std::uint8_t*) data() const; /// /// Gets the length of the underlying buffer. @@ -165,7 +165,7 @@ class value { /// /// @return The length of the document, in bytes. /// - std::size_t length() const; + BSONCXX_ABI_EXPORT_CDECL(std::size_t) length() const; /// /// Checks if the underlying document is empty, i.e. it is equivalent to @@ -173,19 +173,27 @@ class value { /// /// @return true if the underlying document is empty. /// - bool empty() const; + BSONCXX_ABI_EXPORT_CDECL(bool) empty() const; /// /// Get a view over the document owned by this value. /// - BSONCXX_INLINE document::view view() const noexcept; + document::view view() const noexcept { + // Silence false positive with g++ 10.2.1 on Debian 11. + BSONCXX_PUSH_WARNINGS(); + BSONCXX_DISABLE_WARNING(GCC("-Wmaybe-uninitialized")); + return document::view{static_cast(_data.get()), _length}; + BSONCXX_POP_WARNINGS(); + } /// /// Conversion operator that provides a view given a value. /// /// @return A view over the value. /// - BSONCXX_INLINE operator document::view() const noexcept; + operator document::view() const noexcept { + return view(); + } /// /// Constructs an object of type T from this document object. This method uses @@ -224,43 +232,31 @@ class value { /// /// @return A std::unique_ptr with ownership of the buffer. /// - unique_ptr_type release(); + BSONCXX_ABI_EXPORT_CDECL(unique_ptr_type) release(); /// /// Replace the formerly-owned buffer with the new view. /// This will make a copy of the passed-in view. /// - void reset(document::view view); + BSONCXX_ABI_EXPORT_CDECL(void) reset(document::view view); private: unique_ptr_type _data; std::size_t _length{0}; }; -BSONCXX_INLINE document::view value::view() const noexcept { - // Silence false positive with g++ 10.2.1 on Debian 11. - BSONCXX_PUSH_WARNINGS(); - BSONCXX_DISABLE_WARNING(GCC("-Wmaybe-uninitialized")); - return document::view{static_cast(_data.get()), _length}; - BSONCXX_POP_WARNINGS(); -} - -BSONCXX_INLINE value::operator document::view() const noexcept { - return view(); -} - /// /// Compares two document values for (in)-equality. /// /// @{ /// @relatesalso bsoncxx::v_noabi::document::value -BSONCXX_INLINE bool operator==(const value& lhs, const value& rhs) { +inline bool operator==(const value& lhs, const value& rhs) { return (lhs.view() == rhs.view()); } /// @relatesalso bsoncxx::v_noabi::document::value -BSONCXX_INLINE bool operator!=(const value& lhs, const value& rhs) { +inline bool operator!=(const value& lhs, const value& rhs) { return !(lhs == rhs); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view-fwd.hpp index d3054a09d4..9cd2269dc8 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace document { -class BSONCXX_API view; +class view; } // namespace document } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view.hpp index 7f5586c522..458215c095 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/view.hpp @@ -34,14 +34,14 @@ namespace document { /// class view { public: - class BSONCXX_API const_iterator; + class const_iterator; using iterator = const_iterator; /// /// Default constructs a view. The resulting view will be initialized to point at /// an empty BSON document. /// - view(); + BSONCXX_ABI_EXPORT_CDECL() view(); /// /// Constructs a view from a buffer. The caller is responsible for ensuring that @@ -52,27 +52,27 @@ class view { /// @param length /// The size of the buffer, in bytes. /// - view(const std::uint8_t* data, std::size_t length); + BSONCXX_ABI_EXPORT_CDECL() view(const std::uint8_t* data, std::size_t length); /// /// @returns A const_iterator to the first element of the document. /// - const_iterator cbegin() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) cbegin() const; /// /// @returns A const_iterator to the past-the-end element of the document. /// - const_iterator cend() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) cend() const; /// /// @returns A const_iterator to the first element of the document. /// - const_iterator begin() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) begin() const; /// /// @returns A const_iterator to the past-the-end element of the document. /// - const_iterator end() const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) end() const; /// /// Finds the first element of the document with the provided key. If there is @@ -89,7 +89,7 @@ class view { /// /// @return An iterator to the matching element, if found, or the past-the-end iterator. /// - const_iterator find(stdx::string_view key) const; + BSONCXX_ABI_EXPORT_CDECL(const_iterator) find(stdx::string_view key) const; /// /// Finds the first element of the document with the provided key. If there is no @@ -101,14 +101,14 @@ class view { /// /// @return The matching element, if found, or the invalid element. /// - element operator[](stdx::string_view key) const; + BSONCXX_ABI_EXPORT_CDECL(element) operator[](stdx::string_view key) const; /// /// Access the raw bytes of the underlying document. /// /// @return A (non-owning) pointer to the view's buffer. /// - const std::uint8_t* data() const; + BSONCXX_ABI_EXPORT_CDECL(const std::uint8_t*) data() const; /// /// Gets the length of the underlying buffer. @@ -118,7 +118,7 @@ class view { /// /// @return The length of the document, in bytes. /// - std::size_t length() const; + BSONCXX_ABI_EXPORT_CDECL(std::size_t) length() const; /// /// Checks if the underlying document is empty, i.e. it is equivalent to @@ -126,7 +126,7 @@ class view { /// /// @return true if the underlying document is empty. /// - bool empty() const; + BSONCXX_ABI_EXPORT_CDECL(bool) empty() const; /// /// @relates bsoncxx::v_noabi::document::view @@ -134,8 +134,8 @@ class view { /// Compare two document views for (in)-equality. /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator==(view, view); - friend BSONCXX_API bool BSONCXX_CALL operator!=(view, view); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(view, view); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(view, view); /// @} /// @@ -161,14 +161,14 @@ class view::const_iterator { using iterator_category = std::forward_iterator_tag; using difference_type = std::ptrdiff_t; - const_iterator(); - explicit const_iterator(const element& element); + BSONCXX_ABI_EXPORT_CDECL() const_iterator(); + explicit BSONCXX_ABI_EXPORT_CDECL() const_iterator(const element& element); - reference operator*(); - pointer operator->(); + BSONCXX_ABI_EXPORT_CDECL(reference) operator*(); + BSONCXX_ABI_EXPORT_CDECL(pointer) operator->(); - const_iterator& operator++(); - const_iterator operator++(int); + BSONCXX_ABI_EXPORT_CDECL(const_iterator&) operator++(); + BSONCXX_ABI_EXPORT_CDECL(const_iterator) operator++(int); /// /// @relates bsoncxx::v_noabi::document::view::const_iterator @@ -176,8 +176,8 @@ class view::const_iterator { /// Compares two const_iterators for (in)-equality. /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator==(const const_iterator&, const const_iterator&); - friend BSONCXX_API bool BSONCXX_CALL operator!=(const const_iterator&, const const_iterator&); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const const_iterator&, const const_iterator&); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const const_iterator&, const const_iterator&); /// @} /// 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 d460380250..f330f82c41 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 @@ -117,7 +117,7 @@ enum class error_code : std::int32_t { /// /// @return The bsoncxx error_category /// -BSONCXX_API const std::error_category& BSONCXX_CALL error_category(); +BSONCXX_ABI_EXPORT_CDECL(const std::error_category&) error_category(); /// /// Translate a bsoncxx::v_noabi::error_code into a std::error_code. @@ -125,7 +125,7 @@ BSONCXX_API const std::error_category& BSONCXX_CALL error_category(); /// @param error An error from bsoncxx /// @return An error_code /// -BSONCXX_INLINE std::error_code make_error_code(error_code error) { +inline std::error_code make_error_code(error_code error) { return {static_cast(error), error_category()}; } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception-fwd.hpp index 516df7d0db..ce818ff891 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception-fwd.hpp @@ -19,7 +19,7 @@ namespace bsoncxx { namespace v_noabi { -class BSONCXX_API exception; +class BSONCXX_ABI_EXPORT exception; } // namespace v_noabi } // namespace bsoncxx diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp index 385022b532..a812a7df23 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp @@ -50,11 +50,11 @@ enum class ExtendedJsonMode : std::uint8_t { /// /// @{ -BSONCXX_API std::string BSONCXX_CALL to_json(document::view view, - ExtendedJsonMode mode = ExtendedJsonMode::k_legacy); +BSONCXX_ABI_EXPORT_CDECL(std::string) +to_json(document::view view, ExtendedJsonMode mode = ExtendedJsonMode::k_legacy); -BSONCXX_API std::string BSONCXX_CALL to_json(array::view view, - ExtendedJsonMode mode = ExtendedJsonMode::k_legacy); +BSONCXX_ABI_EXPORT_CDECL(std::string) +to_json(array::view view, ExtendedJsonMode mode = ExtendedJsonMode::k_legacy); /// @} /// @@ -68,7 +68,7 @@ BSONCXX_API std::string BSONCXX_CALL to_json(array::view view, /// /// @throws bsoncxx::v_noabi::exception with error details if the conversion failed. /// -BSONCXX_API document::value BSONCXX_CALL from_json(stdx::string_view json); +BSONCXX_ABI_EXPORT_CDECL(document::value) from_json(stdx::string_view json); /// /// Constructs a new document::value from the provided JSON text. This is the UDL version of diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid-fwd.hpp index a7db1f3fb6..3838a67f86 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid-fwd.hpp @@ -19,7 +19,7 @@ namespace bsoncxx { namespace v_noabi { -class BSONCXX_API oid; +class oid; } // namespace v_noabi } // namespace bsoncxx diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid.hpp index eb4f5ba1bf..c0c5f87623 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/oid.hpp @@ -44,7 +44,7 @@ class oid { /// /// Constructs an oid and initializes it to a newly generated ObjectId. /// - oid(); + BSONCXX_ABI_EXPORT_CDECL() oid(); /// /// Constructs an oid initializes it to the contents of the provided buffer. @@ -56,7 +56,7 @@ class oid { /// /// @throws bsoncxx::v_noabi::exception if the length is not equal to oid::size(). /// - explicit oid(const char* bytes, std::size_t len); + explicit BSONCXX_ABI_EXPORT_CDECL() oid(const char* bytes, std::size_t len); /// /// Constructs an oid and initializes it from the provided hex string. @@ -67,14 +67,14 @@ class oid { /// @throws bsoncxx::v_noabi::exception if the string isn't an OID-sized hex /// string. /// - explicit oid(const stdx::string_view& str); + explicit BSONCXX_ABI_EXPORT_CDECL() oid(const stdx::string_view& str); /// /// Converts this oid to a hexadecimal string. /// /// @return A hexadecimal string representation of this ObjectId. /// - std::string to_string() const; + BSONCXX_ABI_EXPORT_CDECL(std::string) to_string() const; /// /// Returns the number of bytes in this ObjectId. @@ -91,12 +91,12 @@ class oid { /// Relational operators for OIDs. /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator<(const oid& lhs, const oid& rhs); - friend BSONCXX_API bool BSONCXX_CALL operator>(const oid& lhs, const oid& rhs); - friend BSONCXX_API bool BSONCXX_CALL operator<=(const oid& lhs, const oid& rhs); - friend BSONCXX_API bool BSONCXX_CALL operator>=(const oid& lhs, const oid& rhs); - friend BSONCXX_API bool BSONCXX_CALL operator==(const oid& lhs, const oid& rhs); - friend BSONCXX_API bool BSONCXX_CALL operator!=(const oid& lhs, const oid& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator<(const oid& lhs, const oid& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator>(const oid& lhs, const oid& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator<=(const oid& lhs, const oid& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator>=(const oid& lhs, const oid& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const oid& lhs, const oid& rhs); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const oid& lhs, const oid& rhs); /// @} /// @@ -106,17 +106,17 @@ class oid { /// /// @return A std::time_t initialized to the timestamp. /// - std::time_t get_time_t() const; + BSONCXX_ABI_EXPORT_CDECL(std::time_t) get_time_t() const; /// /// An accessor for the internal data buffer in the oid. /// /// @return A pointer to the internal buffer holding the oid bytes. /// - const char* bytes() const; + BSONCXX_ABI_EXPORT_CDECL(const char*) bytes() const; private: - friend BSONCXX_PRIVATE int oid_compare(const oid& lhs, const oid& rhs); + friend int oid_compare(const oid& lhs, const oid& rhs); std::array _bytes; }; diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/to_string.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/to_string.hpp index eb5efbdac4..2b3cc78c9a 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/to_string.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/to_string.hpp @@ -46,7 +46,7 @@ namespace string { template , class Allocator = std::allocator> -BSONCXX_INLINE std::basic_string to_string( +std::basic_string to_string( v_noabi::stdx::basic_string_view value, const Allocator& alloc = Allocator()) { return std::basic_string{value.data(), value.length(), alloc}; } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value-fwd.hpp index 4c0a42bd03..a0a9e634e8 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value-fwd.hpp @@ -20,7 +20,7 @@ namespace bsoncxx { namespace v_noabi { namespace string { -class BSONCXX_API view_or_value; +class view_or_value; } // namespace string } // namespace v_noabi diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value.hpp index ef73876504..31618e7e17 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/string/view_or_value.hpp @@ -49,7 +49,7 @@ class view_or_value : public bsoncxx::v_noabi::view_or_value(stdx::string_view(str)) {} /// @@ -71,7 +71,7 @@ class view_or_value : public bsoncxx::v_noabi::view_or_value(stdx::string_view(str)) {} /// @@ -84,7 +84,7 @@ class view_or_value : public bsoncxx::v_noabi::view_or_value #undef BSONCXX_ENUM #pragma pop_macro("BSONCXX_ENUM") diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp index a1738d3b10..3995532974 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types.hpp @@ -80,7 +80,7 @@ enum class binary_sub_type : std::uint8_t { /// /// @return a std::string representation of the type. /// -BSONCXX_API std::string BSONCXX_CALL to_string(type rhs); +BSONCXX_ABI_EXPORT_CDECL(std::string) to_string(type rhs); /// /// Returns a stringification of the given binary sub type. @@ -90,7 +90,7 @@ BSONCXX_API std::string BSONCXX_CALL to_string(type rhs); /// /// @return a std::string representation of the type. /// -BSONCXX_API std::string BSONCXX_CALL to_string(binary_sub_type rhs); +BSONCXX_ABI_EXPORT_CDECL(std::string) to_string(binary_sub_type rhs); namespace types { @@ -98,14 +98,14 @@ namespace types { /// A BSON double value. /// struct b_double { - static constexpr auto type_id = type::k_double; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_double; double value; /// /// Conversion operator unwrapping a double /// - BSONCXX_INLINE operator double() const { + operator double() const { return value; } }; @@ -115,7 +115,7 @@ struct b_double { /// /// @relatesalso bsoncxx::v_noabi::types::b_double /// -BSONCXX_INLINE bool operator==(const b_double& lhs, const b_double& rhs) { +inline bool operator==(const b_double& lhs, const b_double& rhs) { return lhs.value == rhs.value; } @@ -123,7 +123,7 @@ BSONCXX_INLINE bool operator==(const b_double& lhs, const b_double& rhs) { /// A BSON UTF-8 encoded string value. /// struct b_string { - static constexpr auto type_id = type::k_string; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_string; /// /// Constructor for b_string. @@ -132,14 +132,14 @@ struct b_string { /// The value to wrap. /// template > = 0> - BSONCXX_INLINE explicit b_string(T&& t) : value(std::forward(t)) {} + explicit b_string(T&& t) : value(std::forward(t)) {} stdx::string_view value; /// /// Conversion operator unwrapping a string_view /// - BSONCXX_INLINE operator stdx::string_view() const { + operator stdx::string_view() const { return value; } }; @@ -149,7 +149,7 @@ struct b_string { /// /// @relatesalso bsoncxx::v_noabi::types::b_string /// -BSONCXX_INLINE bool operator==(const b_string& lhs, const b_string& rhs) { +inline bool operator==(const b_string& lhs, const b_string& rhs) { return lhs.value == rhs.value; } @@ -164,21 +164,21 @@ BSONCXX_DEPRECATED typedef b_string b_utf8; /// A BSON document value. /// struct b_document { - static constexpr auto type_id = type::k_document; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_document; document::view value; /// /// Conversion operator unwrapping a document::view /// - BSONCXX_INLINE operator document::view() const { + operator document::view() const { return value; } /// /// Returns an unwrapped document::view /// - BSONCXX_INLINE document::view view() { + document::view view() { return value; } }; @@ -188,7 +188,7 @@ struct b_document { /// /// @relatesalso bsoncxx::v_noabi::types::b_document /// -BSONCXX_INLINE bool operator==(const b_document& lhs, const b_document& rhs) { +inline bool operator==(const b_document& lhs, const b_document& rhs) { return lhs.value == rhs.value; } @@ -196,14 +196,14 @@ BSONCXX_INLINE bool operator==(const b_document& lhs, const b_document& rhs) { /// A BSON array value. /// struct b_array { - static constexpr auto type_id = type::k_array; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_array; array::view value; /// /// Conversion operator unwrapping an array::view /// - BSONCXX_INLINE operator array::view() const { + operator array::view() const { return value; } }; @@ -213,7 +213,7 @@ struct b_array { /// /// @relatesalso bsoncxx::v_noabi::types::b_array /// -BSONCXX_INLINE bool operator==(const b_array& lhs, const b_array& rhs) { +inline bool operator==(const b_array& lhs, const b_array& rhs) { return lhs.value == rhs.value; } @@ -221,7 +221,7 @@ BSONCXX_INLINE bool operator==(const b_array& lhs, const b_array& rhs) { /// A BSON binary data value. /// struct b_binary { - static constexpr auto type_id = type::k_binary; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_binary; binary_sub_type sub_type; uint32_t size; @@ -233,7 +233,7 @@ struct b_binary { /// /// @relatesalso bsoncxx::v_noabi::types::b_binary /// -BSONCXX_INLINE bool operator==(const b_binary& lhs, const b_binary& rhs) { +inline bool operator==(const b_binary& lhs, const b_binary& rhs) { return lhs.sub_type == rhs.sub_type && lhs.size == rhs.size && (!lhs.size || (std::memcmp(lhs.bytes, rhs.bytes, lhs.size) == 0)); } @@ -244,7 +244,7 @@ BSONCXX_INLINE bool operator==(const b_binary& lhs, const b_binary& rhs) { /// @deprecated This BSON type is deprecated. Usage is discouraged. /// struct b_undefined { - static constexpr auto type_id = type::k_undefined; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_undefined; }; /// @@ -252,7 +252,7 @@ struct b_undefined { /// /// @relatesalso bsoncxx::v_noabi::types::b_undefined /// -BSONCXX_INLINE bool operator==(const b_undefined&, const b_undefined&) { +inline bool operator==(const b_undefined&, const b_undefined&) { return true; } @@ -260,7 +260,7 @@ BSONCXX_INLINE bool operator==(const b_undefined&, const b_undefined&) { /// A BSON ObjectId value. /// struct b_oid { - static constexpr auto type_id = type::k_oid; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_oid; oid value; }; @@ -270,7 +270,7 @@ struct b_oid { /// /// @relatesalso bsoncxx::v_noabi::types::b_oid /// -BSONCXX_INLINE bool operator==(const b_oid& lhs, const b_oid& rhs) { +inline bool operator==(const b_oid& lhs, const b_oid& rhs) { return lhs.value == rhs.value; } @@ -278,14 +278,14 @@ BSONCXX_INLINE bool operator==(const b_oid& lhs, const b_oid& rhs) { /// A BSON boolean value. /// struct b_bool { - static constexpr auto type_id = type::k_bool; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_bool; bool value; /// /// Conversion operator unwrapping a bool /// - BSONCXX_INLINE operator bool() const { + operator bool() const { return value; } }; @@ -295,7 +295,7 @@ struct b_bool { /// /// @relatesalso bsoncxx::v_noabi::types::b_bool /// -BSONCXX_INLINE bool operator==(const b_bool& lhs, const b_bool& rhs) { +inline bool operator==(const b_bool& lhs, const b_bool& rhs) { return lhs.value == rhs.value; } @@ -303,7 +303,7 @@ BSONCXX_INLINE bool operator==(const b_bool& lhs, const b_bool& rhs) { /// A BSON date value. /// struct b_date { - static constexpr auto type_id = type::k_date; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_date; /// /// Constructor for b_date @@ -311,7 +311,6 @@ struct b_date { /// @param value /// Milliseconds since the system_clock epoch. /// - BSONCXX_INLINE explicit b_date(std::chrono::milliseconds value) : value(value) {} /// @@ -320,7 +319,6 @@ struct b_date { /// @param tp /// A system_clock time_point. /// - BSONCXX_INLINE explicit b_date(const std::chrono::system_clock::time_point& tp) : value(std::chrono::duration_cast(tp.time_since_epoch())) {} @@ -329,21 +327,21 @@ struct b_date { /// /// Conversion operator unwrapping a int64_t /// - BSONCXX_INLINE operator int64_t() const { + operator int64_t() const { return value.count(); } /// /// Manually convert this b_date to an int64_t /// - BSONCXX_INLINE int64_t to_int64() const { + int64_t to_int64() const { return value.count(); } /// /// Conversion operator unwrapping a time_point /// - BSONCXX_INLINE operator std::chrono::system_clock::time_point() const { + operator std::chrono::system_clock::time_point() const { return std::chrono::system_clock::time_point( std::chrono::duration_cast(value)); } @@ -354,7 +352,7 @@ struct b_date { /// /// @relatesalso bsoncxx::v_noabi::types::b_date /// -BSONCXX_INLINE bool operator==(const b_date& lhs, const b_date& rhs) { +inline bool operator==(const b_date& lhs, const b_date& rhs) { return lhs.value == rhs.value; } @@ -362,7 +360,7 @@ BSONCXX_INLINE bool operator==(const b_date& lhs, const b_date& rhs) { /// A BSON null value. /// struct b_null { - static constexpr auto type_id = type::k_null; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_null; }; /// @@ -370,7 +368,7 @@ struct b_null { /// /// @relatesalso bsoncxx::v_noabi::types::b_null /// -BSONCXX_INLINE bool operator==(const b_null&, const b_null&) { +inline bool operator==(const b_null&, const b_null&) { return true; } @@ -378,7 +376,7 @@ BSONCXX_INLINE bool operator==(const b_null&, const b_null&) { /// A BSON regex value. /// struct b_regex { - static constexpr auto type_id = type::k_regex; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_regex; /// /// Constructor for b_regex @@ -392,7 +390,7 @@ struct b_regex { template > = 0> - BSONCXX_INLINE explicit b_regex(T&& regex, U&& options = U{}) + explicit b_regex(T&& regex, U&& options = U{}) : regex(std::forward(regex)), options(std::forward(options)) {} stdx::string_view regex; @@ -404,7 +402,7 @@ struct b_regex { /// /// @relatesalso bsoncxx::v_noabi::types::b_regex /// -BSONCXX_INLINE bool operator==(const b_regex& lhs, const b_regex& rhs) { +inline bool operator==(const b_regex& lhs, const b_regex& rhs) { return lhs.regex == rhs.regex && lhs.options == rhs.options; } @@ -414,7 +412,7 @@ BSONCXX_INLINE bool operator==(const b_regex& lhs, const b_regex& rhs) { /// @deprecated This BSON type is deprecated. Usage is discouraged. /// struct b_dbpointer { - static constexpr auto type_id = type::k_dbpointer; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_dbpointer; stdx::string_view collection; oid value; @@ -425,7 +423,7 @@ struct b_dbpointer { /// /// @relatesalso bsoncxx::v_noabi::types::b_dbpointer /// -BSONCXX_INLINE bool operator==(const b_dbpointer& lhs, const b_dbpointer& rhs) { +inline bool operator==(const b_dbpointer& lhs, const b_dbpointer& rhs) { return lhs.collection == rhs.collection && lhs.value == rhs.value; } @@ -433,7 +431,7 @@ BSONCXX_INLINE bool operator==(const b_dbpointer& lhs, const b_dbpointer& rhs) { /// A BSON JavaScript code value. /// struct b_code { - static constexpr auto type_id = type::k_code; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_code; /// /// Constructor for b_code. @@ -442,14 +440,14 @@ struct b_code { /// The js code /// template > = 0> - BSONCXX_INLINE explicit b_code(T&& t) : code(std::forward(t)) {} + explicit b_code(T&& t) : code(std::forward(t)) {} stdx::string_view code; /// /// Conversion operator unwrapping a string_view /// - BSONCXX_INLINE operator stdx::string_view() const { + operator stdx::string_view() const { return code; } }; @@ -459,7 +457,7 @@ struct b_code { /// /// @relatesalso bsoncxx::v_noabi::types::b_code /// -BSONCXX_INLINE bool operator==(const b_code& lhs, const b_code& rhs) { +inline bool operator==(const b_code& lhs, const b_code& rhs) { return lhs.code == rhs.code; } @@ -469,7 +467,7 @@ BSONCXX_INLINE bool operator==(const b_code& lhs, const b_code& rhs) { /// @deprecated This BSON type is deprecated. Usage is discouraged. /// struct b_symbol { - static constexpr auto type_id = type::k_symbol; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_symbol; /// /// Constructor for b_symbol. @@ -478,14 +476,14 @@ struct b_symbol { /// The symbol. /// template > = 0> - BSONCXX_INLINE explicit b_symbol(T&& t) : symbol(std::forward(t)) {} + explicit b_symbol(T&& t) : symbol(std::forward(t)) {} stdx::string_view symbol; /// /// Conversion operator unwrapping a string_view /// - BSONCXX_INLINE operator stdx::string_view() const { + operator stdx::string_view() const { return symbol; } }; @@ -495,7 +493,7 @@ struct b_symbol { /// /// @relatesalso bsoncxx::v_noabi::types::b_symbol /// -BSONCXX_INLINE bool operator==(const b_symbol& lhs, const b_symbol& rhs) { +inline bool operator==(const b_symbol& lhs, const b_symbol& rhs) { return lhs.symbol == rhs.symbol; } @@ -503,7 +501,7 @@ BSONCXX_INLINE bool operator==(const b_symbol& lhs, const b_symbol& rhs) { /// A BSON JavaScript code with scope value. /// struct b_codewscope { - static constexpr auto type_id = type::k_codewscope; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_codewscope; /// /// Constructor for b_codewscope. @@ -517,7 +515,7 @@ struct b_codewscope { template > = 0> - BSONCXX_INLINE explicit b_codewscope(T&& code, U&& scope) + explicit b_codewscope(T&& code, U&& scope) : code(std::forward(code)), scope(std::forward(scope)) {} stdx::string_view code; @@ -529,7 +527,7 @@ struct b_codewscope { /// /// @relatesalso bsoncxx::v_noabi::types::b_codewscope /// -BSONCXX_INLINE bool operator==(const b_codewscope& lhs, const b_codewscope& rhs) { +inline bool operator==(const b_codewscope& lhs, const b_codewscope& rhs) { return lhs.code == rhs.code && lhs.scope == rhs.scope; } @@ -537,14 +535,14 @@ BSONCXX_INLINE bool operator==(const b_codewscope& lhs, const b_codewscope& rhs) /// A BSON signed 32-bit integer value. /// struct b_int32 { - static constexpr auto type_id = type::k_int32; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_int32; int32_t value; /// /// Conversion operator unwrapping a int32_t /// - BSONCXX_INLINE operator int32_t() const { + operator int32_t() const { return value; } }; @@ -554,7 +552,7 @@ struct b_int32 { /// /// @relatesalso bsoncxx::v_noabi::types::b_int32 /// -BSONCXX_INLINE bool operator==(const b_int32& lhs, const b_int32& rhs) { +inline bool operator==(const b_int32& lhs, const b_int32& rhs) { return lhs.value == rhs.value; } @@ -562,7 +560,7 @@ BSONCXX_INLINE bool operator==(const b_int32& lhs, const b_int32& rhs) { /// A BSON replication timestamp value. /// struct b_timestamp { - static constexpr auto type_id = type::k_timestamp; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_timestamp; uint32_t increment; uint32_t timestamp; @@ -573,7 +571,7 @@ struct b_timestamp { /// /// @relatesalso bsoncxx::v_noabi::types::b_timestamp /// -BSONCXX_INLINE bool operator==(const b_timestamp& lhs, const b_timestamp& rhs) { +inline bool operator==(const b_timestamp& lhs, const b_timestamp& rhs) { return lhs.increment == rhs.increment && lhs.timestamp == rhs.timestamp; } @@ -581,14 +579,14 @@ BSONCXX_INLINE bool operator==(const b_timestamp& lhs, const b_timestamp& rhs) { /// A BSON 64-bit signed integer value. /// struct b_int64 { - static constexpr auto type_id = type::k_int64; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_int64; int64_t value; /// /// Conversion operator unwrapping a int64_t /// - BSONCXX_INLINE operator int64_t() const { + operator int64_t() const { return value; } }; @@ -598,7 +596,7 @@ struct b_int64 { /// /// @relatesalso bsoncxx::v_noabi::types::b_int64 /// -BSONCXX_INLINE bool operator==(const b_int64& lhs, const b_int64& rhs) { +inline bool operator==(const b_int64& lhs, const b_int64& rhs) { return lhs.value == rhs.value; } @@ -606,7 +604,7 @@ BSONCXX_INLINE bool operator==(const b_int64& lhs, const b_int64& rhs) { /// A BSON Decimal128 value. /// struct b_decimal128 { - static constexpr auto type_id = type::k_decimal128; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_decimal128; decimal128 value; @@ -617,7 +615,7 @@ struct b_decimal128 { /// The value to wrap. /// template > = 0> - BSONCXX_INLINE explicit b_decimal128(T&& t) : value(std::forward(t)) {} + explicit b_decimal128(T&& t) : value(std::forward(t)) {} }; /// @@ -625,7 +623,7 @@ struct b_decimal128 { /// /// @relatesalso bsoncxx::v_noabi::types::b_decimal128 /// -BSONCXX_INLINE bool operator==(const b_decimal128& lhs, const b_decimal128& rhs) { +inline bool operator==(const b_decimal128& lhs, const b_decimal128& rhs) { return lhs.value == rhs.value; } @@ -633,7 +631,7 @@ BSONCXX_INLINE bool operator==(const b_decimal128& lhs, const b_decimal128& rhs) /// A BSON min-key value. /// struct b_minkey { - static constexpr auto type_id = type::k_minkey; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_minkey; }; /// @@ -641,7 +639,7 @@ struct b_minkey { /// /// @relatesalso bsoncxx::v_noabi::types::b_minkey /// -BSONCXX_INLINE bool operator==(const b_minkey&, const b_minkey&) { +inline bool operator==(const b_minkey&, const b_minkey&) { return true; } @@ -649,7 +647,7 @@ BSONCXX_INLINE bool operator==(const b_minkey&, const b_minkey&) { /// A BSON max-key value. /// struct b_maxkey { - static constexpr auto type_id = type::k_maxkey; + BSONCXX_ABI_EXPORT static constexpr auto type_id = type::k_maxkey; }; /// @@ -657,7 +655,7 @@ struct b_maxkey { /// /// @relatesalso bsoncxx::v_noabi::types::b_maxkey /// -BSONCXX_INLINE bool operator==(const b_maxkey&, const b_maxkey&) { +inline bool operator==(const b_maxkey&, const b_maxkey&) { return true; } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/make_value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/make_value.hpp index 9c4e237493..7a55c65296 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/make_value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/make_value.hpp @@ -30,7 +30,7 @@ namespace bson_value { /// of the passed-in t can be anything that builder::basic::sub_document::append accepts. /// template -BSONCXX_INLINE bson_value::value make_value(T&& t) { +bson_value::value make_value(T&& t) { auto doc = builder::basic::make_document(builder::basic::kvp("v", std::forward(t))); return doc.view()["v"].get_owning_value(); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value-fwd.hpp index a34ec0446a..d1463117d3 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/value-fwd.hpp @@ -21,7 +21,7 @@ namespace v_noabi { namespace types { namespace bson_value { -class BSONCXX_API value; +class value; } // namespace bson_value } // namespace types 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 0070f56334..7112fbf4b5 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 @@ -55,74 +55,74 @@ class value { /// value(b_document v); /// value(b_array v); ... /// -#define BSONCXX_ENUM(name, val) value(b_##name v); +#define BSONCXX_ENUM(name, val) BSONCXX_ABI_EXPORT_CDECL() value(b_##name v); #include #undef BSONCXX_ENUM /// /// Constructs a BSON UTF-8 string value. /// - value(const char* v); + BSONCXX_ABI_EXPORT_CDECL() value(const char* v); /// /// Constructs a BSON UTF-8 string value. /// - value(std::string v); + BSONCXX_ABI_EXPORT_CDECL() value(std::string v); /// /// Constructs a BSON UTF-8 string value. /// - value(stdx::string_view v); + BSONCXX_ABI_EXPORT_CDECL() value(stdx::string_view v); /// /// Constructs a BSON 32-bit signed integer value. /// - value(int32_t v); + BSONCXX_ABI_EXPORT_CDECL() value(int32_t v); /// /// Constructs a BSON 64-bit signed integer value. /// - value(int64_t v); + BSONCXX_ABI_EXPORT_CDECL() value(int64_t v); /// /// Constructs a BSON double value. /// - value(double v); + BSONCXX_ABI_EXPORT_CDECL() value(double v); /// /// Constructs a BSON boolean value. /// - value(bool v); + BSONCXX_ABI_EXPORT_CDECL() value(bool v); /// /// Constructs a BSON ObjectId value. /// - value(oid v); + BSONCXX_ABI_EXPORT_CDECL() value(oid v); /// /// Constructs a BSON Decimal128 value. /// - value(decimal128 v); + BSONCXX_ABI_EXPORT_CDECL() value(decimal128 v); /// /// Constructs a BSON date value. /// - value(std::chrono::milliseconds v); + BSONCXX_ABI_EXPORT_CDECL() value(std::chrono::milliseconds v); /// /// Constructs a BSON null value. /// - value(std::nullptr_t); + BSONCXX_ABI_EXPORT_CDECL() value(std::nullptr_t); /// /// Constructs a BSON document value. /// - value(bsoncxx::v_noabi::document::view v); + BSONCXX_ABI_EXPORT_CDECL() value(bsoncxx::v_noabi::document::view v); /// /// Constructs a BSON array value. /// - value(bsoncxx::v_noabi::array::view v); + BSONCXX_ABI_EXPORT_CDECL() value(bsoncxx::v_noabi::array::view v); /// /// Constructs a BSON binary data value. @@ -132,6 +132,7 @@ class value { /// @param sub_type /// an optional binary sub type. Defaults to type::k_binary /// + BSONCXX_ABI_EXPORT_CDECL() value(std::vector v, const binary_sub_type sub_type = {}); /// @@ -144,6 +145,7 @@ class value { /// @param sub_type /// an optional binary sub type. Defaults to type::k_binary /// + BSONCXX_ABI_EXPORT_CDECL() value(const uint8_t* data, size_t size, const binary_sub_type sub_type = {}); /// @@ -156,7 +158,7 @@ class value { /// /// @warning The DBPointer (aka DBRef) BSON type is deprecated. Usage is discouraged. /// - value(stdx::string_view collection, oid value); + BSONCXX_ABI_EXPORT_CDECL() value(stdx::string_view collection, oid value); /// /// Constructs a BSON JavaScript code with scope value. @@ -166,6 +168,7 @@ class value { /// @param scope /// a bson document view holding the scope environment /// + BSONCXX_ABI_EXPORT_CDECL() value(stdx::string_view code, bsoncxx::v_noabi::document::view_or_value scope); /// @@ -176,7 +179,7 @@ class value { /// @param options /// The regex options /// - value(stdx::string_view regex, stdx::string_view options); + BSONCXX_ABI_EXPORT_CDECL() value(stdx::string_view regex, stdx::string_view options); /// /// Constructs one of the following BSON values (each specified by the parenthesized type): @@ -195,7 +198,7 @@ class value { /// @warning The Symbol BSON type is deprecated. Usage is discouraged. /// @warning The Undefined BSON type is deprecated. Usage is discouraged. /// - value(const type id, stdx::string_view v); + BSONCXX_ABI_EXPORT_CDECL() value(const type id, stdx::string_view v); /// /// Constructs one of the following BSON values (each specified by the parenthesized type): @@ -209,7 +212,7 @@ class value { /// @throws bsoncxx::v_noabi::exception if the type's value is not k_maxkey, k_minkey, or /// k_undefined. /// - value(const type id); + BSONCXX_ABI_EXPORT_CDECL() value(const type id); /// /// Constructs one of the following BSON values (each specified by the parenthesized type): @@ -231,30 +234,30 @@ class value { /// The BSON timestamp type is used internally by the MongoDB server - use by clients /// is discouraged. /// - value(const type id, uint64_t a, uint64_t b); + BSONCXX_ABI_EXPORT_CDECL() value(const type id, uint64_t a, uint64_t b); - ~value(); + BSONCXX_ABI_EXPORT_CDECL() ~value(); - value(const value&); - value& operator=(const value&); + BSONCXX_ABI_EXPORT_CDECL() value(const value&); + BSONCXX_ABI_EXPORT_CDECL(value&) operator=(const value&); - value(value&&) noexcept; - value& operator=(value&&) noexcept; + BSONCXX_ABI_EXPORT_CDECL() value(value&&) noexcept; + BSONCXX_ABI_EXPORT_CDECL(value&) operator=(value&&) noexcept; /// /// Create an owning copy of a bson_value::view. /// - explicit value(const view&); + explicit BSONCXX_ABI_EXPORT_CDECL() value(const view&); /// /// Get a view over the bson_value owned by this object. /// - bson_value::view view() const noexcept; + BSONCXX_ABI_EXPORT_CDECL(bson_value::view) view() const noexcept; /// /// Conversion operator that provides a bson_value::view given a bson_value::value. /// - operator bson_value::view() const noexcept; + BSONCXX_ABI_EXPORT_CDECL() operator bson_value::view() const noexcept; private: friend ::bsoncxx::v_noabi::document::element; @@ -265,11 +268,12 @@ class value { std::uint32_t keylen); // Makes a copy of 'internal_value' and owns the copy. - value(void* internal_value); + // Export is required by mongocxx via make_owning_bson. + BSONCXX_ABI_EXPORT_CDECL() value(void* internal_value); friend value make_owning_bson(void* internal_value); - class BSONCXX_PRIVATE impl; + class impl; std::unique_ptr _impl; }; @@ -279,12 +283,12 @@ class value { /// @{ /// @relatesalso bsoncxx::v_noabi::types::bson_value::value -BSONCXX_INLINE bool operator==(const value& lhs, const value& rhs) { +inline bool operator==(const value& lhs, const value& rhs) { return (lhs.view() == rhs.view()); } /// @relatesalso bsoncxx::v_noabi::types::bson_value::value -BSONCXX_INLINE bool operator!=(const value& lhs, const value& rhs) { +inline bool operator!=(const value& lhs, const value& rhs) { return !(lhs == rhs); } @@ -297,22 +301,22 @@ BSONCXX_INLINE bool operator!=(const value& lhs, const value& rhs) { /// @{ /// @relatesalso bsoncxx::v_noabi::types::bson_value::value -BSONCXX_INLINE bool operator==(const value& lhs, const view& rhs) { +inline bool operator==(const value& lhs, const view& rhs) { return (lhs.view() == rhs); } /// @relatesalso bsoncxx::v_noabi::types::bson_value::value -BSONCXX_INLINE bool operator==(const view& lhs, const value& rhs) { +inline bool operator==(const view& lhs, const value& rhs) { return (rhs == lhs); } /// @relatesalso bsoncxx::v_noabi::types::bson_value::value -BSONCXX_INLINE bool operator!=(const value& lhs, const view& rhs) { +inline bool operator!=(const value& lhs, const view& rhs) { return !(lhs == rhs); } /// @relatesalso bsoncxx::v_noabi::types::bson_value::value -BSONCXX_INLINE bool operator!=(const view& lhs, const value& rhs) { +inline bool operator!=(const view& lhs, const value& rhs) { return !(lhs == rhs); } diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view-fwd.hpp index 81b7f4eec3..f8b059c796 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/types/bson_value/view-fwd.hpp @@ -21,7 +21,7 @@ namespace v_noabi { namespace types { namespace bson_value { -class BSONCXX_API view; +class view; } // namespace bson_value } // namespace types 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 8061244a4d..8bd9e9f1bd 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 @@ -54,7 +54,7 @@ class view { /// /// etc. /// -#define BSONCXX_ENUM(type, val) explicit view(b_##type) noexcept; +#define BSONCXX_ENUM(type, val) explicit BSONCXX_ABI_EXPORT_CDECL() view(b_##type) noexcept; #include #undef BSONCXX_ENUM @@ -62,12 +62,12 @@ class view { /// Default constructs a bson_value::view. The resulting view will be initialized /// to point at a bson_value of type k_null. /// - view() noexcept; + BSONCXX_ABI_EXPORT_CDECL() view() noexcept; - view(const view&) noexcept; - view& operator=(const view&) noexcept; + BSONCXX_ABI_EXPORT_CDECL() view(const view&) noexcept; + BSONCXX_ABI_EXPORT_CDECL(view&) operator=(const view&) noexcept; - ~view(); + BSONCXX_ABI_EXPORT_CDECL() ~view(); /// /// @relates bsoncxx::v_noabi::types::bson_value::view @@ -75,17 +75,17 @@ class view { /// Compare two bson_value::views for equality /// /// @{ - friend BSONCXX_API bool BSONCXX_CALL operator==(const bson_value::view&, - const bson_value::view&); - friend BSONCXX_API bool BSONCXX_CALL operator!=(const bson_value::view&, - const bson_value::view&); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator==(const bson_value::view&, + const bson_value::view&); + friend BSONCXX_ABI_EXPORT_CDECL(bool) operator!=(const bson_value::view&, + const bson_value::view&); /// @} /// /// /// @return The type of the underlying BSON value stored in this object. /// - bsoncxx::v_noabi::type type() const; + BSONCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::type) type() const; /// /// @return The underlying BSON double value. @@ -93,7 +93,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_double& get_double() const; + BSONCXX_ABI_EXPORT_CDECL(const b_double&) get_double() const; /// /// @return The underlying BSON UTF-8 string value. @@ -103,7 +103,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - BSONCXX_DEPRECATED const b_string& get_utf8() const; + BSONCXX_DEPRECATED BSONCXX_ABI_EXPORT_CDECL(const b_string&) get_utf8() const; /// /// @return The underlying BSON UTF-8 string value. @@ -111,7 +111,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_string& get_string() const; + BSONCXX_ABI_EXPORT_CDECL(const b_string&) get_string() const; /// /// @return The underlying BSON document value. @@ -119,7 +119,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_document& get_document() const; + BSONCXX_ABI_EXPORT_CDECL(const b_document&) get_document() const; /// /// @return The underlying BSON array value. @@ -127,7 +127,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_array& get_array() const; + BSONCXX_ABI_EXPORT_CDECL(const b_array&) get_array() const; /// /// @return The underlying BSON binary data value. @@ -135,7 +135,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_binary& get_binary() const; + BSONCXX_ABI_EXPORT_CDECL(const b_binary&) get_binary() const; /// /// @return The underlying BSON undefined value. @@ -143,7 +143,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_undefined& get_undefined() const; + BSONCXX_ABI_EXPORT_CDECL(const b_undefined&) get_undefined() const; /// /// @return The underlying BSON ObjectId value. @@ -151,7 +151,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_oid& get_oid() const; + BSONCXX_ABI_EXPORT_CDECL(const b_oid&) get_oid() const; /// /// @return The underlying BSON boolean value. @@ -159,7 +159,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_bool& get_bool() const; + BSONCXX_ABI_EXPORT_CDECL(const b_bool&) get_bool() const; /// /// @return The underlying BSON date value. @@ -167,7 +167,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_date& get_date() const; + BSONCXX_ABI_EXPORT_CDECL(const b_date&) get_date() const; /// /// @return The underlying BSON null value. @@ -175,7 +175,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_null& get_null() const; + BSONCXX_ABI_EXPORT_CDECL(const b_null&) get_null() const; /// /// @return The underlying BSON regex value. @@ -183,7 +183,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_regex& get_regex() const; + BSONCXX_ABI_EXPORT_CDECL(const b_regex&) get_regex() const; /// /// @return The underlying BSON DBPointer value. @@ -191,7 +191,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_dbpointer& get_dbpointer() const; + BSONCXX_ABI_EXPORT_CDECL(const b_dbpointer&) get_dbpointer() const; /// /// @return The underlying BSON JavaScript code value. @@ -199,7 +199,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_code& get_code() const; + BSONCXX_ABI_EXPORT_CDECL(const b_code&) get_code() const; /// /// @return The underlying BSON symbol value. @@ -207,7 +207,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_symbol& get_symbol() const; + BSONCXX_ABI_EXPORT_CDECL(const b_symbol&) get_symbol() const; /// /// @return The underlying BSON JavaScript code with scope value. @@ -215,7 +215,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_codewscope& get_codewscope() const; + BSONCXX_ABI_EXPORT_CDECL(const b_codewscope&) get_codewscope() const; /// /// @return The underlying BSON 32-bit signed integer value. @@ -223,7 +223,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_int32& get_int32() const; + BSONCXX_ABI_EXPORT_CDECL(const b_int32&) get_int32() const; /// /// @return The underlying BSON replication timestamp value. @@ -231,7 +231,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_timestamp& get_timestamp() const; + BSONCXX_ABI_EXPORT_CDECL(const b_timestamp&) get_timestamp() const; /// /// @return The underlying BSON 64-bit signed integer value. @@ -239,7 +239,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_int64& get_int64() const; + BSONCXX_ABI_EXPORT_CDECL(const b_int64&) get_int64() const; /// /// @return The underlying BSON Decimal128 value. @@ -247,7 +247,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_decimal128& get_decimal128() const; + BSONCXX_ABI_EXPORT_CDECL(const b_decimal128&) get_decimal128() const; /// /// @return The underlying BSON min-key value. @@ -255,7 +255,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_minkey& get_minkey() const; + BSONCXX_ABI_EXPORT_CDECL(const b_minkey&) get_minkey() const; /// /// @return The underlying BSON max-key value. @@ -263,7 +263,7 @@ class view { /// @warning /// Calling the wrong get_ method will cause an exception to be thrown. /// - const b_maxkey& get_maxkey() const; + BSONCXX_ABI_EXPORT_CDECL(const b_maxkey&) get_maxkey() const; private: friend ::bsoncxx::v_noabi::types::bson_value::value; @@ -274,7 +274,7 @@ class view { void _init(void* internal_value) noexcept; - void BSONCXX_PRIVATE destroy() noexcept; + void destroy() noexcept; bsoncxx::v_noabi::type _type; @@ -323,28 +323,28 @@ using not_view = is_bson_view_compatible; /// @relatesalso bsoncxx::v_noabi::types::bson_value::view template -BSONCXX_INLINE detail::requires_t> // +detail::requires_t> // operator==(const bson_value::view& lhs, T&& rhs) { return lhs == bson_value::view{std::forward(rhs)}; } /// @relatesalso bsoncxx::v_noabi::types::bson_value::view template -BSONCXX_INLINE detail::requires_t> // +detail::requires_t> // operator==(T&& lhs, const bson_value::view& rhs) { return bson_value::view{std::forward(lhs)} == rhs; } /// @relatesalso bsoncxx::v_noabi::types::bson_value::view template -BSONCXX_INLINE detail::requires_t> // +detail::requires_t> // operator!=(const bson_value::view& lhs, T&& rhs) { return lhs != bson_value::view{std::forward(rhs)}; } /// @relatesalso bsoncxx::v_noabi::types::bson_value::view template -BSONCXX_INLINE detail::requires_t> // +detail::requires_t> // operator!=(T&& lhs, const bson_value::view& rhs) { return bson_value::view{std::forward(lhs)} != rhs; } @@ -383,19 +383,19 @@ namespace bson_value { /// @ref bsoncxx::v_noabi::types::bson_value::operator==(const v_noabi::types::bson_value::view& lhs, T&& rhs) template -inline bool operator==(const v_noabi::types::bson_value::view& lhs, T&& rhs); +bool operator==(const v_noabi::types::bson_value::view& lhs, T&& rhs); /// @ref bsoncxx::v_noabi::types::bson_value::operator==(T&& lhs, const v_noabi::types::bson_value::view& rhs) template -inline bool operator==(T&& lhs, const v_noabi::types::bson_value::view& rhs); +bool operator==(T&& lhs, const v_noabi::types::bson_value::view& rhs); /// @ref bsoncxx::v_noabi::types::bson_value::operator!=(const v_noabi::types::bson_value::view& lhs, T&& rhs) template -inline bool operator!=(const v_noabi::types::bson_value::view& lhs, T&& rhs); +bool operator!=(const v_noabi::types::bson_value::view& lhs, T&& rhs); /// @ref bsoncxx::v_noabi::types::bson_value::operator!=(T&& lhs, const v_noabi::types::bson_value::view& rhs) template -inline bool operator!=(T&& lhs, const v_noabi::types::bson_value::view& rhs); +bool operator!=(T&& lhs, const v_noabi::types::bson_value::view& rhs); } // namespace bson_value } // namespace types diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate-fwd.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate-fwd.hpp index c1173346ca..ac3e702384 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate-fwd.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate-fwd.hpp @@ -19,7 +19,7 @@ namespace bsoncxx { namespace v_noabi { -class BSONCXX_API validator; +class validator; } // namespace v_noabi } // namespace bsoncxx diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate.hpp index f1eea0959e..a472ee5be6 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/validate.hpp @@ -41,8 +41,8 @@ namespace v_noabi { /// An engaged optional containing a view if the document is valid, or /// an unengaged optional if the document is invalid. /// -BSONCXX_API stdx::optional BSONCXX_CALL validate(const std::uint8_t* data, - std::size_t length); +BSONCXX_ABI_EXPORT_CDECL(stdx::optional) +validate(const std::uint8_t* data, std::size_t length); /// /// Validates a BSON document. This overload provides additional control over the @@ -64,7 +64,7 @@ BSONCXX_API stdx::optional BSONCXX_CALL validate(const std::uint /// An engaged optional containing a view if the document is valid, or /// an unengaged optional if the document is invalid. /// -BSONCXX_API stdx::optional BSONCXX_CALL +BSONCXX_ABI_EXPORT_CDECL(stdx::optional) validate(const std::uint8_t* data, std::size_t length, const validator& validator, @@ -79,12 +79,12 @@ class validator { /// /// Constructs a validator. /// - validator(); + BSONCXX_ABI_EXPORT_CDECL() validator(); /// /// Destructs a validator. /// - ~validator(); + BSONCXX_ABI_EXPORT_CDECL() ~validator(); /// /// Verify that all keys and string values are valid UTF-8. @@ -92,14 +92,14 @@ class validator { /// @param check_utf8 /// If true, UTF-8 validation is performed. /// - void check_utf8(bool check_utf8); + BSONCXX_ABI_EXPORT_CDECL(void) check_utf8(bool check_utf8); /// /// Getter for the current check_utf8 value of the underlying validator. /// /// @return True if UTF-8 validation is performed. /// - bool check_utf8() const; + BSONCXX_ABI_EXPORT_CDECL(bool) check_utf8() const; /// /// Verify that all keys and string values are valid UTF-8, but allow @@ -109,7 +109,7 @@ class validator { /// @param check_utf8_allow_null /// If true, UTF-8 validation (with null bytes allowed) is performed. /// - void check_utf8_allow_null(bool check_utf8_allow_null); + BSONCXX_ABI_EXPORT_CDECL(void) check_utf8_allow_null(bool check_utf8_allow_null); /// /// Getter for the current check_utf8_allow_null value of the underlying @@ -118,7 +118,7 @@ class validator { /// @return True if UTF-8 validation (with null bytes allowed) is /// performed. /// - bool check_utf8_allow_null() const; + BSONCXX_ABI_EXPORT_CDECL(bool) check_utf8_allow_null() const; /// /// Verifies that document keys are not preceeded with '$'. @@ -126,7 +126,7 @@ class validator { /// @param check_dollar_keys /// If true, keys starting with '$' will be treated as invalid. /// - void check_dollar_keys(bool check_dollar_keys); + BSONCXX_ABI_EXPORT_CDECL(void) check_dollar_keys(bool check_dollar_keys); /// /// Getter for the current check_dollar_keys value of the underlying @@ -134,7 +134,7 @@ class validator { /// /// @return True if keys starting with '$' will be treated as invalid. /// - bool check_dollar_keys() const; + BSONCXX_ABI_EXPORT_CDECL(bool) check_dollar_keys() const; /// /// Verifies that document keys do not contain any '.' characters. @@ -142,7 +142,7 @@ class validator { /// @param check_dot_keys /// If true, keys containing '.' will be treated as invalid. /// - void check_dot_keys(bool check_dot_keys); + BSONCXX_ABI_EXPORT_CDECL(void) check_dot_keys(bool check_dot_keys); /// /// Getter for the current check_dot_keys value of the underlying @@ -150,10 +150,10 @@ class validator { /// /// @return True if keys containing '.' will be treated as invalid. /// - bool check_dot_keys() const; + BSONCXX_ABI_EXPORT_CDECL(bool) check_dot_keys() const; private: - struct BSONCXX_PRIVATE impl; + struct impl; std::unique_ptr _impl; }; diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/view_or_value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/view_or_value.hpp index 042ec27582..2cfae10338 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/view_or_value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/view_or_value.hpp @@ -64,7 +64,7 @@ class view_or_value { /// @param view /// A non-owning View. /// - BSONCXX_INLINE view_or_value(View view) : _view{view} {} + view_or_value(View view) : _view{view} {} /// /// Constructs a view_or_value from a Value type. This object owns the passed-in Value. @@ -72,18 +72,18 @@ class view_or_value { /// @param value /// A Value type. /// - BSONCXX_INLINE view_or_value(Value&& value) : _value(std::move(value)), _view(*_value) {} + view_or_value(Value&& value) : _value(std::move(value)), _view(*_value) {} /// /// Construct a view_or_value from a copied view_or_value. /// - BSONCXX_INLINE view_or_value(const view_or_value& other) + view_or_value(const view_or_value& other) : _value(other._value), _view(_value ? *_value : other._view) {} /// /// Assign to this view_or_value from a copied view_or_value. /// - BSONCXX_INLINE view_or_value& operator=(const view_or_value& other) { + view_or_value& operator=(const view_or_value& other) { _value = other._value; _view = _value ? *_value : other._view; return *this; @@ -94,7 +94,7 @@ class view_or_value { /// /// TODO CXX-800: Create a noexcept expression to check the conditions that must be met. - BSONCXX_INLINE view_or_value(view_or_value&& other) noexcept + view_or_value(view_or_value&& other) noexcept : _value{std::move(other._value)}, _view(_value ? *_value : std::move(other._view)) { other._view = View(); other._value = stdx::nullopt; @@ -104,7 +104,7 @@ class view_or_value { /// Assign to this view_or_value from a moved-in view_or_value. /// /// TODO CXX-800: Create a noexcept expression to check the conditions that must be met. - BSONCXX_INLINE view_or_value& operator=(view_or_value&& other) noexcept { + view_or_value& operator=(view_or_value&& other) noexcept { _value = std::move(other._value); _view = _value ? *_value : std::move(other._view); other._view = View(); @@ -117,7 +117,7 @@ class view_or_value { /// /// @return bool Whether we are owning. /// - BSONCXX_INLINE bool is_owning() const noexcept { + bool is_owning() const noexcept { return static_cast(_value); } @@ -126,7 +126,7 @@ class view_or_value { /// /// @return a View into this view_or_value. /// - BSONCXX_INLINE operator View() const { + operator View() const { return _view; } @@ -135,7 +135,7 @@ class view_or_value { /// /// @return a View into this view_or_value. /// - BSONCXX_INLINE const View& view() const { + const View& view() const { return _view; } @@ -151,15 +151,13 @@ class view_or_value { /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator==(const view_or_value& lhs, - const view_or_value& rhs) { +bool operator==(const view_or_value& lhs, const view_or_value& rhs) { return lhs.view() == rhs.view(); } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator!=(const view_or_value& lhs, - const view_or_value& rhs) { +bool operator!=(const view_or_value& lhs, const view_or_value& rhs) { return !(lhs == rhs); } @@ -173,49 +171,49 @@ BSONCXX_INLINE bool operator!=(const view_or_value& lhs, /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator==(const view_or_value& lhs, View rhs) { +bool operator==(const view_or_value& lhs, View rhs) { return lhs.view() == rhs; } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator==(View lhs, const view_or_value& rhs) { +bool operator==(View lhs, const view_or_value& rhs) { return rhs == lhs; } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator!=(const view_or_value& lhs, View rhs) { +bool operator!=(const view_or_value& lhs, View rhs) { return !(lhs == rhs); } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator!=(View lhs, const view_or_value& rhs) { +bool operator!=(View lhs, const view_or_value& rhs) { return !(rhs == lhs); } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator==(const view_or_value& lhs, const Value& rhs) { +bool operator==(const view_or_value& lhs, const Value& rhs) { return lhs.view() == View(rhs); } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator==(const Value& lhs, const view_or_value& rhs) { +bool operator==(const Value& lhs, const view_or_value& rhs) { return rhs == lhs; } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator!=(const view_or_value& lhs, const Value& rhs) { +bool operator!=(const view_or_value& lhs, const Value& rhs) { return !(lhs == rhs); } /// @relatesalso bsoncxx::v_noabi::view_or_value template -BSONCXX_INLINE bool operator!=(const Value& lhs, const view_or_value& rhs) { +bool operator!=(const Value& lhs, const view_or_value& rhs) { return !(rhs == lhs); } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/element.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/element.cpp index 462a43ff64..0b7f151482 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/element.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/element.cpp @@ -33,19 +33,19 @@ element::element(const std::uint8_t* raw, element::element(const stdx::string_view key) : document::element(key) {} -bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v) { +bool operator==(const element& elem, const types::bson_value::view& v) { return elem.get_value() == v; } -bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem) { +bool operator==(const types::bson_value::view& v, const element& elem) { return elem == v; } -bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v) { +bool operator!=(const element& elem, const types::bson_value::view& v) { return !(elem == v); } -bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem) { +bool operator!=(const types::bson_value::view& v, const element& elem) { return !(elem == v); } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/view.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/view.cpp index 5c34627160..b841e29c84 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/view.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/array/view.cpp @@ -73,12 +73,12 @@ view::const_iterator view::const_iterator::operator++(int) { return before; } -bool BSONCXX_CALL operator==(const view::const_iterator& lhs, const view::const_iterator& rhs) { +bool operator==(const view::const_iterator& lhs, const view::const_iterator& rhs) { return std::forward_as_tuple(lhs._element.raw(), lhs._element.offset()) == std::forward_as_tuple(rhs._element.raw(), rhs._element.offset()); } -bool BSONCXX_CALL operator!=(const view::const_iterator& lhs, const view::const_iterator& rhs) { +bool operator!=(const view::const_iterator& lhs, const view::const_iterator& rhs) { return !(lhs == rhs); } @@ -158,12 +158,12 @@ view::operator document::view() const { return _view; } -bool BSONCXX_CALL operator==(view lhs, view rhs) { +bool operator==(view lhs, view rhs) { return (lhs.length() == rhs.length()) && (std::memcmp(lhs.data(), rhs.data(), lhs.length()) == 0); } -bool BSONCXX_CALL operator!=(view lhs, view rhs) { +bool operator!=(view lhs, view rhs) { return !(lhs == rhs); } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/decimal128.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/decimal128.cpp index fc463b7da6..641e74d1a1 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/decimal128.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/decimal128.cpp @@ -42,11 +42,11 @@ std::string decimal128::to_string() const { return {str}; } -bool BSONCXX_CALL operator==(const decimal128& lhs, const decimal128& rhs) { +bool operator==(const decimal128& lhs, const decimal128& rhs) { return lhs._high == rhs._high && lhs._low == rhs._low; } -bool BSONCXX_CALL operator!=(const decimal128& lhs, const decimal128& rhs) { +bool operator!=(const decimal128& lhs, const decimal128& rhs) { return !(lhs == rhs); } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/element.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/element.cpp index 85c27710a7..bc904a6804 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/element.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/element.cpp @@ -149,19 +149,19 @@ element::operator bool() const { return _raw != nullptr; } -bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v) { +bool operator==(const element& elem, const types::bson_value::view& v) { return elem.get_value() == v; } -bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem) { +bool operator==(const types::bson_value::view& v, const element& elem) { return elem == v; } -bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v) { +bool operator!=(const element& elem, const types::bson_value::view& v) { return !(elem == v); } -bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem) { +bool operator!=(const types::bson_value::view& v, const element& elem) { return !(elem == v); } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/view.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/view.cpp index 130c40252b..94a19fc49c 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/view.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/document/view.cpp @@ -73,12 +73,12 @@ view::const_iterator view::const_iterator::operator++(int) { return before; } -bool BSONCXX_CALL operator==(const view::const_iterator& lhs, const view::const_iterator& rhs) { +bool operator==(const view::const_iterator& lhs, const view::const_iterator& rhs) { return std::forward_as_tuple(lhs._element.raw(), lhs._element.offset()) == std::forward_as_tuple(rhs._element.raw(), rhs._element.offset()); } -bool BSONCXX_CALL operator!=(const view::const_iterator& lhs, const view::const_iterator& rhs) { +bool operator!=(const view::const_iterator& lhs, const view::const_iterator& rhs) { return !(lhs == rhs); } @@ -166,12 +166,12 @@ bool view::empty() const { return _length == 5; } -bool BSONCXX_CALL operator==(view lhs, view rhs) { +bool operator==(view lhs, view rhs) { return (lhs.length() == rhs.length()) && (std::memcmp(lhs.data(), rhs.data(), lhs.length()) == 0); } -bool BSONCXX_CALL operator!=(view lhs, view rhs) { +bool operator!=(view lhs, view rhs) { return !(lhs == rhs); } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/error_code.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/error_code.cpp index f6f5da75b4..ad423bc32d 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/error_code.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/error_code.cpp @@ -91,7 +91,7 @@ class error_category_impl final : public std::error_category { } // namespace -const std::error_category& BSONCXX_CALL error_category() { +const std::error_category& error_category() { static const error_category_impl instance{}; return instance; } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp index 784d342554..b99cfe6c24 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp @@ -54,7 +54,7 @@ std::string to_json_helper(document::view view, decltype(bson_as_json) converter } // namespace -std::string BSONCXX_CALL to_json(document::view view, ExtendedJsonMode mode) { +std::string to_json(document::view view, ExtendedJsonMode mode) { switch (mode) { case ExtendedJsonMode::k_legacy: return to_json_helper(view, bson_as_json); @@ -69,7 +69,7 @@ std::string BSONCXX_CALL to_json(document::view view, ExtendedJsonMode mode) { BSONCXX_UNREACHABLE; } -std::string BSONCXX_CALL to_json(array::view view, ExtendedJsonMode mode) { +std::string to_json(array::view view, ExtendedJsonMode mode) { switch (mode) { case ExtendedJsonMode::k_legacy: return to_json_helper(view, bson_array_as_json); @@ -84,7 +84,7 @@ std::string BSONCXX_CALL to_json(array::view view, ExtendedJsonMode mode) { BSONCXX_UNREACHABLE; } -document::value BSONCXX_CALL from_json(stdx::string_view json) { +document::value from_json(stdx::string_view json) { bson_error_t error; bson_t* result = bson_new_from_json(reinterpret_cast(json.data()), static_cast(json.size()), diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/oid.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/oid.cpp index 7994db3a45..56a6c7823d 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/oid.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/oid.cpp @@ -78,27 +78,27 @@ int oid_compare(const oid& lhs, const oid& rhs) { return bson_oid_compare(&lhs_oid, &rhs_oid); } -bool BSONCXX_CALL operator<(const oid& lhs, const oid& rhs) { +bool operator<(const oid& lhs, const oid& rhs) { return oid_compare(lhs, rhs) < 0; } -bool BSONCXX_CALL operator>(const oid& lhs, const oid& rhs) { +bool operator>(const oid& lhs, const oid& rhs) { return oid_compare(lhs, rhs) > 0; } -bool BSONCXX_CALL operator<=(const oid& lhs, const oid& rhs) { +bool operator<=(const oid& lhs, const oid& rhs) { return oid_compare(lhs, rhs) <= 0; } -bool BSONCXX_CALL operator>=(const oid& lhs, const oid& rhs) { +bool operator>=(const oid& lhs, const oid& rhs) { return oid_compare(lhs, rhs) >= 0; } -bool BSONCXX_CALL operator==(const oid& lhs, const oid& rhs) { +bool operator==(const oid& lhs, const oid& rhs) { return oid_compare(lhs, rhs) == 0; } -bool BSONCXX_CALL operator!=(const oid& lhs, const oid& rhs) { +bool operator!=(const oid& lhs, const oid& rhs) { return oid_compare(lhs, rhs) != 0; } diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh index 9d7d15f97a..5537dca5f5 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/private/itoa.hh @@ -23,9 +23,9 @@ namespace bsoncxx { -class BSONCXX_ABI_EXPORT_TESTING itoa { +class itoa { public: - explicit itoa(uint32_t i = 0); + explicit BSONCXX_ABI_EXPORT_CDECL_TESTING() itoa(uint32_t i = 0); ~itoa() = default; @@ -35,14 +35,22 @@ class BSONCXX_ABI_EXPORT_TESTING itoa { itoa(const itoa& rhs) = delete; itoa& operator=(const itoa&) = delete; - itoa& operator=(uint32_t new_value); + BSONCXX_ABI_EXPORT_CDECL_TESTING(itoa&) operator=(uint32_t new_value); - uint32_t val() const; - const char* c_str() const; - std::size_t length() const; + uint32_t val() const { + return _val; + } + + const char* c_str() const { + return _str; + } + + std::size_t length() const { + return _len; + } private: - BSONCXX_PRIVATE void _init(); + void _init(); uint32_t _val; const char* _str; @@ -50,18 +58,6 @@ class BSONCXX_ABI_EXPORT_TESTING itoa { char _buf[11]; }; -inline uint32_t itoa::val() const { - return _val; -} - -inline const char* itoa::c_str() const { - return _str; -} - -inline std::size_t itoa::length() const { - return _len; -} - } // namespace bsoncxx #include diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types.cpp index 8e309b6a7a..3eb39b12f0 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/types.cpp @@ -23,7 +23,7 @@ namespace v_noabi { #include #undef BSONCXX_ENUM -std::string BSONCXX_CALL to_string(type rhs) { +std::string to_string(type rhs) { switch (static_cast(rhs)) { #define BSONCXX_ENUM(name, val) \ case val: \ @@ -36,7 +36,7 @@ std::string BSONCXX_CALL to_string(type rhs) { } } -std::string BSONCXX_CALL to_string(binary_sub_type rhs) { +std::string to_string(binary_sub_type rhs) { switch (static_cast(rhs)) { #define BSONCXX_ENUM(name, val) \ case val: \ diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/validate.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/validate.cpp index 1774fed59c..77bd12ec5c 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/validate.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/validate.cpp @@ -64,15 +64,15 @@ bool validator::check_dot_keys() const { return _impl->_check_dot_keys; } -stdx::optional BSONCXX_CALL validate(const std::uint8_t* data, std::size_t length) { +stdx::optional validate(const std::uint8_t* data, std::size_t length) { const validator vtor{}; return validate(data, length, vtor); } -stdx::optional BSONCXX_CALL validate(const std::uint8_t* data, - std::size_t length, - const validator& validator, - std::size_t* invalid_offset) { +stdx::optional validate(const std::uint8_t* data, + std::size_t length, + const validator& validator, + std::size_t* invalid_offset) { ::bson_validate_flags_t flags = BSON_VALIDATE_NONE; const auto flip_if = [&flags](bool cond, ::bson_validate_flags_t flag) { From b7a6e74246446497c8e11972512c03e284e7d711 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:36 -0500 Subject: [PATCH 06/28] CXX-3093 Replace MONGOCXX_API -> MONGOCXX_ABI_EXPORT_CDECL --- .../v_noabi/mongocxx/bulk_write-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/bulk_write.hpp | 20 +- .../v_noabi/mongocxx/change_stream-fwd.hpp | 2 +- .../v_noabi/mongocxx/change_stream.hpp | 49 +- .../mongocxx/v_noabi/mongocxx/client-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/client.hpp | 113 +-- .../mongocxx/client_encryption-fwd.hpp | 2 +- .../v_noabi/mongocxx/client_encryption.hpp | 60 +- .../v_noabi/mongocxx/client_session-fwd.hpp | 2 +- .../v_noabi/mongocxx/client_session.hpp | 51 +- .../v_noabi/mongocxx/collection-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/collection.hpp | 658 +++++++++--------- .../mongocxx/v_noabi/mongocxx/cursor-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/cursor.hpp | 35 +- .../v_noabi/mongocxx/database-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/database.hpp | 204 +++--- .../events/command_failed_event-fwd.hpp | 2 +- .../mongocxx/events/command_failed_event.hpp | 21 +- .../events/command_started_event-fwd.hpp | 2 +- .../mongocxx/events/command_started_event.hpp | 21 +- .../events/command_succeeded_event-fwd.hpp | 2 +- .../events/command_succeeded_event.hpp | 21 +- .../events/heartbeat_failed_event-fwd.hpp | 2 +- .../events/heartbeat_failed_event.hpp | 14 +- .../events/heartbeat_started_event-fwd.hpp | 2 +- .../events/heartbeat_started_event.hpp | 10 +- .../events/heartbeat_succeeded_event-fwd.hpp | 2 +- .../events/heartbeat_succeeded_event.hpp | 14 +- .../events/server_changed_event-fwd.hpp | 2 +- .../mongocxx/events/server_changed_event.hpp | 14 +- .../events/server_closed_event-fwd.hpp | 2 +- .../mongocxx/events/server_closed_event.hpp | 10 +- .../events/server_description-fwd.hpp | 2 +- .../mongocxx/events/server_description.hpp | 19 +- .../events/server_opening_event-fwd.hpp | 2 +- .../mongocxx/events/server_opening_event.hpp | 10 +- .../events/topology_changed_event-fwd.hpp | 2 +- .../events/topology_changed_event.hpp | 10 +- .../events/topology_closed_event-fwd.hpp | 2 +- .../mongocxx/events/topology_closed_event.hpp | 6 +- .../events/topology_description-fwd.hpp | 2 +- .../mongocxx/events/topology_description.hpp | 35 +- .../events/topology_opening_event-fwd.hpp | 2 +- .../events/topology_opening_event.hpp | 6 +- .../authentication_exception-fwd.hpp | 2 +- .../exception/bulk_write_exception-fwd.hpp | 2 +- .../v_noabi/mongocxx/exception/error_code.hpp | 4 +- .../mongocxx/exception/exception-fwd.hpp | 2 +- .../exception/gridfs_exception-fwd.hpp | 2 +- .../mongocxx/exception/logic_error-fwd.hpp | 2 +- .../exception/operation_exception-fwd.hpp | 2 +- .../exception/query_exception-fwd.hpp | 2 +- .../mongocxx/exception/server_error_code.hpp | 4 +- .../exception/write_exception-fwd.hpp | 2 +- .../v_noabi/mongocxx/gridfs/bucket-fwd.hpp | 2 +- .../v_noabi/mongocxx/gridfs/bucket.hpp | 184 ++--- .../mongocxx/gridfs/downloader-fwd.hpp | 2 +- .../v_noabi/mongocxx/gridfs/downloader.hpp | 38 +- .../v_noabi/mongocxx/gridfs/uploader-fwd.hpp | 2 +- .../v_noabi/mongocxx/gridfs/uploader.hpp | 49 +- .../mongocxx/v_noabi/mongocxx/hint-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/hint.hpp | 36 +- .../v_noabi/mongocxx/index_model-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/index_model.hpp | 13 +- .../v_noabi/mongocxx/index_view-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/index_view.hpp | 109 +-- .../v_noabi/mongocxx/instance-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/instance.hpp | 14 +- .../mongocxx/v_noabi/mongocxx/logger-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/logger.hpp | 2 +- .../mongocxx/model/delete_many-fwd.hpp | 2 +- .../v_noabi/mongocxx/model/delete_many.hpp | 15 +- .../v_noabi/mongocxx/model/delete_one-fwd.hpp | 2 +- .../v_noabi/mongocxx/model/delete_one.hpp | 14 +- .../v_noabi/mongocxx/model/insert_one-fwd.hpp | 2 +- .../v_noabi/mongocxx/model/insert_one.hpp | 4 +- .../mongocxx/model/replace_one-fwd.hpp | 2 +- .../v_noabi/mongocxx/model/replace_one.hpp | 19 +- .../mongocxx/model/update_many-fwd.hpp | 2 +- .../v_noabi/mongocxx/model/update_many.hpp | 31 +- .../v_noabi/mongocxx/model/update_one-fwd.hpp | 2 +- .../v_noabi/mongocxx/model/update_one.hpp | 31 +- .../v_noabi/mongocxx/model/write-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/model/write.hpp | 34 +- .../mongocxx/options/aggregate-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/aggregate.hpp | 56 +- .../v_noabi/mongocxx/options/apm-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/options/apm.hpp | 75 +- .../mongocxx/options/auto_encryption-fwd.hpp | 2 +- .../mongocxx/options/auto_encryption.hpp | 57 +- .../mongocxx/options/bulk_write-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/bulk_write.hpp | 28 +- .../mongocxx/options/change_stream-fwd.hpp | 2 +- .../mongocxx/options/change_stream.hpp | 55 +- .../v_noabi/mongocxx/options/client-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/client.hpp | 20 +- .../options/client_encryption-fwd.hpp | 2 +- .../mongocxx/options/client_encryption.hpp | 24 +- .../mongocxx/options/client_session-fwd.hpp | 2 +- .../mongocxx/options/client_session.hpp | 13 +- .../v_noabi/mongocxx/options/count-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/count.hpp | 34 +- .../mongocxx/options/create_collection.hpp | 52 +- .../v_noabi/mongocxx/options/data_key-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/data_key.hpp | 16 +- .../v_noabi/mongocxx/options/delete-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/delete.hpp | 27 +- .../v_noabi/mongocxx/options/distinct-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/distinct.hpp | 22 +- .../v_noabi/mongocxx/options/encrypt-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/encrypt.hpp | 29 +- .../options/estimated_document_count-fwd.hpp | 2 +- .../options/estimated_document_count.hpp | 20 +- .../v_noabi/mongocxx/options/find-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/find.hpp | 98 +-- .../options/find_one_and_delete-fwd.hpp | 2 +- .../mongocxx/options/find_one_and_delete.hpp | 45 +- .../options/find_one_and_replace-fwd.hpp | 2 +- .../mongocxx/options/find_one_and_replace.hpp | 60 +- .../options/find_one_and_update-fwd.hpp | 2 +- .../mongocxx/options/find_one_and_update.hpp | 66 +- .../mongocxx/options/gridfs/bucket-fwd.hpp | 2 +- .../mongocxx/options/gridfs/bucket.hpp | 25 +- .../mongocxx/options/gridfs/upload-fwd.hpp | 2 +- .../mongocxx/options/gridfs/upload.hpp | 9 +- .../v_noabi/mongocxx/options/index-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/index.hpp | 102 +-- .../mongocxx/options/index_view-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/index_view.hpp | 21 +- .../v_noabi/mongocxx/options/insert-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/insert.hpp | 20 +- .../v_noabi/mongocxx/options/pool-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/pool.hpp | 4 +- .../v_noabi/mongocxx/options/range-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/range.hpp | 20 +- .../v_noabi/mongocxx/options/replace-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/replace.hpp | 35 +- .../options/rewrap_many_datakey-fwd.hpp | 2 +- .../mongocxx/options/rewrap_many_datakey.hpp | 11 +- .../mongocxx/options/server_api-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/server_api.hpp | 16 +- .../v_noabi/mongocxx/options/tls-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/options/tls.hpp | 30 +- .../mongocxx/options/transaction-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/transaction.hpp | 38 +- .../v_noabi/mongocxx/options/update-fwd.hpp | 2 +- .../v_noabi/mongocxx/options/update.hpp | 41 +- .../v_noabi/mongocxx/pipeline-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/pipeline.hpp | 97 +-- .../mongocxx/v_noabi/mongocxx/pool-fwd.hpp | 2 +- .../mongocxx/v_noabi/mongocxx/pool.hpp | 40 +- .../v_noabi/mongocxx/read_concern-fwd.hpp | 2 +- .../v_noabi/mongocxx/read_concern.hpp | 44 +- .../v_noabi/mongocxx/read_preference-fwd.hpp | 2 +- .../v_noabi/mongocxx/read_preference.hpp | 70 +- .../mongocxx/result/bulk_write-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/bulk_write.hpp | 22 +- .../v_noabi/mongocxx/result/delete-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/delete.hpp | 12 +- .../mongocxx/result/gridfs/upload-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/gridfs/upload.hpp | 10 +- .../mongocxx/result/insert_many-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/insert_many.hpp | 19 +- .../mongocxx/result/insert_one-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/insert_one.hpp | 11 +- .../mongocxx/result/replace_one-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/replace_one.hpp | 17 +- .../result/rewrap_many_datakey-fwd.hpp | 2 +- .../mongocxx/result/rewrap_many_datakey.hpp | 7 +- .../v_noabi/mongocxx/result/update-fwd.hpp | 2 +- .../v_noabi/mongocxx/result/update.hpp | 19 +- .../mongocxx/search_index_model-fwd.hpp | 2 +- .../v_noabi/mongocxx/search_index_model.hpp | 32 +- .../mongocxx/search_index_view-fwd.hpp | 2 +- .../v_noabi/mongocxx/search_index_view.hpp | 88 +-- .../mongocxx/v_noabi/mongocxx/uri-fwd.hpp | 2 +- .../include/mongocxx/v_noabi/mongocxx/uri.hpp | 94 +-- .../mongocxx/validation_criteria-fwd.hpp | 2 +- .../v_noabi/mongocxx/validation_criteria.hpp | 36 +- .../v_noabi/mongocxx/write_concern-fwd.hpp | 2 +- .../v_noabi/mongocxx/write_concern.hpp | 64 +- .../v_noabi/mongocxx/change_stream.cpp | 6 +- .../lib/mongocxx/v_noabi/mongocxx/cursor.cpp | 4 +- .../v_noabi/mongocxx/exception/error_code.cpp | 2 +- .../mongocxx/exception/server_error_code.cpp | 2 +- .../lib/mongocxx/v_noabi/mongocxx/hint.cpp | 16 +- .../lib/mongocxx/v_noabi/mongocxx/logger.cpp | 2 +- .../v_noabi/mongocxx/private/libbson.hh | 36 +- .../v_noabi/mongocxx/read_concern.cpp | 4 +- .../v_noabi/mongocxx/read_preference.cpp | 4 +- .../v_noabi/mongocxx/result/bulk_write.cpp | 4 +- .../v_noabi/mongocxx/result/delete.cpp | 4 +- .../v_noabi/mongocxx/result/gridfs/upload.cpp | 4 +- .../v_noabi/mongocxx/result/insert_many.cpp | 4 +- .../v_noabi/mongocxx/result/insert_one.cpp | 4 +- .../v_noabi/mongocxx/result/replace_one.cpp | 4 +- .../v_noabi/mongocxx/result/update.cpp | 4 +- .../v_noabi/mongocxx/validation_criteria.cpp | 6 +- .../v_noabi/mongocxx/write_concern.cpp | 4 +- 199 files changed, 2236 insertions(+), 1917 deletions(-) diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write-fwd.hpp index e4a15c2add..604fc4ba6a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API bulk_write; +class bulk_write; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write.hpp index 53f4aa1c78..e0cf5b807d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/bulk_write.hpp @@ -46,24 +46,24 @@ class bulk_write { /// /// Move constructs a bulk write operation. /// - bulk_write(bulk_write&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() bulk_write(bulk_write&&) noexcept; /// /// Move assigns a bulk write operation. /// - bulk_write& operator=(bulk_write&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) operator=(bulk_write&&) noexcept; /// /// Destroys a bulk write operation. /// - ~bulk_write(); + MONGOCXX_ABI_EXPORT_CDECL() ~bulk_write(); /// /// Checks if a bulk write operation is empty. /// /// @return A boolean indicating if the bulk write operation is empty. /// - bool empty() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bool) empty() const noexcept; /// /// Appends a single write to the bulk write operation. The write operation's contents are @@ -87,7 +87,7 @@ class bulk_write { /// /// @throws mongocxx::v_noabi::logic_error if the given operation is invalid. /// - bulk_write& append(const model::write& operation); + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) append(const model::write& operation); /// /// Executes a bulk write. @@ -98,16 +98,16 @@ class bulk_write { /// /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// - stdx::optional execute() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) execute() const; private: friend ::mongocxx::v_noabi::collection; - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE bulk_write(const collection& coll, - const options::bulk_write& options, - const client_session* session = nullptr); + bulk_write(const collection& coll, + const options::bulk_write& options, + const client_session* session = nullptr); bool _created_from_collection; std::unique_ptr _impl; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream-fwd.hpp index ff0033d3bf..e7ca8e4d6a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API change_stream; +class change_stream; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream.hpp index 66d9b38b30..420f654e7d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/change_stream.hpp @@ -35,22 +35,22 @@ namespace v_noabi { class change_stream { public: /// A change stream iterator. - class MONGOCXX_API iterator; + class iterator; /// /// Move constructs a change_stream. /// - change_stream(change_stream&& other) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() change_stream(change_stream&& other) noexcept; /// /// Move assigns a change_stream. /// - change_stream& operator=(change_stream&& other) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) operator=(change_stream&& other) noexcept; /// /// Destroys a change_stream. /// - ~change_stream(); + MONGOCXX_ABI_EXPORT_CDECL() ~change_stream(); /// /// A change_stream::iterator points to the beginning of any @@ -72,7 +72,7 @@ class change_stream { /// @exception /// Throws mongocxx::v_noabi::query_exception if the query failed. /// - iterator begin() const; + MONGOCXX_ABI_EXPORT_CDECL(iterator) begin() const; /// /// A change_stream::iterator indicating stream exhaustion, meaning that @@ -81,7 +81,7 @@ class change_stream { /// @return /// The change_stream::iterator indicating exhaustion /// - iterator end() const; + MONGOCXX_ABI_EXPORT_CDECL(iterator) end() const; /// /// Returns a resume token for this change stream. @@ -106,7 +106,8 @@ class change_stream { /// @return /// The token. /// - bsoncxx::v_noabi::stdx::optional get_resume_token() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional) + get_resume_token() const; private: friend ::mongocxx::v_noabi::client; @@ -115,9 +116,9 @@ class change_stream { friend ::mongocxx::v_noabi::change_stream::iterator; - MONGOCXX_PRIVATE change_stream(void* change_stream_ptr); + change_stream(void* change_stream_ptr); - class MONGOCXX_PRIVATE impl; + class impl; std::unique_ptr _impl; }; @@ -138,7 +139,7 @@ class change_stream::iterator { /// Default-constucted iterators can be compared (all default-constructed /// iterators are ==), assigned, and copied. /// - iterator(); + MONGOCXX_ABI_EXPORT_CDECL() iterator(); /// /// Dereferences the view for the document currently being pointed to. @@ -146,7 +147,7 @@ class change_stream::iterator { /// The returned document::view is valid until the iterator is incremented. The value may be /// copied to extend its lifetime. /// - const bsoncxx::v_noabi::document::view& operator*() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view&) operator*() const; /// /// Accesses a member of the dereferenced document currently being pointed to. @@ -154,7 +155,7 @@ class change_stream::iterator { /// The returned document::view is valid until the iterator is incremented. The value may be /// copied to extend its lifetime. /// - const bsoncxx::v_noabi::document::view* operator->() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view*) operator->() const; /// /// Pre-increments the iterator to move to the next document. @@ -169,7 +170,7 @@ class change_stream::iterator { /// /// @throws mongocxx::v_noabi::query_exception if the query failed /// - iterator& operator++(); + MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator++(); /// /// Post-increments the iterator to move to the next document. @@ -184,14 +185,7 @@ class change_stream::iterator { /// /// @throws mongocxx::v_noabi::query_exception if the query failed /// - void operator++(int); - - private: - friend ::mongocxx::v_noabi::change_stream; - - enum class iter_type { k_tracking, k_default_constructed, k_end }; - - MONGOCXX_PRIVATE explicit iterator(iter_type type, const change_stream* change_stream); + MONGOCXX_ABI_EXPORT_CDECL(void) operator++(int); /// /// @relates bsoncxx::v_noabi::change_stream::iterator @@ -202,15 +196,22 @@ class change_stream::iterator { /// exhausted. /// /// @{ - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const change_stream::iterator&, + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const change_stream::iterator&, const change_stream::iterator&) noexcept; - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const change_stream::iterator&, + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const change_stream::iterator&, const change_stream::iterator&) noexcept; /// @} /// - MONGOCXX_PRIVATE bool is_exhausted() const; + private: + friend ::mongocxx::v_noabi::change_stream; + + enum class iter_type { k_tracking, k_default_constructed, k_end }; + + explicit iterator(iter_type type, const change_stream* change_stream); + + bool is_exhausted() const; // iter_type==k_default_constructed is equivalent to _change_stream==nullptr iter_type _type; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client-fwd.hpp index a392c09f5b..d0f19d4cea 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API client; +class client; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client.hpp index bbb7af76ee..5172bb5925 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client.hpp @@ -66,7 +66,7 @@ class client { /// state of a moved-from client. The only valid actions to take with a default constructed /// 'client' are to assign to it, or destroy it. /// - client() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() client() noexcept; /// /// Creates a new client connection to MongoDB. @@ -79,23 +79,24 @@ class client { /// @throws mongocxx::v_noabi::exception if invalid options are provided /// (whether from the URI or provided client options). /// + MONGOCXX_ABI_EXPORT_CDECL() client(const mongocxx::v_noabi::uri& mongodb_uri, const options::client& options = options::client()); /// /// Move constructs a client. /// - client(client&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() client(client&&) noexcept; /// /// Move assigns a client. /// - client& operator=(client&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client&) operator=(client&&) noexcept; /// /// Destroys a client. /// - ~client(); + MONGOCXX_ABI_EXPORT_CDECL() ~client(); client(const client&) = delete; client& operator=(const client&) = delete; @@ -104,7 +105,7 @@ class client { /// Returns true if the client is valid, meaning it was not default constructed /// or moved from. /// - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; /// /// Sets the read concern for this client. @@ -122,15 +123,17 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/read-concern/ /// - MONGOCXX_DEPRECATED void read_concern(mongocxx::v_noabi::read_concern rc); - void read_concern_deprecated(mongocxx::v_noabi::read_concern rc); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(void) + read_concern(mongocxx::v_noabi::read_concern rc); + + MONGOCXX_ABI_EXPORT_CDECL(void) read_concern_deprecated(mongocxx::v_noabi::read_concern rc); /// /// Returns the current read concern for this client. /// /// @return The current @c read_concern /// - mongocxx::v_noabi::read_concern read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_concern) read_concern() const; /// /// Sets the read preference for this client. @@ -148,8 +151,11 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/core/read-preference/ /// - MONGOCXX_DEPRECATED void read_preference(mongocxx::v_noabi::read_preference rp); - void read_preference_deprecated(mongocxx::v_noabi::read_preference rp); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(void) + read_preference(mongocxx::v_noabi::read_preference rp); + + MONGOCXX_ABI_EXPORT_CDECL(void) + read_preference_deprecated(mongocxx::v_noabi::read_preference rp); /// /// Returns the current read preference for this client. @@ -158,14 +164,14 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/core/read-preference/ /// - mongocxx::v_noabi::read_preference read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_preference) read_preference() const; /// /// Returns the current uri for this client. /// /// @return The @c uri that this client was created with. /// - mongocxx::v_noabi::uri uri() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::uri) uri() const; /// /// Sets the write concern for this client. @@ -181,14 +187,16 @@ class client { /// @param wc /// The new write concern /// - MONGOCXX_DEPRECATED void write_concern(mongocxx::v_noabi::write_concern wc); - void write_concern_deprecated(mongocxx::v_noabi::write_concern wc); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(void) + write_concern(mongocxx::v_noabi::write_concern wc); + + MONGOCXX_ABI_EXPORT_CDECL(void) write_concern_deprecated(mongocxx::v_noabi::write_concern wc); /// /// Returns the current write concern for this client. /// /// @return the current @c write_concern - mongocxx::v_noabi::write_concern write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::write_concern) write_concern() const; /// /// Obtains a database that represents a logical grouping of collections on a MongoDB server. @@ -200,7 +208,9 @@ class client { /// /// @return The database /// - mongocxx::v_noabi::database database(bsoncxx::v_noabi::string::view_or_value name) const&; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::database) + database(bsoncxx::v_noabi::string::view_or_value name) const&; + mongocxx::v_noabi::database database(bsoncxx::v_noabi::string::view_or_value name) const&& = delete; @@ -215,10 +225,12 @@ class client { /// /// @return Client side representation of a server side database /// - MONGOCXX_INLINE mongocxx::v_noabi::database operator[]( - bsoncxx::v_noabi::string::view_or_value name) const&; - MONGOCXX_INLINE mongocxx::v_noabi::database operator[]( - bsoncxx::v_noabi::string::view_or_value name) const&& = delete; + mongocxx::v_noabi::database operator[](bsoncxx::v_noabi::string::view_or_value name) const& { + return database(name); + } + + mongocxx::v_noabi::database operator[](bsoncxx::v_noabi::string::view_or_value name) const&& = + delete; /// /// Enumerates the databases in the client. /// @@ -233,7 +245,7 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listDatabases /// - cursor list_databases() const; + MONGOCXX_ABI_EXPORT_CDECL(cursor) list_databases() const; /// /// Enumerates the databases in the client. @@ -252,7 +264,7 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listDatabases /// - cursor list_databases(const client_session& session) const; + MONGOCXX_ABI_EXPORT_CDECL(cursor) list_databases(const client_session& session) const; /// /// Enumerates the databases in the client. @@ -271,7 +283,8 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listDatabases /// - cursor list_databases(const bsoncxx::v_noabi::document::view_or_value opts) const; + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list_databases(const bsoncxx::v_noabi::document::view_or_value opts) const; /// /// Enumerates the databases in the client. @@ -293,8 +306,9 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listDatabases /// - cursor list_databases(const client_session& session, - const bsoncxx::v_noabi::document::view_or_value opts) const; + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list_databases(const client_session& session, + const bsoncxx::v_noabi::document::view_or_value opts) const; /// /// Queries the MongoDB server for a list of known databases. @@ -309,8 +323,8 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listDatabases /// - std::vector list_database_names( - const bsoncxx::v_noabi::document::view_or_value filter = {}) const; + MONGOCXX_ABI_EXPORT_CDECL(std::vector) + list_database_names(const bsoncxx::v_noabi::document::view_or_value filter = {}) const; /// /// Queries the MongoDB server for a list of known databases. @@ -328,9 +342,9 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listDatabases /// - std::vector list_database_names( - const client_session& session, - const bsoncxx::v_noabi::document::view_or_value filter = {}) const; + MONGOCXX_ABI_EXPORT_CDECL(std::vector) + list_database_names(const client_session& session, + const bsoncxx::v_noabi::document::view_or_value filter = {}) const; /// /// Create a client session for a sequence of operations. @@ -342,7 +356,8 @@ class client { /// support, if options is misconfigured, or if the session is configured with options that the /// server does not support. /// - client_session start_session(const options::client_session& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(client_session) + start_session(const options::client_session& options = {}); /// /// Get a change stream on this client with an empty pipeline. @@ -357,7 +372,7 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) watch(const options::change_stream& options = {}); /// /// Get a change stream on this client with an empty pipeline. @@ -374,7 +389,8 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const client_session& session, const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const client_session& session, const options::change_stream& options = {}); /// /// Get a change stream on this client. @@ -393,7 +409,8 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const pipeline& pipe, const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const pipeline& pipe, const options::change_stream& options = {}); /// /// Get a change stream on this client. @@ -412,9 +429,10 @@ class client { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const client_session& session, - const pipeline& pipe, - const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const client_session& session, + const pipeline& pipe, + const options::change_stream& options = {}); /// /// Prevents resource cleanup in the child process from interfering @@ -431,7 +449,7 @@ class client { /// they are destroyed. Client sessions from previous generations /// cannot be used and should be destroyed. /// - void reset(); + MONGOCXX_ABI_EXPORT_CDECL(void) reset(); private: friend ::mongocxx::v_noabi::client_session; @@ -441,25 +459,20 @@ class client { friend ::mongocxx::v_noabi::options::client_encryption; friend ::mongocxx::v_noabi::pool; - MONGOCXX_PRIVATE explicit client(void* implementation); + explicit client(void* implementation); - MONGOCXX_PRIVATE change_stream _watch(const client_session* session, - const pipeline& pipe, - const options::change_stream& options); + change_stream _watch(const client_session* session, + const pipeline& pipe, + const options::change_stream& options); - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; -MONGOCXX_INLINE mongocxx::v_noabi::database client::operator[]( - bsoncxx::v_noabi::string::view_or_value name) const& { - return database(name); -} - } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption-fwd.hpp index 0cec97f088..7aeea76c35 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API client_encryption; +class client_encryption; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption.hpp index 0141cbb866..9e9c69d454 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_encryption.hpp @@ -50,22 +50,22 @@ class client_encryption { /// @see /// https://www.mongodb.com/docs/ecosystem/use-cases/client-side-field-level-encryption-guide /// - client_encryption(options::client_encryption opts); + MONGOCXX_ABI_EXPORT_CDECL() client_encryption(options::client_encryption opts); /// /// Destroys a client_encryption. /// - ~client_encryption(); + MONGOCXX_ABI_EXPORT_CDECL() ~client_encryption(); /// /// Move-constructs a client_encryption object. /// - client_encryption(client_encryption&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() client_encryption(client_encryption&&) noexcept; /// /// Move-assigns a client_encryption object. /// - client_encryption& operator=(client_encryption&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client_encryption&) operator=(client_encryption&&) noexcept; client_encryption(const client_encryption&) = delete; client_encryption& operator=(const client_encryption&) = delete; @@ -87,8 +87,8 @@ class client_encryption { /// @see /// https://www.mongodb.com/docs/ecosystem/use-cases/client-side-field-level-encryption-guide/#b-create-a-data-encryption-key /// - bsoncxx::v_noabi::types::bson_value::value create_data_key(std::string kms_provider, - const options::data_key& opts = {}); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value) + create_data_key(std::string kms_provider, const options::data_key& opts = {}); /** * @brief Create a collection with client-side-encryption enabled, automatically filling any @@ -104,7 +104,8 @@ class client_encryption { * collection. * @return collection A handle to the newly created collection */ - collection create_encrypted_collection( + MONGOCXX_ABI_EXPORT_CDECL(collection) + create_encrypted_collection( const database& db, const std::string& coll_name, const bsoncxx::v_noabi::document::view& options, @@ -128,8 +129,8 @@ class client_encryption { /// @see /// https://www.mongodb.com/docs/manual/reference/method/ClientEncryption.encrypt/#ClientEncryption.encrypt /// - bsoncxx::v_noabi::types::bson_value::value encrypt( - bsoncxx::v_noabi::types::bson_value::view value, const options::encrypt& opts); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value) + encrypt(bsoncxx::v_noabi::types::bson_value::view value, const options::encrypt& opts); /// /// Encrypts a Match Expression or Aggregate Expression to query a range index. @@ -144,8 +145,9 @@ class client_encryption { /// /// @warning The Range algorithm is experimental only. It is not intended for public use. It is /// subject to breaking changes. - bsoncxx::v_noabi::document::value encrypt_expression( - bsoncxx::v_noabi::document::view_or_value expr, const options::encrypt& opts); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + encrypt_expression(bsoncxx::v_noabi::document::view_or_value expr, + const options::encrypt& opts); /// /// Decrypts an encrypted value (BSON binary of subtype 6). @@ -160,8 +162,8 @@ class client_encryption { /// @see /// https://www.mongodb.com/docs/manual/reference/method/ClientEncryption.decrypt/#ClientEncryption.decrypt /// - bsoncxx::v_noabi::types::bson_value::value decrypt( - bsoncxx::v_noabi::types::bson_value::view value); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::value) + decrypt(bsoncxx::v_noabi::types::bson_value::view value); /// /// Decrypts multiple data keys and (re-)encrypts them with a new masterKey, @@ -184,8 +186,9 @@ class client_encryption { /// @see /// https://www.mongodb.com/docs/manual/reference/method/KeyVault.rewrapManyDataKey/ /// - result::rewrap_many_datakey rewrap_many_datakey( - bsoncxx::v_noabi::document::view_or_value filter, const options::rewrap_many_datakey& opts); + MONGOCXX_ABI_EXPORT_CDECL(result::rewrap_many_datakey) + rewrap_many_datakey(bsoncxx::v_noabi::document::view_or_value filter, + const options::rewrap_many_datakey& opts); /// /// Removes the key document with the given UUID (BSON binary subtype 0x04) @@ -199,7 +202,8 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/reference/method/KeyVault.deleteKey/ /// - result::delete_result delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id); + MONGOCXX_ABI_EXPORT_CDECL(result::delete_result) + delete_key(bsoncxx::v_noabi::types::bson_value::view_or_value id); /// /// Finds a single key document with the given UUID (BSON binary subtype 0x04). @@ -212,8 +216,8 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/reference/method/KeyVault.getKey/ /// - stdx::optional get_key( - bsoncxx::v_noabi::types::bson_value::view_or_value id); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + get_key(bsoncxx::v_noabi::types::bson_value::view_or_value id); /// /// Finds all documents in the key vault collection. @@ -224,7 +228,7 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/reference/method/KeyVault.getKeys/ /// - mongocxx::v_noabi::cursor get_keys(); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::cursor) get_keys(); /// /// Adds a keyAltName to the keyAltNames array of the key document in the @@ -240,9 +244,9 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/reference/method/KeyVault.addKeyAlternateName/ /// - stdx::optional add_key_alt_name( - bsoncxx::v_noabi::types::bson_value::view_or_value id, - bsoncxx::v_noabi::string::view_or_value key_alt_name); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + add_key_alt_name(bsoncxx::v_noabi::types::bson_value::view_or_value id, + bsoncxx::v_noabi::string::view_or_value key_alt_name); /// /// Removes a keyAltName from the keyAltNames array of the key document in @@ -258,9 +262,9 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/reference/method/KeyVault.removeKeyAlternateName/ /// - stdx::optional remove_key_alt_name( - bsoncxx::v_noabi::types::bson_value::view_or_value id, - bsoncxx::v_noabi::string::view_or_value key_alt_name); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + remove_key_alt_name(bsoncxx::v_noabi::types::bson_value::view_or_value id, + bsoncxx::v_noabi::string::view_or_value key_alt_name); /// /// Get the key document from the key vault collection with the provided name. @@ -273,11 +277,11 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/reference/method/KeyVault.getKeyByAltName/ /// - stdx::optional get_key_by_alt_name( - bsoncxx::v_noabi::string::view_or_value key_alt_name); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + get_key_by_alt_name(bsoncxx::v_noabi::string::view_or_value key_alt_name); private: - class MONGOCXX_PRIVATE impl; + class impl; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session-fwd.hpp index 1d0fd8b47a..a0a2bb4f19 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API client_session; +class client_session; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session.hpp index 0981011795..0aa0ca4564 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/client_session.hpp @@ -57,36 +57,36 @@ class client_session { /// /// Move constructs a session. /// - client_session(client_session&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() client_session(client_session&&) noexcept; /// /// Move assigns a session. /// - client_session& operator=(client_session&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client_session&) operator=(client_session&&) noexcept; client_session(const client_session&) = delete; - client_session& operator=(const client_session&) = delete; + MONGOCXX_ABI_EXPORT_CDECL(client_session&) operator=(const client_session&) = delete; /// /// Ends and destroys the session. /// - ~client_session() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() ~client_session() noexcept; /// /// Gets the client that started this session. /// - const mongocxx::v_noabi::client& client() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(const mongocxx::v_noabi::client&) client() const noexcept; /// /// Gets the options this session was created with. /// - const options::client_session& options() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(const options::client_session&) options() const noexcept; /// /// Get the server-side "logical session ID" associated with this session, as a BSON document. /// This view is invalid after the session is destroyed. /// - bsoncxx::v_noabi::document::view id() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) id() const noexcept; /// /// Get the session's clusterTime, as a BSON document. This is an opaque value suitable for @@ -94,30 +94,30 @@ class client_session { /// not been used for any operation and you have not called advance_cluster_time(). /// This view is invalid after the session is destroyed. /// - bsoncxx::v_noabi::document::view cluster_time() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) cluster_time() const noexcept; /// /// Get the session's operationTime, as a BSON timestamp. This is an opaque value suitable for /// passing to advance_operation_time(). The timestamp is zero if the session has not been used /// for any operation and you have not called advance_operation_time(). /// - bsoncxx::v_noabi::types::b_timestamp operation_time() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::b_timestamp) operation_time() const noexcept; /// /// Get the server_id the session is pinned to. The server_id is zero if the session is not /// pinned to a server. /// - std::uint32_t server_id() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(std::uint32_t) server_id() const noexcept; /// /// Returns the current transaction state for this session. /// - transaction_state get_transaction_state() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(transaction_state) get_transaction_state() const noexcept; /// /// Returns whether or not this session is dirty. /// - bool get_dirty() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bool) get_dirty() const noexcept; /// /// Advance the cluster time for a session. Has an effect only if the new cluster time is @@ -127,7 +127,8 @@ class client_session { /// clusterTime from another session, ensuring subsequent operations in this session are /// causally consistent with the last operation in the other session. /// - void advance_cluster_time(const bsoncxx::v_noabi::document::view& cluster_time); + MONGOCXX_ABI_EXPORT_CDECL(void) + advance_cluster_time(const bsoncxx::v_noabi::document::view& cluster_time); /// /// Advance the session's operation time, expressed as a BSON timestamp. Has an effect only if @@ -137,7 +138,8 @@ class client_session { /// clusterTime from another session, ensuring subsequent operations in this session are /// causally consistent with the last operation in the other session. /// - void advance_operation_time(const bsoncxx::v_noabi::types::b_timestamp& operation_time); + MONGOCXX_ABI_EXPORT_CDECL(void) + advance_operation_time(const bsoncxx::v_noabi::types::b_timestamp& operation_time); /// /// Starts a transaction on the current client session. @@ -149,7 +151,8 @@ class client_session { /// are network or other transient failures, or if there are other errors such as a session with /// a transaction already in progress. /// - void start_transaction(const stdx::optional& transaction_opts = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + start_transaction(const stdx::optional& transaction_opts = {}); /// /// Commits a transaction on the current client session. @@ -158,7 +161,7 @@ class client_session { /// are network or other transient failures, or if there are other errors such as a session with /// no transaction in progress. /// - void commit_transaction(); + MONGOCXX_ABI_EXPORT_CDECL(void) commit_transaction(); /// /// Aborts a transaction on the current client session. @@ -166,12 +169,12 @@ class client_session { /// @throws mongocxx::v_noabi::operation_exception if the options are misconfigured or if there /// are other errors such as a session with no transaction in progress. /// - void abort_transaction(); + MONGOCXX_ABI_EXPORT_CDECL(void) abort_transaction(); /// /// Represents a callback invoked within a transaction. /// - using with_transaction_cb = std::function; + using with_transaction_cb = std::function; /// /// Helper to run a user-provided callback within a transaction. @@ -194,7 +197,8 @@ class client_session { /// @throws mongocxx::v_noabi::operation_exception if there are errors completing the /// transaction. /// - void with_transaction(with_transaction_cb cb, options::transaction opts = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + with_transaction(with_transaction_cb cb, options::transaction opts = {}); private: friend ::mongocxx::v_noabi::bulk_write; @@ -204,13 +208,12 @@ class client_session { friend ::mongocxx::v_noabi::index_view; friend ::mongocxx::v_noabi::search_index_view; - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE client_session(const mongocxx::v_noabi::client* client, - const options::client_session& options); + client_session(const mongocxx::v_noabi::client* client, const options::client_session& options); - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection-fwd.hpp index 0a569f2be0..a118929281 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API collection; +class collection; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection.hpp index d251250506..50d706e2f5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/collection.hpp @@ -96,9 +96,7 @@ class collection { // // See collection::update_one for an example of such overloads. // - class _empty_doc_tag { - _empty_doc_tag() = default; - }; + class _empty_doc_tag {}; public: /// @@ -107,38 +105,38 @@ class collection { /// valid actions to take with a default constructed collection /// are to assign to it, or destroy it. /// - collection() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() collection() noexcept; /// /// Move constructs a collection. /// - collection(collection&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() collection(collection&&) noexcept; /// /// Move assigns a collection. /// - collection& operator=(collection&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(collection&) operator=(collection&&) noexcept; /// /// Copy constructs a collection. /// - collection(const collection&); + MONGOCXX_ABI_EXPORT_CDECL() collection(const collection&); /// /// Copy assigns a collection. /// - collection& operator=(const collection&); + MONGOCXX_ABI_EXPORT_CDECL(collection&) operator=(const collection&); /// /// Destroys a collection. /// - ~collection(); + MONGOCXX_ABI_EXPORT_CDECL() ~collection(); /// /// Returns true if the collection is valid, meaning it was not /// default constructed or moved from. /// - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; /// /// Runs an aggregation framework pipeline against this collection. @@ -159,8 +157,8 @@ class collection { /// collection level set read concern - collection::read_concern(rc). /// (Write concern supported only for MongoDB 3.4+). /// - cursor aggregate(const pipeline& pipeline, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + aggregate(const pipeline& pipeline, const options::aggregate& options = options::aggregate()); /// /// Runs an aggregation framework pipeline against this collection. @@ -183,9 +181,10 @@ class collection { /// collection level set read concern - collection::read_concern(rc). /// (Write concern supported only for MongoDB 3.4+). /// - cursor aggregate(const client_session& session, - const pipeline& pipeline, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + aggregate(const client_session& session, + const pipeline& pipeline, + const options::aggregate& options = options::aggregate()); /// /// Creates a new bulk operation to be executed against this collection. @@ -197,7 +196,8 @@ class collection { /// @return /// The newly-created bulk write. /// - mongocxx::v_noabi::bulk_write create_bulk_write(const options::bulk_write& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::bulk_write) + create_bulk_write(const options::bulk_write& options = {}); /// /// Creates a new bulk operation to be executed against this collection. @@ -211,8 +211,8 @@ class collection { /// @return /// The newly-created bulk write. /// - mongocxx::v_noabi::bulk_write create_bulk_write(const client_session& session, - const options::bulk_write& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::bulk_write) + create_bulk_write(const client_session& session, const options::bulk_write& options = {}); /// /// Sends a write to the server as a bulk write operation. @@ -234,8 +234,10 @@ class collection { /// @see mongocxx::v_noabi::bulk_write /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// - MONGOCXX_INLINE stdx::optional write( - const model::write& write, const options::bulk_write& options = options::bulk_write()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + write(const model::write& write, const options::bulk_write& options = options::bulk_write()) { + return create_bulk_write(options).append(write).execute(); + } /// /// Sends a write to the server as a bulk write operation. @@ -259,10 +261,12 @@ class collection { /// @see mongocxx::v_noabi::bulk_write /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// - MONGOCXX_INLINE stdx::optional write( - const client_session& session, - const model::write& write, - const options::bulk_write& options = options::bulk_write()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + write(const client_session& session, + const model::write& write, + const options::bulk_write& options = options::bulk_write()) { + return create_bulk_write(session, options).append(write).execute(); + } /// /// Sends a container of writes to the server as a bulk write operation. @@ -286,8 +290,10 @@ class collection { /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// template - MONGOCXX_INLINE stdx::optional bulk_write( - const container_type& writes, const options::bulk_write& options = options::bulk_write()); + stdx::optional bulk_write( + const container_type& writes, const options::bulk_write& options = options::bulk_write()) { + return bulk_write(writes.begin(), writes.end(), options); + } /// /// Sends a container of writes to the server as a bulk write operation. @@ -313,10 +319,12 @@ class collection { /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// template - MONGOCXX_INLINE stdx::optional bulk_write( + stdx::optional bulk_write( const client_session& session, const container_type& writes, - const options::bulk_write& options = options::bulk_write()); + const options::bulk_write& options = options::bulk_write()) { + return bulk_write(session, writes.begin(), writes.end(), options); + } /// /// Sends writes starting at @c begin and ending at @c end to the server as a bulk write @@ -341,10 +349,14 @@ class collection { /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// template - MONGOCXX_INLINE stdx::optional bulk_write( + stdx::optional bulk_write( write_model_iterator_type begin, write_model_iterator_type end, - const options::bulk_write& options = options::bulk_write()); + const options::bulk_write& options = options::bulk_write()) { + auto writes = create_bulk_write(options); + std::for_each(begin, end, [&](const model::write& current) { writes.append(current); }); + return writes.execute(); + } /// /// Sends writes starting at @c begin and ending at @c end to the server as a bulk write @@ -371,11 +383,15 @@ class collection { /// @see https://www.mongodb.com/docs/manual/core/bulk-write-operations/ /// template - MONGOCXX_INLINE stdx::optional bulk_write( + stdx::optional bulk_write( const client_session& session, write_model_iterator_type begin, write_model_iterator_type end, - const options::bulk_write& options = options::bulk_write()); + const options::bulk_write& options = options::bulk_write()) { + auto writes = create_bulk_write(session, options); + std::for_each(begin, end, [&](const model::write& current) { writes.append(current); }); + return writes.execute(); + } /// /// Counts the number of documents matching the provided filter. @@ -399,8 +415,9 @@ class collection { /// /// @see mongocxx::v_noabi::collection::estimated_document_count /// - std::int64_t count_documents(bsoncxx::v_noabi::document::view_or_value filter, - const options::count& options = options::count()); + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) + count_documents(bsoncxx::v_noabi::document::view_or_value filter, + const options::count& options = options::count()); /// /// Counts the number of documents matching the provided filter. @@ -423,9 +440,10 @@ class collection { /// /// @see mongocxx::v_noabi::collection::estimated_document_count /// - std::int64_t count_documents(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::count& options = options::count()); + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) + count_documents(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::count& options = options::count()); /// /// Returns an estimate of the number of documents in the collection. @@ -442,7 +460,8 @@ class collection { /// /// @see mongocxx::v_noabi::collection::count_documents /// - std::int64_t estimated_document_count( + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) + estimated_document_count( const options::estimated_document_count& options = options::estimated_document_count()); /// @@ -464,10 +483,10 @@ class collection { /// @note /// Write concern supported only for MongoDB 3.4+. /// - bsoncxx::v_noabi::document::value create_index( - bsoncxx::v_noabi::document::view_or_value keys, - bsoncxx::v_noabi::document::view_or_value index_options = {}, - options::index_view operation_options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + create_index(bsoncxx::v_noabi::document::view_or_value keys, + bsoncxx::v_noabi::document::view_or_value index_options = {}, + options::index_view operation_options = options::index_view{}); /// /// Creates an index over the collection for the provided keys with the provided options. @@ -490,11 +509,11 @@ class collection { /// @note /// Write concern supported only for MongoDB 3.4+. /// - bsoncxx::v_noabi::document::value create_index( - const client_session& session, - bsoncxx::v_noabi::document::view_or_value keys, - bsoncxx::v_noabi::document::view_or_value index_options = {}, - options::index_view operation_options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + create_index(const client_session& session, + bsoncxx::v_noabi::document::view_or_value keys, + bsoncxx::v_noabi::document::view_or_value index_options = {}, + options::index_view operation_options = options::index_view{}); /// /// Deletes all matching documents from the collection. @@ -512,9 +531,9 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/delete/ /// - stdx::optional delete_many( - bsoncxx::v_noabi::document::view_or_value filter, - const options::delete_options& options = options::delete_options()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + delete_many(bsoncxx::v_noabi::document::view_or_value filter, + const options::delete_options& options = options::delete_options()); /// /// Deletes all matching documents from the collection. @@ -534,10 +553,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/delete/ /// - stdx::optional delete_many( - const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::delete_options& options = options::delete_options()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + delete_many(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::delete_options& options = options::delete_options()); /// /// Deletes a single matching document from the collection. @@ -555,9 +574,9 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/delete/ /// - stdx::optional delete_one( - bsoncxx::v_noabi::document::view_or_value filter, - const options::delete_options& options = options::delete_options()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + delete_one(bsoncxx::v_noabi::document::view_or_value filter, + const options::delete_options& options = options::delete_options()); /// /// Deletes a single matching document from the collection. @@ -577,10 +596,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/delete/ /// - stdx::optional delete_one( - const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::delete_options& options = options::delete_options()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + delete_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::delete_options& options = options::delete_options()); /// /// Finds the distinct values for a specified field across the collection. @@ -598,9 +617,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - cursor distinct(bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value filter, - const options::distinct& options = options::distinct()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + distinct(bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value filter, + const options::distinct& options = options::distinct()); /// /// Finds the distinct values for a specified field across the collection. @@ -620,10 +640,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - cursor distinct(const client_session& session, - bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value filter, - const options::distinct& options = options::distinct()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + distinct(const client_session& session, + bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value filter, + const options::distinct& options = options::distinct()); /// /// Drops this collection and all its contained documents from the database. @@ -644,9 +665,10 @@ class collection { /// @note /// Write concern supported only for MongoDB 3.4+. /// - void drop(const bsoncxx::v_noabi::stdx::optional& - write_concern = {}, - bsoncxx::v_noabi::document::view_or_value collection_options = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop(const bsoncxx::v_noabi::stdx::optional& write_concern = + {}, + bsoncxx::v_noabi::document::view_or_value collection_options = {}); /// /// Drops this collection and all its contained documents from the database. @@ -668,10 +690,11 @@ class collection { /// @note /// Write concern supported only for MongoDB 3.4+. /// - void drop(const client_session& session, - const bsoncxx::v_noabi::stdx::optional& - write_concern = {}, - bsoncxx::v_noabi::document::view_or_value collection_options = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop(const client_session& session, + const bsoncxx::v_noabi::stdx::optional& write_concern = + {}, + bsoncxx::v_noabi::document::view_or_value collection_options = {}); /// /// Finds the documents in this collection which match the provided filter. @@ -690,8 +713,9 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/core/read-operations-introduction/ /// - cursor find(bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options = options::find()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + find(bsoncxx::v_noabi::document::view_or_value filter, + const options::find& options = options::find()); /// /// Finds the documents in this collection which match the provided filter. @@ -712,9 +736,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/core/read-operations-introduction/ /// - cursor find(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options = options::find()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + find(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::find& options = options::find()); /// /// Finds a single document in this collection that match the provided filter. @@ -730,9 +755,9 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/core/read-operations-introduction/ /// - stdx::optional find_one( - bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options = options::find()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one(bsoncxx::v_noabi::document::view_or_value filter, + const options::find& options = options::find()); /// /// Finds a single document in this collection that match the provided filter. @@ -750,10 +775,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/core/read-operations-introduction/ /// - stdx::optional find_one( - const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options = options::find()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::find& options = options::find()); /// /// Finds a single document matching the filter, deletes it, and returns the original. @@ -772,7 +797,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_delete( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_delete( bsoncxx::v_noabi::document::view_or_value filter, const options::find_one_and_delete& options = options::find_one_and_delete()); @@ -795,7 +821,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_delete( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_delete( const client_session& session, bsoncxx::v_noabi::document::view_or_value filter, const options::find_one_and_delete& options = options::find_one_and_delete()); @@ -820,7 +847,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_replace( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_replace( bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement, const options::find_one_and_replace& options = options::find_one_and_replace()); @@ -847,7 +875,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_replace( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_replace( const client_session& session, bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement, @@ -873,7 +902,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_update( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_update( bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update, const options::find_one_and_update& options = options::find_one_and_update()); @@ -898,7 +928,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_update( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_update( bsoncxx::v_noabi::document::view_or_value filter, const pipeline& update, const options::find_one_and_update& options = options::find_one_and_update()); @@ -923,7 +954,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_update( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_update( bsoncxx::v_noabi::document::view_or_value filter, std::initializer_list<_empty_doc_tag> update, const options::find_one_and_update& options = options::find_one_and_update()); @@ -950,7 +982,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_update( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_update( const client_session& session, bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update, @@ -978,7 +1011,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_update( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_update( const client_session& session, bsoncxx::v_noabi::document::view_or_value filter, const pipeline& update, @@ -1006,7 +1040,8 @@ class collection { /// @exception /// Throws mongocxx::v_noabi::write_exception if the operation fails. /// - stdx::optional find_one_and_update( + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + find_one_and_update( const client_session& session, bsoncxx::v_noabi::document::view_or_value filter, std::initializer_list<_empty_doc_tag> update, @@ -1027,8 +1062,9 @@ class collection { /// /// @throws mongocxx::v_noabi::bulk_write_exception if the operation fails. /// - stdx::optional insert_one( - bsoncxx::v_noabi::document::view_or_value document, const options::insert& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + insert_one(bsoncxx::v_noabi::document::view_or_value document, + const options::insert& options = {}); /// /// @@ -1048,10 +1084,10 @@ class collection { /// /// @throws mongocxx::v_noabi::bulk_write_exception if the operation fails. /// - stdx::optional insert_one( - const client_session& session, - bsoncxx::v_noabi::document::view_or_value document, - const options::insert& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + insert_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value document, + const options::insert& options = {}); /// /// Inserts multiple documents into the collection. If any of the documents are missing @@ -1077,8 +1113,10 @@ class collection { /// @throws mongocxx::v_noabi::bulk_write_exception when the operation fails. /// template - MONGOCXX_INLINE stdx::optional insert_many( - const container_type& container, const options::insert& options = options::insert()); + stdx::optional insert_many( + const container_type& container, const options::insert& options = options::insert()) { + return insert_many(container.begin(), container.end(), options); + } /// /// Inserts multiple documents into the collection. If any of the documents are missing @@ -1102,10 +1140,12 @@ class collection { /// @throws mongocxx::v_noabi::bulk_write_exception when the operation fails. /// template - MONGOCXX_INLINE stdx::optional insert_many( + stdx::optional insert_many( const client_session& session, const container_type& container, - const options::insert& options = options::insert()); + const options::insert& options = options::insert()) { + return insert_many(session, container.begin(), container.end(), options); + } /// /// Inserts multiple documents into the collection. If any of the documents are missing @@ -1131,10 +1171,12 @@ class collection { /// @throws mongocxx::v_noabi::bulk_write_exception if the operation fails. /// template - MONGOCXX_INLINE stdx::optional insert_many( + stdx::optional insert_many( document_view_iterator_type begin, document_view_iterator_type end, - const options::insert& options = options::insert()); + const options::insert& options = options::insert()) { + return _insert_many(nullptr, begin, end, options); + } /// /// Inserts multiple documents into the collection. If any of the documents are missing @@ -1158,11 +1200,13 @@ class collection { /// @throws mongocxx::v_noabi::bulk_write_exception if the operation fails. /// template - MONGOCXX_INLINE stdx::optional insert_many( + stdx::optional insert_many( const client_session& session, document_view_iterator_type begin, document_view_iterator_type end, - const options::insert& options = options::insert()); + const options::insert& options = options::insert()) { + return _insert_many(&session, begin, end, options); + } /// /// @@ -1174,7 +1218,7 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listIndexes/ /// - cursor list_indexes() const; + MONGOCXX_ABI_EXPORT_CDECL(cursor) list_indexes() const; /// /// Returns a list of the indexes currently on this collection. @@ -1188,7 +1232,7 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listIndexes/ /// - cursor list_indexes(const client_session& session) const; + MONGOCXX_ABI_EXPORT_CDECL(cursor) list_indexes(const client_session& session) const; /// /// Returns the name of this collection. @@ -1196,7 +1240,7 @@ class collection { /// @return The name of the collection. The return value of this method is invalidated by any /// subsequent call to collection::rename() on this collection object. /// - stdx::string_view name() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::string_view) name() const; /// /// Rename this collection. @@ -1217,9 +1261,10 @@ class collection { /// @note /// Write concern supported only for MongoDB 3.4+. /// - void rename(bsoncxx::v_noabi::string::view_or_value new_name, - bool drop_target_before_rename = false, - const bsoncxx::v_noabi::stdx::optional& write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + rename(bsoncxx::v_noabi::string::view_or_value new_name, + bool drop_target_before_rename = false, + const bsoncxx::v_noabi::stdx::optional& write_concern = {}); /// /// Rename this collection. @@ -1242,10 +1287,11 @@ class collection { /// @note /// Write concern supported only for MongoDB 3.4+. /// - void rename(const client_session& session, - bsoncxx::v_noabi::string::view_or_value new_name, - bool drop_target_before_rename = false, - const bsoncxx::v_noabi::stdx::optional& write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + rename(const client_session& session, + bsoncxx::v_noabi::string::view_or_value new_name, + bool drop_target_before_rename = false, + const bsoncxx::v_noabi::stdx::optional& write_concern = {}); /// /// Sets the read_concern for this collection. Changes will not have any effect on existing @@ -1256,7 +1302,7 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/read-concern/ /// - void read_concern(mongocxx::v_noabi::read_concern rc); + MONGOCXX_ABI_EXPORT_CDECL(void) read_concern(mongocxx::v_noabi::read_concern rc); /// /// Gets the read_concern for the collection. @@ -1266,7 +1312,7 @@ class collection { /// /// @return The current read_concern. /// - mongocxx::v_noabi::read_concern read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_concern) read_concern() const; /// /// Sets the read_preference for this collection. Changes will not have any effect on existing @@ -1277,7 +1323,7 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/core/read-preference/ /// - void read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(void) read_preference(mongocxx::v_noabi::read_preference rp); /// /// Gets the read_preference for the collection. @@ -1286,7 +1332,7 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/core/read-preference/ /// - mongocxx::v_noabi::read_preference read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_preference) read_preference() const; /// /// Replaces a single document matching the provided filter in this collection. @@ -1308,10 +1354,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional replace_one( - bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value replacement, - const options::replace& options = options::replace{}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + replace_one(bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value replacement, + const options::replace& options = options::replace{}); /// /// Replaces a single document matching the provided filter in this collection. @@ -1335,11 +1381,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional replace_one( - const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value replacement, - const options::replace& options = options::replace{}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + replace_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value replacement, + const options::replace& options = options::replace{}); /// /// Updates multiple documents matching the provided filter in this collection. @@ -1361,9 +1407,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_many(bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_many(bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value update, + const options::update& options = options::update()); /// /// Updates multiple documents matching the provided filter in this collection. @@ -1385,9 +1432,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_many(bsoncxx::v_noabi::document::view_or_value filter, - const pipeline& update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_many(bsoncxx::v_noabi::document::view_or_value filter, + const pipeline& update, + const options::update& options = options::update()); /// /// Updates multiple documents matching the provided filter in this collection. @@ -1409,9 +1457,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_many(bsoncxx::v_noabi::document::view_or_value filter, - std::initializer_list<_empty_doc_tag> update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_many(bsoncxx::v_noabi::document::view_or_value filter, + std::initializer_list<_empty_doc_tag> update, + const options::update& options = options::update()); /// /// Updates multiple documents matching the provided filter in this collection. @@ -1435,10 +1484,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_many(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_many(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value update, + const options::update& options = options::update()); /// /// Updates multiple documents matching the provided filter in this collection. @@ -1462,10 +1512,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_many(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const pipeline& update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_many(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const pipeline& update, + const options::update& options = options::update()); /// /// Updates multiple documents matching the provided filter in this collection. @@ -1489,10 +1540,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_many(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - std::initializer_list<_empty_doc_tag> update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_many(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + std::initializer_list<_empty_doc_tag> update, + const options::update& options = options::update()); /// /// Updates a single document matching the provided filter in this collection. @@ -1514,9 +1566,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_one(bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_one(bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value update, + const options::update& options = options::update()); /// /// Updates a single document matching the provided filter in this collection. @@ -1538,9 +1591,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_one(bsoncxx::v_noabi::document::view_or_value filter, - const pipeline& update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_one(bsoncxx::v_noabi::document::view_or_value filter, + const pipeline& update, + const options::update& options = options::update()); /// /// Updates a single document matching the provided filter in this collection. @@ -1562,9 +1616,10 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_one(bsoncxx::v_noabi::document::view_or_value filter, - std::initializer_list<_empty_doc_tag> update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_one(bsoncxx::v_noabi::document::view_or_value filter, + std::initializer_list<_empty_doc_tag> update, + const options::update& options = options::update()); /// /// Updates a single document matching the provided filter in this collection. @@ -1588,10 +1643,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_one(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value update, + const options::update& options = options::update()); /// /// Updates a single document matching the provided filter in this collection. @@ -1615,10 +1671,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_one(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const pipeline& update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const pipeline& update, + const options::update& options = options::update()); /// /// Updates a single document matching the provided filter in this collection. @@ -1642,10 +1699,11 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - stdx::optional update_one(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - std::initializer_list<_empty_doc_tag> update, - const options::update& options = options::update()); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + update_one(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + std::initializer_list<_empty_doc_tag> update, + const options::update& options = options::update()); /// /// Sets the write_concern for this collection. Changes will not have any effect on existing @@ -1654,19 +1712,19 @@ class collection { /// @param wc /// The new write_concern to use. /// - void write_concern(mongocxx::v_noabi::write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(void) write_concern(mongocxx::v_noabi::write_concern wc); /// /// Gets the write_concern for the collection. /// /// @return The current write_concern. /// - mongocxx::v_noabi::write_concern write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::write_concern) write_concern() const; /// /// Gets an index_view to the collection. /// - index_view indexes(); + MONGOCXX_ABI_EXPORT_CDECL(index_view) indexes(); /// /// @@ -1681,7 +1739,7 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) watch(const options::change_stream& options = {}); /// /// @param session @@ -1694,7 +1752,8 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const client_session& session, const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const client_session& session, const options::change_stream& options = {}); /// /// Gets a change stream on this collection. @@ -1712,7 +1771,8 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const pipeline& pipe, const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const pipeline& pipe, const options::change_stream& options = {}); /// /// Gets a change stream on this collection. @@ -1729,245 +1789,159 @@ class collection { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const client_session& session, - const pipeline& pipe, - const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const client_session& session, + const pipeline& pipe, + const options::change_stream& options = {}); /// /// Gets a search_index_view to the collection. /// - search_index_view search_indexes(); + MONGOCXX_ABI_EXPORT_CDECL(search_index_view) search_indexes(); private: friend ::mongocxx::v_noabi::bulk_write; friend ::mongocxx::v_noabi::client_encryption; friend ::mongocxx::v_noabi::database; - MONGOCXX_PRIVATE collection(const database& database, - bsoncxx::v_noabi::string::view_or_value collection_name); + collection(const database& database, bsoncxx::v_noabi::string::view_or_value collection_name); - MONGOCXX_PRIVATE collection(const database& database, void* collection); + collection(const database& database, void* collection); - MONGOCXX_PRIVATE cursor _aggregate(const client_session* session, - const pipeline& pipeline, - const options::aggregate& options); + cursor _aggregate(const client_session* session, + const pipeline& pipeline, + const options::aggregate& options); - MONGOCXX_PRIVATE std::int64_t _count(const client_session* session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::count& options); + std::int64_t _count(const client_session* session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::count& options); - MONGOCXX_PRIVATE std::int64_t _count_documents(const client_session* session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::count& options); + std::int64_t _count_documents(const client_session* session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::count& options); - MONGOCXX_PRIVATE bsoncxx::v_noabi::document::value _create_index( + bsoncxx::v_noabi::document::value _create_index( const client_session* session, bsoncxx::v_noabi::document::view_or_value keys, bsoncxx::v_noabi::document::view_or_value index_options, options::index_view operation_options); - MONGOCXX_PRIVATE stdx::optional _delete_many( + stdx::optional _delete_many( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, const options::delete_options& options); - MONGOCXX_PRIVATE stdx::optional _delete_one( + stdx::optional _delete_one( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, const options::delete_options& options); - MONGOCXX_PRIVATE cursor _distinct(const client_session* session, - bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value filter, - const options::distinct& options); + cursor _distinct(const client_session* session, + bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value filter, + const options::distinct& options); - MONGOCXX_PRIVATE void _drop( + void _drop( const client_session* session, const bsoncxx::v_noabi::stdx::optional& write_concern, bsoncxx::v_noabi::document::view_or_value collection_options); - MONGOCXX_PRIVATE cursor _find(const client_session* session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options); + cursor _find(const client_session* session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::find& options); - MONGOCXX_PRIVATE stdx::optional _find_one( + stdx::optional _find_one( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, const options::find& options); - MONGOCXX_PRIVATE stdx::optional _find_one_and_delete( + stdx::optional _find_one_and_delete( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, const options::find_one_and_delete& options); - MONGOCXX_PRIVATE stdx::optional _find_one_and_replace( + stdx::optional _find_one_and_replace( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement, const options::find_one_and_replace& options); - MONGOCXX_PRIVATE stdx::optional _find_one_and_update( + stdx::optional _find_one_and_update( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update, const options::find_one_and_update& options); - MONGOCXX_PRIVATE stdx::optional _insert_one( + stdx::optional _insert_one( const client_session* session, bsoncxx::v_noabi::document::view_or_value document, const options::insert& options); - MONGOCXX_PRIVATE void _rename( + void _rename( const client_session* session, bsoncxx::v_noabi::string::view_or_value new_name, bool drop_target_before_rename, const bsoncxx::v_noabi::stdx::optional& write_concern); - MONGOCXX_PRIVATE stdx::optional _replace_one( - const client_session* session, - const options::bulk_write& bulk_opts, - const model::replace_one& replace_op); + stdx::optional _replace_one(const client_session* session, + const options::bulk_write& bulk_opts, + const model::replace_one& replace_op); - MONGOCXX_PRIVATE stdx::optional _replace_one( + stdx::optional _replace_one( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement, const options::replace& options); - MONGOCXX_PRIVATE stdx::optional _update_one( - const client_session* session, - bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value update, - const options::update& options); + stdx::optional _update_one(const client_session* session, + bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value update, + const options::update& options); - MONGOCXX_PRIVATE stdx::optional _update_many( - const client_session* session, - bsoncxx::v_noabi::document::view_or_value filter, - bsoncxx::v_noabi::document::view_or_value update, - const options::update& options); + stdx::optional _update_many(const client_session* session, + bsoncxx::v_noabi::document::view_or_value filter, + bsoncxx::v_noabi::document::view_or_value update, + const options::update& options); - MONGOCXX_PRIVATE change_stream _watch(const client_session* session, - const pipeline& pipe, - const options::change_stream& options); + change_stream _watch(const client_session* session, + const pipeline& pipe, + const options::change_stream& options); // Helpers for the insert_many method templates. - mongocxx::v_noabi::bulk_write _init_insert_many(const options::insert& options, - const client_session* session); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::bulk_write) + _init_insert_many(const options::insert& options, const client_session* session); - void _insert_many_doc_handler(mongocxx::v_noabi::bulk_write& writes, - bsoncxx::v_noabi::builder::basic::array& inserted_ids, - bsoncxx::v_noabi::document::view doc) const; + MONGOCXX_ABI_EXPORT_CDECL(void) + _insert_many_doc_handler(mongocxx::v_noabi::bulk_write& writes, + bsoncxx::v_noabi::builder::basic::array& inserted_ids, + bsoncxx::v_noabi::document::view doc) const; - stdx::optional _exec_insert_many( - mongocxx::v_noabi::bulk_write& writes, - bsoncxx::v_noabi::builder::basic::array& inserted_ids); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + _exec_insert_many(mongocxx::v_noabi::bulk_write& writes, + bsoncxx::v_noabi::builder::basic::array& inserted_ids); template - MONGOCXX_PRIVATE stdx::optional _insert_many( - const client_session* session, - document_view_iterator_type begin, - document_view_iterator_type end, - const options::insert& options); - - class MONGOCXX_PRIVATE impl; - - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + stdx::optional _insert_many(const client_session* session, + document_view_iterator_type begin, + document_view_iterator_type end, + const options::insert& options) { + bsoncxx::v_noabi::builder::basic::array inserted_ids; + auto writes = _init_insert_many(options, session); + std::for_each( + begin, end, [&inserted_ids, &writes, this](bsoncxx::v_noabi::document::view doc) { + _insert_many_doc_handler(writes, inserted_ids, doc); + }); + return _exec_insert_many(writes, inserted_ids); + } + + class impl; + + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; -MONGOCXX_INLINE stdx::optional collection::write( - const model::write& write, const options::bulk_write& options) { - return create_bulk_write(options).append(write).execute(); -} - -MONGOCXX_INLINE stdx::optional collection::write( - const client_session& session, const model::write& write, const options::bulk_write& options) { - return create_bulk_write(session, options).append(write).execute(); -} - -template -MONGOCXX_INLINE stdx::optional collection::bulk_write( - const container_type& requests, const options::bulk_write& options) { - return bulk_write(requests.begin(), requests.end(), options); -} - -template -MONGOCXX_INLINE stdx::optional collection::bulk_write( - const client_session& session, - const container_type& requests, - const options::bulk_write& options) { - return bulk_write(session, requests.begin(), requests.end(), options); -} - -template -MONGOCXX_INLINE stdx::optional collection::bulk_write( - write_model_iterator_type begin, - write_model_iterator_type end, - const options::bulk_write& options) { - auto writes = create_bulk_write(options); - std::for_each(begin, end, [&](const model::write& current) { writes.append(current); }); - return writes.execute(); -} - -template -MONGOCXX_INLINE stdx::optional collection::bulk_write( - const client_session& session, - write_model_iterator_type begin, - write_model_iterator_type end, - const options::bulk_write& options) { - auto writes = create_bulk_write(session, options); - std::for_each(begin, end, [&](const model::write& current) { writes.append(current); }); - return writes.execute(); -} - -template -MONGOCXX_INLINE stdx::optional collection::insert_many( - const container_type& container, const options::insert& options) { - return insert_many(container.begin(), container.end(), options); -} - -template -MONGOCXX_INLINE stdx::optional collection::insert_many( - const client_session& session, - const container_type& container, - const options::insert& options) { - return insert_many(session, container.begin(), container.end(), options); -} - -template -MONGOCXX_INLINE stdx::optional collection::_insert_many( - - const client_session* session, - document_view_iterator_type begin, - document_view_iterator_type end, - const options::insert& options) { - bsoncxx::v_noabi::builder::basic::array inserted_ids; - auto writes = _init_insert_many(options, session); - std::for_each(begin, end, [&inserted_ids, &writes, this](bsoncxx::v_noabi::document::view doc) { - _insert_many_doc_handler(writes, inserted_ids, doc); - }); - return _exec_insert_many(writes, inserted_ids); -} - -template -MONGOCXX_INLINE stdx::optional collection::insert_many( - document_view_iterator_type begin, - document_view_iterator_type end, - const options::insert& options) { - return _insert_many(nullptr, begin, end, options); -} - -template -MONGOCXX_INLINE stdx::optional collection::insert_many( - const client_session& session, - document_view_iterator_type begin, - document_view_iterator_type end, - const options::insert& options) { - return _insert_many(&session, begin, end, options); -} - } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor-fwd.hpp index 8ae2e55fec..03534daa0f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API cursor; +class cursor; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor.hpp index 29014329fa..4ee7f458e0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/cursor.hpp @@ -43,22 +43,22 @@ class cursor { public: enum class type { k_non_tailable, k_tailable, k_tailable_await }; - class MONGOCXX_API iterator; + class iterator; /// /// Move constructs a cursor. /// - cursor(cursor&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() cursor(cursor&&) noexcept; /// /// Move assigns a cursor. /// - cursor& operator=(cursor&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(cursor&) operator=(cursor&&) noexcept; /// /// Destroys a cursor. /// - ~cursor(); + MONGOCXX_ABI_EXPORT_CDECL() ~cursor(); cursor(const cursor&) = delete; cursor& operator=(const cursor&) = delete; @@ -77,7 +77,7 @@ class cursor { /// /// @throws mongocxx::v_noabi::query_exception if the query failed /// - iterator begin(); + MONGOCXX_ABI_EXPORT_CDECL(iterator) begin(); /// /// A cursor::iterator indicating cursor exhaustion, meaning that @@ -85,7 +85,7 @@ class cursor { /// /// @return the cursor::iterator /// - iterator end(); + MONGOCXX_ABI_EXPORT_CDECL(iterator) end(); private: friend ::mongocxx::v_noabi::client_encryption; @@ -97,11 +97,10 @@ class cursor { friend ::mongocxx::v_noabi::cursor::iterator; - MONGOCXX_PRIVATE cursor( - void* cursor_ptr, - bsoncxx::v_noabi::stdx::optional cursor_type = bsoncxx::v_noabi::stdx::nullopt); + cursor(void* cursor_ptr, + bsoncxx::v_noabi::stdx::optional cursor_type = bsoncxx::v_noabi::stdx::nullopt); - class MONGOCXX_PRIVATE impl; + class impl; std::unique_ptr _impl; }; @@ -137,26 +136,26 @@ class cursor::iterator { /// /// Dereferences the view for the document currently being pointed to. /// - const bsoncxx::v_noabi::document::view& operator*() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view&) operator*() const; /// /// Accesses a member of the dereferenced document currently being pointed to. /// - const bsoncxx::v_noabi::document::view* operator->() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view*) operator->() const; /// /// Pre-increments the iterator to move to the next document. /// /// @throws mongocxx::v_noabi::query_exception if the query failed /// - iterator& operator++(); + MONGOCXX_ABI_EXPORT_CDECL(iterator&) operator++(); /// /// Post-increments the iterator to move to the next document. /// /// @throws mongocxx::v_noabi::query_exception if the query failed /// - void operator++(int); + MONGOCXX_ABI_EXPORT_CDECL(void) operator++(int); private: friend ::mongocxx::v_noabi::cursor; @@ -168,14 +167,14 @@ class cursor::iterator { /// they point to the same underlying cursor or if both are exhausted. /// /// @{ - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const iterator&, const iterator&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const iterator&, const iterator&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const iterator&, const iterator&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const iterator&, const iterator&); /// @} /// - MONGOCXX_PRIVATE bool is_exhausted() const; + bool is_exhausted() const; - MONGOCXX_PRIVATE explicit iterator(cursor* cursor); + explicit iterator(cursor* cursor); // If this pointer is null, the iterator is considered "past-the-end". cursor* _cursor; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database-fwd.hpp index b14d5d29bc..aa558b2ffc 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API database; +class database; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database.hpp index d76f04e086..e61d470a6d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/database.hpp @@ -50,38 +50,38 @@ class database { /// to the state of a moved-from database. The only valid actions to take with a default /// constructed database are to assign to it, or destroy it. /// - database() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() database() noexcept; /// /// Move constructs a database. /// - database(database&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() database(database&&) noexcept; /// /// Move assigns a database. /// - database& operator=(database&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(database&) operator=(database&&) noexcept; /// /// Copy constructs a database. /// - database(const database&); + MONGOCXX_ABI_EXPORT_CDECL() database(const database&); /// /// Copy assigns a database. /// - database& operator=(const database&); + MONGOCXX_ABI_EXPORT_CDECL(database&) operator=(const database&); /// /// Destroys a database. /// - ~database(); + MONGOCXX_ABI_EXPORT_CDECL() ~database(); /// /// Returns true if the client is valid, meaning it was not default constructed /// or moved from. /// - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; /// /// Runs an aggregation framework pipeline against this database for @@ -104,8 +104,8 @@ class database { /// database level set read concern - database::read_concern(rc). /// (Write concern supported only for MongoDB 3.4+). /// - cursor aggregate(const pipeline& pipeline, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + aggregate(const pipeline& pipeline, const options::aggregate& options = options::aggregate()); /// /// Runs an aggregation framework pipeline against this database for @@ -130,9 +130,10 @@ class database { /// database level set read concern - database::read_concern(rc). /// (Write concern supported only for MongoDB 3.4+). /// - cursor aggregate(const client_session& session, - const pipeline& pipeline, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + aggregate(const client_session& session, + const pipeline& pipeline, + const options::aggregate& options = options::aggregate()); /// /// Runs a command against this database. @@ -144,8 +145,8 @@ class database { /// /// @throws mongocxx::v_noabi::operation_exception if the operation fails. /// - bsoncxx::v_noabi::document::value run_command( - bsoncxx::v_noabi::document::view_or_value command); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + run_command(bsoncxx::v_noabi::document::view_or_value command); /// /// Runs a command against this database. @@ -158,8 +159,8 @@ class database { /// /// @throws mongocxx::v_noabi::operation_exception if the operation fails. /// - bsoncxx::v_noabi::document::value run_command( - const client_session& session, bsoncxx::v_noabi::document::view_or_value command); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + run_command(const client_session& session, bsoncxx::v_noabi::document::view_or_value command); /// /// Executes a command on a specific server using this database. @@ -172,8 +173,8 @@ class database { /// /// @throws mongocxx::v_noabi::operation_exception if the operation fails. /// - bsoncxx::v_noabi::document::value run_command(bsoncxx::v_noabi::document::view_or_value command, - uint32_t server_id); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + run_command(bsoncxx::v_noabi::document::view_or_value command, uint32_t server_id); /// /// Explicitly creates a collection in this database with the specified options. @@ -195,10 +196,10 @@ class database { /// @exception /// mongocxx::v_noabi::operation_exception if the operation fails. /// - mongocxx::v_noabi::collection create_collection( - stdx::string_view name, - bsoncxx::v_noabi::document::view_or_value collection_options = {}, - const stdx::optional& write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + create_collection(stdx::string_view name, + bsoncxx::v_noabi::document::view_or_value collection_options = {}, + const stdx::optional& write_concern = {}); /// /// Explicitly creates a collection in this database with the specified options. @@ -222,11 +223,11 @@ class database { /// @exception /// mongocxx::v_noabi::operation_exception if the operation fails. /// - mongocxx::v_noabi::collection create_collection( - const client_session& session, - stdx::string_view name, - bsoncxx::v_noabi::document::view_or_value collection_options = {}, - const stdx::optional& write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + create_collection(const client_session& session, + stdx::string_view name, + bsoncxx::v_noabi::document::view_or_value collection_options = {}, + const stdx::optional& write_concern = {}); /// /// Explicitly creates a collection in this database with the specified options. @@ -249,17 +250,17 @@ class database { /// @exception /// mongocxx::v_noabi::operation_exception if the operation fails. /// - MONGOCXX_DEPRECATED mongocxx::v_noabi::collection create_collection( - bsoncxx::v_noabi::string::view_or_value name, - const options::create_collection_deprecated& collection_options, - const stdx::optional& write_concern = {}) { + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + create_collection(bsoncxx::v_noabi::string::view_or_value name, + const options::create_collection_deprecated& collection_options, + const stdx::optional& write_concern = {}) { return create_collection_deprecated(name, collection_options, write_concern); } - mongocxx::v_noabi::collection create_collection_deprecated( - bsoncxx::v_noabi::string::view_or_value name, - const options::create_collection_deprecated& collection_options, - const stdx::optional& write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + create_collection_deprecated(bsoncxx::v_noabi::string::view_or_value name, + const options::create_collection_deprecated& collection_options, + const stdx::optional& write_concern = {}); /// /// Explicitly creates a collection in this database with the specified options. @@ -284,11 +285,11 @@ class database { /// @exception /// mongocxx::v_noabi::operation_exception if the operation fails. /// - MONGOCXX_DEPRECATED mongocxx::v_noabi::collection create_collection( - const client_session& session, - bsoncxx::v_noabi::string::view_or_value name, - const options::create_collection_deprecated& collection_options, - const stdx::optional& write_concern = {}) { + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + create_collection(const client_session& session, + bsoncxx::v_noabi::string::view_or_value name, + const options::create_collection_deprecated& collection_options, + const stdx::optional& write_concern = {}) { return create_collection_deprecated(session, name, collection_options, write_concern); } @@ -315,11 +316,11 @@ class database { /// @exception /// mongocxx::v_noabi::operation_exception if the operation fails. /// - mongocxx::v_noabi::collection create_collection_deprecated( - const client_session& session, - bsoncxx::v_noabi::string::view_or_value name, - const options::create_collection_deprecated& collection_options, - const stdx::optional& write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + create_collection_deprecated(const client_session& session, + bsoncxx::v_noabi::string::view_or_value name, + const options::create_collection_deprecated& collection_options, + const stdx::optional& write_concern = {}); /// /// Drops the database and all its collections. @@ -334,8 +335,9 @@ class database { /// @see /// https://www.mongodb.com/docs/manual/reference/command/dropDatabase/ /// - void drop(const bsoncxx::v_noabi::stdx::optional& - write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop(const bsoncxx::v_noabi::stdx::optional& write_concern = + {}); /// /// Drops the database and all its collections. @@ -352,9 +354,10 @@ class database { /// @see /// https://www.mongodb.com/docs/manual/reference/command/dropDatabase/ /// - void drop(const client_session& session, - const bsoncxx::v_noabi::stdx::optional& - write_concern = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop(const client_session& session, + const bsoncxx::v_noabi::stdx::optional& write_concern = + {}); /// /// Checks whether this database contains a collection having the given name. @@ -366,7 +369,8 @@ class database { /// @throws mongocxx::v_noabi::operation_exception if the underlying 'listCollections' /// command fails. /// - bool has_collection(bsoncxx::v_noabi::string::view_or_value name) const; + MONGOCXX_ABI_EXPORT_CDECL(bool) + has_collection(bsoncxx::v_noabi::string::view_or_value name) const; /// /// Enumerates the collections in this database. @@ -378,7 +382,8 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listCollections/ /// - cursor list_collections(bsoncxx::v_noabi::document::view_or_value filter = {}); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list_collections(bsoncxx::v_noabi::document::view_or_value filter = {}); /// /// Enumerates the collections in this database. @@ -392,8 +397,9 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listCollections/ /// - cursor list_collections(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter = {}); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list_collections(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter = {}); /// /// Enumerates the collection names in this database. @@ -408,8 +414,8 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listCollections/ /// - std::vector list_collection_names( - bsoncxx::v_noabi::document::view_or_value filter = {}); + MONGOCXX_ABI_EXPORT_CDECL(std::vector) + list_collection_names(bsoncxx::v_noabi::document::view_or_value filter = {}); /// /// Enumerates the collection names in this database. @@ -426,15 +432,16 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/reference/command/listCollections/ /// - std::vector list_collection_names( - const client_session& session, bsoncxx::v_noabi::document::view_or_value filter = {}); + MONGOCXX_ABI_EXPORT_CDECL(std::vector) + list_collection_names(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter = {}); /// /// Get the name of this database. /// /// @return the name of this database. /// - stdx::string_view name() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::string_view) name() const; /// /// Sets the read_concern for this database. @@ -448,7 +455,7 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/reference/read-concern/ /// - void read_concern(mongocxx::v_noabi::read_concern rc); + MONGOCXX_ABI_EXPORT_CDECL(void) read_concern(mongocxx::v_noabi::read_concern rc); /// /// The current read concern for this database. @@ -458,7 +465,7 @@ class database { /// /// @return the current read_concern /// - mongocxx::v_noabi::read_concern read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_concern) read_concern() const; /// /// Sets the read_preference for this database. @@ -471,7 +478,7 @@ class database { /// /// @param rp the new read_preference. /// - void read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(void) read_preference(mongocxx::v_noabi::read_preference rp); /// /// The current read preference for this database. @@ -480,7 +487,7 @@ class database { /// /// @return the current read_preference /// - mongocxx::v_noabi::read_preference read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_preference) read_preference() const; /// /// Sets the write_concern for this database. @@ -489,14 +496,14 @@ class database { /// from this database, but do affect new ones as new collections will receive a copy of the /// write_concern of this database upon instantiation. /// - void write_concern(mongocxx::v_noabi::write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(void) write_concern(mongocxx::v_noabi::write_concern wc); /// /// The current write_concern for this database. /// /// @return the current write_concern /// - mongocxx::v_noabi::write_concern write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::write_concern) write_concern() const; /// /// Access a collection (logical grouping of documents) within this database. @@ -505,7 +512,8 @@ class database { /// /// @return the collection. /// - mongocxx::v_noabi::collection collection(bsoncxx::v_noabi::string::view_or_value name) const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::collection) + collection(bsoncxx::v_noabi::string::view_or_value name) const; /// /// Allows the db["collection_name"] syntax to be used to access a collection within this @@ -515,8 +523,9 @@ class database { /// /// @return the collection. /// - MONGOCXX_INLINE mongocxx::v_noabi::collection operator[]( - bsoncxx::v_noabi::string::view_or_value name) const; + mongocxx::v_noabi::collection operator[](bsoncxx::v_noabi::string::view_or_value name) const { + return collection(name); + } /// /// Access a GridFS bucket within this database. @@ -532,8 +541,8 @@ class database { /// /// @throws mongocxx::v_noabi::logic_error if `options` are invalid. /// - gridfs::bucket gridfs_bucket( - const options::gridfs::bucket& options = options::gridfs::bucket()) const; + MONGOCXX_ABI_EXPORT_CDECL(gridfs::bucket) + gridfs_bucket(const options::gridfs::bucket& options = options::gridfs::bucket()) const; /// /// Gets a change stream on this database with an empty pipeline. @@ -547,7 +556,7 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) watch(const options::change_stream& options = {}); /// /// @param session @@ -560,7 +569,8 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const client_session& session, const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const client_session& session, const options::change_stream& options = {}); /// /// Gets a change stream on this database. @@ -578,7 +588,8 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const pipeline& pipe, const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const pipeline& pipe, const options::change_stream& options = {}); /// /// Gets a change stream on this database. @@ -595,64 +606,59 @@ class database { /// /// @see https://www.mongodb.com/docs/manual/changeStreams/ /// - change_stream watch(const client_session& session, - const pipeline& pipe, - const options::change_stream& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(change_stream) + watch(const client_session& session, + const pipeline& pipe, + const options::change_stream& options = {}); private: friend ::mongocxx::v_noabi::client_encryption; friend ::mongocxx::v_noabi::client; friend ::mongocxx::v_noabi::collection; - MONGOCXX_PRIVATE database(const mongocxx::v_noabi::client& client, - bsoncxx::v_noabi::string::view_or_value name); + database(const mongocxx::v_noabi::client& client, bsoncxx::v_noabi::string::view_or_value name); - MONGOCXX_PRIVATE cursor _aggregate(const client_session* session, - const pipeline& pipeline, - const options::aggregate& options); + cursor _aggregate(const client_session* session, + const pipeline& pipeline, + const options::aggregate& options); - MONGOCXX_PRIVATE bsoncxx::v_noabi::document::value _run_command( + bsoncxx::v_noabi::document::value _run_command( const client_session* session, bsoncxx::v_noabi::document::view_or_value command); - MONGOCXX_PRIVATE mongocxx::v_noabi::collection _create_collection( + mongocxx::v_noabi::collection _create_collection( const client_session* session, stdx::string_view name, bsoncxx::v_noabi::document::view_or_value collection_options, const stdx::optional& write_concern); - MONGOCXX_PRIVATE mongocxx::v_noabi::collection _create_collection_deprecated( + mongocxx::v_noabi::collection _create_collection_deprecated( const client_session* session, bsoncxx::v_noabi::string::view_or_value name, const options::create_collection_deprecated& collection_options, const stdx::optional& write_concern); - MONGOCXX_PRIVATE cursor _list_collections(const client_session* session, - bsoncxx::v_noabi::document::view_or_value filter); + cursor _list_collections(const client_session* session, + bsoncxx::v_noabi::document::view_or_value filter); - MONGOCXX_PRIVATE std::vector _list_collection_names( + std::vector _list_collection_names( const client_session* session, bsoncxx::v_noabi::document::view_or_value filter); - MONGOCXX_PRIVATE void _drop( + void _drop( const client_session* session, const bsoncxx::v_noabi::stdx::optional& write_concern); - MONGOCXX_PRIVATE change_stream _watch(const client_session* session, - const pipeline& pipe, - const options::change_stream& options); + change_stream _watch(const client_session* session, + const pipeline& pipe, + const options::change_stream& options); - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; -MONGOCXX_INLINE mongocxx::v_noabi::collection database::operator[]( - bsoncxx::v_noabi::string::view_or_value name) const { - return collection(name); -} - } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event-fwd.hpp index 856cf4f843..4e5c4f2443 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API command_failed_event; +class command_failed_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event.hpp index a20f946ea5..861dff490a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_failed_event.hpp @@ -36,12 +36,12 @@ namespace events { /// class command_failed_event { public: - MONGOCXX_PRIVATE explicit command_failed_event(const void* event); + explicit command_failed_event(const void* event); /// /// Destroys a command_failed_event. /// - ~command_failed_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~command_failed_event(); command_failed_event(command_failed_event&&) = default; command_failed_event& operator=(command_failed_event&&) = default; @@ -54,56 +54,57 @@ class command_failed_event { /// /// @return The failure. /// - bsoncxx::v_noabi::document::view failure() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) failure() const; /// /// Returns the name of the command. /// /// @return The command name. /// - bsoncxx::v_noabi::stdx::string_view command_name() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) command_name() const; /// /// Returns the duration of the failed operation. /// /// @return The duration in microseconds. /// - std::int64_t duration() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) duration() const; /// /// Returns the request id. /// /// @return The request id. /// - std::int64_t request_id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) request_id() const; /// /// Returns the operation id. /// /// @return The operation id. /// - std::int64_t operation_id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) operation_id() const; /// /// Optionally returns the service id. /// /// @return No contained value, or contains the service id if load balancing is enabled. /// - bsoncxx::v_noabi::stdx::optional service_id() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional) + service_id() const; /// /// Returns the host name. /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; private: const void* _failed_event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event-fwd.hpp index 2b58ea4b8d..213868f7cf 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API command_started_event; +class command_started_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event.hpp index 925ddc1d42..d4dd3031f1 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_started_event.hpp @@ -36,12 +36,12 @@ namespace events { /// class command_started_event { public: - MONGOCXX_PRIVATE explicit command_started_event(const void* event); + explicit command_started_event(const void* event); /// /// Destroys a command_started_event. /// - ~command_started_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~command_started_event(); command_started_event(command_started_event&&) = default; command_started_event& operator=(command_started_event&&) = default; @@ -54,56 +54,57 @@ class command_started_event { /// /// @return The command. /// - bsoncxx::v_noabi::document::view command() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) command() const; /// /// Returns the name of the database. /// /// @return The database name. /// - bsoncxx::v_noabi::stdx::string_view database_name() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) database_name() const; /// /// Returns the name of the command. /// /// @return The command name. /// - bsoncxx::v_noabi::stdx::string_view command_name() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) command_name() const; /// /// Returns the request id. /// /// @return The request id. /// - std::int64_t request_id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) request_id() const; /// /// Returns the operation id. /// /// @return The operation id. /// - std::int64_t operation_id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) operation_id() const; /// /// Optionally returns the service id. /// /// @return No contained value, or contains the service id if load balancing is enabled. /// - bsoncxx::v_noabi::stdx::optional service_id() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional) + service_id() const; /// /// Returns the host name. /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; private: const void* _started_event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event-fwd.hpp index 062322f123..7c87cd6c80 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API command_succeeded_event; +class command_succeeded_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event.hpp index 1f43fa6c14..b91c5fcbbb 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/command_succeeded_event.hpp @@ -36,11 +36,11 @@ namespace events { /// class command_succeeded_event { public: - MONGOCXX_PRIVATE explicit command_succeeded_event(const void* event); + explicit command_succeeded_event(const void* event); /// /// Destroys a command_succeeded_event. /// - ~command_succeeded_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~command_succeeded_event(); command_succeeded_event(command_succeeded_event&&) = default; command_succeeded_event& operator=(command_succeeded_event&&) = default; @@ -53,56 +53,57 @@ class command_succeeded_event { /// /// @return The reply. /// - bsoncxx::v_noabi::document::view reply() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) reply() const; /// /// Returns the name of the command. /// /// @return The command name. /// - bsoncxx::v_noabi::stdx::string_view command_name() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) command_name() const; /// /// Returns the duration of the successful operation. /// /// @return The duration in microseconds. /// - std::int64_t duration() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) duration() const; /// /// Returns the request id. /// /// @return The request id. /// - std::int64_t request_id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) request_id() const; /// /// Returns the operation id. /// /// @return The operation id. /// - std::int64_t operation_id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) operation_id() const; /// /// Optionally returns the service id. /// /// @return No contained value, or contains the service id if load balancing is enabled. /// - bsoncxx::v_noabi::stdx::optional service_id() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::optional) + service_id() const; /// /// Returns the host name. /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; private: const void* _succeeded_event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event-fwd.hpp index 01946068f8..97706abccb 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API heartbeat_failed_event; +class heartbeat_failed_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event.hpp index 244fda5435..e89690af7f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_failed_event.hpp @@ -36,12 +36,12 @@ namespace events { /// class heartbeat_failed_event { public: - MONGOCXX_PRIVATE explicit heartbeat_failed_event(const void* event); + explicit heartbeat_failed_event(const void* event); /// /// Destroys a heartbeat_failed_event. /// - ~heartbeat_failed_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~heartbeat_failed_event(); heartbeat_failed_event(heartbeat_failed_event&&) = default; heartbeat_failed_event& operator=(heartbeat_failed_event&&) = default; @@ -54,35 +54,35 @@ class heartbeat_failed_event { /// /// @return The message. /// - std::string message() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) message() const; /// /// Returns the duration of the failed operation. /// /// @return The duration in microseconds. /// - std::int64_t duration() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) duration() const; /// /// Returns the host name. /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; /// /// Returns a boolean indicating whether this heartbeat event is from an awaitable hello. /// /// @return A boolean. /// - bool awaited() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) awaited() const; private: const void* _failed_event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event-fwd.hpp index d8cda62898..7377e3bc09 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API heartbeat_started_event; +class heartbeat_started_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event.hpp index 349f727594..ba6ce46a72 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_started_event.hpp @@ -35,12 +35,12 @@ namespace events { /// class heartbeat_started_event { public: - MONGOCXX_PRIVATE explicit heartbeat_started_event(const void* event); + explicit heartbeat_started_event(const void* event); /// /// Destroys a heartbeat_started_event. /// - ~heartbeat_started_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~heartbeat_started_event(); heartbeat_started_event(heartbeat_started_event&&) = default; heartbeat_started_event& operator=(heartbeat_started_event&&) noexcept = default; @@ -53,21 +53,21 @@ class heartbeat_started_event { /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; /// /// Returns a boolean indicating whether this heartbeat event is from an awaitable hello. /// /// @return A boolean. /// - bool awaited() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) awaited() const; private: const void* _started_event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event-fwd.hpp index 3ac2b8cdfa..61df69e430 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API heartbeat_succeeded_event; +class heartbeat_succeeded_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event.hpp index ddc626ba21..198d92c472 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/heartbeat_succeeded_event.hpp @@ -34,12 +34,12 @@ namespace events { /// class heartbeat_succeeded_event { public: - MONGOCXX_PRIVATE explicit heartbeat_succeeded_event(const void* event); + explicit heartbeat_succeeded_event(const void* event); /// /// Destroys a heartbeat_succeeded_event. /// - ~heartbeat_succeeded_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~heartbeat_succeeded_event(); heartbeat_succeeded_event(heartbeat_succeeded_event&&) = default; heartbeat_succeeded_event& operator=(heartbeat_succeeded_event&&) = default; @@ -52,35 +52,35 @@ class heartbeat_succeeded_event { /// /// @return The reply. /// - bsoncxx::v_noabi::document::view reply() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) reply() const; /// /// Returns the duration of the successful operation. /// /// @return The duration in microseconds. /// - std::int64_t duration() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) duration() const; /// /// Returns the host name. /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; /// /// Returns a boolean indicating whether this heartbeat event is from an awaitable hello. /// /// @return A boolean. /// - bool awaited() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) awaited() const; private: const void* _succeeded_event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event-fwd.hpp index 0a5e371897..f5b65a51e9 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API server_changed_event; +class server_changed_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event.hpp index a42285c189..b474c45b3d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_changed_event.hpp @@ -35,12 +35,12 @@ namespace events { /// class server_changed_event { public: - MONGOCXX_PRIVATE explicit server_changed_event(const void* event); + explicit server_changed_event(const void* event); /// /// Destroys a server_changed_event. /// - ~server_changed_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~server_changed_event(); server_changed_event(server_changed_event&&) = default; server_changed_event& operator=(server_changed_event&&) = default; @@ -53,14 +53,14 @@ class server_changed_event { /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the server port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; /// /// An opaque id, unique to this topology for this mongocxx::v_noabi::client or @@ -68,21 +68,21 @@ class server_changed_event { /// /// @return The id. /// - const bsoncxx::v_noabi::oid topology_id() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::oid) topology_id() const; /// /// The server's description before it changed. /// /// @return The server_description. /// - const server_description previous_description() const; + MONGOCXX_ABI_EXPORT_CDECL(const server_description) previous_description() const; /// /// The server's description after it changed. /// /// @return The server_description. /// - const server_description new_description() const; + MONGOCXX_ABI_EXPORT_CDECL(const server_description) new_description() const; private: const void* _event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event-fwd.hpp index a95fcc60da..d9cb986cde 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API server_closed_event; +class server_closed_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event.hpp index fc70b9a821..94b8bc36df 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_closed_event.hpp @@ -36,12 +36,12 @@ namespace events { /// class server_closed_event { public: - MONGOCXX_PRIVATE explicit server_closed_event(const void* event); + explicit server_closed_event(const void* event); /// /// Destroys a server_closed_event. /// - ~server_closed_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~server_closed_event(); server_closed_event(server_closed_event&&) = default; server_closed_event& operator=(server_closed_event&&) = default; @@ -54,14 +54,14 @@ class server_closed_event { /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the server port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; /// /// An opaque id, unique to this topology for this mongocxx::v_noabi::client or @@ -69,7 +69,7 @@ class server_closed_event { /// /// @return The id. /// - const bsoncxx::v_noabi::oid topology_id() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::oid) topology_id() const; private: const void* _event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description-fwd.hpp index e036ca43d6..f082b8e9e2 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API server_description; +class server_description; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description.hpp index 54ba011f04..df079f000b 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_description.hpp @@ -30,12 +30,12 @@ namespace events { /// class server_description { public: - MONGOCXX_PRIVATE explicit server_description(const void* event); + explicit server_description(const void* event); /// /// Destroys a server_description. /// - ~server_description(); + MONGOCXX_ABI_EXPORT_CDECL() ~server_description(); server_description(server_description&&) = default; server_description& operator=(server_description&&) = default; @@ -49,14 +49,14 @@ class server_description { /// /// @return The id. /// - std::uint32_t id() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint32_t) id() const; /// /// The duration of the last hello call, indicating network latency. /// /// @return The duration in microseconds. /// - std::int64_t round_trip_time() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) round_trip_time() const; /// /// The server type: "Unknown", "Standalone", "Mongos", "PossiblePrimary", "RSPrimary", @@ -64,14 +64,15 @@ class server_description { /// /// @return The type as a short-lived string view. /// - bsoncxx::v_noabi::stdx::string_view type() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) type() const; /// /// @return The response as a short-lived document view. /// /// @deprecated use hello instead. /// - MONGOCXX_DEPRECATED bsoncxx::v_noabi::document::view is_master() const; + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) + is_master() const; /// /// The server's last response to the "hello" command, or an empty document if the driver @@ -79,21 +80,21 @@ class server_description { /// /// @return The response as a short-lived document view. /// - bsoncxx::v_noabi::document::view hello() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) hello() const; /// /// Returns the server host name. /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the server port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; private: const void* _sd; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event-fwd.hpp index 2b2875aea8..ec87074c0a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API server_opening_event; +class server_opening_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event.hpp index 090f70e20f..ffdb8710e6 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/server_opening_event.hpp @@ -35,12 +35,12 @@ namespace events { /// class server_opening_event { public: - MONGOCXX_PRIVATE explicit server_opening_event(const void* event); + explicit server_opening_event(const void* event); /// /// Destroys a server_opening_event. /// - ~server_opening_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~server_opening_event(); server_opening_event(server_opening_event&&) = default; server_opening_event& operator=(server_opening_event&&) = default; @@ -53,14 +53,14 @@ class server_opening_event { /// /// @return The host name. /// - bsoncxx::v_noabi::stdx::string_view host() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) host() const; /// /// Returns the server port. /// /// @return The port. /// - std::uint16_t port() const; + MONGOCXX_ABI_EXPORT_CDECL(std::uint16_t) port() const; /// /// An opaque id, unique to this topology for this mongocxx::v_noabi::client or @@ -68,7 +68,7 @@ class server_opening_event { /// /// @return The id. /// - const bsoncxx::v_noabi::oid topology_id() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::oid) topology_id() const; private: const void* _event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event-fwd.hpp index 21f0585c77..25e5817a7c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API topology_changed_event; +class topology_changed_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event.hpp index 7dc331d137..ccb12a36fb 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_changed_event.hpp @@ -34,12 +34,12 @@ namespace events { /// class topology_changed_event { public: - MONGOCXX_PRIVATE explicit topology_changed_event(const void* event); + explicit topology_changed_event(const void* event); /// /// Destroys a topology_changed_event. /// - ~topology_changed_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~topology_changed_event(); topology_changed_event(topology_changed_event&&) = default; topology_changed_event& operator=(topology_changed_event&&) = default; @@ -53,21 +53,21 @@ class topology_changed_event { /// /// @return The id. /// - bsoncxx::v_noabi::oid topology_id() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::oid) topology_id() const; /// /// The server's description before it changed. /// /// @return The topology_description. /// - topology_description previous_description() const; + MONGOCXX_ABI_EXPORT_CDECL(topology_description) previous_description() const; /// /// The server's description after it changed. /// /// @return The topology_description. /// - topology_description new_description() const; + MONGOCXX_ABI_EXPORT_CDECL(topology_description) new_description() const; private: const void* _event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event-fwd.hpp index 3cd9e18653..7512269e71 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API topology_closed_event; +class topology_closed_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event.hpp index 5565b07239..3967ef57af 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_closed_event.hpp @@ -33,12 +33,12 @@ namespace events { /// class topology_closed_event { public: - MONGOCXX_PRIVATE explicit topology_closed_event(const void* event); + explicit topology_closed_event(const void* event); /// /// Destroys a topology_closed_event. /// - ~topology_closed_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~topology_closed_event(); topology_closed_event(topology_closed_event&&) = default; topology_closed_event& operator=(topology_closed_event&&) = default; @@ -52,7 +52,7 @@ class topology_closed_event { /// /// @return The id. /// - bsoncxx::v_noabi::oid topology_id() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::oid) topology_id() const; private: const void* _event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description-fwd.hpp index 17e58e199e..33f13823a4 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API topology_description; +class topology_description; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description.hpp index 1421bd5f7b..65ab20f1ff 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description.hpp @@ -39,7 +39,7 @@ class topology_description { /// /// An array of server_description instances. /// - class MONGOCXX_API server_descriptions { + class server_descriptions { private: using container = std::vector; @@ -47,12 +47,12 @@ class topology_description { /// /// Move constructs a server_descriptions array. /// - server_descriptions(server_descriptions&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() server_descriptions(server_descriptions&&) noexcept; /// /// Move assigns a server_descriptions array. /// - server_descriptions& operator=(server_descriptions&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(server_descriptions&) operator=(server_descriptions&&) noexcept; server_descriptions(const server_descriptions&) = delete; server_descriptions& operator=(const server_descriptions&) = delete; @@ -60,7 +60,7 @@ class topology_description { /// /// Destroys a server_descriptions array. /// - ~server_descriptions(); + MONGOCXX_ABI_EXPORT_CDECL() ~server_descriptions(); /// /// The array's iterator type. @@ -76,8 +76,8 @@ class topology_description { /// Returns an iterator to the beginning. /// /// @{ - iterator begin() noexcept; - const_iterator begin() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(iterator) begin() noexcept; + MONGOCXX_ABI_EXPORT_CDECL(const_iterator) begin() const noexcept; /// @} /// @@ -85,33 +85,33 @@ class topology_description { /// Returns an iterator to the end. /// /// @{ - iterator end() noexcept; - const_iterator end() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(iterator) end() noexcept; + MONGOCXX_ABI_EXPORT_CDECL(const_iterator) end() const noexcept; /// @} /// /// /// The number of server_description instances in the array. /// - std::size_t size() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(std::size_t) size() const noexcept; private: friend ::mongocxx::v_noabi::events::topology_description; - MONGOCXX_PRIVATE explicit server_descriptions(void* sds, std::size_t size); - MONGOCXX_PRIVATE void swap(server_descriptions& other) noexcept; + explicit server_descriptions(void* sds, std::size_t size); + void swap(server_descriptions& other) noexcept; container _container; void* _sds; std::size_t _size; }; - MONGOCXX_PRIVATE explicit topology_description(void* event); + explicit topology_description(void* event); /// /// Destroys a topology_description. /// - ~topology_description(); + MONGOCXX_ABI_EXPORT_CDECL() ~topology_description(); topology_description(topology_description&&) = default; topology_description& operator=(topology_description&&) = default; @@ -125,7 +125,7 @@ class topology_description { /// /// @return The type as a short-lived string view. /// - bsoncxx::v_noabi::stdx::string_view type() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::stdx::string_view) type() const; /// /// Determines if the topology has a readable server available. Servers are @@ -136,7 +136,8 @@ class topology_description { /// /// @return Whether there is a readable server available. /// - bool has_readable_server(const mongocxx::v_noabi::read_preference& pref) const; + MONGOCXX_ABI_EXPORT_CDECL(bool) + has_readable_server(const mongocxx::v_noabi::read_preference& pref) const; /// /// Determines if the topology has a writable server available, such as a @@ -146,14 +147,14 @@ class topology_description { /// /// @return Whether there is a writable server available. /// - bool has_writable_server() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) has_writable_server() const; /// /// Fetches descriptions for all known servers in the topology. /// /// @return An array of server_description objects. /// - server_descriptions servers() const; + MONGOCXX_ABI_EXPORT_CDECL(server_descriptions) servers() const; private: // Non-const since mongoc_topology_description_has_readable_server/writable_server take diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event-fwd.hpp index 31d3fa0a50..a94888755f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace events { -class MONGOCXX_API topology_opening_event; +class topology_opening_event; } // namespace events } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event.hpp index 334e73bd5c..57b4604ca3 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_opening_event.hpp @@ -33,12 +33,12 @@ namespace events { /// class topology_opening_event { public: - MONGOCXX_PRIVATE explicit topology_opening_event(const void* event); + explicit topology_opening_event(const void* event); /// /// Destroys a topology_opening_event. /// - ~topology_opening_event(); + MONGOCXX_ABI_EXPORT_CDECL() ~topology_opening_event(); topology_opening_event(topology_opening_event&&) = default; topology_opening_event& operator=(topology_opening_event&&) = default; @@ -52,7 +52,7 @@ class topology_opening_event { /// /// @return The id. /// - bsoncxx::v_noabi::oid topology_id() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::oid) topology_id() const; private: const void* _event; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception-fwd.hpp index 3710e236e7..629b4c1425 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API authentication_exception; +class MONGOCXX_ABI_EXPORT authentication_exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception-fwd.hpp index d8e3b3ef87..45e565d780 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API bulk_write_exception; +class MONGOCXX_ABI_EXPORT bulk_write_exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/error_code.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/error_code.hpp index f319162a26..4691fc177a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/error_code.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/error_code.hpp @@ -116,7 +116,7 @@ enum class error_code : std::int32_t { /// /// @return The mongocxx error_category /// -MONGOCXX_API const std::error_category& MONGOCXX_CALL error_category(); +MONGOCXX_ABI_EXPORT_CDECL(const std::error_category&) error_category(); /// /// Translate a mongocxx::v_noabi::error_code into a std::error_code. @@ -125,7 +125,7 @@ MONGOCXX_API const std::error_category& MONGOCXX_CALL error_category(); /// /// @return A std::error_code /// -MONGOCXX_INLINE std::error_code make_error_code(error_code error) { +inline std::error_code make_error_code(error_code error) { return {static_cast(error), error_category()}; } diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception-fwd.hpp index f06b0f769b..82bf4f00dc 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API exception; +class MONGOCXX_ABI_EXPORT exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception-fwd.hpp index 920767b316..4affe834be 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API gridfs_exception; +class MONGOCXX_ABI_EXPORT gridfs_exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error-fwd.hpp index db060297c0..42a6eb4391 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API logic_error; +class MONGOCXX_ABI_EXPORT logic_error; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception-fwd.hpp index 2b79238031..c39cdd6bd3 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API operation_exception; +class MONGOCXX_ABI_EXPORT operation_exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception-fwd.hpp index a46b4b5114..9b3518de07 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API query_exception; +class MONGOCXX_ABI_EXPORT query_exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/server_error_code.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/server_error_code.hpp index 21850e7ba4..c417aa8763 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/server_error_code.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/server_error_code.hpp @@ -37,7 +37,7 @@ enum class server_error_code : std::int32_t { /// /// @return The mongocxx error_category /// -MONGOCXX_API const std::error_category& MONGOCXX_CALL server_error_category(); +MONGOCXX_ABI_EXPORT_CDECL(const std::error_category&) server_error_category(); /// /// Translate a mongocxx::v_noabi::server_error_code into a std::error_code. @@ -46,7 +46,7 @@ MONGOCXX_API const std::error_category& MONGOCXX_CALL server_error_category(); /// /// @return A std::error_code /// -MONGOCXX_INLINE std::error_code make_error_code(server_error_code error) { +inline std::error_code make_error_code(server_error_code error) { return {static_cast(error), server_error_category()}; } diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception-fwd.hpp index c7351bbb55..9436949aa8 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API write_exception; +class MONGOCXX_ABI_EXPORT write_exception; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket-fwd.hpp index efcb07ac9d..ae81af0110 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace gridfs { -class MONGOCXX_API bucket; +class bucket; } // namespace gridfs } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket.hpp index 28cdeaeb36..c62505dae5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/bucket.hpp @@ -67,37 +67,37 @@ class bucket { /// bucket. The only valid actions to take with a default constructed bucket are to assign to /// it, or destroy it. /// - bucket() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() bucket() noexcept; /// /// Move constructs a bucket. /// - bucket(bucket&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() bucket(bucket&&) noexcept; /// /// Move assigns a bucket. /// - bucket& operator=(bucket&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bucket&) operator=(bucket&&) noexcept; /// /// Copy constructs a bucket. /// - bucket(const bucket&); + MONGOCXX_ABI_EXPORT_CDECL() bucket(const bucket&); /// /// Copy assigns a bucket. /// - bucket& operator=(const bucket&); + MONGOCXX_ABI_EXPORT_CDECL(bucket&) operator=(const bucket&); /// /// Destroys a bucket. /// - ~bucket(); + MONGOCXX_ABI_EXPORT_CDECL() ~bucket(); /// /// Returns true if the bucket is valid, meaning it was not default constructed or moved from. /// - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; /// /// Opens a gridfs::uploader to create a new GridFS file. The id of the file will be @@ -125,8 +125,8 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - uploader open_upload_stream(stdx::string_view filename, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(uploader) + open_upload_stream(stdx::string_view filename, const options::gridfs::upload& options = {}); /// /// Opens a gridfs::uploader to create a new GridFS file. The id of the file will be @@ -158,9 +158,10 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - uploader open_upload_stream(const client_session& session, - stdx::string_view filename, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(uploader) + open_upload_stream(const client_session& session, + stdx::string_view filename, + const options::gridfs::upload& options = {}); /// /// Opens a gridfs::uploader to create a new GridFS file. @@ -190,9 +191,10 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - uploader open_upload_stream_with_id(bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(uploader) + open_upload_stream_with_id(bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + const options::gridfs::upload& options = {}); /// /// Opens a gridfs::uploader to create a new GridFS file. @@ -226,10 +228,11 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - uploader open_upload_stream_with_id(const client_session& session, - bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(uploader) + open_upload_stream_with_id(const client_session& session, + bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + const options::gridfs::upload& options = {}); /// /// Creates a new GridFS file by uploading bytes from an input stream. The id of the file will @@ -272,9 +275,10 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - result::gridfs::upload upload_from_stream(stdx::string_view filename, - std::istream* source, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(result::gridfs::upload) + upload_from_stream(stdx::string_view filename, + std::istream* source, + const options::gridfs::upload& options = {}); /// /// Creates a new GridFS file by uploading bytes from an input stream. The id of the file will @@ -320,10 +324,11 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - result::gridfs::upload upload_from_stream(const client_session& session, - stdx::string_view filename, - std::istream* source, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(result::gridfs::upload) + upload_from_stream(const client_session& session, + stdx::string_view filename, + std::istream* source, + const options::gridfs::upload& options = {}); /// /// Creates a new GridFS file with a user-supplied unique id by uploading bytes from an input @@ -366,10 +371,11 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - void upload_from_stream_with_id(bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - std::istream* source, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + upload_from_stream_with_id(bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + std::istream* source, + const options::gridfs::upload& options = {}); /// /// Creates a new GridFS file with a user-supplied unique id by uploading bytes from an input @@ -415,11 +421,12 @@ class bucket { /// @throws mongocxx::v_noabi::operation_exception if an error occurs when building GridFS /// indexes. /// - void upload_from_stream_with_id(const client_session& session, - bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - std::istream* source, - const options::gridfs::upload& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(void) + upload_from_stream_with_id(const client_session& session, + bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + std::istream* source, + const options::gridfs::upload& options = {}); /// /// Opens a gridfs::downloader to read a GridFS file. @@ -436,7 +443,8 @@ class bucket { /// @throws mongocxx::v_noabi::query_exception /// if an error occurs when reading from the files collection for this bucket. /// - downloader open_download_stream(bsoncxx::v_noabi::types::bson_value::view id); + MONGOCXX_ABI_EXPORT_CDECL(downloader) + open_download_stream(bsoncxx::v_noabi::types::bson_value::view id); /// /// Opens a gridfs::downloader to read a GridFS file. @@ -457,8 +465,9 @@ class bucket { /// @throws mongocxx::v_noabi::query_exception /// if an error occurs when reading from the files collection for this bucket. /// - downloader open_download_stream(const client_session& session, - bsoncxx::v_noabi::types::bson_value::view id); + MONGOCXX_ABI_EXPORT_CDECL(downloader) + open_download_stream(const client_session& session, + bsoncxx::v_noabi::types::bson_value::view id); /// /// Downloads the contents of a stored GridFS file from the bucket and writes it to a stream. @@ -480,8 +489,8 @@ class bucket { /// `badbit`, any exception thrown during execution of `destination::write()` will be /// re-thrown. /// - void download_to_stream(bsoncxx::v_noabi::types::bson_value::view id, - std::ostream* destination); + MONGOCXX_ABI_EXPORT_CDECL(void) + download_to_stream(bsoncxx::v_noabi::types::bson_value::view id, std::ostream* destination); /// /// @copydoc download_to_stream(bsoncxx::v_noabi::types::bson_value::view id, std::ostream* destination) @@ -489,10 +498,11 @@ class bucket { /// @param start The byte offset to the beginning of content to download. /// @param end The byte offset to the end of content to download. /// - void download_to_stream(bsoncxx::v_noabi::types::bson_value::view id, - std::ostream* destination, - std::size_t start, - std::size_t end); + MONGOCXX_ABI_EXPORT_CDECL(void) + download_to_stream(bsoncxx::v_noabi::types::bson_value::view id, + std::ostream* destination, + std::size_t start, + std::size_t end); /// /// Downloads the contents of a stored GridFS file from the bucket and writes it to a stream. @@ -517,9 +527,10 @@ class bucket { /// `badbit`, any exception thrown during execution of `destination::write()` will be /// re-thrown. /// - void download_to_stream(const client_session& session, - bsoncxx::v_noabi::types::bson_value::view id, - std::ostream* destination); + MONGOCXX_ABI_EXPORT_CDECL(void) + download_to_stream(const client_session& session, + bsoncxx::v_noabi::types::bson_value::view id, + std::ostream* destination); /// /// @copydoc download_to_stream(const client_session& session, bsoncxx::v_noabi::types::bson_value::view id, std::ostream* destination) @@ -527,11 +538,12 @@ class bucket { /// @param start The byte offset to the beginning of content to download. /// @param end The byte offset to the end of content to download. /// - void download_to_stream(const client_session& session, - bsoncxx::v_noabi::types::bson_value::view id, - std::ostream* destination, - std::size_t start, - std::size_t end); + MONGOCXX_ABI_EXPORT_CDECL(void) + download_to_stream(const client_session& session, + bsoncxx::v_noabi::types::bson_value::view id, + std::ostream* destination, + std::size_t start, + std::size_t end); /// /// Deletes a GridFS file from the bucket. @@ -544,7 +556,7 @@ class bucket { /// @throws mongocxx::v_noabi::bulk_write_exception /// if an error occurs when removing file data or chunk data from the database. /// - void delete_file(bsoncxx::v_noabi::types::bson_value::view id); + MONGOCXX_ABI_EXPORT_CDECL(void) delete_file(bsoncxx::v_noabi::types::bson_value::view id); /// /// Deletes a GridFS file from the bucket. @@ -560,7 +572,8 @@ class bucket { /// @throws mongocxx::v_noabi::bulk_write_exception /// if an error occurs when removing file data or chunk data from the database. /// - void delete_file(const client_session& session, bsoncxx::v_noabi::types::bson_value::view id); + MONGOCXX_ABI_EXPORT_CDECL(void) + delete_file(const client_session& session, bsoncxx::v_noabi::types::bson_value::view id); /// /// Finds the documents in the files collection of the bucket which match the provided filter. @@ -580,8 +593,8 @@ class bucket { /// /// @see mongocxx::v_noabi::collection::find. /// - cursor find(bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + find(bsoncxx::v_noabi::document::view_or_value filter, const options::find& options = {}); /// /// Finds the documents in the files collection of the bucket which match the provided filter. @@ -605,9 +618,10 @@ class bucket { /// /// @see mongocxx::v_noabi::collection::find. /// - cursor find(const client_session& session, - bsoncxx::v_noabi::document::view_or_value filter, - const options::find& options = {}); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + find(const client_session& session, + bsoncxx::v_noabi::document::view_or_value filter, + const options::find& options = {}); /// /// Gets the name of the GridFS bucket. @@ -615,46 +629,44 @@ class bucket { /// @return /// The name of the GridFS bucket. /// - stdx::string_view bucket_name() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::string_view) bucket_name() const; private: friend ::mongocxx::v_noabi::database; // Constructs a new GridFS bucket. Throws if options are invalid. - MONGOCXX_PRIVATE bucket(const database& db, const options::gridfs::bucket& options); + bucket(const database& db, const options::gridfs::bucket& options); - MONGOCXX_PRIVATE void create_indexes_if_nonexistent(const client_session* session); + void create_indexes_if_nonexistent(const client_session* session); - MONGOCXX_PRIVATE uploader - _open_upload_stream_with_id(const client_session* session, - bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - const options::gridfs::upload& options); + uploader _open_upload_stream_with_id(const client_session* session, + bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + const options::gridfs::upload& options); - MONGOCXX_PRIVATE void _upload_from_stream_with_id(const client_session* session, - bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - std::istream* source, - const options::gridfs::upload& options); + void _upload_from_stream_with_id(const client_session* session, + bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + std::istream* source, + const options::gridfs::upload& options); - MONGOCXX_PRIVATE downloader _open_download_stream(const client_session* session, - bsoncxx::v_noabi::types::bson_value::view id, - stdx::optional start, - stdx::optional end); + downloader _open_download_stream(const client_session* session, + bsoncxx::v_noabi::types::bson_value::view id, + stdx::optional start, + stdx::optional end); - MONGOCXX_PRIVATE void _download_to_stream(const client_session* session, - bsoncxx::v_noabi::types::bson_value::view id, - std::ostream* destination, - stdx::optional start, - stdx::optional end); + void _download_to_stream(const client_session* session, + bsoncxx::v_noabi::types::bson_value::view id, + std::ostream* destination, + stdx::optional start, + stdx::optional end); - MONGOCXX_PRIVATE void _delete_file(const client_session* session, - bsoncxx::v_noabi::types::bson_value::view id); + void _delete_file(const client_session* session, bsoncxx::v_noabi::types::bson_value::view id); - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader-fwd.hpp index cb6618a62e..48b3c34644 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader-fwd.hpp @@ -22,7 +22,7 @@ namespace gridfs { struct chunks_and_bytes_offset; -class MONGOCXX_API downloader; +class downloader; } // namespace gridfs } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader.hpp index f7e9f1b24b..99429126e9 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/downloader.hpp @@ -52,17 +52,17 @@ class downloader { /// from downloader. The only valid actions to take with a default constructed downloader are to /// assign to it, or destroy it. /// - downloader() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() downloader() noexcept; /// /// Move constructs a downloader. /// - downloader(downloader&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() downloader(downloader&&) noexcept; /// /// Move assigns a downloader. /// - downloader& operator=(downloader&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(downloader&) operator=(downloader&&) noexcept; downloader(const downloader&) = delete; @@ -71,13 +71,13 @@ class downloader { /// /// Destroys a downloader. /// - ~downloader(); + MONGOCXX_ABI_EXPORT_CDECL() ~downloader(); /// /// Returns true if the downloader is valid, meaning it was not default constructed or moved /// from. /// - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; /// /// Reads a specified number of bytes from the GridFS file being downloaded. @@ -99,14 +99,14 @@ class downloader { /// @throws mongocxx::v_noabi::query_exception /// if an error occurs when reading chunk data from the database for the requested file. /// - std::size_t read(std::uint8_t* buffer, std::size_t length); + MONGOCXX_ABI_EXPORT_CDECL(std::size_t) read(std::uint8_t* buffer, std::size_t length); /// /// Closes the downloader stream. /// /// @throws mongocxx::v_noabi::logic_error if the download stream was already closed. /// - void close(); + MONGOCXX_ABI_EXPORT_CDECL(void) close(); /// /// Gets the chunk size of the file being downloaded. @@ -114,7 +114,7 @@ class downloader { /// @return /// The chunk size in bytes. /// - std::int32_t chunk_size() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) chunk_size() const; /// /// Gets the length of the file being downloaded. @@ -122,7 +122,7 @@ class downloader { /// @return /// The length in bytes. /// - std::int64_t file_length() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int64_t) file_length() const; /// /// Gets the files collection document of the file being downloaded. @@ -130,7 +130,7 @@ class downloader { /// @return /// A view to the files collection document of the file being downloaded. /// - bsoncxx::v_noabi::document::view files_document() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) files_document() const; private: friend ::mongocxx::v_noabi::gridfs::bucket; @@ -154,18 +154,18 @@ class downloader { // @param files_doc // The files collection document of the file being downloaded. // - MONGOCXX_PRIVATE downloader(stdx::optional chunks, - chunks_and_bytes_offset start, - std::int32_t chunk_size, - std::int64_t file_len, - bsoncxx::v_noabi::document::value files_doc); + downloader(stdx::optional chunks, + chunks_and_bytes_offset start, + std::int32_t chunk_size, + std::int64_t file_len, + bsoncxx::v_noabi::document::value files_doc); - MONGOCXX_PRIVATE void fetch_chunk(); + void fetch_chunk(); - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader-fwd.hpp index a91ec73e3f..99295bc008 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace gridfs { -class MONGOCXX_API uploader; +class uploader; } // namespace gridfs } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader.hpp index fa6170bd66..7b8aee9e26 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/gridfs/uploader.hpp @@ -47,17 +47,17 @@ class uploader { /// from uploader. The only valid actions to take with a default constructed uploader are to /// assign to it, or destroy it. /// - uploader() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() uploader() noexcept; /// /// Move constructs an uploader. /// - uploader(uploader&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() uploader(uploader&&) noexcept; /// /// Move assigns an uploader. /// - uploader& operator=(uploader&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(uploader&) operator=(uploader&&) noexcept; uploader(const uploader&) = delete; @@ -66,12 +66,12 @@ class uploader { /// /// Destroys an uploader. /// - ~uploader(); + MONGOCXX_ABI_EXPORT_CDECL() ~uploader(); /// /// Returns true if the uploader is valid, meaning it was not default constructed or moved from. /// - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; /// /// Writes a specified number of bytes to a GridFS file. @@ -91,7 +91,7 @@ class uploader { /// if the uploader requires more than 2^31-1 chunks to store the file at the requested chunk /// size. /// - void write(const std::uint8_t* bytes, std::size_t length); + MONGOCXX_ABI_EXPORT_CDECL(void) write(const std::uint8_t* bytes, std::size_t length); /// /// Closes the uploader stream. @@ -105,7 +105,7 @@ class uploader { /// if the uploader requires more than 2^31-1 chunks to store the file at the requested chunk /// size. /// - result::gridfs::upload close(); + MONGOCXX_ABI_EXPORT_CDECL(result::gridfs::upload) close(); /// /// Aborts uploading the file. @@ -115,7 +115,7 @@ class uploader { /// @throws mongocxx::v_noabi::bulk_write_exception /// if an error occurs when removing chunk data from the database. /// - void abort(); + MONGOCXX_ABI_EXPORT_CDECL(void) abort(); /// /// Gets the chunk size of the file being uploaded. @@ -123,7 +123,7 @@ class uploader { /// @return /// The chunk size in bytes. /// - std::int32_t chunk_size() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) chunk_size() const; private: friend ::mongocxx::v_noabi::gridfs::bucket; @@ -149,22 +149,21 @@ class uploader { // @param metadata // Optional metadata field of the files collection document. // - MONGOCXX_PRIVATE uploader( - const client_session* session, - bsoncxx::v_noabi::types::bson_value::view id, - stdx::string_view filename, - collection files, - collection chunks, - std::int32_t chunk_size, - stdx::optional metadata = {}); - - MONGOCXX_PRIVATE void finish_chunk(); - MONGOCXX_PRIVATE void flush_chunks(); - - class MONGOCXX_PRIVATE impl; - - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + uploader(const client_session* session, + bsoncxx::v_noabi::types::bson_value::view id, + stdx::string_view filename, + collection files, + collection chunks, + std::int32_t chunk_size, + stdx::optional metadata = {}); + + void finish_chunk(); + void flush_chunks(); + + class impl; + + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint-fwd.hpp index 69c8c2c4f6..95e1b78ccb 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API hint; +class hint; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint.hpp index 85eec710a7..e66e0a9bf7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/hint.hpp @@ -44,7 +44,7 @@ class hint { /// @param index /// Document view or value representing the index to be used. /// - hint(bsoncxx::v_noabi::document::view_or_value index); + MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v_noabi::document::view_or_value index); /// /// Constructs a new hint. @@ -52,7 +52,7 @@ class hint { /// @param index /// String representing the name of the index to be used. /// - explicit hint(bsoncxx::v_noabi::string::view_or_value index); + explicit MONGOCXX_ABI_EXPORT_CDECL() hint(bsoncxx::v_noabi::string::view_or_value index); /// /// @relates mongocxx::v_noabi::hint @@ -61,7 +61,7 @@ class hint { /// /// Compares equal if the hint contains a matching index name. Otherwise, compares unequal. /// - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const hint& index_hint, std::string index); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const hint& index_hint, std::string index); /// /// @relates mongocxx::v_noabi::hint @@ -70,7 +70,7 @@ class hint { /// /// Compares equal if the hint contains a matching index document. Otherwise, compares unequal. /// - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const hint& index_hint, + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const hint& index_hint, bsoncxx::v_noabi::document::view index); /// @@ -80,7 +80,7 @@ class hint { /// not outlive /// the hint object that it was created from. /// - bsoncxx::v_noabi::types::bson_value::view to_value() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::types::bson_value::view) to_value() const; /// /// Returns a types::bson_value::view representing this hint. @@ -89,7 +89,9 @@ class hint { /// not outlive /// the hint object that it was created from. /// - MONGOCXX_INLINE operator bsoncxx::v_noabi::types::bson_value::view() const; + operator bsoncxx::v_noabi::types::bson_value::view() const { + return to_value(); + } private: stdx::optional _index_doc; @@ -104,13 +106,13 @@ class hint { /// @{ /// @relatesalso mongocxx::v_noabi::hint -MONGOCXX_API bool MONGOCXX_CALL operator==(std::string index, const hint& index_hint); +MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(std::string index, const hint& index_hint); /// @relatesalso mongocxx::v_noabi::hint -MONGOCXX_API bool MONGOCXX_CALL operator!=(const hint& index_hint, std::string index); +MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const hint& index_hint, std::string index); /// @relatesalso mongocxx::v_noabi::hint -MONGOCXX_API bool MONGOCXX_CALL operator!=(std::string index, const hint& index_index); +MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(std::string index, const hint& index_index); /// @} /// @@ -123,22 +125,18 @@ MONGOCXX_API bool MONGOCXX_CALL operator!=(std::string index, const hint& index_ /// @{ /// @relatesalso mongocxx::v_noabi::hint -MONGOCXX_API bool MONGOCXX_CALL operator==(bsoncxx::v_noabi::document::view index, - const hint& index_hint); +MONGOCXX_ABI_EXPORT_CDECL(bool) +operator==(bsoncxx::v_noabi::document::view index, const hint& index_hint); /// @relatesalso mongocxx::v_noabi::hint -MONGOCXX_API bool MONGOCXX_CALL operator!=(const hint& index_hint, - bsoncxx::v_noabi::document::view index); +MONGOCXX_ABI_EXPORT_CDECL(bool) +operator!=(const hint& index_hint, bsoncxx::v_noabi::document::view index); /// @relatesalso mongocxx::v_noabi::hint -MONGOCXX_API bool MONGOCXX_CALL operator!=(bsoncxx::v_noabi::document::view index, - const hint& index_hint); +MONGOCXX_ABI_EXPORT_CDECL(bool) +operator!=(bsoncxx::v_noabi::document::view index, const hint& index_hint); /// @} /// -MONGOCXX_INLINE hint::operator bsoncxx::v_noabi::types::bson_value::view() const { - return to_value(); -} - } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model-fwd.hpp index 6e31b20458..12bafe4d89 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API index_model; +class index_model; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model.hpp index 4bcf427a76..2118616356 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_model.hpp @@ -33,6 +33,7 @@ class index_model { /// /// Initializes a new index_model over a mongocxx::v_noabi::collection. /// + MONGOCXX_ABI_EXPORT_CDECL() index_model(const bsoncxx::v_noabi::document::view_or_value& keys, const bsoncxx::v_noabi::document::view_or_value& options = {}); @@ -41,17 +42,17 @@ class index_model { /// /// Move constructs an index_model. /// - index_model(index_model&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() index_model(index_model&&) noexcept; /// /// Move assigns an index_model. /// - index_model& operator=(index_model&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(index_model&) operator=(index_model&&) noexcept; /// /// Copy constructs an index_model. /// - index_model(const index_model&); + MONGOCXX_ABI_EXPORT_CDECL() index_model(const index_model&); /// /// Copy assigns an index_model. @@ -61,17 +62,17 @@ class index_model { /// /// Destroys an index_model. /// - ~index_model(); + MONGOCXX_ABI_EXPORT_CDECL() ~index_model(); /// /// Retrieves keys of an index_model. /// - bsoncxx::v_noabi::document::view keys() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) keys() const; /// /// Retrieves options of an index_model. /// - bsoncxx::v_noabi::document::view options() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) options() const; private: bsoncxx::v_noabi::document::value _keys; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view-fwd.hpp index d817eda101..c8393783a0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API index_view; +class index_view; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view.hpp index 4ac2201ba7..394561e906 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/index_view.hpp @@ -37,18 +37,18 @@ namespace v_noabi { /// class index_view { public: - index_view(index_view&&) noexcept; - index_view& operator=(index_view&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() index_view(index_view&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(index_view&) operator=(index_view&&) noexcept; - ~index_view(); + MONGOCXX_ABI_EXPORT_CDECL() ~index_view(); index_view(const index_view&) = delete; - index_view& operator=(const index_view&) = delete; + MONGOCXX_ABI_EXPORT_CDECL(index_view&) operator=(const index_view&) = delete; /// /// Returns a cursor over all the indexes. /// - cursor list(); + MONGOCXX_ABI_EXPORT_CDECL(cursor) list(); /// /// Returns a cursor over all the indexes. @@ -56,7 +56,7 @@ class index_view { /// @param session /// The mongocxx::v_noabi::client_session with which to perform the list operation. /// - cursor list(const client_session& session); + MONGOCXX_ABI_EXPORT_CDECL(cursor) list(const client_session& session); /// /// Creates an index. A convenience method that calls create_many. @@ -79,10 +79,10 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/ /// - stdx::optional create_one( - const bsoncxx::v_noabi::document::view_or_value& keys, - const bsoncxx::v_noabi::document::view_or_value& index_options = {}, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + create_one(const bsoncxx::v_noabi::document::view_or_value& keys, + const bsoncxx::v_noabi::document::view_or_value& index_options = {}, + const options::index_view& options = options::index_view{}); /// /// Creates an index. A convenience method that calls create_many. @@ -107,11 +107,11 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/db.collection.createIndex/ /// - stdx::optional create_one( - const client_session& session, - const bsoncxx::v_noabi::document::view_or_value& keys, - const bsoncxx::v_noabi::document::view_or_value& index_options = {}, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + create_one(const client_session& session, + const bsoncxx::v_noabi::document::view_or_value& keys, + const bsoncxx::v_noabi::document::view_or_value& index_options = {}, + const options::index_view& options = options::index_view{}); /// /// Creates an index. A convenience method that calls create_many. @@ -131,8 +131,9 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - stdx::optional create_one( - const index_model& index, const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + create_one(const index_model& index, + const options::index_view& options = options::index_view{}); /// /// Creates an index. A convenience method that calls create_many. @@ -154,10 +155,10 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - stdx::optional create_one( - const client_session& session, - const index_model& index, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + create_one(const client_session& session, + const index_model& index, + const options::index_view& options = options::index_view{}); /// /// Adds a container of indexes to the collection. @@ -177,9 +178,9 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - bsoncxx::v_noabi::document::value create_many( - const std::vector& indexes, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + create_many(const std::vector& indexes, + const options::index_view& options = options::index_view{}); /// /// Adds a container of indexes to the collection. @@ -201,10 +202,10 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - bsoncxx::v_noabi::document::value create_many( - const client_session& session, - const std::vector& indexes, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + create_many(const client_session& session, + const std::vector& indexes, + const options::index_view& options = options::index_view{}); /// /// Drops a single index by name. @@ -222,8 +223,8 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_one(stdx::string_view name, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(stdx::string_view name, const options::index_view& options = options::index_view{}); /// /// Drops a single index by name. @@ -243,9 +244,10 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_one(const client_session& session, - stdx::string_view name, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(const client_session& session, + stdx::string_view name, + const options::index_view& options = options::index_view{}); /// /// Attempts to drop a single index from the collection given the keys and options. @@ -270,9 +272,10 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_one(const bsoncxx::v_noabi::document::view_or_value& keys, - const bsoncxx::v_noabi::document::view_or_value& index_options = {}, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(const bsoncxx::v_noabi::document::view_or_value& keys, + const bsoncxx::v_noabi::document::view_or_value& index_options = {}, + const options::index_view& options = options::index_view{}); /// /// Attempts to drop a single index from the collection given the keys and options. @@ -299,10 +302,11 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_one(const client_session& session, - const bsoncxx::v_noabi::document::view_or_value& keys, - const bsoncxx::v_noabi::document::view_or_value& index_options = {}, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(const client_session& session, + const bsoncxx::v_noabi::document::view_or_value& keys, + const bsoncxx::v_noabi::document::view_or_value& index_options = {}, + const options::index_view& options = options::index_view{}); /// /// Attempts to drop a single index from the collection given an index model. @@ -323,8 +327,8 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_one(const index_model& index, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(const index_model& index, const options::index_view& options = options::index_view{}); /// /// Attempts to drop a single index from the collection given an index model. @@ -347,9 +351,10 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_one(const client_session& session, - const index_model& index, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(const client_session& session, + const index_model& index, + const options::index_view& options = options::index_view{}); /// /// Drops all indexes in the collection. @@ -363,7 +368,8 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_all(const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_all(const options::index_view& options = options::index_view{}); /// /// Drops all indexes in the collection. @@ -379,16 +385,17 @@ class index_view { /// /// @see https://www.mongodb.com/docs/manual/reference/method/cursor.maxTimeMS/ /// - void drop_all(const client_session& session, - const options::index_view& options = options::index_view{}); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_all(const client_session& session, + const options::index_view& options = options::index_view{}); private: friend ::mongocxx::v_noabi::collection; - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE index_view(void* coll, void* client); + index_view(void* coll, void* client); - MONGOCXX_PRIVATE impl& _get_impl(); + impl& _get_impl(); private: std::unique_ptr _impl; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance-fwd.hpp index b39085884a..c8f7dfaed4 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API instance; +class instance; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance.hpp index 89e3888bc2..c6e47ea65e 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/instance.hpp @@ -82,7 +82,7 @@ class instance { /// /// Creates an instance of the driver. /// - instance(); + MONGOCXX_ABI_EXPORT_CDECL() instance(); /// /// Creates an instance of the driver with a user provided log handler. @@ -90,22 +90,22 @@ class instance { /// /// @throws mongocxx::v_noabi::logic_error if an instance already exists. /// - instance(std::unique_ptr logger); + MONGOCXX_ABI_EXPORT_CDECL() instance(std::unique_ptr logger); /// /// Move constructs an instance of the driver. /// - instance(instance&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() instance(instance&&) noexcept; /// /// Move assigns an instance of the driver. /// - instance& operator=(instance&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(instance&) operator=(instance&&) noexcept; /// /// Destroys an instance of the driver. /// - ~instance(); + MONGOCXX_ABI_EXPORT_CDECL() ~instance(); instance(const instance&) = delete; instance& operator=(const instance&) = delete; @@ -125,10 +125,10 @@ class instance { /// @note This method is intended primarily for test authors, where managing the lifetime of the /// instance w.r.t. the test framework can be problematic. /// - static instance& current(); + static MONGOCXX_ABI_EXPORT_CDECL(instance&) current(); private: - class MONGOCXX_PRIVATE impl; + class impl; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger-fwd.hpp index 1ba4ce3516..69094ada26 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger-fwd.hpp @@ -21,7 +21,7 @@ namespace v_noabi { enum class log_level; -class MONGOCXX_API logger; +class MONGOCXX_ABI_EXPORT logger; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp index ff71180a4e..815ef46435 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp @@ -47,7 +47,7 @@ enum class log_level { /// /// @return a std::string representation of the type. /// -MONGOCXX_API stdx::string_view MONGOCXX_CALL to_string(log_level level); +MONGOCXX_ABI_EXPORT_CDECL(stdx::string_view) to_string(log_level level); /// /// The interface that all user-defined loggers must implement. diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many-fwd.hpp index c3a0c75f03..0676edb4fa 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API delete_many; +class delete_many; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many.hpp index efbd6d1016..521d11c60d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_many.hpp @@ -38,14 +38,15 @@ class delete_many { /// @param filter /// Document representing the criteria for deletion. /// - explicit delete_many(bsoncxx::v_noabi::document::view_or_value filter); + explicit MONGOCXX_ABI_EXPORT_CDECL() + delete_many(bsoncxx::v_noabi::document::view_or_value filter); /// /// Gets the filter for this delete operation. /// /// @return The filter to be used for the delete operation. /// - const bsoncxx::v_noabi::document::view_or_value& filter() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) filter() const; /// /// Sets the collation for this delete operation. @@ -60,7 +61,8 @@ class delete_many { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - delete_many& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(delete_many&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Gets the collation option for this delete operation. @@ -71,7 +73,8 @@ class delete_many { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// Sets the index to use for this operation. /// @@ -85,14 +88,14 @@ class delete_many { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - delete_many& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(delete_many&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; private: bsoncxx::v_noabi::document::view_or_value _filter; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one-fwd.hpp index 7b6ca7754a..171a703cbc 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API delete_one; +class delete_one; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one.hpp index 4c6cb16525..5f64af6b3d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/delete_one.hpp @@ -38,14 +38,14 @@ class delete_one { /// @param filter /// Document representing the criteria for deletion. /// - delete_one(bsoncxx::v_noabi::document::view_or_value filter); + MONGOCXX_ABI_EXPORT_CDECL() delete_one(bsoncxx::v_noabi::document::view_or_value filter); /// /// Gets the filter on this delete operation. /// /// @return The filter to be used for the delete operation. /// - const bsoncxx::v_noabi::document::view_or_value& filter() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) filter() const; /// /// Sets the collation for this delete operation. @@ -56,7 +56,8 @@ class delete_one { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - delete_one& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(delete_one&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Gets the collation option for this delete operation. @@ -67,7 +68,8 @@ class delete_one { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the index to use for this operation. @@ -82,14 +84,14 @@ class delete_one { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - delete_one& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(delete_one&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; private: bsoncxx::v_noabi::document::view_or_value _filter; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one-fwd.hpp index b1e022b5bd..e2cadfa5cf 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API insert_one; +class insert_one; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one.hpp index 4ecbb525fa..5d11cf79e5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/insert_one.hpp @@ -35,14 +35,14 @@ class insert_one { /// @param document /// The document to insert. /// - insert_one(bsoncxx::v_noabi::document::view_or_value document); + MONGOCXX_ABI_EXPORT_CDECL() insert_one(bsoncxx::v_noabi::document::view_or_value document); /// /// Gets the document to be inserted. /// /// @return The document to be inserted. /// - const bsoncxx::v_noabi::document::view_or_value& document() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) document() const; private: bsoncxx::v_noabi::document::view_or_value _document; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one-fwd.hpp index 9de61590e3..d9d7a14872 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API replace_one; +class replace_one; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one.hpp index a808604358..4a4d686923 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/replace_one.hpp @@ -40,6 +40,7 @@ class replace_one { /// @param replacement /// Document that will serve as the replacement. /// + MONGOCXX_ABI_EXPORT_CDECL() replace_one(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value replacement); @@ -48,14 +49,14 @@ class replace_one { /// /// @return The filter to be used for the replacement operation. /// - const bsoncxx::v_noabi::document::view_or_value& filter() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) filter() const; /// /// Gets the replacement document. /// /// @return The document that will replace the original selected document. /// - const bsoncxx::v_noabi::document::view_or_value& replacement() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) replacement() const; /// /// Sets the collation for this replacement operation. @@ -66,7 +67,8 @@ class replace_one { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - replace_one& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(replace_one&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Gets the collation option for this replacement operation. @@ -77,7 +79,8 @@ class replace_one { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the upsert option. @@ -92,14 +95,14 @@ class replace_one { /// The server side default is @c false, which does not insert a new document if a match /// is not found. /// - replace_one& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(replace_one&) upsert(bool upsert); /// /// Gets the current value of the upsert option. /// /// @return The optional value of the upsert option. /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Sets the index to use for this operation. @@ -114,14 +117,14 @@ class replace_one { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - replace_one& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(replace_one&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; private: bsoncxx::v_noabi::document::view_or_value _filter; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many-fwd.hpp index 5d03d41e81..5ba2357828 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API update_many; +class update_many; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many.hpp index 64ba2476a2..9a64992d6e 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_many.hpp @@ -45,9 +45,7 @@ class update_many { // // See update_many() for an example of such overloads. // - class _empty_doc_tag { - _empty_doc_tag() = default; - }; + class _empty_doc_tag {}; public: /// @@ -58,6 +56,7 @@ class update_many { /// @param update /// Document representing the modifications to be applied to matching documents. /// + MONGOCXX_ABI_EXPORT_CDECL() update_many(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update); @@ -69,6 +68,7 @@ class update_many { /// @param update /// Pipeline representing the modifications to be applied to matching documents. /// + MONGOCXX_ABI_EXPORT_CDECL() update_many(bsoncxx::v_noabi::document::view_or_value filter, const pipeline& update); /// @@ -79,6 +79,7 @@ class update_many { /// @param update /// Supports the empty update {}. /// + MONGOCXX_ABI_EXPORT_CDECL() update_many(bsoncxx::v_noabi::document::view_or_value filter, std::initializer_list<_empty_doc_tag> update); @@ -87,14 +88,14 @@ class update_many { /// /// @return The filter to be used for the update operation. /// - const bsoncxx::v_noabi::document::view_or_value& filter() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) filter() const; /// /// Gets the update document. /// /// @return The modifications to be applied as part of the update. /// - const bsoncxx::v_noabi::document::view_or_value& update() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) update() const; /// /// Sets the collation for this update operation. @@ -105,7 +106,8 @@ class update_many { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - update_many& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(update_many&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Gets the collation option for this update operation. @@ -116,7 +118,8 @@ class update_many { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// Sets the index to use for this operation. /// @@ -130,14 +133,14 @@ class update_many { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update_many& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(update_many&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Sets the upsert option. @@ -152,14 +155,14 @@ class update_many { /// The server side default is @c false, which does not insert a new document if a match /// is not found. /// - update_many& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(update_many&) upsert(bool upsert); /// /// Gets the current value of the upsert option. /// /// @return The optional value of the upsert option. /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Set array filters for this update operation. @@ -169,7 +172,8 @@ class update_many { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - update_many& array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); + MONGOCXX_ABI_EXPORT_CDECL(update_many&) + array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); /// /// Get array filters for this operation. @@ -179,7 +183,8 @@ class update_many { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - const stdx::optional& array_filters() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + array_filters() const; private: bsoncxx::v_noabi::document::view_or_value _filter; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one-fwd.hpp index 1ac91eea34..cfbdca89f6 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API update_one; +class update_one; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one.hpp index 444e8dbac2..629435d0f1 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/update_one.hpp @@ -45,9 +45,7 @@ class update_one { // // See update_one() for an example of such overloads. // - class _empty_doc_tag { - _empty_doc_tag() = default; - }; + class _empty_doc_tag {}; public: /// @@ -58,6 +56,7 @@ class update_one { /// @param update /// Document representing the modifications to be applied to the matching document. /// + MONGOCXX_ABI_EXPORT_CDECL() update_one(bsoncxx::v_noabi::document::view_or_value filter, bsoncxx::v_noabi::document::view_or_value update); @@ -69,6 +68,7 @@ class update_one { /// @param update /// Pipeline representing the modifications to be applied to the matching document. /// + MONGOCXX_ABI_EXPORT_CDECL() update_one(bsoncxx::v_noabi::document::view_or_value filter, const pipeline& update); /// @@ -79,6 +79,7 @@ class update_one { /// @param update /// Supports the empty update {}. /// + MONGOCXX_ABI_EXPORT_CDECL() update_one(bsoncxx::v_noabi::document::view_or_value filter, std::initializer_list<_empty_doc_tag> update); @@ -87,14 +88,14 @@ class update_one { /// /// @return The filter to be used for the update operation. /// - const bsoncxx::v_noabi::document::view_or_value& filter() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) filter() const; /// /// Gets the update document. /// /// @return The modifications to be applied as part of the update. /// - const bsoncxx::v_noabi::document::view_or_value& update() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::document::view_or_value&) update() const; /// /// Sets the collation for this update operation. @@ -105,7 +106,8 @@ class update_one { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - update_one& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(update_one&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Gets the collation option for this update operation. @@ -116,7 +118,8 @@ class update_one { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the index to use for this operation. @@ -131,14 +134,14 @@ class update_one { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update_one& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(update_one&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Sets the upsert option. @@ -153,14 +156,14 @@ class update_one { /// The server side default is @c false, which does not insert a new document if a match /// is not found. /// - update_one& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(update_one&) upsert(bool upsert); /// /// Gets the current value of the upsert option. /// /// @return The optional value of the upsert option. /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Set array filters for this update operation. @@ -170,7 +173,8 @@ class update_one { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - update_one& array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); + MONGOCXX_ABI_EXPORT_CDECL(update_one&) + array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); /// /// Get array filters for this operation. @@ -180,7 +184,8 @@ class update_one { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - const stdx::optional& array_filters() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + array_filters() const; private: bsoncxx::v_noabi::document::view_or_value _filter; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write-fwd.hpp index 1a58687c6c..5e8f670c67 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace model { -class MONGOCXX_API write; +class write; } // namespace model } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write.hpp index cfcb9c6f20..15fc45bf56 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/model/write.hpp @@ -41,42 +41,42 @@ class write { /// /// Constructs a write from a model::insert_one. /// - write(insert_one value); + MONGOCXX_ABI_EXPORT_CDECL() write(insert_one value); /// /// Constructs a write from a model::update_one. /// - write(update_one value); + MONGOCXX_ABI_EXPORT_CDECL() write(update_one value); /// /// Constructs a write from a model::update_many. /// - write(update_many value); + MONGOCXX_ABI_EXPORT_CDECL() write(update_many value); /// /// Constructs a write from a model::delete_one. /// - write(delete_one value); + MONGOCXX_ABI_EXPORT_CDECL() write(delete_one value); /// /// Constructs a write from a model::delete_many. /// - write(delete_many value); + MONGOCXX_ABI_EXPORT_CDECL() write(delete_many value); /// /// Constructs a write from a model::replace_one. /// - write(replace_one value); + MONGOCXX_ABI_EXPORT_CDECL() write(replace_one value); /// /// Move constructs a write. /// - write(write&& rhs) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() write(write&& rhs) noexcept; /// /// Move assigns a write. /// - write& operator=(write&& rhs) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(write&) operator=(write&& rhs) noexcept; write(const write& rhs) = delete; write& operator=(const write& rhs) = delete; @@ -84,57 +84,57 @@ class write { /// /// Destroys a write. /// - ~write(); + MONGOCXX_ABI_EXPORT_CDECL() ~write(); /// /// Returns the current type of this write. /// - write_type type() const; + MONGOCXX_ABI_EXPORT_CDECL(write_type) type() const; /// /// Accesses the write as a model::insert_one. It is illegal to call /// this method if the return of type() does not indicate /// that this object currently contains the applicable type. /// - const insert_one& get_insert_one() const; + MONGOCXX_ABI_EXPORT_CDECL(const insert_one&) get_insert_one() const; /// /// Accesses the write as an model::update_one. It is illegal to call /// this method if the return of type() does not indicate /// that this object currently contains the applicable type. /// - const update_one& get_update_one() const; + MONGOCXX_ABI_EXPORT_CDECL(const update_one&) get_update_one() const; /// /// Accesses the write as an model::update_many. It is illegal to call /// this method if the return of type() does not indicate /// that this object currently contains the applicable type. /// - const update_many& get_update_many() const; + MONGOCXX_ABI_EXPORT_CDECL(const update_many&) get_update_many() const; /// /// Accesses the write as a model::delete_one. It is illegal to call /// this method if the return of type() does not indicate /// that this object currently contains the applicable type. /// - const delete_one& get_delete_one() const; + MONGOCXX_ABI_EXPORT_CDECL(const delete_one&) get_delete_one() const; /// /// Accesses the write as a model::delete_many. It is illegal to call /// this method if the return of type() does not indicate /// that this object currently contains the applicable type. /// - const delete_many& get_delete_many() const; + MONGOCXX_ABI_EXPORT_CDECL(const delete_many&) get_delete_many() const; /// /// Accesses the write as a model::replace_one. It is illegal to call /// this method if the return of type() does not indicate /// that this object currently contains the applicable type. /// - const replace_one& get_replace_one() const; + MONGOCXX_ABI_EXPORT_CDECL(const replace_one&) get_replace_one() const; private: - MONGOCXX_PRIVATE void destroy_member() noexcept; + void destroy_member() noexcept; write_type _type; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate-fwd.hpp index 7810047a9b..2282c8cfa8 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API aggregate; +class aggregate; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate.hpp index ef7ead3989..7570161a45 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/aggregate.hpp @@ -55,7 +55,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - aggregate& allow_disk_use(bool allow_disk_use); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) allow_disk_use(bool allow_disk_use); /// /// Retrieves the current allow_disk_use setting. @@ -64,7 +64,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& allow_disk_use() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) allow_disk_use() const; /// /// Sets the number of documents to return per batch. @@ -78,7 +78,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - aggregate& batch_size(std::int32_t batch_size); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) batch_size(std::int32_t batch_size); /// /// The current batch size setting. @@ -87,7 +87,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& batch_size() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) batch_size() const; /// /// Sets the collation for this operation. @@ -101,7 +101,8 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - aggregate& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -111,7 +112,8 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the variable mapping for this operation. @@ -125,7 +127,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - aggregate& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) let(bsoncxx::v_noabi::document::view_or_value let); /// /// Retrieves the current variable mapping for this operation. @@ -135,7 +137,8 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + let() const; /// /// Sets the maximum amount of time for this operation to run server-side in milliseconds. @@ -149,7 +152,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - aggregate& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -159,7 +162,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Sets the read_preference for this operation. @@ -172,7 +175,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - aggregate& read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) read_preference(mongocxx::v_noabi::read_preference rp); /// /// The current read_preference for this operation. @@ -181,7 +184,8 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_preference() const; /// /// Sets whether the $out stage should bypass document validation. @@ -192,7 +196,8 @@ class aggregate { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - aggregate& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) + bypass_document_validation(bool bypass_document_validation); /// /// The current bypass_document_validation setting. @@ -201,7 +206,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bypass_document_validation() const; /// /// Sets the index to use for this operation. @@ -218,7 +223,7 @@ class aggregate { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - aggregate& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. @@ -227,7 +232,7 @@ class aggregate { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Sets the write concern to use for this operation. Only has an effect if $out is a part of @@ -243,7 +248,8 @@ class aggregate { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - aggregate& write_concern(mongocxx::v_noabi::write_concern write_concern); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) + write_concern(mongocxx::v_noabi::write_concern write_concern); /// /// Gets the current write concern. @@ -254,7 +260,8 @@ class aggregate { /// @see /// https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Sets the read concern to use for this operation. @@ -268,7 +275,8 @@ class aggregate { /// @return /// A reference to the object on which this member function is being called. /// - aggregate& read_concern(mongocxx::v_noabi::read_concern read_concern); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) + read_concern(mongocxx::v_noabi::read_concern read_concern); /// /// Gets the current read concern. @@ -279,7 +287,8 @@ class aggregate { /// @see /// https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_concern() const; /// /// Sets the comment to use for this operation. @@ -293,7 +302,8 @@ class aggregate { /// @return /// A reference to the object on which this member function is being called. /// - aggregate& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(aggregate&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current comment. @@ -304,7 +314,9 @@ class aggregate { /// @see /// https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + comment() const; private: friend ::mongocxx::v_noabi::collection; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm-fwd.hpp index 4605644732..d228f6c01c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API apm; +class apm; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp index 8bbb0cecd8..ef1b1c67e5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp @@ -56,15 +56,16 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_command_started( - std::function command_started); + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_command_started(std::function command_started); /// /// Retrieves the command started monitoring callback. /// /// @return The command started monitoring callback. /// - const std::function& command_started() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + command_started() const; /// /// Set the command failed monitoring callback. The callback takes a reference to a @@ -80,14 +81,16 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_command_failed(std::function command_failed); + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_command_failed(std::function command_failed); /// /// Retrieves the command failed monitoring callback. /// /// @return The command failed monitoring callback. /// - const std::function& command_failed() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + command_failed() const; /// /// Set the command succeeded monitoring callback. The callback takes a reference to a @@ -103,7 +106,8 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_command_succeeded( + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_command_succeeded( std::function command_succeeded); /// @@ -111,7 +115,8 @@ class apm { /// /// @return The command succeeded monitoring callback. /// - const std::function& command_succeeded() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + command_succeeded() const; /// /// Set the server opening monitoring callback. The callback takes a reference to a @@ -127,14 +132,16 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_server_opening(std::function server_opening); + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_server_opening(std::function server_opening); /// /// Retrieves the server opening monitoring callback. /// /// @return The server opening monitoring callback. /// - const std::function& server_opening() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + server_opening() const; /// /// Set the server closed monitoring callback. The callback takes a reference to a @@ -150,14 +157,16 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_server_closed(std::function server_closed); + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_server_closed(std::function server_closed); /// /// Retrieves the server closed monitoring callback. /// /// @return The server closed monitoring callback. /// - const std::function& server_closed() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + server_closed() const; /// /// Set the server description changed monitoring callback. The callback takes a reference to a @@ -174,14 +183,16 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_server_changed(std::function server_changed); + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_server_changed(std::function server_changed); /// /// Retrieves the server description changed monitoring callback. /// /// @return The server description changed monitoring callback. /// - const std::function& server_changed() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + server_changed() const; /// /// Set the topology_opening monitoring callback. The callback takes a reference to a @@ -197,7 +208,8 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_topology_opening( + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_topology_opening( std::function topology_opening); /// @@ -205,7 +217,8 @@ class apm { /// /// @return The topology_opening monitoring callback. /// - const std::function& topology_opening() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + topology_opening() const; /// /// Set the topology closed monitoring callback. The callback takes a reference to a @@ -221,15 +234,16 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_topology_closed( - std::function topology_closed); + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_topology_closed(std::function topology_closed); /// /// Retrieves the topology closed monitoring callback. /// /// @return The topology closed monitoring callback. /// - const std::function& topology_closed() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + topology_closed() const; /// /// Set the topology description changed monitoring callback. The callback takes a reference to @@ -246,7 +260,8 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_topology_changed( + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_topology_changed( std::function topology_changed); /// @@ -254,7 +269,8 @@ class apm { /// /// @return The topology description changed monitoring callback. /// - const std::function& topology_changed() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + topology_changed() const; /// /// Set the heartbeat started monitoring callback. The callback takes a reference to a @@ -270,7 +286,8 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_heartbeat_started( + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_heartbeat_started( std::function heartbeat_started); /// @@ -278,7 +295,8 @@ class apm { /// /// @return The heartbeat started monitoring callback. /// - const std::function& heartbeat_started() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + heartbeat_started() const; /// /// Set the heartbeat failed monitoring callback. The callback takes a reference to a @@ -294,7 +312,8 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_heartbeat_failed( + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_heartbeat_failed( std::function heartbeat_failed); /// @@ -302,7 +321,8 @@ class apm { /// /// @return The heartbeat failed monitoring callback. /// - const std::function& heartbeat_failed() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + heartbeat_failed() const; /// /// Set the heartbeat succeeded monitoring callback. The callback takes a reference to a @@ -319,7 +339,8 @@ class apm { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - apm& on_heartbeat_succeeded( + MONGOCXX_ABI_EXPORT_CDECL(apm&) + on_heartbeat_succeeded( std::function heartbeat_succeeded); /// @@ -327,8 +348,8 @@ class apm { /// /// @return The heartbeat succeeded monitoring callback. /// - const std::function& heartbeat_succeeded() - const; + MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + heartbeat_succeeded() const; private: std::function _command_started; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption-fwd.hpp index 983834dec1..80ac83560d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API auto_encryption; +class auto_encryption; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption.hpp index 0b58c57436..8b2fec9c66 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/auto_encryption.hpp @@ -38,7 +38,7 @@ class auto_encryption { /// /// Default constructs a new auto_encryption object. /// - auto_encryption() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() auto_encryption() noexcept; /// /// When the key vault collection is on a separate MongoDB cluster, @@ -56,7 +56,7 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& key_vault_client(mongocxx::v_noabi::client* client); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) key_vault_client(mongocxx::v_noabi::client* client); /// /// Gets the key vault client. @@ -64,7 +64,8 @@ class auto_encryption { /// @return /// An optional pointer to the key vault client. /// - const stdx::optional& key_vault_client() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + key_vault_client() const; /// /// When the key vault collection is on a separate MongoDB cluster, @@ -86,7 +87,7 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& key_vault_pool(mongocxx::v_noabi::pool* pool); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) key_vault_pool(mongocxx::v_noabi::pool* pool); /// /// Gets the key vault pool. @@ -94,7 +95,8 @@ class auto_encryption { /// @return /// An optional pointer to the key vault pool. /// - const stdx::optional& key_vault_pool() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + key_vault_pool() const; /// /// Represents the name of a database and a collection. @@ -117,7 +119,7 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& key_vault_namespace(ns_pair ns); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) key_vault_namespace(ns_pair ns); /// /// Gets the key vault namespace. @@ -126,7 +128,7 @@ class auto_encryption { /// An optional pair of strings representing the namespace of the /// key vault collection. /// - const stdx::optional& key_vault_namespace() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) key_vault_namespace() const; /// /// Sets the KMS providers to use for client side encryption. @@ -171,7 +173,8 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) + kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers); /// /// Gets the KMS providers. @@ -179,7 +182,8 @@ class auto_encryption { /// @return /// An optional document containing the KMS providers. /// - const stdx::optional& kms_providers() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + kms_providers() const; /// /// Sets the TLS options to use for client side encryption with a given KMS provider. @@ -203,7 +207,8 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) + tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts); /// /// Gets the TLS options. @@ -211,7 +216,8 @@ class auto_encryption { /// @return /// An optional document containing the TLS options. /// - const stdx::optional& tls_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + tls_opts() const; /// /// Sets a local JSON schema. @@ -235,7 +241,8 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& schema_map(bsoncxx::v_noabi::document::view_or_value schema_map); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) + schema_map(bsoncxx::v_noabi::document::view_or_value schema_map); /// /// Gets the schema map. @@ -243,7 +250,8 @@ class auto_encryption { /// @return /// An optional document containing the schema map. /// - const stdx::optional& schema_map() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + schema_map() const; /// /// Sets the local encrypted fields map. @@ -262,8 +270,8 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& encrypted_fields_map( - bsoncxx::v_noabi::document::view_or_value encrypted_fields_map); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) + encrypted_fields_map(bsoncxx::v_noabi::document::view_or_value encrypted_fields_map); /// /// Get encrypted fields map @@ -271,7 +279,8 @@ class auto_encryption { /// @return /// An optional document containing the encrypted fields map /// - const stdx::optional& encrypted_fields_map() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + encrypted_fields_map() const; /// /// Automatic encryption is disabled when the 'bypassAutoEncryption' @@ -285,7 +294,7 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& bypass_auto_encryption(bool should_bypass); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) bypass_auto_encryption(bool should_bypass); /// /// Gets a boolean specifying whether or not auto encryption is bypassed. @@ -293,7 +302,7 @@ class auto_encryption { /// @return /// A boolean specifying whether auto encryption is bypassed. /// - bool bypass_auto_encryption() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) bypass_auto_encryption() const; /// /// Query analysis is disabled when the 'bypassQueryAnalysis' @@ -307,7 +316,7 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& bypass_query_analysis(bool should_bypass); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) bypass_query_analysis(bool should_bypass); /// /// Gets a boolean specifying whether or not query analysis is bypassed. @@ -315,7 +324,7 @@ class auto_encryption { /// @return /// A boolean specifying whether query analysis is bypassed. /// - bool bypass_query_analysis() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) bypass_query_analysis() const; /// /// Set extra options related to the mongocryptd process. This options @@ -366,7 +375,8 @@ class auto_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - auto_encryption& extra_options(bsoncxx::v_noabi::document::view_or_value extra); + MONGOCXX_ABI_EXPORT_CDECL(auto_encryption&) + extra_options(bsoncxx::v_noabi::document::view_or_value extra); /// /// Gets extra options related to the mongocryptd process. @@ -374,13 +384,14 @@ class auto_encryption { /// @return /// An optional document containing the extra options. /// - const stdx::optional& extra_options() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + extra_options() const; private: friend ::mongocxx::v_noabi::client; friend ::mongocxx::v_noabi::pool; - MONGOCXX_PRIVATE void* convert() const; + void* convert() const; bool _bypass; bool _bypass_query_analysis; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write-fwd.hpp index f0887a167d..bb6e0c581f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API bulk_write; +class bulk_write; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write.hpp index 022d719f3a..7cf115773e 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/bulk_write.hpp @@ -37,7 +37,7 @@ class bulk_write { /// as this is the only safe choice. If you want an unordered update, you must call /// ordered(false) to switch to unordered mode. /// - bulk_write(); + MONGOCXX_ABI_EXPORT_CDECL() bulk_write(); /// /// Sets whether the writes must be executed in order by the server. @@ -54,14 +54,14 @@ class bulk_write { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bulk_write& ordered(bool ordered); + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) ordered(bool ordered); /// /// Gets the current value of the ordered option. /// /// @return The value of the ordered option. /// - bool ordered() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) ordered() const; /// /// Sets the write_concern for this operation. @@ -75,7 +75,7 @@ class bulk_write { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - bulk_write& write_concern(mongocxx::v_noabi::write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) write_concern(mongocxx::v_noabi::write_concern wc); /// /// The current write_concern for this operation. @@ -85,7 +85,8 @@ class bulk_write { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Set whether or not to bypass document validation for this operation. @@ -97,7 +98,8 @@ class bulk_write { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bulk_write& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) + bypass_document_validation(bool bypass_document_validation); /// /// The current setting for bypassing document validation for this operation. @@ -105,7 +107,7 @@ class bulk_write { /// @return /// The current document validation bypass setting. /// - const stdx::optional bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) bypass_document_validation() const; /// /// Set the value of the let option. @@ -117,7 +119,7 @@ class bulk_write { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bulk_write& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -125,7 +127,8 @@ class bulk_write { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -137,7 +140,8 @@ class bulk_write { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bulk_write& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(bulk_write&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -145,7 +149,9 @@ class bulk_write { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; private: bool _ordered; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream-fwd.hpp index da4e40afeb..34b0027dd7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API change_stream; +class change_stream; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream.hpp index 0851353eea..a9e2fc665c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/change_stream.hpp @@ -38,7 +38,7 @@ namespace options { /// class change_stream { public: - change_stream(); + MONGOCXX_ABI_EXPORT_CDECL() change_stream(); /// /// Sets the fullDocument option for the $changeStream. @@ -67,7 +67,8 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& full_document(bsoncxx::v_noabi::string::view_or_value full_doc); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + full_document(bsoncxx::v_noabi::string::view_or_value full_doc); /// /// Gets the current fullDocument option. @@ -75,8 +76,9 @@ class change_stream { /// @return /// The current fullDocument option. /// - const bsoncxx::v_noabi::stdx::optional& full_document() - const; + MONGOCXX_ABI_EXPORT_CDECL( + const bsoncxx::v_noabi::stdx::optional&) + full_document() const; /// /// Sets the fullDocumentBeforeChange option for the $changeStream. @@ -97,8 +99,8 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& full_document_before_change( - bsoncxx::v_noabi::string::view_or_value full_doc_before_change); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + full_document_before_change(bsoncxx::v_noabi::string::view_or_value full_doc_before_change); /// /// Gets the current fullDocumentBeforeChange option. @@ -106,7 +108,8 @@ class change_stream { /// @return /// The current fullDocumentBeforeChange option. /// - const bsoncxx::v_noabi::stdx::optional& + MONGOCXX_ABI_EXPORT_CDECL( + const bsoncxx::v_noabi::stdx::optional&) full_document_before_change() const; /// @@ -119,7 +122,7 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& batch_size(std::int32_t batch_size); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) batch_size(std::int32_t batch_size); /// /// The current batch size setting. @@ -127,7 +130,7 @@ class change_stream { /// @return /// The current batch size. /// - const stdx::optional& batch_size() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) batch_size() const; /// /// Sets the current value of the comment option. @@ -139,7 +142,8 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -147,7 +151,9 @@ class change_stream { /// @return /// The current comment option. /// - const stdx::optional& comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + comment() const; /// /// Specifies the logical starting point for the new change stream. @@ -164,7 +170,8 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& resume_after(bsoncxx::v_noabi::document::view_or_value resume_after); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + resume_after(bsoncxx::v_noabi::document::view_or_value resume_after); /// /// Retrieves the current resumeToken for this change stream. @@ -172,7 +179,8 @@ class change_stream { /// @return /// The current resumeToken. /// - const stdx::optional& resume_after() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + resume_after() const; /// /// Specifies the logical starting point of the new change stream. The new stream will @@ -191,7 +199,8 @@ class change_stream { /// @return /// A reference to the object on which this function is being called. /// - change_stream& start_after(bsoncxx::v_noabi::document::view_or_value token); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + start_after(bsoncxx::v_noabi::document::view_or_value token); /// /// Retrieves the current startAfter token for this change stream. @@ -199,7 +208,8 @@ class change_stream { /// @return /// The current startAfter token. /// - const stdx::optional& start_after() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + start_after() const; /// /// Sets the collation for this operation. @@ -211,7 +221,8 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -219,7 +230,8 @@ class change_stream { /// @return /// The current collation. /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the maximum amount of time for for the server to wait on new documents to satisfy a @@ -232,7 +244,7 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& max_await_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) max_await_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -240,7 +252,8 @@ class change_stream { /// @return /// The current max time (in milliseconds). /// - const stdx::optional& max_await_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + max_await_time() const; /// /// Specifies the logical starting point for the new change stream. Changes are returned at or @@ -256,7 +269,8 @@ class change_stream { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - change_stream& start_at_operation_time(bsoncxx::v_noabi::types::b_timestamp timestamp); + MONGOCXX_ABI_EXPORT_CDECL(change_stream&) + start_at_operation_time(bsoncxx::v_noabi::types::b_timestamp timestamp); private: friend ::mongocxx::v_noabi::client; @@ -264,6 +278,7 @@ class change_stream { friend ::mongocxx::v_noabi::database; bsoncxx::v_noabi::document::value as_bson() const; + stdx::optional _full_document; stdx::optional _full_document_before_change; stdx::optional _batch_size; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client-fwd.hpp index b7dc103afa..94d27a231c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API client; +class client; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client.hpp index ce7fd2ced0..d0670ac8e4 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client.hpp @@ -50,7 +50,7 @@ class client { /// @deprecated /// Please use tls_opts instead. /// - MONGOCXX_DEPRECATED client& ssl_opts(tls ssl_opts); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(client&) ssl_opts(tls ssl_opts); /// /// Sets the TLS-related options. @@ -62,7 +62,7 @@ class client { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - client& tls_opts(tls tls_opts); + MONGOCXX_ABI_EXPORT_CDECL(client&) tls_opts(tls tls_opts); /// /// The current SSL-related options. @@ -71,14 +71,14 @@ class client { /// /// @deprecated Please use tls_opts instead. /// - MONGOCXX_DEPRECATED const stdx::optional& ssl_opts() const; + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) ssl_opts() const; /// /// The current TLS-related options. /// /// @return The TLS-related options. /// - const stdx::optional& tls_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) tls_opts() const; /// /// Sets the automatic encryption options. @@ -90,7 +90,7 @@ class client { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - client& auto_encryption_opts(auto_encryption auto_encryption_opts); + MONGOCXX_ABI_EXPORT_CDECL(client&) auto_encryption_opts(auto_encryption auto_encryption_opts); /// /// Gets the current automatic encryption options. @@ -98,7 +98,7 @@ class client { /// @return /// The automatic encryption opts. /// - const stdx::optional& auto_encryption_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) auto_encryption_opts() const; /// /// Sets the APM-related options. @@ -110,14 +110,14 @@ class client { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - client& apm_opts(apm apm_opts); + MONGOCXX_ABI_EXPORT_CDECL(client&) apm_opts(apm apm_opts); /// /// The current APM-related options. /// /// @return The APM-related options. /// - const stdx::optional& apm_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) apm_opts() const; /// /// Sets the server API options. @@ -129,7 +129,7 @@ class client { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - client& server_api_opts(server_api server_api_opts); + MONGOCXX_ABI_EXPORT_CDECL(client&) server_api_opts(server_api server_api_opts); /// /// Gets the current server API options or returns a disengaged optional if there are no server @@ -138,7 +138,7 @@ class client { /// @return /// The server API options. /// - const stdx::optional& server_api_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) server_api_opts() const; private: stdx::optional _tls_opts; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption-fwd.hpp index fe9f7843cb..099c284ce9 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API client_encryption; +class client_encryption; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption.hpp index 45e41eecd8..8bf6223227 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_encryption.hpp @@ -48,7 +48,8 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - client_encryption& key_vault_client(mongocxx::v_noabi::client* client); + MONGOCXX_ABI_EXPORT_CDECL(client_encryption&) + key_vault_client(mongocxx::v_noabi::client* client); /// /// Gets the key vault client. @@ -56,7 +57,8 @@ class client_encryption { /// @return /// An optional pointer to the key vault client. /// - const stdx::optional& key_vault_client() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + key_vault_client() const; /// /// Represents the name of a database and a collection. @@ -79,7 +81,7 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - client_encryption& key_vault_namespace(ns_pair ns); + MONGOCXX_ABI_EXPORT_CDECL(client_encryption&) key_vault_namespace(ns_pair ns); /// /// Gets the key vault namespace. @@ -88,7 +90,7 @@ class client_encryption { /// An optional pair of strings representing the namespace of the /// key vault collection. /// - const stdx::optional& key_vault_namespace() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) key_vault_namespace() const; /// /// Sets the KMS providers to use for client side encryption. @@ -133,7 +135,8 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - client_encryption& kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers); + MONGOCXX_ABI_EXPORT_CDECL(client_encryption&) + kms_providers(bsoncxx::v_noabi::document::view_or_value kms_providers); /// /// Gets the KMS providers. @@ -141,7 +144,8 @@ class client_encryption { /// @return /// An optional document containing the KMS providers. /// - const stdx::optional& kms_providers() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + kms_providers() const; /// /// Sets the TLS options to use for client side encryption with a given KMS provider. @@ -165,7 +169,8 @@ class client_encryption { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - client_encryption& tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts); + MONGOCXX_ABI_EXPORT_CDECL(client_encryption&) + tls_opts(bsoncxx::v_noabi::document::view_or_value tls_opts); /// /// Gets the TLS options. @@ -173,12 +178,13 @@ class client_encryption { /// @return /// An optional document containing the TLS options. /// - const stdx::optional& tls_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + tls_opts() const; private: friend ::mongocxx::v_noabi::client_encryption; - MONGOCXX_PRIVATE void* convert() const; + void* convert() const; stdx::optional _key_vault_client; stdx::optional _key_vault_namespace; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session-fwd.hpp index 396d3d369c..50b85a60f5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API client_session; +class client_session; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session.hpp index f7a0feb601..d45aff5d74 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/client_session.hpp @@ -50,13 +50,13 @@ class client_session { /// @see /// https://www.mongodb.com/docs/manual/core/read-isolation-consistency-recency/#causal-consistency /// - client_session& causal_consistency(bool causal_consistency) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client_session&) causal_consistency(bool causal_consistency) noexcept; /// /// Gets the value of the causal_consistency option. /// /// - bool causal_consistency() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bool) causal_consistency() const noexcept; /// /// Sets the read concern "snapshot" (not enabled by default). @@ -72,12 +72,12 @@ class client_session { /// other may be active at a time. Attempting to do so will result in an error being thrown /// by mongocxx::v_noabi::client::start_session. /// - client_session& snapshot(bool enable_snapshot_reads) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client_session&) snapshot(bool enable_snapshot_reads) noexcept; /// /// Gets the value of the snapshot_reads option. /// - bool snapshot() const noexcept; + MONGOCXX_ABI_EXPORT_CDECL(bool) snapshot() const noexcept; /// /// Sets the default transaction options. @@ -89,14 +89,15 @@ class client_session { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - client_session& default_transaction_opts(transaction default_transaction_opts); + MONGOCXX_ABI_EXPORT_CDECL(client_session&) + default_transaction_opts(transaction default_transaction_opts); /// /// Gets the current default transaction options. /// /// @return The default transaction options. /// - const stdx::optional& default_transaction_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) default_transaction_opts() const; private: friend ::mongocxx::v_noabi::client_session; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count-fwd.hpp index 0c15ec9213..d706ecb453 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API count; +class count; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count.hpp index 828f541e62..1953ad6367 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/count.hpp @@ -49,7 +49,8 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(count&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -59,7 +60,8 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the index to use for this operation. @@ -73,7 +75,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(count&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. @@ -82,7 +84,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the comment option. @@ -96,7 +98,8 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(count&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -105,7 +108,9 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + comment() const; /// /// Sets the maximum number of documents to count. @@ -119,7 +124,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& limit(std::int64_t limit); + MONGOCXX_ABI_EXPORT_CDECL(count&) limit(std::int64_t limit); /// /// Gets the current limit. @@ -128,7 +133,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& limit() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) limit() const; /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -142,7 +147,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(count&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -151,7 +156,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Sets the number of documents to skip before counting documents. @@ -165,7 +170,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& skip(std::int64_t skip); + MONGOCXX_ABI_EXPORT_CDECL(count&) skip(std::int64_t skip); /// /// Gets the current number of documents to skip. @@ -174,7 +179,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& skip() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) skip() const; /// /// Sets the read_preference for this operation. @@ -188,7 +193,7 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - count& read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(count&) read_preference(mongocxx::v_noabi::read_preference rp); /// /// The current read_preference for this operation. @@ -197,7 +202,8 @@ class count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/aggregate/ /// - const stdx::optional& read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_preference() const; private: stdx::optional _collation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/create_collection.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/create_collection.hpp index 4480c1b68e..5916b14612 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/create_collection.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/create_collection.hpp @@ -31,7 +31,7 @@ namespace options { /// @deprecated Use @ref mongocxx::v_noabi::database::create_collection overloads with a BSON /// document option parameter instead. /// -class MONGOCXX_API create_collection_deprecated { +class create_collection_deprecated { public: /// /// To create a capped collection, specify true. @@ -47,7 +47,7 @@ class MONGOCXX_API create_collection_deprecated { /// /// @see https://www.mongodb.com/docs/manual/reference/glossary/#term-capped-collection /// - create_collection_deprecated& capped(bool capped); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) capped(bool capped); /// /// Gets the current capped setting. @@ -57,7 +57,7 @@ class MONGOCXX_API create_collection_deprecated { /// /// @see https://www.mongodb.com/docs/manual/reference/glossary/#term-capped-collection /// - const stdx::optional& capped() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) capped() const; /// /// Sets the default collation for this collection. @@ -72,7 +72,8 @@ class MONGOCXX_API create_collection_deprecated { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - create_collection_deprecated& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Gets the default collation for this collection. @@ -83,7 +84,8 @@ class MONGOCXX_API create_collection_deprecated { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// The maximum number of documents allowed in the capped collection. @@ -99,7 +101,7 @@ class MONGOCXX_API create_collection_deprecated { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - create_collection_deprecated& max(std::int64_t max_documents); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) max(std::int64_t max_documents); /// /// Gets the current setting for the maximum number of documents allowed in the capped @@ -108,7 +110,7 @@ class MONGOCXX_API create_collection_deprecated { /// @return /// Maximum number of documents allowed in the collection (if capped). /// - const stdx::optional& max() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max() const; /// /// When true, disables the power of 2 sizes allocation for the collection. @@ -122,7 +124,7 @@ class MONGOCXX_API create_collection_deprecated { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - create_collection_deprecated& no_padding(bool no_padding); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) no_padding(bool no_padding); /// /// Gets the current value of the "no padding" option for the collection. @@ -132,7 +134,7 @@ class MONGOCXX_API create_collection_deprecated { /// @return /// When true, power of 2 sizing is disabled for this collection. /// - const stdx::optional& no_padding() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) no_padding() const; /// /// A maximum size, in bytes, for a capped collection. @@ -149,7 +151,7 @@ class MONGOCXX_API create_collection_deprecated { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - create_collection_deprecated& size(std::int64_t max_size); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) size(std::int64_t max_size); /// /// Gets the current size setting, for a capped collection. @@ -157,7 +159,7 @@ class MONGOCXX_API create_collection_deprecated { /// @return /// Maximum size, in bytes, of this collection (if capped). /// - const stdx::optional& size() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) size() const; /// /// Specify configuration to the storage on a per-collection basis. @@ -171,8 +173,8 @@ class MONGOCXX_API create_collection_deprecated { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - create_collection_deprecated& storage_engine( - bsoncxx::v_noabi::document::view_or_value storage_engine_opts); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) + storage_engine(bsoncxx::v_noabi::document::view_or_value storage_engine_opts); /// /// Gets the current storage engine configuration for this collection. @@ -180,7 +182,8 @@ class MONGOCXX_API create_collection_deprecated { /// @return /// Configuration options specific to the storage engine. /// - const stdx::optional& storage_engine() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + storage_engine() const; /// /// Specify validation criteria for this collection. @@ -194,8 +197,8 @@ class MONGOCXX_API create_collection_deprecated { /// /// @see https://www.mongodb.com/docs/manual/core/document-validation/ /// - create_collection_deprecated& validation_criteria( - mongocxx::v_noabi::validation_criteria validation); + MONGOCXX_ABI_EXPORT_CDECL(create_collection_deprecated&) + validation_criteria(mongocxx::v_noabi::validation_criteria validation); /// /// Gets the current validation criteria for this collection. @@ -205,7 +208,8 @@ class MONGOCXX_API create_collection_deprecated { /// /// @see https://www.mongodb.com/docs/manual/core/document-validation/ /// - const stdx::optional& validation_criteria() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + validation_criteria() const; /// /// Return a bson document representing the options set on this object. @@ -216,15 +220,19 @@ class MONGOCXX_API create_collection_deprecated { /// /// @return Options, as a document. /// - MONGOCXX_DEPRECATED bsoncxx::v_noabi::document::value to_document() const; - bsoncxx::v_noabi::document::value to_document_deprecated() const; + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + to_document() const; + + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) to_document_deprecated() const; /// /// @deprecated /// This method is deprecated. To determine which options are set on this object, use the /// provided accessors instead. /// - MONGOCXX_DEPRECATED MONGOCXX_INLINE operator bsoncxx::v_noabi::document::value() const; + MONGOCXX_DEPRECATED inline operator bsoncxx::v_noabi::document::value() const { + return to_document_deprecated(); + } private: stdx::optional _capped; @@ -244,10 +252,6 @@ class MONGOCXX_API create_collection_deprecated { /// MONGOCXX_DEPRECATED typedef create_collection_deprecated create_collection; -MONGOCXX_INLINE create_collection_deprecated::operator bsoncxx::v_noabi::document::value() const { - return to_document_deprecated(); -} - } // namespace options } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key-fwd.hpp index 0c6a9431f8..d99228a2ae 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API data_key; +class data_key; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key.hpp index 369337a72c..81fd0002a3 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/data_key.hpp @@ -89,7 +89,8 @@ class data_key { /// @see /// https://www.mongodb.com/docs/manual/core/security-client-side-encryption-key-management/ /// - data_key& master_key(bsoncxx::v_noabi::document::view_or_value master_key); + MONGOCXX_ABI_EXPORT_CDECL(data_key&) + master_key(bsoncxx::v_noabi::document::view_or_value master_key); /// /// Gets the master key. @@ -97,7 +98,8 @@ class data_key { /// @return /// An optional document containing the master key. /// - const stdx::optional& master_key() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + master_key() const; /// /// Sets an optional list of string alternate names used to reference the key. @@ -112,7 +114,7 @@ class data_key { /// /// @see https://www.mongodb.com/docs/manual/reference/method/getClientEncryption/ /// - data_key& key_alt_names(std::vector key_alt_names); + MONGOCXX_ABI_EXPORT_CDECL(data_key&) key_alt_names(std::vector key_alt_names); /// /// Gets the alternate names for the data key. @@ -120,7 +122,7 @@ class data_key { /// @return /// The alternate names for the data key. /// - const std::vector& key_alt_names() const; + MONGOCXX_ABI_EXPORT_CDECL(const std::vector&) key_alt_names() const; /// /// Represents binary data used to represent key material. @@ -145,7 +147,7 @@ class data_key { /// /// @see https://www.mongodb.com/docs/v6.0/reference/method/KeyVault.createKey/ /// - data_key& key_material(key_material_type key_material); + MONGOCXX_ABI_EXPORT_CDECL(data_key&) key_material(key_material_type key_material); /// /// Gets the keyMaterial as binary data @@ -155,12 +157,12 @@ class data_key { /// /// @see https://www.mongodb.com/docs/v6.0/reference/method/KeyVault.createKey/ /// - const stdx::optional& key_material(); + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) key_material(); private: friend ::mongocxx::v_noabi::client_encryption; - MONGOCXX_PRIVATE void* convert() const; + void* convert() const; stdx::optional _master_key; std::vector _key_alt_names; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete-fwd.hpp index de60565467..93888deb6f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API delete_options; +class delete_options; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete.hpp index 7e2ef89670..02eacebf3a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/delete.hpp @@ -46,7 +46,8 @@ class delete_options { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - delete_options& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(delete_options&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -57,7 +58,8 @@ class delete_options { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the write_concern for this operation. @@ -71,7 +73,7 @@ class delete_options { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - delete_options& write_concern(write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(delete_options&) write_concern(write_concern wc); /// /// The current write_concern for this operation. @@ -82,7 +84,8 @@ class delete_options { /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Sets the index to use for this operation. @@ -97,14 +100,14 @@ class delete_options { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - delete_options& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(delete_options&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -116,7 +119,7 @@ class delete_options { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - delete_options& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(delete_options&) let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -124,7 +127,8 @@ class delete_options { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -136,7 +140,8 @@ class delete_options { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - delete_options& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(delete_options&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -144,7 +149,9 @@ class delete_options { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; private: stdx::optional _collation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct-fwd.hpp index 1a5d901cab..41e9794a15 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API distinct; +class distinct; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct.hpp index 3b25c88f42..d03806ab4d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/distinct.hpp @@ -48,7 +48,8 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - distinct& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(distinct&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -58,7 +59,8 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -72,7 +74,7 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - distinct& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(distinct&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -81,7 +83,7 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Sets the comment for this operation. @@ -95,7 +97,8 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - distinct& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(distinct&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// The current comment for this operation. @@ -104,7 +107,9 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - const stdx::optional& comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + comment() const; /// /// Sets the read_preference for this operation. @@ -118,7 +123,7 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - distinct& read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(distinct&) read_preference(mongocxx::v_noabi::read_preference rp); /// /// The current read_preference for this operation. @@ -127,7 +132,8 @@ class distinct { /// /// @see https://www.mongodb.com/docs/manual/reference/command/distinct/ /// - const stdx::optional& read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_preference() const; private: stdx::optional _collation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt-fwd.hpp index 5c1bed1643..7938fa8f42 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API encrypt; +class encrypt; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt.hpp index 9cba04ef4f..0ad59a98cf 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/encrypt.hpp @@ -52,7 +52,8 @@ class encrypt { /// /// @see https://www.mongodb.com/docs/manual/core/security-client-side-encryption/ /// - encrypt& key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id); + MONGOCXX_ABI_EXPORT_CDECL(encrypt&) + key_id(bsoncxx::v_noabi::types::bson_value::view_or_value key_id); /// /// Gets the key_id. @@ -60,7 +61,9 @@ class encrypt { /// @return /// An optional owning bson_value containing the key_id. /// - const stdx::optional& key_id() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + key_id() const; /// /// Sets a name by which to lookup a key from the key vault collection to use @@ -74,7 +77,7 @@ class encrypt { /// /// @see https://www.mongodb.com/docs/manual/reference/method/getClientEncryption/ /// - encrypt& key_alt_name(std::string name); + MONGOCXX_ABI_EXPORT_CDECL(encrypt&) key_alt_name(std::string name); /// /// Gets the current key alt name. @@ -82,7 +85,7 @@ class encrypt { /// @return /// An optional key name. /// - const stdx::optional& key_alt_name() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) key_alt_name() const; /// /// Determines which AEAD_AES_256_CBC algorithm to use with HMAC_SHA_512 when @@ -148,7 +151,7 @@ class encrypt { /// @see /// https://www.mongodb.com/docs/manual/core/security-client-side-encryption/#encryption-algorithms /// - encrypt& algorithm(encryption_algorithm algorithm); + MONGOCXX_ABI_EXPORT_CDECL(encrypt&) algorithm(encryption_algorithm algorithm); /// /// Gets the current algorithm. @@ -158,7 +161,7 @@ class encrypt { /// @return /// An optional algorithm. /// - const stdx::optional& algorithm() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) algorithm() const; /// /// Sets the contention factor to use for encryption. @@ -168,7 +171,7 @@ class encrypt { /// @param contention_factor /// An integer specifiying the desired contention factor. /// - encrypt& contention_factor(int64_t contention_factor); + MONGOCXX_ABI_EXPORT_CDECL(encrypt&) contention_factor(int64_t contention_factor); /// /// Gets the current contention factor. @@ -176,7 +179,7 @@ class encrypt { /// @return /// An optional contention factor. /// - const stdx::optional& contention_factor() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) contention_factor() const; /// /// Sets the query type to use for encryption. @@ -186,7 +189,7 @@ class encrypt { /// query_type only applies when algorithm is "Indexed" or "RangePreview". /// It is an error to set query_type when algorithm is not "Indexed" or "RangePreview". /// - encrypt& query_type(encryption_query_type query_type); + MONGOCXX_ABI_EXPORT_CDECL(encrypt&) query_type(encryption_query_type query_type); /// /// Gets the current query type. @@ -194,7 +197,7 @@ class encrypt { /// @return /// A query type. /// - const stdx::optional& query_type() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) query_type() const; /// /// Sets the range options to use for encryption. @@ -204,7 +207,7 @@ class encrypt { /// /// @warning The Range algorithm is experimental only. It is not intended for public use. It /// is subject to breaking changes. - encrypt& range_opts(options::range opts); + MONGOCXX_ABI_EXPORT_CDECL(encrypt&) range_opts(options::range opts); /// /// Gets the current range options. @@ -217,12 +220,12 @@ class encrypt { /// /// @warning The Range algorithm is experimental only. It is not intended for public use. It /// is subject to breaking changes. - const stdx::optional& range_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) range_opts() const; private: friend ::mongocxx::v_noabi::client_encryption; - MONGOCXX_PRIVATE void* convert() const; + void* convert() const; stdx::optional _key_id; stdx::optional _key_alt_name; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count-fwd.hpp index be659b1cac..b73413358d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API estimated_document_count; +class estimated_document_count; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count.hpp index 22ab510c8f..9994104e28 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/estimated_document_count.hpp @@ -46,7 +46,8 @@ class estimated_document_count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/count/ /// - estimated_document_count& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(estimated_document_count&) + max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -55,7 +56,8 @@ class estimated_document_count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/count/ /// - const bsoncxx::v_noabi::stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional&) + max_time() const; /// /// Sets the comment for this operation. @@ -69,7 +71,8 @@ class estimated_document_count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/count/ /// - estimated_document_count& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(estimated_document_count&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// The current comment for this operation. @@ -78,7 +81,8 @@ class estimated_document_count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/count/ /// - const bsoncxx::v_noabi::stdx::optional& + MONGOCXX_ABI_EXPORT_CDECL( + const bsoncxx::v_noabi::stdx::optional&) comment() const; /// @@ -93,7 +97,8 @@ class estimated_document_count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/count/ /// - estimated_document_count& read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(estimated_document_count&) + read_preference(mongocxx::v_noabi::read_preference rp); /// /// The current read_preference for this operation. @@ -102,8 +107,9 @@ class estimated_document_count { /// /// @see https://www.mongodb.com/docs/manual/reference/command/count/ /// - const bsoncxx::v_noabi::stdx::optional& read_preference() - const; + MONGOCXX_ABI_EXPORT_CDECL( + const bsoncxx::v_noabi::stdx::optional&) + read_preference() const; private: bsoncxx::v_noabi::stdx::optional _max_time; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find-fwd.hpp index 24dce864a6..06294ecbb7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API find; +class find; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find.hpp index 05f9a3315c..35d2eff063 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find.hpp @@ -55,7 +55,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& allow_disk_use(bool allow_disk_use); + MONGOCXX_ABI_EXPORT_CDECL(find&) allow_disk_use(bool allow_disk_use); /// /// Gets the current setting for allowing disk use on the server. @@ -64,7 +64,7 @@ class find { /// /// @return Whether disk use on the server is allowed. /// - const stdx::optional& allow_disk_use() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) allow_disk_use() const; /// /// Sets whether to allow partial results from a mongos if some shards are down (instead of @@ -79,7 +79,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& allow_partial_results(bool allow_partial); + MONGOCXX_ABI_EXPORT_CDECL(find&) allow_partial_results(bool allow_partial); /// /// Gets the current setting for allowing partial results from mongos. @@ -88,7 +88,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& allow_partial_results() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) allow_partial_results() const; /// /// Sets the number of documents to return per batch. @@ -102,7 +102,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& batch_size(std::int32_t batch_size); + MONGOCXX_ABI_EXPORT_CDECL(find&) batch_size(std::int32_t batch_size); /// /// The current batch size setting. @@ -111,7 +111,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& batch_size() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) batch_size() const; /// /// Sets the collation for this operation. @@ -125,7 +125,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(find&) collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -135,7 +135,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Attaches a comment to the query. If $comment also exists in the modifiers document then @@ -152,7 +153,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& comment(bsoncxx::v_noabi::string::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(find&) comment(bsoncxx::v_noabi::string::view_or_value comment); /// /// Gets the current comment attached to this query. @@ -163,7 +164,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& comment() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + comment() const; /// /// Indicates the type of cursor to use for this query. @@ -177,7 +179,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& cursor_type(cursor::type cursor_type); + MONGOCXX_ABI_EXPORT_CDECL(find&) cursor_type(cursor::type cursor_type); /// /// Gets the current cursor type. @@ -186,7 +188,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& cursor_type() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) cursor_type() const; /// /// Sets the index to use for this operation. @@ -203,7 +205,7 @@ class find { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(find&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. @@ -212,7 +214,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -226,7 +228,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(find&) let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -236,7 +238,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -252,7 +255,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& comment_option(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(find&) + comment_option(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -264,8 +268,9 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& comment_option() - const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + comment_option() const; /// /// Sets maximum number of documents to return. @@ -278,7 +283,7 @@ class find { /// method chaining. /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& limit(std::int64_t limit); + MONGOCXX_ABI_EXPORT_CDECL(find&) limit(std::int64_t limit); /// /// Gets the current limit. @@ -287,7 +292,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& limit() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) limit() const; /// /// Gets the current exclusive upper bound for a specific index. @@ -301,7 +306,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& max(bsoncxx::v_noabi::document::view_or_value max); + MONGOCXX_ABI_EXPORT_CDECL(find&) max(bsoncxx::v_noabi::document::view_or_value max); /// /// Sets the current exclusive upper bound for a specific index. @@ -310,7 +315,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& max() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + max() const; /// /// The maximum amount of time for the server to wait on new documents to satisfy a tailable @@ -329,7 +335,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& max_await_time(std::chrono::milliseconds max_await_time); + MONGOCXX_ABI_EXPORT_CDECL(find&) max_await_time(std::chrono::milliseconds max_await_time); /// /// The maximum amount of time for the server to wait on new documents to satisfy a tailable @@ -339,7 +345,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& max_await_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + max_await_time() const; /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -353,7 +360,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(find&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time_ms setting. @@ -362,7 +369,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Gets the current inclusive lower bound for a specific index. @@ -376,7 +383,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& min(bsoncxx::v_noabi::document::view_or_value min); + MONGOCXX_ABI_EXPORT_CDECL(find&) min(bsoncxx::v_noabi::document::view_or_value min); /// /// Sets the current inclusive lower bound for a specific index. @@ -385,7 +392,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& min() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + min() const; /// /// Sets the cursor flag to prevent cursor from timing out server-side due to a period of @@ -400,7 +408,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& no_cursor_timeout(bool no_cursor_timeout); + MONGOCXX_ABI_EXPORT_CDECL(find&) no_cursor_timeout(bool no_cursor_timeout); /// /// Gets the current no_cursor_timeout setting. @@ -409,7 +417,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& no_cursor_timeout() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) no_cursor_timeout() const; /// /// Sets a projection which limits the returned fields for all matching documents. @@ -423,7 +431,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& projection(bsoncxx::v_noabi::document::view_or_value projection); + MONGOCXX_ABI_EXPORT_CDECL(find&) + projection(bsoncxx::v_noabi::document::view_or_value projection); /// /// Gets the current projection set on this query. @@ -432,7 +441,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& projection() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + projection() const; /// /// Sets the read_preference for this operation. @@ -446,7 +456,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& read_preference(mongocxx::v_noabi::read_preference rp); + MONGOCXX_ABI_EXPORT_CDECL(find&) read_preference(mongocxx::v_noabi::read_preference rp); /// /// The current read_preference for this operation. @@ -456,7 +466,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_preference() const; /// /// Sets whether to return the index keys associated with the query results, instead of the @@ -472,7 +483,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& return_key(bool return_key); + MONGOCXX_ABI_EXPORT_CDECL(find&) return_key(bool return_key); /// /// Gets the current setting for returning the index keys associated with the query results, @@ -484,7 +495,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& return_key() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) return_key() const; /// /// Sets whether to include the record identifier for each document in the query results. @@ -498,7 +509,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& show_record_id(bool show_record_id); + MONGOCXX_ABI_EXPORT_CDECL(find&) show_record_id(bool show_record_id); /// /// Gets the current setting for whether the record identifier is returned for each document in @@ -509,7 +520,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& show_record_id() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) show_record_id() const; /// /// Sets the number of documents to skip before returning results. @@ -523,7 +534,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& skip(std::int64_t skip); + MONGOCXX_ABI_EXPORT_CDECL(find&) skip(std::int64_t skip); /// /// Gets the current number of documents to skip. @@ -532,7 +543,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& skip() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) skip() const; /// /// The order in which to return matching documents. If $orderby also exists in the modifiers @@ -547,7 +558,7 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - find& sort(bsoncxx::v_noabi::document::view_or_value ordering); + MONGOCXX_ABI_EXPORT_CDECL(find&) sort(bsoncxx::v_noabi::document::view_or_value ordering); /// /// Gets the current sort ordering for this query. @@ -556,7 +567,8 @@ class find { /// /// @see https://www.mongodb.com/docs/manual/reference/command/find/ /// - const stdx::optional& sort() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + sort() const; private: stdx::optional _allow_disk_use; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete-fwd.hpp index 015e4bf1ca..eac5176de9 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API find_one_and_delete; +class find_one_and_delete; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete.hpp index b41ea8266b..1fb898a1b0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_delete.hpp @@ -47,7 +47,8 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_delete& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -57,7 +58,8 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -71,7 +73,7 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_delete& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -80,7 +82,7 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Sets a projection that limits the fields to return. @@ -94,7 +96,8 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_delete& projection(bsoncxx::v_noabi::document::view_or_value projection); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) + projection(bsoncxx::v_noabi::document::view_or_value projection); /// /// Gets the current projection set on this operation. @@ -103,7 +106,8 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& projection() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + projection() const; /// /// Sets the order to search for a matching document. @@ -120,7 +124,8 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_delete& sort(bsoncxx::v_noabi::document::view_or_value ordering); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) + sort(bsoncxx::v_noabi::document::view_or_value ordering); /// /// Gets the current sort ordering. @@ -129,7 +134,8 @@ class find_one_and_delete { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& sort() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + sort() const; /// /// Sets the write concern for this operation. @@ -144,7 +150,8 @@ class find_one_and_delete { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_delete& write_concern(mongocxx::v_noabi::write_concern write_concern); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) + write_concern(mongocxx::v_noabi::write_concern write_concern); /// /// Gets the current write concern. @@ -155,7 +162,8 @@ class find_one_and_delete { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Sets the index to use for this operation. @@ -170,14 +178,14 @@ class find_one_and_delete { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_delete& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -189,7 +197,8 @@ class find_one_and_delete { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_delete& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) + let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -197,7 +206,8 @@ class find_one_and_delete { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -209,7 +219,8 @@ class find_one_and_delete { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_delete& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_delete&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -217,7 +228,9 @@ class find_one_and_delete { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; private: stdx::optional _collation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace-fwd.hpp index 88affb96a0..2ff7c41f94 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API find_one_and_replace; +class find_one_and_replace; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace.hpp index aefb85ae8b..f47ac8b005 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_replace.hpp @@ -49,7 +49,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -59,7 +60,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Whether or not to bypass document validation for this operation. @@ -77,7 +79,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + bypass_document_validation(bool bypass_document_validation); /// /// The current setting for bypassing document validation. @@ -86,7 +89,7 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bypass_document_validation() const; /// /// Sets the index to use for this operation. @@ -101,14 +104,14 @@ class find_one_and_replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_replace& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -120,7 +123,8 @@ class find_one_and_replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_replace& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -128,7 +132,8 @@ class find_one_and_replace { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -140,7 +145,8 @@ class find_one_and_replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_replace& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -148,7 +154,9 @@ class find_one_and_replace { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -162,7 +170,7 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -171,7 +179,7 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Sets a projection, which limits the fields to return. @@ -185,7 +193,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& projection(bsoncxx::v_noabi::document::view_or_value projection); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + projection(bsoncxx::v_noabi::document::view_or_value projection); /// /// Gets the current projection for this operation. @@ -194,7 +203,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& projection() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + projection() const; /// /// Set the desired version of the replaced document to return, either the original @@ -210,7 +220,8 @@ class find_one_and_replace { /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// @see mongocxx::v_noabi::options::return_document /// - find_one_and_replace& return_document(return_document return_document); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + return_document(return_document return_document); /// /// Which version of the replaced document to return. @@ -220,7 +231,8 @@ class find_one_and_replace { /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// @see mongocxx::v_noabi::options::return_document /// - const stdx::optional& return_document() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + return_document() const; /// /// Sets the order by which to search the collection for a matching document. @@ -237,7 +249,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& sort(bsoncxx::v_noabi::document::view_or_value ordering); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + sort(bsoncxx::v_noabi::document::view_or_value ordering); /// /// Gets the current sort ordering. @@ -246,7 +259,8 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& sort() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + sort() const; /// /// Sets the upsert flag on the operation. When @c true, the operation creates a new document if @@ -262,7 +276,7 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) upsert(bool upsert); /// /// Gets the current upsert setting. @@ -271,7 +285,7 @@ class find_one_and_replace { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Sets the write concern for this operation. @@ -286,7 +300,8 @@ class find_one_and_replace { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_replace& write_concern(mongocxx::v_noabi::write_concern write_concern); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_replace&) + write_concern(mongocxx::v_noabi::write_concern write_concern); /// /// Gets the current write concern. @@ -297,7 +312,8 @@ class find_one_and_replace { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; private: stdx::optional _bypass_document_validation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update-fwd.hpp index d38a182d85..9ccb8bd949 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API find_one_and_update; +class find_one_and_update; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update.hpp index 86cadd2762..716f858767 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/find_one_and_update.hpp @@ -50,7 +50,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -60,7 +61,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Whether or not to bypass document validation for this operation. @@ -78,7 +80,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + bypass_document_validation(bool bypass_document_validation); /// /// The current setting for bypassing document validation. @@ -87,7 +90,7 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bypass_document_validation() const; /// /// Sets the index to use for this operation. @@ -103,14 +106,14 @@ class find_one_and_update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_update& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -122,7 +125,8 @@ class find_one_and_update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_update& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -130,7 +134,8 @@ class find_one_and_update { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -142,7 +147,8 @@ class find_one_and_update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - find_one_and_update& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -150,7 +156,9 @@ class find_one_and_update { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -164,7 +172,7 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -173,7 +181,7 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) max_time() const; /// /// Sets a projection, which limits the fields to return. @@ -187,7 +195,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& projection(bsoncxx::v_noabi::document::view_or_value projection); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + projection(bsoncxx::v_noabi::document::view_or_value projection); /// /// Gets the current projection for this operation. @@ -196,7 +205,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& projection() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + projection() const; /// /// Set the desired version of the updated document to return, either the original @@ -212,7 +222,8 @@ class find_one_and_update { /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// @see mongocxx::v_noabi::options::return_document /// - find_one_and_update& return_document(return_document return_document); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + return_document(return_document return_document); /// /// Which version of the updated document to return. @@ -222,7 +233,8 @@ class find_one_and_update { /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// @see mongocxx::v_noabi::options::return_document /// - const stdx::optional& return_document() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + return_document() const; /// /// Sets the order by which to search the collection for a matching document. @@ -239,7 +251,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& sort(bsoncxx::v_noabi::document::view_or_value ordering); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + sort(bsoncxx::v_noabi::document::view_or_value ordering); /// /// Gets the current sort ordering. @@ -248,7 +261,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& sort() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + sort() const; /// /// Sets the upsert flag on the operation. When @c true, the operation creates a new document if @@ -264,7 +278,7 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) upsert(bool upsert); /// /// Gets the current upsert setting. @@ -273,7 +287,7 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Sets the write concern for this operation. @@ -288,7 +302,8 @@ class find_one_and_update { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& write_concern(mongocxx::v_noabi::write_concern write_concern); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + write_concern(mongocxx::v_noabi::write_concern write_concern); /// /// Gets the current write concern. @@ -299,7 +314,8 @@ class find_one_and_update { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Set array filters for this operation. @@ -313,7 +329,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - find_one_and_update& array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); + MONGOCXX_ABI_EXPORT_CDECL(find_one_and_update&) + array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); /// /// Get array filters for this operation. @@ -323,7 +340,8 @@ class find_one_and_update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const stdx::optional& array_filters() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + array_filters() const; private: stdx::optional _bypass_document_validation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket-fwd.hpp index 8ebdb2fb6a..6cc2b0f717 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket-fwd.hpp @@ -21,7 +21,7 @@ namespace v_noabi { namespace options { namespace gridfs { -class MONGOCXX_API bucket; +class bucket; } // namespace gridfs } // namespace options diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket.hpp index 6b4969251f..d2f1aee430 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/bucket.hpp @@ -46,7 +46,7 @@ class bucket { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bucket& bucket_name(std::string bucket_name); + MONGOCXX_ABI_EXPORT_CDECL(bucket&) bucket_name(std::string bucket_name); /// /// Gets the name of the bucket. @@ -54,7 +54,7 @@ class bucket { /// @return /// The name of the bucket. /// - const stdx::optional& bucket_name() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bucket_name() const; /// /// Sets the size of the chunks in the bucket. This will be used as the chunk size for files @@ -67,7 +67,7 @@ class bucket { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bucket& chunk_size_bytes(std::int32_t chunk_size_bytes); + MONGOCXX_ABI_EXPORT_CDECL(bucket&) chunk_size_bytes(std::int32_t chunk_size_bytes); /// /// Gets the size of the chunks in the bucket. @@ -75,7 +75,7 @@ class bucket { /// @return /// The size of the chunks in the bucket in bytes. /// - const stdx::optional& chunk_size_bytes() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) chunk_size_bytes() const; /// /// Sets the read concern to be used when reading from the bucket. Defaults to the read @@ -88,7 +88,7 @@ class bucket { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bucket& read_concern(mongocxx::v_noabi::read_concern read_concern); + MONGOCXX_ABI_EXPORT_CDECL(bucket&) read_concern(mongocxx::v_noabi::read_concern read_concern); /// /// Gets the read concern of the bucket. @@ -96,7 +96,8 @@ class bucket { /// @return /// The read concern of the bucket. /// - const stdx::optional& read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_concern() const; /// /// Sets the read preference to be used when reading from the GridFS bucket. Defaults to the @@ -115,7 +116,8 @@ class bucket { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bucket& read_preference(mongocxx::v_noabi::read_preference read_preference); + MONGOCXX_ABI_EXPORT_CDECL(bucket&) + read_preference(mongocxx::v_noabi::read_preference read_preference); /// /// Gets the read preference of the bucket. @@ -123,7 +125,8 @@ class bucket { /// @return /// The read preference of the bucket. /// - const stdx::optional& read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + read_preference() const; /// /// Sets the write concern to be used when writing to the GridFS bucket. Defaults to the write @@ -136,7 +139,8 @@ class bucket { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - bucket& write_concern(mongocxx::v_noabi::write_concern write_concern); + MONGOCXX_ABI_EXPORT_CDECL(bucket&) + write_concern(mongocxx::v_noabi::write_concern write_concern); /// /// Gets the write concern of the bucket. @@ -144,7 +148,8 @@ class bucket { /// @return /// The write concern of the bucket. /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; private: stdx::optional _bucket_name; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload-fwd.hpp index caaf9095f3..b0b6c74af0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload-fwd.hpp @@ -21,7 +21,7 @@ namespace v_noabi { namespace options { namespace gridfs { -class MONGOCXX_API upload; +class upload; } // namespace gridfs } // namespace options diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload.hpp index fcd402adef..8fe2a7aca5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/gridfs/upload.hpp @@ -43,7 +43,7 @@ class upload { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - upload& chunk_size_bytes(std::int32_t chunk_size_bytes); + MONGOCXX_ABI_EXPORT_CDECL(upload&) chunk_size_bytes(std::int32_t chunk_size_bytes); /// /// Gets the chunk size of the GridFS file being uploaded. @@ -51,7 +51,7 @@ class upload { /// @return /// The chunk size of the GridFS file being uploaded in bytes. /// - const stdx::optional& chunk_size_bytes() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) chunk_size_bytes() const; /// /// Sets the metadata field of the GridFS file being uploaded. A GridFS file can store arbitrary @@ -64,7 +64,7 @@ class upload { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - upload& metadata(bsoncxx::v_noabi::document::view_or_value metadata); + MONGOCXX_ABI_EXPORT_CDECL(upload&) metadata(bsoncxx::v_noabi::document::view_or_value metadata); /// /// Gets the metadata of the GridFS file being uploaded. @@ -72,7 +72,8 @@ class upload { /// @return /// The metadata document of the GridFS file. /// - const stdx::optional& metadata() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + metadata() const; private: stdx::optional _chunk_size_bytes; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index-fwd.hpp index d107b4b7eb..4719c392f7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API index; +class index; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp index fe78387e6f..a52a693520 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp @@ -43,20 +43,20 @@ class index { /// /// Base class representing the optional storage engine options for indexes. /// - class MONGOCXX_API base_storage_options { + class MONGOCXX_ABI_EXPORT base_storage_options { public: virtual ~base_storage_options(); private: friend ::mongocxx::v_noabi::options::index; - MONGOCXX_PRIVATE virtual int type() const = 0; + virtual int type() const = 0; }; /// /// Class representing the optional WiredTiger storage engine options for indexes. /// - class MONGOCXX_API wiredtiger_storage_options final : public base_storage_options { + class MONGOCXX_ABI_EXPORT wiredtiger_storage_options final : public base_storage_options { public: ~wiredtiger_storage_options() override; @@ -78,12 +78,12 @@ class index { private: friend ::mongocxx::v_noabi::collection; - MONGOCXX_PRIVATE int type() const override; + MONGOCXX_ABI_NO_EXPORT int type() const override; stdx::optional _config_string; }; - index(); + MONGOCXX_ABI_EXPORT_CDECL() index(); /// /// Whether or not to build the index in the background so that building the index does not @@ -98,14 +98,14 @@ class index { /// /// @see https://www.mongodb.com/docs/manual/tutorial/build-indexes-in-the-background/ /// - index& background(bool background); + MONGOCXX_ABI_EXPORT_CDECL(index&) background(bool background); /// /// The current background setting. /// /// @return The current background. /// - const stdx::optional& background() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) background() const; /// /// Whether or not to create a unique index so that the collection will not accept insertion of @@ -120,14 +120,14 @@ class index { /// /// @see https://www.mongodb.com/docs/manual/core/index-unique/ /// - index& unique(bool unique); + MONGOCXX_ABI_EXPORT_CDECL(index&) unique(bool unique); /// /// The current unique setting. /// /// @return The current unique. /// - const stdx::optional& unique() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) unique() const; /// /// Whether or not the index is hidden from the query planner. A hidden index is not evaluated @@ -142,14 +142,14 @@ class index { /// /// @see https://www.mongodb.com/docs/manual/core/index-hidden/ /// - index& hidden(bool hidden); + MONGOCXX_ABI_EXPORT_CDECL(index&) hidden(bool hidden); /// /// The current hidden setting. /// /// @return The current hidden. /// - const stdx::optional& hidden() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hidden() const; /// /// The name of the index. @@ -161,14 +161,15 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& name(bsoncxx::v_noabi::string::view_or_value name); + MONGOCXX_ABI_EXPORT_CDECL(index&) name(bsoncxx::v_noabi::string::view_or_value name); /// /// The current name setting. /// /// @return The current name. /// - const stdx::optional& name() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + name() const; /// /// Sets the collation for this index. @@ -183,7 +184,7 @@ class index { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - index& collation(bsoncxx::v_noabi::document::view collation); + MONGOCXX_ABI_EXPORT_CDECL(index&) collation(bsoncxx::v_noabi::document::view collation); /// /// Retrieves the current collation for this index. @@ -194,7 +195,8 @@ class index { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Whether or not to create a sparse index. Sparse indexes only reference documents with the @@ -209,14 +211,14 @@ class index { /// /// @see https://www.mongodb.com/docs/manual/core/index-sparse/ /// - index& sparse(bool sparse); + MONGOCXX_ABI_EXPORT_CDECL(index&) sparse(bool sparse); /// /// The current sparse setting. /// /// @return The current sparse setting. /// - const stdx::optional& sparse() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) sparse() const; /// /// Optionally used only in MongoDB 3.0.0 and higher. Specifies the storage engine options for @@ -229,7 +231,8 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& storage_options(std::unique_ptr storage_options); + MONGOCXX_ABI_EXPORT_CDECL(index&) + storage_options(std::unique_ptr storage_options); /// /// Optionally used only in MongoDB 3.0.0 and higher. Specifies the WiredTiger-specific storage @@ -238,7 +241,8 @@ class index { /// @param storage_options /// The storage engine options for the index. /// - index& storage_options(std::unique_ptr storage_options); + MONGOCXX_ABI_EXPORT_CDECL(index&) + storage_options(std::unique_ptr storage_options); /// /// Set a value, in seconds, as a TTL to control how long MongoDB retains documents in this @@ -253,14 +257,14 @@ class index { /// /// @see https://www.mongodb.com/docs/manual/core/index-ttl/ /// - index& expire_after(std::chrono::seconds seconds); + MONGOCXX_ABI_EXPORT_CDECL(index&) expire_after(std::chrono::seconds seconds); /// /// The current expire_after setting. /// /// @return The current expire_after value. /// - const stdx::optional& expire_after() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) expire_after() const; /// /// Sets the index version. @@ -272,14 +276,14 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& version(std::int32_t v); + MONGOCXX_ABI_EXPORT_CDECL(index&) version(std::int32_t v); /// /// The current index version. /// /// @return The current index version. /// - const stdx::optional& version() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) version() const; /// /// For text indexes, sets the weight document. The weight document contains field and weight @@ -292,14 +296,15 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& weights(bsoncxx::v_noabi::document::view weights); + MONGOCXX_ABI_EXPORT_CDECL(index&) weights(bsoncxx::v_noabi::document::view weights); /// /// The current weights setting. /// /// @return The current weights. /// - const stdx::optional& weights() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + weights() const; /// /// For text indexes, the language that determines the list of stop words and the rules for the @@ -312,14 +317,16 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& default_language(bsoncxx::v_noabi::string::view_or_value default_language); + MONGOCXX_ABI_EXPORT_CDECL(index&) + default_language(bsoncxx::v_noabi::string::view_or_value default_language); /// /// The current default_language setting. /// /// @return The current default_language. /// - const stdx::optional& default_language() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + default_language() const; /// /// For text indexes, the name of the field, in the collection’s documents, that contains the @@ -332,14 +339,16 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& language_override(bsoncxx::v_noabi::string::view_or_value language_override); + MONGOCXX_ABI_EXPORT_CDECL(index&) + language_override(bsoncxx::v_noabi::string::view_or_value language_override); /// /// The current name of the field that contains the override language for text indexes. /// /// @return The name of the field that contains the override language for text indexes. /// - const stdx::optional& language_override() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + language_override() const; /// /// Sets the document for the partial filter expression for partial indexes. @@ -351,14 +360,16 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& partial_filter_expression(bsoncxx::v_noabi::document::view partial_filter_expression); + MONGOCXX_ABI_EXPORT_CDECL(index&) + partial_filter_expression(bsoncxx::v_noabi::document::view partial_filter_expression); /// /// The current partial_filter_expression setting. /// /// @return The current partial_filter_expression. /// - const stdx::optional& partial_filter_expression() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + partial_filter_expression() const; /// /// For 2dsphere indexes, the 2dsphere index version number. Version can be either 1 or 2. @@ -370,14 +381,14 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& twod_sphere_version(std::uint8_t twod_sphere_version); + MONGOCXX_ABI_EXPORT_CDECL(index&) twod_sphere_version(std::uint8_t twod_sphere_version); /// /// The current twod_sphere_version setting. /// /// @return The current twod_sphere_version. /// - const stdx::optional& twod_sphere_version() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) twod_sphere_version() const; /// /// For 2d indexes, the precision of the stored geohash value of the location data. @@ -389,14 +400,14 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& twod_bits_precision(std::uint8_t twod_bits_precision); + MONGOCXX_ABI_EXPORT_CDECL(index&) twod_bits_precision(std::uint8_t twod_bits_precision); /// /// The current precision of the stored geohash value of the location data. /// /// @return The precision of the stored geohash value of the location data. /// - const stdx::optional& twod_bits_precision() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) twod_bits_precision() const; /// /// For 2d indexes, the lower inclusive boundary for the longitude and latitude values. @@ -408,14 +419,14 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& twod_location_min(double twod_location_min); + MONGOCXX_ABI_EXPORT_CDECL(index&) twod_location_min(double twod_location_min); /// /// The current lower inclusive boundary for the longitude and latitude values. /// /// @return The lower inclusive boundary for the longitude and latitude values. /// - const stdx::optional& twod_location_min() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) twod_location_min() const; /// /// For 2d indexes, the upper inclusive boundary for the longitude and latitude values. @@ -427,14 +438,14 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - index& twod_location_max(double twod_location_max); + MONGOCXX_ABI_EXPORT_CDECL(index&) twod_location_max(double twod_location_max); /// /// The current upper inclusive boundary for the longitude and latitude values. /// /// @return The upper inclusive boundary for the longitude and latitude values. /// - const stdx::optional& twod_location_max() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) twod_location_max() const; /// /// For geoHaystack indexes, specify the number of units within which to group the location @@ -453,8 +464,9 @@ class index { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - MONGOCXX_DEPRECATED index& haystack_bucket_size(double haystack_bucket_size); - index& haystack_bucket_size_deprecated(double haystack_bucket_size); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(index&) + haystack_bucket_size(double haystack_bucket_size); + MONGOCXX_ABI_EXPORT_CDECL(index&) haystack_bucket_size_deprecated(double haystack_bucket_size); /// /// The current haystack_bucket_size setting. @@ -464,8 +476,10 @@ class index { /// @deprecated /// This method is deprecated. /// - MONGOCXX_DEPRECATED const stdx::optional& haystack_bucket_size() const; - const stdx::optional& haystack_bucket_size_deprecated() const; + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + haystack_bucket_size() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + haystack_bucket_size_deprecated() const; /// /// Conversion operator that provides a view of the options in document form. @@ -475,7 +489,7 @@ class index { /// /// @return A view of the current builder contents. /// - operator bsoncxx::v_noabi::document::view_or_value(); + MONGOCXX_ABI_EXPORT_CDECL() operator bsoncxx::v_noabi::document::view_or_value(); private: friend ::mongocxx::v_noabi::collection; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view-fwd.hpp index 773334b2a0..3bac1aa4a6 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API index_view; +class index_view; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view.hpp index c088398d33..922eeef5c7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index_view.hpp @@ -33,7 +33,7 @@ namespace options { /// class index_view { public: - index_view(); + MONGOCXX_ABI_EXPORT_CDECL() index_view(); /// /// Sets the maximum amount of time for this operation to run (server-side) in milliseconds. @@ -48,7 +48,7 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - index_view& max_time(std::chrono::milliseconds max_time); + MONGOCXX_ABI_EXPORT_CDECL(index_view&) max_time(std::chrono::milliseconds max_time); /// /// The current max_time setting. @@ -59,7 +59,8 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const bsoncxx::v_noabi::stdx::optional& max_time() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::stdx::optional&) + max_time() const; /// /// Sets the write concern for this operation. @@ -74,7 +75,8 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - index_view& write_concern(mongocxx::v_noabi::write_concern write_concern); + MONGOCXX_ABI_EXPORT_CDECL(index_view&) + write_concern(mongocxx::v_noabi::write_concern write_concern); /// /// Gets the current write concern. @@ -85,7 +87,9 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/findAndModify/ /// - const bsoncxx::v_noabi::stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL( + const bsoncxx::v_noabi::stdx::optional&) + write_concern() const; /// /// Sets the commit quorum for this operation. @@ -104,7 +108,7 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/createIndexes /// - index_view& commit_quorum(std::int32_t commit_quorum); + MONGOCXX_ABI_EXPORT_CDECL(index_view&) commit_quorum(std::int32_t commit_quorum); /// /// Sets the commit quorum for this operation. @@ -123,7 +127,7 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/createIndexes /// - index_view& commit_quorum(std::string commit_quorum); + MONGOCXX_ABI_EXPORT_CDECL(index_view&) commit_quorum(std::string commit_quorum); /// /// Gets the current commitQuorum setting. @@ -136,7 +140,8 @@ class index_view { /// @see /// https://www.mongodb.com/docs/manual/reference/command/createIndexes /// - const stdx::optional commit_quorum() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + commit_quorum() const; private: bsoncxx::v_noabi::stdx::optional _max_time; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert-fwd.hpp index beeb1f5363..51760cb4f7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API insert; +class insert; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert.hpp index a790ed282d..461539e016 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/insert.hpp @@ -48,14 +48,14 @@ class insert { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - insert& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(insert&) bypass_document_validation(bool bypass_document_validation); /// /// Gets the current value of the bypass_document_validation option. /// /// @return The optional value of the bypass_document_validation option. /// - const stdx::optional& bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bypass_document_validation() const; /// /// Sets the write_concern for this operation. @@ -69,7 +69,7 @@ class insert { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - insert& write_concern(mongocxx::v_noabi::write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(insert&) write_concern(mongocxx::v_noabi::write_concern wc); /// /// The current write_concern for this operation. @@ -78,7 +78,8 @@ class insert { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// @note: This applies only to insert_many and is ignored for insert_one. @@ -97,7 +98,7 @@ class insert { /// /// @see https://www.mongodb.com/docs/manual/reference/command/insert/ /// - insert& ordered(bool ordered); + MONGOCXX_ABI_EXPORT_CDECL(insert&) ordered(bool ordered); /// /// The current ordered value for this operation. @@ -106,7 +107,7 @@ class insert { /// /// @see https://www.mongodb.com/docs/manual/reference/command/insert/ /// - const stdx::optional& ordered() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) ordered() const; /// /// Sets the comment for this operation. @@ -120,7 +121,8 @@ class insert { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - insert& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(insert&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// The current comment for this operation. @@ -129,7 +131,9 @@ class insert { /// /// @see https://www.mongodb.com/docs/manual/reference/command/insert/ /// - const stdx::optional& comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + comment() const; private: stdx::optional _write_concern; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool-fwd.hpp index 7edcc1fb44..be24696954 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API pool; +class pool; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool.hpp index eec3ff1566..dd71b419d9 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/pool.hpp @@ -37,14 +37,14 @@ class pool { /// @param client_opts /// The client options. /// - pool(client client_opts = client()); + MONGOCXX_ABI_EXPORT_CDECL() pool(client client_opts = client()); /// /// The current client options. /// /// @return The client options. /// - const client& client_opts() const; + MONGOCXX_ABI_EXPORT_CDECL(const client&) client_opts() const; private: client _client_opts; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range-fwd.hpp index 586d8b3760..abe76b03c7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API range; +class range; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range.hpp index f04b02ec07..5950871945 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/range.hpp @@ -44,33 +44,37 @@ class range { public: /// @brief Sets `RangeOpts.min`. /// @note Required if @ref precision is set. - range& min(bsoncxx::v_noabi::types::bson_value::view_or_value value); + MONGOCXX_ABI_EXPORT_CDECL(range&) min(bsoncxx::v_noabi::types::bson_value::view_or_value value); /// @brief Gets `RangeOpts.min`. /// @note Required if @ref precision is set. - const stdx::optional& min() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + min() const; /// @brief Sets `RangeOpts.max`. /// @note Required if @ref precision is set. - range& max(bsoncxx::v_noabi::types::bson_value::view_or_value value); + MONGOCXX_ABI_EXPORT_CDECL(range&) max(bsoncxx::v_noabi::types::bson_value::view_or_value value); /// @brief Gets `RangeOpts.max`. /// @note Required if @ref precision is set. - const stdx::optional& max() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional&) + max() const; /// @brief Sets `RangeOpts.sparsity`. - range& sparsity(std::int64_t value); + MONGOCXX_ABI_EXPORT_CDECL(range&) sparsity(std::int64_t value); /// @brief Gets `RangeOpts.sparsity`. - const stdx::optional& sparsity() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) sparsity() const; /// @brief Sets `RangeOpts.precision`. /// @note May only be set for `double` or `decimal128`. - range& precision(std::int32_t value); + MONGOCXX_ABI_EXPORT_CDECL(range&) precision(std::int32_t value); /// @brief Gets `RangeOpts.precision`. /// @note May only be set for `double` or `decimal128`. - const stdx::optional& precision() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) precision() const; private: stdx::optional _min; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace-fwd.hpp index f0ac38fca4..08f3f9d8ed 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API replace; +class replace; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace.hpp index 0afbd8852d..22f33e825d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/replace.hpp @@ -50,14 +50,14 @@ class replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - replace& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(replace&) bypass_document_validation(bool bypass_document_validation); /// /// Gets the current value of the bypass_document_validation option. /// /// @return The optional value of the bypass_document_validation option. /// - const stdx::optional& bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bypass_document_validation() const; /// /// Sets the collation for this operation. @@ -72,7 +72,8 @@ class replace { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - replace& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(replace&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -83,7 +84,8 @@ class replace { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the upsert option. @@ -101,14 +103,14 @@ class replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - replace& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(replace&) upsert(bool upsert); /// /// Gets the current value of the upsert option. /// /// @return The optional value of the upsert option. /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Sets the write_concern for this operation. @@ -122,7 +124,7 @@ class replace { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - replace& write_concern(mongocxx::v_noabi::write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(replace&) write_concern(mongocxx::v_noabi::write_concern wc); /// /// The current write_concern for this operation. @@ -132,7 +134,8 @@ class replace { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Sets the index to use for this operation. @@ -147,14 +150,14 @@ class replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - replace& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(replace&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -166,7 +169,7 @@ class replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - replace& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(replace&) let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -174,7 +177,8 @@ class replace { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -186,7 +190,8 @@ class replace { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - replace& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(replace&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -194,7 +199,9 @@ class replace { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; private: stdx::optional _bypass_document_validation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey-fwd.hpp index 26a5b9babe..84cb6b77d8 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API rewrap_many_datakey; +class rewrap_many_datakey; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey.hpp index c17b0d9f0b..fdd846782a 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/rewrap_many_datakey.hpp @@ -50,7 +50,8 @@ class rewrap_many_datakey { /// @see /// https://www.mongodb.com/docs/manual/core/csfle/reference/kms-providers/#std-label-csfle-reference-kms-providers /// - rewrap_many_datakey& provider(bsoncxx::v_noabi::string::view_or_value provider); + MONGOCXX_ABI_EXPORT_CDECL(rewrap_many_datakey&) + provider(bsoncxx::v_noabi::string::view_or_value provider); /// /// Get the KMS provider @@ -65,7 +66,7 @@ class rewrap_many_datakey { /// @see /// https://www.mongodb.com/docs/manual/core/csfle/reference/kms-providers/#std-label-csfle-reference-kms-providers /// - bsoncxx::v_noabi::string::view_or_value provider() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::string::view_or_value) provider() const; /// /// Set the masterKey option. @@ -82,7 +83,8 @@ class rewrap_many_datakey { /// @see /// https://www.mongodb.com/docs/manual/core/csfle/reference/kms-providers/#std-label-csfle-reference-kms-providers-create-and-store /// - rewrap_many_datakey& master_key(bsoncxx::v_noabi::document::view_or_value master_key); + MONGOCXX_ABI_EXPORT_CDECL(rewrap_many_datakey&) + master_key(bsoncxx::v_noabi::document::view_or_value master_key); /// /// Get the masterKey option. @@ -97,7 +99,8 @@ class rewrap_many_datakey { /// @see /// https://www.mongodb.com/docs/manual/core/csfle/reference/kms-providers/#std-label-csfle-reference-kms-providers-create-and-store /// - const stdx::optional& master_key() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + master_key() const; private: friend ::mongocxx::v_noabi::client_encryption; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api-fwd.hpp index b604db7b78..2dfb73a352 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API server_api; +class server_api; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api.hpp index ba6383854b..ddaaa7f36b 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/server_api.hpp @@ -51,7 +51,7 @@ class server_api { /// @param version /// The server api version to send to the server. /// - server_api(version version); + MONGOCXX_ABI_EXPORT_CDECL() server_api(version version); /// /// Converts a version enum value to its string value. @@ -64,7 +64,7 @@ class server_api { /// @return /// The string value of the given enum value. /// - static std::string version_to_string(version version); + static MONGOCXX_ABI_EXPORT_CDECL(std::string) version_to_string(version version); /// /// Converts a version string to its enum value. @@ -77,7 +77,7 @@ class server_api { /// @return /// The enum value of the given string. /// - static version version_from_string(stdx::string_view version); + static MONGOCXX_ABI_EXPORT_CDECL(version) version_from_string(stdx::string_view version); /// /// Sets the strict option, specifying whether the server should return @@ -89,7 +89,7 @@ class server_api { /// @return /// A reference to this object to facilitate method chaining. /// - server_api& strict(bool strict); + MONGOCXX_ABI_EXPORT_CDECL(server_api&) strict(bool strict); /// /// Gets the current value of the strict option. @@ -97,7 +97,7 @@ class server_api { /// @return /// The optional value of the strict option. /// - const stdx::optional& strict() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) strict() const; /// /// Sets the deprecation errors option, specifying whether the server should @@ -109,7 +109,7 @@ class server_api { /// @return /// A reference to this object to facilitate method chaining. /// - server_api& deprecation_errors(bool deprecation_errors); + MONGOCXX_ABI_EXPORT_CDECL(server_api&) deprecation_errors(bool deprecation_errors); /// /// Gets the current value of the deprecation errors option. @@ -117,7 +117,7 @@ class server_api { /// @return /// The optional value of the deprecation errors option. /// - const stdx::optional& deprecation_errors() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) deprecation_errors() const; /// /// Gets the declared server api version. @@ -125,7 +125,7 @@ class server_api { /// @return /// The version enum value specifying the declared server api version. /// - version get_version() const; + MONGOCXX_ABI_EXPORT_CDECL(version) get_version() const; private: friend ::mongocxx::v_noabi::client; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls-fwd.hpp index 6e777636b7..82ad014608 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API tls; +class tls; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls.hpp index 8118a427a5..af206ccefa 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/tls.hpp @@ -44,14 +44,15 @@ class tls { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - tls& pem_file(bsoncxx::v_noabi::string::view_or_value pem_file); + MONGOCXX_ABI_EXPORT_CDECL(tls&) pem_file(bsoncxx::v_noabi::string::view_or_value pem_file); /// /// Retrieves the current path to the .pem file. /// /// @return The path to the .pem file. /// - const stdx::optional& pem_file() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + pem_file() const; /// /// The pass phrase used to decrypt an encrypted PEM file. @@ -63,14 +64,16 @@ class tls { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - tls& pem_password(bsoncxx::v_noabi::string::view_or_value pem_password); + MONGOCXX_ABI_EXPORT_CDECL(tls&) + pem_password(bsoncxx::v_noabi::string::view_or_value pem_password); /// /// Retrieves the current decryption pass phrase. /// /// @return The pass phrase. /// - const stdx::optional& pem_password() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + pem_password() const; /// /// The path to the .pem file that contains the root certificate chain from the Certificate @@ -83,14 +86,15 @@ class tls { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - tls& ca_file(bsoncxx::v_noabi::string::view_or_value ca_file); + MONGOCXX_ABI_EXPORT_CDECL(tls&) ca_file(bsoncxx::v_noabi::string::view_or_value ca_file); /// /// Retrieves the current path to the CA file. /// /// @return The path to the CA file. /// - const stdx::optional& ca_file() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + ca_file() const; /// /// The path to the Certificate Authority directory. @@ -102,14 +106,15 @@ class tls { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - tls& ca_dir(bsoncxx::v_noabi::string::view_or_value ca_dir); + MONGOCXX_ABI_EXPORT_CDECL(tls&) ca_dir(bsoncxx::v_noabi::string::view_or_value ca_dir); /// /// Retrieves the current path to the CA directory. /// /// @return The path to the CA directory. /// - const stdx::optional& ca_dir() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + ca_dir() const; /// /// The path to the .pem file that contains revoked certificates. @@ -121,14 +126,15 @@ class tls { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - tls& crl_file(bsoncxx::v_noabi::string::view_or_value crl_file); + MONGOCXX_ABI_EXPORT_CDECL(tls&) crl_file(bsoncxx::v_noabi::string::view_or_value crl_file); /// /// Retrieves the current path to the .pem file that contains revoked certificates. /// /// @return The path to the revoked certificates file. /// - const stdx::optional& crl_file() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + crl_file() const; /// /// If true, the driver will not verify the server's CA file. @@ -140,14 +146,14 @@ class tls { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - tls& allow_invalid_certificates(bool allow_invalid_certificates); + MONGOCXX_ABI_EXPORT_CDECL(tls&) allow_invalid_certificates(bool allow_invalid_certificates); /// /// Retrieves whether or not the driver will check the server's CA file. /// /// @return Whether or not the driver will check the server's CA file. /// - const stdx::optional& allow_invalid_certificates() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) allow_invalid_certificates() const; private: stdx::optional _pem_file; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction-fwd.hpp index 4d8ec9c644..e73df0d36e 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API transaction; +class transaction; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction.hpp index e4ad754215..b6126247cf 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/transaction.hpp @@ -37,32 +37,32 @@ namespace options { /// class transaction { public: - transaction(); + MONGOCXX_ABI_EXPORT_CDECL() transaction(); /// /// Copy constructs transaction options. /// - transaction(const transaction&); + MONGOCXX_ABI_EXPORT_CDECL() transaction(const transaction&); /// /// Copy assigns transaction options. /// - transaction& operator=(const transaction&); + MONGOCXX_ABI_EXPORT_CDECL(transaction&) operator=(const transaction&); /// /// Move constructs transaction options. /// - transaction(transaction&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() transaction(transaction&&) noexcept; /// /// Move assigns transaction options. /// - transaction& operator=(transaction&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(transaction&) operator=(transaction&&) noexcept; /// /// Destroys the transaction options. /// - ~transaction() noexcept; + MONGOCXX_ABI_EXPORT_CDECL() ~transaction() noexcept; /// /// Sets the transaction read concern. @@ -74,7 +74,7 @@ class transaction { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - transaction& read_concern(const mongocxx::v_noabi::read_concern& rc); + MONGOCXX_ABI_EXPORT_CDECL(transaction&) read_concern(const mongocxx::v_noabi::read_concern& rc); /// /// Gets the current transaction read concern. @@ -82,7 +82,7 @@ class transaction { /// @return /// An optional containing the read concern. If the read concern has not been set, a /// disengaged optional is returned. - stdx::optional read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) read_concern() const; /// /// Sets the transaction write concern. @@ -94,7 +94,8 @@ class transaction { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - transaction& write_concern(const mongocxx::v_noabi::write_concern& wc); + MONGOCXX_ABI_EXPORT_CDECL(transaction&) + write_concern(const mongocxx::v_noabi::write_concern& wc); /// /// Gets the current transaction write concern. @@ -104,7 +105,8 @@ class transaction { /// @return /// An optional containing the write concern. If the write concern has not been set, a /// disengaged optional is returned. - stdx::optional write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + write_concern() const; /// /// Sets the transaction read preference. @@ -116,7 +118,8 @@ class transaction { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - transaction& read_preference(const mongocxx::v_noabi::read_preference& rp); + MONGOCXX_ABI_EXPORT_CDECL(transaction&) + read_preference(const mongocxx::v_noabi::read_preference& rp); /// /// Gets the current transaction read preference. @@ -124,7 +127,8 @@ class transaction { /// @return /// An optional containing the read preference. If the read preference has not been set, a /// disengaged optional is returned. - stdx::optional read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + read_preference() const; /// /// Sets the transaction's max commit time, in milliseconds. @@ -135,7 +139,7 @@ class transaction { /// @return /// A reference to the object on which this function is being called. /// - transaction& max_commit_time_ms(std::chrono::milliseconds ms); + MONGOCXX_ABI_EXPORT_CDECL(transaction&) max_commit_time_ms(std::chrono::milliseconds ms); /// /// Gets the current transaction commit time, in milliseconds. @@ -144,15 +148,15 @@ class transaction { /// An optional containing the timeout. If the max commit time has not been set, /// a disengaged optional is returned. /// - stdx::optional max_commit_time_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) max_commit_time_ms() const; private: friend ::mongocxx::v_noabi::client_session; - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE impl& _get_impl(); - MONGOCXX_PRIVATE const impl& _get_impl() const; + impl& _get_impl(); + const impl& _get_impl() const; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update-fwd.hpp index bfd1527f9d..6312f80374 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace options { -class MONGOCXX_API update; +class update; } // namespace options } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update.hpp index 9cd58af626..6c0a5ffe42 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/update.hpp @@ -50,14 +50,14 @@ class update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update& bypass_document_validation(bool bypass_document_validation); + MONGOCXX_ABI_EXPORT_CDECL(update&) bypass_document_validation(bool bypass_document_validation); /// /// Gets the current value of the bypass_document_validation option. /// /// @return The optional value of the bypass_document_validation option. /// - const stdx::optional& bypass_document_validation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) bypass_document_validation() const; /// /// Sets the collation for this operation. @@ -72,7 +72,8 @@ class update { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - update& collation(bsoncxx::v_noabi::document::view_or_value collation); + MONGOCXX_ABI_EXPORT_CDECL(update&) + collation(bsoncxx::v_noabi::document::view_or_value collation); /// /// Retrieves the current collation for this operation. @@ -83,7 +84,8 @@ class update { /// @see /// https://www.mongodb.com/docs/manual/reference/collation/ /// - const stdx::optional& collation() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + collation() const; /// /// Sets the index to use for this operation. @@ -98,14 +100,14 @@ class update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update& hint(mongocxx::v_noabi::hint index_hint); + MONGOCXX_ABI_EXPORT_CDECL(update&) hint(mongocxx::v_noabi::hint index_hint); /// /// Gets the current hint. /// /// @return The current hint, if one is set. /// - const stdx::optional& hint() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) hint() const; /// /// Set the value of the let option. @@ -117,7 +119,7 @@ class update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update& let(bsoncxx::v_noabi::document::view_or_value let); + MONGOCXX_ABI_EXPORT_CDECL(update&) let(bsoncxx::v_noabi::document::view_or_value let); /// /// Gets the current value of the let option. @@ -125,7 +127,8 @@ class update { /// @return /// The current let option. /// - const stdx::optional let() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) + let() const; /// /// Set the value of the comment option. @@ -137,7 +140,8 @@ class update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update& comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); + MONGOCXX_ABI_EXPORT_CDECL(update&) + comment(bsoncxx::v_noabi::types::bson_value::view_or_value comment); /// /// Gets the current value of the comment option. @@ -145,7 +149,9 @@ class update { /// @return /// The current comment option. /// - const stdx::optional comment() const; + MONGOCXX_ABI_EXPORT_CDECL( + const stdx::optional) + comment() const; /// /// Sets the upsert option. @@ -163,14 +169,14 @@ class update { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - update& upsert(bool upsert); + MONGOCXX_ABI_EXPORT_CDECL(update&) upsert(bool upsert); /// /// Gets the current value of the upsert option. /// /// @return The optional value of the upsert option. /// - const stdx::optional& upsert() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) upsert() const; /// /// Sets the write_concern for this operation. @@ -184,7 +190,7 @@ class update { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - update& write_concern(mongocxx::v_noabi::write_concern wc); + MONGOCXX_ABI_EXPORT_CDECL(update&) write_concern(mongocxx::v_noabi::write_concern wc); /// /// The current write_concern for this operation. @@ -194,7 +200,8 @@ class update { /// /// @see https://www.mongodb.com/docs/manual/core/write-concern/ /// - const stdx::optional& write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + write_concern() const; /// /// Set array filters for this operation. @@ -208,7 +215,8 @@ class update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - update& array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); + MONGOCXX_ABI_EXPORT_CDECL(update&) + array_filters(bsoncxx::v_noabi::array::view_or_value array_filters); /// /// Get array filters for this operation. @@ -218,7 +226,8 @@ class update { /// /// @see https://www.mongodb.com/docs/manual/reference/command/update/ /// - const stdx::optional& array_filters() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + array_filters() const; private: stdx::optional _bypass_document_validation; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline-fwd.hpp index 43d81f4525..e7c4b733ec 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API pipeline; +class pipeline; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline.hpp index 3277b10d7b..d9fa98ae65 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pipeline.hpp @@ -43,25 +43,25 @@ class pipeline { /// /// @see https://www.mongodb.com/docs/manual/core/aggregation-pipeline/ /// - pipeline(); + MONGOCXX_ABI_EXPORT_CDECL() pipeline(); /// /// Move constructs a pipeline. /// - pipeline(pipeline&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() pipeline(pipeline&&) noexcept; /// /// Move assigns a pipeline. /// - pipeline& operator=(pipeline&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) operator=(pipeline&&) noexcept; /// /// Destroys a pipeline. /// - ~pipeline(); + MONGOCXX_ABI_EXPORT_CDECL() ~pipeline(); pipeline(const pipeline&) = delete; - pipeline& operator=(const pipeline&) = delete; + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) operator=(const pipeline&) = delete; /// /// Adds new fields to documents. @@ -77,7 +77,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& add_fields(bsoncxx::v_noabi::document::view_or_value fields_to_add); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + add_fields(bsoncxx::v_noabi::document::view_or_value fields_to_add); /// /// Categorizes documents into groups, called buckets, based on a specified expression and @@ -93,7 +94,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& bucket(bsoncxx::v_noabi::document::view_or_value bucket_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + bucket(bsoncxx::v_noabi::document::view_or_value bucket_args); /// /// Categorizes documents into a specific number of groups, called buckets, based on a @@ -110,7 +112,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& bucket_auto(bsoncxx::v_noabi::document::view_or_value bucket_auto_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + bucket_auto(bsoncxx::v_noabi::document::view_or_value bucket_auto_args); /// /// Returns statistics regarding a collection or view. @@ -125,8 +128,9 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& coll_stats(bsoncxx::v_noabi::document::view_or_value coll_stats_args = - bsoncxx::v_noabi::document::view{}); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + coll_stats(bsoncxx::v_noabi::document::view_or_value coll_stats_args = + bsoncxx::v_noabi::document::view{}); /// /// Returns a document containing a count of the number of documents input to the stage. @@ -140,7 +144,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& count(std::string field); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) count(std::string field); /// /// Returns a stream of documents containing information on active and/or dormant @@ -157,7 +161,8 @@ class pipeline { /// @return /// A reference to the object on which this method is being called. /// - pipeline& current_op(bsoncxx::v_noabi::document::view_or_value current_op_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + current_op(bsoncxx::v_noabi::document::view_or_value current_op_args); /// /// Processes multiple aggregation pipelines within a single stage on the same set of input @@ -173,7 +178,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& facet(bsoncxx::v_noabi::document::view_or_value facet_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + facet(bsoncxx::v_noabi::document::view_or_value facet_args); /// /// Appends a stage to this pipeline object. @@ -190,7 +196,8 @@ class pipeline { /// @return /// A reference to this object on which this member function is being called. /// - pipeline& append_stage(bsoncxx::v_noabi::document::view_or_value stage); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + append_stage(bsoncxx::v_noabi::document::view_or_value stage); /// /// Appends stages to this pipeline object from the given bson array. @@ -207,7 +214,8 @@ class pipeline { /// @return /// A reference to the object on which this member function is being called. /// - pipeline& append_stages(bsoncxx::v_noabi::array::view_or_value stages); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + append_stages(bsoncxx::v_noabi::array::view_or_value stages); /// /// Outputs documents in order of nearest to farthest from a specified point. @@ -222,7 +230,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& geo_near(bsoncxx::v_noabi::document::view_or_value geo_near_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + geo_near(bsoncxx::v_noabi::document::view_or_value geo_near_args); /// /// Performs a recursive search on a collection. @@ -237,7 +246,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& graph_lookup(bsoncxx::v_noabi::document::view_or_value graph_lookup_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + graph_lookup(bsoncxx::v_noabi::document::view_or_value graph_lookup_args); /// /// Groups documents by some specified expression and outputs to the next stage a @@ -257,7 +267,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& group(bsoncxx::v_noabi::document::view_or_value group_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + group(bsoncxx::v_noabi::document::view_or_value group_args); /// /// Returns statistics regarding the use of each index for the collection. @@ -268,7 +279,7 @@ class pipeline { /// /// @see https://www.mongodb.com/docs/manual/reference/operator/aggregation/indexStats/ /// - pipeline& index_stats(); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) index_stats(); /// /// Limits the number of documents passed to the next stage in the pipeline. @@ -282,7 +293,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& limit(std::int32_t limit); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) limit(std::int32_t limit); /// /// Lists the sessions cached in memory by the mongod or mongos instance. @@ -297,8 +308,8 @@ class pipeline { /// @return /// A reference to the object on which this method is being called. /// - pipeline& list_local_sessions( - bsoncxx::v_noabi::document::view_or_value list_local_sessions_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + list_local_sessions(bsoncxx::v_noabi::document::view_or_value list_local_sessions_args); /// /// Lists all sessions stored in the system.sessions collection in the config database. @@ -312,7 +323,8 @@ class pipeline { /// @return /// A reference to the object on which this method is being called. /// - pipeline& list_sessions(bsoncxx::v_noabi::document::view_or_value list_sessions_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + list_sessions(bsoncxx::v_noabi::document::view_or_value list_sessions_args); /// /// Performs a left outer join to an unsharded collection in the same database to filter in @@ -328,7 +340,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& lookup(bsoncxx::v_noabi::document::view_or_value lookup_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + lookup(bsoncxx::v_noabi::document::view_or_value lookup_args); /// /// Filters the documents. Only the documents that match the condition(s) specified by the @@ -343,7 +356,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& match(bsoncxx::v_noabi::document::view_or_value filter); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) match(bsoncxx::v_noabi::document::view_or_value filter); /// /// Outputs the aggregation results to a collection. @@ -358,7 +371,8 @@ class pipeline { /// @return /// A reference to the object on which this member function is being called. /// - pipeline& merge(bsoncxx::v_noabi::document::view_or_value merge_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + merge(bsoncxx::v_noabi::document::view_or_value merge_args); /// /// Takes documents returned by the aggregation pipeline and writes them to a specified @@ -374,7 +388,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& out(std::string collection_name); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) out(std::string collection_name); /// /// Projects a subset of the fields in the documents to the next stage of the pipeline. @@ -388,7 +402,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& project(bsoncxx::v_noabi::document::view_or_value projection); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + project(bsoncxx::v_noabi::document::view_or_value projection); /// /// Restricts the contents of the documents based on information stored in the documents @@ -403,7 +418,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& redact(bsoncxx::v_noabi::document::view_or_value restrictions); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + redact(bsoncxx::v_noabi::document::view_or_value restrictions); /// /// Promotes a specified document to the top level and replaces all other fields. @@ -418,7 +434,8 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& replace_root(bsoncxx::v_noabi::document::view_or_value replace_root_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + replace_root(bsoncxx::v_noabi::document::view_or_value replace_root_args); /// /// Randomly selects the specified number of documents that pass into the stage and passes the @@ -433,7 +450,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& sample(std::int32_t size); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) sample(std::int32_t size); /// /// Skips over the specified number of documents that pass into the stage and passes the @@ -448,7 +465,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& skip(std::int32_t docs_to_skip); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) skip(std::int32_t docs_to_skip); /// /// Sorts all input documents and returns them to the pipeline in sorted order. @@ -462,7 +479,7 @@ class pipeline { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - pipeline& sort(bsoncxx::v_noabi::document::view_or_value ordering); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) sort(bsoncxx::v_noabi::document::view_or_value ordering); /// /// Groups incoming documents based on the value of a specified expression, then computes the @@ -481,7 +498,8 @@ class pipeline { /// This overload of sort_by_count() is intended to be used when the desired sort is over a /// grouping of the result of a complex expression computed from the input documents. /// - pipeline& sort_by_count(bsoncxx::v_noabi::document::view_or_value field_expression); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + sort_by_count(bsoncxx::v_noabi::document::view_or_value field_expression); /// /// Groups incoming documents based on the value of a specified expression, then computes the @@ -501,7 +519,7 @@ class pipeline { /// This overload of sort_by_count() is intended to be used when the desired sort is over a /// grouping of the value of a particular element in the input documents. /// - pipeline& sort_by_count(std::string field_expression); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) sort_by_count(std::string field_expression); /// /// Deconstructs an array field from the input documents to output a document for each element. @@ -521,7 +539,8 @@ class pipeline { /// This overload of unwind() is intended to be used when additional options other than the /// field name need to be specified. /// - pipeline& unwind(bsoncxx::v_noabi::document::view_or_value unwind_args); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) + unwind(bsoncxx::v_noabi::document::view_or_value unwind_args); /// /// Deconstructs an array field from the input documents to output a document for each element. @@ -541,19 +560,19 @@ class pipeline { /// This overload of unwind() is intended to be used when no options other than the field name /// need to be specified. /// - pipeline& unwind(std::string field_name); + MONGOCXX_ABI_EXPORT_CDECL(pipeline&) unwind(std::string field_name); /// /// @return A view of the underlying BSON array this pipeline represents. /// - bsoncxx::v_noabi::array::view view_array() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::array::view) view_array() const; private: friend ::mongocxx::v_noabi::client; friend ::mongocxx::v_noabi::collection; friend ::mongocxx::v_noabi::database; - class MONGOCXX_PRIVATE impl; + class impl; std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool-fwd.hpp index ff7e44f95a..806d310a20 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API pool; +class pool; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp index 6dc7680b8d..71e8f79ee8 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp @@ -60,13 +60,13 @@ class pool { /// @throws mongocxx::v_noabi::exception if invalid options are provided (whether from the URI /// or /// provided client options). - explicit pool(const uri& mongodb_uri = mongocxx::v_noabi::uri(), - const options::pool& options = options::pool()); + explicit MONGOCXX_ABI_EXPORT_CDECL() pool(const uri& mongodb_uri = mongocxx::v_noabi::uri(), + const options::pool& options = options::pool()); /// /// Destroys a pool. /// - ~pool(); + MONGOCXX_ABI_EXPORT_CDECL() ~pool(); pool(pool&&) = delete; pool& operator=(pool&&) = delete; @@ -81,35 +81,38 @@ class pool { /// @note The lifetime of any entry object must be a subset of the pool object /// from which it was acquired. /// - class MONGOCXX_API entry { + class entry { public: /// Access a member of the client instance. - client* operator->() const& noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client*) operator->() const& noexcept; client* operator->() && = delete; /// Retrieve a reference to the client. - client& operator*() const& noexcept; + MONGOCXX_ABI_EXPORT_CDECL(client&) operator*() const& noexcept; client& operator*() && = delete; /// Assign nullptr to this entry to release its client to the pool. - entry& operator=(std::nullptr_t) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(entry&) operator=(std::nullptr_t) noexcept; /// Return true if this entry has a client acquired from the pool. - explicit operator bool() const noexcept; + explicit MONGOCXX_ABI_EXPORT_CDECL() operator bool() const noexcept; // Allows the pool_entry["db_name"] syntax to be used to access a database within the // entry's underlying client. - MONGOCXX_INLINE mongocxx::v_noabi::database operator[]( - bsoncxx::v_noabi::string::view_or_value name) const&; + mongocxx::v_noabi::database operator[]( + bsoncxx::v_noabi::string::view_or_value name) const& { + return (**this)[name]; + } + mongocxx::v_noabi::database operator[](bsoncxx::v_noabi::string::view_or_value name) && = delete; private: friend ::mongocxx::v_noabi::pool; - using unique_client = std::unique_ptr>; + using unique_client = std::unique_ptr>; - MONGOCXX_PRIVATE explicit entry(unique_client); + explicit entry(unique_client); unique_client _client; }; @@ -118,28 +121,23 @@ class pool { /// Acquires a client from the pool. The calling thread will block until a connection is /// available. /// - entry acquire(); + MONGOCXX_ABI_EXPORT_CDECL(entry) acquire(); /// /// Acquires a client from the pool. This method will return immediately, but may return a /// disengaged optional if a client is not available. /// - stdx::optional try_acquire(); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) try_acquire(); private: friend ::mongocxx::v_noabi::options::auto_encryption; - MONGOCXX_PRIVATE void _release(client* client); + void _release(client* client); - class MONGOCXX_PRIVATE impl; + class impl; const std::unique_ptr _impl; }; -MONGOCXX_INLINE mongocxx::v_noabi::database pool::entry::operator[]( - bsoncxx::v_noabi::string::view_or_value name) const& { - return (**this)[name]; -} - } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern-fwd.hpp index f6e0d03050..6e062235a6 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API read_concern; +class read_concern; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern.hpp index 938469720f..6da01f23e0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_concern.hpp @@ -77,32 +77,32 @@ class read_concern { /// run with this read_concern will use the server's default read_concern instead of /// specifying one. /// - read_concern(); + MONGOCXX_ABI_EXPORT_CDECL() read_concern(); /// /// Copy constructs a read_concern. /// - read_concern(const read_concern&); + MONGOCXX_ABI_EXPORT_CDECL() read_concern(const read_concern&); /// /// Copy assigns a read_concern. /// - read_concern& operator=(const read_concern&); + MONGOCXX_ABI_EXPORT_CDECL(read_concern&) operator=(const read_concern&); /// /// Move constructs a read_concern. /// - read_concern(read_concern&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() read_concern(read_concern&&) noexcept; /// /// Move assigns a read_concern. /// - read_concern& operator=(read_concern&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(read_concern&) operator=(read_concern&&) noexcept; /// /// Destroys a read_concern. /// - ~read_concern(); + MONGOCXX_ABI_EXPORT_CDECL() ~read_concern(); /// /// Sets the read concern level. @@ -114,7 +114,7 @@ class read_concern { /// mongocxx::v_noabi::exception if rc_level is not k_local, k_majority, k_linearizable, or /// k_server_default. /// - void acknowledge_level(level rc_level); + MONGOCXX_ABI_EXPORT_CDECL(void) acknowledge_level(level rc_level); /// /// Gets the current read concern level. @@ -124,7 +124,7 @@ class read_concern { /// /// @return The read concern level. /// - level acknowledge_level() const; + MONGOCXX_ABI_EXPORT_CDECL(level) acknowledge_level() const; /// /// Sets the read concern string. Any valid read concern string (e.g. "local", @@ -135,7 +135,7 @@ class read_concern { /// @param rc_string /// The read concern string. /// - void acknowledge_string(stdx::string_view rc_string); + MONGOCXX_ABI_EXPORT_CDECL(void) acknowledge_string(stdx::string_view rc_string); /// /// Gets the current read concern string. @@ -145,7 +145,7 @@ class read_concern { /// /// @return The read concern string. /// - stdx::string_view acknowledge_string() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::string_view) acknowledge_string() const; /// /// Gets the document form of this read_concern. @@ -153,14 +153,7 @@ class read_concern { /// @return /// Document representation of this read_concern. /// - bsoncxx::v_noabi::document::value to_document() const; - - private: - friend ::mongocxx::v_noabi::client; - friend ::mongocxx::v_noabi::collection; - friend ::mongocxx::v_noabi::database; - friend ::mongocxx::v_noabi::options::transaction; - friend ::mongocxx::v_noabi::uri; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) to_document() const; /// /// @relates mongocxx::v_noabi::read_concern @@ -168,14 +161,21 @@ class read_concern { /// Compares two read_concern objects for (in)-equality. /// /// @{ - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const read_concern&, const read_concern&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const read_concern&, const read_concern&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const read_concern&, const read_concern&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const read_concern&, const read_concern&); /// @} /// - class MONGOCXX_PRIVATE impl; + private: + friend ::mongocxx::v_noabi::client; + friend ::mongocxx::v_noabi::collection; + friend ::mongocxx::v_noabi::database; + friend ::mongocxx::v_noabi::options::transaction; + friend ::mongocxx::v_noabi::uri; + + class impl; - MONGOCXX_PRIVATE read_concern(std::unique_ptr&& implementation); + read_concern(std::unique_ptr&& implementation); std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference-fwd.hpp index d6e40125fd..07038e01d0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API read_preference; +class read_preference; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference.hpp index d4ed2f2d11..655081d566 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/read_preference.hpp @@ -103,7 +103,7 @@ class read_preference { /// /// Constructs a new read_preference with read_mode set to k_primary. /// - read_preference(); + MONGOCXX_ABI_EXPORT_CDECL() read_preference(); struct deprecated_tag {}; @@ -115,8 +115,9 @@ class read_preference { /// /// @deprecated The constructor with no arguments and the method mode() should be used. /// - MONGOCXX_DEPRECATED read_preference(read_mode mode); - read_preference(read_mode mode, deprecated_tag); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL() read_preference(read_mode mode); + + MONGOCXX_ABI_EXPORT_CDECL() read_preference(read_mode mode, deprecated_tag); /// /// Constructs a new read_preference with tags. @@ -130,34 +131,36 @@ class read_preference { /// /// @deprecated The tags() method should be used instead. /// - MONGOCXX_DEPRECATED read_preference(read_mode mode, - bsoncxx::v_noabi::document::view_or_value tags); + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL() + read_preference(read_mode mode, bsoncxx::v_noabi::document::view_or_value tags); + + MONGOCXX_ABI_EXPORT_CDECL() read_preference(read_mode mode, bsoncxx::v_noabi::document::view_or_value tags, deprecated_tag); /// /// Copy constructs a read_preference. /// - read_preference(const read_preference&); + MONGOCXX_ABI_EXPORT_CDECL() read_preference(const read_preference&); /// /// Copy assigns a read_preference. /// - read_preference& operator=(const read_preference&); + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) operator=(const read_preference&); /// /// Move constructs a read_preference. /// - read_preference(read_preference&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() read_preference(read_preference&&) noexcept; /// /// Move assigns a read_preference. /// - read_preference& operator=(read_preference&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) operator=(read_preference&&) noexcept; /// /// Destroys a read_preference. /// - ~read_preference(); + MONGOCXX_ABI_EXPORT_CDECL() ~read_preference(); /// /// Sets a new mode for this read_preference. @@ -169,14 +172,14 @@ class read_preference { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - read_preference& mode(read_mode mode); + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) mode(read_mode mode); /// /// Returns the current read_mode for this read_preference. /// /// @return The current read_mode. /// - read_mode mode() const; + MONGOCXX_ABI_EXPORT_CDECL(read_mode) mode() const; /// /// Sets or updates the tag set list for this read_preference. @@ -190,7 +193,8 @@ class read_preference { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - read_preference& tags(bsoncxx::v_noabi::document::view_or_value tag_set_list); + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) + tags(bsoncxx::v_noabi::document::view_or_value tag_set_list); /// /// Sets or updates the tag set list for this read_preference. @@ -204,7 +208,8 @@ class read_preference { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - read_preference& tags(bsoncxx::v_noabi::array::view_or_value tag_set_list); + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) + tags(bsoncxx::v_noabi::array::view_or_value tag_set_list); /// /// Sets or updates the tag set list for this read_preference. @@ -213,7 +218,7 @@ class read_preference { /// /// @see https://www.mongodb.com/docs/manual/core/read-preference-tags/ /// - stdx::optional tags() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tags() const; /// /// Sets the max staleness setting for this read_preference. Secondary @@ -245,14 +250,14 @@ class read_preference { /// /// @throws mongocxx::v_noabi::logic_error if the argument is invalid. /// - read_preference& max_staleness(std::chrono::seconds max_staleness); + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) max_staleness(std::chrono::seconds max_staleness); /// /// Returns the current max staleness setting for this read_preference. /// /// @return The optionally current max staleness setting. /// - stdx::optional max_staleness() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) max_staleness() const; /// /// Sets the hedge document to be used for the read preference. Sharded clusters running MongoDB @@ -272,23 +277,15 @@ class read_preference { /// @return A reference to the object on which this member function is being called. This /// facilitates method chaining. /// - read_preference& hedge(bsoncxx::v_noabi::document::view_or_value hedge); + MONGOCXX_ABI_EXPORT_CDECL(read_preference&) + hedge(bsoncxx::v_noabi::document::view_or_value hedge); /// /// Gets the current hedge document to be used for the read preference. /// /// @return A hedge document if one was set. /// - const stdx::optional hedge() const; - - private: - friend ::mongocxx::v_noabi::client; - friend ::mongocxx::v_noabi::collection; - friend ::mongocxx::v_noabi::database; - friend ::mongocxx::v_noabi::events::topology_description; - friend ::mongocxx::v_noabi::options::transaction; - friend ::mongocxx::v_noabi::search_index_view; - friend ::mongocxx::v_noabi::uri; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional) hedge() const; /// /// @relates mongocxx::v_noabi::read_preference @@ -296,16 +293,25 @@ class read_preference { /// Compares two read_preference objects for (in)-equality. /// /// @{ - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const read_preference&, + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const read_preference&, const read_preference&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const read_preference&, + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const read_preference&, const read_preference&); /// @} /// - class MONGOCXX_PRIVATE impl; + private: + friend ::mongocxx::v_noabi::client; + friend ::mongocxx::v_noabi::collection; + friend ::mongocxx::v_noabi::database; + friend ::mongocxx::v_noabi::events::topology_description; + friend ::mongocxx::v_noabi::options::transaction; + friend ::mongocxx::v_noabi::search_index_view; + friend ::mongocxx::v_noabi::uri; + + class impl; - MONGOCXX_PRIVATE read_preference(std::unique_ptr&& implementation); + read_preference(std::unique_ptr&& implementation); std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write-fwd.hpp index 9aa36539d0..828f2f8828 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API bulk_write; +class bulk_write; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write.hpp index 2d60126f19..592adf7399 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/bulk_write.hpp @@ -38,21 +38,21 @@ class bulk_write { using id_map = std::map; // This constructor is public for testing purposes only - explicit bulk_write(bsoncxx::v_noabi::document::value raw_response); + explicit MONGOCXX_ABI_EXPORT_CDECL() bulk_write(bsoncxx::v_noabi::document::value raw_response); /// /// Gets the number of documents that were inserted during this operation. /// /// @return The number of documents that were inserted. /// - std::int32_t inserted_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) inserted_count() const; /// /// Gets the number of documents that were matched during this operation. /// /// @return The number of documents that were matched. /// - std::int32_t matched_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) matched_count() const; /// /// Gets the number of documents that were modified during this operation. @@ -61,21 +61,21 @@ class bulk_write { /// /// @throws with server versions below 2.6 due to the field `nModified` not being returned. /// - std::int32_t modified_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) modified_count() const; /// /// Gets the number of documents that were deleted during this operation. /// /// @return The number of documents that were deleted. /// - std::int32_t deleted_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) deleted_count() const; /// /// Gets the number of documents that were upserted during this operation. /// /// @return The number of documents that were upserted. /// - std::int32_t upserted_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) upserted_count() const; /// /// Gets the ids of the upserted documents. @@ -83,15 +83,15 @@ class bulk_write { /// @note The returned id_map must not be accessed after the bulk_write object is destroyed. /// @return A map from bulk write index to _id field for upserted documents. /// - id_map upserted_ids() const; + MONGOCXX_ABI_EXPORT_CDECL(id_map) upserted_ids() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const bulk_write&, const bulk_write&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const bulk_write&, const bulk_write&); private: - MONGOCXX_PRIVATE bsoncxx::v_noabi::document::view view() const; + bsoncxx::v_noabi::document::view view() const; bsoncxx::v_noabi::document::value _response; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const bulk_write&, const bulk_write&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const bulk_write&, const bulk_write&); }; } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete-fwd.hpp index 338b1d50d1..a518eed415 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API delete_result; +class delete_result; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete.hpp index c3183314e1..acf37e7522 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/delete.hpp @@ -32,27 +32,27 @@ namespace result { class delete_result { public: // This constructor is public for testing purposes only - explicit delete_result(result::bulk_write result); + explicit MONGOCXX_ABI_EXPORT_CDECL() delete_result(result::bulk_write result); /// /// Returns the bulk write result. /// /// @return The raw bulk write result. /// - const result::bulk_write& result() const; + MONGOCXX_ABI_EXPORT_CDECL(const result::bulk_write&) result() const; /// /// Gets the number of documents that were deleted during this operation. /// /// @return The number of documents that were deleted. /// - std::int32_t deleted_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) deleted_count() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const delete_result&, const delete_result&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const delete_result&, const delete_result&); private: result::bulk_write _result; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const delete_result&, const delete_result&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const delete_result&, const delete_result&); }; } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload-fwd.hpp index ffd0de8d41..557fdf3fa5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload-fwd.hpp @@ -21,7 +21,7 @@ namespace v_noabi { namespace result { namespace gridfs { -class MONGOCXX_API upload; +class upload; } // namespace gridfs } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload.hpp index 1574898498..5b874b5af0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/gridfs/upload.hpp @@ -29,14 +29,17 @@ namespace gridfs { /// Class representing the result of a GridFS upload operation. class upload { public: - upload(bsoncxx::v_noabi::types::bson_value::view id); + MONGOCXX_ABI_EXPORT_CDECL() upload(bsoncxx::v_noabi::types::bson_value::view id); /// /// Gets the id of the uploaded GridFS file. /// /// @return The id of the uploaded file. /// - const bsoncxx::v_noabi::types::bson_value::view& id() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::types::bson_value::view&) id() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const upload&, const upload&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const upload&, const upload&); private: // Array with a single element, containing the value of the _id field for the inserted files @@ -45,9 +48,6 @@ class upload { // Points into _id_owned. bsoncxx::v_noabi::types::bson_value::view _id; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const upload&, const upload&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const upload&, const upload&); }; } // namespace gridfs diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many-fwd.hpp index de4cc35ff3..13f9a2e352 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API insert_many; +class insert_many; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many.hpp index 5a0982f6e2..02ed1e27c8 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_many.hpp @@ -38,12 +38,13 @@ class insert_many { public: using id_map = std::map; + MONGOCXX_ABI_EXPORT_CDECL() insert_many(result::bulk_write result, bsoncxx::v_noabi::array::value inserted_ids); ~insert_many() = default; - insert_many(const insert_many&); - insert_many& operator=(const insert_many&); + MONGOCXX_ABI_EXPORT_CDECL() insert_many(const insert_many&); + MONGOCXX_ABI_EXPORT_CDECL(insert_many&) operator=(const insert_many&); insert_many(insert_many&&) = default; insert_many& operator=(insert_many&&) = default; @@ -53,14 +54,14 @@ class insert_many { /// /// @return The raw bulk write result. /// - const result::bulk_write& result() const; + MONGOCXX_ABI_EXPORT_CDECL(const result::bulk_write&) result() const; /// /// Gets the number of documents that were inserted during this operation. /// /// @return The number of documents that were inserted. /// - std::int32_t inserted_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) inserted_count() const; /// /// Gets the _ids of the inserted documents. @@ -69,13 +70,16 @@ class insert_many { /// destroyed. /// @return Map of the index of the operation to the _id of the inserted document. /// - id_map inserted_ids() const; + MONGOCXX_ABI_EXPORT_CDECL(id_map) inserted_ids() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const insert_many&, const insert_many&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const insert_many&, const insert_many&); private: friend ::mongocxx::v_noabi::collection; // Construct _inserted_ids from _inserted_ids_owned - MONGOCXX_PRIVATE void _buildInsertedIds(); + void _buildInsertedIds(); result::bulk_write _result; @@ -85,9 +89,6 @@ class insert_many { // Points into _inserted_ids_owned. id_map _inserted_ids; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const insert_many&, const insert_many&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const insert_many&, const insert_many&); }; } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one-fwd.hpp index 6b9446c403..b23e4b75c7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API insert_one; +class insert_one; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one.hpp index 93e0f1d40f..258c026f56 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/insert_one.hpp @@ -31,6 +31,7 @@ namespace result { class insert_one { public: // This constructor is public for testing purposes only + MONGOCXX_ABI_EXPORT_CDECL() insert_one(result::bulk_write result, bsoncxx::v_noabi::types::bson_value::view inserted_id); /// @@ -38,14 +39,17 @@ class insert_one { /// /// @return The raw bulk write result. /// - const result::bulk_write& result() const; + MONGOCXX_ABI_EXPORT_CDECL(const result::bulk_write&) result() const; /// /// Gets the _id of the inserted document. /// /// @return The value of the _id field for the inserted document. /// - const bsoncxx::v_noabi::types::bson_value::view& inserted_id() const; + MONGOCXX_ABI_EXPORT_CDECL(const bsoncxx::v_noabi::types::bson_value::view&) inserted_id() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const insert_one&, const insert_one&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const insert_one&, const insert_one&); private: result::bulk_write _result; @@ -55,9 +59,6 @@ class insert_one { // Points into _inserted_id_owned. bsoncxx::v_noabi::types::bson_value::view _inserted_id; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const insert_one&, const insert_one&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const insert_one&, const insert_one&); }; } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one-fwd.hpp index e56c2d440e..e2355d20d5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API replace_one; +class replace_one; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one.hpp index 7804fb21a5..a4caa651db 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/replace_one.hpp @@ -33,41 +33,42 @@ namespace result { class replace_one { public: // This constructor is public for testing purposes only - explicit replace_one(result::bulk_write result); + explicit MONGOCXX_ABI_EXPORT_CDECL() replace_one(result::bulk_write result); /// /// Returns the bulk write result for this replace_one operation. /// /// @return The raw bulk write result. /// - const result::bulk_write& result() const; + MONGOCXX_ABI_EXPORT_CDECL(const result::bulk_write&) result() const; /// /// Gets the number of documents that were matched during this operation. /// /// @return The number of documents that were matched. /// - std::int32_t matched_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) matched_count() const; /// /// Gets the number of documents that were modified during this operation. /// /// @return The number of documents that were modified. /// - std::int32_t modified_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) modified_count() const; /// /// Gets the id of the upserted document. /// /// @return The value of the _id field for upserted document. /// - stdx::optional upserted_id() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + upserted_id() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const replace_one&, const replace_one&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const replace_one&, const replace_one&); private: result::bulk_write _result; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const replace_one&, const replace_one&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const replace_one&, const replace_one&); }; } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey-fwd.hpp index 4fc8bb471c..24bccd8203 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API rewrap_many_datakey; +class rewrap_many_datakey; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey.hpp index dd9f7490c4..1d1e703f9c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/rewrap_many_datakey.hpp @@ -31,14 +31,17 @@ class rewrap_many_datakey { public: rewrap_many_datakey() = default; - explicit rewrap_many_datakey(mongocxx::v_noabi::result::bulk_write bulk_write_result_doc); + explicit MONGOCXX_ABI_EXPORT_CDECL() + rewrap_many_datakey(mongocxx::v_noabi::result::bulk_write bulk_write_result_doc); /// /// Returns the bulk write result for this rewrap_many_datakey operation. /// /// @return The raw bulk write result. /// - const bsoncxx::v_noabi::stdx::optional& result(); + MONGOCXX_ABI_EXPORT_CDECL( + const bsoncxx::v_noabi::stdx::optional&) + result(); private: bsoncxx::v_noabi::stdx::optional _result; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update-fwd.hpp index 50f24e3826..b5f5e9fe12 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update-fwd.hpp @@ -20,7 +20,7 @@ namespace mongocxx { namespace v_noabi { namespace result { -class MONGOCXX_API update; +class update; } // namespace result } // namespace v_noabi diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update.hpp index 85113b9d7e..8dab8c4dac 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/result/update.hpp @@ -33,46 +33,47 @@ namespace result { class update { public: // This constructor is public for testing purposes only - explicit update(result::bulk_write result); + explicit MONGOCXX_ABI_EXPORT_CDECL() update(result::bulk_write result); /// /// Returns the bulk write result for this update operation. /// /// @return The raw bulk write result. /// - const result::bulk_write& result() const; + MONGOCXX_ABI_EXPORT_CDECL(const result::bulk_write&) result() const; /// /// Gets the number of documents that were matched during this operation. /// /// @return The number of documents that were matched. /// - std::int32_t matched_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) matched_count() const; /// /// Gets the number of documents that were modified during this operation. /// /// @return The number of documents that were modified. - std::int32_t modified_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) modified_count() const; /// /// Gets the number of documents that were upserted during this operation. /// /// @return The number of documents that were upserted. - std::int32_t upserted_count() const; + MONGOCXX_ABI_EXPORT_CDECL(std::int32_t) upserted_count() const; /// /// If a document was upserted during this operation, gets the _id of the upserted document. /// /// @return The value of the _id field for upserted document. /// - stdx::optional upserted_id() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + upserted_id() const; + + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const update&, const update&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const update&, const update&); private: result::bulk_write _result; - - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const update&, const update&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const update&, const update&); }; } // namespace result diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model-fwd.hpp index 77d216670a..92fc237caf 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API search_index_model; +class search_index_model; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model.hpp index 234731af9c..edabfa5ea8 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_model.hpp @@ -22,7 +22,10 @@ class search_index_model { /// /// Initializes a new search_index_model over a mongocxx::v_noabi::collection. /// + MONGOCXX_ABI_EXPORT_CDECL() search_index_model(bsoncxx::v_noabi::document::view_or_value definition); + + MONGOCXX_ABI_EXPORT_CDECL() search_index_model(bsoncxx::v_noabi::string::view_or_value name, bsoncxx::v_noabi::document::view_or_value definition); @@ -31,42 +34,46 @@ class search_index_model { /// /// Move constructs a search_index_model. /// - search_index_model(search_index_model&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() search_index_model(search_index_model&&) noexcept; /// /// Move assigns a search_index_model. /// - search_index_model& operator=(search_index_model&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(search_index_model&) operator=(search_index_model&&) noexcept; /// /// Copy constructs a search_index_model. /// - search_index_model(const search_index_model&); + MONGOCXX_ABI_EXPORT_CDECL() search_index_model(const search_index_model&); /// /// Copy assigns a search_index_model. /// - search_index_model& operator=(const search_index_model&); + MONGOCXX_ABI_EXPORT_CDECL(search_index_model&) operator=(const search_index_model&); /// /// Destroys a search_index_model. /// - ~search_index_model(); + MONGOCXX_ABI_EXPORT_CDECL() ~search_index_model(); /// /// Retrieves name of a search_index_model. /// - bsoncxx::v_noabi::stdx::optional name() const; + MONGOCXX_ABI_EXPORT_CDECL( + bsoncxx::v_noabi::stdx::optional) + name() const; /// /// Retrieves definition of a search_index_model. /// - bsoncxx::v_noabi::document::view definition() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) definition() const; /// /// Retrieves type of a search_index_model. /// - bsoncxx::v_noabi::stdx::optional type() const; + MONGOCXX_ABI_EXPORT_CDECL( + bsoncxx::v_noabi::stdx::optional) + type() const; /// /// Sets type of a search_index_model. @@ -74,14 +81,15 @@ class search_index_model { /// @param type The type for this index. Can be either "search" or "vectorSearch". /// /// @return A reference to this object to facilitate method chaining. - search_index_model& type(bsoncxx::v_noabi::string::view_or_value type); + MONGOCXX_ABI_EXPORT_CDECL(search_index_model&) + type(bsoncxx::v_noabi::string::view_or_value type); private: - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE const impl& _get_impl() const; + const impl& _get_impl() const; - MONGOCXX_PRIVATE impl& _get_impl(); + impl& _get_impl(); private: std::unique_ptr _impl; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view-fwd.hpp index 289eab1753..3db19e1f8c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API search_index_view; +class search_index_view; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view.hpp index d61efe98a3..7b8206953f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/search_index_view.hpp @@ -22,13 +22,13 @@ namespace v_noabi { /// class search_index_view { public: - search_index_view(search_index_view&&) noexcept; - search_index_view& operator=(search_index_view&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() search_index_view(search_index_view&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(search_index_view&) operator=(search_index_view&&) noexcept; - search_index_view(const search_index_view&); - search_index_view& operator=(const search_index_view&); + MONGOCXX_ABI_EXPORT_CDECL() search_index_view(const search_index_view&); + MONGOCXX_ABI_EXPORT_CDECL(search_index_view&) operator=(const search_index_view&); - ~search_index_view(); + MONGOCXX_ABI_EXPORT_CDECL() ~search_index_view(); /// /// Returns a cursor over all the search indexes. @@ -38,7 +38,8 @@ class search_index_view { /// /// @return A cursor to the list of the search indexes returned. /// - cursor list(const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list(const options::aggregate& options = options::aggregate()); /// /// Returns a cursor over all the search indexes. @@ -50,8 +51,8 @@ class search_index_view { /// /// @return A cursor to the list of the search indexes returned. /// - cursor list(const client_session& session, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list(const client_session& session, const options::aggregate& options = options::aggregate()); /// /// Returns a cursor over all the search indexes. @@ -63,8 +64,9 @@ class search_index_view { /// /// @return A cursor to the list of the search indexes returned. /// - cursor list(bsoncxx::v_noabi::string::view_or_value name, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list(bsoncxx::v_noabi::string::view_or_value name, + const options::aggregate& options = options::aggregate()); /// /// Returns a cursor over all the search indexes. @@ -78,9 +80,10 @@ class search_index_view { /// /// @return A cursor to the list of the search indexes returned. /// - cursor list(const client_session& session, - bsoncxx::v_noabi::string::view_or_value name, - const options::aggregate& options = options::aggregate()); + MONGOCXX_ABI_EXPORT_CDECL(cursor) + list(const client_session& session, + bsoncxx::v_noabi::string::view_or_value name, + const options::aggregate& options = options::aggregate()); /// /// This is a convenience method for creating a single search index with a default name. @@ -90,7 +93,8 @@ class search_index_view { /// /// @return The name of the created search index. /// - std::string create_one(bsoncxx::v_noabi::document::view_or_value definition); + MONGOCXX_ABI_EXPORT_CDECL(std::string) + create_one(bsoncxx::v_noabi::document::view_or_value definition); /// /// This is a convenience method for creating a single search index with a default name. @@ -102,8 +106,8 @@ class search_index_view { /// /// @return The name of the created search index. /// - std::string create_one(const client_session& session, - bsoncxx::v_noabi::document::view_or_value definition); + MONGOCXX_ABI_EXPORT_CDECL(std::string) + create_one(const client_session& session, bsoncxx::v_noabi::document::view_or_value definition); /// /// This is a convenience method for creating a single search index. @@ -115,8 +119,9 @@ class search_index_view { /// /// @return The name of the created search index. /// - std::string create_one(bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value definition); + MONGOCXX_ABI_EXPORT_CDECL(std::string) + create_one(bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value definition); /// /// This is a convenience method for creating a single search index. @@ -130,9 +135,10 @@ class search_index_view { /// /// @return The name of the created search index. /// - std::string create_one(const client_session& session, - bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value definition); + MONGOCXX_ABI_EXPORT_CDECL(std::string) + create_one(const client_session& session, + bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value definition); /// /// This is a convenience method for creating a single search index. @@ -142,7 +148,7 @@ class search_index_view { /// /// @return The name of the created index. /// - std::string create_one(const search_index_model& model); + MONGOCXX_ABI_EXPORT_CDECL(std::string) create_one(const search_index_model& model); /// /// This is a convenience method for creating a single search index. @@ -154,7 +160,8 @@ class search_index_view { /// /// @return The name of the created index. /// - std::string create_one(const client_session& session, const search_index_model& model); + MONGOCXX_ABI_EXPORT_CDECL(std::string) + create_one(const client_session& session, const search_index_model& model); /// /// Creates multiple search indexes in the collection. @@ -164,7 +171,8 @@ class search_index_view { /// /// @return The names of the created indexes. /// - std::vector create_many(const std::vector& models); + MONGOCXX_ABI_EXPORT_CDECL(std::vector) + create_many(const std::vector& models); /// /// Creates multiple search indexes in the collection. @@ -176,8 +184,8 @@ class search_index_view { /// /// @return The names of the created indexes. /// - std::vector create_many(const client_session& session, - const std::vector& models); + MONGOCXX_ABI_EXPORT_CDECL(std::vector) + create_many(const client_session& session, const std::vector& models); /// /// Drops a single search index from the collection by the index name. @@ -185,7 +193,7 @@ class search_index_view { /// @param name /// The name of the search index to drop. /// - void drop_one(bsoncxx::v_noabi::string::view_or_value name); + MONGOCXX_ABI_EXPORT_CDECL(void) drop_one(bsoncxx::v_noabi::string::view_or_value name); /// /// Drops a single search index from the collection by the index name. @@ -195,7 +203,8 @@ class search_index_view { /// @param name /// The name of the search index to drop. /// - void drop_one(const client_session& session, bsoncxx::v_noabi::string::view_or_value name); + MONGOCXX_ABI_EXPORT_CDECL(void) + drop_one(const client_session& session, bsoncxx::v_noabi::string::view_or_value name); /// /// Updates a single search index from the collection by the search index name. @@ -205,8 +214,9 @@ class search_index_view { /// @param definition /// The definition to update the search index to. /// - void update_one(bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value definition); + MONGOCXX_ABI_EXPORT_CDECL(void) + update_one(bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value definition); /// /// Updates a single search index from the collection by the search index name. @@ -218,23 +228,23 @@ class search_index_view { /// @param definition /// The definition to update the search index to. /// - void update_one(const client_session& session, - bsoncxx::v_noabi::string::view_or_value name, - bsoncxx::v_noabi::document::view_or_value definition); + MONGOCXX_ABI_EXPORT_CDECL(void) + update_one(const client_session& session, + bsoncxx::v_noabi::string::view_or_value name, + bsoncxx::v_noabi::document::view_or_value definition); private: friend ::mongocxx::v_noabi::collection; - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE search_index_view(void* coll, void* client); + search_index_view(void* coll, void* client); - MONGOCXX_PRIVATE std::vector _create_many_helper( - bsoncxx::v_noabi::array::view created_indexes); + std::vector _create_many_helper(bsoncxx::v_noabi::array::view created_indexes); - MONGOCXX_PRIVATE const impl& _get_impl() const; + const impl& _get_impl() const; - MONGOCXX_PRIVATE impl& _get_impl(); + impl& _get_impl(); private: std::unique_ptr _impl; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri-fwd.hpp index c7a8788db9..38f78386ef 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API uri; +class uri; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri.hpp index 4ca79d6103..d221dfd08c 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/uri.hpp @@ -49,7 +49,7 @@ class uri { std::int32_t family; }; - static const std::string k_default_uri; + static MONGOCXX_ABI_EXPORT const std::string k_default_uri; /// /// Constructs a uri from an optional MongoDB URI string. If no URI string is specified, @@ -62,22 +62,23 @@ class uri { /// @param uri_string /// String representing a MongoDB connection string URI, defaults to k_default_uri. /// + MONGOCXX_ABI_EXPORT_CDECL() uri(bsoncxx::v_noabi::string::view_or_value uri_string = k_default_uri); /// /// Move constructs a uri. /// - uri(uri&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() uri(uri&&) noexcept; /// /// Move assigns a uri. /// - uri& operator=(uri&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(uri&) operator=(uri&&) noexcept; /// /// Destroys a uri. /// - ~uri(); + MONGOCXX_ABI_EXPORT_CDECL() ~uri(); uri(const uri&) = delete; uri& operator=(const uri&) = delete; @@ -87,28 +88,28 @@ class uri { /// /// @return A string representing the authentication mechanism. /// - std::string auth_mechanism() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) auth_mechanism() const; /// /// Returns the authentication source from the uri. /// /// @return A string representing the authentication source. /// - std::string auth_source() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) auth_source() const; /// /// Returns the hosts from the uri. /// /// @return A vector of hosts. /// - std::vector hosts() const; + MONGOCXX_ABI_EXPORT_CDECL(std::vector) hosts() const; /// /// Returns the database from the uri. /// /// @return A string with the name of the database. /// - std::string database() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) database() const; /// /// Returns other uri options. @@ -119,35 +120,35 @@ class uri { /// /// @return A document view containing other options. /// - bsoncxx::v_noabi::document::view options() const; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::view) options() const; /// /// Returns the password from the uri. /// /// @return A string containing the supplied password. /// - std::string password() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) password() const; /// /// Returns the read concern from the uri. /// /// @return A read_concern that represents what was specified in the uri. /// - mongocxx::v_noabi::read_concern read_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_concern) read_concern() const; /// /// Returns the read preference from the uri. /// /// @return A read_preference that represents what was specified in the uri. /// - mongocxx::v_noabi::read_preference read_preference() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::read_preference) read_preference() const; /// /// Returns the replica set specified in the uri. /// /// @return A string representing the supplied replica set name. /// - std::string replica_set() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) replica_set() const; /// /// Returns the ssl parameter from the uri. @@ -156,63 +157,64 @@ class uri { /// /// @deprecated The tls() method should be used instead of this method. /// - MONGOCXX_DEPRECATED bool ssl() const; + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(bool) ssl() const; /// /// Returns the tls parameter from the uri. /// /// @return Boolean that is @c true if tls is enabled and @c false if not. /// - bool tls() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) tls() const; /// /// Returns the uri in a string format. /// /// @return A string with the uri. /// - std::string to_string() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) to_string() const; /// /// Returns the supplied username from the uri. /// /// @return A string with the username specified in the uri. /// - std::string username() const; + MONGOCXX_ABI_EXPORT_CDECL(std::string) username() const; /// /// Returns the write concern specified in the uri. /// /// @return A write_concern that represents what was specified in the uri. /// - mongocxx::v_noabi::write_concern write_concern() const; + MONGOCXX_ABI_EXPORT_CDECL(mongocxx::v_noabi::write_concern) write_concern() const; /// /// Returns the value of the option "appname" if present in the uri. /// /// @return An optional stdx::string_view /// - stdx::optional appname() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) appname() const; /// /// Returns the value of the option "authMechanismProperties" if present in the uri. /// /// @return An optional bsoncxx::v_noabi::document::view /// - stdx::optional auth_mechanism_properties() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + auth_mechanism_properties() const; /// /// Returns the value of the option credentials if present in the uri. /// /// @return An optional bsoncxx::v_noabi::document::view /// - stdx::optional credentials(); + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) credentials(); /// /// Returns the value of the option "srvMaxHosts" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional srv_max_hosts() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) srv_max_hosts() const; /// /// Returns the list of compressors present in the uri or an empty list if "compressors" was not @@ -220,112 +222,113 @@ class uri { /// /// @return A std::vector of stdx::string_view. /// - std::vector compressors() const; + MONGOCXX_ABI_EXPORT_CDECL(std::vector) compressors() const; /// /// Returns the value of the option "connectTimeoutMS" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional connect_timeout_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) connect_timeout_ms() const; /// /// Returns the value of the option "directConnection" if present in the uri. /// /// @return An optional bool /// - stdx::optional direct_connection() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) direct_connection() const; /// /// Returns the value of the option "heartbeatFrequencyMS" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional heartbeat_frequency_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) heartbeat_frequency_ms() const; /// /// Returns the value of the option "localThresholdMS" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional local_threshold_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) local_threshold_ms() const; /// /// Returns the value of the option "maxPoolSize" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional max_pool_size() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) max_pool_size() const; /// /// Returns the value of the option "retryReads" if present in the uri. /// /// @return An optional bool /// - stdx::optional retry_reads() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) retry_reads() const; /// /// Returns the value of the option "retryWrites" if present in the uri. /// /// @return An optional bool /// - stdx::optional retry_writes() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) retry_writes() const; /// /// Returns the value of the option "serverSelectionTimeoutMS" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional server_selection_timeout_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) server_selection_timeout_ms() const; /// /// Returns the value of the option "serverSelectionTryOnce" if present in the uri. /// /// @return An optional bool /// - stdx::optional server_selection_try_once() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) server_selection_try_once() const; /// /// Returns the value of the option "socketTimeoutMS" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional socket_timeout_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) socket_timeout_ms() const; /// /// Returns the value of the option "tlsAllowInvalidCertificates" if present in the uri. /// /// @return An optional bool /// - stdx::optional tls_allow_invalid_certificates() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tls_allow_invalid_certificates() const; /// /// Returns the value of the option "tlsAllowInvalidHostnames" if present in the uri. /// /// @return An optional bool /// - stdx::optional tls_allow_invalid_hostnames() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tls_allow_invalid_hostnames() const; /// /// Returns the value of the option "tlsCAFile" if present in the uri. /// /// @return An optional stdx::string_view /// - stdx::optional tls_ca_file() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tls_ca_file() const; /// /// Returns the value of the option "tlsCertificateKeyFile" if present in the uri. /// /// @return An optional stdx::string_view /// - stdx::optional tls_certificate_key_file() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tls_certificate_key_file() const; /// /// Returns the value of the option "tlsCertificateKeyFilePassword" if present in the uri. /// /// @return An optional stdx::string_view /// - stdx::optional tls_certificate_key_file_password() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + tls_certificate_key_file_password() const; /// /// Returns the value of the option "tlsDisableCertificateRevocationCheck" if present in the @@ -333,43 +336,44 @@ class uri { /// /// @return An optional bool /// - stdx::optional tls_disable_certificate_revocation_check() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) + tls_disable_certificate_revocation_check() const; /// /// Returns the value of the option "tlsDisableOCSPEndpointCheck" if present in the uri. /// /// @return An optional bool /// - stdx::optional tls_disable_ocsp_endpoint_check() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tls_disable_ocsp_endpoint_check() const; /// /// Returns the value of the option "tlsInsecure" if present in the uri. /// /// @return An optional bool /// - stdx::optional tls_insecure() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tls_insecure() const; /// /// Returns the value of the option "waitQueueTimeoutMS" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional wait_queue_timeout_ms() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) wait_queue_timeout_ms() const; /// /// Returns the value of the option "zlibCompressionLevel" if present in the uri. /// /// @return An optional std::int32_t /// - stdx::optional zlib_compression_level() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) zlib_compression_level() const; private: friend ::mongocxx::v_noabi::client; friend ::mongocxx::v_noabi::pool; - class MONGOCXX_PRIVATE impl; + class impl; - MONGOCXX_PRIVATE uri(std::unique_ptr&& implementation); + uri(std::unique_ptr&& implementation); std::unique_ptr _impl; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria-fwd.hpp index d157b5bed1..435f5ec271 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API validation_criteria; +class validation_criteria; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria.hpp index 20cef179ac..a87f85f08f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/validation_criteria.hpp @@ -42,7 +42,8 @@ class validation_criteria { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - validation_criteria& rule(bsoncxx::v_noabi::document::view_or_value rule); + MONGOCXX_ABI_EXPORT_CDECL(validation_criteria&) + rule(bsoncxx::v_noabi::document::view_or_value rule); /// /// Gets the validation rule for this validation object. @@ -50,7 +51,8 @@ class validation_criteria { /// @return /// Document representing a validation rule. /// - const stdx::optional& rule() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) + rule() const; /// /// A class to represent the different validation level options. @@ -76,7 +78,7 @@ class validation_criteria { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - validation_criteria& level(validation_level level); + MONGOCXX_ABI_EXPORT_CDECL(validation_criteria&) level(validation_level level); /// /// Gets the validation level. @@ -84,7 +86,7 @@ class validation_criteria { /// @return /// The enumerated validation level. /// - const stdx::optional& level() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) level() const; /// /// A class to represent the different validation action options. @@ -108,7 +110,7 @@ class validation_criteria { /// A reference to the object on which this member function is being called. This facilitates /// method chaining. /// - validation_criteria& action(validation_action action); + MONGOCXX_ABI_EXPORT_CDECL(validation_criteria&) action(validation_action action); /// /// Gets the validation action to run when documents failing validation are inserted or @@ -117,7 +119,7 @@ class validation_criteria { /// @return /// The enumerated validation action. /// - const stdx::optional& action() const; + MONGOCXX_ABI_EXPORT_CDECL(const stdx::optional&) action() const; /// /// Returns a bson document representing this set of validation criteria. @@ -128,15 +130,19 @@ class validation_criteria { /// /// @return Validation criteria, as a document. /// - MONGOCXX_DEPRECATED bsoncxx::v_noabi::document::value to_document() const; - bsoncxx::v_noabi::document::value to_document_deprecated() const; + MONGOCXX_DEPRECATED MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) + to_document() const; + + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) to_document_deprecated() const; /// /// @deprecated /// This method is deprecated. To determine which options are set on this object, use the /// provided accessors instead. /// - MONGOCXX_DEPRECATED MONGOCXX_INLINE operator bsoncxx::v_noabi::document::value() const; + MONGOCXX_DEPRECATED operator bsoncxx::v_noabi::document::value() const { + return to_document_deprecated(); + } private: stdx::optional _rule; @@ -151,19 +157,15 @@ class validation_criteria { /// @{ /// @relatesalso mongocxx::v_noabi::validation_criteria -MONGOCXX_API bool MONGOCXX_CALL operator==(const validation_criteria& lhs, - const validation_criteria& rhs); +MONGOCXX_ABI_EXPORT_CDECL(bool) +operator==(const validation_criteria& lhs, const validation_criteria& rhs); /// @relatesalso mongocxx::v_noabi::validation_criteria -MONGOCXX_API bool MONGOCXX_CALL operator!=(const validation_criteria& lhs, - const validation_criteria& rhs); +MONGOCXX_ABI_EXPORT_CDECL(bool) +operator!=(const validation_criteria& lhs, const validation_criteria& rhs); /// @} /// -MONGOCXX_INLINE validation_criteria::operator bsoncxx::v_noabi::document::value() const { - return to_document_deprecated(); -} - } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern-fwd.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern-fwd.hpp index 3cdf06bdb1..8abcf7dedb 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern-fwd.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern-fwd.hpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -class MONGOCXX_API write_concern; +class write_concern; } // namespace v_noabi } // namespace mongocxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern.hpp index 38fd71793d..ef891a90c7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/write_concern.hpp @@ -67,32 +67,32 @@ class write_concern { /// /// Constructs a new write_concern. /// - write_concern(); + MONGOCXX_ABI_EXPORT_CDECL() write_concern(); /// /// Copy constructs a write_concern. /// - write_concern(const write_concern&); + MONGOCXX_ABI_EXPORT_CDECL() write_concern(const write_concern&); /// /// Copy assigns a write_concern. /// - write_concern& operator=(const write_concern&); + MONGOCXX_ABI_EXPORT_CDECL(write_concern&) operator=(const write_concern&); /// /// Move constructs a write_concern. /// - write_concern(write_concern&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL() write_concern(write_concern&&) noexcept; /// /// Move assigns a write_concern. /// - write_concern& operator=(write_concern&&) noexcept; + MONGOCXX_ABI_EXPORT_CDECL(write_concern&) operator=(write_concern&&) noexcept; /// /// Destroys a write_concern. /// - ~write_concern(); + MONGOCXX_ABI_EXPORT_CDECL() ~write_concern(); /// /// Sets the journal parameter for this write concern. @@ -102,7 +102,7 @@ class write_concern { /// before reporting a write operations was successful. This ensures that data is not lost if /// the mongod instance shuts down unexpectedly. /// - void journal(bool journal); + MONGOCXX_ABI_EXPORT_CDECL(void) journal(bool journal); /// /// Sets the number of nodes that are required to acknowledge the write before the operation is @@ -119,7 +119,7 @@ class write_concern { /// available nodes will cause writes using this write concern to block forever if no timeout /// is set. /// - void nodes(std::int32_t confirm_from); + MONGOCXX_ABI_EXPORT_CDECL(void) nodes(std::int32_t confirm_from); /// /// Sets the acknowledge level. @@ -144,7 +144,7 @@ class write_concern { /// Throws mongocxx::v_noabi::exception for setting a tag acknowledge level. Use tag() /// instead. /// - void acknowledge_level(level confirm_level); + MONGOCXX_ABI_EXPORT_CDECL(void) acknowledge_level(level confirm_level); /// /// Requires that a majority of the nodes in a replica set acknowledge a write operation before @@ -156,7 +156,7 @@ class write_concern { /// /// @throws mongocxx::v_noabi::logic_error for an invalid timeout value. /// - void majority(std::chrono::milliseconds timeout); + MONGOCXX_ABI_EXPORT_CDECL(void) majority(std::chrono::milliseconds timeout); /// /// Sets the name representing the server-side getLastErrorMode entry containing the list of @@ -167,7 +167,7 @@ class write_concern { /// @param tag /// The string representing on of the "getLastErrorModes" in the replica set configuration. /// - void tag(stdx::string_view tag); + MONGOCXX_ABI_EXPORT_CDECL(void) tag(stdx::string_view tag); /// /// Sets an upper bound on the time a write concern can take to be satisfied. If the write @@ -179,14 +179,14 @@ class write_concern { /// /// @throws mongocxx::v_noabi::logic_error for an invalid timeout value. /// - void timeout(std::chrono::milliseconds timeout); + MONGOCXX_ABI_EXPORT_CDECL(void) timeout(std::chrono::milliseconds timeout); /// /// Gets the current status of the journal parameter. /// /// @return @c true if journal is required, @c false if not. /// - bool journal() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) journal() const; /// /// Gets the current number of nodes that this write_concern requires operations to reach. @@ -198,7 +198,7 @@ class write_concern { /// /// @return The number of required nodes. /// - stdx::optional nodes() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) nodes() const; /// /// Gets the current acknowledgment level. @@ -207,35 +207,35 @@ class write_concern { /// /// @return The acknowledgment level. /// - level acknowledge_level() const; + MONGOCXX_ABI_EXPORT_CDECL(level) acknowledge_level() const; /// /// Gets the current getLastErrorMode that is required by this write_concern. /// /// @return The current getLastErrorMode. /// - stdx::optional tag() const; + MONGOCXX_ABI_EXPORT_CDECL(stdx::optional) tag() const; /// /// Gets whether the majority of nodes is currently required by this write_concern. /// /// @return The current majority setting. /// - bool majority() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) majority() const; /// /// Gets the current timeout for this write_concern. /// /// @return Current timeout in milliseconds. /// - std::chrono::milliseconds timeout() const; + MONGOCXX_ABI_EXPORT_CDECL(std::chrono::milliseconds) timeout() const; /// /// Gets whether this write_concern requires an acknowledged write. /// /// @return Whether this write concern requires an acknowledged write. /// - bool is_acknowledged() const; + MONGOCXX_ABI_EXPORT_CDECL(bool) is_acknowledged() const; /// /// Gets the document form of this write_concern. @@ -243,15 +243,7 @@ class write_concern { /// @return /// Document representation of this write_concern. /// - bsoncxx::v_noabi::document::value to_document() const; - - private: - friend ::mongocxx::v_noabi::bulk_write; - friend ::mongocxx::v_noabi::client; - friend ::mongocxx::v_noabi::collection; - friend ::mongocxx::v_noabi::database; - friend ::mongocxx::v_noabi::options::transaction; - friend ::mongocxx::v_noabi::uri; + MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v_noabi::document::value) to_document() const; /// /// @relates mongocxx::v_noabi::write_concern @@ -259,14 +251,22 @@ class write_concern { /// Compares two write_concern objects for (in)-equality. /// /// @{ - friend MONGOCXX_API bool MONGOCXX_CALL operator==(const write_concern&, const write_concern&); - friend MONGOCXX_API bool MONGOCXX_CALL operator!=(const write_concern&, const write_concern&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator==(const write_concern&, const write_concern&); + friend MONGOCXX_ABI_EXPORT_CDECL(bool) operator!=(const write_concern&, const write_concern&); /// @} /// - class MONGOCXX_PRIVATE impl; + private: + friend ::mongocxx::v_noabi::bulk_write; + friend ::mongocxx::v_noabi::client; + friend ::mongocxx::v_noabi::collection; + friend ::mongocxx::v_noabi::database; + friend ::mongocxx::v_noabi::options::transaction; + friend ::mongocxx::v_noabi::uri; + + class impl; - MONGOCXX_PRIVATE write_concern(std::unique_ptr&& implementation); + write_concern(std::unique_ptr&& implementation); std::unique_ptr _impl; }; diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/change_stream.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/change_stream.cpp index 00e0daa852..a6d34914b3 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/change_stream.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/change_stream.cpp @@ -98,8 +98,7 @@ change_stream::iterator::iterator(const iter_type type, const change_stream* cha // Care about the underlying change_stream being the same so we can // support a collection of iterators for change streams from different // collections. -bool MONGOCXX_CALL operator==(const change_stream::iterator& lhs, - const change_stream::iterator& rhs) noexcept { +bool operator==(const change_stream::iterator& lhs, const change_stream::iterator& rhs) noexcept { // Tracking different streams never equal. if (lhs._change_stream != rhs._change_stream) { return false; @@ -118,8 +117,7 @@ bool MONGOCXX_CALL operator==(const change_stream::iterator& lhs, ((rhs._type == change_stream::iterator::iter_type::k_end) && lhs.is_exhausted()); } -bool MONGOCXX_CALL operator!=(const change_stream::iterator& lhs, - const change_stream::iterator& rhs) noexcept { +bool operator!=(const change_stream::iterator& lhs, const change_stream::iterator& rhs) noexcept { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/cursor.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/cursor.cpp index f5e6019898..72ec99fb29 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/cursor.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/cursor.cpp @@ -101,11 +101,11 @@ const bsoncxx::v_noabi::document::view* cursor::iterator::operator->() const { // both are "at the end". We check for exhaustion first because the most // common check is `iter != cursor.end()`. // -bool MONGOCXX_CALL operator==(const cursor::iterator& lhs, const cursor::iterator& rhs) { +bool operator==(const cursor::iterator& lhs, const cursor::iterator& rhs) { return ((rhs.is_exhausted() && lhs.is_exhausted()) || (lhs._cursor == rhs._cursor)); } -bool MONGOCXX_CALL operator!=(const cursor::iterator& lhs, const cursor::iterator& rhs) { +bool operator!=(const cursor::iterator& lhs, const cursor::iterator& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/error_code.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/error_code.cpp index 01a850c77a..f56bccfc67 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/error_code.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/error_code.cpp @@ -100,7 +100,7 @@ class error_category final : public std::error_category { } // namespace -const std::error_category& MONGOCXX_CALL error_category() { +const std::error_category& error_category() { static const class error_category category {}; return category; } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/server_error_code.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/server_error_code.cpp index 9d3df589af..3d030caa9d 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/server_error_code.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/server_error_code.cpp @@ -39,7 +39,7 @@ class server_error_category final : public std::error_category { } // namespace -const std::error_category& MONGOCXX_CALL server_error_category() { +const std::error_category& server_error_category() { static const class server_error_category category {}; return category; } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/hint.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/hint.cpp index 9ec1f8f49e..7e72073fe9 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/hint.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/hint.cpp @@ -40,35 +40,35 @@ bsoncxx::v_noabi::types::bson_value::view hint::to_value() const { bsoncxx::v_noabi::types::b_string{*_index_string}}; } -bool MONGOCXX_CALL operator==(const hint& index_hint, std::string index) { +bool operator==(const hint& index_hint, std::string index) { return ((index_hint._index_string) && (*(index_hint._index_string) == index)); } -bool MONGOCXX_CALL operator==(std::string index, const hint& index_hint) { +bool operator==(std::string index, const hint& index_hint) { return index_hint == index; } -bool MONGOCXX_CALL operator!=(const hint& index_hint, std::string index) { +bool operator!=(const hint& index_hint, std::string index) { return !(index_hint == index); } -bool MONGOCXX_CALL operator!=(std::string index, const hint& index_hint) { +bool operator!=(std::string index, const hint& index_hint) { return !(index_hint == index); } -bool MONGOCXX_CALL operator==(const hint& index_hint, bsoncxx::v_noabi::document::view index) { +bool operator==(const hint& index_hint, bsoncxx::v_noabi::document::view index) { return index_hint._index_doc && index_hint._index_doc->view() == index; } -bool MONGOCXX_CALL operator==(bsoncxx::v_noabi::document::view index, const hint& index_hint) { +bool operator==(bsoncxx::v_noabi::document::view index, const hint& index_hint) { return index_hint == index; } -bool MONGOCXX_CALL operator!=(const hint& index_hint, bsoncxx::v_noabi::document::view index) { +bool operator!=(const hint& index_hint, bsoncxx::v_noabi::document::view index) { return !(index_hint == index); } -bool MONGOCXX_CALL operator!=(bsoncxx::v_noabi::document::view index, const hint& index_hint) { +bool operator!=(bsoncxx::v_noabi::document::view index, const hint& index_hint) { return !(index_hint == index); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/logger.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/logger.cpp index b787026977..762ad1a9c1 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/logger.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/logger.cpp @@ -19,7 +19,7 @@ namespace mongocxx { namespace v_noabi { -stdx::string_view MONGOCXX_CALL to_string(log_level level) { +stdx::string_view to_string(log_level level) { switch (level) { case log_level::k_error: return "error"; diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh index 115bc3da10..84e7124e26 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libbson.hh @@ -45,61 +45,62 @@ namespace libbson { // not call init itself (expecting an already initialized bson_t) then init() could be called // instead. // -class MONGOCXX_ABI_EXPORT_TESTING scoped_bson_t { +class scoped_bson_t { public: // // Constructs a new scoped_bson_t having a non-initialized internal bson_t. // - scoped_bson_t(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING() scoped_bson_t(); // // Constructs a new scoped_bson_t from the provided document. // // The internal bson_t is considered initialized. // - explicit scoped_bson_t(bsoncxx::document::view_or_value doc); + explicit MONGOCXX_ABI_EXPORT_CDECL_TESTING() + scoped_bson_t(bsoncxx::document::view_or_value doc); // // Initializes a bson_t from the provided document. // // The internal bson_t is considered initialized. // - void init_from_static(bsoncxx::document::view_or_value doc); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(void) init_from_static(bsoncxx::document::view_or_value doc); // // Constructs a new scoped_bson_t from the provided document. // // The internal bson_t is considered initialized. // - explicit scoped_bson_t(bsoncxx::document::view doc); + explicit MONGOCXX_ABI_EXPORT_CDECL_TESTING() scoped_bson_t(bsoncxx::document::view doc); // // Initializes a bson_t from the provided document. // // The internal bson_t is considered initialized. // - void init_from_static(bsoncxx::document::view doc); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(void) init_from_static(bsoncxx::document::view doc); // // Constructs a new scoped_bson_t from the provided document. // // The internal bson_t is considered initialized. // - explicit scoped_bson_t(bsoncxx::document::value doc); + explicit MONGOCXX_ABI_EXPORT_CDECL_TESTING() scoped_bson_t(bsoncxx::document::value doc); // // Initializes a bson_t from the provided document. // // The internal bson_t is considered initialized. // - void init_from_static(bsoncxx::document::value doc); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(void) init_from_static(bsoncxx::document::value doc); // // Constructs a new scoped_bson_t from the provided optional document. // // The internal bson_t is initialized if the optional contains a document. // - explicit scoped_bson_t( + explicit MONGOCXX_ABI_EXPORT_CDECL_TESTING() scoped_bson_t( bsoncxx::v_noabi::stdx::optional doc); // @@ -107,7 +108,8 @@ class MONGOCXX_ABI_EXPORT_TESTING scoped_bson_t { // // The internal bson_t is initialized if the optional contains a document. // - void init_from_static( + MONGOCXX_ABI_EXPORT_CDECL_TESTING(void) + init_from_static( bsoncxx::v_noabi::stdx::optional doc); // @@ -116,7 +118,7 @@ class MONGOCXX_ABI_EXPORT_TESTING scoped_bson_t { // This is equivalent to calling libmongoc's bson_init() and informing this scoped_bson_t // instance that it should call bson_destroy on the internal bson_t when destructed. // - void init(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(void) init(); // // Marks this bson_t as initialized (presumably by another libmongoc function). @@ -125,9 +127,9 @@ class MONGOCXX_ABI_EXPORT_TESTING scoped_bson_t { // internally (possibly as a side effect of a function call) so this is a way of explictly // saying so. // - void flag_init(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(void) flag_init(); - ~scoped_bson_t(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING() ~scoped_bson_t(); scoped_bson_t(const scoped_bson_t& rhs) = delete; scoped_bson_t& operator=(const scoped_bson_t& rhs) = delete; @@ -141,15 +143,15 @@ class MONGOCXX_ABI_EXPORT_TESTING scoped_bson_t { // output argument of another function), be sure to call flag_init() // first. // - bson_t* bson(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(bson_t*) bson(); // // First calls flag_init() then returns a pointer to the wrapped internal bson_t structure. // - bson_t* bson_for_init(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(bson_t*) bson_for_init(); - bsoncxx::v_noabi::document::view view(); - bsoncxx::v_noabi::document::value steal(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(bsoncxx::v_noabi::document::view) view(); + MONGOCXX_ABI_EXPORT_CDECL_TESTING(bsoncxx::v_noabi::document::value) steal(); private: bson_t _bson; diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_concern.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_concern.cpp index a4ca934de1..f90d2d27df 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_concern.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_concern.cpp @@ -125,11 +125,11 @@ bsoncxx::v_noabi::document::value read_concern::to_document() const { return doc.extract(); } -bool MONGOCXX_CALL operator==(const read_concern& lhs, const read_concern& rhs) { +bool operator==(const read_concern& lhs, const read_concern& rhs) { return lhs.acknowledge_level() == rhs.acknowledge_level(); } -bool MONGOCXX_CALL operator!=(const read_concern& lhs, const read_concern& rhs) { +bool operator!=(const read_concern& lhs, const read_concern& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_preference.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_preference.cpp index 6b07cae7ca..75fca3a25f 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_preference.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/read_preference.cpp @@ -138,12 +138,12 @@ const stdx::optional read_preference::hedge() return stdx::optional{}; } -bool MONGOCXX_CALL operator==(const read_preference& lhs, const read_preference& rhs) { +bool operator==(const read_preference& lhs, const read_preference& rhs) { return (lhs.mode() == rhs.mode()) && (lhs.tags() == rhs.tags()) && (lhs.max_staleness() == rhs.max_staleness()); } -bool MONGOCXX_CALL operator!=(const read_preference& lhs, const read_preference& rhs) { +bool operator!=(const read_preference& lhs, const read_preference& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/bulk_write.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/bulk_write.cpp index c2ec4a7b6b..97afd36e63 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/bulk_write.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/bulk_write.cpp @@ -60,10 +60,10 @@ bsoncxx::v_noabi::document::view bulk_write::view() const { return _response.view(); } -bool MONGOCXX_CALL operator==(const bulk_write& lhs, const bulk_write& rhs) { +bool operator==(const bulk_write& lhs, const bulk_write& rhs) { return lhs.view() == rhs.view(); } -bool MONGOCXX_CALL operator!=(const bulk_write& lhs, const bulk_write& rhs) { +bool operator!=(const bulk_write& lhs, const bulk_write& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/delete.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/delete.cpp index 14535529eb..846e29498d 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/delete.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/delete.cpp @@ -30,10 +30,10 @@ std::int32_t delete_result::deleted_count() const { return _result.deleted_count(); } -bool MONGOCXX_CALL operator==(const delete_result& lhs, const delete_result& rhs) { +bool operator==(const delete_result& lhs, const delete_result& rhs) { return lhs.result() == rhs.result(); } -bool MONGOCXX_CALL operator!=(const delete_result& lhs, const delete_result& rhs) { +bool operator!=(const delete_result& lhs, const delete_result& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/gridfs/upload.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/gridfs/upload.cpp index d2bd1a9167..73f43ebda4 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/gridfs/upload.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/gridfs/upload.cpp @@ -30,10 +30,10 @@ const bsoncxx::v_noabi::types::bson_value::view& upload::id() const { return _id; } -bool MONGOCXX_CALL operator==(const upload& lhs, const upload& rhs) { +bool operator==(const upload& lhs, const upload& rhs) { return lhs.id() == rhs.id(); } -bool MONGOCXX_CALL operator!=(const upload& lhs, const upload& rhs) { +bool operator!=(const upload& lhs, const upload& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_many.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_many.cpp index 782b706730..b5b5aa9639 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_many.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_many.cpp @@ -57,7 +57,7 @@ insert_many::id_map insert_many::inserted_ids() const { return _inserted_ids; } -bool MONGOCXX_CALL operator==(const insert_many& lhs, const insert_many& rhs) { +bool operator==(const insert_many& lhs, const insert_many& rhs) { if (lhs.result() != rhs.result()) { return false; } else if (lhs.inserted_ids().size() != rhs.inserted_ids().size()) { @@ -72,7 +72,7 @@ bool MONGOCXX_CALL operator==(const insert_many& lhs, const insert_many& rhs) { } return true; } -bool MONGOCXX_CALL operator!=(const insert_many& lhs, const insert_many& rhs) { +bool operator!=(const insert_many& lhs, const insert_many& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_one.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_one.cpp index aa9ecff6fd..96b473f5ff 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_one.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/insert_one.cpp @@ -35,10 +35,10 @@ const bsoncxx::v_noabi::types::bson_value::view& insert_one::inserted_id() const return _inserted_id; } -bool MONGOCXX_CALL operator==(const insert_one& lhs, const insert_one& rhs) { +bool operator==(const insert_one& lhs, const insert_one& rhs) { return ((lhs.result() == rhs.result()) && (lhs.inserted_id() == rhs.inserted_id())); } -bool MONGOCXX_CALL operator!=(const insert_one& lhs, const insert_one& rhs) { +bool operator!=(const insert_one& lhs, const insert_one& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/replace_one.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/replace_one.cpp index dfb9c61dfa..50ac0a7282 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/replace_one.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/replace_one.cpp @@ -41,10 +41,10 @@ stdx::optional replace_one::upserted_id() c return _result.upserted_ids()[0]; } -bool MONGOCXX_CALL operator==(const replace_one& lhs, const replace_one& rhs) { +bool operator==(const replace_one& lhs, const replace_one& rhs) { return lhs.result() == rhs.result(); } -bool MONGOCXX_CALL operator!=(const replace_one& lhs, const replace_one& rhs) { +bool operator!=(const replace_one& lhs, const replace_one& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/update.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/update.cpp index 0f7b839db2..da69240099 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/update.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/result/update.cpp @@ -44,10 +44,10 @@ stdx::optional update::upserted_id() const return _result.upserted_ids()[0]; } -bool MONGOCXX_CALL operator==(const update& lhs, const update& rhs) { +bool operator==(const update& lhs, const update& rhs) { return lhs.result() == rhs.result(); } -bool MONGOCXX_CALL operator!=(const update& lhs, const update& rhs) { +bool operator!=(const update& lhs, const update& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/validation_criteria.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/validation_criteria.cpp index 680ff3dfc7..6e051acbc6 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/validation_criteria.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/validation_criteria.cpp @@ -105,13 +105,11 @@ bsoncxx::v_noabi::document::value validation_criteria::to_document() const { return to_document_deprecated(); } -MONGOCXX_API bool MONGOCXX_CALL operator==(const validation_criteria& lhs, - const validation_criteria& rhs) { +bool operator==(const validation_criteria& lhs, const validation_criteria& rhs) { return ((lhs.rule() == rhs.rule()) && (lhs.level() == rhs.level()) && (lhs.action() == rhs.action())); } -MONGOCXX_API bool MONGOCXX_CALL operator!=(const validation_criteria& lhs, - const validation_criteria& rhs) { +bool operator!=(const validation_criteria& lhs, const validation_criteria& rhs) { return !(lhs == rhs); } diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/write_concern.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/write_concern.cpp index e7c80d7b17..caab53be79 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/write_concern.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/write_concern.cpp @@ -198,7 +198,7 @@ bsoncxx::v_noabi::document::value write_concern::to_document() const { return doc.extract(); } -bool MONGOCXX_CALL operator==(const write_concern& lhs, const write_concern& rhs) { +bool operator==(const write_concern& lhs, const write_concern& rhs) { return std::forward_as_tuple(lhs.journal(), lhs.nodes(), lhs.acknowledge_level(), @@ -212,7 +212,7 @@ bool MONGOCXX_CALL operator==(const write_concern& lhs, const write_concern& rhs rhs.timeout()); } -bool MONGOCXX_CALL operator!=(const write_concern& lhs, const write_concern& rhs) { +bool operator!=(const write_concern& lhs, const write_concern& rhs) { return !(lhs == rhs); } From 48519e3420fc03726858efd6f996a9492a44c284 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:36 -0500 Subject: [PATCH 07/28] Address -Wweak-vtables warnings for exception classes --- benchmark/microbench.cpp | 2 ++ benchmark/microbench.hpp | 7 +++++- .../v_noabi/bsoncxx/exception/exception.hpp | 8 +++++++ src/bsoncxx/lib/CMakeLists.txt | 1 + .../v_noabi/bsoncxx/exception/exception.cpp | 23 +++++++++++++++++++ .../exception/authentication_exception.hpp | 7 ++++++ .../exception/bulk_write_exception.hpp | 7 ++++++ .../v_noabi/mongocxx/exception/exception.hpp | 8 +++++++ .../mongocxx/exception/gridfs_exception.hpp | 7 ++++++ .../mongocxx/exception/logic_error.hpp | 7 ++++++ .../exception/operation_exception.hpp | 7 ++++++ .../mongocxx/exception/query_exception.hpp | 7 ++++++ .../mongocxx/exception/write_exception.hpp | 7 ++++++ .../mongocxx/v_noabi/mongocxx/logger.hpp | 5 ++++ .../v_noabi/mongocxx/options/index.hpp | 14 +++++++++++ src/mongocxx/lib/CMakeLists.txt | 7 ++++++ .../exception/authentication_exception.cpp | 23 +++++++++++++++++++ .../exception/bulk_write_exception.cpp | 23 +++++++++++++++++++ .../v_noabi/mongocxx/exception/exception.cpp | 23 +++++++++++++++++++ .../mongocxx/exception/gridfs_exception.cpp | 23 +++++++++++++++++++ .../mongocxx/exception/logic_error.cpp | 23 +++++++++++++++++++ .../exception/operation_exception.cpp | 2 ++ .../mongocxx/exception/query_exception.cpp | 23 +++++++++++++++++++ .../mongocxx/exception/write_exception.cpp | 23 +++++++++++++++++++ src/mongocxx/test/CMakeLists.txt | 2 ++ src/mongocxx/test/catch_helpers.cpp | 23 +++++++++++++++++++ src/mongocxx/test/catch_helpers.hh | 7 ++++++ 27 files changed, 318 insertions(+), 1 deletion(-) create mode 100644 src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/exception.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/authentication_exception.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/exception.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/logic_error.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/query_exception.cpp create mode 100644 src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/write_exception.cpp create mode 100644 src/mongocxx/test/catch_helpers.cpp diff --git a/benchmark/microbench.cpp b/benchmark/microbench.cpp index 9e363a2b4d..fc01167a38 100644 --- a/benchmark/microbench.cpp +++ b/benchmark/microbench.cpp @@ -26,6 +26,8 @@ bool finished_running(const std::chrono::duration& cu return (curr_time > maxtime || (curr_time > mintime && iter > max_iter)); } +microbench::~microbench() = default; + void microbench::run() { setup(); diff --git a/benchmark/microbench.hpp b/benchmark/microbench.hpp index e3e5c6de7a..aa6c607062 100644 --- a/benchmark/microbench.hpp +++ b/benchmark/microbench.hpp @@ -67,7 +67,12 @@ class microbench { microbench(std::string&& name, double task_size, std::set tags = {}) : _score{task_size}, _tags{tags}, _name{std::move(name)} {} - virtual ~microbench() = default; + virtual ~microbench(); + + microbench(microbench&&) = default; + microbench& operator=(microbench&&) = default; + microbench(const microbench&) = default; + microbench& operator=(const microbench&) = default; void run(); diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp index d474d4dc9b..fa1895ad51 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp @@ -28,6 +28,14 @@ namespace v_noabi { /// its underlying implementation. /// class exception : public std::system_error { + public: + ~exception() override; + + exception(exception&&) = default; + exception& operator=(exception&&) = default; + exception(const exception&) = default; + exception& operator=(const exception&) = default; + using std::system_error::system_error; }; diff --git a/src/bsoncxx/lib/CMakeLists.txt b/src/bsoncxx/lib/CMakeLists.txt index 8bab5f4697..26c849b65a 100644 --- a/src/bsoncxx/lib/CMakeLists.txt +++ b/src/bsoncxx/lib/CMakeLists.txt @@ -22,6 +22,7 @@ set(bsoncxx_sources_v_noabi bsoncxx/v_noabi/bsoncxx/document/value.cpp bsoncxx/v_noabi/bsoncxx/document/view.cpp bsoncxx/v_noabi/bsoncxx/exception/error_code.cpp + bsoncxx/v_noabi/bsoncxx/exception/exception.cpp bsoncxx/v_noabi/bsoncxx/json.cpp bsoncxx/v_noabi/bsoncxx/oid.cpp bsoncxx/v_noabi/bsoncxx/private/itoa.cpp diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/exception.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/exception.cpp new file mode 100644 index 0000000000..c25b008fac --- /dev/null +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/exception/exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace bsoncxx { +namespace v_noabi { + +exception::~exception() = default; + +} // namespace v_noabi +} // namespace bsoncxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception.hpp index d16cbb6b75..5d39880881 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/authentication_exception.hpp @@ -31,6 +31,13 @@ namespace v_noabi { /// class authentication_exception : public operation_exception { public: + ~authentication_exception() override; + + authentication_exception(authentication_exception&&) = default; + authentication_exception& operator=(authentication_exception&&) = default; + authentication_exception(const authentication_exception&) = default; + authentication_exception& operator=(const authentication_exception&) = default; + using operation_exception::operation_exception; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.hpp index 7531b46684..6e3124e0ab 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.hpp @@ -31,6 +31,13 @@ namespace v_noabi { /// class bulk_write_exception : public operation_exception { public: + ~bulk_write_exception() override; + + bulk_write_exception(bulk_write_exception&&) = default; + bulk_write_exception& operator=(bulk_write_exception&&) = default; + bulk_write_exception(const bulk_write_exception&) = default; + bulk_write_exception& operator=(const bulk_write_exception&) = default; + using operation_exception::operation_exception; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp index 33cc79fd90..257d957a85 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp @@ -28,6 +28,14 @@ namespace v_noabi { /// A class to be used as the base class for all mongocxx exceptions. /// class exception : public std::system_error { + public: + ~exception() override; + + exception(exception&&) = default; + exception& operator=(exception&&) = default; + exception(const exception&) = default; + exception& operator=(const exception&) = default; + using system_error::system_error; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.hpp index 26832c5e1c..491995c424 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.hpp @@ -31,6 +31,13 @@ namespace v_noabi { /// class gridfs_exception : public exception { public: + ~gridfs_exception() override; + + gridfs_exception(gridfs_exception&&) = default; + gridfs_exception& operator=(gridfs_exception&&) = default; + gridfs_exception(const gridfs_exception&) = default; + gridfs_exception& operator=(const gridfs_exception&) = default; + using exception::exception; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error.hpp index 757751ff0a..20f517fb6d 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/logic_error.hpp @@ -30,6 +30,13 @@ namespace v_noabi { /// class logic_error : public exception { public: + ~logic_error() override; + + logic_error(logic_error&&) = default; + logic_error& operator=(logic_error&&) = default; + logic_error(const logic_error&) = default; + logic_error& operator=(const logic_error&) = default; + using exception::exception; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp index bdbd0bd91f..07c2a07580 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp @@ -36,6 +36,13 @@ namespace v_noabi { /// class operation_exception : public exception { public: + ~operation_exception() override; + + operation_exception(operation_exception&&) = default; + operation_exception& operator=(operation_exception&&) = default; + operation_exception(const operation_exception&) = default; + operation_exception& operator=(const operation_exception&) = default; + using exception::exception; /// diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception.hpp index eebfc18e13..b7e6490149 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/query_exception.hpp @@ -30,6 +30,13 @@ namespace v_noabi { /// class query_exception : public operation_exception { public: + ~query_exception() override; + + query_exception(query_exception&&) = default; + query_exception& operator=(query_exception&&) = default; + query_exception(const query_exception&) = default; + query_exception& operator=(const query_exception&) = default; + using operation_exception::operation_exception; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception.hpp index 09c2f0e0dc..812e06e41f 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/write_exception.hpp @@ -30,6 +30,13 @@ namespace v_noabi { /// class write_exception : public operation_exception { public: + ~write_exception() override; + + write_exception(write_exception&&) = default; + write_exception& operator=(write_exception&&) = default; + write_exception(const write_exception&) = default; + write_exception& operator=(const write_exception&) = default; + using operation_exception::operation_exception; }; diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp index 815ef46435..4852ee82d7 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/logger.hpp @@ -56,6 +56,11 @@ class logger { public: virtual ~logger(); + logger(logger&&) = default; + logger& operator=(logger&&) = default; + logger(const logger&) = default; + logger& operator=(const logger&) = default; + /// /// Handles a log message. User defined logger implementations may do whatever they wish when /// this is called, such as log the output to a file or send it to a remote server for analysis. diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp index a52a693520..f3617d864e 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp @@ -47,6 +47,13 @@ class index { public: virtual ~base_storage_options(); + base_storage_options(base_storage_options&&) = default; + base_storage_options& operator=(base_storage_options&&) = default; + base_storage_options(const base_storage_options&) = default; + base_storage_options& operator=(const base_storage_options&) = default; + + base_storage_options() = default; + private: friend ::mongocxx::v_noabi::options::index; @@ -60,6 +67,13 @@ class index { public: ~wiredtiger_storage_options() override; + wiredtiger_storage_options(wiredtiger_storage_options&&) = default; + wiredtiger_storage_options& operator=(wiredtiger_storage_options&&) = default; + wiredtiger_storage_options(const wiredtiger_storage_options&) = default; + wiredtiger_storage_options& operator=(const wiredtiger_storage_options&) = default; + + wiredtiger_storage_options() = default; + /// /// Set the WiredTiger configuration string. /// diff --git a/src/mongocxx/lib/CMakeLists.txt b/src/mongocxx/lib/CMakeLists.txt index bc68250224..224ae798ae 100644 --- a/src/mongocxx/lib/CMakeLists.txt +++ b/src/mongocxx/lib/CMakeLists.txt @@ -35,9 +35,16 @@ set(mongocxx_sources_v_noabi mongocxx/v_noabi/mongocxx/events/topology_closed_event.cpp mongocxx/v_noabi/mongocxx/events/topology_description.cpp mongocxx/v_noabi/mongocxx/events/topology_opening_event.cpp + mongocxx/v_noabi/mongocxx/exception/authentication_exception.cpp + mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.cpp mongocxx/v_noabi/mongocxx/exception/error_code.cpp + mongocxx/v_noabi/mongocxx/exception/exception.cpp + mongocxx/v_noabi/mongocxx/exception/gridfs_exception.cpp + mongocxx/v_noabi/mongocxx/exception/logic_error.cpp mongocxx/v_noabi/mongocxx/exception/operation_exception.cpp + mongocxx/v_noabi/mongocxx/exception/query_exception.cpp mongocxx/v_noabi/mongocxx/exception/server_error_code.cpp + mongocxx/v_noabi/mongocxx/exception/write_exception.cpp mongocxx/v_noabi/mongocxx/gridfs/bucket.cpp mongocxx/v_noabi/mongocxx/gridfs/downloader.cpp mongocxx/v_noabi/mongocxx/gridfs/uploader.cpp diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/authentication_exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/authentication_exception.cpp new file mode 100644 index 0000000000..f0ea5a69ae --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/authentication_exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +authentication_exception::~authentication_exception() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.cpp new file mode 100644 index 0000000000..516ae999b3 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/bulk_write_exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +bulk_write_exception::~bulk_write_exception() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/exception.cpp new file mode 100644 index 0000000000..751e4dc1b1 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +exception::~exception() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.cpp new file mode 100644 index 0000000000..911ffff8e8 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/gridfs_exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +gridfs_exception::~gridfs_exception() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/logic_error.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/logic_error.cpp new file mode 100644 index 0000000000..a36d9cb97f --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/logic_error.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +logic_error::~logic_error() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/operation_exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/operation_exception.cpp index 0c9ed3336b..bade496dba 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/operation_exception.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/operation_exception.cpp @@ -25,6 +25,8 @@ namespace mongocxx { namespace v_noabi { +operation_exception::~operation_exception() = default; + operation_exception::operation_exception(std::error_code ec, bsoncxx::v_noabi::document::value&& raw_server_error, std::string what_arg) diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/query_exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/query_exception.cpp new file mode 100644 index 0000000000..032a7fe3e4 --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/query_exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +query_exception::~query_exception() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/write_exception.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/write_exception.cpp new file mode 100644 index 0000000000..a363f8d0ec --- /dev/null +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/exception/write_exception.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace v_noabi { + +write_exception::~write_exception() = default; + +} // namespace v_noabi +} // namespace mongocxx diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index ac7aad8dae..e1fe0ef009 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -43,6 +43,7 @@ add_library(spec_test_common OBJECT add_executable(test_driver bulk_write.cpp + catch_helpers.cpp change_streams.cpp client_session.cpp client_side_encryption.cpp @@ -332,6 +333,7 @@ endif() set_dist_list(src_mongocxx_test_DIST CMakeLists.txt bulk_write.cpp + catch_helpers.cpp catch_helpers.hh change_streams.cpp client_helpers.cpp diff --git a/src/mongocxx/test/catch_helpers.cpp b/src/mongocxx/test/catch_helpers.cpp new file mode 100644 index 0000000000..8b8fd96ed7 --- /dev/null +++ b/src/mongocxx/test/catch_helpers.cpp @@ -0,0 +1,23 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +namespace mongocxx { +namespace test_util { + +mongocxx_exception_matcher::~mongocxx_exception_matcher() = default; + +} // namespace test_util +} // namespace mongocxx diff --git a/src/mongocxx/test/catch_helpers.hh b/src/mongocxx/test/catch_helpers.hh index f16c6a04fc..f74dfea778 100644 --- a/src/mongocxx/test/catch_helpers.hh +++ b/src/mongocxx/test/catch_helpers.hh @@ -34,6 +34,13 @@ class mongocxx_exception_matcher : public Catch::Matchers::MatcherBase Date: Tue, 3 Sep 2024 13:37:36 -0500 Subject: [PATCH 08/28] Add __cdecl to main() in examples --- .evergreen/build_snapshot_rpm.sh | 8 +++---- examples/CMakeLists.txt | 10 +++++++++ examples/bsoncxx/builder_basic.cpp | 4 +++- examples/bsoncxx/builder_core.cpp | 4 +++- examples/bsoncxx/builder_list.cpp | 4 +++- examples/bsoncxx/builder_stream.cpp | 4 +++- .../bsoncxx/builder_stream_customization.cpp | 4 +++- examples/bsoncxx/decimal128.cpp | 4 +++- examples/bsoncxx/getting_values.cpp | 4 +++- examples/bsoncxx/view_and_value.cpp | 4 +++- examples/macros.hh | 21 +++++++++++++++++++ examples/mongocxx/aggregate.cpp | 4 +++- ...tic_client_side_field_level_encryption.cpp | 2 ++ examples/mongocxx/bulk_write.cpp | 4 +++- examples/mongocxx/causal_consistency.cpp | 4 +++- examples/mongocxx/change_streams.cpp | 4 +++- examples/mongocxx/client_session.cpp | 4 +++- examples/mongocxx/connect.cpp | 4 +++- examples/mongocxx/create.cpp | 4 +++- examples/mongocxx/document_validation.cpp | 4 +++- examples/mongocxx/exception.cpp | 4 +++- examples/mongocxx/explicit_encryption.cpp | 4 +++- .../explicit_encryption_auto_decryption.cpp | 4 +++- .../mongocxx/get_values_from_documents.cpp | 2 ++ examples/mongocxx/gridfs.cpp | 4 +++- examples/mongocxx/index.cpp | 4 +++- examples/mongocxx/inserted_id.cpp | 4 +++- examples/mongocxx/instance_management.cpp | 2 ++ .../mongocxx/mongodb.com/usage_overview.cpp | 4 +++- examples/mongocxx/pool.cpp | 4 +++- examples/mongocxx/query.cpp | 4 +++- examples/mongocxx/query_projection.cpp | 4 +++- examples/mongocxx/remove.cpp | 4 +++- ...ide_field_level_encryption_enforcement.cpp | 4 +++- examples/mongocxx/tailable_cursor.cpp | 2 ++ examples/mongocxx/tutorial.cpp | 4 +++- examples/mongocxx/update.cpp | 4 +++- examples/mongocxx/view_or_value_variant.cpp | 4 +++- examples/mongocxx/with_transaction.cpp | 4 +++- 39 files changed, 139 insertions(+), 36 deletions(-) create mode 100644 examples/macros.hh diff --git a/.evergreen/build_snapshot_rpm.sh b/.evergreen/build_snapshot_rpm.sh index 1a9d39e21f..d595567516 100755 --- a/.evergreen/build_snapshot_rpm.sh +++ b/.evergreen/build_snapshot_rpm.sh @@ -124,10 +124,10 @@ sudo mock -r ${config} --use-bootstrap-image --isolation=simple --copyin "${mock sudo mock -r ${config} --use-bootstrap-image --isolation=simple --cwd "/tmp/${build_dir}" --chroot -- /bin/sh -c "( rpm -Uvh ../mock-result/*.rpm && - /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o runcommand_examples examples/mongocxx/mongodb.com/runcommand_examples.cpp -lmongocxx -lbsoncxx && - /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o aggregation_examples examples/mongocxx/mongodb.com/aggregation_examples.cpp -lmongocxx -lbsoncxx && - /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o index_examples examples/mongocxx/mongodb.com/index_examples.cpp -lmongocxx -lbsoncxx && - /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o documentation_examples examples/mongocxx/mongodb.com/documentation_examples.cpp -lmongocxx -lbsoncxx + /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o runcommand_examples examples/mongocxx/mongodb.com/runcommand_examples.cpp -lmongocxx -lbsoncxx && + /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o aggregation_examples examples/mongocxx/mongodb.com/aggregation_examples.cpp -lmongocxx -lbsoncxx && + /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o index_examples examples/mongocxx/mongodb.com/index_examples.cpp -lmongocxx -lbsoncxx && + /usr/bin/g++ -I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o documentation_examples examples/mongocxx/mongodb.com/documentation_examples.cpp -lmongocxx -lbsoncxx )" if [ ! -e "${mock_root}/tmp/${build_dir}/runcommand_examples" ]; then diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index 771c434a04..c8881058f3 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -66,6 +66,9 @@ function(add_examples_executable source) add_executable(${target_name} EXCLUDE_FROM_ALL ${source}) target_link_libraries(${target_name} PRIVATE ${PARSED_LIBRARIES}) + # Permit `#include `. + target_include_directories(${target_name} PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/..) + # Keep executables in separate directories. set_target_properties(${target_name} PROPERTIES OUTPUT_NAME ${name} @@ -123,6 +126,12 @@ file(GLOB_RECURSE mongocxx_examples_sources "mongocxx/*.cpp" ) +file(GLOB_RECURSE examples_headers + RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} + CONFIGURE_DEPENDS + "*.hh" +) + foreach(source ${api_examples_sources}) add_examples_executable(${source} LIBRARIES mongocxx_target) endforeach() @@ -155,6 +164,7 @@ set_local_dist (examples_DIST_local ${api_examples_sources} ${bsoncxx_examples_sources} ${mongocxx_examples_sources} + ${examples_headers} README.md add_subdirectory/.gitignore add_subdirectory/CMakeLists.txt diff --git a/examples/bsoncxx/builder_basic.cpp b/examples/bsoncxx/builder_basic.cpp index b029a7ee39..c1b1b94e0f 100644 --- a/examples/bsoncxx/builder_basic.cpp +++ b/examples/bsoncxx/builder_basic.cpp @@ -19,9 +19,11 @@ #include #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { // bsoncxx::builder::basic presents a BSON-construction interface familiar to users of the // server's // BSON library or the Java driver. diff --git a/examples/bsoncxx/builder_core.cpp b/examples/bsoncxx/builder_core.cpp index 64311546ba..ae2627ffd9 100644 --- a/examples/bsoncxx/builder_core.cpp +++ b/examples/bsoncxx/builder_core.cpp @@ -15,9 +15,11 @@ #include #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { // bsoncxx::builder::core is a low-level primitive that can be useful for building other // BSON abstractions. Most users should just use builder::stream or builder::basic. diff --git a/examples/bsoncxx/builder_list.cpp b/examples/bsoncxx/builder_list.cpp index b9a1f57d11..8964c4d55a 100644 --- a/examples/bsoncxx/builder_list.cpp +++ b/examples/bsoncxx/builder_list.cpp @@ -18,9 +18,11 @@ #include #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { using namespace bsoncxx::builder; // diff --git a/examples/bsoncxx/builder_stream.cpp b/examples/bsoncxx/builder_stream.cpp index e0d7223274..4d50379a53 100644 --- a/examples/bsoncxx/builder_stream.cpp +++ b/examples/bsoncxx/builder_stream.cpp @@ -17,9 +17,11 @@ #include #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { using builder::stream::array; using builder::stream::document; diff --git a/examples/bsoncxx/builder_stream_customization.cpp b/examples/bsoncxx/builder_stream_customization.cpp index df9c4ed0de..87879779da 100644 --- a/examples/bsoncxx/builder_stream_customization.cpp +++ b/examples/bsoncxx/builder_stream_customization.cpp @@ -19,6 +19,8 @@ #include #include +#include + using namespace bsoncxx; // concatenates arbitrary ranges into an array context @@ -68,7 +70,7 @@ range_kvp_appender make_range_kvp_appender(begin_t&& begin, end_ std::forward(end)); } -int main() { +int EXAMPLES_CDECL main() { using builder::stream::array; using builder::stream::document; using builder::stream::finalize; diff --git a/examples/bsoncxx/decimal128.cpp b/examples/bsoncxx/decimal128.cpp index 513424f4b3..8ba1ec4ca0 100644 --- a/examples/bsoncxx/decimal128.cpp +++ b/examples/bsoncxx/decimal128.cpp @@ -20,9 +20,11 @@ #include #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { // Convert a string to BSON Decimal128. decimal128 d128; try { diff --git a/examples/bsoncxx/getting_values.cpp b/examples/bsoncxx/getting_values.cpp index 143c1c591a..88a90bc922 100644 --- a/examples/bsoncxx/getting_values.cpp +++ b/examples/bsoncxx/getting_values.cpp @@ -21,9 +21,11 @@ #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { using namespace builder::stream; builder::stream::document build_doc; diff --git a/examples/bsoncxx/view_and_value.cpp b/examples/bsoncxx/view_and_value.cpp index 90e91e4d12..1fe9637ca5 100644 --- a/examples/bsoncxx/view_and_value.cpp +++ b/examples/bsoncxx/view_and_value.cpp @@ -29,9 +29,11 @@ #include #include +#include + using namespace bsoncxx; -int main() { +int EXAMPLES_CDECL main() { // This example will cover the read-only BSON interface. // Lets first build up a non-trivial BSON document using the builder interface. diff --git a/examples/macros.hh b/examples/macros.hh new file mode 100644 index 0000000000..2b477ea889 --- /dev/null +++ b/examples/macros.hh @@ -0,0 +1,21 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#pragma once + +#if defined(_MSC_VER) +#define EXAMPLES_CDECL __cdecl +#else +#define EXAMPLES_CDECL +#endif diff --git a/examples/mongocxx/aggregate.cpp b/examples/mongocxx/aggregate.cpp index c16b46f6d5..a8ac725f7b 100644 --- a/examples/mongocxx/aggregate.cpp +++ b/examples/mongocxx/aggregate.cpp @@ -22,10 +22,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/automatic_client_side_field_level_encryption.cpp b/examples/mongocxx/automatic_client_side_field_level_encryption.cpp index 378bfce83f..c36b81cb25 100644 --- a/examples/mongocxx/automatic_client_side_field_level_encryption.cpp +++ b/examples/mongocxx/automatic_client_side_field_level_encryption.cpp @@ -32,6 +32,8 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; diff --git a/examples/mongocxx/bulk_write.cpp b/examples/mongocxx/bulk_write.cpp index a9fd84d33d..dfe8ecfd79 100644 --- a/examples/mongocxx/bulk_write.cpp +++ b/examples/mongocxx/bulk_write.cpp @@ -22,10 +22,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/causal_consistency.cpp b/examples/mongocxx/causal_consistency.cpp index 6ef619697e..295f4c610b 100644 --- a/examples/mongocxx/causal_consistency.cpp +++ b/examples/mongocxx/causal_consistency.cpp @@ -31,12 +31,14 @@ #include #include +#include + using bsoncxx::builder::stream::close_document; using bsoncxx::builder::stream::document; using bsoncxx::builder::stream::finalize; using bsoncxx::builder::stream::open_document; -int main() { +int EXAMPLES_CDECL main() { if (const char* const topology_env = std::getenv("MONGOCXX_TEST_TOPOLOGY")) { const auto topology = std::string(topology_env); if (topology != "replica") { diff --git a/examples/mongocxx/change_streams.cpp b/examples/mongocxx/change_streams.cpp index f56be96a9c..f2eb79aa13 100644 --- a/examples/mongocxx/change_streams.cpp +++ b/examples/mongocxx/change_streams.cpp @@ -26,6 +26,8 @@ #include #include +#include + namespace { // watch_forever iterates the change stream until an error occurs. @@ -47,7 +49,7 @@ namespace { } // namespace -int main(int argc, char* argv[]) { +int EXAMPLES_CDECL main(int argc, char* argv[]) { if (std::getenv("MONGOCXX_TEST_TOPOLOGY")) { std::cerr << "Skipping: change_streams example should not be run by tests" << std::endl; return 0; diff --git a/examples/mongocxx/client_session.cpp b/examples/mongocxx/client_session.cpp index fd1370956b..17356fd414 100644 --- a/examples/mongocxx/client_session.cpp +++ b/examples/mongocxx/client_session.cpp @@ -23,12 +23,14 @@ #include #include +#include + using bsoncxx::to_json; using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; using namespace mongocxx; -int main() { +int EXAMPLES_CDECL main() { if (const char* const topology_env = std::getenv("MONGOCXX_TEST_TOPOLOGY")) { const auto topology = std::string(topology_env); if (topology != "replica") { diff --git a/examples/mongocxx/connect.cpp b/examples/mongocxx/connect.cpp index 35f865cbe2..d3211eeead 100644 --- a/examples/mongocxx/connect.cpp +++ b/examples/mongocxx/connect.cpp @@ -25,6 +25,8 @@ #include #include +#include + namespace { class logger final : public mongocxx::logger { @@ -50,7 +52,7 @@ std::unique_ptr make_logger() { } // namespace -int main(int argc, char* argv[]) { +int EXAMPLES_CDECL main(int argc, char* argv[]) { using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; diff --git a/examples/mongocxx/create.cpp b/examples/mongocxx/create.cpp index 7c8b0d57ea..065e05f140 100644 --- a/examples/mongocxx/create.cpp +++ b/examples/mongocxx/create.cpp @@ -22,11 +22,13 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_array; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/document_validation.cpp b/examples/mongocxx/document_validation.cpp index aea16fbf5a..986eea820b 100644 --- a/examples/mongocxx/document_validation.cpp +++ b/examples/mongocxx/document_validation.cpp @@ -22,13 +22,15 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; using bsoncxx::stdx::string_view; using mongocxx::collection; using mongocxx::validation_criteria; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/exception.cpp b/examples/mongocxx/exception.cpp index b773143690..713258953e 100644 --- a/examples/mongocxx/exception.cpp +++ b/examples/mongocxx/exception.cpp @@ -27,10 +27,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // Do not print error messages when run in CI to prevent MSBuild diagnostic format detection // from causing build failures. There is currently no way to specify // IgnoreStandardErrorWarningFormat=true via CMake or CLI. See: diff --git a/examples/mongocxx/explicit_encryption.cpp b/examples/mongocxx/explicit_encryption.cpp index 7252ddf520..36ca490c55 100644 --- a/examples/mongocxx/explicit_encryption.cpp +++ b/examples/mongocxx/explicit_encryption.cpp @@ -31,6 +31,8 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; @@ -45,7 +47,7 @@ using namespace mongocxx; const int kKeyLength = 96; -int main() { +int EXAMPLES_CDECL main() { instance inst{}; // This must be the same master key that was used to create diff --git a/examples/mongocxx/explicit_encryption_auto_decryption.cpp b/examples/mongocxx/explicit_encryption_auto_decryption.cpp index 56107fae0d..c805c8d3c7 100644 --- a/examples/mongocxx/explicit_encryption_auto_decryption.cpp +++ b/examples/mongocxx/explicit_encryption_auto_decryption.cpp @@ -31,6 +31,8 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; @@ -45,7 +47,7 @@ using namespace mongocxx; const int kKeyLength = 96; -int main() { +int EXAMPLES_CDECL main() { instance inst{}; // This must be the same master key that was used to create diff --git a/examples/mongocxx/get_values_from_documents.cpp b/examples/mongocxx/get_values_from_documents.cpp index bf2b0f9587..2b63115858 100644 --- a/examples/mongocxx/get_values_from_documents.cpp +++ b/examples/mongocxx/get_values_from_documents.cpp @@ -20,6 +20,8 @@ #include #include +#include + using bsoncxx::type; using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_array; diff --git a/examples/mongocxx/gridfs.cpp b/examples/mongocxx/gridfs.cpp index 2dc148a985..405253385f 100644 --- a/examples/mongocxx/gridfs.cpp +++ b/examples/mongocxx/gridfs.cpp @@ -22,9 +22,11 @@ #include #include +#include + using namespace mongocxx; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/index.cpp b/examples/mongocxx/index.cpp index bad4cfe200..7e740e73b6 100644 --- a/examples/mongocxx/index.cpp +++ b/examples/mongocxx/index.cpp @@ -18,10 +18,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/inserted_id.cpp b/examples/mongocxx/inserted_id.cpp index f59c64a166..0abc89d1f0 100644 --- a/examples/mongocxx/inserted_id.cpp +++ b/examples/mongocxx/inserted_id.cpp @@ -21,10 +21,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/instance_management.cpp b/examples/mongocxx/instance_management.cpp index 9255a40ff6..faaefd06dd 100644 --- a/examples/mongocxx/instance_management.cpp +++ b/examples/mongocxx/instance_management.cpp @@ -23,6 +23,8 @@ #include #include +#include + namespace { // The mongocxx::instance constructor and destructor initialize and shut down the driver, diff --git a/examples/mongocxx/mongodb.com/usage_overview.cpp b/examples/mongocxx/mongodb.com/usage_overview.cpp index e991525475..de9734459d 100644 --- a/examples/mongocxx/mongodb.com/usage_overview.cpp +++ b/examples/mongocxx/mongodb.com/usage_overview.cpp @@ -24,10 +24,12 @@ #include #include +#include + // NOTE: Any time this file is modified, a WEBSITE ticket should be opened to sync the changes with // the "What is MongoDB" webpage, which the example was originally added to as part of WEBSITE-5148. -int main() { +int EXAMPLES_CDECL main() { // 1. Connect to MongoDB instance running on localhost mongocxx::instance instance{}; mongocxx::client client{mongocxx::uri{}}; diff --git a/examples/mongocxx/pool.cpp b/examples/mongocxx/pool.cpp index 9f2a48a474..dbca4d6067 100644 --- a/examples/mongocxx/pool.cpp +++ b/examples/mongocxx/pool.cpp @@ -27,9 +27,11 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/query.cpp b/examples/mongocxx/query.cpp index 7935b17f40..dc6462adf2 100644 --- a/examples/mongocxx/query.cpp +++ b/examples/mongocxx/query.cpp @@ -23,11 +23,13 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_array; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/query_projection.cpp b/examples/mongocxx/query_projection.cpp index 203b264b3f..1d106489f3 100644 --- a/examples/mongocxx/query_projection.cpp +++ b/examples/mongocxx/query_projection.cpp @@ -22,10 +22,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/remove.cpp b/examples/mongocxx/remove.cpp index 419ad532b3..7cc58d42b4 100644 --- a/examples/mongocxx/remove.cpp +++ b/examples/mongocxx/remove.cpp @@ -18,10 +18,12 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/server_side_field_level_encryption_enforcement.cpp b/examples/mongocxx/server_side_field_level_encryption_enforcement.cpp index 0897c31203..2d2e16564d 100644 --- a/examples/mongocxx/server_side_field_level_encryption_enforcement.cpp +++ b/examples/mongocxx/server_side_field_level_encryption_enforcement.cpp @@ -31,6 +31,8 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; @@ -47,7 +49,7 @@ using namespace mongocxx; const int kKeyLength = 96; -int main() { +int EXAMPLES_CDECL main() { instance inst{}; // This must be the same master key that was used to create diff --git a/examples/mongocxx/tailable_cursor.cpp b/examples/mongocxx/tailable_cursor.cpp index 9818f953c4..c922a7e46d 100644 --- a/examples/mongocxx/tailable_cursor.cpp +++ b/examples/mongocxx/tailable_cursor.cpp @@ -25,6 +25,8 @@ #include #include +#include + using bsoncxx::builder::basic::document; using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; diff --git a/examples/mongocxx/tutorial.cpp b/examples/mongocxx/tutorial.cpp index 67582e77e2..ba71067ba6 100644 --- a/examples/mongocxx/tutorial.cpp +++ b/examples/mongocxx/tutorial.cpp @@ -14,6 +14,8 @@ #include #include +#include + // Redefine assert after including headers. Release builds may undefine the assert macro and result // in -Wunused-variable warnings. #if defined(NDEBUG) || !defined(assert) @@ -31,7 +33,7 @@ using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_array; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { mongocxx::instance instance{}; // This should be done only once. mongocxx::uri uri("mongodb://localhost:27017"); mongocxx::client client(uri); diff --git a/examples/mongocxx/update.cpp b/examples/mongocxx/update.cpp index e1a0a1871c..cd20ef80b2 100644 --- a/examples/mongocxx/update.cpp +++ b/examples/mongocxx/update.cpp @@ -19,11 +19,13 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_array; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/view_or_value_variant.cpp b/examples/mongocxx/view_or_value_variant.cpp index 2e28a7f4ca..3f83cd8c7e 100644 --- a/examples/mongocxx/view_or_value_variant.cpp +++ b/examples/mongocxx/view_or_value_variant.cpp @@ -20,11 +20,13 @@ #include #include +#include + using bsoncxx::builder::basic::array; using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/with_transaction.cpp b/examples/mongocxx/with_transaction.cpp index 6eb68b3dbb..ba0a2719f2 100644 --- a/examples/mongocxx/with_transaction.cpp +++ b/examples/mongocxx/with_transaction.cpp @@ -31,6 +31,8 @@ #include #include +#include + using bsoncxx::builder::basic::kvp; using bsoncxx::builder::basic::make_document; using namespace mongocxx; @@ -39,7 +41,7 @@ using namespace mongocxx; // This example shows how to use the client_session::with_transaction helper to // conveniently run a custom callback inside of a transaction. // -int main() { +int EXAMPLES_CDECL main() { if (const char* const topology_env = std::getenv("MONGOCXX_TEST_TOPOLOGY")) { const auto topology = std::string(topology_env); if (topology != "replica") { From 1cf9334db966e2e9a6524e02ecc06cecf1baf6ce Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:37 -0500 Subject: [PATCH 09/28] Include __cdecl in specialization of mongocxx::test_util::mock --- src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/mock.hh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/mock.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/mock.hh index 179b72055f..affc7b5fe2 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/mock.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/test_util/mock.hh @@ -37,7 +37,7 @@ template class mock; template -class mock { +class mock { public: using underlying_ptr = R (*)(Args...); using callback = std::function; From f1e60cc85bbb9f3ca08b9b519cb34c71c2c5fe1b Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:37 -0500 Subject: [PATCH 10/28] Include __cdecl in std::function for exported symbols --- .../mongocxx/v_noabi/mongocxx/options/apm.hpp | 99 ++++++++++++------- .../mongocxx/v_noabi/mongocxx/options/apm.cpp | 68 ++++++++----- 2 files changed, 106 insertions(+), 61 deletions(-) diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp index ef1b1c67e5..a8ba180199 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/apm.hpp @@ -57,14 +57,16 @@ class apm { /// method chaining. /// MONGOCXX_ABI_EXPORT_CDECL(apm&) - on_command_started(std::function command_started); + on_command_started(std::function + command_started); /// /// Retrieves the command started monitoring callback. /// /// @return The command started monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) command_started() const; /// @@ -82,14 +84,16 @@ class apm { /// method chaining. /// MONGOCXX_ABI_EXPORT_CDECL(apm&) - on_command_failed(std::function command_failed); + on_command_failed( + std::function command_failed); /// /// Retrieves the command failed monitoring callback. /// /// @return The command failed monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) command_failed() const; /// @@ -108,14 +112,16 @@ class apm { /// MONGOCXX_ABI_EXPORT_CDECL(apm&) on_command_succeeded( - std::function command_succeeded); + std::function + command_succeeded); /// /// Retrieves the command succeeded monitoring callback. /// /// @return The command succeeded monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) command_succeeded() const; /// @@ -133,14 +139,16 @@ class apm { /// method chaining. /// MONGOCXX_ABI_EXPORT_CDECL(apm&) - on_server_opening(std::function server_opening); + on_server_opening( + std::function server_opening); /// /// Retrieves the server opening monitoring callback. /// /// @return The server opening monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) server_opening() const; /// @@ -158,14 +166,16 @@ class apm { /// method chaining. /// MONGOCXX_ABI_EXPORT_CDECL(apm&) - on_server_closed(std::function server_closed); + on_server_closed( + std::function server_closed); /// /// Retrieves the server closed monitoring callback. /// /// @return The server closed monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) server_closed() const; /// @@ -184,14 +194,16 @@ class apm { /// method chaining. /// MONGOCXX_ABI_EXPORT_CDECL(apm&) - on_server_changed(std::function server_changed); + on_server_changed( + std::function server_changed); /// /// Retrieves the server description changed monitoring callback. /// /// @return The server description changed monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) server_changed() const; /// @@ -210,14 +222,16 @@ class apm { /// MONGOCXX_ABI_EXPORT_CDECL(apm&) on_topology_opening( - std::function topology_opening); + std::function + topology_opening); /// /// Retrieves the topology_opening monitoring callback. /// /// @return The topology_opening monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) topology_opening() const; /// @@ -235,14 +249,16 @@ class apm { /// method chaining. /// MONGOCXX_ABI_EXPORT_CDECL(apm&) - on_topology_closed(std::function topology_closed); + on_topology_closed(std::function + topology_closed); /// /// Retrieves the topology closed monitoring callback. /// /// @return The topology closed monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) topology_closed() const; /// @@ -262,14 +278,16 @@ class apm { /// MONGOCXX_ABI_EXPORT_CDECL(apm&) on_topology_changed( - std::function topology_changed); + std::function + topology_changed); /// /// Retrieves the topology description changed monitoring callback. /// /// @return The topology description changed monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) topology_changed() const; /// @@ -288,14 +306,16 @@ class apm { /// MONGOCXX_ABI_EXPORT_CDECL(apm&) on_heartbeat_started( - std::function heartbeat_started); + std::function + heartbeat_started); /// /// Retrieves the heartbeat started monitoring callback. /// /// @return The heartbeat started monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) heartbeat_started() const; /// @@ -314,14 +334,16 @@ class apm { /// MONGOCXX_ABI_EXPORT_CDECL(apm&) on_heartbeat_failed( - std::function heartbeat_failed); + std::function + heartbeat_failed); /// /// Retrieves the heartbeat failed monitoring callback. /// /// @return The heartbeat failed monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) heartbeat_failed() const; /// @@ -341,29 +363,34 @@ class apm { /// MONGOCXX_ABI_EXPORT_CDECL(apm&) on_heartbeat_succeeded( - std::function heartbeat_succeeded); + std::function + heartbeat_succeeded); /// /// Retrieves the heartbeat succeeded monitoring callback. /// /// @return The heartbeat succeeded monitoring callback. /// - MONGOCXX_ABI_EXPORT_CDECL(const std::function&) + MONGOCXX_ABI_EXPORT_CDECL( + const std::function&) heartbeat_succeeded() const; private: - std::function _command_started; - std::function _command_failed; - std::function _command_succeeded; - std::function _server_closed; - std::function _server_changed; - std::function _server_opening; - std::function _topology_closed; - std::function _topology_changed; - std::function _topology_opening; - std::function _heartbeat_started; - std::function _heartbeat_failed; - std::function _heartbeat_succeeded; + std::function _command_started; + std::function _command_failed; + std::function + _command_succeeded; + std::function _server_closed; + std::function _server_changed; + std::function _server_opening; + std::function _topology_closed; + std::function _topology_changed; + std::function _topology_opening; + std::function + _heartbeat_started; + std::function _heartbeat_failed; + std::function + _heartbeat_succeeded; }; } // namespace options diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/options/apm.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/options/apm.cpp index b54081a7f4..a28c909340 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/options/apm.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/options/apm.cpp @@ -21,122 +21,140 @@ namespace v_noabi { namespace options { apm& apm::on_command_started( - std::function command_started) { + std::function command_started) { _command_started = std::move(command_started); return *this; } -const std::function& apm::command_started() const { +const std::function& +apm::command_started() const { return _command_started; } apm& apm::on_command_failed( - std::function command_failed) { + std::function command_failed) { _command_failed = std::move(command_failed); return *this; } -const std::function& apm::command_failed() const { +const std::function& +apm::command_failed() const { return _command_failed; } apm& apm::on_command_succeeded( - std::function command_succeeded) { + std::function + command_succeeded) { _command_succeeded = std::move(command_succeeded); return *this; } -const std::function& apm::command_succeeded() const { +const std::function& +apm::command_succeeded() const { return _command_succeeded; } apm& apm::on_server_opening( - std::function server_opening) { + std::function server_opening) { _server_opening = server_opening; return *this; } -const std::function& apm::server_opening() const { +const std::function& +apm::server_opening() const { return _server_opening; } -apm& apm::on_server_closed(std::function server_closed) { +apm& apm::on_server_closed( + std::function server_closed) { _server_closed = server_closed; return *this; } -const std::function& apm::server_closed() const { +const std::function& +apm::server_closed() const { return _server_closed; } apm& apm::on_server_changed( - std::function server_changed) { + std::function server_changed) { _server_changed = server_changed; return *this; } -const std::function& apm::server_changed() const { +const std::function& +apm::server_changed() const { return _server_changed; } apm& apm::on_topology_opening( - std::function topology_opening) { + std::function + topology_opening) { _topology_opening = topology_opening; return *this; } -const std::function& apm::topology_opening() const { +const std::function& +apm::topology_opening() const { return _topology_opening; } apm& apm::on_topology_closed( - std::function topology_closed) { + std::function topology_closed) { _topology_closed = topology_closed; return *this; } -const std::function& apm::topology_closed() const { +const std::function& +apm::topology_closed() const { return _topology_closed; } apm& apm::on_topology_changed( - std::function topology_changed) { + std::function + topology_changed) { _topology_changed = topology_changed; return *this; } -const std::function& apm::topology_changed() const { +const std::function& +apm::topology_changed() const { return _topology_changed; } apm& apm::on_heartbeat_started( - std::function heartbeat_started) { + std::function + heartbeat_started) { _heartbeat_started = std::move(heartbeat_started); return *this; } -const std::function& apm::heartbeat_started() const { +const std::function& +apm::heartbeat_started() const { return _heartbeat_started; } apm& apm::on_heartbeat_failed( - std::function heartbeat_failed) { + std::function + heartbeat_failed) { _heartbeat_failed = std::move(heartbeat_failed); return *this; } -const std::function& apm::heartbeat_failed() const { +const std::function& +apm::heartbeat_failed() const { return _heartbeat_failed; } apm& apm::on_heartbeat_succeeded( - std::function heartbeat_succeeded) { + std::function + heartbeat_succeeded) { _heartbeat_succeeded = std::move(heartbeat_succeeded); return *this; } -const std::function& apm::heartbeat_succeeded() - const { +const std::function& +apm::heartbeat_succeeded() const { return _heartbeat_succeeded; } From e6af99d40071e6f23db1868bb86beedd5d519e73 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:37 -0500 Subject: [PATCH 11/28] CDRIVER-5789 Workaround missing __cdecl in mongoc_log_func_t --- .../v_noabi/mongocxx/private/libmongoc.cpp | 3 +++ .../mongocxx/v_noabi/mongocxx/private/libmongoc.hh | 14 ++++++++++++++ .../v_noabi/mongocxx/private/libmongoc_symbols.hh | 2 +- 3 files changed, 18 insertions(+), 1 deletion(-) diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.cpp index 0ef695b38c..29c25cb26f 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.cpp @@ -33,6 +33,9 @@ namespace libmongoc { #include "libmongoc_symbols.hh" #undef MONGOCXX_LIBMONGOC_SYMBOL +mongocxx::test_util::mock& log_set_handler = + *new test_util::mock(mongoc_log_set_handler); + #if defined(__GNUC__) && (__GNUC__ >= 6) && !defined(__clang__) #pragma GCC diagnostic pop #endif diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh index b02a45e49b..5597746048 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc.hh @@ -59,6 +59,17 @@ namespace libmongoc { #include "libmongoc_symbols.hh" #undef MONGOCXX_LIBMONGOC_SYMBOL +// CDRIVER-5678 +using log_func_cdecl_t = void(MONGOCXX_ABI_CDECL*)(mongoc_log_level_t log_level, + const char* log_domain, + const char* message, + void* user_data); +using log_set_handler_cdecl_t = void(MONGOCXX_ABI_CDECL*)(log_func_cdecl_t log_func, + void* user_data); + +extern MONGOCXX_ABI_EXPORT_TESTING mongocxx::test_util::mock& + log_set_handler; + #if defined(__GNUC__) && (__GNUC__ >= 6) && !defined(__clang__) #pragma GCC diagnostic pop #endif @@ -69,6 +80,9 @@ namespace libmongoc { #include "libmongoc_symbols.hh" #undef MONGOCXX_LIBMONGOC_SYMBOL +// CDRIVER-5678 +constexpr auto log_set_handler = mongoc_log_set_handler; + #endif } // namespace libmongoc diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc_symbols.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc_symbols.hh index a84d535514..2fdbfe47fa 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc_symbols.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/libmongoc_symbols.hh @@ -278,7 +278,7 @@ MONGOCXX_LIBMONGOC_SYMBOL(index_opt_geo_init) MONGOCXX_LIBMONGOC_SYMBOL(index_opt_init) MONGOCXX_LIBMONGOC_SYMBOL(index_opt_wt_init) MONGOCXX_LIBMONGOC_SYMBOL(init) -MONGOCXX_LIBMONGOC_SYMBOL(log_set_handler) +// MONGOCXX_LIBMONGOC_SYMBOL(log_set_handler) // CDRIVER-5678: not __cdecl. MONGOCXX_LIBMONGOC_SYMBOL(read_concern_copy) MONGOCXX_LIBMONGOC_SYMBOL(read_concern_destroy) MONGOCXX_LIBMONGOC_SYMBOL(read_concern_get_level) From 7ebea8e539ff2b511b9fb1f850a042c17f3ba575 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:38 -0500 Subject: [PATCH 12/28] CXX-3093 Add changelog entry for ABI symbol removal --- CHANGELOG.md | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 2e42fa9cc1..7a41165b0b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -22,6 +22,18 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu - A future minor release plans to raise the minimum supported MongoDB Server version from 3.6 to 4.0. This is in accordance with [MongoDB Software Lifecycle Schedules](https://www.mongodb.com/legal/support-policy/lifecycles). +### Removed + +- Export of private member functions in bsoncxx: + - `bsoncxx::v_noabi::types::bson_value::value::value(const uint8_t*, uint32_t, uint32_t, uint32_t)` + - `bsoncxx::v_noabi::types::bson_value::view::_init(void*)` + - `bsoncxx::v_noabi::types::bson_value::view::view(const uint8_t*, uint32_t, uint32_t, uint32_t)` + - `bsoncxx::v_noabi::types::bson_value::view::view(void*)` +- Export of private member functions in mongocxx: + - `mongocxx::v_noabi::options::change_stream::as_bson()` + - `mongocxx::v_noabi::options::aggregate::append(bsoncxx::v_noabi::builder::basic::document&)` + - `mongocxx::v_noabi::options::index::storage_options()` + ## 3.10.3 [Unreleased] From f8ae8570c5e4a9915c334b2906db5a1cebb22ce0 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:38 -0500 Subject: [PATCH 13/28] CXX-3092 Enable /Gv when building test suite with MSVC --- cmake/FetchCatch2.cmake | 5 +++++ examples/CMakeLists.txt | 2 +- src/bsoncxx/test/CMakeLists.txt | 7 ++++++- src/bsoncxx/test/catch.cpp | 21 +++++++++++++++++++++ src/mongocxx/test/CMakeLists.txt | 6 +++++- src/mongocxx/test/catch.cpp | 21 +++++++++++++++++++++ 6 files changed, 59 insertions(+), 3 deletions(-) create mode 100644 src/bsoncxx/test/catch.cpp create mode 100644 src/mongocxx/test/catch.cpp diff --git a/cmake/FetchCatch2.cmake b/cmake/FetchCatch2.cmake index 3ce6c40d2a..bcc2b01e57 100644 --- a/cmake/FetchCatch2.cmake +++ b/cmake/FetchCatch2.cmake @@ -30,6 +30,11 @@ function(fetch_catch2) string(REPLACE " -Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") + # Ensure consistent default calling convention with test executables. + if(MSVC) + string(APPEND CMAKE_CXX_FLAGS " /Gv") + endif() + FetchContent_MakeAvailable(EP_Catch2) # Avoid building unnecessary targets. Use FetchContent_Declare(EXCLUDE_FROM_ALL) in CMake 3.28 and newer. diff --git a/examples/CMakeLists.txt b/examples/CMakeLists.txt index c8881058f3..bcc3d56f1e 100644 --- a/examples/CMakeLists.txt +++ b/examples/CMakeLists.txt @@ -75,7 +75,7 @@ function(add_examples_executable source) RUNTIME_OUTPUT_DIRECTORY ${subdir} ) - # Deliberately use `__vectorcall` by default with MSVC to catch missing `__cdecl`. + # Use `__vectorcall` by default with MSVC to catch missing `__cdecl`. target_compile_options(${target_name} PRIVATE "$<$:/Gv>") # Keep build and run targets completely separate. diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index 50bc2a33d5..5b2e53a2c0 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -36,6 +36,7 @@ add_executable(test_bson bson_util_itoa.cpp bson_validate.cpp bson_value.cpp + catch.cpp exception_guard.cpp json.cpp oid.cpp @@ -62,11 +63,14 @@ target_include_directories(bsoncxx_test_properties INTERFACE ${CMAKE_CURRENT_SOURCE_DIR}/../.. ) target_compile_definitions(bsoncxx_test_properties INTERFACE ${libbson_definitions}) +# Use `__vectorcall` by default with MSVC to catch missing `__cdecl`. +target_compile_options(bsoncxx_test_properties INTERFACE "$<$:/Gv>") add_library(bsoncxx::test_properties ALIAS bsoncxx_test_properties) # Avoid redundant recompilation of catch/main.cpp. add_library(bsoncxx_test_properties_with_main INTERFACE) -target_link_libraries(bsoncxx_test_properties_with_main INTERFACE bsoncxx::test_properties Catch2::Catch2WithMain) +target_link_libraries(bsoncxx_test_properties_with_main INTERFACE bsoncxx::test_properties) +target_sources(bsoncxx_test_properties INTERFACE catch.cpp) add_library(bsoncxx::test_properties_with_main ALIAS bsoncxx_test_properties_with_main) target_link_libraries (test_bson PRIVATE bsoncxx::test_properties_with_main) @@ -158,6 +162,7 @@ set_dist_list(src_bsoncxx_test_DIST bson_util_itoa.cpp bson_validate.cpp bson_value.cpp + catch.cpp catch.hh exception_guard.cpp exception_guard.hh diff --git a/src/bsoncxx/test/catch.cpp b/src/bsoncxx/test/catch.cpp new file mode 100644 index 0000000000..a4d4abfd7f --- /dev/null +++ b/src/bsoncxx/test/catch.cpp @@ -0,0 +1,21 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include + +int BSONCXX_ABI_CDECL main(int argc, char* argv[]) { + return Catch::Session().run(argc, argv); +} diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index e1fe0ef009..c4bddcbff4 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -157,10 +157,13 @@ target_include_directories(mongocxx_test_properties INTERFACE # Allow `#include `. ${CMAKE_CURRENT_SOURCE_DIR}/../.. ) +# Use `__vectorcall` by default with MSVC to catch missing `__cdecl`. +target_compile_options(mongocxx_test_properties INTERFACE "$<$:/Gv>") add_library(mongocxx::test_properties ALIAS mongocxx_test_properties) add_library(mongocxx_test_properties_with_main INTERFACE) -target_link_libraries(mongocxx_test_properties_with_main INTERFACE mongocxx::test_properties Catch2::Catch2WithMain) +target_link_libraries(mongocxx_test_properties_with_main INTERFACE mongocxx::test_properties) +target_sources(mongocxx_test_properties_with_main INTERFACE catch.cpp) add_library(mongocxx::test_properties_with_main ALIAS mongocxx_test_properties_with_main) set_property( @@ -335,6 +338,7 @@ set_dist_list(src_mongocxx_test_DIST bulk_write.cpp catch_helpers.cpp catch_helpers.hh + catch.cpp change_streams.cpp client_helpers.cpp client_helpers.hh diff --git a/src/mongocxx/test/catch.cpp b/src/mongocxx/test/catch.cpp new file mode 100644 index 0000000000..9e11603f04 --- /dev/null +++ b/src/mongocxx/test/catch.cpp @@ -0,0 +1,21 @@ +// Copyright 2009-present MongoDB, Inc. +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +#include + +#include + +int MONGOCXX_ABI_CDECL main(int argc, char* argv[]) { + return Catch::Session().run(argc, argv); +} From 42519e1e759091a52b6c3dba0c1ee87c7e7907de Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:38 -0500 Subject: [PATCH 14/28] doxygen: set ALWAYS_DETAILED_SEC = YES --- Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index 1615cf618a..92ee71a20d 100644 --- a/Doxyfile +++ b/Doxyfile @@ -153,7 +153,7 @@ ABBREVIATE_BRIEF = # description. # The default value is: NO. -ALWAYS_DETAILED_SEC = NO +ALWAYS_DETAILED_SEC = YES # If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all # inherited members of a class in the documentation of that class as if those From 960873f9e844e927cf69fb196b6c0ce71d75293b Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:39 -0500 Subject: [PATCH 15/28] doxygen: set STRICT_PROTO_MATCHING = YES --- Doxyfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Doxyfile b/Doxyfile index 92ee71a20d..b722e328e2 100644 --- a/Doxyfile +++ b/Doxyfile @@ -726,7 +726,7 @@ SORT_BY_SCOPE_NAME = YES # accept a match between prototype and implementation in such cases. # The default value is: NO. -STRICT_PROTO_MATCHING = NO +STRICT_PROTO_MATCHING = YES # The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo # list. This list is created by putting \todo commands in the documentation. From a70c9b1fd6eb521a00abd6ef2f0d13376678f678 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 13:37:39 -0500 Subject: [PATCH 16/28] Disable C4251 and C4275 warnings for exception classes --- .../bsoncxx/v_noabi/bsoncxx/config/compiler.hpp | 6 ------ .../bsoncxx/v_noabi/bsoncxx/config/postlude.hpp | 1 - .../bsoncxx/v_noabi/bsoncxx/exception/exception.hpp | 6 ++++++ .../mongocxx/v_noabi/mongocxx/config/compiler.hpp | 11 ----------- .../mongocxx/v_noabi/mongocxx/config/postlude.hpp | 3 --- .../mongocxx/v_noabi/mongocxx/exception/exception.hpp | 8 ++++++++ .../mongocxx/exception/operation_exception.hpp | 8 ++++++++ .../mongocxx/v_noabi/mongocxx/options/index.hpp | 8 ++++++++ 8 files changed, 30 insertions(+), 21 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp index ad47bbcfc7..18502e00c1 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/compiler.hpp @@ -36,12 +36,6 @@ // clang-format on -// Disable MSVC warnings that cause a lot of noise related to DLL visibility -// for types that we don't control (like std::unique_ptr). -BSONCXX_PUSH_WARNINGS(); -BSONCXX_DISABLE_WARNING(MSVC(4251)); -BSONCXX_DISABLE_WARNING(MSVC(5275)); - // For backward compatibility. Use `inline` instead. #define BSONCXX_INLINE inline BSONCXX_ABI_NO_EXPORT diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp index 17e1035c29..48ad09ce32 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp @@ -15,7 +15,6 @@ // compiler.hpp #undef BSONCXX_INLINE #pragma pop_macro("BSONCXX_INLINE") -BSONCXX_POP_WARNINGS(); #undef BSONCXX_CALL #pragma pop_macro("BSONCXX_CALL") diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp index fa1895ad51..0362233919 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/exception/exception.hpp @@ -23,6 +23,10 @@ namespace bsoncxx { namespace v_noabi { +BSONCXX_PUSH_WARNINGS(); +BSONCXX_DISABLE_WARNING(MSVC(4251)); +BSONCXX_DISABLE_WARNING(MSVC(4275)); + /// /// Class representing any exceptions emitted from the bsoncxx library or /// its underlying implementation. @@ -39,6 +43,8 @@ class exception : public std::system_error { using std::system_error::system_error; }; +BSONCXX_POP_WARNINGS(); + } // namespace v_noabi } // namespace bsoncxx diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp index 5c32336858..63651b0c89 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/compiler.hpp @@ -12,17 +12,6 @@ // See the License for the specific language governing permissions and // limitations under the License. -// TODO: DRY this definition with the one from bsoncxx/config/compiler.hpp per discussion -// here - https://github.com/mongodb/mongo-cxx-driver/pull/374#issuecomment-158179295 -#if defined(_MSC_VER) - -// Disable MSVC warnings that cause a lot of noise related to DLL visibility -// for types that we don't control (like std::unique_ptr). -#pragma warning(push) -#pragma warning(disable : 4251 4275) - -#endif - // For backward compatibility. Use `inline` instead. #define MONGOCXX_INLINE inline MONGOCXX_ABI_NO_EXPORT diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp index eb5b5f30bc..5162a6cdc1 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/config/postlude.hpp @@ -15,9 +15,6 @@ // compiler.hpp #undef MONGOCXX_INLINE #pragma pop_macro("MONGOCXX_INLINE") -#if defined(_MSC_VER) -#pragma warning(pop) -#endif #undef MONGOCXX_CALL #pragma pop_macro("MONGOCXX_CALL") diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp index 257d957a85..6d3ec6a4ae 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/exception.hpp @@ -19,11 +19,16 @@ #include +#include #include namespace mongocxx { namespace v_noabi { +BSONCXX_PUSH_WARNINGS(); +BSONCXX_DISABLE_WARNING(MSVC(4251)); +BSONCXX_DISABLE_WARNING(MSVC(4275)); + /// /// A class to be used as the base class for all mongocxx exceptions. /// @@ -39,9 +44,12 @@ class exception : public std::system_error { using system_error::system_error; }; +BSONCXX_POP_WARNINGS(); + } // namespace v_noabi } // namespace mongocxx +#include #include /// diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp index 07c2a07580..a2f9044174 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/exception/operation_exception.hpp @@ -23,11 +23,16 @@ #include #include +#include #include namespace mongocxx { namespace v_noabi { +BSONCXX_PUSH_WARNINGS(); +BSONCXX_DISABLE_WARNING(MSVC(4251)); +BSONCXX_DISABLE_WARNING(MSVC(4275)); + /// /// Class representing an exception received from a MongoDB server. It includes the server-provided /// error code, if one was available. @@ -84,9 +89,12 @@ class operation_exception : public exception { stdx::optional _raw_server_error; }; +BSONCXX_POP_WARNINGS(); + } // namespace v_noabi } // namespace mongocxx +#include #include /// diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp index f3617d864e..f3abde75c5 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/options/index.hpp @@ -27,6 +27,7 @@ #include #include +#include #include namespace mongocxx { @@ -40,6 +41,10 @@ namespace options { /// class index { public: + BSONCXX_PUSH_WARNINGS(); + BSONCXX_DISABLE_WARNING(MSVC(4251)); + BSONCXX_DISABLE_WARNING(MSVC(4275)); + /// /// Base class representing the optional storage engine options for indexes. /// @@ -97,6 +102,8 @@ class index { stdx::optional _config_string; }; + BSONCXX_POP_WARNINGS(); + MONGOCXX_ABI_EXPORT_CDECL() index(); /// @@ -537,6 +544,7 @@ class index { } // namespace v_noabi } // namespace mongocxx +#include #include /// From 85456b03d286e39a9255dc672705744e3e750082 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Tue, 3 Sep 2024 14:53:49 -0500 Subject: [PATCH 17/28] Restore conflict resolution against latest commits --- .../mongocxx/automatic_client_side_field_level_encryption.cpp | 2 +- examples/mongocxx/get_values_from_documents.cpp | 2 +- examples/mongocxx/instance_management.cpp | 2 +- examples/mongocxx/mongodb.com/aggregation_examples.cpp | 4 +++- examples/mongocxx/mongodb.com/documentation_examples.cpp | 4 +++- examples/mongocxx/mongodb.com/index_examples.cpp | 4 +++- examples/mongocxx/mongodb.com/runcommand_examples.cpp | 4 +++- examples/mongocxx/tailable_cursor.cpp | 2 +- src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp | 2 +- src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp | 2 +- src/mongocxx/test/spec/unified_tests/assert.cpp | 4 ++-- 11 files changed, 20 insertions(+), 12 deletions(-) diff --git a/examples/mongocxx/automatic_client_side_field_level_encryption.cpp b/examples/mongocxx/automatic_client_side_field_level_encryption.cpp index c36b81cb25..bc12bc7f5d 100644 --- a/examples/mongocxx/automatic_client_side_field_level_encryption.cpp +++ b/examples/mongocxx/automatic_client_side_field_level_encryption.cpp @@ -99,7 +99,7 @@ bsoncxx::document::value doc_from_file(std::string path) { } // namespace -int main() { +int EXAMPLES_CDECL main() { instance inst{}; // This must be the same master key that was used to create diff --git a/examples/mongocxx/get_values_from_documents.cpp b/examples/mongocxx/get_values_from_documents.cpp index 2b63115858..74a74a2679 100644 --- a/examples/mongocxx/get_values_from_documents.cpp +++ b/examples/mongocxx/get_values_from_documents.cpp @@ -124,7 +124,7 @@ void iterate_documents(mongocxx::collection& coll) { } // namespace -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/instance_management.cpp b/examples/mongocxx/instance_management.cpp index faaefd06dd..633574880d 100644 --- a/examples/mongocxx/instance_management.cpp +++ b/examples/mongocxx/instance_management.cpp @@ -95,7 +95,7 @@ bool do_work() { } // namespace -int main(int argc, char* argv[]) { +int EXAMPLES_CDECL main(int argc, char* argv[]) { auto uri = mongocxx::uri{(argc >= 2) ? argv[1] : mongocxx::uri::k_default_uri}; configure(std::move(uri)); return do_work() ? EXIT_SUCCESS : EXIT_FAILURE; diff --git a/examples/mongocxx/mongodb.com/aggregation_examples.cpp b/examples/mongocxx/mongodb.com/aggregation_examples.cpp index 95586a15fa..287bd0cf97 100644 --- a/examples/mongocxx/mongodb.com/aggregation_examples.cpp +++ b/examples/mongocxx/mongodb.com/aggregation_examples.cpp @@ -26,6 +26,8 @@ #include #include +#include + using namespace mongocxx; namespace { @@ -144,7 +146,7 @@ void aggregation_examples(const mongocxx::database& db) { } // namespace -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/mongodb.com/documentation_examples.cpp b/examples/mongocxx/mongodb.com/documentation_examples.cpp index 3b151224e8..337d118def 100644 --- a/examples/mongocxx/mongodb.com/documentation_examples.cpp +++ b/examples/mongocxx/mongodb.com/documentation_examples.cpp @@ -33,6 +33,8 @@ #include #include +#include + namespace { template @@ -1700,7 +1702,7 @@ static void queryable_encryption_api(mongocxx::client& client) { } // namespace -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/mongodb.com/index_examples.cpp b/examples/mongocxx/mongodb.com/index_examples.cpp index 1b63f512d5..177e6f1400 100644 --- a/examples/mongocxx/mongodb.com/index_examples.cpp +++ b/examples/mongocxx/mongodb.com/index_examples.cpp @@ -17,6 +17,8 @@ #include #include +#include + namespace { void index_examples(const mongocxx::database& db) { @@ -40,7 +42,7 @@ void index_examples(const mongocxx::database& db) { } // namespace -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/mongodb.com/runcommand_examples.cpp b/examples/mongocxx/mongodb.com/runcommand_examples.cpp index fd172bcf85..749e338626 100644 --- a/examples/mongocxx/mongodb.com/runcommand_examples.cpp +++ b/examples/mongocxx/mongodb.com/runcommand_examples.cpp @@ -19,6 +19,8 @@ #include #include +#include + namespace { void runcommand_examples(mongocxx::database& db) { @@ -36,7 +38,7 @@ void runcommand_examples(mongocxx::database& db) { } // namespace -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/examples/mongocxx/tailable_cursor.cpp b/examples/mongocxx/tailable_cursor.cpp index c922a7e46d..0369e72afb 100644 --- a/examples/mongocxx/tailable_cursor.cpp +++ b/examples/mongocxx/tailable_cursor.cpp @@ -74,7 +74,7 @@ void insert_docs(mongocxx::collection* coll) { } // namespace -int main() { +int EXAMPLES_CDECL main() { // The mongocxx::instance constructor and destructor initialize and shut down the driver, // respectively. Therefore, a mongocxx::instance must be created before using the driver and // must remain alive for as long as the driver is in use. diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp index a812a7df23..162f388b26 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/json.hpp @@ -82,7 +82,7 @@ BSONCXX_ABI_EXPORT_CDECL(document::value) from_json(stdx::string_view json); /// /// @throws bsoncxx::v_noabi::exception with error details if the conversion failed. /// -BSONCXX_API document::value BSONCXX_CALL operator"" _bson(const char* json, size_t len); +BSONCXX_ABI_EXPORT_CDECL(document::value) operator"" _bson(const char* json, size_t len); } // namespace v_noabi } // namespace bsoncxx diff --git a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp index b99cfe6c24..ab06f52594 100644 --- a/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp +++ b/src/bsoncxx/lib/bsoncxx/v_noabi/bsoncxx/json.cpp @@ -99,7 +99,7 @@ document::value from_json(stdx::string_view json) { return document::value{buf, length, bson_free_deleter}; } -document::value BSONCXX_CALL operator"" _bson(const char* str, size_t len) { +document::value operator"" _bson(const char* str, size_t len) { return from_json(stdx::string_view{str, len}); } diff --git a/src/mongocxx/test/spec/unified_tests/assert.cpp b/src/mongocxx/test/spec/unified_tests/assert.cpp index 2ea6bfec96..b946978119 100644 --- a/src/mongocxx/test/spec/unified_tests/assert.cpp +++ b/src/mongocxx/test/spec/unified_tests/assert.cpp @@ -24,12 +24,12 @@ #include #include +#include + #include #include #include -#include - using namespace bsoncxx; using namespace mongocxx; From 5bc41acfa8b27298f17df4cc2d1d1e7dfedd0832 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 4 Sep 2024 09:48:27 -0500 Subject: [PATCH 18/28] Scope "Downloading" messages to avoid misleading repeated output --- cmake/FetchCatch2.cmake | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/cmake/FetchCatch2.cmake b/cmake/FetchCatch2.cmake index bcc2b01e57..2b02b3d23e 100644 --- a/cmake/FetchCatch2.cmake +++ b/cmake/FetchCatch2.cmake @@ -2,8 +2,6 @@ include(FetchContent) -message(STATUS "Downloading Catch2...") - function(fetch_catch2) set(fetch_args "") if (CMAKE_VERSION VERSION_GREATER_EQUAL "3.25.0") @@ -26,6 +24,8 @@ function(fetch_catch2) FetchContent_GetProperties(EP_Catch2) if(NOT ep_catch2_POPULATED) + message(STATUS "Downloading Catch2...") + # Avoid Catch2 compile warnings from being treated as errors. string(REPLACE " -Werror" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}") string(REPLACE " -Werror" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}") @@ -43,9 +43,9 @@ function(fetch_catch2) # Catch2 config vars. set_property(CACHE CATCH_INSTALL_DOCS PROPERTY VALUE OFF) set_property(CACHE CATCH_INSTALL_EXTRAS PROPERTY VALUE OFF) + + message (STATUS "Downloading Catch2... done.") endif() endfunction() fetch_catch2() - -message (STATUS "Downloading Catch2... done.") From f19b89e07badf35908ed5e841ce44fbc94773e20 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 4 Sep 2024 09:48:28 -0500 Subject: [PATCH 19/28] Fix unknown option errors with calc_release_version.py --- etc/calc_release_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/calc_release_version.py b/etc/calc_release_version.py index da8b5925c8..72fdd386f2 100644 --- a/etc/calc_release_version.py +++ b/etc/calc_release_version.py @@ -250,7 +250,7 @@ def iter_tag_lines(): the second is a tag that is associated with that commit. Duplicate commits are possible. """ - output = check_output(['git', 'tag', '--list', '--format=%(*objectname)|%(objectname)|%(refname:strip=2)']) + output = check_output(['git', 'tag', '--list', '--format="%(*objectname)|%(objectname)|%(refname:strip=2)"']) lines = output.splitlines() for l in lines: obj, tagobj, tag = l.split('|', 2) From f891391b823d95ab1927154bd729c88f55a0a4a9 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 4 Sep 2024 09:48:28 -0500 Subject: [PATCH 20/28] Also update debian_package_build.sh with examples include directory --- .evergreen/debian_package_build.sh | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.evergreen/debian_package_build.sh b/.evergreen/debian_package_build.sh index 8dba6d4a83..b234dd3eac 100755 --- a/.evergreen/debian_package_build.sh +++ b/.evergreen/debian_package_build.sh @@ -77,14 +77,13 @@ sudo DEB_BUILD_PROFILES="${DEB_BUILD_PROFILES}" chroot ./unstable-chroot /bin/ba LANG=C /bin/bash -x ./debian/build_snapshot.sh && \ debc ../*.changes && \ dpkg -i ../*.deb && \ - /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o runcommand_examples examples/mongocxx/mongodb.com/runcommand_examples.cpp -lmongocxx -lbsoncxx && \ - /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o aggregation_examples examples/mongocxx/mongodb.com/aggregation_examples.cpp -lmongocxx -lbsoncxx && \ - /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o index_examples examples/mongocxx/mongodb.com/index_examples.cpp -lmongocxx -lbsoncxx && \ - /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -o documentation_examples examples/mongocxx/mongodb.com/documentation_examples.cpp -lmongocxx -lbsoncxx )" + /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o runcommand_examples examples/mongocxx/mongodb.com/runcommand_examples.cpp -lmongocxx -lbsoncxx && \ + /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o aggregation_examples examples/mongocxx/mongodb.com/aggregation_examples.cpp -lmongocxx -lbsoncxx && \ + /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o index_examples examples/mongocxx/mongodb.com/index_examples.cpp -lmongocxx -lbsoncxx && \ + /usr/bin/g++ ${MNMLSTC_INCLUDE:-}-I/usr/include/bsoncxx/v_noabi -I/usr/include/mongocxx/v_noabi -I. -o documentation_examples examples/mongocxx/mongodb.com/documentation_examples.cpp -lmongocxx -lbsoncxx )" [ -e ./unstable-chroot/tmp/mongo-cxx-driver/runcommand_examples ] || (echo "Example 'runcommand_examples' was not built!" ; exit 1) [ -e ./unstable-chroot/tmp/mongo-cxx-driver/aggregation_examples ] || (echo "Example 'aggregation_examples' was not built!" ; exit 1) [ -e ./unstable-chroot/tmp/mongo-cxx-driver/index_examples ] || (echo "Example 'index_examples' was not built!" ; exit 1) [ -e ./unstable-chroot/tmp/mongo-cxx-driver/documentation_examples ] || (echo "Example 'documentation_examples' was not built!" ; exit 1) (cd ./unstable-chroot/tmp/ ; tar zcvf ../../deb.tar.gz *.dsc *.orig.tar.gz *.debian.tar.xz *.build *.deb) - From 26fa6cfab338564f90f950f2a710c3a8e20ac8b3 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 5 Sep 2024 13:13:23 -0500 Subject: [PATCH 21/28] Revert "Fix unknown option errors with calc_release_version.py" This reverts commit f19b89e07badf35908ed5e841ce44fbc94773e20. --- etc/calc_release_version.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/calc_release_version.py b/etc/calc_release_version.py index 72fdd386f2..da8b5925c8 100644 --- a/etc/calc_release_version.py +++ b/etc/calc_release_version.py @@ -250,7 +250,7 @@ def iter_tag_lines(): the second is a tag that is associated with that commit. Duplicate commits are possible. """ - output = check_output(['git', 'tag', '--list', '--format="%(*objectname)|%(objectname)|%(refname:strip=2)"']) + output = check_output(['git', 'tag', '--list', '--format=%(*objectname)|%(objectname)|%(refname:strip=2)']) lines = output.splitlines() for l in lines: obj, tagobj, tag = l.split('|', 2) From 3b0ab8e877e667b7b118f5ceb01214c08e27fdaa Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Sep 2024 15:03:42 -0500 Subject: [PATCH 22/28] Remove private headers from macro guard tests --- src/bsoncxx/test/CMakeLists.txt | 6 +++--- src/mongocxx/test/CMakeLists.txt | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index b276ca45d3..0fed55ce3d 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -146,9 +146,9 @@ if(ENABLE_MACRO_GUARD_TESTS) "include/*.hpp" # Public headers. EXCLUDE_REGEXES "include/bsoncxx/doc\.hpp" # Doc header. - "(include|lib)/.*/(prelude|postlude)\.(hpp|hh)" # Macro guard headers. - "(include|lib)/bsoncxx/v_noabi/bsoncxx/config/.*" # v_noabi config headers. - "include/bsoncxx/v_noabi/bsoncxx/enums/.*" # v_noabi X-macro headers. + "include/.*/(prelude|postlude)\.hpp" # Macro guard headers. + "(include|lib)/bsoncxx/v_noabi/bsoncxx/config/.*\.hpp" # v_noabi config headers. + "include/bsoncxx/v_noabi/bsoncxx/enums/.*\.hpp" # v_noabi X-macro headers. ) endif() diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index e6f9fc3c01..d704ec6c99 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -332,8 +332,8 @@ if(ENABLE_MACRO_GUARD_TESTS) "include/*.hpp" # Public headers. EXCLUDE_REGEXES "include/mongocxx/doc\.hpp" # Doc header. - "include/.*/(prelude|postlude)\.(hpp|hh)" # Macro guard headers. - "include/mongocxx/v_noabi/mongocxx/config/.*" # v_noabi config headers. + "include/.*/(prelude|postlude)\.hpp" # Macro guard headers. + "(include|lib)/mongocxx/v_noabi/mongocxx/config/.*\.hpp" # v_noabi config headers. ) endif() From 60dfb27c27143e7799894e250d629aa785ad3fd0 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Sep 2024 15:13:56 -0500 Subject: [PATCH 23/28] Add coding guidelines section for virtual functions --- etc/coding_guidelines.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/etc/coding_guidelines.md b/etc/coding_guidelines.md index 953bd0c7a4..938345deeb 100644 --- a/etc/coding_guidelines.md +++ b/etc/coding_guidelines.md @@ -144,3 +144,9 @@ class foo { ## Relational Operators - Prefer to use free functions + +## Virtual Functions + +- Define at least one virtual function out-of-line in a source file as the "key function" for the polymorphic class to avoid weak vtables. + - Use the virtual destructor as the key function if no other appropriate virtual function exists. + - Ensure all copy and move special member functions are defaulted, deleted, or defined if the virtual destructor is defined out-of-line. From 4ae21792fd8e86df96ef0e6842a47d6cd24f74ac Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Sep 2024 16:00:28 -0500 Subject: [PATCH 24/28] Add missing macro guards for DEPRECATED_(NO_)EXPORT --- .../include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp | 2 ++ .../include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp index 48ad09ce32..7894bd3fef 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp @@ -54,6 +54,8 @@ #pragma pop_macro("BSONCXX_API") #pragma pop_macro("BSONCXX_PRIVATE") #pragma pop_macro("BSONCXX_DEPRECATED") +#pragma pop_macro("BSONCXX_DEPRECATED_EXPORT") +#pragma pop_macro("BSONCXX_DEPRECATED_NO_EXPORT") #endif // prelude.hpp diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp index 23d8bb10f8..f797d9d90d 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp @@ -105,6 +105,10 @@ #undef BSONCXX_PRIVATE #pragma push_macro("BSONCXX_DEPRECATED") #undef BSONCXX_DEPRECATED +#pragma push_macro("BSONCXX_DEPRECATED_EXPORT") +#undef BSONCXX_DEPRECATED +#pragma push_macro("BSONCXX_DEPRECATED_NO_EXPORT") +#undef BSONCXX_DEPRECATED #endif #include From f9741724fbd0b2256a830131f09f1830213dc092 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Sep 2024 16:47:17 -0500 Subject: [PATCH 25/28] Add missing __cdecl in value::deleter_type declarations --- src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp | 2 +- src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp | 2 +- src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp | 3 ++- .../lib/mongocxx/v_noabi/mongocxx/private/client_session.hh | 3 +-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp index c168c6f742..97356cbbef 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/value.hpp @@ -35,7 +35,7 @@ namespace array { /// class value { public: - using deleter_type = void (*)(std::uint8_t*); + using deleter_type = void(BSONCXX_ABI_CDECL*)(std::uint8_t*); using unique_ptr_type = std::unique_ptr; /// diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp index 7b7a5aa76b..e94b21d809 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/value.hpp @@ -37,7 +37,7 @@ namespace document { /// class value { public: - using deleter_type = void (*)(std::uint8_t*); + using deleter_type = void(BSONCXX_ABI_CDECL*)(std::uint8_t*); using unique_ptr_type = std::unique_ptr; /// diff --git a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp index 71e8f79ee8..23c57639d0 100644 --- a/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp +++ b/src/mongocxx/include/mongocxx/v_noabi/mongocxx/pool.hpp @@ -110,7 +110,8 @@ class pool { private: friend ::mongocxx::v_noabi::pool; - using unique_client = std::unique_ptr>; + using unique_client = + std::unique_ptr>; explicit entry(unique_client); diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/client_session.hh b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/client_session.hh index 13f09ea3c5..64c208cc95 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/client_session.hh +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/private/client_session.hh @@ -244,8 +244,7 @@ class client_session::impl { options::client_session _options; using unique_session = - std::unique_ptr>; + std::unique_ptr>; unique_session _session_t; From f5c075042a3c6523f9d73e4a36ef5f5e6498714d Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Wed, 11 Sep 2024 16:59:01 -0500 Subject: [PATCH 26/28] Remove stray use of MONGOCXX_CALL --- src/mongocxx/lib/mongocxx/v_noabi/mongocxx/collection.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/collection.cpp b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/collection.cpp index 73a5495500..a392ac9edd 100644 --- a/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/collection.cpp +++ b/src/mongocxx/lib/mongocxx/v_noabi/mongocxx/collection.cpp @@ -90,9 +90,8 @@ mongocxx::v_noabi::stdx::optional find_and_mo bool bypass, mongocxx::v_noabi::stdx::optional array_filters, const T& options) { - using unique_opts = - std::unique_ptr>; + using unique_opts = std::unique_ptr>; auto opts = unique_opts(mongocxx::libmongoc::find_and_modify_opts_new(), destroy_fam_opts); From e9734b64dd932d121dd57be0ea9cd7dfc2ddb8a0 Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 09:14:50 -0500 Subject: [PATCH 27/28] Exclude generated config headers from macro guard tests --- src/bsoncxx/test/CMakeLists.txt | 2 +- src/mongocxx/test/CMakeLists.txt | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/bsoncxx/test/CMakeLists.txt b/src/bsoncxx/test/CMakeLists.txt index 0fed55ce3d..51e2d7d18f 100644 --- a/src/bsoncxx/test/CMakeLists.txt +++ b/src/bsoncxx/test/CMakeLists.txt @@ -147,7 +147,7 @@ if(ENABLE_MACRO_GUARD_TESTS) EXCLUDE_REGEXES "include/bsoncxx/doc\.hpp" # Doc header. "include/.*/(prelude|postlude)\.hpp" # Macro guard headers. - "(include|lib)/bsoncxx/v_noabi/bsoncxx/config/.*\.hpp" # v_noabi config headers. + "include/bsoncxx/v_noabi/bsoncxx/config/.*\.hpp" # v_noabi config headers. "include/bsoncxx/v_noabi/bsoncxx/enums/.*\.hpp" # v_noabi X-macro headers. ) endif() diff --git a/src/mongocxx/test/CMakeLists.txt b/src/mongocxx/test/CMakeLists.txt index d704ec6c99..8cc14d1328 100644 --- a/src/mongocxx/test/CMakeLists.txt +++ b/src/mongocxx/test/CMakeLists.txt @@ -333,7 +333,7 @@ if(ENABLE_MACRO_GUARD_TESTS) EXCLUDE_REGEXES "include/mongocxx/doc\.hpp" # Doc header. "include/.*/(prelude|postlude)\.hpp" # Macro guard headers. - "(include|lib)/mongocxx/v_noabi/mongocxx/config/.*\.hpp" # v_noabi config headers. + "include/mongocxx/v_noabi/mongocxx/config/.*\.hpp" # v_noabi config headers. ) endif() From 114a1cc9a591c1cbd33a4feb1769f1b097c6da9d Mon Sep 17 00:00:00 2001 From: Ezra Chung Date: Thu, 12 Sep 2024 14:49:28 -0500 Subject: [PATCH 28/28] Revert macro guards for export.hpp to current pattern --- .../include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp | 2 -- src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp | 3 +-- 2 files changed, 1 insertion(+), 4 deletions(-) diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp index 7894bd3fef..73343023d9 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/postlude.hpp @@ -46,7 +46,6 @@ // export.hpp (generated by CMake) #pragma pop_macro("BSONCXX_ABI_EXPORT_H") -#if !defined(BSONCXX_ABI_EXPORT_H) #pragma pop_macro("BSONCXX_ABI_EXPORT") #pragma pop_macro("BSONCXX_ABI_NO_EXPORT") #pragma pop_macro("BSONCXX_ABI_CDECL") @@ -56,7 +55,6 @@ #pragma pop_macro("BSONCXX_DEPRECATED") #pragma pop_macro("BSONCXX_DEPRECATED_EXPORT") #pragma pop_macro("BSONCXX_DEPRECATED_NO_EXPORT") -#endif // prelude.hpp #undef BSONCXX_UNREACHABLE diff --git a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp index f797d9d90d..1588b614b1 100644 --- a/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp +++ b/src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp @@ -90,7 +90,7 @@ // export.hpp (generated by CMake) #pragma push_macro("BSONCXX_ABI_EXPORT_H") -#if !defined(BSONCXX_ABI_EXPORT_H) +#undef BSONCXX_ABI_EXPORT_H #pragma push_macro("BSONCXX_ABI_EXPORT") #undef BSONCXX_ABI_EXPORT #pragma push_macro("BSONCXX_ABI_NO_EXPORT") @@ -109,7 +109,6 @@ #undef BSONCXX_DEPRECATED #pragma push_macro("BSONCXX_DEPRECATED_NO_EXPORT") #undef BSONCXX_DEPRECATED -#endif #include //