Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccTagComposite.h
Go to the documentation of this file.
1/** @file
2File: IccTagComposite.h
3
4Contains: Header for implementation of CIccTagStruct and CIccTagArray
5and supporting classes
6
7Version: V1
8
9Copyright: (c) see ICC Software License
10*/
11
12/*
13* The ICC Software License, Version 0.2
14*
15*
16* Copyright (c) 2003-2012 The International Color Consortium. All rights
17* reserved.
18*
19* Redistribution and use in source and binary forms, with or without
20* modification, are permitted provided that the following conditions
21* are met:
22*
23* 1. Redistributions of source code must retain the above copyright
24* notice, this list of conditions and the following disclaimer.
25*
26* 2. Redistributions in binary form must reproduce the above copyright
27* notice, this list of conditions and the following disclaimer in
28* the documentation and/or other materials provided with the
29* distribution.
30*
31* 3. In the absence of prior written permission, the names "ICC" and "The
32* International Color Consortium" must not be used to imply that the
33* ICC organization endorses or promotes products derived from this
34* software.
35*
36*
37* THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
38* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
39* OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
40* DISCLAIMED. IN NO EVENT SHALL THE INTERNATIONAL COLOR CONSORTIUM OR
41* ITS CONTRIBUTING MEMBERS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
42* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
43* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
44* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
45* ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
46* OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
47* OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
48* SUCH DAMAGE.
49* ====================================================================
50*
51* This software consists of voluntary contributions made by many
52* individuals on behalf of the The International Color Consortium.
53*
54*
55* Membership in the ICC is encouraged when this software is used for
56* commercial purposes.
57*
58*
59* For more information on The International Color Consortium, please
60* see <http://www.color.org/>.
61*
62*
63*/
64
65//////////////////////////////////////////////////////////////////////
66// HISTORY:
67//
68// -June 8, 2011
69// Initial prototype development
70//
71//////////////////////////////////////////////////////////////////////
72
73#ifndef _ICCTAGCOMPOSITE_H
74#define _ICCTAGCOMPOSITE_H
75
76#include "IccProfile.h"
77#include "IccTag.h"
78#include "IccDefs.h"
79#include <memory>
80#include <list>
81
82#ifdef USEREFICCMAXNAMESPACE
83namespace refIccMAX {
84#endif
85
86class CIccTagStruct;
87class CIccTagArray;
88
89/**
90****************************************************************************
91* Class: IIccStruct
92*
93* Purpose: The interface for Tag Struct handler
94*****************************************************************************
95*/
97{
98public:
99 virtual ~IIccStruct() {}
100 virtual IIccStruct* NewCopy(CIccTagStruct *pNewTagStruct) const = 0;
101
102 virtual void Describe(std::string &sDescription, int nVerboseness) const;
103
104 virtual const icChar *GetClassName() const = 0;
105 virtual const icChar *GetDisplayName() const = 0;
106
107 CIccTagStruct* GetTagStruct() { return m_pTagStruct; }
108
109 virtual std::string GetElemName(icSignature sigElem) const = 0;
110 virtual icSignature GetElemSig(const icChar *szElemName) const = 0;
111
112 virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile* pProfile = NULL) const = 0;
113
114protected:
115
116 TagEntryList *getTagEntries() const;
117
119};
120
121
122/**
123****************************************************************************
124* Class: IIccArray
125*
126* Purpose: The interface for Tag Array handler
127*****************************************************************************
128*/
130{
131public:
132 virtual ~IIccArray() {}
133 virtual IIccArray* NewCopy(CIccTagArray *pNewTagArray) const = 0;
134
135 virtual void Describe(std::string &sDescription, int nVerboseness) const { }
136
137 virtual const icChar *GetClassName() const = 0;
138
139 virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile* pProfile=NULL) const = 0;
140
141 CIccTagArray* GetTagArray() { return m_pTagArray; }
142
143protected:
145};
146
147
148/**
149****************************************************************************
150* Class: CIccTagStruct
151*
152* Purpose: The general purpose Tag Struct type tag
153*****************************************************************************
154*/
156{
157 friend class IIccStruct;
158public:
160 CIccTagStruct(const CIccTagStruct &lut);
161 CIccTagStruct &operator=(const CIccTagStruct &lut);
162 virtual CIccTag *NewCopy() const { return new CIccTagStruct(*this);}
163 virtual ~CIccTagStruct();
164
165 static CIccTagStruct *ParseMem(icUInt8Number *pMem, icUInt32Number size);
166
168 virtual icStructSignature GetTagStructType() const { return m_sigStructType; }
169
170 virtual bool SetTagStructType(icStructSignature sig);
171
172 virtual const icChar *GetClassName() const { return "CIccTagStruct"; }
173
174 virtual void Describe(std::string &sDescription, int nVerboseness);
175
176 virtual bool Read(icUInt32Number size, CIccIO *pIO);
177 virtual bool Write(CIccIO *pIO);
178
179 virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile* pProfile=NULL) const;
180
181 TagEntryList *GetElemList() { return m_ElemEntries; }
182
183 CIccTag* FindElem(icSignature sig);
184 CIccTag* FindElemOfType(icSignature sig, icTagTypeSignature sigType);
185
186 icFloatNumber GetElemNumberValue(icSignature sig, icFloatNumber defaultValue=0);
187
188 bool AttachElem(icSignature sig, CIccTag *pTag);
189 bool DeleteElem(icSignature sig);
190
191 bool AreElemsUnique() const;
192
193 static std::string GetElemName(icTagSignature sig, icStructSignature sigThis);
194
195 IIccStruct *GetStructHandler();
196
197protected:
198 IIccStruct *m_pStruct; //Note: The CIccTagStruct will delete the m_pStruct in destructor
199
200 void Cleanup();
201 IccTagEntry* GetElem(icSignature sig) const;
202 IccTagEntry* GetElem(CIccTag *pTag) const;
203
204 bool LoadElem(IccTagEntry *pTagEntry, CIccIO *pIO);
205 bool DetachElem(CIccTag *pTag);
206
208
211
212 TagEntryList *m_ElemEntries;
213
214 TagPtrList *m_ElemVals;
215};
216
217
218/**
219****************************************************************************
220* Class: CIccTagArray
221*
222* Purpose: The Tag Array tag
223*****************************************************************************
224*/
226{
227public:
228 CIccTagArray();
229 CIccTagArray(icArraySignature sigArrayType);
230 CIccTagArray(const CIccTagArray &lut);
231 CIccTagArray &operator=(const CIccTagArray &lut);
232 virtual CIccTag *NewCopy() const { return new CIccTagArray(*this);}
233 virtual ~CIccTagArray();
234
236
237 virtual icTagTypeSignature GetType() const { return icSigTagArrayType; }
238 virtual icArraySignature GetTagArrayType() const { return m_sigArrayType; }
239
240 virtual bool SetTagArrayType(icArraySignature sig);
241
242 bool AreAllOfType(icTagTypeSignature sigTagType);
243
244 virtual const icChar *GetClassName() const { return "CIccTagArray"; }
245
246 virtual void Describe(std::string &sDescription, int nVerboseness);
247
248 virtual bool Read(icUInt32Number size, CIccIO *pIO);
249 virtual bool Write(CIccIO *pIO);
250
251 virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile* pProfile=NULL) const;
252
253 bool AttachTag(icUInt32Number nIndex, CIccTag *pTag);
254 CIccTag * DetachTag(icUInt32Number nIndex, bool bDeleteFlag=false);
255
256 CIccTag *GetIndex(icUInt32Number index) const;
257 CIccTag *operator[](icUInt32Number index) const { return GetIndex(index); }
258
259 /// Returns the size of the data array
260 icUInt32Number GetSize() const { return m_nSize; }
261 bool SetSize(icUInt32Number nSize);
262
263 IIccArray* GetArrayHandler();
264
265protected:
266 IIccArray *m_pArray; //Note: The CIccTagArray will delete the m_pArray in destructor
267
268 void Cleanup();
269
271
273 IccTagPtr *m_TagVals;
274};
275
280
281
282#ifdef USEREFICCMAXNAMESPACE
283}
284#endif
285
286#endif //_ICCTAGCOMPOSITE_H
icArraySignature sig
File: IccDefs.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
#define ICCPROFLIB_API
File: IccProfile.h.
File: IccTag.h.
IIccArray * icGetTagArrayHandlerOfType(CIccTag *pTag, icArraySignature sig)
IIccArray * icGetTagArrayHandler(CIccTag *pTag)
IIccStruct * icGetTagStructHandlerOfType(CIccTag *pTag, icStructSignature sig)
IIccStruct * icGetTagStructHandler(CIccTag *pTag)
icTagTypeSignature
unsigned int icUInt32Number
Type: Class.
Definition IccIO.h:97
Class: CIccTagArray.
icArraySignature m_sigArrayType
icUInt32Number m_nSize
virtual CIccTag * NewCopy() const
Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
CIccTag * operator[](icUInt32Number index) const
static CIccTagArray * ParseMem(icUInt8Number *pMem, icUInt32Number size)
IccTagPtr * m_TagVals
virtual const icChar * GetClassName() const
icUInt32Number GetSize() const
Returns the size of the data array.
IIccArray * m_pArray
virtual icTagTypeSignature GetType() const
Function: GetType()
virtual icArraySignature GetTagArrayType() const
Class: CIccTag.
Class: CIccTagStruct.
icUInt32Number m_tagSize
TagEntryList * m_ElemEntries
static std::string GetElemName(icTagSignature sig, icStructSignature sigThis)
TagEntryList * GetElemList()
icStructSignature m_sigStructType
virtual icStructSignature GetTagStructType() const
TagPtrList * m_ElemVals
virtual const icChar * GetClassName() const
icUInt32Number m_tagStart
IIccStruct * m_pStruct
virtual icTagTypeSignature GetType() const
Function: GetType()
virtual CIccTag * NewCopy() const
Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
Class: IIccArray.
CIccTagArray * GetTagArray()
virtual IIccArray * NewCopy(CIccTagArray *pNewTagArray) const =0
CIccTagArray * m_pTagArray
virtual ~IIccArray()
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const =0
virtual void Describe(std::string &sDescription, int nVerboseness) const
virtual const icChar * GetClassName() const =0
Class: IIccStruct.
virtual ~IIccStruct()
virtual const icChar * GetClassName() const =0
virtual IIccStruct * NewCopy(CIccTagStruct *pNewTagStruct) const =0
virtual std::string GetElemName(icSignature sigElem) const =0
CIccTagStruct * m_pTagStruct
virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const =0
CIccTagStruct * GetTagStruct()
virtual icSignature GetElemSig(const icChar *szElemName) const =0
virtual const icChar * GetDisplayName() const =0
unsigned char icUInt8Number
Number definitions.
icUInt32Number icSignature
@ icSigTagArrayType
@ icSigTagStructType
icStructSignature
Tag Structure type signatures.
icArraySignature
Tag Array type signatures.
icTagSignature
public tags and sizes