Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
CIccTagStruct Class Reference

Class: CIccTagStruct. More...

#include <IccTagComposite.h>

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

Public Member Functions

bool AreElemsUnique () const
 Name: CIccTagStruct::AreElemsUnique.
 
bool AttachElem (icSignature sig, CIccTag *pTag)
 Name: CIccTagStruct::AttachTag.
 
 CIccTagStruct ()
 Name: CIccTagStruct::CIccTagStruct.
 
 CIccTagStruct (const CIccTagStruct &lut)
 Name: CIccTagStruct::CIccTagStruct.
 
bool DeleteElem (icSignature sig)
 Name: CIccTagStruct::DeleteSubTag.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagStruct::Describe.
 
CIccTagFindElem (icSignature sig)
 Name: CIccTagStruct::FindElem.
 
CIccTagFindElemOfType (icSignature sig, icTagTypeSignature sigType)
 Name: CIccTagStruct::FindElemOfType.
 
virtual const icCharGetClassName () const
 
TagEntryList * GetElemList ()
 
icFloatNumber GetElemNumberValue (icSignature sig, icFloatNumber defaultValue=0)
 Name: CIccTagStruct::GetElemNumberValue.
 
IIccStructGetStructHandler ()
 Name: CIccTagStruct::GetStructHandler.
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagStructoperator= (const CIccTagStruct &lut)
 Name: &operator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagStruct::Read.
 
virtual bool SetTagStructType (icStructSignature sig)
 Name: CIccTagStruct::SetTagStructType.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagStruct::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagStruct::Write.
 
virtual ~CIccTagStruct ()
 Name: CIccTagStruct::~CIccTagStruct.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual IIccExtensionTagGetExtension ()
 
virtual icArraySignature GetTagArrayType () const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 Function: Read(size, pIO) - Read tag from file.
 
virtual bool ReadAll ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual ~CIccTag ()
 Name: CIccTag::CIccTag.
 

Static Public Member Functions

static std::string GetElemName (icTagSignature sig, icStructSignature sigThis)
 
static CIccTagStructParseMem (icUInt8Number *pMem, icUInt32Number size)
 Name: CIccTagStruct::ParseMem.
 
- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 

Protected Member Functions

void Cleanup ()
 Name: CIccTagStruct::Cleanup.
 
bool DetachElem (CIccTag *pTag)
 Name: CIccTagStruct::DetachSubTag.
 
IccTagEntry * GetElem (CIccTag *pTag) const
 Name: CIccTagStruct::GetElem.
 
IccTagEntry * GetElem (icSignature sig) const
 Name: CIccTagStruct::GetElem.
 
bool LoadElem (IccTagEntry *pTagEntry, CIccIO *pIO)
 Name: CIccTagStruct::LoadSubTag.
 

Protected Attributes

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

Friends

class IIccStruct
 

Additional Inherited Members

- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 

Detailed Description

Class: CIccTagStruct.

Purpose: The general purpose Tag Struct type tag

Definition at line 155 of file IccTagComposite.h.

Constructor & Destructor Documentation

◆ CIccTagStruct() [1/2]

CIccTagStruct::CIccTagStruct ( )

Name: CIccTagStruct::CIccTagStruct.

Purpose:

Args:

Return:

Definition at line 129 of file IccTagComposite.cpp.

130{
131 m_ElemEntries = new(TagEntryList);
132 m_ElemVals = new(TagPtrList);
133 m_pStruct = NULL;
134}
TagEntryList * m_ElemEntries
TagPtrList * m_ElemVals
IIccStruct * m_pStruct

References m_ElemEntries, m_ElemVals, and m_pStruct.

Referenced by ParseMem().

+ Here is the caller graph for this function:

◆ CIccTagStruct() [2/2]

CIccTagStruct::CIccTagStruct ( const CIccTagStruct & subTags)

Name: CIccTagStruct::CIccTagStruct.

Purpose:

Args:

Return:

Definition at line 146 of file IccTagComposite.cpp.

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}
icStructSignature m_sigStructType
virtual IIccStruct * NewCopy(CIccTagStruct *pNewTagStruct) const =0
Lists of tags, tags, profile header and profile structure.

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

+ Here is the call graph for this function:

◆ ~CIccTagStruct()

CIccTagStruct::~CIccTagStruct ( )
virtual

Name: CIccTagStruct::~CIccTagStruct.

Purpose:

Args:

Return:

Definition at line 237 of file IccTagComposite.cpp.

238{
239 Cleanup();
240
241 delete m_ElemEntries;
242 delete m_ElemVals;
243
244 if (m_pStruct)
245 delete m_pStruct;
246}
void Cleanup()
Name: CIccTagStruct::Cleanup.

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.

Definition at line 615 of file IccTagComposite.cpp.

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.

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).

Definition at line 757 of file IccTagComposite.cpp.

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}
icArraySignature sig
IccTagEntry * GetElem(icSignature sig) const
Name: CIccTagStruct::GetElem.
icTagSignature
public tags and sizes

References GetElem(), m_ElemEntries, m_ElemVals, and sig.

Referenced by icConvertEncodingProfile().

+ 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

Definition at line 559 of file IccTagComposite.cpp.

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

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

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

+ 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

Definition at line 807 of file IccTagComposite.cpp.

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}
Class: CIccTag.
bool DetachElem(CIccTag *pTag)
Name: CIccTagStruct::DetachSubTag.

References DetachElem(), GetElem(), m_ElemEntries, and 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.

Definition at line 308 of file IccTagComposite.cpp.

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}
static bool GetStructSigName(std::string &structName, icStructSignature structTypeSig, bool bFillUnknown=true)
Function: GetStructSigName(structTypeSig) Get display name of structTypeSig.
static IIccStruct * CreateStruct(icStructSignature structTypeSig, CIccTagStruct *pTagStruct)
Function: CreateStruct(structTypeSig) Create a element of type structTypeSig.
Class: CIccStructUnknown.
Class: IIccStruct.
virtual void Describe(std::string &sDescription, int nVerboseness) const

References 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

Definition at line 932 of file IccTagComposite.cpp.

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:

◆ 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

Definition at line 672 of file IccTagComposite.cpp.

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

References GetElem(), and sig.

Referenced by GetElemNumberValue().

+ 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

Definition at line 698 of file IccTagComposite.cpp.

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 sig.

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.

Definition at line 172 of file IccTagComposite.h.

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.

Definition at line 645 of file IccTagComposite.cpp.

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.

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

Definition at line 589 of file IccTagComposite.cpp.

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 sig.

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

+ Here is the caller graph for this function:

◆ GetElemList()

TagEntryList * CIccTagStruct::GetElemList ( )
inline

Definition at line 181 of file IccTagComposite.h.

181{ return m_ElemEntries; }

Referenced by 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.

Definition at line 726 of file IccTagComposite.cpp.

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
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
virtual bool IsNumArrayType() const
Class: CIccTagNumArray.
virtual bool GetValues(icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const =0
CIccTag * FindElem(icSignature sig)
Name: CIccTagStruct::FindElem.

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

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams().

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

Definition at line 973 of file IccTagComposite.cpp.

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

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

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

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

◆ GetTagStructType()

virtual icStructSignature CIccTagStruct::GetTagStructType ( ) const
inlinevirtual

Reimplemented from CIccTag.

Definition at line 168 of file IccTagComposite.h.

168{ return m_sigStructType; }

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

+ 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.

Definition at line 167 of file IccTagComposite.h.

167{ return icSigTagStructType; }
@ icSigTagStructType

References icSigTagStructType.

Referenced by Write().

+ Here is the caller graph for this function:

◆ 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

Definition at line 847 of file IccTagComposite.cpp.

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}
@ icSeekSet
Definition IccIO.h:83
icTagTypeSignature
unsigned int icUInt32Number
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)
Name: CIccTag::Create.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Function: Read(size, pIO) - Read tag from file.
icUInt32Number m_tagSize
icUInt32Number m_tagStart

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

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.

Definition at line 162 of file IccTagComposite.h.

162{ return new CIccTagStruct(*this);}
CIccTagStruct()
Name: CIccTagStruct::CIccTagStruct.

◆ operator=()

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

Name: &operator=.

Purpose:

Args:

Return:

Definition at line 189 of file IccTagComposite.cpp.

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

Definition at line 280 of file IccTagComposite.cpp.

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}
Type: Class.
Definition IccIO.h:217
bool Attach(icUInt8Number *pData, icUInt32Number nSize, bool bWrite=false)
Definition IccIO.cpp:686
Class: CIccTagStruct.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagStruct::Read.

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

+ Here is the call graph for this function:

◆ Read()

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

Name: CIccTagStruct::Read.

Purpose:

Args:

Return:

Reimplemented from CIccTag.

Definition at line 346 of file IccTagComposite.cpp.

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}
virtual icInt32Number Tell()
Definition IccIO.h:133
icUInt32Number m_nReserved
virtual bool SetTagStructType(icStructSignature sig)
Name: CIccTagStruct::SetTagStructType.
bool LoadElem(IccTagEntry *pTagEntry, CIccIO *pIO)
Name: CIccTagStruct::LoadSubTag.
icStructSignature
Tag Structure type signatures.
icUInt32Number icUInt64Number[2]

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

Referenced by ParseMem().

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

◆ SetTagStructType()

bool CIccTagStruct::SetTagStructType ( icStructSignature sig)
virtual

Name: CIccTagStruct::SetTagStructType.

Purpose:

Args:

Return:

Definition at line 259 of file IccTagComposite.cpp.

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

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

Referenced by 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.

Definition at line 519 of file IccTagComposite.cpp.

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:118
@ icValidateWarning
Definition IccDefs.h:120
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
std::string icGetSigPath(icUInt32Number nSig)
Definition IccUtil.cpp:1191
const char * icMsgValidateWarning
Definition IccUtil.cpp:90
Type: Class.
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
Function: Validate Each derived tag will implement it's own IsValid() function.
bool AreElemsUnique() const
Name: CIccTagStruct::AreElemsUnique.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const =0

References AreElemsUnique(), CIccInfo::GetSigPathName(), icGetSigPath(), icMaxStatus(), icMsgValidateWarning, icValidateWarning, m_ElemEntries, m_pStruct, 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.

Definition at line 425 of file IccTagComposite.cpp.

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 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
virtual icTagTypeSignature GetType() const
Function: GetType()

References CIccIO::Align32(), CIccIO::GetLength(), GetType(), icSeekSet, m_ElemEntries, CIccTag::m_nReserved, m_sigStructType, m_tagStart, CIccIO::Seek(), sig, CIccIO::Tell(), and CIccIO::Write32().

+ Here is the call graph for this function:

Friends And Related Symbol Documentation

◆ IIccStruct

friend class IIccStruct
friend

Definition at line 157 of file IccTagComposite.h.

Member Data Documentation

◆ m_ElemEntries

◆ m_ElemVals

TagPtrList* CIccTagStruct::m_ElemVals
protected

◆ m_pStruct

IIccStruct* CIccTagStruct::m_pStruct
protected

◆ m_sigStructType

icStructSignature CIccTagStruct::m_sigStructType
protected

◆ m_tagSize

icUInt32Number CIccTagStruct::m_tagSize
protected

Definition at line 210 of file IccTagComposite.h.

Referenced by LoadElem(), and Read().

◆ m_tagStart

icUInt32Number CIccTagStruct::m_tagStart
protected

Definition at line 209 of file IccTagComposite.h.

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


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