/**** * * Implementation of change-input-errors.h. * */ #include "change-input-errors.h" #include "std-macros.h" ChangeInputErrors::ChangeInputErrors() { alerrstr = new String("A card of the given id is already in the rolodex."); nalerrstr = new String("A card of the given id is not in the rolodex."); nerrstr = new String("Card name must be <= 30 characters."); iderrstr = new String("Card id must be 9 digits."); aerrstr = new String("Card age must be >=0 and <= 200 characters."); serrstr = new String("Card sex must be \"m\" or \"f\""); aderrstr = new String("Card address must be <= 40 characters."); sl = new StrList(); anyerrors = false; } void ChangeInputErrors::SetNotThereError() { sl->Put(new StrListElem((String*) nalerrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetAlreadyThereError() { sl->Put(new StrListElem((String*) alerrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetIdenticalToExtantError() { sl->Put(new StrListElem((String*) identerrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetNameError() { sl->Put(new StrListElem((String*) nerrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetIdError() { sl->Put(new StrListElem((String*) iderrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetAgeError() { sl->Put(new StrListElem((String*) aerrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetSexError() { sl->Put(new StrListElem((String*) serrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::SetAddressError() { sl->Put(new StrListElem((String*) aderrstr->Copy(), (void*) NULL)); anyerrors = true; } void ChangeInputErrors::Clear() { if (sl) delete sl; sl = new StrList(); anyerrors = false; } StrList* ChangeInputErrors::GetErrorList() { return sl; } bool ChangeInputErrors::AnyErrors() { return anyerrors; }