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

Class: CIccTagMultiLocalizedUnicode. More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagMultiLocalizedUnicode:
+ Collaboration diagram for CIccTagMultiLocalizedUnicode:

Public Member Functions

 CIccTagMultiLocalizedUnicode ()
 Name: CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode.
 
 CIccTagMultiLocalizedUnicode (const CIccTagMultiLocalizedUnicode &ITMLU)
 Name: CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagMultiLocalizedUnicode::Describe.
 
CIccLocalizedUnicodeFind (icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
 Name: refIccMAX::CIccTagMultiLocalizedUnicode::Find.
 
virtual const icCharGetClassName () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagMultiLocalizedUnicodeoperator= (const CIccTagMultiLocalizedUnicode &MultiLocalizedTag)
 Name: CIccTagMultiLocalizedUnicode::operator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagMultiLocalizedUnicode::Read.
 
void SetText (const icChar *szText, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
 Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.
 
void SetText (const icUInt16Number *sszUnicode16Text, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
 Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.
 
void SetText (const icUInt32Number *sszUnicode32Text, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
 Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagMultiLocalizedUnicode::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagMultiLocalizedUnicode::Write.
 
virtual ~CIccTagMultiLocalizedUnicode ()
 Name: CIccTagMultiLocalizedUnicode::~CIccTagMultiLocalizedUnicode.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
virtual IIccExtensionTagGetExtension ()
 
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 Attributes

CIccMultiLocalizedUnicodem_Strings
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 

Additional Inherited Members

- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 

Detailed Description

Class: CIccTagMultiLocalizedUnicode.

Purpose: The MultiLocalizedUnicode tag

Definition at line 1228 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagMultiLocalizedUnicode() [1/2]

CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode ( )

Name: CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode.

Purpose: Constructor

Definition at line 7311 of file IccTagBasic.cpp.

7312{
7314}
std::list< CIccLocalizedUnicode > CIccMultiLocalizedUnicode
List Class: CIccMultiLocalizedUnicode.
CIccMultiLocalizedUnicode * m_Strings

◆ CIccTagMultiLocalizedUnicode() [2/2]

CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode ( const CIccTagMultiLocalizedUnicode & ITMLU)

Name: CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode.

Purpose: Copy Constructor

Args: ITMLU = The CIccTagMultiLocalizedUnicode object to be copied

Definition at line 7327 of file IccTagBasic.cpp.

7328{
7330 *m_Strings = *ITMLU.m_Strings;
7331}

References m_Strings.

◆ ~CIccTagMultiLocalizedUnicode()

CIccTagMultiLocalizedUnicode::~CIccTagMultiLocalizedUnicode ( )
virtual

Name: CIccTagMultiLocalizedUnicode::~CIccTagMultiLocalizedUnicode.

Purpose: Destructor

Definition at line 7364 of file IccTagBasic.cpp.

7365{
7366 delete m_Strings;
7367}

Member Function Documentation

◆ Describe()

void CIccTagMultiLocalizedUnicode::Describe ( std::string & sDescription,
int nVerboseness )
virtual

Name: CIccTagMultiLocalizedUnicode::Describe.

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

Definition at line 7535 of file IccTagBasic.cpp.

7536{
7537 char szBuf[128];
7538 std::string utf8;
7539 int nSize = 127;
7540 CIccMultiLocalizedUnicode::iterator i;
7541
7542 for (i=m_Strings->begin(); i!=m_Strings->end(); i++) {
7543 if (i!=m_Strings->begin())
7544 sDescription += "\n";
7545
7546 // Bad ICCs can have unprintables...
7547 sDescription += "Language = ";
7548 if (isprint(i->m_nLanguageCode >> 8) && isprint(i->m_nLanguageCode & 0x00FF)) {
7549 sprintf(szBuf, "'%c%c'", i->m_nLanguageCode >> 8, i->m_nLanguageCode & 0x00FF);
7550 }
7551 else {
7552 sprintf(szBuf, "'\?\?' (0x%04X)", i->m_nLanguageCode);
7553 }
7554 sDescription += szBuf;
7555
7556 if (i->m_nCountryCode) {
7557 // Region Codes are optional according to ISO
7558 sDescription += ", Region = ";
7559 if (isprint(i->m_nCountryCode >> 8) && isprint(i->m_nCountryCode & 0x00FF)) {
7560 sprintf(szBuf, "'%c%c'", i->m_nCountryCode>>8, i->m_nCountryCode & 0x00FF);
7561 }
7562 else {
7563 sprintf(szBuf, "'\?\?' (0x%04X)", i->m_nCountryCode);
7564 }
7565 sDescription += szBuf;
7566 }
7567 sDescription += "\n";
7568
7569 i->GetText(utf8);
7570 sDescription += "\"";
7571 sDescription += utf8;
7572 sDescription += "\"\n";
7573 }
7574}

Referenced by CIccDictEntry::Describe(), and CIccProfileIdDesc::Describe().

+ Here is the caller graph for this function:

◆ Find()

CIccLocalizedUnicode * CIccTagMultiLocalizedUnicode::Find ( icLanguageCode nLanguageCode = icLanguageCodeEnglish,
icCountryCode nRegionCode = icCountryCodeUSA )

Name: refIccMAX::CIccTagMultiLocalizedUnicode::Find.

Purpose:

Args: nLanguageCode nRegionCode

Return: Pointer to CIccLocalizedUnicode object associated with the nLanguageCode and nRegionCode or NULL if not found

Definition at line 7629 of file IccTagBasic.cpp.

7631{
7632 CIccMultiLocalizedUnicode::iterator i;
7633
7634 for (i=m_Strings->begin(); i!=m_Strings->end(); i++) {
7635 if (i->m_nLanguageCode == nLanguageCode &&
7636 i->m_nCountryCode == nRegionCode) {
7637 return &(*i);
7638 }
7639 }
7640
7641 return NULL;
7642}

Referenced by icGetTagText().

+ Here is the caller graph for this function:

◆ GetClassName()

virtual const icChar * CIccTagMultiLocalizedUnicode::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlMultiLocalizedUnicode.

Definition at line 1238 of file IccTagBasic.h.

1238{ return "CIcciSigMultiLocalizedUnicode"; }

◆ GetType()

virtual icTagTypeSignature CIccTagMultiLocalizedUnicode::GetType ( ) const
inlinevirtual

Function: GetType()

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

Reimplemented from CIccTag.

Definition at line 1237 of file IccTagBasic.h.

@ icSigMultiLocalizedUnicodeType

References icSigMultiLocalizedUnicodeType.

◆ NewCopy()

virtual CIccTag * CIccTagMultiLocalizedUnicode::NewCopy ( ) const
inlinevirtual

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.

Reimplemented in CIccTagXmlMultiLocalizedUnicode.

Definition at line 1234 of file IccTagBasic.h.

1234{return new CIccTagMultiLocalizedUnicode(*this);}
CIccTagMultiLocalizedUnicode()
Name: CIccTagMultiLocalizedUnicode::CIccTagMultiLocalizedUnicode.

Referenced by CIccDictEntry::CIccDictEntry(), and CIccDictEntry::operator=().

+ Here is the caller graph for this function:

◆ operator=()

CIccTagMultiLocalizedUnicode & CIccTagMultiLocalizedUnicode::operator= ( const CIccTagMultiLocalizedUnicode & MultiLocalizedTag)

Name: CIccTagMultiLocalizedUnicode::operator=.

Purpose: Copy Operator

Args: MultiLocalizedTag = The CIccTagMultiLocalizedUnicode object to be copied

Definition at line 7344 of file IccTagBasic.cpp.

7345{
7346 if (&MultiLocalizedTag == this)
7347 return *this;
7348
7349 m_Strings->clear();
7350 *m_Strings = *MultiLocalizedTag.m_Strings;
7351
7352 return *this;
7353}

References m_Strings.

◆ Read()

bool CIccTagMultiLocalizedUnicode::Read ( icUInt32Number size,
CIccIO * pIO )
virtual

Name: CIccTagMultiLocalizedUnicode::Read.

Purpose: Read in the tag contents into a data block

Since MultiLocalizedUnicode tags can be embedded in other tags this function ensures that the current read pointer will be set to the position just after the last name record.

Args: size - # of bytes in tag, pIO - IO object to read tag from

Return: true = successful, false = failure

Reimplemented from CIccTag.

Definition at line 7388 of file IccTagBasic.cpp.

7389{
7391 icUInt32Number nNumRec, nRecSize;
7392 icLanguageCode nLanguageCode;
7393 icCountryCode nRegionCode;
7394 icUInt32Number nLength, nOffset, nNumChar;
7395
7396 if (!m_Strings->empty())
7397 m_Strings->clear();
7398
7399 if (sizeof(icTagTypeSignature) +
7400 sizeof(icUInt32Number)*3 > size)
7401 return false;
7402
7403 if (!pIO) {
7404 return false;
7405 }
7406
7407 icUInt32Number nTagPos = pIO->Tell();
7408
7409 if (!pIO->Read32(&sig) ||
7410 !pIO->Read32(&m_nReserved) ||
7411 !pIO->Read32(&nNumRec) ||
7412 !pIO->Read32(&nRecSize))
7413 return false;
7414
7415
7416 if (nRecSize!=12) { //Recognized version name records are 12 bytes each
7417 return false;
7418 }
7419
7420 icUInt32Number i;
7421 CIccLocalizedUnicode Unicode;
7422 icUInt32Number nLastPos = 0;
7423
7424 for (i=0; i<nNumRec; i++) {
7425 if (4*sizeof(icUInt32Number) + (i+1)*12 > size)
7426 return false;
7427
7428 pIO->Seek(nTagPos+4*sizeof(icUInt32Number) + i*12, icSeekSet);
7429
7430 if (!pIO->Read16(&nLanguageCode) ||
7431 !pIO->Read16(&nRegionCode) ||
7432 !pIO->Read32(&nLength) ||
7433 !pIO->Read32(&nOffset))
7434 return false;
7435
7436 if (nOffset+nLength > size)
7437 return false;
7438
7439 //Find out position of the end of last named record
7440 if (nOffset+nLength > nLastPos)
7441 nLastPos = nOffset + nLength;
7442
7443 nNumChar = nLength / sizeof(icUInt16Number);
7444
7445 if (!Unicode.SetSize(nNumChar))
7446 return false;
7447
7448 Unicode.m_nLanguageCode = nLanguageCode;
7449 Unicode.m_nCountryCode = nRegionCode;
7450
7451 pIO->Seek(nTagPos+nOffset, icSeekSet);
7452
7453 if (pIO->Read16(Unicode.GetBuf(), nNumChar) != (icInt32Number)nNumChar)
7454 return false;
7455
7456 m_Strings->push_back(Unicode);
7457 }
7458
7459 //Now seek past the last named record
7460 if (nLastPos > 0)
7461 pIO->Seek(nTagPos+nLastPos, icSeekSet);
7462
7463 return true;
7464}
icArraySignature sig
@ icSeekSet
Definition IccIO.h:83
icTagTypeSignature
unsigned int icUInt32Number
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
Data Class: CIccLocalizedUnicode.
icLanguageCode m_nLanguageCode
icUInt16Number * GetBuf() const
bool SetSize(icUInt32Number)
Name: CIccLocalizedUnicode::SetSize.
icCountryCode m_nCountryCode
icUInt32Number m_nReserved
unsigned short icUInt16Number
long icInt32Number
icUInt16Number icCountryCode
icUInt16Number icLanguageCode

References CIccLocalizedUnicode::GetBuf(), icSeekSet, CIccLocalizedUnicode::m_nCountryCode, CIccLocalizedUnicode::m_nLanguageCode, CIccIO::Read16(), CIccIO::Read32(), CIccIO::Seek(), CIccLocalizedUnicode::SetSize(), sig, and CIccIO::Tell().

Referenced by CIccProfileIdDesc::Read(), and CIccTagDict::Read().

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

◆ SetText() [1/3]

void CIccTagMultiLocalizedUnicode::SetText ( const icChar * szText,
icLanguageCode nLanguageCode = icLanguageCodeEnglish,
icCountryCode nRegionCode = icCountryCodeUSA )

Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.

Purpose:

Args: sszUnicodeText nLanguageCode RegionCode

Definition at line 7656 of file IccTagBasic.cpp.

7659{
7660 CIccLocalizedUnicode *pText = Find(nLanguageCode, nRegionCode);
7661
7662 if (!pText) {
7663 CIccLocalizedUnicode newText;
7664 newText.SetText(szText, nLanguageCode, nRegionCode);
7665 m_Strings->push_back(newText);
7666 }
7667 else {
7668 pText->SetText(szText, nLanguageCode, nRegionCode);
7669 }
7670}
bool SetText(const icChar *szText, icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
Name: CIccLocalizedUnicode::SetText.
CIccLocalizedUnicode * Find(icLanguageCode nLanguageCode=icLanguageCodeEnglish, icCountryCode nRegionCode=icCountryCodeUSA)
Name: refIccMAX::CIccTagMultiLocalizedUnicode::Find.

References CIccLocalizedUnicode::SetText().

Referenced by CDevLinkWriter::begin(), CIccProfileIdDesc::CIccProfileIdDesc(), main(), CIccTagXmlDict::ParseXml(), and CIccTagXmlProfileSequenceId::ParseXml().

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

◆ SetText() [2/3]

void CIccTagMultiLocalizedUnicode::SetText ( const icUInt16Number * sszUnicode16Text,
icLanguageCode nLanguageCode = icLanguageCodeEnglish,
icCountryCode nRegionCode = icCountryCodeUSA )

Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.

Purpose:

Args: sszUnicodeText nLanguageCode RegionCode

Definition at line 7685 of file IccTagBasic.cpp.

7688{
7689 CIccLocalizedUnicode *pText = Find(nLanguageCode, nRegionCode);
7690
7691 if (!pText) {
7692 CIccLocalizedUnicode newText;
7693 newText.SetText(sszUnicode16Text, nLanguageCode, nRegionCode);
7694 m_Strings->push_back(newText);
7695 }
7696 else {
7697 pText->SetText(sszUnicode16Text, nLanguageCode, nRegionCode);
7698 }
7699}

References CIccLocalizedUnicode::SetText().

+ Here is the call graph for this function:

◆ SetText() [3/3]

void CIccTagMultiLocalizedUnicode::SetText ( const icUInt32Number * sszUnicode32Text,
icLanguageCode nLanguageCode = icLanguageCodeEnglish,
icCountryCode nRegionCode = icCountryCodeUSA )

Name: refIccMAX::CIccTagMultiLocalizedUnicode::SetText.

Purpose:

Args: sszUnicodeText nLanguageCode RegionCode

Definition at line 7713 of file IccTagBasic.cpp.

7716{
7717 CIccLocalizedUnicode *pText = Find(nLanguageCode, nRegionCode);
7718
7719 if (!pText) {
7720 CIccLocalizedUnicode newText;
7721 newText.SetText(sszUnicode32Text, nLanguageCode, nRegionCode);
7722 m_Strings->push_back(newText);
7723 }
7724 else {
7725 pText->SetText(sszUnicode32Text, nLanguageCode, nRegionCode);
7726 }
7727}

References CIccLocalizedUnicode::SetText().

+ Here is the call graph for this function:

◆ Validate()

icValidateStatus CIccTagMultiLocalizedUnicode::Validate ( std::string sigPath,
std::string & sReport,
const CIccProfile * pProfile = NULL ) const
virtual

Name: CIccTagMultiLocalizedUnicode::Validate.

Purpose: Check tag data validity.

Args: sig = signature of tag being validated, sReport = String to add report information to

Return: icValidateStatusOK if valid, or other error status.

Reimplemented from CIccTag.

Definition at line 7591 of file IccTagBasic.cpp.

7592{
7593 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
7594
7595 CIccInfo Info;
7596 std::string sSigPathName = Info.GetSigPathName(sigPath);
7597
7598 if (!m_Strings->size()) {
7599 sReport += icMsgValidateWarning;
7600 sReport += sSigPathName;
7601 sReport += " - Empty tag!\n";
7603 }
7604
7605 CIccMultiLocalizedUnicode::iterator i;
7606 for (i=m_Strings->begin(); i!=m_Strings->end(); i++) {
7607 // TODO: Validate ISO-639 Language Codes and and ISO-3166 Country codes.
7608 // Needs to be done against a full set of codes or many false warnings.
7609 }
7610
7611 return rv;
7612}
icValidateStatus
Definition IccDefs.h:118
@ icValidateWarning
Definition IccDefs.h:120
icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Name: icMaxStatus.
Definition IccUtil.cpp:244
const char * icMsgValidateWarning
Definition IccUtil.cpp:90
Type: Class.
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
Function: Validate Each derived tag will implement it's own IsValid() function.

References CIccInfo::GetSigPathName(), icMaxStatus(), icMsgValidateWarning, icValidateWarning, and CIccTag::Validate().

Referenced by CIccProfileIdDesc::Validate().

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

◆ Write()

bool CIccTagMultiLocalizedUnicode::Write ( CIccIO * pIO)
virtual

Name: CIccTagMultiLocalizedUnicode::Write.

Purpose: Write the tag to a file

Args: pIO - The IO object to write tag to.

Return: true = succesful, false = failure

Reimplemented from CIccTag.

Definition at line 7480 of file IccTagBasic.cpp.

7481{
7483 icUInt32Number nNumRec=(icUInt32Number)m_Strings->size(), nRecSize=12;
7484 icUInt32Number nLength;
7485
7486 if (!pIO) {
7487 return false;
7488 }
7489
7490 if (!pIO->Write32(&sig) ||
7491 !pIO->Write32(&m_nReserved) ||
7492 !pIO->Write32(&nNumRec) ||
7493 !pIO->Write32(&nRecSize))
7494 return false;
7495
7496
7497 icUInt32Number nPos = 4*sizeof(icUInt32Number) + nNumRec*12;
7498
7499 CIccMultiLocalizedUnicode::iterator i;
7500
7501 for (i=m_Strings->begin(); i!=m_Strings->end(); i++) {
7502 nLength = i->GetLength() * sizeof(icUInt16Number);
7503
7504 if (!pIO->Write16(&i->m_nLanguageCode) ||
7505 !pIO->Write16(&i->m_nCountryCode) ||
7506 !pIO->Write32(&nLength) ||
7507 !pIO->Write32(&nPos))
7508 return false;
7509 nPos += nLength;
7510 }
7511
7512 for (i=m_Strings->begin(); i!=m_Strings->end(); i++) {
7513 nLength = i->GetLength();
7514
7515 if (nLength) {
7516 if (pIO->Write16(i->GetBuf(), nLength) != (icInt32Number)nLength)
7517 return false;
7518 }
7519 }
7520
7521 return true;
7522}
icInt32Number Write16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:122
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
virtual icTagTypeSignature GetType() const
Function: GetType()

References sig, CIccIO::Write16(), and CIccIO::Write32().

Referenced by CIccProfileIdDesc::Write().

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

Member Data Documentation

◆ m_Strings

CIccMultiLocalizedUnicode* CIccTagMultiLocalizedUnicode::m_Strings

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