User-Defined Sentinels
RWDateTime also provides for the use of 128 user-defined sentinels numbered 0 through 127. Each of these sentinels behaves like the null sentinel for part extraction functions, arithmetic manipulation, and relational operations. The
asString() family of functions return
"#>num<#" where
num is the user sentinel number. The static method
RWDateTime::userSentinel(int) is available for constructing user sentinels. These can be used to define different kind of dates, such as “refused”, for cases where a user has declined to enter data in a date field.
Here is an example of constructing and using user-defined sentinels:
RWDateTime sent0 = RWDateTime::userSentinel(0);
RWDateTime sent1 = RWDateTime::userSentinel(1);
std::cout << sent1.asString() << std::endl; // outputs #>1<#