Skip to content

Commit 0421d99

Browse files
authored
CXX-3155 Remove undocumented using-directives and using-declarations (#1256)
1 parent ffdb9e2 commit 0421d99

File tree

6 files changed

+19
-46
lines changed

6 files changed

+19
-46
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,10 @@ Changes prior to 3.9.0 are documented as [release notes on GitHub](https://githu
2323
- `b_utf8` in `bsoncxx::v_noabi::types`. Use `b_string` instead.
2424
- `get_utf8` in `bsoncxx::v_noabi::document::element`, `bsoncxx::v_noabi::array::element`, and `bsoncxx::v_noabi::types::bson_value::view`. Use `get_string` instead.
2525
- `k_cannot_append_utf8` and `k_need_element_type_k_utf8` in `bsoncxx::v_noabi::exception::error_code`. Use `k_cannot_append_string` and `k_need_element_type_k_string` instead.
26+
- Undocumented using-directives and using-declarations.
27+
- `bsoncxx::builder::types` in `<bsoncxx/builder/list.hpp>`. Use `bsoncxx::types` in `<bsoncxx/types.hpp>` instead.
28+
- `bsoncxx::builder::stream::concatenate` in `<bsoncxx/builder/stream/helpers.hpp>`. Use `bsoncxx::builder::concatenate` in `<bsoncxx/builder/concatenate.hpp>` instead.
29+
- `mongocxx::events::read_preference` in `<mongocxx/events/topology_description.hpp>`. Use `mongocxx::read_preference` in `<mongocxx/read_preference.hpp>` instead.
2630

2731
## 3.11.0
2832

examples/bsoncxx/builder_list.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ int EXAMPLES_CDECL main() {
6767
"BSON 32-bit signed integer value", -123,
6868
"BSON date value", std::chrono::milliseconds(123456789),
6969
"BSON Decimal128 value", decimal128{100, 200},
70-
"BSON regex value with options", bson_value::value("regex", "imsx" /* opts */)};
70+
"BSON regex value with options", types::bson_value::value("regex", "imsx" /* opts */)};
7171
// clang-format on
7272

7373
//
@@ -95,7 +95,7 @@ int EXAMPLES_CDECL main() {
9595
-123,
9696
std::chrono::milliseconds(123456789),
9797
decimal128{100, 200},
98-
bson_value::value("regex", "imsx" /* opts */)};
98+
types::bson_value::value("regex", "imsx" /* opts */)};
9999

100100
//
101101
// The list builder will create a BSON document, if possible. Otherwise, it will create a BSON

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/list.hpp

Lines changed: 5 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -30,16 +30,6 @@ namespace bsoncxx {
3030
namespace v_noabi {
3131
namespace builder {
3232

33-
using namespace ::bsoncxx::v_noabi::types; // Deprecated. Deliberately undocumented.
34-
35-
} // namespace builder
36-
} // namespace v_noabi
37-
} // namespace bsoncxx
38-
39-
namespace bsoncxx {
40-
namespace v_noabi {
41-
namespace builder {
42-
4333
///
4434
/// A JSON-like builder for creating documents and arrays.
4535
///
@@ -94,7 +84,7 @@ class list {
9484
/// @see
9585
/// - @ref bsoncxx::v_noabi::types::bson_value::view.
9686
///
97-
operator bson_value::view() {
87+
operator types::bson_value::view() {
9888
return view();
9989
}
10090

@@ -104,12 +94,12 @@ class list {
10494
/// @see
10595
/// - @ref bsoncxx::v_noabi::types::bson_value::view.
10696
///
107-
bson_value::view view() {
97+
types::bson_value::view view() {
10898
return val.view();
10999
}
110100

111101
private:
112-
bson_value::value val;
102+
types::bson_value::value val;
113103

114104
friend ::bsoncxx::v_noabi::builder::document;
115105
friend ::bsoncxx::v_noabi::builder::array;
@@ -141,12 +131,12 @@ class list {
141131
_core.key_owned(std::string((begin(init) + i)->val.view().get_string().value));
142132
_core.append((begin(init) + i + 1)->val);
143133
}
144-
val = bson_value::value(_core.extract_document());
134+
val = types::bson_value::value(_core.extract_document());
145135
} else if (type_deduction || is_array) {
146136
core _core{true};
147137
for (auto&& ele : init)
148138
_core.append(ele.val);
149-
val = bson_value::value(_core.extract_array());
139+
val = types::bson_value::value(_core.extract_array());
150140
} else {
151141
throw bsoncxx::v_noabi::exception{error_code::k_unmatched_key_in_builder,
152142
err_msg.str()};
@@ -207,14 +197,6 @@ class array : public list {
207197
} // namespace v_noabi
208198
} // namespace bsoncxx
209199

210-
namespace bsoncxx {
211-
namespace builder {
212-
213-
using namespace ::bsoncxx::v_noabi::types; // Deprecated. Deliberately undocumented.
214-
215-
} // namespace builder
216-
} // namespace bsoncxx
217-
218200
#include <bsoncxx/config/postlude.hpp>
219201

220202
///

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/builder/stream/helpers.hpp

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414

1515
#pragma once
1616

17-
#include <bsoncxx/builder/concatenate.hpp>
1817
#include <bsoncxx/document/view_or_value.hpp>
1918

2019
#include <bsoncxx/config/prelude.hpp>
@@ -24,8 +23,6 @@ namespace v_noabi {
2423
namespace builder {
2524
namespace stream {
2625

27-
using ::bsoncxx::v_noabi::builder::concatenate; // Deprecated. Deliberately undocumented.
28-
2926
///
3027
/// The type of a stream manipulator to open a subdocument.
3128
///
@@ -99,8 +96,6 @@ namespace bsoncxx {
9996
namespace builder {
10097
namespace stream {
10198

102-
using ::bsoncxx::v_noabi::builder::stream::concatenate; // Deprecated. Deliberately undocumented.
103-
10499
using ::bsoncxx::v_noabi::builder::stream::close_array;
105100
using ::bsoncxx::v_noabi::builder::stream::close_document;
106101
using ::bsoncxx::v_noabi::builder::stream::finalize;

src/bsoncxx/test/bson_builder.cpp

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -583,7 +583,8 @@ TEST_CASE("builder appends concatenate", "[bsoncxx::builder::stream]") {
583583

584584
{
585585
using namespace builder::stream;
586-
b << "foo" << open_document << concatenate(child_builder.view()) << close_document;
586+
b << "foo" << open_document << builder::concatenate(child_builder.view())
587+
<< close_document;
587588
}
588589

589590
bson_eq_stream(&expected, b);
@@ -602,7 +603,8 @@ TEST_CASE("builder appends concatenate", "[bsoncxx::builder::stream]") {
602603

603604
{
604605
using namespace builder::stream;
605-
b << "foo" << open_array << "bar" << concatenate(child_builder.view()) << close_array;
606+
b << "foo" << open_array << "bar" << builder::concatenate(child_builder.view())
607+
<< close_array;
606608
}
607609

608610
bson_eq_stream(&expected, b);
@@ -1120,7 +1122,7 @@ TEST_CASE("basic document builder works with concat", "[bsoncxx::builder::basic]
11201122
builder::stream::document stream;
11211123
builder::basic::document basic;
11221124

1123-
stream << builder::stream::concatenate(subdoc.view());
1125+
stream << builder::concatenate(subdoc.view());
11241126

11251127
SECTION("single insert works") {
11261128
basic.append(builder::basic::concatenate(subdoc.view()));
@@ -1129,7 +1131,7 @@ TEST_CASE("basic document builder works with concat", "[bsoncxx::builder::basic]
11291131
}
11301132

11311133
SECTION("variadic works") {
1132-
stream << builder::stream::concatenate(subdoc.view());
1134+
stream << builder::concatenate(subdoc.view());
11331135

11341136
basic.append(builder::basic::concatenate(subdoc.view()),
11351137
builder::basic::concatenate(subdoc.view()));
@@ -1147,7 +1149,7 @@ TEST_CASE("basic array builder works with concat", "[bsoncxx::builder::basic]")
11471149
builder::stream::array stream;
11481150
builder::basic::array basic;
11491151

1150-
stream << builder::stream::concatenate(array_view);
1152+
stream << builder::concatenate(array_view);
11511153

11521154
SECTION("single insert works") {
11531155
basic.append(builder::basic::concatenate(array_view));
@@ -1156,7 +1158,7 @@ TEST_CASE("basic array builder works with concat", "[bsoncxx::builder::basic]")
11561158
}
11571159

11581160
SECTION("variadic works") {
1159-
stream << builder::stream::concatenate(array_view);
1161+
stream << builder::concatenate(array_view);
11601162

11611163
basic.append(builder::basic::concatenate(array_view),
11621164
builder::basic::concatenate(array_view));

src/mongocxx/include/mongocxx/v_noabi/mongocxx/events/topology_description.hpp

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -29,8 +29,6 @@ namespace mongocxx {
2929
namespace v_noabi {
3030
namespace events {
3131

32-
using mongocxx::v_noabi::read_preference; // Deprecated. Deliberately undocumented.
33-
3432
///
3533
/// Class representing what the driver knows about a topology of MongoDB servers: either a
3634
/// standalone, a replica set, or a sharded cluster.
@@ -167,14 +165,6 @@ class topology_description {
167165
} // namespace v_noabi
168166
} // namespace mongocxx
169167

170-
namespace mongocxx {
171-
namespace events {
172-
173-
using ::mongocxx::v_noabi::events::read_preference; // Deprecated. Deliberately undocumented.
174-
175-
} // namespace events
176-
} // namespace mongocxx
177-
178168
#include <mongocxx/config/postlude.hpp>
179169

180170
///

0 commit comments

Comments
 (0)