@@ -11,6 +11,13 @@ namespace rfl {
1111
1212template <auto _threshold>
1313struct EqualTo {
14+ // / @brief Validates that the given value is equal to the threshold.
15+ // / @tparam T The type of the value to validate.
16+ // / @param _value The value to validate.
17+ // / @return Result<T> containing the value if valid, or an error if not.
18+ // / @details This function checks if the input value is exactly equal to the
19+ // / compile-time threshold. If not, it returns an error with a descriptive
20+ // / message.
1421 template <class T >
1522 static Result<T> validate (T _value) noexcept {
1623 constexpr auto threshold = static_cast <T>(_threshold);
@@ -23,6 +30,12 @@ struct EqualTo {
2330 return _value;
2431 }
2532
33+ // / @brief Converts the validation rule to a schema representation.
34+ // / @tparam T The type for which the schema is generated.
35+ // / @return parsing::schema::ValidationType representing the EqualTo
36+ // / constraint.
37+ // / @details This function creates a schema object that encodes the equality
38+ // / constraint for serialization or documentation purposes.
2639 template <class T >
2740 static parsing::schema::ValidationType to_schema () {
2841 using ValidationType = parsing::schema::ValidationType;
@@ -36,6 +49,14 @@ struct EqualTo {
3649
3750template <auto _threshold>
3851struct Minimum {
52+ // / @brief Validates that the given value is greater than or equal to the
53+ // / threshold.
54+ // / @tparam T The type of the value to validate.
55+ // / @param _value The value to validate.
56+ // / @return Result<T> containing the value if valid, or an error if not.
57+ // / @details This function checks if the input value is at least the
58+ // / compile-time threshold. If not, it returns an error with a descriptive
59+ // / message.
3960 template <class T >
4061 static Result<T> validate (T _value) noexcept {
4162 constexpr auto threshold = static_cast <T>(_threshold);
@@ -48,6 +69,12 @@ struct Minimum {
4869 return _value;
4970 }
5071
72+ // / @brief Converts the validation rule to a schema representation.
73+ // / @tparam T The type for which the schema is generated.
74+ // / @return parsing::schema::ValidationType representing the Minimum
75+ // / constraint.
76+ // / @details This function creates a schema object that encodes the minimum
77+ // / value constraint for serialization or documentation purposes.
5178 template <class T >
5279 static parsing::schema::ValidationType to_schema () {
5380 using ValidationType = parsing::schema::ValidationType;
@@ -61,6 +88,14 @@ struct Minimum {
6188
6289template <auto _threshold>
6390struct ExclusiveMinimum {
91+ // / @brief Validates that the given value is strictly greater than the
92+ // / threshold.
93+ // / @tparam T The type of the value to validate.
94+ // / @param _value The value to validate.
95+ // / @return Result<T> containing the value if valid, or an error if not.
96+ // / @details This function checks if the input value is strictly greater than
97+ // / the compile-time threshold. If not, it returns an error with a descriptive
98+ // / message.
6499 template <class T >
65100 static Result<T> validate (T _value) noexcept {
66101 constexpr auto threshold = static_cast <T>(_threshold);
@@ -73,6 +108,12 @@ struct ExclusiveMinimum {
73108 return _value;
74109 }
75110
111+ // / @brief Converts the validation rule to a schema representation.
112+ // / @tparam T The type for which the schema is generated.
113+ // / @return parsing::schema::ValidationType representing the ExclusiveMinimum
114+ // / constraint.
115+ // / @details This function creates a schema object that encodes the exclusive
116+ // / minimum value constraint for serialization or documentation purposes.
76117 template <class T >
77118 static parsing::schema::ValidationType to_schema () {
78119 using ValidationType = parsing::schema::ValidationType;
@@ -86,6 +127,14 @@ struct ExclusiveMinimum {
86127
87128template <auto _threshold>
88129struct Maximum {
130+ // / @brief Validates that the given value is less than or equal to the
131+ // / threshold.
132+ // / @tparam T The type of the value to validate.
133+ // / @param _value The value to validate.
134+ // / @return Result<T> containing the value if valid, or an error if not.
135+ // / @details This function checks if the input value is at most the
136+ // / compile-time threshold. If not, it returns an error with a descriptive
137+ // / message.
89138 template <class T >
90139 static Result<T> validate (T _value) noexcept {
91140 constexpr auto threshold = static_cast <T>(_threshold);
@@ -98,6 +147,12 @@ struct Maximum {
98147 return _value;
99148 }
100149
150+ // / @brief Converts the validation rule to a schema representation.
151+ // / @tparam T The type for which the schema is generated.
152+ // / @return parsing::schema::ValidationType representing the Maximum
153+ // / constraint.
154+ // / @details This function creates a schema object that encodes the maximum
155+ // / value constraint for serialization or documentation purposes.
101156 template <class T >
102157 static parsing::schema::ValidationType to_schema () {
103158 using ValidationType = parsing::schema::ValidationType;
@@ -111,6 +166,13 @@ struct Maximum {
111166
112167template <auto _threshold>
113168struct ExclusiveMaximum {
169+ // / @brief Validates that the given value is strictly less than the threshold.
170+ // / @tparam T The type of the value to validate.
171+ // / @param _value The value to validate.
172+ // / @return Result<T> containing the value if valid, or an error if not.
173+ // / @details This function checks if the input value is strictly less than the
174+ // / compile-time threshold. If not, it returns an error with a descriptive
175+ // / message.
114176 template <class T >
115177 static Result<T> validate (T _value) noexcept {
116178 constexpr auto threshold = static_cast <T>(_threshold);
@@ -123,6 +185,12 @@ struct ExclusiveMaximum {
123185 return _value;
124186 }
125187
188+ // / @brief Converts the validation rule to a schema representation.
189+ // / @tparam T The type for which the schema is generated.
190+ // / @return parsing::schema::ValidationType representing the ExclusiveMaximum
191+ // / constraint.
192+ // / @details This function creates a schema object that encodes the exclusive
193+ // / maximum value constraint for serialization or documentation purposes.
126194 template <class T >
127195 static parsing::schema::ValidationType to_schema () {
128196 using ValidationType = parsing::schema::ValidationType;
@@ -136,6 +204,13 @@ struct ExclusiveMaximum {
136204
137205template <auto _threshold>
138206struct NotEqualTo {
207+ // / @brief Validates that the given value is not equal to the threshold.
208+ // / @tparam T The type of the value to validate.
209+ // / @param _value The value to validate.
210+ // / @return Result<T> containing the value if valid, or an error if not.
211+ // / @details This function checks if the input value is not equal to the
212+ // / compile-time threshold. If it is, it returns an error with a descriptive
213+ // / message.
139214 template <class T >
140215 static Result<T> validate (T _value) noexcept {
141216 constexpr auto threshold = static_cast <T>(_threshold);
@@ -148,6 +223,12 @@ struct NotEqualTo {
148223 return _value;
149224 }
150225
226+ // / @brief Converts the validation rule to a schema representation.
227+ // / @tparam T The type for which the schema is generated.
228+ // / @return parsing::schema::ValidationType representing the NotEqualTo
229+ // / constraint.
230+ // / @details This function creates a schema object that encodes the
231+ // / not-equal-to constraint for serialization or documentation purposes.
151232 template <class T >
152233 static parsing::schema::ValidationType to_schema () {
153234 using ValidationType = parsing::schema::ValidationType;
0 commit comments