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

#include <IccTagXml.h>

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

Public Member Functions

virtual const char * GetClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
virtual bool ParseXml (xmlNode *pNode, std::string &parseStr)
 
virtual bool ToXml (std::string &xml, std::string blanks="")
 
virtual ~CIccTagXmlDict ()
 
- Public Member Functions inherited from CIccTagDict
bool AreNamesNonzero () const
 Name: CIccTagDict::AreNamesNonzero.
 
bool AreNamesUnique () const
 Name: CIccTagDict::AreNamesUnique.
 
 CIccTagDict ()
 Name: CIccTagDict::CIccTagDict.
 
 CIccTagDict (const CIccTagDict &dict)
 Name: CIccTagDict::CIccTagDict.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagDict::Describe.
 
CIccDictEntryGet (const char *szName) const
 Name: CIccTagDict::Get.
 
CIccDictEntryGet (const icUInt16Number *szName) const
 Name: CIccTagDict::Get.
 
CIccDictEntryGet (std::wstring sName) const
 Name: CIccTagDict::Get.
 
CIccTagMultiLocalizedUnicodeGetNameLocalized (const char *szName) const
 Name: CIccTagDict::GetNameLocalized.
 
CIccTagMultiLocalizedUnicodeGetNameLocalized (const icUnicodeChar *szName) const
 Name: CIccTagDict::GetNameLocalized.
 
CIccTagMultiLocalizedUnicodeGetNameLocalized (std::wstring sName) const
 Name: CIccTagDict::GetNameLocalized.
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
std::wstring GetValue (const char *szName, bool *bIsSet=NULL) const
 Name: CIccTagDict::GetValue.
 
std::wstring GetValue (const icUnicodeChar *szName, bool *bIsSet=NULL) const
 Name: CIccTagDict::GetValue.
 
std::wstring GetValue (std::wstring sName, bool *bIsSet=NULL) const
 Name: CIccTagDict::GetValue.
 
CIccTagMultiLocalizedUnicodeGetValueLocalized (const char *szName) const
 Name: CIccTagDict::GetValueLocalized.
 
CIccTagMultiLocalizedUnicodeGetValueLocalized (const icUnicodeChar *szName) const
 Name: CIccTagDict::GetValueLocalized.
 
CIccTagMultiLocalizedUnicodeGetValueLocalized (std::wstring sName) const
 Name: CIccTagDict::GetValueLocalized.
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagDictoperator= (const CIccTagDict &dict)
 Name: &operator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagDict::Read.
 
bool Remove (const char *szName)
 Name: CIccTagDict::Remove.
 
bool Remove (const icUnicodeChar *szName)
 Name: CIccTagDict::Remove.
 
bool Remove (std::wstring sName)
 Name: CIccTagDict::Remove.
 
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)
 Name: CIccTagDict::Set.
 
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 icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagDict::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagDict::Write.
 
virtual ~CIccTagDict ()
 Name: CIccTagDict::~CIccTagDict.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
virtual bool IsArrayType ()
 
virtual bool IsMBBType ()
 
virtual bool IsNumArrayType () const
 
virtual bool IsSupported ()
 Function: IsSupported(size, pIO) - Check if tag fully supported for apply purposes.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO, CIccProfile *pProfile)
 Function: Read(size, pIO) - Read tag from file.
 
virtual bool ReadAll ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual ~CIccTag ()
 Name: CIccTag::CIccTag.
 
- Public Member Functions inherited from CIccTagXml
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
virtual ~CIccTagXml (void)
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 
- Public Attributes inherited from CIccTagDict
CIccNameValueDictm_Dict
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 
- Protected Member Functions inherited from CIccTagDict
void Cleanup ()
 Name: CIccTagDict::Cleanup.
 
icUInt32Number MaxPosRecSize ()
 Name: CIccTagDict::MaxPosRecSize;.
 
- Protected Attributes inherited from CIccTagDict
bool m_bBadAlignment
 
icUInt32Number m_tagSize
 
icUInt32Number m_tagStart
 

Detailed Description

Definition at line 627 of file IccTagXml.h.

Constructor & Destructor Documentation

◆ ~CIccTagXmlDict()

virtual CIccTagXmlDict::~CIccTagXmlDict ( )
inlinevirtual

Definition at line 630 of file IccTagXml.h.

630{}

Member Function Documentation

◆ GetClassName()

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

Reimplemented from CIccTagDict.

Definition at line 632 of file IccTagXml.h.

632{return "CIccTagXmlDict"; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTagXmlDict::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

Definition at line 634 of file IccTagXml.h.

634{return this; }

◆ ParseXml()

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

Implements CIccTagXml.

Definition at line 4267 of file IccTagXml.cpp.

4268{
4269 m_Dict->clear();
4270
4271 for (pNode = icXmlFindNode(pNode, "DictEntry"); pNode; pNode = icXmlFindNode(pNode->next, "DictEntry")) {
4272 CIccDictEntryPtr ptr;
4273 CIccDictEntry *pDesc = new CIccDictEntry();
4274 xmlAttr *pAttr;
4275 CIccUTF16String str;
4276
4277 if (!pDesc)
4278 return false;
4279 ptr.ptr = pDesc;
4280
4281 str = icXmlAttrValue(pNode, "Name", "");
4282 str.ToWString(pDesc->GetName());
4283
4284 pAttr = icXmlFindAttr(pNode, "Value");
4285 if (pAttr) {
4286 std::wstring wstr;
4287 str = icXmlAttrValue(pAttr, "");
4288 str.ToWString(wstr);
4289
4290 pDesc->SetValue(wstr);
4291 }
4292
4293 xmlNode *pChild;
4294
4295 for (pChild = pNode->children; pChild; pChild = pChild->next) {
4296 if (pChild->type == XML_ELEMENT_NODE && !icXmlStrCmp(pChild->name, "LocalizedName")) {
4298 if (!pTag) {
4299 pTag = new CIccTagMultiLocalizedUnicode();
4300 pDesc->SetNameLocalized(pTag);
4301 }
4302
4303 if ((pAttr = icXmlFindAttr(pChild, "LanguageCountry")) && pChild->children) {
4304 xmlNode *pText;
4306
4307 for (pText = pChild->children; pText && pText->type != XML_TEXT_NODE && pText->type != XML_CDATA_SECTION_NODE; pText = pText->next);
4308
4309 if (pText) {
4310 CIccUTF16String str((const char*)pText->content);
4311
4312 pTag->SetText(str.c_str(), (icLanguageCode)(lc>>16), (icCountryCode)(lc & 0xffff));
4313 }
4314 else {
4315 pTag->SetText("");
4316 }
4317 }
4318 }
4319 else if (pChild->type == XML_ELEMENT_NODE && !icXmlStrCmp(pChild->name, "LocalizedValue")) {
4321 if (!pTag) {
4322 pTag = new CIccTagMultiLocalizedUnicode();
4323 pDesc->SetValueLocalized(pTag);
4324 }
4325
4326 if ((pAttr = icXmlFindAttr(pChild, "LanguageCountry")) && pChild->children) {
4327 xmlNode *pText;
4329
4330 for (pText = pChild->children; pText && pText->type != XML_TEXT_NODE && pText->type != XML_CDATA_SECTION_NODE; pText = pText->next);
4331
4332 if (pText) {
4333 CIccUTF16String str((const char*)pText->content);
4334 pTag->SetText(str.c_str(), (icLanguageCode)(lc>>16), (icCountryCode)(lc & 0xffff));
4335 }
4336 else {
4337 pTag->SetText("");
4338 }
4339 }
4340 }
4341 }
4342
4343 m_Dict->push_back(ptr);
4344 }
4345
4346 return true;
4347}
icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
unsigned int icUInt32Number
Data Class: CIccDictEntry.
Definition IccTagDict.h:97
bool SetValueLocalized(CIccTagMultiLocalizedUnicode *pValueLocalized)
Name: CIccDictEntry::SetValueLocalized.
bool SetNameLocalized(CIccTagMultiLocalizedUnicode *pNameLocalized)
Name: CIccDictEntry::SetNameLocalized.
CIccTagMultiLocalizedUnicode * GetValueLocalized()
Definition IccTagDict.h:119
CIccTagMultiLocalizedUnicode * GetNameLocalized()
Definition IccTagDict.h:118
std::wstring & GetName()
Definition IccTagDict.h:109
bool SetValue(std::wstring sValue)
Definition IccTagDict.h:139
CIccDictEntry * ptr
Definition IccTagDict.h:141
CIccNameValueDict * m_Dict
Definition IccTagDict.h:214
Class: CIccTagMultiLocalizedUnicode.
void SetText(const icChar *szText, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.
const icUInt16Number * c_str()
Definition IccUtilXml.h:93
const wchar_t * ToWString(std::wstring &buf)
icUInt16Number icCountryCode
icUInt16Number icLanguageCode

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

+ Here is the call graph for this function:

◆ ToXml()

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

Implements CIccTagXml.

Definition at line 4206 of file IccTagXml.cpp.

4207{
4208 std::string info;
4209
4210 CIccNameValueDict::iterator nvp;
4211
4212 for (nvp=m_Dict->begin(); nvp!=m_Dict->end(); nvp++) {
4213 CIccDictEntry *nv = nvp->ptr;
4214 if (!nv)
4215 continue;
4216
4217 char buf[256];
4218 char data[256];
4219 char fix[256];
4220 std::string bufstr;
4221
4222 xml += blanks + " <DictEntry Name=\"";
4223 xml += icFixXml(fix, icUtf16ToUtf8(bufstr, (icUInt16Number*)nv->GetName().c_str(), (int)nv->GetName().size()));
4224 xml += "\"";
4225
4226 if (nv->IsValueSet()) {
4227 xml += " Value=\"";
4228 xml += icFixXml(fix, icUtf16ToUtf8(bufstr, (icUInt16Number*)nv->GetValue().c_str(), (int)nv->GetValue().size()));
4229 xml += "\"";
4230 }
4231
4232 if (!nv->GetNameLocalized() && !nv->GetValueLocalized()) {
4233 xml += "/>\n";
4234 }
4235 else {
4236 xml += ">\n";
4237
4238 if (nv->GetNameLocalized()) {
4239 CIccMultiLocalizedUnicode::iterator i;
4240
4241 for (i=nv->GetNameLocalized()->m_Strings->begin(); i!=nv->GetNameLocalized()->m_Strings->end(); i++) {
4242 sprintf(buf, " <LocalizedName LanguageCountry=\"%s\"", icFixXml(fix, icGetSigStr(data, (i->m_nLanguageCode<<16) + i->m_nCountryCode)));
4243 xml += blanks + buf;
4244
4245 sprintf(buf, "><![CDATA[%s]]></LocalizedName>\n", icFixXml(fix, icUtf16ToUtf8(bufstr, i->GetBuf(), i->GetLength())));
4246 xml += buf;
4247 }
4248 }
4249 if (nv->GetValueLocalized()) {
4250 CIccMultiLocalizedUnicode::iterator i;
4251
4252 for (i=nv->GetValueLocalized()->m_Strings->begin(); i!=nv->GetValueLocalized()->m_Strings->end(); i++) {
4253 sprintf(buf, " <LocalizedValue LanguageCountry=\"%s\"", icFixXml(fix, icGetSigStr(data, (i->m_nLanguageCode<<16) + i->m_nCountryCode)));
4254 xml += blanks + buf;
4255
4256 sprintf(buf, "><![CDATA[%s]]></LocalizedValue>\n", icFixXml(fix, icUtf16ToUtf8(bufstr, i->GetBuf(), i->GetLength())));
4257 xml += buf;
4258 }
4259 }
4260 xml += blanks + " </DictEntry>\n";
4261 }
4262 }
4263 return true;
4264}
const icChar * icGetSigStr(icChar *pBuf, icUInt32Number nSig)
Definition IccUtil.cpp:1056
const char * icUtf16ToUtf8(std::string &buf, const icUInt16Number *szSrc, int sizeSrc)
const char * icFixXml(std::string &buf, const char *szStr)
bool IsValueSet()
Definition IccTagDict.h:115
std::wstring GetValue()
Definition IccTagDict.h:114
CIccMultiLocalizedUnicode * m_Strings
unsigned short icUInt16Number

References CIccDictEntry::GetName(), CIccDictEntry::GetNameLocalized(), CIccDictEntry::GetValue(), CIccDictEntry::GetValueLocalized(), icFixXml(), icGetSigStr(), icUtf16ToUtf8(), CIccDictEntry::IsValueSet(), and CIccTagMultiLocalizedUnicode::m_Strings.

+ Here is the call graph for this function:

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