Skip to content

Commit f8c0b56

Browse files
authored
CXX-3064 Fix use of Doxygen @relates, @relatesalso, and groups (#1170)
* doxygen: strip include directory from file paths * clang-format: avoid breaking long single-line Doxygen commands * doxygen: expand *_INLINE as inline * docs: add missing @internal command * docs: fix broken @copydoc in bucket.hpp * docs: fix URLs to Working with BSON doc page * doxygen: set SORT_* = YES * doxygen: add BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR * CXX-2288 add library root-level forward headers * CXX-3064 fix @relates and groupings * Relocate root-level documentation into root forward headers * Remove order-dependent language from docs
1 parent edc22ae commit f8c0b56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+526
-583
lines changed

.clang-format

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ BasedOnStyle: Google
55
BinPackArguments: false
66
BinPackParameters: false
77
ColumnLimit: 100
8+
CommentPragmas: '^\s*@(addtogroup|copydoc|defgroup|fn|ref)'
89
Cpp11BracedListStyle: true
910
DerivePointerAlignment: false
1011
IncludeBlocks: Regroup

Doxyfile

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,8 @@ FULL_PATH_NAMES = YES
160160
# will be relative from the directory where doxygen is started.
161161
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
162162

163-
STRIP_FROM_PATH =
163+
STRIP_FROM_PATH = src/bsoncxx/include \
164+
src/mongocxx/include
164165

165166
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
166167
# path mentioned in the documentation of a class, which tells the reader which
@@ -638,7 +639,7 @@ SORT_MEMBER_DOCS = YES
638639
# this will also influence the order of the classes in the class list.
639640
# The default value is: NO.
640641

641-
SORT_BRIEF_DOCS = NO
642+
SORT_BRIEF_DOCS = YES
642643

643644
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
644645
# (brief and detailed) documentation of class members so that constructors and
@@ -650,14 +651,14 @@ SORT_BRIEF_DOCS = NO
650651
# detailed member documentation.
651652
# The default value is: NO.
652653

653-
SORT_MEMBERS_CTORS_1ST = NO
654+
SORT_MEMBERS_CTORS_1ST = YES
654655

655656
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
656657
# of group names into alphabetical order. If set to NO the group names will
657658
# appear in their defined order.
658659
# The default value is: NO.
659660

660-
SORT_GROUP_NAMES = NO
661+
SORT_GROUP_NAMES = YES
661662

662663
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
663664
# fully-qualified names, including namespaces. If set to NO, the class list will
@@ -667,7 +668,7 @@ SORT_GROUP_NAMES = NO
667668
# list.
668669
# The default value is: NO.
669670

670-
SORT_BY_SCOPE_NAME = NO
671+
SORT_BY_SCOPE_NAME = YES
671672

672673
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
673674
# type resolution of all parameters of a function it will reject a match between
@@ -2212,11 +2213,13 @@ INCLUDE_FILE_PATTERNS =
22122213
PREDEFINED = BSONCXX_API= \
22132214
BSONCXX_CALL= \
22142215
BSONCXX_DEPRECATED \
2215-
BSONCXX_INLINE= \
2216+
BSONCXX_INLINE=inline \
2217+
BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR= \
22162218
MONGOCXX_API= \
22172219
MONGOCXX_CALL= \
2218-
MONGOCXX_DEPRECATED \
2219-
MONGOCXX_INLINE=
2220+
MONGOCXX_DEPRECATED= \
2221+
MONGOCXX_INLINE=inline \
2222+
MONGOCXX_PRIVATE_DOXYGEN_PREPROCESSOR=
22202223

22212224
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
22222225
# tag can be used to specify a list of macro names that should be expanded. The

src/bsoncxx/include/bsoncxx/fwd.hpp

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
// Copyright 2009-present MongoDB, Inc.
2+
//
3+
// Licensed under the Apache License, Version 2.0 (the "License");
4+
// you may not use this file except in compliance with the License.
5+
// You may obtain a copy of the License at
6+
//
7+
// http://www.apache.org/licenses/LICENSE-2.0
8+
//
9+
// Unless required by applicable law or agreed to in writing, software
10+
// distributed under the License is distributed on an "AS IS" BASIS,
11+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12+
// See the License for the specific language governing permissions and
13+
// limitations under the License.
14+
15+
#if !defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
16+
#error "This file is for documentation purposes only. It should not be included."
17+
#endif // !defined(BSONCXX_PRIVATE_DOXYGEN_PREPROCESSOR)
18+
19+
///
20+
/// @namespace bsoncxx
21+
/// The top-level namespace for bsoncxx library entities.
22+
///

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/element.hpp

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -88,33 +88,25 @@ class element : private document::element {
8888
BSONCXX_PRIVATE explicit element(const stdx::string_view key);
8989
};
9090

91-
///
92-
/// @{
9391
///
9492
/// Convenience methods to compare for equality against a bson_value.
9593
///
96-
/// Returns true if this element contains a bson_value that matches.
97-
///
98-
/// @relates element
94+
/// Compares equal if this element contains a matching bson_value. Otherwise, compares unequal.
9995
///
96+
/// @{
97+
98+
/// @relatesalso bsoncxx::v_noabi::array::element
10099
BSONCXX_API bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v);
100+
101+
/// @relatesalso bsoncxx::v_noabi::array::element
101102
BSONCXX_API bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem);
102-
///
103-
/// @}
104-
///
105103

106-
///
107-
/// @{
108-
///
109-
/// Convenience methods to compare for equality against a bson_value.
110-
///
111-
/// Returns false if this element contains a bson_value that matches.
112-
///
113-
/// @relates element
114-
///
104+
/// @relatesalso bsoncxx::v_noabi::array::element
115105
BSONCXX_API bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v);
106+
107+
/// @relatesalso bsoncxx::v_noabi::array::element
116108
BSONCXX_API bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem);
117-
///
109+
118110
/// @}
119111
///
120112

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view.hpp

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -130,15 +130,13 @@ class view {
130130
operator document::view() const;
131131

132132
///
133-
/// @{
133+
/// @relates bsoncx::v_noabi::document::view
134134
///
135135
/// Compare two views for (in)-equality
136136
///
137-
/// @relates view
138-
///
137+
/// @{
139138
friend BSONCXX_API bool BSONCXX_CALL operator==(view, view);
140139
friend BSONCXX_API bool BSONCXX_CALL operator!=(view, view);
141-
///
142140
/// @}
143141
///
144142

@@ -173,15 +171,13 @@ class view::const_iterator {
173171
const_iterator operator++(int);
174172

175173
///
176-
/// @{
177-
///
178-
/// Compare two const_iterators for (in)-equality
174+
/// @relates bsoncxx::v_noabi::array::view::const_iterator
179175
///
180-
/// @relates view::const_iterator
176+
/// Compare two const_iterators for (in)-equality.
181177
///
178+
/// @{
182179
friend BSONCXX_API bool BSONCXX_CALL operator==(const const_iterator&, const const_iterator&);
183180
friend BSONCXX_API bool BSONCXX_CALL operator!=(const const_iterator&, const const_iterator&);
184-
///
185181
/// @}
186182
///
187183

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/array/view_or_value.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,10 @@ namespace bsoncxx {
2525
namespace v_noabi {
2626
namespace array {
2727

28-
using view_or_value = ::bsoncxx::v_noabi::view_or_value<view, value>;
28+
///
29+
/// Equivalent to `v_noabi::view_or_value<v_noabi::array::view, v_noabi::array::value>`.
30+
///
31+
using view_or_value = v_noabi::view_or_value<view, value>;
2932

3033
} // namespace array
3134
} // namespace v_noabi

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

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -82,32 +82,30 @@ struct concatenate_array {
8282
};
8383

8484
///
85-
/// Helper method to concatenate a document. Use this with the document stream
86-
/// builder to merge an existing document's fields with a new document's.
85+
/// Helper method to concatenate a document.
8786
///
88-
/// @param doc A document to be concatenated.
87+
/// Use this with the document stream builder to merge an existing document's fields with a new
88+
/// document's.
89+
///
90+
/// @param doc The document to concatenate.
8991
///
9092
/// @return concatenate_doc A concatenating struct.
9193
///
92-
/// @relatesalso concatenate_doc
94+
/// @see bsoncxx::v_noabi::builder::concatenate_doc
95+
///
96+
/// @note An overload accepting @ref v_noabi::array::view_or_value and returning a @ref
97+
/// concatenate_array is also declared in this scope.
9398
///
9499
BSONCXX_INLINE concatenate_doc concatenate(document::view_or_value doc) {
95100
return {std::move(doc)};
96101
}
97102

98-
///
99-
/// Method to concatenate an array with a new array. Use this with the array stream
100-
/// builder to merge an existing array's fields with a new array.
101-
///
102-
/// @param array An array to be concatenated.
103-
///
104-
/// @return concatenate_array A concatenating struct.
105-
///
106-
/// @relatesalso concatenate_array
107-
///
103+
// Why is Doxygen unable to parse this overload correctly???
104+
// @cond DOXYGEN_DISABLE "warning: no matching file member found for ..."
108105
BSONCXX_INLINE concatenate_array concatenate(array::view_or_value array) {
109106
return {std::move(array)};
110107
}
108+
// @endcond
111109

112110
} // namespace builder
113111
} // namespace v_noabi

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,12 @@ namespace builder {
3232
namespace stream {
3333

3434
///
35-
/// A streaming interface for constructing
36-
/// a BSON array.
35+
/// A streaming interface for constructing a BSON array.
3736
///
38-
/// @note Use of the stream builder is discouraged. See
39-
/// https://www.mongodb.com/docs/languages/cpp/drivers/current/working-with-bson/#basic-builder for
40-
/// more details.
37+
/// @warning Use of the stream builder is discouraged. See
38+
/// [Working with
39+
/// BSON](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/working-with-bson/#basic-builder)
40+
/// for more details.
4141
///
4242
class array : public array_context<> {
4343
public:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ class array_context {
167167
///
168168
/// Conversion operator for single_context.
169169
///
170-
/// @relatesalso single_context
170+
/// @see bsoncxx::v_noabi::builder::stream::single_context
171171
///
172172
BSONCXX_INLINE operator single_context();
173173

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ namespace builder {
3030
namespace stream {
3131

3232
///
33-
/// A streaming interface for constructing
34-
/// a BSON document.
33+
/// A streaming interface for constructing a BSON document.
3534
///
36-
/// @note Use of the stream builder is discouraged. See
37-
/// https://www.mongodb.com/docs/languages/cpp/drivers/current/working-with-bson/#basic-builder for
38-
/// more details.
35+
/// @warning Use of the stream builder is discouraged. See
36+
/// [Working with
37+
/// BSON](https://www.mongodb.com/docs/languages/cpp/cpp-driver/current/working-with-bson/#basic-builder)
38+
/// for more details.
3939
///
4040
class document : public key_context<> {
4141
public:

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ class value_context {
108108
///
109109
/// Conversion operator for single_context.
110110
///
111-
/// @relatesalso single_context
111+
/// @see bsoncxx::v_noabi::builder::stream::single_context
112112
///
113113
operator single_context();
114114

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/prelude.hpp

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -120,21 +120,3 @@
120120
// CXX-2769: out-of-place, but remains for backward compatibility.
121121
#pragma push_macro("BSONCXX_ENUM")
122122
#undef BSONCXX_ENUM
123-
124-
// Doxygen does not account for generated header files.
125-
// Document globally applicable macros and namespaces here.
126-
127-
///
128-
/// @namespace bsoncxx
129-
/// The top-level namespace for bsoncxx library entities.
130-
///
131-
132-
///
133-
/// @namespace bsoncxx::v_noabi
134-
/// Entities declared in this namespace do not have a stable ABI.
135-
///
136-
137-
///
138-
/// @namespace bsoncxx::v_noabi::stdx
139-
/// Declares polyfills for C++17 forward compatibility.
140-
///

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/config/util.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
#define BSONCXX_STRINGIFY_IMPL(...) #__VA_ARGS__
88

99
/**
10+
* @internal
1011
* @brief Token-paste two macro arguments, after macro expansion
1112
*/
1213
#define BSONCXX_CONCAT(A, ...) BSONCXX_CONCAT_IMPL(A, __VA_ARGS__)

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/decimal128.hpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,13 @@ class decimal128 {
6565
std::string to_string() const;
6666

6767
///
68-
/// @{
68+
/// @relates bsoncxx::v_noabi::decimal128
6969
///
7070
/// Relational operators for decimal128
7171
///
72-
/// @relates decimal128
73-
///
72+
/// @{
7473
friend BSONCXX_API bool BSONCXX_CALL operator==(const decimal128& lhs, const decimal128& rhs);
7574
friend BSONCXX_API bool BSONCXX_CALL operator!=(const decimal128& lhs, const decimal128& rhs);
76-
///
7775
/// @}
7876
///
7977

src/bsoncxx/include/bsoncxx/v_noabi/bsoncxx/document/element.hpp

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ namespace document {
4040
/// interrogated by calling type(), the key can be extracted by calling key() and
4141
/// a specific value can be extracted through get_X() accessors.
4242
///
43-
/// @relatesalso array::element
43+
/// @see bsoncxx::v_noabi::array::element
4444
///
4545
class element {
4646
public:
@@ -386,33 +386,25 @@ class element {
386386
stdx::optional<stdx::string_view> _key;
387387
};
388388

389-
///
390-
/// @{
391389
///
392390
/// Convenience methods to compare for equality against a bson_value.
393391
///
394-
/// Returns true if this element contains a bson_value that matches.
395-
///
396-
/// @relates element
392+
/// Compares equal if the element contains a matching bson_value. Otherwise, compares unequal.
397393
///
394+
/// @{
395+
396+
/// @relatesalso bsoncxx::v_noabi::document::element
398397
BSONCXX_API bool BSONCXX_CALL operator==(const element& elem, const types::bson_value::view& v);
398+
399+
/// @relatesalso bsoncxx::v_noabi::document::element
399400
BSONCXX_API bool BSONCXX_CALL operator==(const types::bson_value::view& v, const element& elem);
400-
///
401-
/// @}
402-
///
403401

404-
///
405-
/// @{
406-
///
407-
/// Convenience methods to compare for equality against a bson_value.
408-
///
409-
/// Returns false if this element contains a bson_value that matches.
410-
///
411-
/// @relates element
412-
///
402+
/// @relatesalso bsoncxx::v_noabi::document::element
413403
BSONCXX_API bool BSONCXX_CALL operator!=(const element& elem, const types::bson_value::view& v);
404+
405+
/// @relatesalso bsoncxx::v_noabi::document::element
414406
BSONCXX_API bool BSONCXX_CALL operator!=(const types::bson_value::view& v, const element& elem);
415-
///
407+
416408
/// @}
417409
///
418410

0 commit comments

Comments
 (0)