SamValidationErrors Class Reference

The SamValidationErrors class is a container class that holds SamValidationError Objects, allowing a validation method to return all of the invalid errors rather than just one. More...

#include <SamValidation.h>

Collaboration diagram for SamValidationErrors:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 SamValidationErrors ()
 Constructor.
 ~SamValidationErrors ()
 Destructor.
void clear ()
 Remove all the errors from the container.
void addError (SamValidationError::Type newType, SamValidationError::Severity newSeverity, const char *newMessage)
 Add the specified error to this container.
unsigned int numErrors ()
 Return the number of validation errors contained in this object.
const SamValidationErrorgetNextError ()
 Return a pointer to the next error without removing it from the container, and returning null once all errors have been retrieved until resetErrorIter is called.
void resetErrorIter ()
 Reset the iterator to the begining of the errors.
void getErrorString (std::string &errorString) const
 Append the error messages contained in this container to the passed in string.

Detailed Description

The SamValidationErrors class is a container class that holds SamValidationError Objects, allowing a validation method to return all of the invalid errors rather than just one.

Definition at line 116 of file SamValidation.h.


Member Function Documentation

void SamValidationErrors::getErrorString ( std::string &  errorString  )  const

Append the error messages contained in this container to the passed in string.

Definition at line 180 of file SamValidation.cpp.

Referenced by SamRecord::isValid().

00181 {
00182     for(std::list<const SamValidationError*>::
00183             const_iterator validationErrorIter = 
00184             myValidationErrors.begin(); 
00185         validationErrorIter != myValidationErrors.end(); 
00186         validationErrorIter++)
00187     {
00188         std::string error = "";
00189         (*validationErrorIter)->getErrorString(error);
00190         errorString += error;
00191     }
00192 }

const SamValidationError * SamValidationErrors::getNextError (  ) 

Return a pointer to the next error without removing it from the container, and returning null once all errors have been retrieved until resetErrorIter is called.

Definition at line 160 of file SamValidation.cpp.

00161 {
00162     if(myErrorIter == myValidationErrors.end())
00163     {
00164         // at the end of the list, return null.
00165         return(NULL);
00166     }
00167     // Not at the end of the list, return the last element and increment.
00168     return(*myErrorIter++);
00169 }


The documentation for this class was generated from the following files:
Generated on Mon Feb 11 13:45:29 2013 for libStatGen Software by  doxygen 1.6.3