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

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlStruct:
+ Collaboration diagram for CIccTagXmlStruct:

Public Member Functions

virtual ~CIccTagXmlStruct ()
 
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 char * GetClassName () const
 
TagEntryList * GetElemList ()
 
icFloatNumber GetElemNumberValue (icSignature sig, icFloatNumber defaultValue=0)
 
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
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
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
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 bool ToXml (std::string &xml, std::string blanks="")
 
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)
 
bool ParseTag (xmlNode *pNode, std::string &parseStr)
 

Protected Attributes

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

Detailed Description

Constructor & Destructor Documentation

◆ ~CIccTagXmlStruct()

virtual CIccTagXmlStruct::~CIccTagXmlStruct ( )
inlinevirtual
644{}

Member Function Documentation

◆ AreElemsUnique()

bool CIccTagStruct::AreElemsUnique ( ) const
inherited

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}
TagEntryList * m_ElemEntries
Definition IccTagComposite.h:212

References CIccTagStruct::m_ElemEntries, and icTag::sig.

Referenced by CIccTagStruct::Validate().

+ Here is the caller graph for this function:

◆ AttachElem()

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

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
TagPtrList * m_ElemVals
Definition IccTagComposite.h:214
IccTagEntry * GetElem(icSignature sig) const
Definition IccTagComposite.cpp:589

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

Referenced by icConvertEncodingProfile(), and ParseTag().

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

◆ Cleanup()

void CIccTagStruct::Cleanup ( )
protectedinherited

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
icStructSignature m_sigStructType
Definition IccTagComposite.h:207
IIccStruct * m_pStruct
Definition IccTagComposite.h:198

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

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

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 CIccTagStruct::DetachElem(), CIccTagStruct::GetElem(), CIccTagStruct::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 
)
virtualinherited

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(), CIccTagStruct::m_pStruct, and CIccTagStruct::m_sigStructType.

+ Here is the call graph for this function:

◆ DetachElem()

bool CIccTagStruct::DetachElem ( CIccTag pTag)
protectedinherited

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 CIccTagStruct::m_ElemEntries, and CIccTagStruct::m_ElemVals.

Referenced by CIccTagStruct::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)
inherited

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 CIccTagStruct::GetElem().

Referenced by CIccStructUnknown::GetElem(), CIccTagStruct::GetElemNumberValue(), CIccStructNamedColor::getName(), ParseTag(), 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 
)
inherited

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 CIccTagStruct::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 char * CIccTagXmlStruct::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTagStruct.

646{return "CIccTagXmlStruct"; }

◆ GetElem() [1/2]

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

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 CIccTagStruct::m_ElemEntries.

Referenced by CIccTagStruct::DeleteElem().

+ Here is the caller graph for this function:

◆ GetElem() [2/2]

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

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 CIccTagStruct::m_ElemEntries, and icTag::sig.

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

+ Here is the caller graph for this function:

◆ GetElemList()

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

References CIccTagStruct::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 
)
staticinherited

◆ GetElemNumberValue()

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

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

◆ GetExtClassName()

virtual const char * CIccTagXml::GetExtClassName ( ) const
inlinevirtualinherited

Implements IIccExtensionTag.

79{ return "CIccTagXml"; }

Referenced by icProfDescToXml(), and icXmlParseProfDesc().

+ Here is the caller graph for this function:

◆ GetExtDerivedClassName()

virtual const char * CIccTagXml::GetExtDerivedClassName ( ) const
inlinevirtualinherited

Implements IIccExtensionTag.

Reimplemented in CIccCurveXml.

80{ return ""; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTagXmlStruct::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

648{return this; }

◆ GetStructHandler()

IIccStruct * CIccTagStruct::GetStructHandler ( )
inherited

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(), CIccTagStruct::m_pStruct, and CIccTagStruct::m_sigStructType.

Referenced by icGetTagStructHandler(), 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
inlinevirtualinherited

Reimplemented from CIccTag.

168{ return m_sigStructType; }

References CIccTagStruct::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
inlinevirtualinherited

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 CIccTagStruct::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; }

◆ LoadElem()

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

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, CIccTagStruct::m_ElemEntries, CIccTagStruct::m_ElemVals, CIccTagStruct::m_tagSize, CIccTagStruct::m_tagStart, icTag::offset, CIccTag::Read(), CIccIO::Read32(), CIccIO::Seek(), and icTag::size.

Referenced by CIccTagStruct::Read().

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

◆ NewCopy()

virtual CIccTag * CIccTagStruct::NewCopy ( ) const
inlinevirtualinherited

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::CIccTagStruct().

+ Here is the call graph for this function:

◆ ParseMem()

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

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 CIccTagStruct::Read().

+ Here is the call graph for this function:

◆ ParseTag()

bool CIccTagXmlStruct::ParseTag ( xmlNode *  pNode,
std::string &  parseStr 
)
protected

Name: CIccTagXmlStruct::ParseTag

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: pNode - pointer to xmlNode object to parse from

Return: true - tag from node successfully parsed, false - failure

4497{
4498 xmlAttr *attr;
4499
4500 if (pNode->type != XML_ELEMENT_NODE) {// || icXmlStrCmp(pNode->name, "Tag")) {
4501 parseStr += "Invalid Tag Node: ";
4502 parseStr += (const char *)pNode->name;
4503 parseStr += "\n";
4504 return false;
4505 }
4506
4507 CIccTag *pTag = NULL;
4508
4509 std::string nodeName = (icChar*)pNode->name;
4510 icSignature sigTag;
4511 if (m_pStruct)
4512 sigTag = m_pStruct->GetElemSig(nodeName.c_str());
4513 else
4514 sigTag = 0;
4515
4516 if (sigTag != 0 || nodeName == "PrivateSubTag") { //Parsing of XML tags by name
4517 if (nodeName == "PrivateSubTag") {
4518 const char *tagSig = icXmlAttrValue(pNode, "TagSignature", "");
4519 if (tagSig[0]) {
4520 sigTag = (icTagSignature)icGetSigVal(tagSig);
4521 }
4522 else {
4523 parseStr += "Invalid TagSignature for PrivateSubTag\n";
4524 return false;
4525 }
4526 }
4527
4528 const char *sameAs = icXmlAttrValue(pNode, "SameAs", "");
4529
4530 if (sameAs[0]) {
4531 icTagSignature sigParentTag = icGetTagNameSig(sameAs);
4532 if (!strcmp(sameAs, "PrivateSubTag") || sigParentTag == icSigUnknownTag) {
4533 const char *sameAsSig = icXmlAttrValue(pNode, "SameAsSignature", "");
4534 if (sameAsSig[0]) {
4535 sigParentTag = (icTagSignature)icGetSigVal(sameAsSig);
4536 }
4537 else {
4538 parseStr += "Invalid SameAsSignature for PrivateSubTag\n";
4539 return false;
4540 }
4541 }
4542 pTag = this->FindElem(sigParentTag);
4543 if (pTag) {
4544 AttachElem(sigTag, pTag);
4545 }
4546 else {
4547 parseStr += "SameAs tag ";
4548 parseStr += sameAs;
4549 parseStr += " for ";
4550 parseStr += nodeName + " does not exist\n";
4551 return false;
4552 }
4553
4554 return true;
4555 }
4556 else { //Parse the type node as the first child
4557 xmlNode *pTypeNode;
4558 for (pTypeNode = pNode->children; pTypeNode; pTypeNode = pTypeNode->next) {
4559 if (pTypeNode->type == XML_ELEMENT_NODE) {
4560 break;
4561 }
4562 }
4563
4564 if (!pTypeNode) {
4565 parseStr += "No tag type node defined for ";
4566 parseStr += nodeName;
4567 parseStr += "\n";
4568 return false;
4569 }
4570
4571 // get the tag type signature
4572 icTagTypeSignature sigType = icGetTypeNameTagSig((const icChar*)pTypeNode->name);
4573
4574 if (sigType == icSigUnknownType) {
4575 xmlAttr *attr = icXmlFindAttr(pTypeNode, "type");
4577 }
4578
4579 CIccInfo info;
4580
4581 // create a tag based on the signature
4582 pTag = CIccTag::Create(sigType);
4583
4584 IIccExtensionTag *pExt;
4585
4586 if (pTag && (pExt = pTag->GetExtension()) && !strcmp(pExt->GetExtClassName(), "CIccTagXml")) {
4587 CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
4588
4589 if (pXmlTag->ParseXml(pTypeNode->children, parseStr)) {
4590 if ((attr = icXmlFindAttr(pTypeNode, "reserved"))) {
4591 sscanf(icXmlAttrValue(attr), "%u", &pTag->m_nReserved);
4592 }
4593 AttachElem(sigTag, pTag);
4594 }
4595 else {
4596 parseStr += "Unable to Parse \"";
4597 parseStr += (const char*)pTypeNode->name;
4598 parseStr += "\" (";
4599 parseStr += nodeName;
4600 parseStr += ") Tag\n";
4601 return false;
4602 }
4603 }
4604 else {
4605 parseStr += "Invalid tag extension for \"";
4606 parseStr += (const char*)pTypeNode->name;
4607 parseStr += "\" (";
4608 parseStr += nodeName;
4609 parseStr += ") Tag\n";
4610 return false;
4611 }
4612 }
4613 }
4614 else { //Legacy parsing of XML tags by type
4615 sigTag = (icTagSignature)0;
4616 // get the tag type signature
4617 icTagTypeSignature sigType = icGetTypeNameTagSig(nodeName.c_str());
4618
4619 if (sigType == icSigUnknownType) {
4620 xmlAttr *attr = icXmlFindAttr(pNode, "type");
4622 }
4623
4624 CIccInfo info;
4625
4626 // create a tag based on the signature
4627 pTag = CIccTag::Create(sigType);
4628
4629 IIccExtensionTag *pExt;
4630
4631 if (pTag && (pExt = pTag->GetExtension()) && !strcmp(pExt->GetExtClassName(), "CIccTagXml")) {
4632 CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
4633
4634 if (pXmlTag->ParseXml(pNode->children, parseStr)) {
4635 if ((attr = icXmlFindAttr(pNode, "reserved"))) {
4636 sscanf(icXmlAttrValue(attr), "%u", &pTag->m_nReserved);
4637 }
4638
4639 for (xmlNode *tagSigNode = pNode->children; tagSigNode; tagSigNode = tagSigNode->next) {
4640 if (tagSigNode->type == XML_ELEMENT_NODE && !icXmlStrCmp(tagSigNode->name, "TagSignature")) {
4641 sigTag = (icTagSignature)icGetSigVal((const icChar*)tagSigNode->children->content);
4642 AttachElem(sigTag, pTag);
4643 }
4644 }
4645 }
4646 else {
4647 parseStr += "Unable to Parse \"";
4648 parseStr += info.GetTagTypeSigName(sigType);
4649 parseStr += "\" (";
4650 parseStr += nodeName;
4651 parseStr += ") Tag\n";
4652 return false;
4653 }
4654 }
4655 else {
4656 parseStr += "Invalid tag extension for \"";
4657 parseStr += info.GetTagTypeSigName(sigType);
4658 parseStr += "\" (";
4659 parseStr += nodeName;
4660 parseStr += ") Tag\n";
4661 return false;
4662 }
4663 }
4664
4665 return true;
4666}
#define icSigUnknownType
Definition icProfileHeader.h:591
icUInt32Number icSignature
Definition icProfileHeader.h:271
#define icSigUnknownTag
Definition icProfileHeader.h:483
char icChar
Definition IccDefs.h:110
ICCPROFLIB_API icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
Definition IccUtilXml.cpp:669
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
icTagTypeSignature icGetTypeNameTagSig(const icChar *szTagType)
Definition IccUtilXml.cpp:1152
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
icTagSignature icGetTagNameSig(const icChar *szTagName)
Definition IccUtilXml.cpp:1169
Definition IccUtil.h:303
const icChar * GetTagTypeSigName(icTagTypeSignature sig)
Definition IccUtil.cpp:1594
virtual icSignature GetElemSig(const icChar *szElemName) const =0
bool AttachElem(icSignature sig, CIccTag *pTag)
Definition IccTagComposite.cpp:757
Definition IccTagBasic.h:90
virtual const char * GetExtClassName() const =0
Definition IccTagXml.h:75
virtual bool ParseXml(xmlNode *pNode, std::string &parseStr)=0

References CIccTagStruct::AttachElem(), CIccTag::Create(), CIccTagStruct::FindElem(), IIccStruct::GetElemSig(), IIccExtensionTag::GetExtClassName(), CIccTag::GetExtension(), CIccInfo::GetTagTypeSigName(), icGetSigVal(), icGetTagNameSig(), icGetTypeNameTagSig(), icXmlAttrValue(), icXmlAttrValue(), icXmlFindAttr(), CIccTag::m_nReserved, CIccTagStruct::m_pStruct, and CIccTagXml::ParseXml().

Referenced by ParseXml().

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

◆ ParseXml()

bool CIccTagXmlStruct::ParseXml ( xmlNode *  pNode,
std::string &  parseStr 
)
virtual

Implements CIccTagXml.

4670{
4671 // parse each tag
4672 xmlNode *tagNode, *firstNode=pNode;
4673
4674 for (; pNode; pNode = pNode->next) {
4675 if (pNode->type == XML_ELEMENT_NODE)
4676 break;
4677 }
4678 if (!pNode) {
4679 parseStr += "Invalid Tag Structure: ";
4680 if (firstNode)
4681 parseStr += (const char*)firstNode->name;
4682 else
4683 parseStr += ":";
4684 parseStr += "\n";
4685 return false;
4686 }
4687
4688 std::string nodeName = (icChar*)pNode->name;
4689
4690 icStructSignature sigStruct = CIccStructCreator::GetStructSig(nodeName.c_str());
4691
4692 if (sigStruct) {
4693 SetTagStructType(sigStruct);
4694 pNode = pNode->children;
4695 }
4696 else {
4697 tagNode = icXmlFindNode(firstNode, "StructureSignature");
4698 if (!tagNode) {
4699 parseStr += "Unable to find StructureSignature\n";
4700 return false;
4701 }
4702
4703 if (tagNode->type == XML_ELEMENT_NODE && tagNode->children && tagNode->children->content) {
4704
4705 sigStruct = (icStructSignature)icGetSigVal(tagNode->children ? (const icChar*)tagNode->children->content : "");
4706 SetTagStructType(sigStruct);
4707 }
4708 else {
4709 parseStr += "Invalid XNode type for StructureSignature\n";
4710 return false;
4711 }
4712 }
4713
4714 tagNode = icXmlFindNode(pNode, "MemberTags");
4715 if (!tagNode) {
4716 parseStr += "Unable to find structure MemberTags\n";
4717 return false;
4718 }
4719
4720 for (tagNode = tagNode->children; tagNode; tagNode = tagNode->next) {
4721 if (tagNode->type == XML_ELEMENT_NODE) {
4722 if (!ParseTag(tagNode, parseStr)) {
4723 parseStr += "Failed to parse tag member (";
4724 parseStr += (char*)tagNode->name;
4725 parseStr += ")\n";
4726 return false;
4727 }
4728 }
4729 }
4730
4731 return true;
4732}
icStructSignature
Definition icProfileHeader.h:598
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
virtual bool SetTagStructType(icStructSignature sig)
Definition IccTagComposite.cpp:259
static icStructSignature GetStructSig(const icChar *structName)
Definition IccStructFactory.h:266
bool ParseTag(xmlNode *pNode, std::string &parseStr)
Definition IccTagXml.cpp:4496

References CIccStructCreator::GetStructSig(), icGetSigVal(), icXmlFindNode(), ParseTag(), and CIccTagStruct::SetTagStructType().

+ Here is the call graph for this function:

◆ Read() [1/2]

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

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}
icUInt32Number icUInt64Number[2]
Definition icProfileHeader.h:268
bool LoadElem(IccTagEntry *pTagEntry, CIccIO *pIO)
Definition IccTagComposite.cpp:847
void Cleanup()
Definition IccTagComposite.cpp:559
virtual icInt32Number Tell()
Definition IccIO.h:133
icUInt32Number m_nReserved
Definition IccTagBasic.h:235

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

Referenced by CIccTagStruct::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)
virtualinherited

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(), CIccTagStruct::m_pStruct, and CIccTagStruct::m_sigStructType.

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

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

◆ ToXml()

bool CIccTagXmlStruct::ToXml ( std::string &  xml,
std::string  blanks = "" 
)
virtual

Implements CIccTagXml.

4364{
4365 std::string info;
4366 char buf[256], fix[256], line[256];
4367 IIccStruct *pStruct = GetStructHandler();
4368
4369 const icChar *structName = ((pStruct != NULL) ? pStruct->GetDisplayName() : NULL);
4370 blanks += " ";
4371
4372 if (structName && strcmp(structName, "privateStruct")) {
4373 sprintf(line, "<%s> <MemberTags>\n", structName);
4374 }
4375 else {
4376 // print out the struct signature
4377 sprintf(line, "<privateStruct StructSignature=\"%s\"/> <MemberTags>\n", icFixXml(fix, icGetSigStr(buf, m_sigStructType)));
4378 structName = "privateStruct";
4379 }
4380
4381 xml += blanks + line;
4382 TagEntryList::iterator i, j;
4383 std::set<icTagSignature> sigSet;
4384 CIccInfo Fmt;
4385 IccOffsetTagSigMap offsetTags;
4386
4387 for (i=m_ElemEntries->begin(); i!=m_ElemEntries->end(); i++) {
4388 if (sigSet.find(i->TagInfo.sig)==sigSet.end()) {
4389 CIccTag *pTag = FindElem(i->TagInfo.sig);
4390
4391 if (pTag) {
4392 CIccTagXml *pTagXml = (CIccTagXml*)(pTag->GetExtension());
4393 if (pTagXml) {
4394 IccOffsetTagSigMap::iterator prevTag = offsetTags.find(i->TagInfo.offset);
4395 std::string tagName = ((pStruct!=NULL) ? pStruct->GetElemName((icSignature)i->TagInfo.sig) : "");
4396 if (prevTag == offsetTags.end()) {
4397 const icChar* tagSig = icGetTagSigTypeName(pTag->GetType());
4398
4399 if (tagName.size() && strncmp(tagName.c_str(), "PrivateSubTag", 13)) {
4400 sprintf(line, " <%s>", icFixXml(fix, tagName.c_str()));
4401 }
4402 else {
4403 sprintf(line, " <PrivateSubTag TagSignature=\"%s\">", icFixXml(fix, icGetSigStr(buf, i->TagInfo.sig)));
4404 tagName = "PrivateSubTag";
4405 }
4406 xml += blanks + line;
4407
4408 // PrivateType - a type that does not belong to the list in the icc specs - custom for vendor.
4409 if (!strcmp("PrivateType", tagSig))
4410 sprintf(line, " <PrivateType type=\"%s\">\n", icFixXml(fix, icGetSigStr(buf, pTag->GetType())));
4411 else
4412 sprintf(line, " <%s>\n", tagSig); //parent node is the tag type
4413
4414 xml += line;
4415 j = i;
4416#if 0
4417 // print out the tag signature (there is at least one)
4418 sprintf(line, " <TagSignature>%s</TagSignature>\n", icFixXml(fix, icGetSigStr(buf, i->TagInfo.sig)));
4419 xml += blanks + line;
4420
4421 sigSet.insert(i->TagInfo.sig);
4422
4423 // print out the rest of the tag signatures
4424 for (j++; j != m_ElemEntries->end(); j++) {
4425 if (j->pTag == i->pTag || j->TagInfo.offset == i->TagInfo.offset) {
4426 sprintf(line, " <TagSignature>%s</TagSignature>\n", icFixXml(fix, icGetSigStr(buf, j->TagInfo.sig)));
4427 xml += blanks + line;
4428 sigSet.insert(j->TagInfo.sig);
4429 }
4430 }
4431 // if (pTag->m_nReserved) {
4432 // sprintf(line, " Reserved=\"%08x\"", pTag->m_nReserved);
4433 // xml += line;
4434 // }
4435 // xml += ">\n";
4436#endif
4437 //convert the rest of the tag to xml
4438 if (!pTagXml->ToXml(xml, blanks + " ")) {
4439 printf("Unable to output sub-tag with type %s\n", icGetSigStr(buf, i->TagInfo.sig));
4440 return false;
4441 }
4442 sprintf(line, " </%s> </%s>\n", tagSig, tagName.c_str());
4443 xml += blanks + line;
4444 offsetTags[i->TagInfo.offset] = i->TagInfo.sig;
4445 }
4446 else {
4447 std::string prevTagName = ((pStruct != NULL) ? pStruct->GetElemName(prevTag->second) : "");
4448 char fix2[200];
4449
4450 if (tagName.size() && strncmp(tagName.c_str(), "PrivateSubTag", 13))
4451 sprintf(line, " <%s SameAs=\"%s\"", icFixXml(fix, tagName.c_str()), icFixXml(fix2, prevTagName.c_str())); //parent node is the tag type
4452 else
4453 sprintf(line, " <PrivateSubTag TagSignature=\"%s\" SameAs=\"%s\"", icFixXml(fix2, icGetSigStr(buf, i->TagInfo.sig)), icFixXml(fix, prevTagName.c_str()));
4454
4455 xml += line;
4456 if (prevTagName.size() || !strncmp(prevTagName.c_str(), "PrivateSubTag", 13)) {
4457 sprintf(line, " SameAsSignature=\"%s\"", icFixXml(fix2, icGetSigStr(buf, prevTag->second)));
4458 xml += line;
4459 }
4460
4461 xml += "/>\n";
4462 }
4463 }
4464 else {
4465 printf("Non XML tag in list with type %s!\n", icGetSigStr(buf, i->TagInfo.sig));
4466 return false;
4467 }
4468 }
4469 else {
4470 printf("Unable to find tag with type %s!\n", icGetSigStr(buf, i->TagInfo.sig));
4471 return false;
4472 }
4473 }
4474 }
4475
4476 xml += blanks + "</MemberTags> </" + structName + ">\n";
4477 return true;
4478}
ICCPROFLIB_API const icChar * icGetSigStr(icChar *pBuf, icUInt32Number nSig)
Definition IccUtil.cpp:1056
std::map< icUInt32Number, icTagSignature > IccOffsetTagSigMap
Definition IccProfileXml.cpp:72
const icChar * icGetTagSigTypeName(icTagTypeSignature tagTypeSig)
Definition IccUtilXml.cpp:1141
const char * icFixXml(char *szDest, const char *szStr)
Definition IccUtilXml.cpp:305
virtual std::string GetElemName(icSignature sigElem) const =0
virtual const icChar * GetDisplayName() const =0
IIccStruct * GetStructHandler()
Definition IccTagComposite.cpp:973
virtual icTagTypeSignature GetType() const
Definition IccTagBasic.h:131
virtual IIccExtensionTag * GetExtension()
Definition IccTagBasic.h:143
virtual bool ToXml(std::string &xml, std::string blanks="")=0

References CIccTagStruct::FindElem(), IIccStruct::GetDisplayName(), IIccStruct::GetElemName(), CIccTag::GetExtension(), CIccTagStruct::GetStructHandler(), CIccTag::GetType(), icFixXml(), icGetSigStr(), icGetTagSigTypeName(), CIccTagStruct::m_ElemEntries, CIccTagStruct::m_sigStructType, icTag::offset, icTag::sig, and CIccTagXml::ToXml().

+ Here is the call graph for this function:

◆ Validate()

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

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
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 CIccTagStruct::AreElemsUnique(), CIccInfo::GetSigPathName(), icGetSigPath(), icMaxStatus(), icMsgValidateWarning, icValidateWarning, CIccTagStruct::m_ElemEntries, CIccTagStruct::m_pStruct, icTag::sig, CIccTag::Validate(), and IIccStruct::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagStruct::Write ( CIccIO pIO)
virtualinherited

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(), CIccTagStruct::GetType(), icSeekSet, CIccTagStruct::m_ElemEntries, CIccTag::m_nReserved, CIccTagStruct::m_sigStructType, CIccTagStruct::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

◆ m_nReserved

icUInt32Number CIccTag::m_nReserved
inherited

Referenced by CIccTag::CIccTag(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::operator=(), CIccProfileXml::ParseTag(), 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(), 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(), CIccTagStruct::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
protectedinherited

◆ m_tagStart

icUInt32Number CIccTagStruct::m_tagStart
protectedinherited

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