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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 19 additions & 1 deletion src/mongocxx/include/mongocxx/v1/uri.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include <cstdint>
#include <string>
#include <system_error>
#include <type_traits>
#include <vector>

namespace mongocxx {
Expand Down Expand Up @@ -242,7 +243,7 @@ class uri {
///
/// Return the mongoc "credentials" field containing "authMechanism" and related options.
///
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) credentials();
MONGOCXX_ABI_EXPORT_CDECL(bsoncxx::v1::stdx::optional<bsoncxx::v1::document::view>) credentials() const;

///
/// Return the "srvMaxHosts" option.
Expand Down Expand Up @@ -389,13 +390,30 @@ class uri {
friend std::error_code make_error_code(errc v) {
return {static_cast<int>(v), error_category()};
}

class internal;

private:
// MSVC may incorrectly select the `void*` ctor given a `char const*` argument without `/Zc:strictStrings`.
struct void_ptr {
void* impl = nullptr;
};

explicit uri(void_ptr vp);
};

BSONCXX_PRIVATE_INLINE_CXX17 constexpr char const* uri::k_default_uri;

} // namespace v1
} // namespace mongocxx

namespace std {

template <>
struct is_error_code_enum<mongocxx::v1::uri::errc> : true_type {};

} // namespace std

#include <mongocxx/v1/detail/postlude.hpp>

///
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@

#pragma once

#include <mongocxx/v1/uri-fwd.hpp> // IWYU pragma: export

#include <mongocxx/config/prelude.hpp>

namespace mongocxx {
Expand All @@ -26,7 +28,7 @@ class uri;

namespace mongocxx {

using ::mongocxx::v_noabi::uri;
using v_noabi::uri;

} // namespace mongocxx

Expand All @@ -36,3 +38,6 @@ using ::mongocxx::v_noabi::uri;
/// @file
/// Declares @ref mongocxx::v_noabi::uri.
///
/// @par Includes
/// - @ref mongocxx/v1/uri-fwd.hpp
///
Loading