OWLNext    7.0
Borland's Object Windows Library for the modern age
Loading...
Searching...
No Matches
owl::TRangeValidator Class Reference

Determines whether the data typed by a user falls within a designated range of integers. More...

#include <owl/validate.h>

Inheritance diagram for owl::TRangeValidator:
owl::TFilterValidator owl::TValidator owl::TStreamableBase

Classes

struct  TRange
 

Public Types

using TExtent = int
 

Public Member Functions

 TRangeValidator (TExtent minValue, TExtent maxValue)
 Constructs a range validator object using minValue and maxValue as the range of possible values.
 
 TRangeValidator (const TRange &range)
 Constructs a range validator object by first calling the constructor inherited from TFilterValidator, passing a set of characters containing the digits '0'..'9' and the characters '+' and '-'.
 
void Error (TWindow *owner)
 Overrides TValidator's virtual function and displays a message box indicating that the entered value does not fall within the specified range.
 
bool IsValid (LPCTSTR str)
 We first validate the range, because of the asynchronous manner in which SetMin and SetMax could be called might have Min greater than Max.
 
uint Transfer (TCHAR *str, void *buffer, TTransferDirection direction)
 Incorporates the three types, tdSizeData, tdGetData, and tdSetData, that a range validator can handle for its associated edit control.
 
int Adjust (tstring &text, int &begPos, int &endPos, int amount)
 We first validate the range, because of the asynchronous manner in which SetMin and SetMax could be called might have Min greater than Max.
 
auto GetMin () const -> TExtent
 Returns the minimum number the validator can accept.
 
void SetMin (TExtent minValue)
 Sets the minimum number the validator can accept.
 
auto GetMax () const -> TExtent
 Returns the maximum number the validator can accept.
 
void SetMax (TExtent maxValue)
 Sets the maximum number the validator can accept.
 
auto GetRange () const -> TRange
 Returns the given the minimum and maximum number the validator can accept.
 
void SetRange (const TRange &range)
 Sets the minimum and maximum number the validator can accept.
 
- Public Member Functions inherited from owl::TFilterValidator
 TFilterValidator (const TCharSet &validChars)
 Let the compiler know that the following template instances will be defined elsewhere.
 
bool IsValidInput (TCHAR *str, bool suppressFill)
 IsValidInput overrides TValidator's virtual function and checks each character in the string str to ensure it is in the set of allowed characters, ValidChar.
 
- Public Member Functions inherited from owl::TValidator
 TValidator ()
 Constructs an abstract validator object and sets Options fields to 0.
 
virtual ~TValidator ()
 Destroys an abstract validator object.
 
bool Valid (LPCTSTR str, TWindow *owner=0)
 Returns true if IsValid returns true.
 
bool Valid (const tstring &str, TWindow *owner=0)
 
bool HasOption (int option)
 Gets the Options bits. Returns true if a specified option is set.
 
void SetOption (int option)
 Sets the bits for the Options data member.
 
void UnsetOption (int option)
 Unsets the bits specified in the Options data member.
 
- Public Member Functions inherited from owl::TStreamableBase
virtual ~TStreamableBase ()
 

Additional Inherited Members

- Protected Member Functions inherited from owl::TFilterValidator
const TCharSetGetValidChars ()
 Returns the valid character set for the validator.
 
void SetValidChars (const TCharSet &vc)
 Sets the valid character set for the validator.
 
- Protected Attributes inherited from owl::TValidator
uint16 Options
 A bitmap member used to control options for various descendants of TValidator.
 

Detailed Description

Determines whether the data typed by a user falls within a designated range of integers.

TRangeValidator is a streamable class.

Definition at line 224 of file validate.h.

Member Typedef Documentation

◆ TExtent

Definition at line 227 of file validate.h.

Constructor & Destructor Documentation

◆ TRangeValidator() [1/2]

owl::TRangeValidator::TRangeValidator ( TRangeValidator::TExtent minValue,
TRangeValidator::TExtent maxValue )
inline

Constructs a range validator object using minValue and maxValue as the range of possible values.

Definition at line 415 of file validate.h.

◆ TRangeValidator() [2/2]

owl::TRangeValidator::TRangeValidator ( const TRange & range)

Constructs a range validator object by first calling the constructor inherited from TFilterValidator, passing a set of characters containing the digits '0'..'9' and the characters '+' and '-'.

Sets Range establishing the range of acceptable long integer values.

Definition at line 27 of file rangeval.cpp.

References SetRange().

Member Function Documentation

◆ Adjust()

int owl::TRangeValidator::Adjust ( tstring & text,
int & begPos,
int & endPos,
int amount )
virtual

We first validate the range, because of the asynchronous manner in which SetMin and SetMax could be called might have Min greater than Max.

Adjusts the 'value' of the text, given a cursor position and an amount. Returns the actual amount adjusted.

Reimplemented from owl::TValidator.

Definition at line 232 of file rangeval.cpp.

References _T, owl::to_tstring(), and WARN.

◆ Error()

void owl::TRangeValidator::Error ( TWindow * owner)
virtual

Overrides TValidator's virtual function and displays a message box indicating that the entered value does not fall within the specified range.

Reimplemented from owl::TFilterValidator.

Definition at line 39 of file rangeval.cpp.

References owl::TRangeValidator::TRange::Max, owl::TRangeValidator::TRange::Min, and PRECONDITION.

◆ GetMax()

auto owl::TRangeValidator::GetMax ( ) const -> TExtent
inline

Returns the maximum number the validator can accept.

Definition at line 431 of file validate.h.

References owl::TRangeValidator::TRange::Max.

◆ GetMin()

auto owl::TRangeValidator::GetMin ( ) const -> TExtent
inline

Returns the minimum number the validator can accept.

Definition at line 422 of file validate.h.

References owl::TRangeValidator::TRange::Min.

◆ GetRange()

auto owl::TRangeValidator::GetRange ( ) const -> TRange
inline

Returns the given the minimum and maximum number the validator can accept.

Definition at line 439 of file validate.h.

◆ IsValid()

bool owl::TRangeValidator::IsValid ( LPCTSTR s)
virtual

We first validate the range, because of the asynchronous manner in which SetMin and SetMax could be called might have Min greater than Max.

If the given string is empty or blank (all white-space), returns true. Otherwise, converts the string str into an integer number and returns true if the result meets all three of these conditions:

  • It is a valid integer number.
  • Its value is greater than or equal to Min.
  • Its value is less than or equal to Max. If any of those tests fails, IsValid returns false.

Reimplemented from owl::TFilterValidator.

Definition at line 177 of file rangeval.cpp.

References owl::TFilterValidator::IsValid(), owl::TRangeValidator::TRange::Max, owl::TRangeValidator::TRange::Min, and PRECONDITION.

◆ SetMax()

void owl::TRangeValidator::SetMax ( TExtent maxValue)

Sets the maximum number the validator can accept.

We can't validate the range here, because of the asynchronous manner in which SetMin and SetMax could be called might have Range.Min greater than Range.Max.

Definition at line 149 of file rangeval.cpp.

References owl::TRangeValidator::TRange::Max.

◆ SetMin()

void owl::TRangeValidator::SetMin ( TExtent minValue)

Sets the minimum number the validator can accept.

We can't validate the range here, because of the asynchronous manner in which SetMin and SetMax could be called might have Range.Min greater than Range.Max.

Definition at line 136 of file rangeval.cpp.

References owl::TRangeValidator::TRange::Min.

◆ SetRange()

void owl::TRangeValidator::SetRange ( const TRange & range)

Sets the minimum and maximum number the validator can accept.

Definition at line 158 of file rangeval.cpp.

◆ Transfer()

uint owl::TRangeValidator::Transfer ( TCHAR * str,
void * buffer,
TTransferDirection direction )
virtual

Incorporates the three types, tdSizeData, tdGetData, and tdSetData, that a range validator can handle for its associated edit control.

The parameter str is the edit control's string value, and buffer is the data passed to the edit control. Depending on the value of direction, Transfer either sets str from the number in buffer or sets the number at buffer to the value of the string str. If direction is tdSetData, Transfer sets str from buffer. If direction is tdGetData, Transfer sets buffer from str. If direction is tdSizeData, Transfer neither sets nor reads data. Transfer always returns the size of the data transferred.

Reimplemented from owl::TValidator.

Definition at line 205 of file rangeval.cpp.

References _T, owl::TValidator::Options, owl::tdGetData, owl::tdSetData, owl::tdSizeData, owl::voTransfer, and WARN.


The documentation for this class was generated from the following files: