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

#include <IccTagComposite.h>

+ Inheritance diagram for CIccTagStruct:
+ Collaboration diagram for CIccTagStruct:

Public Member Functions

 CIccTagStruct ()
 
 CIccTagStruct (const CIccTagStruct &lut)
 
virtual ~CIccTagStruct ()
 
bool AreElemsUnique () const
 
bool AttachElem (icSignature sig, CIccTag *pTag)
 
bool DeleteElem (icSignature sig)
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
CIccTagFindElem (icSignature sig)
 
CIccTagFindElemOfType (icSignature sig, icTagTypeSignature sigType)
 
virtual const icCharGetClassName () const
 
TagEntryList * GetElemList ()
 
icFloatNumber GetElemNumberValue (icSignature sig, icFloatNumber defaultValue=0)
 
virtual IIccExtensionTagGetExtension ()
 
IIccStructGetStructHandler ()
 
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
 
CIccTagStructoperator= (const CIccTagStruct &lut)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
virtual bool SetTagStructType (icStructSignature 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 std::string GetElemName (icTagSignature sig, icStructSignature sigThis)
 
static CIccTagStructParseMem (icUInt8Number *pMem, icUInt32Number size)
 

Data Fields

icUInt32Number m_nReserved
 

Protected Member Functions

void Cleanup ()
 
bool DetachElem (CIccTag *pTag)
 
IccTagEntry * GetElem (CIccTag *pTag) const
 
IccTagEntry * GetElem (icSignature sig) const
 
bool LoadElem (IccTagEntry *pTagEntry, CIccIO *pIO)
 

Protected Attributes

TagEntryList * m_ElemEntries
 
TagPtrList * m_ElemVals
 
IIccStructm_pStruct
 
icStructSignature m_sigStructType
 
icUInt32Number m_tagSize
 
icUInt32Number m_tagStart
 

Detailed Description

Class: CIccTagStruct

Purpose: The general purpose Tag Struct type tag

Constructor & Destructor Documentation

◆ CIccTagStruct() [1/2]

CIccTagStruct::CIccTagStruct ( )

Name: CIccTagStruct::CIccTagStruct

Purpose:

Args:

Return:

130{
131 m_ElemEntries = new(TagEntryList);
132 m_ElemVals = new(TagPtrList);
133 m_pStruct = NULL;
134}
TagEntryList * m_ElemEntries
Definition IccTagComposite.h:212
TagPtrList * m_ElemVals
Definition IccTagComposite.h:214
IIccStruct * m_pStruct
Definition IccTagComposite.h:198

References m_ElemEntries, m_ElemVals, and m_pStruct.

◆ CIccTagStruct() [2/2]

CIccTagStruct::CIccTagStruct ( const CIccTagStruct subTags)

Name: CIccTagStruct::CIccTagStruct

Purpose:

Args:

Return:

147{
149 m_ElemEntries = new(TagEntryList);
150 m_ElemVals = new(TagPtrList);
151
152 if (!subTags.m_ElemEntries->empty()) {
153 TagEntryList::const_iterator i;
154 IccTagEntry entry;
155 for (i=subTags.m_ElemEntries->begin(); i!=subTags.m_ElemEntries->end(); i++) {
156 entry.pTag = i->pTag->NewCopy();
157 memcpy(&entry.TagInfo, &i->TagInfo, sizeof(icTag));
158 m_ElemEntries->push_back(entry);
159 }
160 }
161
162 if (!subTags.m_ElemVals->empty()) {
163 TagPtrList::const_iterator i;
164 IccTagPtr tagptr;
165 for (i=subTags.m_ElemVals->begin(); i!=subTags.m_ElemVals->end(); i++) {
166 tagptr.ptr = i->ptr->NewCopy();
167 m_ElemVals->push_back(tagptr);
168 }
169 }
170
171 if (subTags.m_pStruct) {
172 m_pStruct = subTags.m_pStruct->NewCopy(this);
173 }
174 else {
175 m_pStruct = NULL;
176 }
177}
Definition icProfileHeader.h:2021
virtual IIccStruct * NewCopy(CIccTagStruct *pNewTagStruct) const =0
icStructSignature m_sigStructType
Definition IccTagComposite.h:207

References m_ElemEntries, m_ElemVals, m_pStruct, m_sigStructType, CIccTag::NewCopy(), and IIccStruct::NewCopy().

Referenced by NewCopy().

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

◆ ~CIccTagStruct()

CIccTagStruct::~CIccTagStruct ( )
virtual

Name: CIccTagStruct::~CIccTagStruct

Purpose:

Args:

Return:

238{
239 Cleanup();
240
241 delete m_ElemEntries;
242 delete m_ElemVals;
243
244 if (m_pStruct)
245 delete m_pStruct;
246}
void Cleanup()
Definition IccTagComposite.cpp:559

References Cleanup(), m_ElemEntries, m_ElemVals, and m_pStruct.

+ Here is the call graph for this function:

Member Function Documentation

◆ AreElemsUnique()

bool CIccTagStruct::AreElemsUnique ( ) const

Name: CIccTagStruct::AreElemsUnique

Purpose: For each tag it checks to see if any other tags have the same signature.

Return: true if all tags have unique signatures, or false if there are duplicate tag signatures.

616{
617 TagEntryList::const_iterator i, j;
618
619 for (i=m_ElemEntries->begin(); i!=m_ElemEntries->end(); i++) {
620 j=i;
621 for (j++; j!= m_ElemEntries->end(); j++) {
622 if (i->TagInfo.sig == j->TagInfo.sig)
623 return false;
624 }
625 }
626
627 return true;
628}

References m_ElemEntries, and icTag::sig.

Referenced by Validate().

+ Here is the caller graph for this function:

◆ AttachElem()

bool CIccTagStruct::AttachElem ( icSignature  sig,
CIccTag pTag 
)

Name: CIccTagStruct::AttachTag

Purpose: Assign a tag object to a directory entry in the profile. This will assume ownership of the tag object.

Args: sig - signature of tag 'name' to use to assign tag object with, pTag - pointer to tag object to attach to profile.

Return: true = tag assigned to profile, false - tag not assigned to profile (tag already exists).

758{
759 IccTagEntry *pEntry = GetElem(sig);
760
761 if (pEntry) {
762 if (pEntry->pTag == pTag)
763 return true;
764
765 return false;
766 }
767
768 IccTagEntry Entry;
769 Entry.TagInfo.sig = (icTagSignature)sig;
770 Entry.TagInfo.offset = 0;
771 Entry.TagInfo.size = 0;
772 Entry.pTag = pTag;
773
774 m_ElemEntries->push_back(Entry);
775
776 TagPtrList::iterator i;
777
778 for (i=m_ElemVals->begin(); i!=m_ElemVals->end(); i++)
779 if (i->ptr == pTag)
780 break;
781
782 if (i==m_ElemVals->end()) {
783 IccTagPtr TagPtr;
784 TagPtr.ptr = pTag;
785 m_ElemVals->push_back(TagPtr);
786 }
787
788 return true;
789}
icTagSignature
Definition icProfileHeader.h:341
IccTagEntry * GetElem(icSignature sig) const
Definition IccTagComposite.cpp:589

References GetElem(), m_ElemEntries, m_ElemVals, icTag::offset, icTag::sig, and icTag::size.

Referenced by icConvertEncodingProfile(), and CIccTagXmlStruct::ParseTag().

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

◆ Cleanup()

void CIccTagStruct::Cleanup ( )
protected

Name: CIccTagStruct::Cleanup

Purpose: Detach from a pending IO object

560{
561 TagPtrList::iterator i;
562
563 for (i=m_ElemVals->begin(); i!=m_ElemVals->end(); i++) {
564 if (i->ptr)
565 delete i->ptr;
566 }
567 m_ElemEntries->clear();
568 m_ElemVals->clear();
569
570 if (m_pStruct)
571 delete m_pStruct;
572 m_pStruct = NULL;
574}
@ icSigUndefinedStruct
Definition icProfileHeader.h:606

References icSigUndefinedStruct, m_ElemEntries, m_ElemVals, m_pStruct, and m_sigStructType.

Referenced by ~CIccTagStruct(), 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(), 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:

◆ DeleteElem()

bool CIccTagStruct::DeleteElem ( icSignature  sig)

Name: CIccTagStruct::DeleteSubTag

Purpose: Delete tag directory entry with given signature. If no other tag directory entries use the tag object, the tag object will also be deleted.

Args: sig - signature of tag directory entry to remove

Return: true - desired tag directory entry was found and deleted, false - desired tag directory entry was not found

808{
809 TagEntryList::iterator i;
810
811 for (i=m_ElemEntries->begin(); i!=m_ElemEntries->end(); i++) {
812 if (i->TagInfo.sig==sig)
813 break;
814 }
815 if (i!=m_ElemEntries->end()) {
816 CIccTag *pTag = i->pTag;
817 m_ElemEntries->erase(i);
818
819 if (!GetElem(pTag)) {
820 DetachElem(pTag);
821 delete pTag;
822 }
823 return true;
824 }
825
826 return false;
827}
bool DetachElem(CIccTag *pTag)
Definition IccTagComposite.cpp:932
Definition IccTagBasic.h:108

References DetachElem(), GetElem(), m_ElemEntries, and icTag::sig.

Referenced by icConvertEncodingProfile().

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

◆ Describe()

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

Name: CIccTagStruct::Describe

Purpose:

Args:

Return:

Reimplemented from CIccTag.

309{
310 std::string name;
312
313 sDescription += "BEGIN STRUCT \"";
314 sDescription += name + "\"\n";
315
316 if (m_pStruct) {
317 m_pStruct->Describe(sDescription, nVerboseness);
318 }
319 else {
321 if (pStruct) {
322 pStruct->Describe(sDescription, nVerboseness);
323 delete pStruct;
324 }
325 else {
326 CIccStructUnknown structHandler(this);
327
328 structHandler.Describe(sDescription, nVerboseness);
329 }
330 }
331 sDescription += "END STRUCT \"";
332 sDescription += name + "\"\n";
333}
Definition IccStructBasic.h:96
Definition IccTagComposite.h:97
virtual void Describe(std::string &sDescription, int nVerboseness) const
Definition IccTagComposite.cpp:86
static bool GetStructSigName(std::string &structName, icStructSignature structTypeSig, bool bFillUnknown=true)
Definition IccStructFactory.h:253
static IIccStruct * CreateStruct(icStructSignature structTypeSig, CIccTagStruct *pTagStruct)
Definition IccStructFactory.h:236

References CIccStructUnknown::CIccStructUnknown(), CIccStructCreator::CreateStruct(), CIccStructUnknown::Describe(), IIccStruct::Describe(), CIccStructCreator::GetStructSigName(), m_pStruct, and m_sigStructType.

+ Here is the call graph for this function:

◆ DetachElem()

bool CIccTagStruct::DetachElem ( CIccTag pTag)
protected

Name: CIccTagStruct::DetachSubTag

Purpose: Remove association of a tag object from all tag directory entries. Associated tag directory entries will be removed from the tag directory. The tag object is NOT deleted from memory, but is considered to be no longer associated with the CIccTagStruct object. The caller assumes ownership of the tag object.

Args: pTag - pointer to tag object unassociated with the profile object

Return: true - tag object found and unassociated with profile object, false - tag object not found

933{
934 if (!pTag)
935 return false;
936
937 TagPtrList::iterator i;
938
939 for (i=m_ElemVals->begin(); i!=m_ElemVals->end(); i++) {
940 if (i->ptr == pTag)
941 break;
942 }
943
944 if (i==m_ElemVals->end())
945 return false;
946
947 m_ElemVals->erase(i);
948
949 TagEntryList::iterator j;
950 for (j=m_ElemEntries->begin(); j!=m_ElemEntries->end();) {
951 if (j->pTag == pTag) {
952 j=m_ElemEntries->erase(j);
953 }
954 else
955 j++;
956 }
957 return true;
958}

References m_ElemEntries, and m_ElemVals.

Referenced by DeleteElem().

+ Here is the caller 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{}

◆ FindElem()

CIccTag * CIccTagStruct::FindElem ( icSignature  sig)

Name: CIccTagStruct::FindElem

Purpose: Finds the tag object associated with the struct entry with the given signature.

Args: sig - element signature to find

Return: The desired tag object, or NULL if unable to find in the struct

673{
674 IccTagEntry *pEntry = GetElem(sig);
675
676 if (pEntry) {
677 return pEntry->pTag;
678 }
679
680 return NULL;
681}

References GetElem().

Referenced by CIccStructUnknown::GetElem(), GetElemNumberValue(), CIccStructNamedColor::getName(), CIccTagXmlStruct::ParseTag(), CIccTagXmlStruct::ToXml(), CIccStructNamedColor::Validate(), CIccStructBRDF::Validate(), and CIccStructColorantInfo::Validate().

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

◆ FindElemOfType()

CIccTag * CIccTagStruct::FindElemOfType ( icSignature  sig,
icTagTypeSignature  sigType 
)

Name: CIccTagStruct::FindElemOfType

Purpose: Finds the tag object associated with the struct entry with the given signature that has a specific tag type.

Args: sig - element signature to find sigType - signature of desired tag type

Return: The desired tag object, or NULL if unable to find in the struct

699{
700 IccTagEntry *pEntry = GetElem(sig);
701
702 if (pEntry && pEntry->pTag && pEntry->pTag->GetType()==sigType) {
703 return pEntry->pTag;
704 }
705
706 return NULL;
707}

References GetElem(), and CIccTag::GetType().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), and icGetParamFloatNum().

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

◆ GetClassName()

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

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlStruct.

172{ return "CIccTagStruct"; }

◆ GetElem() [1/2]

IccTagEntry * CIccTagStruct::GetElem ( CIccTag pTag) const
protected

Name: CIccTagStruct::GetElem

Purpose: Finds the first tag entry that points to the indicated tag object

Args: pTag - pointer to tag object desired to be found

Return: pointer to first tag struct entry that points to the desired tag object, or NULL if tag object is not pointed to by any tag struct entries.

646{
647 TagEntryList::const_iterator i;
648
649 for (i=m_ElemEntries->begin(); i!=m_ElemEntries->end(); i++) {
650 if (i->pTag==pTag)
651 return (IccTagEntry*)&(i->TagInfo);
652 }
653
654 return NULL;
655}

References m_ElemEntries.

Referenced by DeleteElem().

+ Here is the caller graph for this function:

◆ GetElem() [2/2]

IccTagEntry * CIccTagStruct::GetElem ( icSignature  sig) const
protected

Name: CIccTagStruct::GetElem

Purpose: Get a tag entry with a given signature

Args: sig - signature id to find in tag structure

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

590{
591 TagEntryList::const_iterator i;
592
593 for (i=m_ElemEntries->begin(); i!=m_ElemEntries->end(); i++) {
594 if (i->TagInfo.sig==sig)
595 return (IccTagEntry*)&(i->TagInfo);
596 }
597
598 return NULL;
599}

References m_ElemEntries, and icTag::sig.

Referenced by AttachElem(), FindElem(), and FindElemOfType().

+ Here is the caller graph for this function:

◆ GetElemList()

TagEntryList * CIccTagStruct::GetElemList ( )
inline
181{ return m_ElemEntries; }

References m_ElemEntries.

Referenced by CIccStructUnknown::Describe(), IIccStruct::Describe(), and icConvertEncodingProfile().

+ Here is the caller graph for this function:

◆ GetElemName()

static std::string CIccTagStruct::GetElemName ( icTagSignature  sig,
icStructSignature  sigThis 
)
static

◆ GetElemNumberValue()

icFloatNumber CIccTagStruct::GetElemNumberValue ( icSignature  sig,
icFloatNumber  defaultValue = 0 
)

Name: CIccTagStruct::GetElemNumberValue

Purpose: Returns the number value associated with the first entry of a CIccTagNumberArray based tag with the given signature.

Args: sig - subtag signature to find defaultValue - value to use if the tag cannot be found, or is not a number tag

Return: The tags value or defaultValue if unable to find subtag in the struct or if the subtag is not a CIccTagNumberArray based tag.

727{
728 CIccTag *pTag = FindElem(sig);
729
730 if (!pTag || !pTag->IsNumArrayType())
731 return defaultValue;
732
733 CIccTagNumArray *pNumArray = (CIccTagNumArray*)pTag;
734 icFloatNumber rv = defaultValue;
735
736 pNumArray->GetValues(&rv, 0, 1);
737
738 return rv;
739}
float icFloatNumber
Definition IccDefs.h:101
CIccTag * FindElem(icSignature sig)
Definition IccTagComposite.cpp:672
virtual bool IsNumArrayType() const
Definition IccTagBasic.h:137
Definition IccTagBasic.h:791
virtual bool GetValues(icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const =0

References FindElem(), CIccTagNumArray::GetValues(), and CIccTag::IsNumArrayType().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

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

◆ 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:

◆ GetStructHandler()

IIccStruct * CIccTagStruct::GetStructHandler ( )

Name: CIccTagStruct::GetStructHandler

Purpose: Get struct object handler

Args:

Return: Pointer to a IIccStruct object handler for the associated struct type

974{
975 if (!m_pStruct) {
976
978 }
979 return m_pStruct;
980}

References CIccStructCreator::CreateStruct(), m_pStruct, and m_sigStructType.

Referenced by icGetTagStructHandler(), CIccTagXmlStruct::ToXml(), and CIccArrayNamedColor::Validate().

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

◆ GetTagArrayType()

virtual icArraySignature CIccTag::GetTagArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagArray.

133{ return icSigUndefinedArray; }
@ icSigUndefinedArray
Definition icProfileHeader.h:617

References icSigUndefinedArray.

Referenced by icGetTagArrayHandlerOfType(), and CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ GetTagStructType()

virtual icStructSignature CIccTagStruct::GetTagStructType ( ) const
inlinevirtual

Reimplemented from CIccTag.

168{ return m_sigStructType; }

References m_sigStructType.

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), IIccStruct::Describe(), and CIccStructNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetType()

virtual icTagTypeSignature CIccTagStruct::GetType ( ) const
inlinevirtual

Function: GetType()

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

Reimplemented from CIccTag.

167{ return icSigTagStructType; }
@ icSigTagStructType
Definition icProfileHeader.h:564

References icSigTagStructType.

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(), 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; }

◆ LoadElem()

bool CIccTagStruct::LoadElem ( IccTagEntry *  pTagEntry,
CIccIO pIO 
)
protected

Name: CIccTagStruct::LoadSubTag

Purpose: This will load from the indicated IO object and associate a tag object to a tag directory entry. Nothing happens if tag directory entry is associated with a tag object.

Args: pTagEntry - pointer to tag directory entry, pIO - pointer to IO object to read tag object data from

Return: true - tag directory object associated with tag directory entry, false - failure

848{
849 if (!pTagEntry)
850 return false;
851
852 if (pTagEntry->pTag)
853 return true;
854
855 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
856 sizeof(icUInt32Number) +
857 sizeof(icUInt32Number);
858
859 if (pTagEntry->TagInfo.offset<headerSize ||
860 !pTagEntry->TagInfo.size ||
861 pTagEntry->TagInfo.offset+pTagEntry->TagInfo.size > m_tagSize) {
862 return false;
863 }
864
865 icTagTypeSignature sigType;
866
867 icUInt32Number offset = pTagEntry->TagInfo.offset + m_tagStart;
868
869 //First we need to get the tag type to create the right kind of tag
870 if (pIO->Seek(offset, icSeekSet)!=offset)
871 return false;
872
873 if (!pIO->Read32(&sigType))
874 return false;
875
876 CIccTag *pTag = CIccTag::Create(sigType);
877
878 if (!pTag)
879 return false;
880
881 //Now seek back to where the tag starts so the created tag object can read
882 //in its data.
883 //First we need to get the tag type to create the right kind of tag
884 if (pIO->Seek(offset, icSeekSet)!=offset) {
885 delete pTag;
886 return false;
887 }
888
889 if (!pTag->Read(pTagEntry->TagInfo.size, pIO)) {
890 delete pTag;
891 return false;
892 }
893
894 pTagEntry->pTag = pTag;
895
896 IccTagPtr TagPtr;
897
898 TagPtr.ptr = pTag;
899
900 m_ElemVals->push_back(TagPtr);
901
902 TagEntryList::iterator i;
903
904 for (i=m_ElemEntries->begin(); i!= m_ElemEntries->end(); i++) {
905 if (i->TagInfo.offset == pTagEntry->TagInfo.offset &&
906 i->pTag != pTag)
907 i->pTag = pTag;
908 }
909
910 return true;
911}
unsigned long icUInt32Number
Definition icProfileHeader.h:262
icTagTypeSignature
Definition icProfileHeader.h:526
@ icSeekSet
Definition IccIO.h:83
icUInt32Number m_tagSize
Definition IccTagComposite.h:210
icUInt32Number m_tagStart
Definition IccTagComposite.h:209
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
Definition IccIO.h:132
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
static CIccTag * Create(icTagTypeSignature sig)
Definition IccTagBasic.cpp:143
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.h:167

References CIccTag::Create(), icSeekSet, m_ElemEntries, m_ElemVals, m_tagSize, m_tagStart, icTag::offset, CIccTag::Read(), CIccIO::Read32(), CIccIO::Seek(), and icTag::size.

Referenced by Read().

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

◆ NewCopy()

virtual CIccTag * CIccTagStruct::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.

162{ return new CIccTagStruct(*this);}
CIccTagStruct()
Definition IccTagComposite.cpp:129

References CIccTagStruct().

+ Here is the call graph for this function:

◆ operator=()

CIccTagStruct & CIccTagStruct::operator= ( const CIccTagStruct subTags)

Name: &operator=

Purpose:

Args:

Return:

190{
191 if (&subTags == this)
192 return *this;
193
194 Cleanup();
195
197
198 if (!subTags.m_ElemEntries->empty()) {
199 m_ElemEntries->clear();
200 TagEntryList::const_iterator i;
201 IccTagEntry entry;
202 for (i=subTags.m_ElemEntries->begin(); i!=subTags.m_ElemEntries->end(); i++) {
203 entry.pTag = i->pTag->NewCopy();
204 memcpy(&entry.TagInfo, &i->TagInfo, sizeof(icTag));
205 m_ElemEntries->push_back(entry);
206 }
207 }
208
209 if (!subTags.m_ElemVals->empty()) {
210 m_ElemVals->clear();
211 TagPtrList::const_iterator i;
212 IccTagPtr tagptr;
213 for (i=subTags.m_ElemVals->begin(); i!=subTags.m_ElemVals->end(); i++) {
214 tagptr.ptr = i->ptr->NewCopy();
215 m_ElemVals->push_back(tagptr);
216 }
217 }
218
219 if (subTags.m_pStruct)
220 m_pStruct = subTags.m_pStruct->NewCopy(this);
221 else
222 m_pStruct = NULL;
223
224 return *this;
225}

References Cleanup(), m_ElemEntries, m_ElemVals, m_pStruct, m_sigStructType, CIccTag::NewCopy(), and IIccStruct::NewCopy().

+ Here is the call graph for this function:

◆ ParseMem()

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

Name: CIccTagStruct::ParseMem

Purpose:

Args:

Return:

281{
282 CIccMemIO IO;
283
284 if (!IO.Attach(pMem, size))
285 return NULL;
286
287 CIccTagStruct *pTags = new CIccTagStruct;
288
289 if (!pTags->Read(size, &IO)) {
290 delete pTags;
291 return NULL;
292 }
293
294 return pTags;
295}
Definition IccTagComposite.h:156
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagComposite.cpp:346
Definition IccIO.h:217
bool Attach(icUInt8Number *pData, icUInt32Number nSize, bool bWrite=false)
Definition IccIO.cpp:686

References CIccMemIO::Attach(), and Read().

+ Here is the call graph for this function:

◆ Read() [1/2]

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

Name: CIccTagStruct::Read

Purpose:

Args:

Return:

Reimplemented from CIccTag.

347{
349
350 m_tagSize = size;
351
352 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
353 sizeof(icUInt32Number) +
354 sizeof(icStructSignature) +
355 sizeof(icUInt32Number);
356
357 if (headerSize > size)
358 return false;
359
360 if (!pIO) {
361 return false;
362 }
363
364 Cleanup();
365
366 m_tagStart = pIO->Tell();
367
368 if (!pIO->Read32(&sig))
369 return false;
370
371 if (!pIO->Read32(&m_nReserved))
372 return false;
373
374 icStructSignature sigStructType;
375
376 if (!pIO->Read32(&sigStructType))
377 return false;
378
379 SetTagStructType(sigStructType);
380
381 icUInt32Number count, i;
382 IccTagEntry TagEntry;
383
384 TagEntry.pTag = NULL;
385
386 if (!pIO->Read32(&count))
387 return false;
388
389 if (headerSize + (icUInt64Number)count*sizeof(icUInt32Number)*3 > size)
390 return false;
391
392 //Read TagDir
393 for (i=0; i<count; i++) {
394 if (!pIO->Read32(&TagEntry.TagInfo.sig) ||
395 !pIO->Read32(&TagEntry.TagInfo.offset) ||
396 !pIO->Read32(&TagEntry.TagInfo.size)) {
397 return false;
398 }
399 m_ElemEntries->push_back(TagEntry);
400 }
401
402 TagEntryList::iterator entry;
403
404 for (entry=m_ElemEntries->begin(); entry!=m_ElemEntries->end(); entry++) {
405 if (!LoadElem((IccTagEntry*)&(entry->TagInfo), pIO)) {
406 Cleanup();
407 return false;
408 }
409 }
410
411
412 return true;
413}
icStructSignature
Definition icProfileHeader.h:598
icUInt32Number icUInt64Number[2]
Definition icProfileHeader.h:268
virtual bool SetTagStructType(icStructSignature sig)
Definition IccTagComposite.cpp:259
bool LoadElem(IccTagEntry *pTagEntry, CIccIO *pIO)
Definition IccTagComposite.cpp:847
virtual icInt32Number Tell()
Definition IccIO.h:133
icUInt32Number m_nReserved
Definition IccTagBasic.h:235

References Cleanup(), LoadElem(), m_ElemEntries, CIccTag::m_nReserved, m_tagSize, m_tagStart, icTag::offset, CIccIO::Read32(), SetTagStructType(), icTag::sig, icTag::size, and CIccIO::Tell().

Referenced by ParseMem().

+ Here is the call graph for this function:
+ Here is the caller 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; }

◆ SetTagStructType()

bool CIccTagStruct::SetTagStructType ( icStructSignature  sig)
virtual

Name: CIccTagStruct::SetTagStructType

Purpose:

Args:

Return:

260{
261 if (m_pStruct)
262 delete m_pStruct;
263
264 m_sigStructType = sig;
266
267 return m_pStruct != NULL;
268}

References CIccStructCreator::CreateStruct(), m_pStruct, and m_sigStructType.

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

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

◆ Validate()

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

Name: CIccTagStruct::Validate

Purpose:

Args:

Return:

Reimplemented from CIccTag.

521{
522 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
523
524 CIccInfo Info;
525 std::string sSigPathName = Info.GetSigPathName(sigPath);
526
527 // Check for duplicate tags
528 if (!AreElemsUnique()) {
529 sReport += icMsgValidateWarning;
530 sReport += sSigPathName;
531 sReport += " - There are duplicate elements.\n";
533 }
534
535 if (m_pStruct) { //Should call GetStructHandler before validate to get
536 rv = icMaxStatus(rv, m_pStruct->Validate(sigPath, sReport, pProfile));
537 }
538 else {
539 sReport += "Unknown tag struct type - Validating struct sub-tags\n";
541
542 // Per Tag tests
543 TagEntryList::iterator i;
544 for (i = m_ElemEntries->begin(); i != m_ElemEntries->end(); i++) {
545 rv = icMaxStatus(rv, i->pTag->Validate(sigPath + icGetSigPath(i->TagInfo.sig), sReport, pProfile));
546 }
547 }
548
549 return rv;
550}
icValidateStatus
Definition IccDefs.h:119
@ icValidateWarning
Definition IccDefs.h:121
ICCPROFLIB_API std::string icGetSigPath(icUInt32Number sig)
Definition IccUtil.cpp:1191
ICCPROFLIB_API const char * icMsgValidateWarning
Definition IccUtil.cpp:90
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
Definition IccUtil.h:303
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
bool AreElemsUnique() const
Definition IccTagComposite.cpp:615
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Definition IccTagBasic.cpp:164

References AreElemsUnique(), CIccInfo::GetSigPathName(), icGetSigPath(), icMaxStatus(), icMsgValidateWarning, icValidateWarning, m_ElemEntries, m_pStruct, icTag::sig, CIccTag::Validate(), and IIccStruct::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagStruct::Write ( CIccIO pIO)
virtual

Name: CIccTagStruct::Write

Purpose:

Args:

Return:

Reimplemented from CIccTag.

426{
428
429 if (!pIO)
430 return false;
431
432 m_tagStart = pIO->Tell();
433
434 if (!pIO->Write32(&sig))
435 return false;
436
437 if (!pIO->Write32(&m_nReserved))
438 return false;
439
440 if (!pIO->Write32(&m_sigStructType))
441 return false;
442
443 TagEntryList::iterator i, j;
444 icUInt32Number count;
445
446 for (count=0, i=m_ElemEntries->begin(); i!= m_ElemEntries->end(); i++) {
447 if (i->pTag)
448 count++;
449 }
450
451 pIO->Write32(&count);
452
453 icUInt32Number dirpos = pIO->Tell();
454
455 //Write Unintialized TagDir
456 for (i=m_ElemEntries->begin(); i!= m_ElemEntries->end(); i++) {
457 if (i->pTag) {
458 i->TagInfo.offset = 0;
459 i->TagInfo.size = 0;
460
461 pIO->Write32(&i->TagInfo.sig);
462 pIO->Write32(&i->TagInfo.offset);
463 pIO->Write32(&i->TagInfo.size);
464 }
465 }
466
467 //Write Tags
468 for (i=m_ElemEntries->begin(); i!= m_ElemEntries->end(); i++) {
469 if (i->pTag) {
470 for (j=m_ElemEntries->begin(); j!=i; j++) {
471 if (i->pTag == j->pTag)
472 break;
473 }
474
475 if (i==j) {
476 i->TagInfo.offset = pIO->GetLength();
477 i->pTag->Write(pIO);
478 i->TagInfo.size = pIO->GetLength() - i->TagInfo.offset;
479 i->TagInfo.offset -= m_tagStart;
480
481 pIO->Align32();
482 }
483 else {
484 i->TagInfo.offset = j->TagInfo.offset;
485 i->TagInfo.size = j->TagInfo.size;
486 }
487 }
488 }
489 icUInt32Number epos = pIO->Tell();
490
491 pIO->Seek(dirpos, icSeekSet);
492
493 //Write TagDir with offsets and sizes
494 for (i=m_ElemEntries->begin(); i!= m_ElemEntries->end(); i++) {
495 if (i->pTag) {
496 pIO->Write32(&i->TagInfo.sig);
497 pIO->Write32(&i->TagInfo.offset);
498 pIO->Write32(&i->TagInfo.size);
499 }
500 }
501
502 pIO->Seek(epos, icSeekSet);
503
504
505 return true;
506}
virtual icTagTypeSignature GetType() const
Definition IccTagComposite.h:167
virtual icInt32Number GetLength()
Definition IccIO.h:130
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(), CIccIO::GetLength(), GetType(), icSeekSet, m_ElemEntries, CIccTag::m_nReserved, m_sigStructType, m_tagStart, icTag::offset, CIccIO::Seek(), icTag::sig, icTag::size, CIccIO::Tell(), CIccTag::Write(), and CIccIO::Write32().

+ Here is the call graph for this function:

Field Documentation

◆ m_ElemEntries

◆ m_ElemVals

TagPtrList* CIccTagStruct::m_ElemVals
protected

◆ 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(), Read(), CIccTagArray::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(), Write(), CIccTagArray::Write(), CIccTagDict::Write(), CIccTagEmbeddedProfile::Write(), CIccTagCurve::Write(), CIccTagParametricCurve::Write(), CIccTagLutAtoB::Write(), CIccTagLut8::Write(), CIccTagLut16::Write(), CIccTagGamutBoundaryDesc::Write(), CIccTagMultiProcessElement::Write(), and CIccTagProfileSequenceId::Write().

◆ m_pStruct

◆ m_sigStructType

◆ m_tagSize

icUInt32Number CIccTagStruct::m_tagSize
protected

Referenced by LoadElem(), and Read().

◆ m_tagStart

icUInt32Number CIccTagStruct::m_tagStart
protected

Referenced by LoadElem(), Read(), and Write().


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