Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccTagDict.h
Go to the documentation of this file.
1/** @file
2File: IccTagDictTag.h
3
4Contains: Header for implementation of CIccTagDict
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// -Jun 26, 2009
69// Initial CIccDictTag prototype development
70//
71//////////////////////////////////////////////////////////////////////
72
73#ifndef _ICCTAGSUBTAG_H
74#define _ICCTAGSUBTAG_H
75
76#include "IccProfile.h"
77#include "IccTag.h"
78#include "IccTagFactory.h"
79#include <memory>
80#include <list>
81#include <string>
82
83#ifdef USEREFICCMAXNAMESPACE
84namespace refIccMAX {
85#endif
86
87
88/**
89****************************************************************************
90* Data Class: CIccDictEntry
91*
92* Purpose: Implementation of a dictionary entry with optional localization of
93* name and value
94*****************************************************************************
95*/
97{
98public: //member functions
100 CIccDictEntry(const CIccDictEntry& IDE);
101 CIccDictEntry &operator=(const CIccDictEntry &IDE);
102 virtual ~CIccDictEntry();
103
104 void Describe(std::string &sDescription, int nVerboseness);
105
106 icUInt32Number PosRecSize();
107
108 //Data
109 std::wstring &GetName() { return *m_sName; }
110
111 std::wstring::const_iterator ValueBegin() {return m_sValue->begin();}
112 std::wstring::const_iterator ValueEnd() {return m_sValue->end();}
113
114 std::wstring GetValue() { return *m_sValue; }
115 bool IsValueSet() { return m_bValueSet; }
116
117 //GetNameLocalized and GetValueLocalized both give direct access to objects owned by the CIccDirEntry object
118 CIccTagMultiLocalizedUnicode* GetNameLocalized() { return m_pNameLocalized; }
119 CIccTagMultiLocalizedUnicode* GetValueLocalized() { return m_pValueLocalized; }
120
121 void UnsetValue() { m_sValue->clear(); m_bValueSet = false; }
122 bool SetValue(std::wstring sValue);
123
124 //SetNameLocalized and SetValueLocalized both transfer ownership of the argument to the CIccDirEntry object
125 //deleting access to previous object
126 bool SetNameLocalized(CIccTagMultiLocalizedUnicode *pNameLocalized);
127 bool SetValueLocalized(CIccTagMultiLocalizedUnicode *pValueLocalized);
128
129protected:
130 std::wstring *m_sName;
131 std::wstring *m_sValue;
133
136};
137
139{
140public:
142};
143
144/**
145****************************************************************************
146* List Class: CIccDictEntry
147*
148* Purpose: Dictionary is stored as a List of CIccDictEntry objects
149*****************************************************************************
150*/
151typedef std::list<CIccDictEntryPtr> CIccNameValueDict;
152
153/**
154****************************************************************************
155* Class: CIccTagDict
156*
157* Purpose: A name-value dictionary tag with optional localization
158*****************************************************************************
159*/
161{
162public:
163 CIccTagDict();
164 CIccTagDict(const CIccTagDict &dict);
165 CIccTagDict &operator=(const CIccTagDict &dict);
166 virtual CIccTag *NewCopy() const { return new CIccTagDict(*this);}
167 virtual ~CIccTagDict();
168
169 virtual icTagTypeSignature GetType() const { return icSigDictType; }
170 virtual const icChar *GetClassName() const { return "CIccTagDict"; }
171
172 virtual void Describe(std::string &sDescription, int nVerboseness);
173
174 virtual bool Read(icUInt32Number size, CIccIO *pIO);
175 virtual bool Write(CIccIO *pIO);
176
177 virtual icValidateStatus Validate(std::string sigPath, std::string &sReport, const CIccProfile* pProfile=NULL) const;
178
179 bool AreNamesUnique() const;
180 bool AreNamesNonzero() const;
181
182 CIccDictEntry *Get(const char *szName) const;
183 CIccDictEntry *Get(const icUInt16Number *szName) const;
184 CIccDictEntry *Get(std::wstring sName) const;
185
186 std::wstring GetValue(const char *szName, bool *bIsSet=NULL) const;
187 std::wstring GetValue(const icUnicodeChar *szName, bool *bIsSet=NULL) const;
188 std::wstring GetValue(std::wstring sName, bool *bIsSet=NULL) const;
189
190 CIccTagMultiLocalizedUnicode* GetNameLocalized(std::wstring sName) const;
191 CIccTagMultiLocalizedUnicode* GetNameLocalized(const icUnicodeChar *szName) const;
192 CIccTagMultiLocalizedUnicode* GetNameLocalized(const char *szName) const;
193
194 CIccTagMultiLocalizedUnicode* GetValueLocalized(std::wstring sName) const;
195 CIccTagMultiLocalizedUnicode* GetValueLocalized(const icUnicodeChar *szName) const;
196 CIccTagMultiLocalizedUnicode* GetValueLocalized(const char *szName) const;
197
198 bool Remove(std::wstring sName);
199 bool Remove(const icUnicodeChar *szName);
200 bool Remove(const char *szName);
201
202 bool Set(const char *szName, const char *szValue=NULL);
203 bool Set(const icUnicodeChar *szName, const icUnicodeChar *szValue=NULL);
204 bool Set(std::wstring sName, std::wstring sValue, bool bUnSet=false);
205
206 bool SetNameLocalized(const char *szName, CIccTagMultiLocalizedUnicode *pTag);
207 bool SetNameLocalized(const icUnicodeChar *szName, CIccTagMultiLocalizedUnicode *pTag);
208 bool SetNameLocalized(std::wstring sName, CIccTagMultiLocalizedUnicode *pTag);
209
210 bool SetValueLocalized(const char *szName, CIccTagMultiLocalizedUnicode *pTag);
211 bool SetValueLocalized(const icUnicodeChar *szName, CIccTagMultiLocalizedUnicode *pTag);
212 bool SetValueLocalized(std::wstring sName, CIccTagMultiLocalizedUnicode *pTag);
213
215
216protected:
218 void Cleanup();
219 icUInt32Number MaxPosRecSize();
220
223};
224
225
226//CIccFloatTag support
227#ifdef USEREFICCMAXNAMESPACE
228}
229#endif
230
231#endif //_ICCTAGDICTTAG_H
232
char icChar
Definition IccDefs.h:109
icValidateStatus
Definition IccDefs.h:118
#define ICCPROFLIB_API
File: IccProfile.h.
File: IccTag.h.
std::list< CIccDictEntryPtr > CIccNameValueDict
List Class: CIccDictEntry.
Definition IccTagDict.h:151
const icChar * szName
File: IccTagFactory.h.
icTagTypeSignature
unsigned int icUInt32Number
Data Class: CIccDictEntry.
Definition IccTagDict.h:97
std::wstring * m_sValue
Definition IccTagDict.h:131
void UnsetValue()
Definition IccTagDict.h:121
CIccTagMultiLocalizedUnicode * GetValueLocalized()
Definition IccTagDict.h:119
std::wstring::const_iterator ValueEnd()
Definition IccTagDict.h:112
CIccTagMultiLocalizedUnicode * GetNameLocalized()
Definition IccTagDict.h:118
std::wstring & GetName()
Definition IccTagDict.h:109
std::wstring * m_sName
Definition IccTagDict.h:130
bool IsValueSet()
Definition IccTagDict.h:115
std::wstring::const_iterator ValueBegin()
Definition IccTagDict.h:111
bool m_bValueSet
Definition IccTagDict.h:132
CIccTagMultiLocalizedUnicode * m_pValueLocalized
Definition IccTagDict.h:135
CIccTagMultiLocalizedUnicode * m_pNameLocalized
Definition IccTagDict.h:134
std::wstring GetValue()
Definition IccTagDict.h:114
Definition IccTagDict.h:139
CIccDictEntry * ptr
Definition IccTagDict.h:141
Type: Class.
Definition IccIO.h:97
Class: CIccTagDict.
Definition IccTagDict.h:161
bool m_bBadAlignment
Definition IccTagDict.h:217
CIccNameValueDict * m_Dict
Definition IccTagDict.h:214
virtual CIccTag * NewCopy() const
Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
Definition IccTagDict.h:166
icUInt32Number m_tagStart
Definition IccTagDict.h:222
virtual const icChar * GetClassName() const
Definition IccTagDict.h:170
virtual icTagTypeSignature GetType() const
Function: GetType()
Definition IccTagDict.h:169
icUInt32Number m_tagSize
Definition IccTagDict.h:221
Class: CIccTag.
Class: CIccTagMultiLocalizedUnicode.
unsigned short icUInt16Number
icUInt16Number icUnicodeChar
16-bit unicode characters
@ icSigDictType