9#include <owl/validate.rh>
97 return Strings->Find(
tstring{str}) != Strings->NPOS;
121 const auto count =
static_cast<int>(Strings->Size());
122 const auto index = Strings->
Find(text);
123 if (index == Strings->NPOS)
125 auto newIndex = index + amount;
128 else if (newIndex >= count)
129 newIndex = count - 1;
131 text = (*Strings)[newIndex];
132 return newIndex - index;
139#if OWL_PERSISTENT_STREAMS
155TLookupValidator::Streamer::Write(opstream& os)
const
164TStringLookupValidator::Streamer::Read(
ipstream& is,
uint32 )
const
170 for (
unsigned i = 0; i < count; i++ ) {
173 GetObject()->Strings->Add(temp);
182TStringLookupValidator::Streamer::Write(
opstream& os)
const
185 unsigned count = GetObject()->Strings->Size();
187 for (
unsigned i = 0; i < count; i++)
188 os << (*GetObject()->Strings)[i];
Definition of class TAppDictionary.
Definition of class TApplication.
#define PRECONDITION(condition)
A streamable class, TLookupValidator compares the string typed by a user with a list of acceptable va...
TLookupValidator()
Constructs a TLookupValidator object.
bool IsValid(LPCTSTR str)
IsValid overrides TValidator's virtual function and calls Lookup to find the string str in the list o...
virtual bool Lookup(LPCTSTR str)
Searches for the string str in the list of valid entries and returns true if it finds str; otherwise,...
int Find(const T &t) const
Derived from TLookupValidator, TStringLookupValidator is a streamable class.
void Error(TWindow *owner)
Overrides TValidator's virtual function and displays a message box indicating that the typed string d...
int Adjust(tstring &text, int &begPos, int &endPos, int amount)
Adjusts the 'value' of the text, given a cursor position and an amount.
~TStringLookupValidator()
This destructor disposes of a list of valid strings by calling NewStringList and then disposes of the...
TStringLookupValidator(TSortedStringArray *strings)
Constructs a string-lookup object by first calling the constructor inherited from TLookupValidator an...
bool Lookup(LPCTSTR str)
Overrides TLookupValidator's virtual function.
void NewStringList(TSortedStringArray *strings)
Sets the list of valid input string for the string-lookup validator.
A streamable class, TValidator defines an abstract data validation object.
TWindow, derived from TEventHandler and TStreamableBase, provides window-specific behavior and encaps...
tstring LoadString(uint id) const
int MessageBox(LPCTSTR text, LPCTSTR caption=0, uint flags=MB_OK) const
Displays a message in a modal pop-up dialog box.
ipstream, a specialized input stream derivative of pstream, is the base class for reading (extracting...
Base class for writing streamable objects.
Definition of class TFrameWindow.
void ReadBaseObject(Base *base, ipstream &in)
void WriteBaseObject(Base *base, opstream &out)
Object Windows Library (OWLNext Core).
TSortedObjectArray< tstring > TSortedStringArray
IMPLEMENT_STREAMABLE1(TApplication, TModule)