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

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlTextDescription:
+ Collaboration diagram for CIccTagXmlTextDescription:

Public Member Functions

 CIccTagXmlTextDescription ()
 
 CIccTagXmlTextDescription (const CIccTagXmlTextDescription &ITTD)
 
virtual ~CIccTagXmlTextDescription ()
 
icUInt32Number Capacity () const
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 
virtual void DetachIO ()
 
icCharGetBuffer (icUInt32Number nSize)
 
virtual const char * GetClassName () const
 
virtual const char * GetExtClassName () const
 
virtual const char * GetExtDerivedClassName () const
 
virtual IIccExtensionTagGetExtension ()
 
virtual icArraySignature GetTagArrayType () const
 
virtual icStructSignature GetTagStructType () const
 
const icCharGetText () const
 
virtual icTagTypeSignature GetType () const
 
icUInt16NumberGetUnicodeBuffer (icUInt32Number nSize)
 
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 ()
 
void Release ()
 
void ReleaseUnicode ()
 
void SetText (const icChar *szText)
 
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

icUInt32Number m_nReserved
 

Protected Attributes

bool m_bInvalidScript
 
icUInt32Number m_nASCIISize
 
icUInt16Number m_nScriptCode
 
icUInt8Number m_nScriptSize
 
icUInt32Number m_nUnicodeLanguageCode
 
icUInt32Number m_nUnicodeSize
 
icUInt8Number m_szScriptText [67]
 
icCharm_szText
 
icUInt16Numberm_uzUnicodeText
 

Detailed Description

Constructor & Destructor Documentation

◆ CIccTagXmlTextDescription() [1/2]

CIccTagXmlTextDescription::CIccTagXmlTextDescription ( )
inline
CIccTagTextDescription()
Definition IccTagBasic.cpp:1913

References CIccTagTextDescription::CIccTagTextDescription().

+ Here is the call graph for this function:

◆ CIccTagXmlTextDescription() [2/2]

CIccTagXmlTextDescription::CIccTagXmlTextDescription ( const CIccTagXmlTextDescription ITTD)
inline
190: CIccTagTextDescription(ITTD) {}

References CIccTagTextDescription::CIccTagTextDescription().

Referenced by NewCopy().

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

◆ ~CIccTagXmlTextDescription()

virtual CIccTagXmlTextDescription::~CIccTagXmlTextDescription ( )
inlinevirtual
191{}

Member Function Documentation

◆ Capacity()

icUInt32Number CIccTagTextDescription::Capacity ( ) const
inlineinherited
503{ return m_nASCIISize; }
icUInt32Number m_nASCIISize
Definition IccTagBasic.h:512

References CIccTagTextDescription::m_nASCIISize.

◆ 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 CIccTagTextDescription::Describe ( std::string &  sDescription,
int  nVerboseness 
)
virtualinherited

Name: CIccTagTextDescription::Describe

Purpose: Dump data associated with the tag to a string

Args: sDescription - string to concatenate tag dump to

Reimplemented from CIccTag.

2200{
2201 sDescription += "TextDescription Length = ";
2202 if (m_szText && *m_szText) {
2203 char buf[40];
2204 sprintf(buf, "%zu bytes\n", strlen(m_szText));
2205 sDescription += buf;
2206 }
2207 else
2208 sDescription += "0 (NULL)";
2209
2210 if (nVerboseness > 25) {
2211 sDescription += "\"";
2212 if (m_szText && *m_szText) {
2213 if ((nVerboseness > 50) || (strlen(m_szText) < BRIEF_STRING_SIZE)) {
2214 // output entire string if short or doing verbose
2215 sDescription += m_szText;
2216 }
2217 else {
2218 // copy just first part of string to keep nVerboseness under control
2219 char buf[BRIEF_STRING_SIZE+1];
2220 strncpy(buf, m_szText, BRIEF_STRING_SIZE);
2221 buf[BRIEF_STRING_SIZE] = '\0'; // ensure NULL termination
2222 sDescription += buf;
2223 sDescription += "\n... <!truncated!>";
2224 }
2225 }
2226 sDescription += "\"\n";
2227 }
2228}
#define BRIEF_STRING_SIZE
Definition IccTagBasic.cpp:103
icChar * m_szText
Definition IccTagBasic.h:511

References CIccTagTextDescription::m_szText.

◆ 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{}

◆ GetBuffer()

icChar * CIccTagTextDescription::GetBuffer ( icUInt32Number  nSize)
inherited

Name: CIccTagTextDescription::GetBuffer

Purpose: This function allocates room and returns pointer to data buffer to put string into

Args: nSize = Requested size of data buffer.

Return:

2289{
2290 if (m_nASCIISize < nSize) {
2291 m_szText = (icChar*)icRealloc(m_szText, nSize+1);
2292
2293 m_szText[nSize] = '\0';
2294
2295 m_nASCIISize = nSize;
2296 }
2297
2298 return m_szText;
2299}
char icChar
Definition IccDefs.h:110
ICCPROFLIB_API void * icRealloc(void *ptr, size_t size)
Definition IccUtil.cpp:111

References icRealloc(), CIccTagTextDescription::m_nASCIISize, and CIccTagTextDescription::m_szText.

Referenced by ParseXml(), CIccTagTextDescription::Read(), and CIccTagTextDescription::SetText().

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

◆ GetClassName()

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

Reimplemented from CIccTagTextDescription.

195{return "CIccTagXmlTextDescription"; }

◆ 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 * CIccTagXmlTextDescription::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

197{return this; }

◆ 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:

◆ GetText()

const icChar * CIccTagTextDescription::GetText ( ) const
inlineinherited
497{ return m_szText; }

References CIccTagTextDescription::m_szText.

Referenced by CIccProfileIdDesc::CIccProfileIdDesc(), icGetTagText(), and main().

+ Here is the caller graph for this function:

◆ GetType()

virtual icTagTypeSignature CIccTagTextDescription::GetType ( ) const
inlinevirtualinherited

Function: GetType()

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

Reimplemented from CIccTag.

489{ return icSigTextDescriptionType; }
@ icSigTextDescriptionType
Definition icProfileHeader.h:566

References icSigTextDescriptionType.

Referenced by CIccTagTextDescription::Write().

+ Here is the caller graph for this function:

◆ GetUnicodeBuffer()

icUInt16Number * CIccTagTextDescription::GetUnicodeBuffer ( icUInt32Number  nSize)
inherited

Name: CIccTagTextDescription::GetUnicodeBuffer

Purpose: This function allocates room and returns pointer to data buffer to put string into

Args: nSize = Requested size of data buffer.

Return:

2333{
2334 if (m_nUnicodeSize < nSize) {
2336
2337 m_uzUnicodeText[nSize] = 0;
2338
2339 m_nUnicodeSize = nSize;
2340 }
2341
2342 return m_uzUnicodeText;
2343}
unsigned short icUInt16Number
Definition icProfileHeader.h:256
icUInt16Number * m_uzUnicodeText
Definition IccTagBasic.h:514
icUInt32Number m_nUnicodeSize
Definition IccTagBasic.h:515

References icRealloc(), CIccTagTextDescription::m_nUnicodeSize, and CIccTagTextDescription::m_uzUnicodeText.

Referenced by ParseXml(), and CIccTagTextDescription::Read().

+ 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; }

◆ NewCopy()

virtual CIccTag * CIccTagXmlTextDescription::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 CIccTagTextDescription.

193{return new CIccTagXmlTextDescription(*this);}
CIccTagXmlTextDescription()
Definition IccTagXml.h:189

References CIccTagXmlTextDescription().

+ Here is the call graph for this function:

◆ ParseXml()

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

Implements CIccTagXml.

382{
383 pNode = icXmlFindNode(pNode, "TextData");
384
385 // support for reading desc, dmmd, and dmnd tags from file.
386 // if (!pNode || !pNode->children)
387 if (!pNode)
388 return false;
389
390 // search for "file" attribute in <TextDescription/> tag
391 const icChar *filename = icXmlAttrValue(pNode, "File");
392
393 // file exists
394 if (filename[0]) {
395 CIccIO *file = IccOpenFileIO(filename, "rb");
396
397 if (!file){
398 parseStr += "Error! - File '";
399 parseStr += filename;
400 parseStr +="' not found.\n";
401 delete file;
402 return false;
403 }
404
405 icUInt32Number fileLength = file->GetLength();
406 char *buf = (char *)malloc(fileLength);
407
408 if (!buf) {
409 perror("Memory Error");
410 parseStr += "'";
411 parseStr += filename;
412 parseStr += "' may not be a valid text file.\n";
413 delete file;
414 return false;
415 }
416
417 if (file->ReadLine(buf, fileLength)!=fileLength) {
418 parseStr += "Error while reading file '";
419 parseStr += filename;
420 parseStr += "'. Size read is not equal to file length. File may not be a valid text file.\n";
421 free(buf);
422 delete file;
423 return false;
424 }
425
426 // set ANSII string
427 std::string ansiStr;
428 icUtf8ToAnsi(ansiStr, buf);
429
430 icUInt32Number nStrSize = (icUInt32Number)ansiStr.size();
431 GetBuffer(nStrSize);
432 if (nStrSize) {
433 memcpy(m_szText, ansiStr.c_str(), nStrSize);
434 m_nASCIISize = nStrSize + 1;
435 }
436 else
437 m_szText[0] = '\0';
438
439 // set Unicode String
440 CIccUTF16String wstr(buf);
441
442 nStrSize = (icUInt32Number)wstr.Size();
444
445 if (nStrSize) {
446 // assign each entry in wstr to m_uzUnicodeText
447 for (int i=0; i < (int) nStrSize; i++) {
448 m_uzUnicodeText[i] = wstr[i];
449 }
450
451 // include the null termintor in the string size.
452 m_nUnicodeSize = nStrSize + 1;
453 }
454 else
455 m_uzUnicodeText[0] = 0;
456
457 // Set ScriptCode
459 m_nScriptSize = (icUInt8Number) fileLength + 1;
460 memcpy(m_szScriptText, buf, 67);
461
462 delete file;
463 }
464
465 // file does not exist
466 else {
467 std::string str = icXmlParseTextString(pNode, parseStr);
468 icUInt32Number nSize = (icUInt32Number)str.size();
469 icChar *pBuf = GetBuffer(nSize);
470
471 if (nSize) {
472 memcpy(m_szText, str.c_str(), nSize);
473
474 // include the null termintor in the string size.
475 m_nASCIISize = nSize + 1;
476 }
477 else
478 m_szText[0] = '\0';
479
480 Release();
481
482 // support for automatically generating unicode and scriptcode tags if these do not
483 // exist in the XML file.
484 bool unicodeExists = false;
485 bool scriptcodeExists = false;
486 for (;pNode; pNode = pNode->next) {
487 if (pNode->type==XML_ELEMENT_NODE) {
488 if (!icXmlStrCmp(pNode->name, "Unicode")) {
489 const icChar *pRegion = icXmlAttrValue(pNode, "LanguageCode");
490
491 // *pRegion may not have value.
492 if (pRegion && /* *pRegion && */pNode->children && pNode->children->content) {
493 CIccUTF16String wstr((const char*)pNode->children->content);
494
495 nSize = (icUInt32Number)wstr.Size();
496
497 // set size of m_uzUnicodeText
499 if (nSize) {
500
501 // assign each entry in wstr to m_uzUnicodeText
502 for (int i=0; i < (int) nSize; i++) {
503 m_uzUnicodeText[i] = wstr[i];
504 }
505
506 // include the null termintor in the string size.
507 m_nUnicodeSize = nSize + 1;
508
509 unicodeExists = true;
510 }
511 else
512 m_uzUnicodeText[0] = 0;
513 }
514 }
515 else if (!icXmlStrCmp(pNode->name, "MacScript")) {
516 const icChar *pScript = icXmlAttrValue(pNode, "ScriptCode");
517
518 if (pScript && *pScript) {
519 icUInt32Number nCode=0;
520
521 sscanf(pScript, "%x", &nCode);
523 if (pNode->children && pNode->children->content) {
524 // set m_nScriptSize as receiver the return value of icXmlGetHexData
525 // no need to add 1 since the return value is already exact.
526 m_nScriptSize = (icUInt8Number) icXmlGetHexData(m_szScriptText, (const char*)pNode->children->content, sizeof(m_szScriptText));
527 scriptcodeExists = true;
528 }
529 else
530 m_szScriptText[0] = 0;
531 }
532 }
533 }
534 }
535#if 0
536 // automatically generate unicode tag in the profile if it does not exist
537 if (!unicodeExists){
538
540
541 if (nSize) {
542 // assign each entry in wstr to m_uzUnicodeText
543 for (int i=0; i < (int) nSize; i++) {
544 m_uzUnicodeText[i] = str[i];
545 }
546
547 // include the null termintor in the string size.
548 m_nUnicodeSize = nSize + 1;
549 }
550 else
551 m_uzUnicodeText[0] = 0;
552 }
553
554 // automatically generate scriptcode tag in the profile if it does not exist
555 if (!scriptcodeExists){
558 memcpy(m_szScriptText, m_szText, 67);
559
560 }
561#endif
562 }
563
564 return true;
565}
unsigned char icUInt8Number
Definition icProfileHeader.h:250
unsigned long icUInt32Number
Definition icProfileHeader.h:262
static std::string icXmlParseTextString(xmlNode *pNode, std::string &parseStr, bool bConvert=true)
Definition IccTagXml.cpp:180
const char * icUtf8ToAnsi(std::string &buf, const char *szSrc)
Definition IccUtilXml.cpp:397
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
Definition IccUtilXml.cpp:687
icUInt32Number icXmlGetHexData(void *pBuf, const char *szText, icUInt32Number nBufSize)
Definition IccUtilXml.cpp:609
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault="")
Definition IccUtilXml.cpp:572
CIccIO * IccOpenFileIO(const icChar *szFilename, const char *szAttr)
Definition IccIoXml.cpp:100
Definition IccIO.h:97
virtual icInt32Number GetLength()
Definition IccIO.h:130
icInt32Number ReadLine(void *pBuf8, icInt32Number nNum=256)
Definition IccIO.cpp:93
icUInt16Number m_nScriptCode
Definition IccTagBasic.h:520
icChar * GetBuffer(icUInt32Number nSize)
Definition IccTagBasic.cpp:2288
icUInt8Number m_szScriptText[67]
Definition IccTagBasic.h:518
icUInt16Number * GetUnicodeBuffer(icUInt32Number nSize)
Definition IccTagBasic.cpp:2332
void Release()
Definition IccTagBasic.cpp:2309
icUInt8Number m_nScriptSize
Definition IccTagBasic.h:519
Definition IccUtilXml.h:75

References CIccUTF16String::CIccUTF16String(), CIccTagTextDescription::GetBuffer(), CIccIO::GetLength(), CIccTagTextDescription::GetUnicodeBuffer(), IccOpenFileIO(), icUtf8ToAnsi(), icXmlAttrValue(), icXmlFindNode(), icXmlGetHexData(), icXmlParseTextString(), CIccTagTextDescription::m_nASCIISize, CIccTagTextDescription::m_nScriptCode, CIccTagTextDescription::m_nScriptSize, CIccTagTextDescription::m_nUnicodeSize, CIccTagTextDescription::m_szScriptText, CIccTagTextDescription::m_szText, CIccTagTextDescription::m_uzUnicodeText, CIccUTF16String::operator[](), CIccIO::ReadLine(), CIccTagTextDescription::Release(), and CIccUTF16String::Size().

+ Here is the call graph for this function:

◆ Read() [1/2]

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

Name: CIccTagTextDescription::Read

Purpose: Read in the tag contents into a data block

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

Return: true = successful, false = failure

Reimplemented from CIccTag.

2056{
2058 icUInt32Number nEnd;
2059
2060 m_szText[0] = '\0';
2061 nEnd = pIO->Tell() + size;
2062
2063 if (size<3*sizeof(icUInt32Number) || !pIO)
2064 return false;
2065
2066 icUInt32Number nSize;
2067
2068 if (!pIO->Read32(&sig) ||
2069 !pIO->Read32(&m_nReserved) ||
2070 !pIO->Read32(&nSize))
2071 return false;
2072
2073 if (3*sizeof(icUInt32Number) + nSize > size)
2074 return false;
2075
2076 icChar *pBuf = GetBuffer(nSize);
2077
2078 if (nSize) {
2079 if (pIO->Read8(pBuf, nSize) != (icInt32Number)nSize) {
2080 return false;
2081 }
2082 }
2083 else
2084 m_szText[0] = '\0';
2085
2086 Release();
2087
2088 if (pIO->Tell() + 2 * sizeof(icUInt32Number) > nEnd)
2089 return false;
2090
2091 if (!pIO->Read32(&m_nUnicodeLanguageCode) ||
2092 !pIO->Read32(&nSize))
2093 return false;
2094
2095 // Calculations in GetUnicodeBuffer() can cause wrap-around error
2096 if (nSize == 0xFFFFFFFF)
2097 return false;
2098
2099 icUInt16Number *pBuf16 = GetUnicodeBuffer(nSize);
2100
2101 if (nSize) {
2102 if (pIO->Read16(pBuf16, nSize) != (icInt32Number)nSize) {
2103 return false;
2104 }
2105 }
2106 else
2107 pBuf16[0] = 0;
2108
2110
2111 if (pIO->Tell()+3 > (icInt32Number)nEnd)
2112 return false;
2113
2114 if (!pIO->Read16(&m_nScriptCode) ||
2115 !pIO->Read8(&m_nScriptSize))
2116 return false;
2117
2118 if (pIO->Tell() + m_nScriptSize> (icInt32Number)nEnd ||
2119 m_nScriptSize > sizeof(m_szScriptText))
2120 return false;
2121
2122 int nScriptLen = pIO->Read8(m_szScriptText, 67);
2123
2124 if (!nScriptLen)
2125 return false;
2126
2127 if (nScriptLen<67) {
2128 memset(&m_szScriptText[0], 0, 67-nScriptLen);
2129 m_bInvalidScript = true;
2130 }
2131
2132 return true;
2133}
long icInt32Number
Definition icProfileHeader.h:291
icTagTypeSignature
Definition icProfileHeader.h:526
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:104
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
virtual icInt32Number Tell()
Definition IccIO.h:133
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
Definition IccTagBasic.h:235
icUInt32Number m_nUnicodeLanguageCode
Definition IccTagBasic.h:516
void ReleaseUnicode()
Definition IccTagBasic.cpp:2353
bool m_bInvalidScript
Definition IccTagBasic.h:522

References CIccTagTextDescription::GetBuffer(), CIccTagTextDescription::GetUnicodeBuffer(), CIccTagTextDescription::m_bInvalidScript, CIccTag::m_nReserved, CIccTagTextDescription::m_nScriptCode, CIccTagTextDescription::m_nScriptSize, CIccTagTextDescription::m_nUnicodeLanguageCode, CIccTagTextDescription::m_szScriptText, CIccTagTextDescription::m_szText, CIccIO::Read16(), CIccIO::Read32(), CIccIO::Read8(), CIccTagTextDescription::Release(), CIccTagTextDescription::ReleaseUnicode(), 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; }

◆ Release()

void CIccTagTextDescription::Release ( )
inherited

Name: CIccTagTextDescription::Release

Purpose: This will resize the buffer to fit the zero terminated string in the buffer.

2310{
2311 icUInt32Number nSize = (icUInt32Number)strlen(m_szText);
2312
2313 if (nSize < m_nASCIISize-1) {
2314 m_szText=(icChar*)icRealloc(m_szText, nSize+1);
2315 m_nASCIISize = nSize+1;
2316 }
2317}

References icRealloc(), CIccTagTextDescription::m_nASCIISize, and CIccTagTextDescription::m_szText.

Referenced by ParseXml(), CIccTagTextDescription::Read(), and CIccTagTextDescription::SetText().

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

◆ ReleaseUnicode()

void CIccTagTextDescription::ReleaseUnicode ( )
inherited

Name: CIccTagTextDescription::ReleaseUnicode

Purpose: This will resize the buffer to fit the zero terminated string in the buffer.

2354{
2355 int i;
2356 for (i=0; m_uzUnicodeText[i]; i++);
2357
2358 icUInt32Number nSize = i+1;
2359
2360 if (nSize < m_nUnicodeSize-1) {
2362 m_nUnicodeSize = nSize+1;
2363 }
2364}

References icRealloc(), CIccTagTextDescription::m_nUnicodeSize, and CIccTagTextDescription::m_uzUnicodeText.

Referenced by CIccTagTextDescription::Read().

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

◆ SetText()

void CIccTagTextDescription::SetText ( const icChar szText)
inherited

Name: CIccTagTextDescription::SetText

Purpose: Allows text data associated with the tag to be set.

Args: szText - zero terminated string to put in tag

2242{
2243 m_bInvalidScript = false;
2244
2245 if (!szText) {
2246 SetText("");
2247 return;
2248 }
2249
2250 icUInt32Number len=(icUInt32Number)strlen(szText) + 1;
2251 icChar *szBuf = GetBuffer(len);
2252
2253 strcpy(szBuf, szText);
2254 Release();
2255}
void SetText(const icChar *szText)
Definition IccTagBasic.cpp:2241

References CIccTagTextDescription::GetBuffer(), CIccTagTextDescription::m_bInvalidScript, CIccTagTextDescription::Release(), and CIccTagTextDescription::SetText().

Referenced by CIccTagTextDescription::operator=(), and CIccTagTextDescription::SetText().

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

◆ ToXml()

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

Implements CIccTagXml.

337{
338 std::string fix;
339 std::string buf;
340 char data[256]; // Adjust the size as needed
341 std::string datastr;
342
343 icXmlDumpTextData(xml, blanks, m_szText);
344
345 // Added support for <![CData[Insert Text here]]> for Unicode
346 if (m_uzUnicodeText[0]) {
347 if (m_nUnicodeLanguageCode == 0)
348 buf = "<Unicode>";
349 else {
351 icFixXml(fix, data);
352 buf = "<Unicode LanguageCode=\"" + fix + "\">";
353 }
354 xml += blanks + buf;
355
357 icFixXml(fix, datastr.c_str());
358 buf = "<![CDATA[" + fix + "]]></Unicode>\n";
359 xml += buf;
360 }
361
362 if (m_nScriptSize) {
363 buf = "<MacScript ScriptCode=\"" + std::to_string(m_nScriptCode) + "\">";
364 xml += blanks + buf;
365
366 std::stringstream ss;
367 for (int i = 0; i < m_nScriptSize; i++) {
368 ss << std::hex << std::uppercase << std::setw(2) << std::setfill('0')
369 << static_cast<int>(static_cast<unsigned char>(m_szScriptText[i]));
370 }
371 buf = ss.str();
372
373 xml += buf;
374 xml += "</MacScript>\n";
375 }
376
377 return true;
378}
ICCPROFLIB_API const icChar * icGetSigStr(icChar *pBuf, icUInt32Number nSig)
Definition IccUtil.cpp:1056
static bool icXmlDumpTextData(std::string &xml, std::string blanks, const char *szText, bool bConvert=true)
Definition IccTagXml.cpp:124
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

References icFixXml(), icGetSigStr(), icUtf16ToUtf8(), icXmlDumpTextData(), CIccTagTextDescription::m_nScriptCode, CIccTagTextDescription::m_nScriptSize, CIccTagTextDescription::m_nUnicodeLanguageCode, CIccTagTextDescription::m_szScriptText, CIccTagTextDescription::m_szText, and CIccTagTextDescription::m_uzUnicodeText.

+ Here is the call graph for this function:

◆ Validate()

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

Name: CIccTagTextDescription::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.

2382{
2383 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
2384
2385 CIccInfo Info;
2386 std::string sSigPathName = Info.GetSigPathName(sigPath);
2387
2388 if (m_nScriptSize>67) {
2389 sReport += icMsgValidateNonCompliant;
2390 sReport += sSigPathName;
2391 sReport += " - ScriptCode count must not be greater than 67.\n";
2392
2394 }
2395
2396 if (m_bInvalidScript) {
2397 sReport += icMsgValidateNonCompliant;
2398 sReport += sSigPathName;
2399 sReport += " - ScriptCode must contain 67 bytes.\n";
2400
2402 }
2403
2404 return rv;
2405}
icValidateStatus
Definition IccDefs.h:119
@ icValidateNonCompliant
Definition IccDefs.h:122
ICCPROFLIB_API icValidateStatus icMaxStatus(icValidateStatus s1, icValidateStatus s2)
Definition IccUtil.cpp:244
ICCPROFLIB_API const char * icMsgValidateNonCompliant
Definition IccUtil.cpp:91
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

References CIccInfo::GetSigPathName(), icMaxStatus(), icMsgValidateNonCompliant, icValidateNonCompliant, CIccTagTextDescription::m_bInvalidScript, CIccTagTextDescription::m_nScriptSize, and CIccTag::Validate().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagTextDescription::Write ( CIccIO pIO)
virtualinherited

Name: CIccTagTextDescription::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.

2149{
2151 icUInt32Number zero = 0;
2152
2153 if (!pIO)
2154 return false;
2155
2156 if (!pIO->Write32(&sig) ||
2157 !pIO->Write32(&m_nReserved) ||
2158 !pIO->Write32(&m_nASCIISize))
2159 return false;
2160
2161 if (m_nASCIISize) {
2163 return false;
2164 }
2165
2166 if (!pIO->Write32(&m_nUnicodeLanguageCode))
2167 return false;
2168
2169 if (m_nUnicodeSize > 1) {
2170 if (!pIO->Write32(&m_nUnicodeSize) ||
2172 return false;
2173 }
2174 else {
2175 if (!pIO->Write32(&zero))
2176 return false;
2177 }
2178
2179 if (!pIO->Write16(&m_nScriptCode) ||
2180 !pIO->Write8(&m_nScriptSize) ||
2181 pIO->Write8(m_szScriptText, 67)!= 67)
2182 return false;
2183
2184 m_bInvalidScript = false;
2185
2186 return true;
2187}
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:105
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
Definition IccTagBasic.h:489

References CIccTagTextDescription::GetType(), CIccTagTextDescription::m_bInvalidScript, CIccTagTextDescription::m_nASCIISize, CIccTag::m_nReserved, CIccTagTextDescription::m_nScriptCode, CIccTagTextDescription::m_nScriptSize, CIccTagTextDescription::m_nUnicodeLanguageCode, CIccTagTextDescription::m_nUnicodeSize, CIccTagTextDescription::m_szScriptText, CIccTagTextDescription::m_szText, CIccTagTextDescription::m_uzUnicodeText, CIccIO::Write16(), CIccIO::Write32(), and CIccIO::Write8().

+ Here is the call graph for this function:

Field Documentation

◆ m_bInvalidScript

◆ m_nASCIISize

◆ 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_nScriptCode

◆ m_nScriptSize

◆ m_nUnicodeLanguageCode

◆ m_nUnicodeSize

◆ m_szScriptText

◆ m_szText

◆ m_uzUnicodeText


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