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

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlDict:
+ Collaboration diagram for CIccTagXmlDict:

Public Member Functions

virtual ~CIccTagXmlDict ()
 
bool AreNamesNonzero () const
 
bool AreNamesUnique () const
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
CIccDictEntryGet (const char *szName) const
 
CIccDictEntryGet (const icUInt16Number *szName) const
 
CIccDictEntryGet (std::wstring sName) const
 
virtual const char * GetClassName () const
 
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
CIccTagMultiLocalizedUnicodeGetNameLocalized (const char *szName) const
 
CIccTagMultiLocalizedUnicodeGetNameLocalized (const icUnicodeChar *szName) const
 
CIccTagMultiLocalizedUnicodeGetNameLocalized (std::wstring sName) const
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual icTagTypeSignature GetType () const
 
std::wstring GetValue (const char *szName, bool *bIsSet=NULL) const
 
std::wstring GetValue (const icUnicodeChar *szName, bool *bIsSet=NULL) const
 
std::wstring GetValue (std::wstring sName, bool *bIsSet=NULL) const
 
CIccTagMultiLocalizedUnicodeGetValueLocalized (const char *szName) const
 
CIccTagMultiLocalizedUnicodeGetValueLocalized (const icUnicodeChar *szName) const
 
CIccTagMultiLocalizedUnicodeGetValueLocalized (std::wstring sName) const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 
virtual CIccTagNewCopy () const
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 
virtual bool ReadAll ()
 
bool Remove (const char *szName)
 
bool Remove (const icUnicodeChar *szName)
 
bool Remove (std::wstring sName)
 
bool Set (const char *szName, const char *szValue=NULL)
 
bool Set (const icUnicodeChar *szName, const icUnicodeChar *szValue=NULL)
 
bool Set (std::wstring sName, std::wstring sValue, bool bUnSet=false)
 
bool SetNameLocalized (const char *szName, CIccTagMultiLocalizedUnicode *pTag)
 
bool SetNameLocalized (const icUnicodeChar *szName, CIccTagMultiLocalizedUnicode *pTag)
 
bool SetNameLocalized (std::wstring sName, CIccTagMultiLocalizedUnicode *pTag)
 
bool SetValueLocalized (const char *szName, CIccTagMultiLocalizedUnicode *pTag)
 
bool SetValueLocalized (const icUnicodeChar *szName, CIccTagMultiLocalizedUnicode *pTag)
 
bool SetValueLocalized (std::wstring sName, CIccTagMultiLocalizedUnicode *pTag)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 
virtual bool Write (CIccIO *pIO)
 

Static Public Member Functions

static CIccTagCreate (icTagTypeSignature sig)
 

Data Fields

CIccNameValueDictm_Dict
 
icUInt32Number m_nReserved
 

Protected Member Functions

void Cleanup ()
 
icUInt32Number MaxPosRecSize ()
 

Protected Attributes

bool m_bBadAlignment
 
icUInt32Number m_tagSize
 
icUInt32Number m_tagStart
 

Detailed Description

Constructor & Destructor Documentation

◆ ~CIccTagXmlDict()

virtual CIccTagXmlDict::~CIccTagXmlDict ( )
inlinevirtual
630{}

Member Function Documentation

◆ AreNamesNonzero()

bool CIccTagDict::AreNamesNonzero ( ) const
inherited

Name: CIccTagDict::AreNamesNonzero

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.

1011{
1012 CIccNameValueDict::const_iterator i, j;
1013
1014 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
1015 if (i->ptr->GetName().empty())
1016 return false;
1017 }
1018
1019return true;
1020}
CIccNameValueDict * m_Dict
Definition IccTagDict.h:214

References CIccDictEntry::GetName(), CIccTagDict::m_Dict, and CIccDictEntryPtr::ptr.

Referenced by CIccTagDict::Validate().

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

◆ AreNamesUnique()

bool CIccTagDict::AreNamesUnique ( ) const
inherited

Name: CIccTagDict::AreNamesUnique

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.

983{
984 CIccNameValueDict::const_iterator i, j;
985
986 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
987 j=i;
988 for (j++; j!= m_Dict->end(); j++) {
989 if (i->ptr->GetName() == j->ptr->GetName())
990 return false;
991 }
992 }
993
994 return true;
995}

References CIccDictEntry::GetName(), CIccTagDict::m_Dict, and CIccDictEntryPtr::ptr.

Referenced by CIccTagDict::Validate().

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

◆ Cleanup()

void CIccTagDict::Cleanup ( )
protectedinherited

Name: CIccTagDict::Cleanup

Purpose: Detach from a pending IO object

959{
960 CIccNameValueDict::iterator i;
961
962 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
963 if (i->ptr)
964 delete i->ptr;
965 }
966 m_Dict->clear();
967}

References CIccTagDict::m_Dict, and CIccDictEntryPtr::ptr.

Referenced by CIccTagDict::~CIccTagDict(), CIccTagDict::operator=(), and CIccTagDict::Read().

+ Here is the caller graph for this function:

◆ Create()

CIccTag * CIccTag::Create ( icTagTypeSignature  sig)
staticinherited

Name: CIccTag::Create

Purpose: This is a static tag creator based upon tag signature type

Args: sig = tag type signature

Return: Pointer to Allocated tag

144{
145 return CIccTagCreator::CreateTag(sig);
146}
static CIccTag * CreateTag(icTagTypeSignature tagTypeSig)
Definition IccTagFactory.h:279

References CIccTagCreator::CreateTag().

Referenced by CIccDefaultEncProfileConverter::ConvertFromParams(), CIccTagStruct::LoadElem(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccMpeTintArray::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagLut8::SetColorSpaces(), CIccTagLut16::SetColorSpaces(), and CIccProfileDescText::SetType().

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

◆ Describe()

void CIccTagDict::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtualinherited

Name: CIccTagDict::Describe

Purpose:

Args:

Return:

Reimplemented from CIccTag.

458{
459 icChar buf[128];
460
461 sprintf(buf, "BEGIN DICT_TAG\n");
462 sDescription += buf;
463
464 CIccNameValueDict::iterator i;
465 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
466 sDescription += "\n";
467
468 i->ptr->Describe(sDescription, nVerboseness);
469 }
470
471 sprintf(buf, "\nEND DICT_TAG\n");
472 sDescription += buf;
473}
char icChar
Definition IccDefs.h:110

References CIccDictEntry::Describe(), CIccTagDict::m_Dict, and CIccDictEntryPtr::ptr.

+ Here is the call graph for this function:

◆ DetachIO()

virtual void CIccTag::DetachIO ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

183{}

◆ Get() [1/3]

CIccDictEntry * CIccTagDict::Get ( const char *  szName) const
inherited

Name: CIccTagDict::Get

Purpose: Get a dictionary entry with a given name

Args: sName - name to find in dictionary

Return: Pointer to desired dictionary entry, or NULL if not found.

1085{
1086 std::wstring sName(szName, szName+strlen(szName));
1087
1088 return Get(sName);
1089}
CIccDictEntry * Get(const char *szName) const
Definition IccTagDict.cpp:1084

References CIccTagDict::Get().

+ Here is the call graph for this function:

◆ Get() [2/3]

CIccDictEntry * CIccTagDict::Get ( const icUInt16Number szName) const
inherited

Name: CIccTagDict::Get

Purpose: Get a dictionary entry with a given name

Args: sName - name to find in dictionary

Return: Pointer to desired dictionary entry, or NULL if not found.

1062{
1063 std::wstring sName;
1064 while(*szName)
1065 sName += *szName;
1066
1067 return Get(sName);
1068}

References CIccTagDict::Get().

+ Here is the call graph for this function:

◆ Get() [3/3]

CIccDictEntry * CIccTagDict::Get ( std::wstring  sName) const
inherited

Name: CIccTagDict::Get

Purpose: Get a dictionary entry with a given name

Args: sName - name to find in dictionary

Return: Pointer to desired dictionary entry, or NULL if not found.

1037{
1038 CIccNameValueDict::const_iterator i;
1039
1040 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
1041 if (i->ptr->GetName() == sName)
1042 return i->ptr;
1043 }
1044
1045 return NULL;
1046}

References CIccDictEntry::GetName(), CIccTagDict::m_Dict, and CIccDictEntryPtr::ptr.

Referenced by CIccTagDict::Get(), CIccTagDict::Get(), CIccTagDict::GetNameLocalized(), CIccTagDict::GetValue(), CIccTagDict::GetValueLocalized(), CIccTagDict::Set(), CIccTagDict::SetNameLocalized(), and CIccTagDict::SetValueLocalized().

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

◆ GetClassName()

virtual const char * CIccTagXmlDict::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTagDict.

632{return "CIccTagXmlDict"; }

◆ GetExtClassName()

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

Implements IIccExtensionTag.

79{ return "CIccTagXml"; }

Referenced by icProfDescToXml(), and icXmlParseProfDesc().

+ Here is the caller graph for this function:

◆ GetExtDerivedClassName()

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

Implements IIccExtensionTag.

Reimplemented in CIccCurveXml.

80{ return ""; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTagXmlDict::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

634{return this; }

◆ GetNameLocalized() [1/3]

CIccTagMultiLocalizedUnicode * CIccTagDict::GetNameLocalized ( const char *  szName) const
inherited

Name: CIccTagDict::GetNameLocalized

Purpose: Get a localized name information associated with a given name

Args: sName - name to find in dictionary

Return: localized information for name

1225{
1226 std::wstring sName(szName, szName+strlen(szName));
1227
1228 return GetNameLocalized(sName);
1229}
CIccTagMultiLocalizedUnicode * GetNameLocalized(std::wstring sName) const
Definition IccTagDict.cpp:1178

References CIccTagDict::GetNameLocalized().

+ Here is the call graph for this function:

◆ GetNameLocalized() [2/3]

CIccTagMultiLocalizedUnicode * CIccTagDict::GetNameLocalized ( const icUnicodeChar szName) const
inherited

Name: CIccTagDict::GetNameLocalized

Purpose: Get a localized name information associated with a given name

Args: sName - name to find in dictionary

Return: localized information for name

1202{
1203 std::wstring sName;
1204 while(*szName)
1205 sName += *szName;
1206
1207 return GetNameLocalized(sName);
1208}

References CIccTagDict::GetNameLocalized().

+ Here is the call graph for this function:

◆ GetNameLocalized() [3/3]

CIccTagMultiLocalizedUnicode * CIccTagDict::GetNameLocalized ( std::wstring  sName) const
inherited

Name: CIccTagDict::GetNameLocalized

Purpose: Get a localized name information associated with a given name

Args: sName - name to find in dictionary

Return: localized information for name

1179{
1180 CIccDictEntry *de = Get(sName);
1181
1182 if (de)
1183 return de->GetNameLocalized();
1184
1185 return NULL;
1186}
Definition IccTagDict.h:97
CIccTagMultiLocalizedUnicode * GetNameLocalized()
Definition IccTagDict.h:118

References CIccTagDict::Get(), and CIccDictEntry::GetNameLocalized().

Referenced by CIccTagDict::GetNameLocalized(), and CIccTagDict::GetNameLocalized().

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

◆ GetTagArrayType()

virtual icArraySignature CIccTag::GetTagArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagArray.

133{ return icSigUndefinedArray; }
@ icSigUndefinedArray
Definition icProfileHeader.h:617

References icSigUndefinedArray.

Referenced by icGetTagArrayHandlerOfType(), and CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ GetTagStructType()

virtual icStructSignature CIccTag::GetTagStructType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagStruct.

132{ return icSigUndefinedStruct; }
@ icSigUndefinedStruct
Definition icProfileHeader.h:606

References icSigUndefinedStruct.

Referenced by icGetTagStructHandlerOfType(), CIccArrayColorantInfo::Validate(), and CIccArrayNamedColor::Validate().

+ Here is the caller graph for this function:

◆ GetType()

virtual icTagTypeSignature CIccTagDict::GetType ( ) const
inlinevirtualinherited

Function: GetType()

Purpose: Get Tag Type. Each derived tag will implement it's own GetType() function.

Reimplemented from CIccTag.

169{ return icSigDictType; }
@ icSigDictType
Definition icProfileHeader.h:535

References icSigDictType.

Referenced by CIccTagDict::Write().

+ Here is the caller graph for this function:

◆ GetValue() [1/3]

std::wstring CIccTagDict::GetValue ( const char *  szName,
bool *  bIsSet = NULL 
) const
inherited

Name: CIccTagDict::GetValue

Purpose: Get a value associated with a given name

Args: szName - name to find in dictionary

Return: Pointer to desired dictionary entry, or NULL if not found.

1159{
1160 std::wstring sName(szName, szName+strlen(szName));
1161
1162 return GetValue(sName, bIsSet);
1163}
std::wstring GetValue(const char *szName, bool *bIsSet=NULL) const
Definition IccTagDict.cpp:1158

References CIccTagDict::GetValue().

+ Here is the call graph for this function:

◆ GetValue() [2/3]

std::wstring CIccTagDict::GetValue ( const icUnicodeChar szName,
bool *  bIsSet = NULL 
) const
inherited

Name: CIccTagDict::GetValue

Purpose: Get a value associated with a given name

Args: szName - name to find in dictionary

Return: Pointer to desired dictionary entry, or NULL if not found.

1137{
1138 std::wstring sName;
1139 while(*szName)
1140 sName += *szName;
1141
1142 return GetValue(sName, bIsSet);
1143}

References CIccTagDict::GetValue().

+ Here is the call graph for this function:

◆ GetValue() [3/3]

std::wstring CIccTagDict::GetValue ( std::wstring  sName,
bool *  bIsSet = NULL 
) const
inherited

Name: CIccTagDict::GetValue

Purpose: Get a value associated with a given name

Args: sName - name to find in dictionary

Return: Pointer to desired dictionary entry, or NULL if not found.

1105{
1106 CIccDictEntry *de = Get(sName);
1107
1108 if (de) {
1109
1110 if (bIsSet)
1111 *bIsSet = de->IsValueSet();
1112
1113 return de->GetValue();
1114 }
1115
1116 if (bIsSet)
1117 *bIsSet = false;
1118
1119 std::wstring str;
1120 return str;
1121}
bool IsValueSet()
Definition IccTagDict.h:115
std::wstring GetValue()
Definition IccTagDict.h:114

References CIccTagDict::Get(), CIccDictEntry::GetValue(), and CIccDictEntry::IsValueSet().

Referenced by CIccTagDict::GetValue(), and CIccTagDict::GetValue().

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

◆ GetValueLocalized() [1/3]

CIccTagMultiLocalizedUnicode * CIccTagDict::GetValueLocalized ( const char *  szName) const
inherited

Name: CIccTagDict::GetValueLocalized

Purpose: Get a localized name information for value associated with a given name

Args: sName - name to find in dictionary

Return: localized information for name's value

1292{
1293 std::wstring sName(szName, szName+strlen(szName));
1294
1295 return GetValueLocalized(sName);
1296}
CIccTagMultiLocalizedUnicode * GetValueLocalized(std::wstring sName) const
Definition IccTagDict.cpp:1245

References CIccTagDict::GetValueLocalized().

+ Here is the call graph for this function:

◆ GetValueLocalized() [2/3]

CIccTagMultiLocalizedUnicode * CIccTagDict::GetValueLocalized ( const icUnicodeChar szName) const
inherited

Name: CIccTagDict::GetValueLocalized

Purpose: Get a localized name information for value associated with a given name

Args: sName - name to find in dictionary

Return: localized information for name's value

1269{
1270 std::wstring sName;
1271 while(*szName)
1272 sName += *szName;
1273
1274 return GetValueLocalized(sName);
1275}

References CIccTagDict::GetValueLocalized().

+ Here is the call graph for this function:

◆ GetValueLocalized() [3/3]

CIccTagMultiLocalizedUnicode * CIccTagDict::GetValueLocalized ( std::wstring  sName) const
inherited

Name: CIccTagDict::GetValueLocalized

Purpose: Get a localized name information for value associated with a given name

Args: sName - name to find in dictionary

Return: localized information for name's value

1246{
1247 CIccDictEntry *de = Get(sName);
1248
1249 if (de)
1250 return de->GetValueLocalized();
1251
1252 return NULL;
1253}
CIccTagMultiLocalizedUnicode * GetValueLocalized()
Definition IccTagDict.h:119

References CIccTagDict::Get(), and CIccDictEntry::GetValueLocalized().

Referenced by CIccTagDict::GetValueLocalized(), and CIccTagDict::GetValueLocalized().

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

◆ IsArrayType()

virtual bool CIccTag::IsArrayType ( )
inlinevirtualinherited

Reimplemented in CIccTagXYZ, CIccTagChromaticity, CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, CIccTagFloatNum< T, Tsig >, and CIccTagData.

135{ return false; }

Referenced by MyTagDialog::MyTagDialog(), and DumpTag().

+ Here is the caller graph for this function:

◆ IsMBBType()

virtual bool CIccTag::IsMBBType ( )
inlinevirtualinherited

Reimplemented in CIccMBB.

136{ return false; } //If true then CIccTag can be cast as an CIccMBB

Referenced by CIccProfileXml::ParseTag().

+ Here is the caller graph for this function:

◆ IsNumArrayType()

virtual bool CIccTag::IsNumArrayType ( ) const
inlinevirtualinherited

Reimplemented in CIccTagSparseMatrixArray, CIccTagFixedNum< T, Tsig >, CIccTagNum< T, Tsig >, and CIccTagFloatNum< T, Tsig >.

137{ return false;} //If true then CIccTag can be cast as a CIccTagNumArray

Referenced by CIccArrayNamedColor::FindDeviceColor(), CIccArrayNamedColor::FindPcsColor(), CIccArrayNamedColor::FindSpectralColor(), CIccTagStruct::GetElemNumberValue(), CIccStructNamedColor::GetNumArray(), CIccMpeXmlTintArray::ParseXml(), and CIccMpeTintArray::Read().

+ Here is the caller graph for this function:

◆ IsSupported()

virtual bool CIccTag::IsSupported ( )
inlinevirtualinherited

Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes. By Default inherited classes are supported. Unknown tag types are not supported.

Returns true if tag type is supported.

Reimplemented in CIccTagUnknown, CIccTagEmbeddedProfile, and CIccTagMultiProcessElement.

153{ return true; }

◆ MaxPosRecSize()

icUInt32Number CIccTagDict::MaxPosRecSize ( )
protectedinherited

Name: CIccTagDict::MaxPosRecSize;

Purpose:

Args:

Return:

431{
432
433 icUInt32Number rv = 16;
434
435 CIccNameValueDict::iterator i;
436 CIccDictEntry ptr;
437
438 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
439 if (i->ptr->PosRecSize() > rv)
440 rv = i->ptr->PosRecSize();
441 }
442
443 return rv;
444}
unsigned long icUInt32Number
Definition icProfileHeader.h:262
icUInt32Number PosRecSize()
Definition IccTagDict.cpp:254

References CIccTagDict::m_Dict, CIccDictEntry::PosRecSize(), and CIccDictEntryPtr::ptr.

Referenced by CIccTagDict::Write().

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

◆ NewCopy()

virtual CIccTag * CIccTagDict::NewCopy ( ) const
inlinevirtualinherited

Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.

Parameter(s): none

Returns a new CIccTag object that is a copy of this object.

Reimplemented from CIccTag.

166{ return new CIccTagDict(*this);}
CIccTagDict()
Definition IccTagDict.cpp:340

References CIccTagDict::CIccTagDict().

+ Here is the call graph for this function:

◆ ParseXml()

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

Implements CIccTagXml.

4281{
4282 m_Dict->clear();
4283
4284 for (pNode = icXmlFindNode(pNode, "DictEntry"); pNode; pNode = icXmlFindNode(pNode->next, "DictEntry")) {
4285 CIccDictEntryPtr ptr;
4286 CIccDictEntry *pDesc = new CIccDictEntry();
4287 xmlAttr *pAttr;
4288 CIccUTF16String str;
4289
4290 if (!pDesc)
4291 return false;
4292 ptr.ptr = pDesc;
4293
4294 str = icXmlAttrValue(pNode, "Name", "");
4295 str.ToWString(pDesc->GetName());
4296
4297 pAttr = icXmlFindAttr(pNode, "Value");
4298 if (pAttr) {
4299 std::wstring wstr;
4300 str = icXmlAttrValue(pAttr, "");
4301 str.ToWString(wstr);
4302
4303 pDesc->SetValue(wstr);
4304 }
4305
4306 xmlNode *pChild;
4307
4308 for (pChild = pNode->children; pChild; pChild = pChild->next) {
4309 if (pChild->type == XML_ELEMENT_NODE && !icXmlStrCmp(pChild->name, "LocalizedName")) {
4311 if (!pTag) {
4312 pTag = new CIccTagMultiLocalizedUnicode();
4313 pDesc->SetNameLocalized(pTag);
4314 }
4315
4316 if ((pAttr = icXmlFindAttr(pChild, "LanguageCountry")) && pChild->children) {
4317 xmlNode *pText;
4319
4320 for (pText = pChild->children; pText && pText->type != XML_TEXT_NODE && pText->type != XML_CDATA_SECTION_NODE; pText = pText->next);
4321
4322 if (pText) {
4323 CIccUTF16String str((const char*)pText->content);
4324
4325 pTag->SetText(str.c_str(), (icLanguageCode)(lc>>16), (icCountryCode)(lc & 0xffff));
4326 }
4327 else {
4328 pTag->SetText("");
4329 }
4330 }
4331 }
4332 else if (pChild->type == XML_ELEMENT_NODE && !icXmlStrCmp(pChild->name, "LocalizedValue")) {
4334 if (!pTag) {
4335 pTag = new CIccTagMultiLocalizedUnicode();
4336 pDesc->SetValueLocalized(pTag);
4337 }
4338
4339 if ((pAttr = icXmlFindAttr(pChild, "LanguageCountry")) && pChild->children) {
4340 xmlNode *pText;
4342
4343 for (pText = pChild->children; pText && pText->type != XML_TEXT_NODE && pText->type != XML_CDATA_SECTION_NODE; pText = pText->next);
4344
4345 if (pText) {
4346 CIccUTF16String str((const char*)pText->content);
4347 pTag->SetText(str.c_str(), (icLanguageCode)(lc>>16), (icCountryCode)(lc & 0xffff));
4348 }
4349 else {
4350 pTag->SetText("");
4351 }
4352 }
4353 }
4354 }
4355
4356 m_Dict->push_back(ptr);
4357 }
4358
4359 return true;
4360}
icUInt16Number icCountryCode
Definition icProfileHeader.h:1273
icUInt16Number icLanguageCode
Definition icProfileHeader.h:1248
CIccDictEntry * ptr
Definition IccTagDict.h:141
Definition IccTagDict.h:139
ICCPROFLIB_API icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
Definition IccUtilXml.cpp:669
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
Definition IccTagBasic.h:1229
void SetText(const icChar *szText, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
Definition IccTagBasic.cpp:7719
bool SetValueLocalized(CIccTagMultiLocalizedUnicode *pValueLocalized)
Definition IccTagDict.cpp:310
bool SetNameLocalized(CIccTagMultiLocalizedUnicode *pNameLocalized)
Definition IccTagDict.cpp:283
std::wstring & GetName()
Definition IccTagDict.h:109
bool SetValue(std::wstring sValue)
Definition IccTagDict.cpp:264
Definition IccUtilXml.h:75
const icUInt16Number * c_str()
Definition IccUtilXml.h:93
const wchar_t * ToWString(std::wstring &buf)
Definition IccUtilXml.cpp:263

References CIccDictEntry::CIccDictEntry(), CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode(), CIccUTF16String::CIccUTF16String(), CIccUTF16String::c_str(), CIccDictEntry::GetName(), CIccDictEntry::GetNameLocalized(), CIccDictEntry::GetValueLocalized(), icGetSigVal(), icXmlAttrValue(), icXmlAttrValue(), icXmlFindAttr(), icXmlFindNode(), CIccTagDict::m_Dict, CIccUTF16String::operator=(), CIccDictEntryPtr::ptr, CIccDictEntry::SetNameLocalized(), CIccTagMultiLocalizedUnicode::SetText(), CIccTagMultiLocalizedUnicode::SetText(), CIccDictEntry::SetValue(), CIccDictEntry::SetValueLocalized(), and CIccUTF16String::ToWString().

+ Here is the call graph for this function:

◆ Read() [1/2]

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

Name: CIccTagDict::Read

Purpose:

Args:

Return:

Reimplemented from CIccTag.

495{
497
498 m_tagSize = size;
499
500 icUInt32Number headerSize = sizeof(icTagTypeSignature) +
501 sizeof(icUInt32Number) +
502 sizeof(icUInt32Number) +
503 sizeof(icUInt32Number);
504
505 if (headerSize > size)
506 return false;
507
508 if (!pIO) {
509 return false;
510 }
511
512 Cleanup();
513
514 m_tagStart = pIO->Tell();
515
516 if (!pIO->Read32(&sig))
517 return false;
518
519 if (!pIO->Read32(&m_nReserved))
520 return false;
521
522 icUInt32Number count, reclen, i;
523
524 if (!pIO->Read32(&count))
525 return false;
526
527 if (!pIO->Read32(&reclen))
528 return false;
529
530 if (reclen!=16 && reclen!=24 && reclen!=32)
531 return false;
532
533 if (headerSize + count*reclen > size)
534 return false;
535
536 icDictRecordPos *pos = (icDictRecordPos*)calloc(count, sizeof(icDictRecordPos));
537 if (!pos)
538 return false;
539
540 //Read TagDir
541 for (i=0; i<count; i++) {
542 if (!pIO->Read32(&pos[i].posName.offset) ||
543 !pIO->Read32(&pos[i].posName.size) ||
544 !pIO->Read32(&pos[i].posValue.offset) ||
545 !pIO->Read32(&pos[i].posValue.size)) {
546 free(pos);
547 return false;
548 }
549
550 if (reclen>=24) {
551 if (!pIO->Read32(&pos[i].posNameLocalized.offset) ||
552 !pIO->Read32(&pos[i].posNameLocalized.size)) {
553 free(pos);
554 return false;
555 }
556 if (reclen>=32) {
557 if (!pIO->Read32(&pos[i].posValueLocalized.offset) ||
558 !pIO->Read32(&pos[i].posValueLocalized.size)) {
559 free(pos);
560 return false;
561 }
562 }
563 }
564
565 if ((pos[i].posName.offset & 0x3) ||
566 (pos[i].posValue.offset & 0x3) ||
567 (pos[i].posNameLocalized.offset & 0x3) ||
568 (pos[i].posValueLocalized.offset & 0x3))
569 m_bBadAlignment = true;
570 }
571
572 icUInt32Number bufsize = 128, num;
573 icUnicodeChar *buf = (icUnicodeChar*)malloc(bufsize);
574 CIccDictEntryPtr ptr = {};
575 std::wstring str;
576
577 for (i=0; i<count; i++) {
578 ptr.ptr = new CIccDictEntry();
579 if (!ptr.ptr)
580 return false;
581
582 //GetName
583 if (pos[i].posName.offset) {
584 if (!pos[i].posName.size) {
585 str.clear();
586 ptr.ptr->SetValue(str);
587 }
588 else {
589 if (pos[i].posName.offset + pos[i].posName.size >size ||
590 !pos[i].posName.size) {
591 free(pos);
592 free(buf);
593 delete ptr.ptr;
594 return false;
595 }
596
597 //Make sure we have buf large enough for the string
598 if (bufsize < pos[i].posName.size) {
599 bufsize = pos[i].posName.size;
600 buf = (icUnicodeChar*)icRealloc(buf, bufsize);
601 if (!buf) {
602 free(pos);
603 delete ptr.ptr;
604 return false;
605 }
606 }
607
608 if (pIO->Seek(m_tagStart+pos[i].posName.offset, icSeekSet)<0) {
609 free(pos);
610 free(buf);
611 delete ptr.ptr;
612 return false;
613 }
614
615 num = pos[i].posName.size / sizeof(icUnicodeChar);
616 if (pIO->Read16(buf, num)!=(icInt32Number)num) {
617 free(pos);
618 free(buf);
619 delete ptr.ptr;
620 return false;
621 }
622 str.assign(&buf[0], &buf[num]);
623 ptr.ptr->GetName() = str;
624 }
625 }
626
627 //GetValue
628 if (pos[i].posValue.offset) {
629 if (!pos[i].posValue.size) {
630 str.clear();
631 ptr.ptr->SetValue(str);
632 }
633 else {
634 if (pos[i].posValue.offset + pos[i].posValue.size >size ||
635 (pos[i].posValue.size&1)) {
636 free(pos);
637 free(buf);
638 delete ptr.ptr;
639 return false;
640 }
641
642 //Make sure we have buf large enough for the string
643 if (bufsize < pos[i].posValue.size) {
644 bufsize = pos[i].posValue.size;
645 buf = (icUnicodeChar*)icRealloc(buf, bufsize);
646 if (!buf) {
647 free(pos);
648 delete ptr.ptr;
649 return false;
650 }
651 }
652
653 if (pIO->Seek(m_tagStart+pos[i].posValue.offset, icSeekSet)<0) {
654 free(pos);
655 free(buf);
656 delete ptr.ptr;
657 return false;
658 }
659
660 num = pos[i].posValue.size / sizeof(icUnicodeChar);
661 if (pIO->Read16(buf, num)!=(icInt32Number)num) {
662 free(pos);
663 free(buf);
664 delete ptr.ptr;
665 return false;
666 }
667 str.assign(&buf[0], &buf[num]);
668 ptr.ptr->SetValue(str);
669 }
670 }
671
672 //Get NameLocalized
673 if (pos[i].posNameLocalized.offset) {
674 if (pos[i].posNameLocalized.offset + pos[i].posNameLocalized.size > size ||
675 pos[i].posNameLocalized.size < sizeof(icSignature)) {
676 free(pos);
677 free(buf);
678 delete ptr.ptr;
679 return false;
680 }
681
682 if (pIO->Seek(m_tagStart+pos[i].posNameLocalized.offset, icSeekSet)<0) {
683 free(pos);
684 free(buf);
685 delete ptr.ptr;
686 return false;
687 }
688
690 if (!pIO->Read32(&textSig, 1)) {
691 free(pos);
692 free(buf);
693 delete ptr.ptr;
694 return false;
695 }
696
697 if (textSig != icSigMultiLocalizedUnicodeType) {
698 free(pos);
699 free(buf);
700 delete ptr.ptr;
701 return false;
702 }
703
704 if (pIO->Seek(m_tagStart+pos[i].posNameLocalized.offset, icSeekSet)<0) {
705 free(pos);
706 free(buf);
707 delete ptr.ptr;
708 return false;
709 }
710
712
713 if (!pTag || !pTag->Read(pos[i].posNameLocalized.size, pIO)) {
714 free(pos);
715 free(buf);
716 delete ptr.ptr;
717 return false;
718 }
719
720 ptr.ptr->SetNameLocalized(pTag);
721 }
722
723 //Get ValueLocalized
724 if (pos[i].posValueLocalized.offset) {
725 if (pos[i].posValueLocalized.offset + pos[i].posValueLocalized.size > size ||
726 pos[i].posValueLocalized.size < sizeof(icSignature)) {
727 free(pos);
728 free(buf);
729 delete ptr.ptr;
730 return false;
731 }
732
733 if (pIO->Seek(m_tagStart+pos[i].posValueLocalized.offset, icSeekSet)<0) {
734 free(pos);
735 free(buf);
736 delete ptr.ptr;
737 return false;
738 }
739
741 if (!pIO->Read32(&textSig, 1)) {
742 free(pos);
743 free(buf);
744 delete ptr.ptr;
745 return false;
746 }
747
748 if (textSig != icSigMultiLocalizedUnicodeType) {
749 free(pos);
750 free(buf);
751 delete ptr.ptr;
752 return false;
753 }
754
755 if (pIO->Seek(m_tagStart+pos[i].posValueLocalized.offset, icSeekSet)<0) {
756 free(pos);
757 free(buf);
758 delete ptr.ptr;
759 return false;
760 }
761
763
764 if (!pTag || !pTag->Read(pos[i].posValueLocalized.size, pIO)) {
765 free(pos);
766 free(buf);
767 delete ptr.ptr;
768 return false;
769 }
770
771 ptr.ptr->SetValueLocalized(pTag);
772 }
773
774 m_Dict->push_back(ptr);
775 }
776
777 free(pos);
778 free(buf);
779
780 return true;
781}
long icInt32Number
Definition icProfileHeader.h:291
icUInt16Number icUnicodeChar
Definition icProfileHeader.h:321
icUInt32Number icSignature
Definition icProfileHeader.h:271
icTagTypeSignature
Definition icProfileHeader.h:526
@ icSigMultiLocalizedUnicodeType
Definition icProfileHeader.h:549
icUInt32Number size
Definition icProfileHeader.h:1462
@ icSeekSet
Definition IccIO.h:83
ICCPROFLIB_API void * icRealloc(void *ptr, size_t size)
Definition IccUtil.cpp:111
icPositionNumber posValue
Definition IccTagDict.cpp:478
icPositionNumber posName
Definition IccTagDict.cpp:477
Definition IccTagDict.cpp:476
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
virtual icInt32Number Tell()
Definition IccIO.h:133
virtual icInt32Number Seek(icInt32Number nOffset, icSeekVal pos)
Definition IccIO.h:132
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagBasic.h:235
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.cpp:7451
bool m_bBadAlignment
Definition IccTagDict.h:217
void Cleanup()
Definition IccTagDict.cpp:958
icUInt32Number m_tagStart
Definition IccTagDict.h:222
icUInt32Number m_tagSize
Definition IccTagDict.h:221

References CIccDictEntry::CIccDictEntry(), CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode(), CIccTagDict::Cleanup(), CIccDictEntry::GetName(), icRealloc(), icSeekSet, icSigMultiLocalizedUnicodeType, CIccTagDict::m_bBadAlignment, CIccTagDict::m_Dict, CIccTag::m_nReserved, CIccTagDict::m_tagSize, CIccTagDict::m_tagStart, icPositionNumber::offset, icDictRecordPos::posName, icDictRecordPos::posNameLocalized, icDictRecordPos::posValue, icDictRecordPos::posValueLocalized, CIccDictEntryPtr::ptr, CIccTagMultiLocalizedUnicode::Read(), CIccIO::Read16(), CIccIO::Read32(), CIccIO::Seek(), CIccDictEntry::SetNameLocalized(), CIccDictEntry::SetValue(), CIccDictEntry::SetValueLocalized(), icPositionNumber::size, and CIccIO::Tell().

+ Here is the call graph for this function:

◆ Read() [2/2]

virtual bool CIccTag::Read ( icUInt32Number  size,
CIccIO pIO,
CIccProfile pProfile 
)
inlinevirtualinherited

Function: Read(size, pIO) - Read tag from file. Each derived tag will implement it's own Read() function.

Parameter(s): size - number of bytes in tag including the type signature. pIO - IO object used to read in tag. The IO object should already be initialized to point to the begining of the tag.

Returns true if Read is successful.

Reimplemented in CIccTagEmbeddedProfile.

197{ return Read(size, pIO); }
virtual bool Read(icUInt32Number size, CIccIO *pIO)
Definition IccTagBasic.h:167

References CIccTag::Read().

+ Here is the call graph for this function:

◆ ReadAll()

virtual bool CIccTag::ReadAll ( )
inlinevirtualinherited

Function: ReadAll() - Read All sub data for tag from file. Called by CIccProfile::ReadAll() to read all sub data for tag

Returns true if ReadAll is successful.

Reimplemented in CIccTagEmbeddedProfile.

175{ return true; }

◆ Remove() [1/3]

bool CIccTagDict::Remove ( const char *  szName)
inherited

Name: CIccTagDict::Remove

Purpose: Remove a name value pair from the dictionary

Args: sName = the name to look for in the dictionary

Return: true if sName exists and was remove , or false otherwise

1367{
1368 std::wstring sName(szName, szName+strlen(szName));
1369
1370 return Remove(sName);
1371}
bool Remove(std::wstring sName)
Definition IccTagDict.cpp:1312

References CIccTagDict::Remove().

+ Here is the call graph for this function:

◆ Remove() [2/3]

bool CIccTagDict::Remove ( const icUnicodeChar szName)
inherited

Name: CIccTagDict::Remove

Purpose: Remove a name value pair from the dictionary

Args: sName = the name to look for in the dictionary

Return: true if sName exists and was remove , or false otherwise

1343{
1344 std::wstring sName;
1345 while(*szName)
1346 sName += *szName;
1347
1348 return Remove(sName);
1349
1350}

References CIccTagDict::Remove().

+ Here is the call graph for this function:

◆ Remove() [3/3]

bool CIccTagDict::Remove ( std::wstring  sName)
inherited

Name: CIccTagDict::Remove

Purpose: Remove a name value pair from the dictionary

Args: sName = the name to look for in the dictionary

Return: true if sName exists and was removed, or false otherwise

1313{
1314 CIccNameValueDict::iterator i;
1315
1316 for (i=m_Dict->begin(); i!=m_Dict->end(); i++) {
1317 if (i->ptr->GetName() == sName) {
1318 delete i->ptr;
1319
1320 m_Dict->erase(i);
1321 return true;
1322 }
1323 }
1324
1325 return false;
1326}

References CIccDictEntry::GetName(), CIccTagDict::m_Dict, and CIccDictEntryPtr::ptr.

Referenced by CIccTagDict::Remove(), and CIccTagDict::Remove().

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

◆ Set() [1/3]

bool CIccTagDict::Set ( const char *  szName,
const char *  szValue = NULL 
)
inherited
1433{
1434 std::wstring sName(szName, szName+strlen(szName));
1435 std::wstring sValue;
1436
1437 if (szValue) {
1438 sValue.assign(szValue, szValue+strlen(szValue));
1439
1440 return Set(sName, sValue, false);
1441 }
1442
1443 return Set(sName, sValue, true);
1444}
bool Set(const char *szName, const char *szValue=NULL)
Definition IccTagDict.cpp:1432

References CIccTagDict::Set().

+ Here is the call graph for this function:

◆ Set() [2/3]

bool CIccTagDict::Set ( const icUnicodeChar szName,
const icUnicodeChar szValue = NULL 
)
inherited
1415{
1416 std::wstring sName;
1417 while(*szName)
1418 sName += *szName;
1419
1420 std::wstring sValue;
1421
1422 if (szValue) {
1423 while(*szValue)
1424 sValue += *szValue;
1425
1426 return Set(sName, sValue, false);
1427 }
1428
1429 return Set(sName, sValue, true);
1430}

References CIccTagDict::Set().

+ Here is the call graph for this function:

◆ Set() [3/3]

bool CIccTagDict::Set ( std::wstring  sName,
std::wstring  sValue,
bool  bUnSet = false 
)
inherited

Name: CIccTagDict::Set

Purpose: Associate a value with a name in the dictionary

Args: sName = the name to look for in the dictionary sValue = value to associate with sName bUnset = flag to indicate that value has not been set (no data for value in tag)

Return: true if value associate with sName was changed, or false if no change

1390{
1391 CIccDictEntry *de = Get(sName);
1392
1393 if (de) {
1394 if (de->GetValue()==sValue && de->IsValueSet() && !bUnSet)
1395 return false;
1396 }
1397 else {
1398 de = new CIccDictEntry;
1399 de->GetName() = sName;
1400
1401 CIccDictEntryPtr ptr = {};
1402 ptr.ptr = de;
1403 m_Dict->push_back(ptr);
1404 }
1405
1406 if (sValue.empty() && bUnSet)
1407 de->UnsetValue();
1408 else
1409 de->SetValue(sValue);
1410
1411 return true;
1412}
void UnsetValue()
Definition IccTagDict.h:121

References CIccTagDict::Get(), CIccDictEntry::GetName(), CIccDictEntry::GetValue(), CIccDictEntry::IsValueSet(), CIccTagDict::m_Dict, CIccDictEntryPtr::ptr, CIccDictEntry::SetValue(), and CIccDictEntry::UnsetValue().

Referenced by CIccTagDict::Set(), and CIccTagDict::Set().

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

◆ SetNameLocalized() [1/3]

bool CIccTagDict::SetNameLocalized ( const char *  szName,
CIccTagMultiLocalizedUnicode pTag 
)
inherited
1472{
1473 std::wstring sName;
1474 while(*szName)
1475 sName += *szName++;
1476
1477 return SetNameLocalized(sName, pTag);
1478}
bool SetNameLocalized(const char *szName, CIccTagMultiLocalizedUnicode *pTag)
Definition IccTagDict.cpp:1471

References CIccTagDict::SetNameLocalized().

+ Here is the call graph for this function:

◆ SetNameLocalized() [2/3]

bool CIccTagDict::SetNameLocalized ( const icUnicodeChar szName,
CIccTagMultiLocalizedUnicode pTag 
)
inherited
1463{
1464 std::wstring sName;
1465 while(*szName)
1466 sName += *szName++;
1467
1468 return SetNameLocalized(sName, pTag);
1469}

References CIccTagDict::SetNameLocalized().

+ Here is the call graph for this function:

◆ SetNameLocalized() [3/3]

bool CIccTagDict::SetNameLocalized ( std::wstring  sName,
CIccTagMultiLocalizedUnicode pTag 
)
inherited
1447{
1448 CIccDictEntry *de = Get(sName);
1449
1450 if (!de) {
1451 de = new CIccDictEntry;
1452 de->GetName() = sName;
1453
1454 CIccDictEntryPtr ptr = {};
1455 ptr.ptr = de;
1456 m_Dict->push_back(ptr);
1457 }
1458
1459 return de->SetNameLocalized(pTag);
1460}

References CIccTagDict::Get(), CIccDictEntry::GetName(), CIccTagDict::m_Dict, CIccDictEntryPtr::ptr, and CIccDictEntry::SetNameLocalized().

Referenced by CIccTagDict::SetNameLocalized(), and CIccTagDict::SetNameLocalized().

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

◆ SetValueLocalized() [1/3]

bool CIccTagDict::SetValueLocalized ( const char *  szName,
CIccTagMultiLocalizedUnicode pTag 
)
inherited
1506{
1507 std::wstring sName(szName, szName+strlen(szName));
1508
1509 return SetValueLocalized(sName, pTag);
1510}
bool SetValueLocalized(const char *szName, CIccTagMultiLocalizedUnicode *pTag)
Definition IccTagDict.cpp:1505

References CIccTagDict::SetValueLocalized().

+ Here is the call graph for this function:

◆ SetValueLocalized() [2/3]

bool CIccTagDict::SetValueLocalized ( const icUnicodeChar szName,
CIccTagMultiLocalizedUnicode pTag 
)
inherited
1497{
1498 std::wstring sName;
1499 while(*szName)
1500 sName += *szName++;
1501
1502 return SetValueLocalized(sName, pTag);
1503}

References CIccTagDict::SetValueLocalized().

+ Here is the call graph for this function:

◆ SetValueLocalized() [3/3]

bool CIccTagDict::SetValueLocalized ( std::wstring  sName,
CIccTagMultiLocalizedUnicode pTag 
)
inherited
1481{
1482 CIccDictEntry *de = Get(sName);
1483
1484 if (!de) {
1485 de = new CIccDictEntry;
1486 de->GetName() = sName;
1487
1488 CIccDictEntryPtr ptr = {};
1489 ptr.ptr = de;
1490 m_Dict->push_back(ptr);
1491 }
1492
1493 return de->SetValueLocalized(pTag);
1494}

References CIccTagDict::Get(), CIccDictEntry::GetName(), CIccTagDict::m_Dict, CIccDictEntryPtr::ptr, and CIccDictEntry::SetValueLocalized().

Referenced by CIccTagDict::SetValueLocalized(), and CIccTagDict::SetValueLocalized().

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

◆ ToXml()

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

Implements CIccTagXml.

4220{
4221 std::string info;
4222
4223 CIccNameValueDict::iterator nvp;
4224
4225 for (nvp=m_Dict->begin(); nvp!=m_Dict->end(); nvp++) {
4226 CIccDictEntry *nv = nvp->ptr;
4227 if (!nv)
4228 continue;
4229
4230 char buf[256];
4231 char data[256];
4232 char fix[256];
4233 std::string bufstr;
4234
4235 xml += blanks + " <DictEntry Name=\"";
4236 xml += icFixXml(fix, icUtf16ToUtf8(bufstr, (icUInt16Number*)nv->GetName().c_str(), (int)nv->GetName().size()));
4237 xml += "\"";
4238
4239 if (nv->IsValueSet()) {
4240 xml += " Value=\"";
4241 xml += icFixXml(fix, icUtf16ToUtf8(bufstr, (icUInt16Number*)nv->GetValue().c_str(), (int)nv->GetValue().size()));
4242 xml += "\"";
4243 }
4244
4245 if (!nv->GetNameLocalized() && !nv->GetValueLocalized()) {
4246 xml += "/>\n";
4247 }
4248 else {
4249 xml += ">\n";
4250
4251 if (nv->GetNameLocalized()) {
4252 CIccMultiLocalizedUnicode::iterator i;
4253
4254 for (i=nv->GetNameLocalized()->m_Strings->begin(); i!=nv->GetNameLocalized()->m_Strings->end(); i++) {
4255 sprintf(buf, " <LocalizedName LanguageCountry=\"%s\"", icFixXml(fix, icGetSigStr(data, (i->m_nLanguageCode<<16) + i->m_nCountryCode)));
4256 xml += blanks + buf;
4257
4258 sprintf(buf, "><![CDATA[%s]]></LocalizedName>\n", icFixXml(fix, icUtf16ToUtf8(bufstr, i->GetBuf(), i->GetLength())));
4259 xml += buf;
4260 }
4261 }
4262 if (nv->GetValueLocalized()) {
4263 CIccMultiLocalizedUnicode::iterator i;
4264
4265 for (i=nv->GetValueLocalized()->m_Strings->begin(); i!=nv->GetValueLocalized()->m_Strings->end(); i++) {
4266 sprintf(buf, " <LocalizedValue LanguageCountry=\"%s\"", icFixXml(fix, icGetSigStr(data, (i->m_nLanguageCode<<16) + i->m_nCountryCode)));
4267 xml += blanks + buf;
4268
4269 sprintf(buf, "><![CDATA[%s]]></LocalizedValue>\n", icFixXml(fix, icUtf16ToUtf8(bufstr, i->GetBuf(), i->GetLength())));
4270 xml += buf;
4271 }
4272 }
4273 xml += blanks + " </DictEntry>\n";
4274 }
4275 }
4276 return true;
4277}
unsigned short icUInt16Number
Definition icProfileHeader.h:256
ICCPROFLIB_API const icChar * icGetSigStr(icChar *pBuf, icUInt32Number nSig)
Definition IccUtil.cpp:1056
const char * icUtf16ToUtf8(std::string &buf, const icUInt16Number *szSrc, int sizeSrc=0)
Definition IccUtilXml.cpp:341
const char * icFixXml(char *szDest, const char *szStr)
Definition IccUtilXml.cpp:305
CIccMultiLocalizedUnicode * m_Strings
Definition IccTagBasic.h:1260

References CIccLocalizedUnicode::GetBuf(), CIccLocalizedUnicode::GetLength(), CIccDictEntry::GetName(), CIccDictEntry::GetNameLocalized(), CIccDictEntry::GetValue(), CIccDictEntry::GetValueLocalized(), icFixXml(), icGetSigStr(), icUtf16ToUtf8(), CIccDictEntry::IsValueSet(), CIccTagDict::m_Dict, CIccLocalizedUnicode::m_nCountryCode, CIccLocalizedUnicode::m_nLanguageCode, CIccTagMultiLocalizedUnicode::m_Strings, and CIccDictEntryPtr::ptr.

+ Here is the call graph for this function:

◆ Validate()

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

Name: CIccTagDict::Validate

Purpose:

Args:

Return:

Reimplemented from CIccTag.

919{
920 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
921
922 CIccInfo Info;
923 std::string sSigPathName = Info.GetSigPathName(sigPath);
924
925 // Check for duplicate tags
926 if (!AreNamesUnique()) {
927 sReport += icMsgValidateWarning;
928 sReport += sSigPathName;
929 sReport += " - There are duplicate names.\n";
931 }
932
933 if (!AreNamesNonzero()) {
934 sReport += icMsgValidateWarning;
935 sReport += sSigPathName;
936 sReport += " - There zero-length names.\n";
938 }
939
940 // Check for duplicate tags
941 if (m_bBadAlignment) {
942 sReport += icMsgValidateWarning;
943 sReport += sSigPathName;
944 sReport += " - Some Data elements are not aligned correctly\n";
946 }
947
948 return rv;
949}
icValidateStatus
Definition IccDefs.h:119
@ icValidateWarning
Definition IccDefs.h:121
ICCPROFLIB_API const char * icMsgValidateWarning
Definition IccUtil.cpp:90
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
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
Definition IccTagBasic.cpp:164
bool AreNamesUnique() const
Definition IccTagDict.cpp:982
bool AreNamesNonzero() const
Definition IccTagDict.cpp:1010

References CIccTagDict::AreNamesNonzero(), CIccTagDict::AreNamesUnique(), CIccInfo::GetSigPathName(), icMaxStatus(), icMsgValidateWarning, icValidateWarning, CIccTagDict::m_bBadAlignment, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagDict::Write ( CIccIO pIO)
virtualinherited

Name: CIccTagDict::Write

Purpose:

Args:

Return:

Reimplemented from CIccTag.

794{
796
797 if (!pIO)
798 return false;
799
800 m_tagStart = pIO->Tell();
801
802 if (!pIO->Write32(&sig))
803 return false;
804
805 if (!pIO->Write32(&m_nReserved))
806 return false;
807
808 CIccNameValueDict::iterator i, j;
809 icUInt32Number count;
810 icUInt8Number zbuf[32];
811
812 memset(zbuf, 0, 32);
813
814 for (count=0, i=m_Dict->begin(); i!= m_Dict->end(); i++) {
815 if (i->ptr)
816 count++;
817 }
818
819 pIO->Write32(&count);
820
821 icUInt32Number recSize = MaxPosRecSize();
822 pIO->Write32(&recSize);
823
824 icDictRecordPos *pos = (icDictRecordPos*)calloc(count, sizeof(icDictRecordPos));
825 if (!pos)
826 return false;
827
828 icUInt32Number n, dirpos = pIO->Tell();
829
830 //Write Unintialized Dict rec offset array
831 for (i=m_Dict->begin(); i!= m_Dict->end(); i++) {
832 if (i->ptr) {
833 pIO->Write8(zbuf, recSize);
834 }
835 }
836
838 std::wstring::const_iterator chrptr;
839 //Write Dict records
840 for (n=0, i=m_Dict->begin(); i!= m_Dict->end(); i++) {
841 if (i->ptr) {
842 pos[n].posName.offset = pIO->Tell()-m_tagStart;
843
844 for(chrptr = i->ptr->GetName().begin(); chrptr!=i->ptr->GetName().end(); chrptr++) {
845 c=(icUnicodeChar)*chrptr;
846 pIO->Write16(&c, 1);
847 }
848 pos[n].posName.size = pIO->Tell()-m_tagStart - pos[n].posName.offset;
849 pIO->Align32();
850
851 if (i->ptr->IsValueSet()) {
852 pos[n].posValue.offset = pIO->Tell()-m_tagStart;
853 for(chrptr = i->ptr->ValueBegin(); chrptr!=i->ptr->ValueEnd(); chrptr++) {
854 c=(icUnicodeChar)*chrptr;
855 pIO->Write16(&c, 1);
856 }
857 pos[n].posValue.size = pIO->Tell()-m_tagStart - pos[n].posValue.offset;
858 pIO->Align32();
859 }
860
861 if (recSize>16 && i->ptr->GetNameLocalized()) {
862 pos[n].posNameLocalized.offset = pIO->Tell()-m_tagStart;
863 i->ptr->GetNameLocalized()->Write(pIO);
865 pIO->Align32();
866 }
867
868 if (recSize>24 && i->ptr->GetValueLocalized()) {
869 pos[n].posValueLocalized.offset = pIO->Tell()-m_tagStart;
870 i->ptr->GetValueLocalized()->Write(pIO);
872 pIO->Align32();
873 }
874 n++;
875 }
876 }
877 icUInt32Number endpos = pIO->Tell();
878
879 pIO->Seek(dirpos, icSeekSet);
880
881 //Write TagDir with offsets and sizes
882 for (n=0, i=m_Dict->begin(); i!= m_Dict->end(); i++) {
883 if (i->ptr) {
884 pIO->Write32(&pos[n].posName.offset);
885 pIO->Write32(&pos[n].posName.size);
886 pIO->Write32(&pos[n].posValue.offset);
887 pIO->Write32(&pos[n].posValue.size);
888 if (recSize>16) {
889 pIO->Write32(&pos[n].posNameLocalized.offset);
890 pIO->Write32(&pos[n].posNameLocalized.size);
891 if (recSize>24) {
892 pIO->Write32(&pos[n].posValueLocalized.offset);
893 pIO->Write32(&pos[n].posValueLocalized.size);
894 }
895 }
896 }
897 n++;
898 }
899 pIO->Seek(endpos, icSeekSet);
900
901 free(pos);
902
903 return true;
904}
unsigned char icUInt8Number
Definition icProfileHeader.h:250
icUInt32Number offset
Definition icProfileHeader.h:1461
icPositionNumber posValueLocalized
Definition IccTagDict.cpp:480
icPositionNumber posNameLocalized
Definition IccTagDict.cpp:479
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:105
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:122
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
icUInt32Number MaxPosRecSize()
Definition IccTagDict.cpp:430
virtual icTagTypeSignature GetType() const
Definition IccTagDict.h:169

References CIccIO::Align32(), CIccDictEntry::GetName(), CIccDictEntry::GetNameLocalized(), CIccTagDict::GetType(), CIccDictEntry::GetValueLocalized(), icSeekSet, CIccDictEntry::IsValueSet(), CIccTagDict::m_Dict, CIccTag::m_nReserved, CIccTagDict::m_tagStart, CIccTagDict::MaxPosRecSize(), icPositionNumber::offset, icDictRecordPos::posName, icDictRecordPos::posNameLocalized, icDictRecordPos::posValue, icDictRecordPos::posValueLocalized, CIccDictEntryPtr::ptr, CIccIO::Seek(), icPositionNumber::size, CIccIO::Tell(), CIccDictEntry::ValueBegin(), CIccDictEntry::ValueEnd(), CIccTagMultiLocalizedUnicode::Write(), CIccIO::Write16(), CIccIO::Write32(), and CIccIO::Write8().

+ Here is the call graph for this function:

Field Documentation

◆ m_bBadAlignment

bool CIccTagDict::m_bBadAlignment
protectedinherited

◆ m_Dict

◆ m_nReserved

icUInt32Number CIccTag::m_nReserved
inherited

Referenced by CIccTag::CIccTag(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::CIccTagMultiProcessElement(), CIccTagMultiProcessElement::operator=(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagText::Read(), CIccTagUtf8Text::Read(), CIccTagZipUtf8Text::Read(), CIccTagUtf16Text::Read(), CIccTagTextDescription::Read(), CIccTagSignature::Read(), CIccTagNamedColor2::Read(), CIccTagXYZ::Read(), CIccTagChromaticity::Read(), CIccTagCicp::Read(), CIccTagSparseMatrixArray::Read(), CIccTagFixedNum< T, Tsig >::Read(), CIccTagNum< T, Tsig >::Read(), CIccTagFloatNum< T, Tsig >::Read(), CIccTagMeasurement::Read(), CIccTagMultiLocalizedUnicode::Read(), CIccTagData::Read(), CIccTagDateTime::Read(), CIccTagColorantOrder::Read(), CIccTagColorantTable::Read(), CIccTagViewingConditions::Read(), CIccTagProfileSeqDesc::Read(), CIccTagResponseCurveSet16::Read(), CIccTagSpectralDataInfo::Read(), CIccTagSpectralViewingConditions::Read(), CIccTagEmbeddedHeightImage::Read(), CIccTagEmbeddedNormalImage::Read(), CIccTagStruct::Read(), CIccTagArray::Read(), CIccTagDict::Read(), CIccTagCurve::Read(), CIccTagParametricCurve::Read(), CIccTagLutAtoB::Read(), CIccTagLut8::Read(), CIccTagLut16::Read(), CIccTagGamutBoundaryDesc::Read(), CIccTagMultiProcessElement::Read(), CIccTagProfileSequenceId::Read(), CIccTagEmbeddedProfile::Read(), CIccTag::Validate(), CIccTagText::Write(), CIccTagUtf8Text::Write(), CIccTagZipUtf8Text::Write(), CIccTagUtf16Text::Write(), CIccTagTextDescription::Write(), CIccTagSignature::Write(), CIccTagNamedColor2::Write(), CIccTagXYZ::Write(), CIccTagChromaticity::Write(), CIccTagCicp::Write(), CIccTagSparseMatrixArray::Write(), CIccTagFixedNum< T, Tsig >::Write(), CIccTagNum< T, Tsig >::Write(), CIccTagFloatNum< T, Tsig >::Write(), CIccTagMeasurement::Write(), CIccTagMultiLocalizedUnicode::Write(), CIccTagData::Write(), CIccTagDateTime::Write(), CIccTagColorantOrder::Write(), CIccTagColorantTable::Write(), CIccTagViewingConditions::Write(), CIccTagProfileSeqDesc::Write(), CIccTagResponseCurveSet16::Write(), CIccTagSpectralDataInfo::Write(), CIccTagSpectralViewingConditions::Write(), CIccTagEmbeddedHeightImage::Write(), CIccTagEmbeddedNormalImage::Write(), CIccTagStruct::Write(), CIccTagArray::Write(), CIccTagDict::Write(), CIccTagEmbeddedProfile::Write(), CIccTagCurve::Write(), CIccTagParametricCurve::Write(), CIccTagLutAtoB::Write(), CIccTagLut8::Write(), CIccTagLut16::Write(), CIccTagGamutBoundaryDesc::Write(), CIccTagMultiProcessElement::Write(), and CIccTagProfileSequenceId::Write().

◆ m_tagSize

icUInt32Number CIccTagDict::m_tagSize
protectedinherited

◆ m_tagStart

icUInt32Number CIccTagDict::m_tagStart
protectedinherited

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