/**** * * Implementation of add-input-errors.h. * */ #include "add-input-errors.h" #include "std-macros.h" AddInputErrors::AddInputErrors() { alerrstr = new String("A card of the given id is already 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 addess must be <= 40 characters."); sl = new StrList(); anyerrors = false; } void AddInputErrors::SetAlreadyThereError() { sl->Put(new StrListElem((String*) alerrstr->Copy(), (void*) NULL)); anyerrors = true; } void AddInputErrors::SetNameError() { sl->Put(new StrListElem((String*) nerrstr->Copy(), (void*) NULL)); anyerrors = true; } void AddInputErrors::SetIdError() { sl->Put(new StrListElem((String*) iderrstr->Copy(), (void*) NULL)); anyerrors = true; } void AddInputErrors::SetAgeError() { sl->Put(new StrListElem((String*) aerrstr->Copy(), (void*) NULL)); anyerrors = true; } void AddInputErrors::SetSexError() { sl->Put(new StrListElem((String*) serrstr->Copy(), (void*) NULL)); anyerrors = true; } void AddInputErrors::SetAddressError() { sl->Put(new StrListElem((String*) aderrstr->Copy(), (void*) NULL)); anyerrors = true; } void AddInputErrors::Clear() { if (sl) delete sl; sl = new StrList(); anyerrors = false; } StrList* AddInputErrors::GetErrorList() { return sl; } bool AddInputErrors::AnyErrors() { return anyerrors; }