Skip to content

Commit 9285eb4

Browse files
committed
Add documentation for mongoc_optional_t
1 parent 654f60a commit 9285eb4

File tree

7 files changed

+135
-0
lines changed

7 files changed

+135
-0
lines changed

src/libmongoc/doc/api.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ API Reference
3838
mongoc_insert_flags_t
3939
mongoc_iovec_t
4040
mongoc_matcher_t
41+
mongoc_optional_t
4142
mongoc_query_flags_t
4243
mongoc_rand
4344
mongoc_read_concern_t
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
:man_page: mongoc_optional_copy
2+
3+
mongoc_optional_copy()
4+
======================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
mongoc_optional_t *
12+
mongoc_optional_copy (const mongoc_optional_t *source, mongoc_optional_t *copy);
13+
14+
Creates a deep copy of ``source`` into ``copy``.
15+
16+
Parameters
17+
----------
18+
19+
* ``source``: A :symbol:`mongoc_optional_t`.
20+
* ``copy``: An empty :symbol:`mongoc_optional_t`. Values will be overwritten.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:man_page: mongoc_optional_init
2+
3+
mongoc_optional_init()
4+
======================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
void
12+
mongoc_optional_init (mongoc_optional_t *opt);
13+
14+
Initializes values for a :symbol:`mongoc_optional_t`.
15+
16+
Parameters
17+
----------
18+
19+
* ``opt``: A :symbol:`mongoc_optional_t`.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
:man_page: mongoc_optional_is_set
2+
3+
mongoc_optional_is_set()
4+
========================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
bool
12+
mongoc_optional_is_set (const mongoc_optional_t *opt);
13+
14+
Returns whether a value for a :symbol:`mongoc_optional_t` was set.
15+
16+
Parameters
17+
----------
18+
19+
* ``opt``: A :symbol:`mongoc_optional_t`.
20+
21+
Returns
22+
-------
23+
24+
Returns ``true`` if a value was set, or ``false`` otherwise.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
:man_page: mongoc_optional_set_value
2+
3+
mongoc_optional_set_value()
4+
===========================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
void
12+
mongoc_optional_set_value (mongoc_optional_t *opt);
13+
14+
Sets a value on a :symbol:`mongoc_optional_t`. Once a value has been set, it cannot be unset, i.e. `mongoc_optional_is_set` will always return ``true`` after calling `mongoc_optional_set_value`.
15+
16+
Parameters
17+
----------
18+
19+
* ``opt``: A :symbol:`mongoc_optional_t`.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
:man_page: mongoc_optional_t
2+
3+
mongoc_optional_t
4+
=================
5+
6+
A struct to store optional boolean values.
7+
8+
Synopsis
9+
--------
10+
11+
Used to specify optional boolean flags, which may remain unset.
12+
13+
This is used within :symbol:`mongoc_server_api_t` to track whether a flag was explicitly set.
14+
15+
.. only:: html
16+
17+
Functions
18+
---------
19+
20+
.. toctree::
21+
:titlesonly:
22+
:maxdepth: 1
23+
24+
mongoc_optional_copy
25+
mongoc_optional_init
26+
mongoc_optional_is_set
27+
mongoc_optional_set_value
28+
mongoc_optional_value
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
:man_page: mongoc_optional_value
2+
3+
mongoc_optional_value()
4+
=======================
5+
6+
Synopsis
7+
--------
8+
9+
.. code-block:: c
10+
11+
bool
12+
mongoc_optional_value (const mongoc_optional_t *opt);
13+
14+
Returns the value for a :symbol:`mongoc_optional_t`.
15+
16+
Parameters
17+
----------
18+
19+
* ``opt``: A :symbol:`mongoc_optional_t`.
20+
21+
Returns
22+
-------
23+
24+
Returns the value that was set on the :symbol:`mongoc_optional_t`. If no value was set, ``false`` is returned.

0 commit comments

Comments
 (0)