/**
 ******************************************************************************
 * Name: CIccTagStruct::Validate
 * 
 * Purpose: 
 * 
 * Args: 
 * 
 * Return: 
 ******************************************************************************/
icValidateStatus CIccTagStruct::Validate(std::string sigPath, std::string &sReport,
                                           const CIccProfile* pProfile /*=NULL*/) const
{ 
  icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);

  CIccInfo Info;
  std::string sSigPathName = Info.GetSigPathName(sigPath);

  // Check for duplicate tags
  if (!AreElemsUnique()) {
    sReport += icValidateWarning;
    sReport += sSigPathName;
    sReport += " - There are duplicate tags.\r\n";
    rv =icMaxStatus(rv, icValidateWarning);
  }

  // Check Required Tags which includes exclusion tests
  //rv = icMaxStatus(rv, CheckRequiredSubTags(sReport));

  //rv = icMaxStatus(rv, CheckSubTagTypes(sig, sReport));

  // Per Tag tests
  TagEntryList::iterator i;
  for (i=m_ElemEntries->begin(); i!=m_ElemEntries->end(); i++) {
    rv = icMaxStatus(rv, i->pTag->Validate(sigPath + icGetSigPath(i->TagInfo.sig), sReport, pProfile));
  }

  return rv;
}
Ejemplo n.º 2
0
/**
 ******************************************************************************
 * Name: CIccTagProfileSequenceId::Validate
 * 
 * Purpose: 
 * 
 * Args: 
 * 
 * Return: 
 ******************************************************************************/
icValidateStatus CIccTagProfileSequenceId::Validate(std::string sigPath, std::string &sReport,
                                           const CIccProfile* pProfile /*=NULL*/) const
{ 
  icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);

  CIccInfo Info;
  std::string sSigName = Info.GetSigPathName(sigPath);

  CIccProfileIdDescList::iterator i;
  
  for (i=m_list->begin(); i!=m_list->end(); i++) {
    rv = icMaxStatus(rv, i->Validate(sigPath+icGetSigPath(GetType()), sReport, pProfile));
  }

  return rv;
}
/**
******************************************************************************
* Name: CIccTagArray::Validate
* 
* Purpose: 
* 
* Args: 
* 
* Return: 
******************************************************************************/
icValidateStatus CIccTagArray::Validate(std::string sigPath, std::string &sReport,
                                         const CIccProfile* pProfile /*=NULL*/) const
{ 
  icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);

  CIccInfo Info;
  std::string sigAryPath = sigPath + icGetSigPath(m_sigArrayType);

  if (m_pArray) {  //Should call GetArrayHandler before validate to get 
    rv = icMaxStatus(rv, m_pArray->Validate(sigPath, sReport, pProfile));
  }
  else if (m_sigArrayType==icSigUtf8TextTypeArray) { //UTF8 text arrays are known
    //Check # of channels 
    if (icGetFirstSigPathSig(sigPath) == icSigMaterialTypeArrayTag && 
        pProfile &&
        m_nSize != icGetMaterialColorSpaceSamples(pProfile->m_Header.mcs)) {
      std::string sSigPathName = Info.GetSigPathName(sigPath);

      sReport += icValidateCriticalErrorMsg;
      sReport += sSigPathName;
      sReport += " - Number of material channel names does not match MCS in header.\r\n";
      rv = icMaxStatus(rv, icValidateCriticalError);
    }
    icUInt32Number i;
    for (i=0; i<m_nSize; i++) {
      rv = icMaxStatus(rv, m_TagVals[i].ptr->Validate(sigAryPath, sReport, pProfile));
    }
  }
  else { 
    icUInt32Number i;
    sReport += "Unknown tag array type - Validating array sub-tags\n";
    rv = icMaxStatus(rv, icValidateWarning);

    for (i=0; i<m_nSize; i++) {
      rv = icMaxStatus(rv, m_TagVals[i].ptr->Validate(sigAryPath, sReport, pProfile));
    }
  }

  return rv;
}