IccMAX 2.1.27
Color Profile Tools
Loading...
Searching...
No Matches
CIccTagArray Class Reference

#include <IccTagComposite.h>

+ Inheritance diagram for CIccTagArray:
+ Collaboration diagram for CIccTagArray:

Public Member Functions

 CIccTagArray ()
 
 CIccTagArray (const CIccTagArray &lut)
 
 CIccTagArray (icArraySignature sigArrayType)
 
virtual ~CIccTagArray ()
 
bool AreAllOfType (icTagTypeSignature sigTagType)
 
bool AttachTag (icUInt32Number nIndex, CIccTag *pTag)
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
CIccTagDetachTag (icUInt32Number nIndex, bool bDeleteFlag=false)
 
IIccArrayGetArrayHandler ()
 
virtual const icCharGetClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
CIccTagGetIndex (icUInt32Number index) const
 
icUInt32Number GetSize () const
 Returns the size of the data array.
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 
virtual CIccTagNewCopy () const
 
CIccTagArrayoperator= (const CIccTagArray &lut)
 
CIccTagoperator[] (icUInt32Number index) const
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
bool SetSize (icUInt32Number nSize)
 
virtual bool SetTagArrayType (icArraySignature sig)
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 
virtual bool Write (CIccIO *pIO)
 

Static Public Member Functions

static CIccTagCreate (icTagTypeSignature sig)
 
static CIccTagArrayParseMem (icUInt8Number *pMem, icUInt32Number size)
 

Data Fields

icUInt32Number m_nReserved
 

Protected Member Functions

void Cleanup ()
 

Protected Attributes

icUInt32Number m_nSize
 
IIccArraym_pArray
 
icArraySignature m_sigArrayType
 
IccTagPtr * m_TagVals
 

Detailed Description

Class: CIccTagArray

Purpose: The Tag Array tag

Constructor & Destructor Documentation

◆ CIccTagArray() [1/3]

CIccTagArray::CIccTagArray ( )

Name: CIccTagArray::CIccTagArray

Purpose:

Args:

Return:

994{
995 m_TagVals = NULL;
996 m_nSize = 0;
997 m_pArray = NULL;
999}
#define icSigUnknownArray
Definition icProfileHeader.h:624
icArraySignature m_sigArrayType
Definition IccTagComposite.h:270
icUInt32Number m_nSize
Definition IccTagComposite.h:272
IccTagPtr * m_TagVals
Definition IccTagComposite.h:273
IIccArray * m_pArray
Definition IccTagComposite.h:266

References m_nSize, m_pArray, m_sigArrayType, and m_TagVals.

◆ CIccTagArray() [2/3]

CIccTagArray::CIccTagArray ( icArraySignature  sigArrayType)

Name: CIccTagArray::CIccTagArray

Purpose:

Args:

Return:

1012{
1013 m_TagVals = NULL;
1014 m_nSize = 0;
1015
1016 m_pArray = NULL;
1017 SetTagArrayType(sigArrayType);
1018}
virtual bool SetTagArrayType(icArraySignature sig)
Definition IccTagComposite.cpp:1122

References m_nSize, m_pArray, m_TagVals, and SetTagArrayType().

+ Here is the call graph for this function:

◆ CIccTagArray() [3/3]

CIccTagArray::CIccTagArray ( const CIccTagArray tagAry)

Name: CIccTagArray::CIccTagArray

Purpose:

Args:

Return:

1031{
1032 if (tagAry.m_nSize) {
1033 m_TagVals = new IccTagPtr[tagAry.m_nSize];
1034
1036 for (i=0; i<tagAry.m_nSize; i++) {
1037 if (tagAry.m_TagVals[i].ptr)
1038 m_TagVals[i].ptr = tagAry.m_TagVals[i].ptr->NewCopy();
1039 else
1040 m_TagVals[i].ptr = NULL;
1041 }
1042 m_nSize = tagAry.m_nSize;
1043 }
1045
1046 if (tagAry.m_pArray)
1047 m_pArray = tagAry.m_pArray->NewCopy(this);
1048 else
1049 m_pArray = NULL;
1050}
unsigned long icUInt32Number
Definition icProfileHeader.h:262
virtual IIccArray * NewCopy(CIccTagArray *pNewTagArray) const =0

References m_nSize, m_pArray, m_sigArrayType, m_TagVals, CIccTag::NewCopy(), and IIccArray::NewCopy().

Referenced by NewCopy().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ ~CIccTagArray()

CIccTagArray::~CIccTagArray ( )
virtual

Name: CIccTagArray::~CIccTagArray

Purpose:

Args:

Return:

1103{
1104 Cleanup();
1105}
void Cleanup()
Definition IccTagComposite.cpp:1503

References Cleanup().

+ Here is the call graph for this function:

Member Function Documentation

◆ AreAllOfType()

bool CIccTagArray::AreAllOfType ( icTagTypeSignature  sigTagType)

Name: CIccTagArray::AreAllOftype

Purpose: checks if all array elements have type signature sigTagType Args: sigTagType Return: true if all elements are of type sigTagType, false otherwise

1146{
1148 for (i=0; i<m_nSize; i++) {
1149 CIccTag *pTag = GetIndex(i);
1150 if (!pTag || pTag->GetType()!=sigTagType)
1151 return false;
1152 }
1153
1154 return true;
1155}
CIccTag * GetIndex(icUInt32Number index) const
Definition IccTagComposite.cpp:1544
Definition IccTagBasic.h:108
virtual icTagTypeSignature GetType() const
Definition IccTagBasic.h:131

References GetIndex(), CIccTag::GetType(), and m_nSize.

+ Here is the call graph for this function:

◆ AttachTag()

bool CIccTagArray::AttachTag ( icUInt32Number  nIndex,
CIccTag pTag 
)

Name: CIccTagArray::AttachTag

Purpose: Get a tag entry with a given signature

Args: nIndex - index of tag in array

Return: Pointer to desired tag struct entry, or NULL if not found.

1567{
1568 if (nIndex>m_nSize || !pTag) {
1569 return false;
1570 }
1571
1572 if (m_TagVals[nIndex].ptr && m_TagVals[nIndex].ptr != pTag) {
1573 return false;
1574 }
1575
1576 m_TagVals[nIndex].ptr = pTag;
1577 return true;
1578}

References m_nSize, and m_TagVals.

◆ Cleanup()

void CIccTagArray::Cleanup ( )
protected

Name: CIccTagArray::Cleanup

Purpose: Detach from a pending IO object

1504{
1505 icUInt32Number i, j;
1506 CIccTag* pTag;
1507
1508 for (i=0; i<m_nSize; i++) {
1509 pTag = m_TagVals[i].ptr;
1510 if (pTag) {
1511 for (j=i+1; j<m_nSize; j++) {
1512 if (m_TagVals[i].ptr==pTag)
1513 m_TagVals[i].ptr = NULL;
1514 }
1515 delete pTag;
1516 m_TagVals[i].ptr = NULL;
1517 }
1518 }
1519
1520 if (m_TagVals)
1521 free(m_TagVals);
1522 m_TagVals = nullptr;
1523
1524 if (m_pArray)
1525 delete m_pArray;
1526
1527 m_pArray = NULL;
1529}
@ icSigUndefinedArray
Definition icProfileHeader.h:617

References icSigUndefinedArray, m_nSize, m_pArray, m_sigArrayType, and m_TagVals.

Referenced by ~CIccTagArray(), operator=(), and Read().

+ Here is the caller graph for this function:

◆ Create()

CIccTag * CIccTag::Create ( icTagTypeSignature  sig)
staticinherited

Name: CIccTag::Create

Purpose: This is a static tag creator based upon tag signature type

Args: sig = tag type signature

Return: Pointer to Allocated tag

144{
145 return CIccTagCreator::CreateTag(sig);
146}
static CIccTag * CreateTag(icTagTypeSignature tagTypeSig)
Definition IccTagFactory.h:279

References CIccTagCreator::CreateTag().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccTagStruct::LoadElem(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeTintArray::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::SetColorSpaces(), and CIccProfileDescText::SetType().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Describe()

void CIccTagArray::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtual

Name: CIccTagArray::Describe

Purpose:

Args:

Return:

Reimplemented from CIccTag.

1169{
1170 std::string name;
1171 icChar buf[128];
1172 CIccInfo info;
1173
1174 IIccArray *pArrayObj = GetArrayHandler();
1176
1177 sDescription += "BEGIN TAG_ARRAY \"";
1178 sDescription += name;
1179 sDescription += "\"\n\n";
1180
1182
1183 for (i=0; i<m_nSize; i++) {
1184 if (i)
1185 sDescription += "\n";
1186 sprintf(buf, "BEGIN INDEX[%d]\n", i);
1187 sDescription += buf;
1188
1189 if (m_TagVals[i].ptr) {
1190 m_TagVals[i].ptr->Describe(sDescription, nVerboseness);
1191 }
1192 sprintf(buf, "END INDEX[%d]\n", i);
1193 sDescription += buf;
1194 }
1195
1196 sDescription += "\n";
1197 sDescription += "END TAG_ARRAY \"";
1198 sDescription += name;
1199 sDescription += "\"\n";
1200}
char icChar
Definition IccDefs.h:110
Definition IccUtil.h:303
static bool GetArraySigName(std::string &arrayName, icArraySignature arrayTypeSig, bool bFillUnknown=true)
Definition IccArrayFactory.h:254
Definition IccTagComposite.h:130
IIccArray * GetArrayHandler()
Definition IccTagComposite.cpp:1624

References CIccTag::Describe(), GetArrayHandler(), CIccArrayCreator::GetArraySigName(), m_nSize, m_sigArrayType, and m_TagVals.

+ Here is the call graph for this function:

◆ DetachIO()

virtual void CIccTag::DetachIO ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

183{}

◆ DetachTag()

CIccTag * CIccTagArray::DetachTag ( icUInt32Number  nIndex,
bool  bDeleteFlag = false 
)

Name: CIccTagArray::DetachTag

Purpose: Detach tag value at given index

Args: nIndex - index of tag in array bDeleteFlag - flag indicating detached tag should be deleted

Return: Pointer to Detached tag struct entry, or NULL if not found or deleted.

1596{
1597 if (nIndex>m_nSize)
1598 return NULL;
1599
1600 CIccTag *rv = m_TagVals[nIndex].ptr;
1601 m_TagVals[nIndex].ptr = NULL;
1602
1603 if (bDeleteFlag) {
1604 delete rv;
1605 rv = NULL;
1606 }
1607
1608 return rv;
1609}

References m_nSize, and m_TagVals.

◆ GetArrayHandler()

IIccArray * CIccTagArray::GetArrayHandler ( )

Name: CIccTagArray::GetArrayHandler

Purpose: Get Array object handler

Args:

Return: Pointer to an Array object handler for the associated array type

1625{
1626 if (!m_pArray) {
1628 }
1629
1630 return m_pArray;
1631}
static IIccArray * CreateArray(icArraySignature arrayTypeSig, CIccTagArray *pTagArray=NULL)
Definition IccArrayFactory.h:237

References CIccArrayCreator::CreateArray(), m_pArray, and m_sigArrayType.

Referenced by Describe(), and icGetTagArrayHandler().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ GetClassName()

virtual const icChar * CIccTagArray::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlArray.

244{ return "CIccTagArray"; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTag::GetExtension ( )
inlinevirtualinherited

Reimplemented in CIccTagXmlUnknown, CIccTagXmlText, CIccTagXmlUtf8Text, CIccTagXmlZipUtf8Text, CIccTagXmlZipXml, CIccTagXmlUtf16Text, CIccTagXmlTextDescription, CIccTagXmlSignature, CIccTagXmlNamedColor2, CIccTagXmlXYZ, CIccTagXmlChromaticity, CIccTagXmlCicp, CIccTagXmlSparseMatrixArray, CIccTagXmlFixedNum< T, Tsig >, CIccTagXmlNum< T, A, Tsig >, CIccTagXmlFloatNum< T, A, Tsig >, CIccTagXmlMeasurement, CIccTagXmlMultiLocalizedUnicode, CIccTagXmlTagData, CIccTagXmlDateTime, CIccTagXmlColorantOrder, CIccTagXmlColorantTable, CIccTagXmlViewingConditions, CIccTagXmlSpectralDataInfo, CIccTagXmlSpectralViewingConditions, CIccTagXmlProfileSeqDesc, CIccTagXmlResponseCurveSet16, CIccTagXmlCurve, CIccTagXmlParametricCurve, CIccTagXmlSegmentedCurve, CIccTagXmlLutAtoB, CIccTagXmlLutBtoA, CIccTagXmlLut8, CIccTagXmlLut16, CIccTagXmlMultiProcessElement, CIccTagXmlProfileSequenceId, CIccTagXmlDict, CIccTagXmlStruct, CIccTagXmlArray, CIccTagXmlGamutBoundaryDesc, CIccTagXmlEmbeddedHeightImage, CIccTagXmlEmbeddedNormalImage, and CIccTagXmlEmbeddedProfile.

143{return NULL;}

Referenced by icCurvesFromXml(), icCurvesToXml(), icProfDescToXml(), icXmlParseProfDesc(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeXmlTintArray::ToXml(), CIccTagXmlStruct::ToXml(), CIccTagXmlArray::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ GetIndex()

CIccTag * CIccTagArray::GetIndex ( icUInt32Number  nIndex) const

Name: CIccTagArray::GetIndex

Purpose: Get a tag entry with a given index

Args: nIndex - index of tag in array

Return: Pointer to desired tag entry, or NULL if not found.

1545{
1546 if (nIndex>m_nSize)
1547 return NULL;
1548
1549 return m_TagVals[nIndex].ptr;
1550}

References m_nSize, and m_TagVals.

Referenced by AreAllOfType(), CIccArrayNamedColor::Begin(), CIccArrayNamedColor::FindDeviceColor(), CIccArrayNamedColor::FindPcsColor(), CIccArrayNamedColor::FindSpectralColor(), operator[](), CIccArrayUnknown::Validate(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetSize()

icUInt32Number CIccTagArray::GetSize ( ) const
inline

Returns the size of the data array.

260{ return m_nSize; }

References m_nSize.

Referenced by CIccArrayNamedColor::Begin(), CIccArrayNamedColor::FindDeviceColor(), CIccArrayNamedColor::FindPcsColor(), CIccArrayNamedColor::FindSpectralColor(), CIccArrayUnknown::Validate(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetTagArrayType()

virtual icArraySignature CIccTagArray::GetTagArrayType ( ) const
inlinevirtual

Reimplemented from CIccTag.

238{ return m_sigArrayType; }

References m_sigArrayType.

◆ GetTagStructType()

virtual icStructSignature CIccTag::GetTagStructType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagStruct.

132{ return icSigUndefinedStruct; }
@ icSigUndefinedStruct
Definition icProfileHeader.h:606

References icSigUndefinedStruct.

Referenced by icGetTagStructHandlerOfType(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetType()

virtual icTagTypeSignature CIccTagArray::GetType ( ) const
inlinevirtual

Function: GetType()

Purpose: Get Tag Type. Each derived tag will implement it's own GetType() function.

Reimplemented from CIccTag.

237{ return icSigTagArrayType; }
@ icSigTagArrayType
Definition icProfileHeader.h:563

References icSigTagArrayType.

Referenced by Write().

+ Here is the caller graph for this function:

◆ IsArrayType()

virtual bool CIccTag::IsArrayType ( )
inlinevirtualinherited

Reimplemented in CIccTagXYZ, CIccTagChromaticity, CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, CIccTagFloatNum< T, Tsig >, and CIccTagData.

135{ return false; }

Referenced by MyTagDialog::MyTagDialog(), and DumpTag().

+ Here is the caller graph for this function:

◆ IsMBBType()

virtual bool CIccTag::IsMBBType ( )
inlinevirtualinherited

Reimplemented in CIccMBB.

136{ return false; } //If true then CIccTag can be cast as an CIccMBB

Referenced by CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ IsNumArrayType()

virtual bool CIccTag::IsNumArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, and CIccTagFloatNum< T, Tsig >.

137{ return false;} //If true then CIccTag can be cast as a CIccTagNumArray

Referenced by CIccArrayNamedColor::FindDeviceColor(), CIccArrayNamedColor::FindPcsColor(), CIccArrayNamedColor::FindSpectralColor(), CIccTagStruct::GetElemNumberValue(), CIccStructNamedColor::GetNumArray(), CIccMpeXmlTintArray::ParseXml(), and CIccMpeTintArray::Read().

+ Here is the caller graph for this function:

◆ IsSupported()

virtual bool CIccTag::IsSupported ( )
inlinevirtualinherited

Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes. By Default inherited classes are supported. Unknown tag types are not supported.

Returns true if tag type is supported.

Reimplemented in CIccTagUnknown, CIccTagEmbeddedProfile, and CIccTagMultiProcessElement.

153{ return true; }

◆ NewCopy()

virtual CIccTag * CIccTagArray::NewCopy ( ) const
inlinevirtual

Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.

Parameter(s): none

Returns a new CIccTag object that is a copy of this object.

Reimplemented from CIccTag.

232{ return new CIccTagArray(*this);}
CIccTagArray()
Definition IccTagComposite.cpp:993

References CIccTagArray().

+ Here is the call graph for this function:

◆ operator=()

CIccTagArray & CIccTagArray::operator= ( const CIccTagArray tagAry)

Name: &operator=

Purpose:

Args:

Return:

1063{
1064 if (&tagAry == this)
1065 return *this;
1066
1067 Cleanup();
1068
1069 if (tagAry.m_nSize) {
1070 m_TagVals = new IccTagPtr[tagAry.m_nSize];
1071
1073 for (i=0; i<m_nSize; i++) {
1074 if (tagAry.m_TagVals[i].ptr)
1075 m_TagVals[i].ptr = tagAry.m_TagVals[i].ptr->NewCopy();
1076 else
1077 m_TagVals[i].ptr = NULL;
1078 }
1079 m_nSize = tagAry.m_nSize;
1080 }
1081
1083
1084 if (tagAry.m_pArray)
1085 m_pArray = tagAry.m_pArray->NewCopy(this);
1086 else
1087 m_pArray = NULL;
1088
1089 return *this;
1090}

References Cleanup(), m_nSize, m_pArray, m_sigArrayType, m_TagVals, CIccTag::NewCopy(), and IIccArray::NewCopy().

+ Here is the call graph for this function:

◆ operator[]()

CIccTag * CIccTagArray::operator[] ( icUInt32Number  index) const
inline
257{ return GetIndex(index); }

References GetIndex().

+ Here is the call graph for this function:

◆ ParseMem()

static CIccTagArray * CIccTagArray::ParseMem ( icUInt8Number pMem,
icUInt32Number  size 
)
static

◆ Read() [1/2]

bool CIccTagArray::Read ( icUInt32Number  size,
CIccIO pIO 
)
virtual

Name: CIccTagArray::Read

Purpose:

Args:

Return:

Reimplemented from CIccTag.

1214{
1216
1217 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
1218 sizeof(icUInt32Number) +
1219 sizeof(icTagTypeSignature) +
1220 sizeof(icStructSignature) +
1221 sizeof(icUInt32Number);
1222
1223 if (headerSize > size)
1224 return false;
1225
1226 if (!pIO) {
1227 return false;
1228 }
1229
1230 Cleanup();
1231
1232 icUInt32Number nTagStart = pIO->Tell();
1233
1234 if (!pIO->Read32(&sig))
1235 return false;
1236
1237 icArraySignature sigArrayType;
1238
1239 if (!pIO->Read32(&m_nReserved) ||
1240 !pIO->Read32(&sigArrayType))
1241 return false;
1242
1243 SetTagArrayType(sigArrayType);
1244
1245 icUInt32Number count, i, j;
1246 IccTagEntry TagEntry;
1247
1248 TagEntry.pTag = NULL;
1249
1250 if (!pIO->Read32(&count))
1251 return false;
1252
1253 if (headerSize + count*sizeof(icPositionNumber) > size)
1254 return false;
1255
1256 if (count) {
1257 icPositionNumber *tagPos = new icPositionNumber[count];
1258
1259 if (!SetSize(count)) {
1260 delete[] tagPos;
1261 return false;
1262 }
1263
1264 for (i=0; i<count; i++) {
1265 if (!pIO->Read32(&tagPos[i].offset) ||
1266 !pIO->Read32(&tagPos[i].size)) {
1267 delete [] tagPos;
1268 return false;
1269 }
1270 }
1271
1272 for (i=0; i<count; i++) {
1273 if (!tagPos[i].offset || !tagPos[i].size) {
1274 m_TagVals[i].ptr = NULL;
1275 continue;
1276 }
1277
1278 for (j=0; j<i; j++) {
1279 if (tagPos[i].offset == tagPos[j].offset)
1280 break;
1281 }
1282
1283 if (j<i) {
1284 m_TagVals[i].ptr = m_TagVals[j].ptr;
1285 }
1286 else {
1287 if (tagPos[i].offset + tagPos[i].size > size) {
1288 delete [] tagPos;
1289 return false;
1290 }
1291 pIO->Seek(nTagStart + tagPos[i].offset, icSeekSet);
1292
1293 icTagTypeSignature tagSig;
1294 pIO->Read32(&tagSig);
1295 pIO->Seek(nTagStart + tagPos[i].offset, icSeekSet);
1296
1297 CIccTag *pTag = CIccTagCreator::CreateTag(tagSig);
1298 if (pTag) {
1299 if (!pTag->Read(tagPos[i].size, pIO)) {
1300 delete [] tagPos;
1301 return false;
1302 }
1303 m_TagVals[i].ptr = pTag;
1304 }
1305 else {
1306 delete [] tagPos;
1307 return false;
1308 }
1309 }
1310 }
1311
1312 delete [] tagPos;
1313 }
1314
1315 return true;
1316}
icTagTypeSignature
Definition icProfileHeader.h:526
icStructSignature
Definition icProfileHeader.h:598
icArraySignature
Definition icProfileHeader.h:616
Definition icProfileHeader.h:1460
@ icSeekSet
Definition IccIO.h:83
bool SetSize(icUInt32Number nSize)
Definition IccTagComposite.cpp:1420
virtual icInt32Number Tell()
Definition IccIO.h:133
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
Definition IccIO.h:132
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagBasic.h:235
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.h:167

References Cleanup(), CIccTagCreator::CreateTag(), icSeekSet, CIccTag::m_nReserved, m_TagVals, icPositionNumber::offset, CIccTag::Read(), CIccIO::Read32(), CIccIO::Seek(), SetSize(), SetTagArrayType(), icPositionNumber::size, and CIccIO::Tell().

+ Here is the call graph for this function:

◆ Read() [2/2]

virtual bool CIccTag::Read ( icUInt32Number  size,
CIccIO pIO,
CIccProfile pProfile 
)
inlinevirtualinherited

Function: Read(size, pIO) - Read tag from file. Each derived tag will implement it's own Read() function.

Parameter(s): size - number of bytes in tag including the type signature. pIO - IO object used to read in tag. The IO object should already be initialized to point to the begining of the tag.

Returns true if Read is successful.

Reimplemented in CIccTagEmbeddedProfile.

197{ return Read(size, pIO); }

References CIccTag::Read().

+ Here is the call graph for this function:

◆ ReadAll()

virtual bool CIccTag::ReadAll ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

Reimplemented in CIccTagEmbeddedProfile.

175{ return true; }

◆ SetSize()

bool CIccTagArray::SetSize ( icUInt32Number  nSize)

Name: CIccTagArray::SetSize

Purpose: Sets the size of the tag array.

Args: nSize - number of tag entries,

1421{
1422 if (!m_nSize) {
1423 m_TagVals = (IccTagPtr*)calloc(nSize, sizeof(IccTagPtr));
1424 if (!m_TagVals) {
1425 m_nSize =0;
1426 return false;
1427 }
1428 }
1429 else {
1430 if (nSize<=m_nSize)
1431 return true;
1432
1433 m_TagVals = (IccTagPtr*)icRealloc(m_TagVals, nSize*sizeof(IccTagPtr));
1434 if (!m_TagVals) {
1435 m_nSize = 0;
1436 return false;
1437 }
1438 memset(&m_TagVals[m_nSize], 0, (nSize-m_nSize)*sizeof(IccTagPtr));
1439 }
1440 m_nSize = nSize;
1441 return true;
1442}
ICCPROFLIB_API void * icRealloc(void *ptr, size_t size)
Definition IccUtil.cpp:111

References icRealloc(), m_nSize, and m_TagVals.

Referenced by CIccTagXmlArray::ParseXml(), and Read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ SetTagArrayType()

bool CIccTagArray::SetTagArrayType ( icArraySignature  sig)
virtual

Name: CIccTagArray::~SetTagArrayType

Purpose: Set the signature of the tag array type. This also sets the m_pArray to allow array type specific handling to be utilized.

Args: sig - signature of array type

Return: true if sig is a recognized array type, false otherwise

1123{
1124 if (m_pArray)
1125 delete m_pArray;
1126
1127 m_sigArrayType = sig;
1129
1130 return (m_pArray != NULL) || (m_sigArrayType == icSigUtf8TextTypeArray);
1131}
@ icSigUtf8TextTypeArray
Definition icProfileHeader.h:620

References CIccArrayCreator::CreateArray(), icSigUtf8TextTypeArray, m_pArray, and m_sigArrayType.

Referenced by CIccTagArray(), CIccTagXmlArray::ParseXml(), and Read().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ Validate()

icValidateStatus CIccTagArray::Validate ( std::string  sigPath,
std::string &  sReport,
const CIccProfile pProfile = NULL 
) const
virtual

Name: CIccTagArray::Validate

Purpose:

Args:

Return:

Reimplemented from CIccTag.

1457{
1458 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
1459
1460 CIccInfo Info;
1461 std::string sigAryPath = sigPath + icGetSigPath(m_sigArrayType);
1462
1463 if (m_pArray) { //Should call GetArrayHandler before validate to get
1464 rv = icMaxStatus(rv, m_pArray->Validate(sigPath, sReport, pProfile));
1465 }
1466 else if (m_sigArrayType==icSigUtf8TextTypeArray) { //UTF8 text arrays are known
1467 //Check # of channels
1469 pProfile &&
1470 m_nSize != icGetMaterialColorSpaceSamples(pProfile->m_Header.mcs)) {
1471 std::string sSigPathName = Info.GetSigPathName(sigPath);
1472
1473 sReport += icMsgValidateCriticalError;
1474 sReport += sSigPathName;
1475 sReport += " - Number of material channel names does not match MCS in header.\n";
1477 }
1479 for (i=0; i<m_nSize; i++) {
1480 rv = icMaxStatus(rv, m_TagVals[i].ptr->Validate(sigAryPath, sReport, pProfile));
1481 }
1482 }
1483 else {
1485 sReport += "Unknown tag array type - Validating array sub-tags\n";
1487
1488 for (i=0; i<m_nSize; i++) {
1489 rv = icMaxStatus(rv, m_TagVals[i].ptr->Validate(sigAryPath, sReport, pProfile));
1490 }
1491 }
1492
1493 return rv;
1494}
@ icSigMaterialTypeArrayTag
Definition icProfileHeader.h:427
icValidateStatus
Definition IccDefs.h:119
@ icValidateWarning
Definition IccDefs.h:121
@ icValidateCriticalError
Definition IccDefs.h:123
ICCPROFLIB_API icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
ICCPROFLIB_API std::string icGetSigPath(icUInt32Number sig)
Definition IccUtil.cpp:1191
ICCPROFLIB_API const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
ICCPROFLIB_API icUInt32Number icGetMaterialColorSpaceSamples(icMaterialColorSignature sig)
Definition IccUtil.cpp:1391
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const =0
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Definition IccTagBasic.cpp:164

References CIccInfo::GetSigPathName(), icGetFirstSigPathSig(), icGetMaterialColorSpaceSamples(), icGetSigPath(), icMaxStatus(), icMsgValidateCriticalError, icSigMaterialTypeArrayTag, icSigUtf8TextTypeArray, icValidateCriticalError, icValidateWarning, m_nSize, m_pArray, m_sigArrayType, m_TagVals, icHeader::mcs, CIccTag::Validate(), and IIccArray::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagArray::Write ( CIccIO pIO)
virtual

Name: CIccTagArray::Write

Purpose:

Args:

Return:

Reimplemented from CIccTag.

1329{
1331
1332 if (!pIO)
1333 return false;
1334
1335 icUInt32Number nTagStart = pIO->Tell();
1336
1337 if (!pIO->Write32(&sig))
1338 return false;
1339
1340 if (!pIO->Write32(&m_nReserved))
1341 return false;
1342
1343 if (!pIO->Write32(&m_sigArrayType))
1344 return false;
1345
1346 if (!pIO->Write32(&m_nSize))
1347 return false;
1348
1349 if (m_nSize) {
1350 icUInt32Number i, j;
1351
1352 icUInt32Number pos = pIO->Tell();
1353
1354 //Write Unintialized TagPosition block
1355 icUInt32Number zero = 0;
1356 for (i=0; i<m_nSize; i++) {
1357 if (!pIO->Write32(&zero) || !pIO->Write32(&zero))
1358 return false;
1359 }
1361 if (!tagPos)
1362 return false;
1363
1364 //Write Tags
1365 for (i=0; i<m_nSize; i++) {
1366 if (m_TagVals[i].ptr) {
1367 for (j=0; j<i; j++) {
1368 if (m_TagVals[i].ptr==m_TagVals[j].ptr)
1369 break;
1370 }
1371
1372 if (j<i) {
1373 tagPos[i].offset = tagPos[j].offset;
1374 tagPos[i].size = tagPos[j].offset;
1375 }
1376 else {
1377 tagPos[i].offset = pIO->Tell() - nTagStart;
1378 if (!m_TagVals[i].ptr->Write(pIO)) {
1379 delete [] tagPos;
1380 return false;
1381 }
1382 tagPos[i].size = pIO->Tell() - nTagStart - tagPos[i].offset;
1383 pIO->Align32();
1384 }
1385 }
1386 else {
1387 tagPos[i].offset = 0;
1388 tagPos[i].size = 0;
1389 }
1390 }
1391 icUInt32Number endPos = pIO->Tell();
1392
1393 //Update TagPosition block
1394 pIO->Seek(pos, icSeekSet);
1395 for (i=0; i<m_nSize; i++) {
1396 if (!pIO->Write32(&tagPos[i].offset) ||
1397 !pIO->Write32(&tagPos[i].size)) {
1398 delete [] tagPos;
1399 return false;
1400 }
1401 }
1402 delete[] tagPos;
1403 pIO->Seek(endPos, icSeekSet);
1404 }
1405
1406 return true;
1407}
icUInt32Number offset
Definition icProfileHeader.h:1461
icUInt32Number size
Definition icProfileHeader.h:1462
virtual icTagTypeSignature GetType() const
Definition IccTagComposite.h:237
bool Align32()
Write operation to make sure that filelength is evenly divisible by 4.
Definition IccIO.cpp:341
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152

References CIccIO::Align32(), GetType(), icSeekSet, CIccTag::m_nReserved, m_nSize, m_sigArrayType, m_TagVals, icPositionNumber::offset, CIccIO::Seek(), icPositionNumber::size, CIccIO::Tell(), CIccTag::Write(), and CIccIO::Write32().

+ Here is the call graph for this function:

Field Documentation

◆ m_nReserved

icUInt32Number CIccTag::m_nReserved
inherited

Referenced by CIccTag::CIccTag(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::operator=(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagText::Read(), CIccTagUtf8Text::Read(), CIccTagZipUtf8Text::Read(), CIccTagUtf16Text::Read(), CIccTagTextDescription::Read(), CIccTagSignature::Read(), CIccTagNamedColor2::Read(), CIccTagXYZ::Read(), CIccTagChromaticity::Read(), CIccTagCicp::Read(), CIccTagSparseMatrixArray::Read(), CIccTagFixedNum< T, Tsig >::Read(), CIccTagNum< T, Tsig >::Read(), CIccTagFloatNum< T, Tsig >::Read(), CIccTagMeasurement::Read(), CIccTagMultiLocalizedUnicode::Read(), CIccTagData::Read(), CIccTagDateTime::Read(), CIccTagColorantOrder::Read(), CIccTagColorantTable::Read(), CIccTagViewingConditions::Read(), CIccTagProfileSeqDesc::Read(), CIccTagResponseCurveSet16::Read(), CIccTagSpectralDataInfo::Read(), CIccTagSpectralViewingConditions::Read(), CIccTagEmbeddedHeightImage::Read(), CIccTagEmbeddedNormalImage::Read(), CIccTagStruct::Read(), Read(), CIccTagDict::Read(), CIccTagCurve::Read(), CIccTagParametricCurve::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagGamutBoundaryDesc::Read(), CIccTagMultiProcessElement::Read(), CIccTagProfileSequenceId::Read(), CIccTagEmbeddedProfile::Read(), CIccTag::Validate(), CIccTagText::Write(), CIccTagUtf8Text::Write(), CIccTagZipUtf8Text::Write(), CIccTagUtf16Text::Write(), CIccTagTextDescription::Write(), CIccTagSignature::Write(), CIccTagNamedColor2::Write(), CIccTagXYZ::Write(), CIccTagChromaticity::Write(), CIccTagCicp::Write(), CIccTagSparseMatrixArray::Write(), CIccTagFixedNum< T, Tsig >::Write(), CIccTagNum< T, Tsig >::Write(), CIccTagFloatNum< T, Tsig >::Write(), CIccTagMeasurement::Write(), CIccTagMultiLocalizedUnicode::Write(), CIccTagData::Write(), CIccTagDateTime::Write(), CIccTagColorantOrder::Write(), CIccTagColorantTable::Write(), CIccTagViewingConditions::Write(), CIccTagProfileSeqDesc::Write(), CIccTagResponseCurveSet16::Write(), CIccTagSpectralDataInfo::Write(), CIccTagSpectralViewingConditions::Write(), CIccTagEmbeddedHeightImage::Write(), CIccTagEmbeddedNormalImage::Write(), CIccTagStruct::Write(), Write(), CIccTagDict::Write(), CIccTagEmbeddedProfile::Write(), CIccTagCurve::Write(), CIccTagParametricCurve::Write(), CIccTagLutAtoB::Write(), CIccTagLut8::Write(), CIccTagLut16::Write(), CIccTagGamutBoundaryDesc::Write(), CIccTagMultiProcessElement::Write(), and CIccTagProfileSequenceId::Write().

◆ m_nSize

◆ m_pArray

◆ m_sigArrayType

◆ m_TagVals


The documentation for this class was generated from the following files: