MongoDB C++ Driver  mongocxx-3.10.2
range.hpp
1 // Copyright 2023 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 #pragma once
16 
17 #include <cstdint>
18 
19 #include <mongocxx/options/range-fwd.hpp>
20 
21 #include <bsoncxx/types.hpp>
22 #include <bsoncxx/types/bson_value/view_or_value.hpp>
23 #include <mongocxx/stdx.hpp>
24 
25 #include <mongocxx/config/prelude.hpp>
26 
27 namespace mongocxx {
28 namespace v_noabi {
29 namespace options {
30 
43 class range {
44  public:
48 
51  const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& min() const;
52 
56 
59  const stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value>& max() const;
60 
62  range& sparsity(std::int64_t value);
63 
65  const stdx::optional<std::int64_t>& sparsity() const;
66 
69  range& precision(std::int32_t value);
70 
73  const stdx::optional<std::int32_t>& precision() const;
74 
75  private:
76  stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _min;
77  stdx::optional<bsoncxx::v_noabi::types::bson_value::view_or_value> _max;
78  stdx::optional<std::int64_t> _sparsity;
79  stdx::optional<std::int32_t> _precision;
80 };
81 
82 } // namespace options
83 } // namespace v_noabi
84 } // namespace mongocxx
85 
86 // CXX-2770: missing include of postlude header.
87 #if defined(MONGOCXX_TEST_MACRO_GUARDS_FIX_MISSING_POSTLUDE)
88 #include <mongocxx/config/postlude.hpp>
89 #endif
RangeOpts specifies index options for a Queryable Encryption field supporting "rangePreview" queries.
Definition: range.hpp:43
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & max() const
Gets RangeOpts.max.
const stdx::optional< std::int32_t > & precision() const
Gets RangeOpts.precision.
range & max(bsoncxx::v_noabi::types::bson_value::view_or_value value)
Sets RangeOpts.max.
range & min(bsoncxx::v_noabi::types::bson_value::view_or_value value)
Sets RangeOpts.min.
range & sparsity(std::int64_t value)
Sets RangeOpts.sparsity.
const stdx::optional< std::int64_t > & sparsity() const
Gets RangeOpts.sparsity.
const stdx::optional< bsoncxx::v_noabi::types::bson_value::view_or_value > & min() const
Gets RangeOpts.min.
range & precision(std::int32_t value)
Sets RangeOpts.precision.
The top-level namespace for mongocxx library entities.
Definition: bulk_write-fwd.hpp:19