Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccTagComposite.cpp
Go to the documentation of this file.
1/** @file
2 File: IccTagComposite.cpp
3
4 Contains: Implementation of Struct and Array Tags
5
6 Version: V1
7
8 Copyright: (c) see ICC Software License
9*/
10
11/*
12* The ICC Software License, Version 0.2
13*
14*
15* Copyright (c) 2003-2012 The International Color Consortium. All rights
16* reserved.
17*
18* Redistribution and use in source and binary forms, with or without
19* modification, are permitted provided that the following conditions
20* are met:
21*
22* 1. Redistributions of source code must retain the above copyright
23* notice, this list of conditions and the following disclaimer.
24*
25* 2. Redistributions in binary form must reproduce the above copyright
26* notice, this list of conditions and the following disclaimer in
27* the documentation and/or other materials provided with the
28* distribution.
29*
30* 3. In the absence of prior written permission, the names "ICC" and "The
31* International Color Consortium" must not be used to imply that the
32* ICC organization endorses or promotes products derived from this
33* software.
34*
35*
36* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
37* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
38* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
39* DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
40* ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
41* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
42* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
43* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
44* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
45* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
46* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
47* SUCH DAMAGE.
48* ====================================================================
49*
50* This software consists of voluntary contributions made by many
51* individuals on behalf of the The International Color Consortium.
52*
53*
54* Membership in the ICC is encouraged when this software is used for
55* commercial purposes.
56*
57*
58* For more information on The International Color Consortium, please
59* see <http://www.color.org/>.
60*
61*
62*/
63
64//////////////////////////////////////////////////////////////////////
65// HISTORY:
66//
67// -Initial implementation by Max Derhak Oct-21-2006
68//
69//////////////////////////////////////////////////////////////////////
70
71#ifdef WIN32
72#pragma warning( disable: 4786) //disable warning in <list.h>
73#endif
74
75#include <stdio.h>
76#include <math.h>
77#include <string.h>
78#include <stdlib.h>
79#include "IccTagComposite.h"
80#include "IccStructBasic.h"
81#include "IccUtil.h"
82#include "IccIO.h"
83#include "IccStructFactory.h"
84#include "IccArrayFactory.h"
85
86void IIccStruct::Describe(std::string &sDescription, int nVerboseness) const
87{
88 if (m_pTagStruct) {
89 char buf[256];
90 CIccInfo info;
91
92 sprintf(buf, "BEGIN UNKNOWN_TAG_STRUCT ");
93 sDescription += buf;
94 sDescription += info.GetStructSigName(m_pTagStruct->GetTagStructType());
95 sDescription += "\n\n";
96
97 TagEntryList::iterator i;
98 TagEntryList *pList = m_pTagStruct->GetElemList();
99 for (i=pList->begin(); i!=pList->end(); i++) {
100 i->pTag->Describe(sDescription, nVerboseness);
101 }
102
103 sDescription += "\n";
104 sprintf(buf, "END TAG_STRUCT\n");
105 sDescription += buf;
106 sDescription += "\n";
107 }
108}
109
110TagEntryList* IIccStruct::getTagEntries() const
111{
112 if (m_pTagStruct)
114
115 return NULL;
116}
117
118
119/**
120 ******************************************************************************
121 * Name: CIccTagStruct::CIccTagStruct
122 *
123 * Purpose:
124 *
125 * Args:
126 *
127 * Return:
128 ******************************************************************************/
130{
131 m_ElemEntries = new(TagEntryList);
132 m_ElemVals = new(TagPtrList);
133 m_pStruct = NULL;
134}
135
136/**
137 ******************************************************************************
138 * Name: CIccTagStruct::CIccTagStruct
139 *
140 * Purpose:
141 *
142 * Args:
143 *
144 * Return:
145 ******************************************************************************/
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}
178
179/**
180 ******************************************************************************
181 * Name: &operator=
182 *
183 * Purpose:
184 *
185 * Args:
186 *
187 * Return:
188 ******************************************************************************/
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}
226
227/**
228 ******************************************************************************
229 * Name: CIccTagStruct::~CIccTagStruct
230 *
231 * Purpose:
232 *
233 * Args:
234 *
235 * Return:
236 ******************************************************************************/
238{
239 Cleanup();
240
241 delete m_ElemEntries;
242 delete m_ElemVals;
243
244 if (m_pStruct)
245 delete m_pStruct;
246}
247
248
249/**
250 ******************************************************************************
251 * Name: CIccTagStruct::SetTagStructType
252 *
253 * Purpose:
254 *
255 * Args:
256 *
257 * Return:
258 ******************************************************************************/
269
270/**
271 ******************************************************************************
272 * Name: CIccTagStruct::ParseMem
273 *
274 * Purpose:
275 *
276 * Args:
277 *
278 * Return:
279 ******************************************************************************/
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}
296
297
298/**
299 ******************************************************************************
300 * Name: CIccTagStruct::Describe
301 *
302 * Purpose:
303 *
304 * Args:
305 *
306 * Return:
307 ******************************************************************************/
308void CIccTagStruct::Describe(std::string &sDescription, int nVerboseness)
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}
334
335
336/**
337 ******************************************************************************
338 * Name: CIccTagStruct::Read
339 *
340 * Purpose:
341 *
342 * Args:
343 *
344 * Return:
345 ******************************************************************************/
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}
414
415/**
416 ******************************************************************************
417 * Name: CIccTagStruct::Write
418 *
419 * Purpose:
420 *
421 * Args:
422 *
423 * Return:
424 ******************************************************************************/
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}
507
508
509/**
510 ******************************************************************************
511 * Name: CIccTagStruct::Validate
512 *
513 * Purpose:
514 *
515 * Args:
516 *
517 * Return:
518 ******************************************************************************/
519icValidateStatus CIccTagStruct::Validate(std::string sigPath, std::string &sReport,
520 const CIccProfile* pProfile /*=NULL*/) const
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}
551
552/**
553 ***************************************************************************
554 * Name: CIccTagStruct::Cleanup
555 *
556 * Purpose: Detach from a pending IO object
557 ***************************************************************************
558 */
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}
575
576/**
577 ****************************************************************************
578 * Name: CIccTagStruct::GetElem
579 *
580 * Purpose: Get a tag entry with a given signature
581 *
582 * Args:
583 * sig - signature id to find in tag structure
584 *
585 * Return:
586 * Pointer to desired tag struct entry, or NULL if not found.
587 *****************************************************************************
588 */
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}
600
601
602/**
603 ******************************************************************************
604 * Name: CIccTagStruct::AreElemsUnique
605 *
606 * Purpose: For each tag it checks to see if any other tags have the same
607 * signature.
608 *
609 *
610 * Return:
611 * true if all tags have unique signatures, or false if there are duplicate
612 * tag signatures.
613 *******************************************************************************
614 */
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}
629
630
631/**
632******************************************************************************
633* Name: CIccTagStruct::GetElem
634*
635* Purpose: Finds the first tag entry that points to the indicated tag object
636*
637* Args:
638* pTag - pointer to tag object desired to be found
639*
640* Return:
641* pointer to first tag struct entry that points to the desired tag object,
642* or NULL if tag object is not pointed to by any tag struct entries.
643*******************************************************************************
644*/
645IccTagEntry* CIccTagStruct::GetElem(CIccTag *pTag) const
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}
656
657
658/**
659 ******************************************************************************
660 * Name: CIccTagStruct::FindElem
661 *
662 * Purpose: Finds the tag object associated with the struct entry with the
663 * given signature.
664 *
665 * Args:
666 * sig - element signature to find
667 *
668 * Return:
669 * The desired tag object, or NULL if unable to find in the struct
670 *******************************************************************************
671 */
673{
674 IccTagEntry *pEntry = GetElem(sig);
675
676 if (pEntry) {
677 return pEntry->pTag;
678 }
679
680 return NULL;
681}
682
683/**
684******************************************************************************
685* Name: CIccTagStruct::FindElemOfType
686*
687* Purpose: Finds the tag object associated with the struct entry with the
688* given signature that has a specific tag type.
689*
690* Args:
691* sig - element signature to find
692* sigType - signature of desired tag type
693*
694* Return:
695* The desired tag object, or NULL if unable to find in the struct
696*******************************************************************************
697*/
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}
708
709
710/**
711******************************************************************************
712* Name: CIccTagStruct::GetElemNumberValue
713*
714* Purpose: Returns the number value associated with the first entry of a
715* CIccTagNumberArray based tag with the given signature.
716*
717* Args:
718* sig - subtag signature to find
719* defaultValue - value to use if the tag cannot be found, or is not a number tag
720*
721* Return:
722* The tags value or defaultValue if unable to find subtag in the struct or if the
723* subtag is not a CIccTagNumberArray based tag.
724*******************************************************************************
725*/
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}
740
741/**
742 ******************************************************************************
743 * Name: CIccTagStruct::AttachTag
744 *
745 * Purpose: Assign a tag object to a directory entry in the profile. This
746 * will assume ownership of the tag object.
747 *
748 * Args:
749 * sig - signature of tag 'name' to use to assign tag object with,
750 * pTag - pointer to tag object to attach to profile.
751 *
752 * Return:
753 * true = tag assigned to profile,
754 * false - tag not assigned to profile (tag already exists).
755 *******************************************************************************
756 */
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}
790
791
792/**
793 ******************************************************************************
794 * Name: CIccTagStruct::DeleteSubTag
795 *
796 * Purpose: Delete tag directory entry with given signature. If no other tag
797 * directory entries use the tag object, the tag object will also be deleted.
798 *
799 * Args:
800 * sig - signature of tag directory entry to remove
801 *
802 * Return:
803 * true - desired tag directory entry was found and deleted,
804 * false - desired tag directory entry was not found
805 *******************************************************************************
806 */
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}
828
829
830/**
831 ******************************************************************************
832 * Name: CIccTagStruct::LoadSubTag
833 *
834 * Purpose: This will load from the indicated IO object and associate a tag
835 * object to a tag directory entry. Nothing happens if tag directory entry
836 * is associated with a tag object.
837 *
838 * Args:
839 * pTagEntry - pointer to tag directory entry,
840 * pIO - pointer to IO object to read tag object data from
841 *
842 * Return:
843 * true - tag directory object associated with tag directory entry,
844 * false - failure
845 *******************************************************************************
846 */
847bool CIccTagStruct::LoadElem(IccTagEntry *pTagEntry, CIccIO *pIO)
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}
912
913
914/**
915 ******************************************************************************
916 * Name: CIccTagStruct::DetachSubTag
917 *
918 * Purpose: Remove association of a tag object from all tag directory entries.
919 * Associated tag directory entries will be removed from the tag directory.
920 * The tag object is NOT deleted from memory, but is considered to be
921 * no longer associated with the CIccTagStruct object. The caller assumes
922 * ownership of the tag object.
923 *
924 * Args:
925 * pTag - pointer to tag object unassociated with the profile object
926 *
927 * Return:
928 * true - tag object found and unassociated with profile object,
929 * false - tag object not found
930 *******************************************************************************
931 */
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}
959
960
961/**
962****************************************************************************
963* Name: CIccTagStruct::GetStructHandler
964*
965* Purpose: Get struct object handler
966*
967* Args:
968*
969* Return:
970* Pointer to a IIccStruct object handler for the associated struct type
971*****************************************************************************
972*/
981
982
983/**
984******************************************************************************
985* Name: CIccTagArray::CIccTagArray
986*
987* Purpose:
988*
989* Args:
990*
991* Return:
992******************************************************************************/
994{
995 m_TagVals = NULL;
996 m_nSize = 0;
997 m_pArray = NULL;
999}
1000
1001/**
1002******************************************************************************
1003* Name: CIccTagArray::CIccTagArray
1004*
1005* Purpose:
1006*
1007* Args:
1008*
1009* Return:
1010******************************************************************************/
1011CIccTagArray::CIccTagArray(icArraySignature sigArrayType/* =icSigUndefinedArray */)
1012{
1013 m_TagVals = NULL;
1014 m_nSize = 0;
1015
1016 m_pArray = NULL;
1017 SetTagArrayType(sigArrayType);
1018}
1019
1020/**
1021******************************************************************************
1022* Name: CIccTagArray::CIccTagArray
1023*
1024* Purpose:
1025*
1026* Args:
1027*
1028* Return:
1029******************************************************************************/
1031{
1032 if (tagAry.m_nSize) {
1033 m_TagVals = new IccTagPtr[tagAry.m_nSize];
1034
1036 for (i=0; i<tagAry.m_nSize; i++) {
1037 if (tagAry.m_TagVals[i].ptr)
1038 m_TagVals[i].ptr = tagAry.m_TagVals[i].ptr->NewCopy();
1039 else
1040 m_TagVals[i].ptr = NULL;
1041 }
1042 m_nSize = tagAry.m_nSize;
1043 }
1045
1046 if (tagAry.m_pArray)
1047 m_pArray = tagAry.m_pArray->NewCopy(this);
1048 else
1049 m_pArray = NULL;
1050}
1051
1052/**
1053******************************************************************************
1054* Name: &operator=
1055*
1056* Purpose:
1057*
1058* Args:
1059*
1060* Return:
1061******************************************************************************/
1063{
1064 if (&tagAry == this)
1065 return *this;
1066
1067 Cleanup();
1068
1069 if (tagAry.m_nSize) {
1070 m_TagVals = new IccTagPtr[tagAry.m_nSize];
1071
1073 for (i=0; i<m_nSize; i++) {
1074 if (tagAry.m_TagVals[i].ptr)
1075 m_TagVals[i].ptr = tagAry.m_TagVals[i].ptr->NewCopy();
1076 else
1077 m_TagVals[i].ptr = NULL;
1078 }
1079 m_nSize = tagAry.m_nSize;
1080 }
1081
1083
1084 if (tagAry.m_pArray)
1085 m_pArray = tagAry.m_pArray->NewCopy(this);
1086 else
1087 m_pArray = NULL;
1088
1089 return *this;
1090}
1091
1092/**
1093******************************************************************************
1094* Name: CIccTagArray::~CIccTagArray
1095*
1096* Purpose:
1097*
1098* Args:
1099*
1100* Return:
1101******************************************************************************/
1106
1107
1108/**
1109******************************************************************************
1110* Name: CIccTagArray::~SetTagArrayType
1111*
1112* Purpose:
1113* Set the signature of the tag array type. This also sets the m_pArray
1114* to allow array type specific handling to be utilized.
1115*
1116* Args:
1117* sig - signature of array type
1118*
1119* Return:
1120* true if sig is a recognized array type, false otherwise
1121******************************************************************************/
1132
1133
1134/**
1135******************************************************************************
1136* Name: CIccTagArray::AreAllOftype
1137*
1138* Purpose:
1139* checks if all array elements have type signature sigTagType
1140* Args:
1141* sigTagType
1142* Return:
1143* true if all elements are of type sigTagType, false otherwise
1144******************************************************************************/
1146{
1148 for (i=0; i<m_nSize; i++) {
1149 CIccTag *pTag = GetIndex(i);
1150 if (!pTag || pTag->GetType()!=sigTagType)
1151 return false;
1152 }
1153
1154 return true;
1155}
1156
1157
1158/**
1159******************************************************************************
1160* Name: CIccTagArray::Describe
1161*
1162* Purpose:
1163*
1164* Args:
1165*
1166* Return:
1167******************************************************************************/
1168void CIccTagArray::Describe(std::string &sDescription, int nVerboseness)
1169{
1170 std::string name;
1171 icChar buf[128];
1172 CIccInfo info;
1173
1174 IIccArray *pArrayObj = GetArrayHandler();
1176
1177 sDescription += "BEGIN TAG_ARRAY \"";
1178 sDescription += name;
1179 sDescription += "\"\n\n";
1180
1182
1183 for (i=0; i<m_nSize; i++) {
1184 if (i)
1185 sDescription += "\n";
1186 sprintf(buf, "BEGIN INDEX[%d]\n", i);
1187 sDescription += buf;
1188
1189 if (m_TagVals[i].ptr) {
1190 m_TagVals[i].ptr->Describe(sDescription, nVerboseness);
1191 }
1192 sprintf(buf, "END INDEX[%d]\n", i);
1193 sDescription += buf;
1194 }
1195
1196 sDescription += "\n";
1197 sDescription += "END TAG_ARRAY \"";
1198 sDescription += name;
1199 sDescription += "\"\n";
1200}
1201
1202
1203/**
1204******************************************************************************
1205* Name: CIccTagArray::Read
1206*
1207* Purpose:
1208*
1209* Args:
1210*
1211* Return:
1212******************************************************************************/
1214{
1216
1217 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
1218 sizeof(icUInt32Number) +
1219 sizeof(icTagTypeSignature) +
1220 sizeof(icStructSignature) +
1221 sizeof(icUInt32Number);
1222
1223 if (headerSize > size)
1224 return false;
1225
1226 if (!pIO) {
1227 return false;
1228 }
1229
1230 Cleanup();
1231
1232 icUInt32Number nTagStart = pIO->Tell();
1233
1234 if (!pIO->Read32(&sig))
1235 return false;
1236
1237 icArraySignature sigArrayType;
1238
1239 if (!pIO->Read32(&m_nReserved) ||
1240 !pIO->Read32(&sigArrayType))
1241 return false;
1242
1243 SetTagArrayType(sigArrayType);
1244
1245 icUInt32Number count, i, j;
1246 IccTagEntry TagEntry;
1247
1248 TagEntry.pTag = NULL;
1249
1250 if (!pIO->Read32(&count))
1251 return false;
1252
1253 if (headerSize + count*sizeof(icPositionNumber) > size)
1254 return false;
1255
1256 if (count) {
1257 icPositionNumber *tagPos = new icPositionNumber[count];
1258
1259 if (!SetSize(count)) {
1260 delete[] tagPos;
1261 return false;
1262 }
1263
1264 for (i=0; i<count; i++) {
1265 if (!pIO->Read32(&tagPos[i].offset) ||
1266 !pIO->Read32(&tagPos[i].size)) {
1267 delete [] tagPos;
1268 return false;
1269 }
1270 }
1271
1272 for (i=0; i<count; i++) {
1273 if (!tagPos[i].offset || !tagPos[i].size) {
1274 m_TagVals[i].ptr = NULL;
1275 continue;
1276 }
1277
1278 for (j=0; j<i; j++) {
1279 if (tagPos[i].offset == tagPos[j].offset)
1280 break;
1281 }
1282
1283 if (j<i) {
1284 m_TagVals[i].ptr = m_TagVals[j].ptr;
1285 }
1286 else {
1287 if (tagPos[i].offset + tagPos[i].size > size) {
1288 delete [] tagPos;
1289 return false;
1290 }
1291 pIO->Seek(nTagStart + tagPos[i].offset, icSeekSet);
1292
1293 icTagTypeSignature tagSig;
1294 pIO->Read32(&tagSig);
1295 pIO->Seek(nTagStart + tagPos[i].offset, icSeekSet);
1296
1297 CIccTag *pTag = CIccTagCreator::CreateTag(tagSig);
1298 if (pTag) {
1299 if (!pTag->Read(tagPos[i].size, pIO)) {
1300 delete [] tagPos;
1301 return false;
1302 }
1303 m_TagVals[i].ptr = pTag;
1304 }
1305 else {
1306 delete [] tagPos;
1307 return false;
1308 }
1309 }
1310 }
1311
1312 delete [] tagPos;
1313 }
1314
1315 return true;
1316}
1317
1318/**
1319******************************************************************************
1320* Name: CIccTagArray::Write
1321*
1322* Purpose:
1323*
1324* Args:
1325*
1326* Return:
1327******************************************************************************/
1329{
1331
1332 if (!pIO)
1333 return false;
1334
1335 icUInt32Number nTagStart = pIO->Tell();
1336
1337 if (!pIO->Write32(&sig))
1338 return false;
1339
1340 if (!pIO->Write32(&m_nReserved))
1341 return false;
1342
1343 if (!pIO->Write32(&m_sigArrayType))
1344 return false;
1345
1346 if (!pIO->Write32(&m_nSize))
1347 return false;
1348
1349 if (m_nSize) {
1350 icUInt32Number i, j;
1351
1352 icUInt32Number pos = pIO->Tell();
1353
1354 //Write Unintialized TagPosition block
1355 icUInt32Number zero = 0;
1356 for (i=0; i<m_nSize; i++) {
1357 if (!pIO->Write32(&zero) || !pIO->Write32(&zero))
1358 return false;
1359 }
1361 if (!tagPos)
1362 return false;
1363
1364 //Write Tags
1365 for (i=0; i<m_nSize; i++) {
1366 if (m_TagVals[i].ptr) {
1367 for (j=0; j<i; j++) {
1368 if (m_TagVals[i].ptr==m_TagVals[j].ptr)
1369 break;
1370 }
1371
1372 if (j<i) {
1373 tagPos[i].offset = tagPos[j].offset;
1374 tagPos[i].size = tagPos[j].offset;
1375 }
1376 else {
1377 tagPos[i].offset = pIO->Tell() - nTagStart;
1378 if (!m_TagVals[i].ptr->Write(pIO)) {
1379 delete [] tagPos;
1380 return false;
1381 }
1382 tagPos[i].size = pIO->Tell() - nTagStart - tagPos[i].offset;
1383 pIO->Align32();
1384 }
1385 }
1386 else {
1387 tagPos[i].offset = 0;
1388 tagPos[i].size = 0;
1389 }
1390 }
1391 icUInt32Number endPos = pIO->Tell();
1392
1393 //Update TagPosition block
1394 pIO->Seek(pos, icSeekSet);
1395 for (i=0; i<m_nSize; i++) {
1396 if (!pIO->Write32(&tagPos[i].offset) ||
1397 !pIO->Write32(&tagPos[i].size)) {
1398 delete [] tagPos;
1399 return false;
1400 }
1401 }
1402 pIO->Seek(endPos, icSeekSet);
1403 }
1404
1405 return true;
1406}
1407
1408
1409/**
1410 ****************************************************************************
1411 * Name: CIccTagArray::SetSize
1412 *
1413 * Purpose: Sets the size of the tag array.
1414 *
1415 * Args:
1416 * nSize - number of tag entries,
1417 *****************************************************************************
1418 */
1420{
1421 if (!m_nSize) {
1422 m_TagVals = (IccTagPtr*)calloc(nSize, sizeof(IccTagPtr));
1423 if (!m_TagVals) {
1424 m_nSize =0;
1425 return false;
1426 }
1427 }
1428 else {
1429 if (nSize<=m_nSize)
1430 return true;
1431
1432 m_TagVals = (IccTagPtr*)icRealloc(m_TagVals, nSize*sizeof(IccTagPtr));
1433 if (!m_TagVals) {
1434 m_nSize = 0;
1435 return false;
1436 }
1437 memset(&m_TagVals[m_nSize], 0, (nSize-m_nSize)*sizeof(IccTagPtr));
1438 }
1439 m_nSize = nSize;
1440 return true;
1441}
1442
1443
1444/**
1445******************************************************************************
1446* Name: CIccTagArray::Validate
1447*
1448* Purpose:
1449*
1450* Args:
1451*
1452* Return:
1453******************************************************************************/
1454icValidateStatus CIccTagArray::Validate(std::string sigPath, std::string &sReport,
1455 const CIccProfile* pProfile /*=NULL*/) const
1456{
1457 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
1458
1459 CIccInfo Info;
1460 std::string sigAryPath = sigPath + icGetSigPath(m_sigArrayType);
1461
1462 if (m_pArray) { //Should call GetArrayHandler before validate to get
1463 rv = icMaxStatus(rv, m_pArray->Validate(sigPath, sReport, pProfile));
1464 }
1465 else if (m_sigArrayType==icSigUtf8TextTypeArray) { //UTF8 text arrays are known
1466 //Check # of channels
1468 pProfile &&
1469 m_nSize != icGetMaterialColorSpaceSamples(pProfile->m_Header.mcs)) {
1470 std::string sSigPathName = Info.GetSigPathName(sigPath);
1471
1472 sReport += icMsgValidateCriticalError;
1473 sReport += sSigPathName;
1474 sReport += " - Number of material channel names does not match MCS in header.\n";
1476 }
1478 for (i=0; i<m_nSize; i++) {
1479 rv = icMaxStatus(rv, m_TagVals[i].ptr->Validate(sigAryPath, sReport, pProfile));
1480 }
1481 }
1482 else {
1484 sReport += "Unknown tag array type - Validating array sub-tags\n";
1486
1487 for (i=0; i<m_nSize; i++) {
1488 rv = icMaxStatus(rv, m_TagVals[i].ptr->Validate(sigAryPath, sReport, pProfile));
1489 }
1490 }
1491
1492 return rv;
1493}
1494
1495/**
1496***************************************************************************
1497* Name: CIccTagArray::Cleanup
1498*
1499* Purpose: Detach from a pending IO object
1500***************************************************************************
1501*/
1503{
1504 icUInt32Number i, j;
1505 CIccTag* pTag;
1506
1507 for (i=0; i<m_nSize; i++) {
1508 pTag = m_TagVals[i].ptr;
1509 if (pTag) {
1510 for (j=i+1; j<m_nSize; j++) {
1511 if (m_TagVals[i].ptr==pTag)
1512 m_TagVals[i].ptr = NULL;
1513 }
1514 delete pTag;
1515 m_TagVals[i].ptr = NULL;
1516 }
1517 }
1518
1519 delete [] m_TagVals;
1520
1521 if (m_pArray)
1522 delete m_pArray;
1523
1524 m_pArray = NULL;
1526}
1527
1528/**
1529****************************************************************************
1530* Name: CIccTagArray::GetIndex
1531*
1532* Purpose: Get a tag entry with a given index
1533*
1534* Args:
1535* nIndex - index of tag in array
1536*
1537* Return:
1538* Pointer to desired tag entry, or NULL if not found.
1539*****************************************************************************
1540*/
1542{
1543 if (nIndex>m_nSize)
1544 return NULL;
1545
1546 return m_TagVals[nIndex].ptr;
1547}
1548
1549
1550/**
1551****************************************************************************
1552* Name: CIccTagArray::AttachTag
1553*
1554* Purpose: Get a tag entry with a given signature
1555*
1556* Args:
1557* nIndex - index of tag in array
1558*
1559* Return:
1560* Pointer to desired tag struct entry, or NULL if not found.
1561*****************************************************************************
1562*/
1564{
1565 if (nIndex>m_nSize || !pTag) {
1566 return false;
1567 }
1568
1569 if (m_TagVals[nIndex].ptr && m_TagVals[nIndex].ptr != pTag) {
1570 return false;
1571 }
1572
1573 m_TagVals[nIndex].ptr = pTag;
1574 return true;
1575}
1576
1577
1578/**
1579****************************************************************************
1580* Name: CIccTagArray::DetachTag
1581*
1582* Purpose: Detach tag value at given index
1583*
1584* Args:
1585* nIndex - index of tag in array
1586* bDeleteFlag - flag indicating detached tag should be deleted
1587*
1588* Return:
1589* Pointer to Detached tag struct entry, or NULL if not found or deleted.
1590*****************************************************************************
1591*/
1593{
1594 if (nIndex>m_nSize)
1595 return NULL;
1596
1597 CIccTag *rv = m_TagVals[nIndex].ptr;
1598 m_TagVals[nIndex].ptr = NULL;
1599
1600 if (bDeleteFlag) {
1601 delete rv;
1602 rv = NULL;
1603 }
1604
1605 return rv;
1606}
1607
1608
1609/**
1610****************************************************************************
1611* Name: CIccTagArray::GetArrayHandler
1612*
1613* Purpose: Get Array object handler
1614*
1615* Args:
1616*
1617* Return:
1618* Pointer to an Array object handler for the associated array type
1619*****************************************************************************
1620*/
1622{
1623 if (!m_pArray) {
1625 }
1626
1627 return m_pArray;
1628}
1629
1630
1632{
1633 if (!pTag)
1634 return NULL;
1635 if (pTag->GetType()!=icSigTagStructType)
1636 return NULL;
1637
1638 CIccTagStruct *pStruct = (CIccTagStruct*)pTag;
1639
1640 return pStruct->GetStructHandler();
1641}
1642
1644{
1645 if (pTag->GetTagStructType()==sig)
1646 return icGetTagStructHandler(pTag);
1647
1648 return NULL;
1649}
1650
1652{
1653 if (!pTag)
1654 return NULL;
1655 if (pTag->GetType()!=icSigTagArrayType)
1656 return NULL;
1657
1658 CIccTagArray *pArray = (CIccTagArray*)pTag;
1659
1660 return pArray->GetArrayHandler();
1661}
1662
1664{
1665 if (pTag->GetTagArrayType()==sig)
1666 return icGetTagArrayHandler(pTag);
1667
1668 return NULL;
1669}
1670
icArraySignature sig
File: IccArrayFactory.h.
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100
char icChar
Definition IccDefs.h:109
icValidateStatus
Definition IccDefs.h:118
@ icValidateWarning
Definition IccDefs.h:120
@ icValidateCriticalError
Definition IccDefs.h:122
File: IccIO.h.
@ icSeekSet
Definition IccIO.h:83
File: IccStructBasic.h.
File: IccStructFactory.h.
IIccArray * icGetTagArrayHandlerOfType(CIccTag *pTag, icArraySignature sig)
IIccArray * icGetTagArrayHandler(CIccTag *pTag)
IIccStruct * icGetTagStructHandlerOfType(CIccTag *pTag, icStructSignature sig)
IIccStruct * icGetTagStructHandler(CIccTag *pTag)
File: IccTagComposite.h.
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
void * icRealloc(void *ptr, size_t size)
Name: icRealloc.
Definition IccUtil.cpp:111
icUInt32Number icGetMaterialColorSpaceSamples(icMaterialColorSignature sig)
Definition IccUtil.cpp:1391
const char * icMsgValidateCriticalError
Definition IccUtil.cpp:92
icSignature icGetFirstSigPathSig(std::string sigPath)
Definition IccUtil.cpp:1201
File: IccUtil.h.
icTagTypeSignature
unsigned int icUInt32Number
static IIccArray * CreateArray(icArraySignature arrayTypeSig, CIccTagArray *pTagArray=NULL)
Function: CreateArray(structTypeSig) Create a element of type structTypeSig.
static bool GetArraySigName(std::string &arrayName, icArraySignature arrayTypeSig, bool bFillUnknown=true)
Function: GetArraySigName(structTypeSig) Get display name of structTypeSig.
Type: Class.
Definition IccIO.h:97
virtual icInt32Number GetLength()
Definition IccIO.h:130
virtual icInt32Number Tell()
Definition IccIO.h:133
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 icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
Definition IccIO.h:132
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
Type: Class.
Definition IccUtil.h:303
const icChar * GetStructSigName(icStructSignature sig)
Definition IccUtil.cpp:1504
std::string GetSigPathName(std::string sigPath)
Definition IccUtil.cpp:1614
Type: Class.
Definition IccIO.h:217
bool Attach(icUInt8Number *pData, icUInt32Number nSize, bool bWrite=false)
Definition IccIO.cpp:686
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.
virtual void Describe(std::string &sDescription, int nVerboseness) const
Class: CIccTagArray.
bool AreAllOfType(icTagTypeSignature sigTagType)
Name: CIccTagArray::AreAllOftype.
icArraySignature m_sigArrayType
icUInt32Number m_nSize
CIccTagArray & operator=(const CIccTagArray &lut)
Name: &operator=.
bool AttachTag(icUInt32Number nIndex, CIccTag *pTag)
Name: CIccTagArray::AttachTag.
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagArray::Describe.
CIccTag * DetachTag(icUInt32Number nIndex, bool bDeleteFlag=false)
Name: CIccTagArray::DetachTag.
virtual bool SetTagArrayType(icArraySignature sig)
Name: CIccTagArray::~SetTagArrayType.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagArray::Read.
bool SetSize(icUInt32Number nSize)
Name: CIccTagArray::SetSize.
IIccArray * GetArrayHandler()
Name: CIccTagArray::GetArrayHandler.
CIccTag * GetIndex(icUInt32Number index) const
Name: CIccTagArray::GetIndex.
virtual ~CIccTagArray()
Name: CIccTagArray::~CIccTagArray.
virtual bool Write(CIccIO *pIO)
Name: CIccTagArray::Write.
IccTagPtr * m_TagVals
IIccArray * m_pArray
virtual icTagTypeSignature GetType() const
Function: GetType()
CIccTagArray()
Name: CIccTagArray::CIccTagArray.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccTagArray::Validate.
void Cleanup()
Name: CIccTagArray::Cleanup.
static CIccTag * CreateTag(icTagTypeSignature tagTypeSig)
Function: CreateTag(tagTypeSig) Create a tag of type tagTypeSig.
Class: CIccTag.
virtual icTagTypeSignature GetType() const
Function: GetType()
icUInt32Number m_nReserved
static CIccTag * Create(icTagTypeSignature sig)
Name: CIccTag::Create.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Function: Read(size, pIO) - Read tag from file.
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.
virtual bool IsNumArrayType() const
virtual icArraySignature GetTagArrayType() const
virtual icStructSignature GetTagStructType() const
Class: CIccTagNumArray.
virtual bool GetValues(icFloatNumber *DstVector, icUInt32Number nStart=0, icUInt32Number nVectorSize=1) const =0
Class: CIccTagStruct.
bool AttachElem(icSignature sig, CIccTag *pTag)
Name: CIccTagStruct::AttachTag.
bool AreElemsUnique() const
Name: CIccTagStruct::AreElemsUnique.
CIccTag * FindElemOfType(icSignature sig, icTagTypeSignature sigType)
Name: CIccTagStruct::FindElemOfType.
static CIccTagStruct * ParseMem(icUInt8Number *pMem, icUInt32Number size)
Name: CIccTagStruct::ParseMem.
icUInt32Number m_tagSize
TagEntryList * m_ElemEntries
virtual void Describe(std::string &sDescription, int nVerboseness)
Name: CIccTagStruct::Describe.
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
Name: CIccTagStruct::Validate.
icFloatNumber GetElemNumberValue(icSignature sig, icFloatNumber defaultValue=0)
Name: CIccTagStruct::GetElemNumberValue.
bool DetachElem(CIccTag *pTag)
Name: CIccTagStruct::DetachSubTag.
virtual bool SetTagStructType(icStructSignature sig)
Name: CIccTagStruct::SetTagStructType.
CIccTagStruct & operator=(const CIccTagStruct &lut)
Name: &operator=.
bool DeleteElem(icSignature sig)
Name: CIccTagStruct::DeleteSubTag.
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Name: CIccTagStruct::Read.
TagEntryList * GetElemList()
icStructSignature m_sigStructType
virtual icStructSignature GetTagStructType() const
IIccStruct * GetStructHandler()
Name: CIccTagStruct::GetStructHandler.
TagPtrList * m_ElemVals
virtual ~CIccTagStruct()
Name: CIccTagStruct::~CIccTagStruct.
CIccTag * FindElem(icSignature sig)
Name: CIccTagStruct::FindElem.
virtual bool Write(CIccIO *pIO)
Name: CIccTagStruct::Write.
icUInt32Number m_tagStart
IIccStruct * m_pStruct
CIccTagStruct()
Name: CIccTagStruct::CIccTagStruct.
bool LoadElem(IccTagEntry *pTagEntry, CIccIO *pIO)
Name: CIccTagStruct::LoadSubTag.
IccTagEntry * GetElem(icSignature sig) const
Name: CIccTagStruct::GetElem.
void Cleanup()
Name: CIccTagStruct::Cleanup.
virtual icTagTypeSignature GetType() const
Function: GetType()
Class: IIccArray.
virtual IIccArray * NewCopy(CIccTagArray *pNewTagArray) const =0
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const =0
Class: IIccStruct.
virtual void Describe(std::string &sDescription, int nVerboseness) const
virtual IIccStruct * NewCopy(CIccTagStruct *pNewTagStruct) const =0
CIccTagStruct * m_pTagStruct
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const =0
TagEntryList * getTagEntries() const
unsigned char icUInt8Number
Number definitions.
#define icSigUnknownArray
Convenience Enum Definitions - Not defined in ICC specification.
icUInt32Number icSignature
@ icSigTagArrayType
@ icSigTagStructType
icStructSignature
Tag Structure type signatures.
@ icSigUndefinedStruct
icUInt32Number icUInt64Number[2]
icArraySignature
Tag Array type signatures.
@ icSigUtf8TextTypeArray
@ icSigUndefinedArray
icTagSignature
public tags and sizes
@ icSigMaterialTypeArrayTag
icUInt32Number offset
icUInt32Number size
Lists of tags, tags, profile header and profile structure.