Stroika Library 3.0d16
 
Loading...
Searching...
No Matches
ValidationStrategy.h
1/*
2 * Copyright(c) Sophist Solutions, Inc. 1990-2025. All rights reserved
3 */
4#ifndef _Stroika_Foundation_DataExchange_ValidationStrategy_h_
5#define _Stroika_Foundation_DataExchange_ValidationStrategy_h_ 1
6
7#include "Stroika/Foundation/StroikaPreComp.h"
8
9/*
10 * \note Code-Status: <a href="Code-Status.md#Alpha">Alpha</a>
11 *
12 */
14
15 /**
16 * Many times, in code, the caller knows the arguments are in some valid type restricted range
17 * (like if the data comes from an algorithm).
18 * Many times, the code doesn't know (like if the data comes from a file).
19 *
20 * This enumeration/specification, allows SOME APIs to (usually by default) treat validation/constraint failures
21 * as compile time or runtime assertion failures (so not checked in release code).
22 *
23 * And sometimes, to indicate the source of the data is untrusted, and the data must be validated (typically resulting
24 * in a DataExchange::BadFormatException being thrown).
25 *
26 * Stroika has long had this sort of dichotomy/choice (with the aforementioned bias towards assertion checking). This just regularizes
27 * the names/types used to indicate that choice.
28 *
29 * Often times, and API will be a const, inline, or constexpr version that only does assertions, and will have an OVERLOAD
30 * taking this parameter, which does the slower checking (one way or the other).
31 */
32 enum class ValidationStrategy {
33 /**
34 * For most APIs using ValidationStrategy, this will be the default.
35 */
37
38 /**
39 * Indicates the data comes from an untrusted source, should be validated, and an exception raised if its invalid.
40 */
41 eThrow
42 };
43
44}
45
46/*
47 ********************************************************************************
48 ***************************** Implementation Details ***************************
49 ********************************************************************************
50 */
51#include "ValidationStrategy.inl"
52
53#endif /*_Stroika_Foundation_DataExchange_ValidationStrategy_h_*/