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

Class: CIccTagUtf16Text() More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagUtf16Text:
+ Collaboration diagram for CIccTagUtf16Text:

Public Member Functions

icUInt32Number Capacity () const
 
 CIccTagUtf16Text ()
 Name: CIccTagUtf16Text::CIccTagUtf16Text.
 
 CIccTagUtf16Text (const CIccTagUtf16Text &ITT)
 Name: CIccTagUtf16Text::CIccTagUtf16Text.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagUtf16Text::Describe.
 
icUChar16GetBuffer (icUInt32Number nSize)
 Name: CIccTagUtf16Text::GetBuffer.
 
virtual const icCharGetClassName () const
 
icUInt32Number GetLength () const
 Name: CIccTagUtf16Text::GetLength.
 
const icUChar16GetText () const
 
const icCharGetText (std::string &bufStr) const
 Name: CIccTagUtf16Text::GetText.
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagUtf16Textoperator= (const CIccTagUtf16Text &TextTag)
 Name: CIccTagUtf16Text::operator=.
 
const icUChar16operator= (const icUChar16 *szText)
 Name: *CIccTagUtf16Textoperator=.
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagUtf16Text::Read.
 
void Release ()
 Name: CIccTagUtf16Text::Release.
 
void SetText (const icChar *szText)
 
void SetText (const icUChar *szText)
 Name: CIccTagUtf16Text::SetText.
 
void SetText (const icUChar16 *szText)
 Name: CIccTagUtf16Text::SetText.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagUtf16Text::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagUtf16Text::Write.
 
virtual ~CIccTagUtf16Text ()
 Name: CIccTagUtf16Text::~CIccTagUtf16Text.
 
- 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.
 

Protected Attributes

icUInt32Number m_nBufSize
 
icUChar16m_szText
 

Additional Inherited Members

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

Detailed Description

Class: CIccTagUtf16Text()

Purpose: The utf8TextType ICC tag

Definition at line 433 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagUtf16Text() [1/2]

CIccTagUtf16Text::CIccTagUtf16Text ( )

Name: CIccTagUtf16Text::CIccTagUtf16Text.

Purpose: Constructor

Definition at line 1499 of file IccTagBasic.cpp.

1500{
1501 m_szText = (icUChar16*)malloc(1*sizeof(icUChar16));
1502 m_szText[0] = 0;
1503 m_nBufSize = 1;
1504}
unsigned short icUChar16
Definition IccDefs.h:111
icUInt32Number m_nBufSize
icUChar16 * m_szText

◆ CIccTagUtf16Text() [2/2]

CIccTagUtf16Text::CIccTagUtf16Text ( const CIccTagUtf16Text & ITT)

Name: CIccTagUtf16Text::CIccTagUtf16Text.

Purpose: Copy Constructor

Args: ITT = The CIccTagText object to be copied

Definition at line 1516 of file IccTagBasic.cpp.

1517{
1518 m_szText = (icUChar16*)malloc(1*sizeof(icUChar16));
1519 m_szText[0] = 0;
1520 m_nBufSize = 1;
1521 SetText(ITT.m_szText);
1522}
void SetText(const icUChar16 *szText)
Name: CIccTagUtf16Text::SetText.

References m_szText.

◆ ~CIccTagUtf16Text()

CIccTagUtf16Text::~CIccTagUtf16Text ( )
virtual

Name: CIccTagUtf16Text::~CIccTagUtf16Text.

Purpose: Destructor

Definition at line 1555 of file IccTagBasic.cpp.

1556{
1557 free(m_szText);
1558}

Member Function Documentation

◆ Capacity()

icUInt32Number CIccTagUtf16Text::Capacity ( ) const
inline

Definition at line 463 of file IccTagBasic.h.

463{ return m_nBufSize; }

◆ Describe()

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

Name: CIccTagUtf16Text::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 1672 of file IccTagBasic.cpp.

1673{
1674 sDescription += "UTF16 Length = ";
1675 if (m_szText && *m_szText) {
1676 char buf[40];
1677 sprintf(buf, "%d bytes\n", m_nBufSize);
1678 sDescription += buf;
1679 }
1680 else
1681 sDescription += "0 (NULL)";
1682
1683 if (nVerboseness > 25) {
1684 sDescription += "\"";
1685 if (m_szText && *m_szText) {
1686 std::string s;
1687 if ((nVerboseness > 50) || (m_nBufSize < BRIEF_STRING_SIZE)) {
1688 // output entire string if short or doing verbose
1689 sDescription += GetText(s);
1690 }
1691 else {
1692 // copy just first part of string to keep nVerboseness under control
1693 char buf[BRIEF_STRING_SIZE + 1];
1694 strncpy(buf, GetText(s), BRIEF_STRING_SIZE);
1695 buf[BRIEF_STRING_SIZE] = '\0'; // ensure NULL termination
1696 sDescription += buf;
1697 sDescription += "\n... <!truncated!>";
1698 }
1699 }
1700 sDescription += "\"\n";
1701 }
1702
1703}
#define BRIEF_STRING_SIZE
const icUChar16 * GetText() const

References BRIEF_STRING_SIZE.

◆ GetBuffer()

icUChar16 * CIccTagUtf16Text::GetBuffer ( icUInt32Number nSize)

Name: CIccTagUtf16Text::GetBuffer.

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

Args: nSize = Requested size of data buffer.

Return: The utf16 character buffer array

Definition at line 1826 of file IccTagBasic.cpp.

1827{
1828 if (m_nBufSize < nSize) {
1829 m_szText = (icUChar16*)icRealloc(m_szText, (nSize+1)*sizeof(icUChar16));
1830
1831 m_szText[nSize] = 0;
1832
1833 m_nBufSize = nSize;
1834 }
1835
1836 return m_szText;
1837}
void * icRealloc(void *ptr, size_t size)
Name: icRealloc.
Definition IccUtil.cpp:111

References icRealloc().

+ Here is the call graph for this function:

◆ GetClassName()

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

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlUtf16Text.

Definition at line 443 of file IccTagBasic.h.

443{ return "CIccUtf16TagText"; }

◆ GetLength()

icUInt32Number CIccTagUtf16Text::GetLength ( ) const

Name: CIccTagUtf16Text::GetLength.

Purpose: Get length of utf16 string

Definition at line 1568 of file IccTagBasic.cpp.

1569{
1571 if (!m_szText || !m_nBufSize)
1572 return 0;
1573
1574 for (n=0; n<m_nBufSize && m_szText[n]; n++);
1575
1576 return n;
1577}
unsigned int icUInt32Number

◆ GetText() [1/2]

const icUChar16 * CIccTagUtf16Text::GetText ( ) const
inline

Definition at line 451 of file IccTagBasic.h.

451{ return m_szText; }

◆ GetText() [2/2]

const icChar * CIccTagUtf16Text::GetText ( std::string & buf) const

Name: CIccTagUtf16Text::GetText.

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

Args: buf - buffer to put tag data into. Returns: buf.c_str()

Definition at line 1716 of file IccTagBasic.cpp.

1717{
1718 icUtf8Vector str;
1719
1721
1722 buf.clear();
1723 icUtf8Vector::iterator c;
1724 c=str.begin();
1725 if (str.size()>2 && (str[0]==0xff && str[1]==0xfe)) {
1726 c++; c++;
1727 }
1728 for (; c!=str.end(); c++)
1729 buf.push_back(*c);
1730
1731 return buf.c_str();
1732}
icUtfConversionResult icConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, icUtfConversionFlags flags)
@ lenientConversion
icUInt32Number GetLength() const
Name: CIccTagUtf16Text::GetLength.

References icConvertUTF16toUTF8(), and lenientConversion.

Referenced by icGetTagText().

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

◆ GetType()

virtual icTagTypeSignature CIccTagUtf16Text::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 442 of file IccTagBasic.h.

442{ return icSigUtf16TextType; }
@ icSigUtf16TextType

References icSigUtf16TextType.

◆ NewCopy()

virtual CIccTag * CIccTagUtf16Text::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 CIccTagXmlUtf16Text.

Definition at line 439 of file IccTagBasic.h.

439{return new CIccTagUtf16Text(*this);}
CIccTagUtf16Text()
Name: CIccTagUtf16Text::CIccTagUtf16Text.

◆ operator=() [1/2]

CIccTagUtf16Text & CIccTagUtf16Text::operator= ( const CIccTagUtf16Text & TextTag)

Name: CIccTagUtf16Text::operator=.

Purpose: Copy Operator

Args: TextTag = The CIccTagText object to be copied

Definition at line 1534 of file IccTagBasic.cpp.

1535{
1536 if (&TextTag == this)
1537 return *this;
1538
1539 m_szText = (icUChar16*)malloc(1*sizeof(icUChar16));
1540 m_szText[0] = '\0';
1541 m_nBufSize = 1;
1542 SetText(TextTag.m_szText);
1543
1544 return *this;
1545}

References m_szText.

◆ operator=() [2/2]

const icUChar16 * CIccTagUtf16Text::operator= ( const icUChar16 * szText)

Name: *CIccTagUtf16Textoperator=.

Purpose: Define assignment operator to associate text with tag.

Args: szText - zero terminated string to put in the tag

Return: A pointer to the string assigned to the tag.

Definition at line 1807 of file IccTagBasic.cpp.

1808{
1809 SetText(szText);
1810 return (icUChar16*)m_szText;
1811}

◆ Read()

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

Name: CIccTagUtf16Text::Read.

Purpose: Read in a text type tag 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.

Definition at line 1593 of file IccTagBasic.cpp.

1594{
1596
1597 if (size<sizeof(icTagTypeSignature) || !pIO) {
1598 m_szText[0] = '\0';
1599 return false;
1600 }
1601
1602 if (!pIO->Read32(&sig))
1603 return false;
1604
1605 if (!pIO->Read32(&m_nReserved))
1606 return false;
1607
1608 icUInt32Number nSize = (size - sizeof(icTagTypeSignature) - sizeof(icUInt32Number))/sizeof(icUChar16);
1609
1610 icUChar16 *pBuf = GetBuffer(nSize);
1611
1612 if (nSize) {
1613 if (pIO->Read16(pBuf, nSize) != (icInt32Number)nSize) {
1614 return false;
1615 }
1616 }
1617
1618 Release();
1619
1620 return true;
1621}
icArraySignature sig
icTagTypeSignature
icInt32Number Read16(void *pBuf16, icInt32Number nNum=1)
Definition IccIO.cpp:114
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
icUChar16 * GetBuffer(icUInt32Number nSize)
Name: CIccTagUtf16Text::GetBuffer.
void Release()
Name: CIccTagUtf16Text::Release.
long icInt32Number

References CIccIO::Read16(), CIccIO::Read32(), and sig.

+ Here is the call graph for this function:

◆ Release()

void CIccTagUtf16Text::Release ( )

Name: CIccTagUtf16Text::Release.

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

Definition at line 1847 of file IccTagBasic.cpp.

1848{
1849 icUInt32Number nSize = GetLength()+1;
1850
1851 if (nSize < m_nBufSize-1) {
1852 m_szText=(icUChar16*)icRealloc(m_szText, (nSize+1)*sizeof(icUChar16));
1853 m_nBufSize = nSize+1;
1854 }
1855}

References icRealloc().

+ Here is the call graph for this function:

◆ SetText() [1/3]

void CIccTagUtf16Text::SetText ( const icChar * szText)
inline

Definition at line 455 of file IccTagBasic.h.

455{ SetText((icUChar*)szText); }
unsigned char icUChar
Definition IccDefs.h:110

References SetText().

Referenced by SetText().

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

◆ SetText() [2/3]

void CIccTagUtf16Text::SetText ( const icUChar * szText)

Name: CIccTagUtf16Text::SetText.

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

Args: szText - zero terminated string to put in tag

Definition at line 1772 of file IccTagBasic.cpp.

1773{
1774 if (!szText) {
1775 icUChar16 c=0;
1776 SetText(&c);
1777 }
1778
1779 icUtf16Vector str;
1780 icConvertUTF8toUTF16(szText, szText+strlen((icChar*)szText)+1, str, lenientConversion);
1781
1782 int pos = 0;
1783 if (str[0]==0xfeff) {
1784 pos = 1;
1785 }
1786
1787 icUInt32Number nSize = (icUInt32Number)(str.size()-pos);
1788 icUChar16 *szBuf = GetBuffer(nSize);
1789
1790 if (nSize)
1791 memcpy(m_szText, &str[pos], nSize*sizeof(icUChar));
1792 Release();
1793}
icUtfConversionResult icConvertUTF8toUTF16(const UTF8 **sourceStart, const UTF8 *sourceEnd, UTF16 **targetStart, UTF16 *targetEnd, icUtfConversionFlags flags)
char icChar
Definition IccDefs.h:109

References icConvertUTF8toUTF16(), and lenientConversion.

+ Here is the call graph for this function:

◆ SetText() [3/3]

void CIccTagUtf16Text::SetText ( const icUChar16 * szText)

Name: CIccTagUtf16Text::SetText.

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

Args: szText - zero terminated string to put in tag

Definition at line 1745 of file IccTagBasic.cpp.

1746{
1747 if (!szText) {
1748 icUChar16 c=0;
1749 SetText(&c);
1750 }
1751
1753 for (n=0; szText[n]; n++);
1754
1755 icUInt32Number len=n + 1;
1756 icUChar16 *szBuf = GetBuffer(len);
1757
1758 memcpy(szBuf, szText, len*sizeof(icUChar16));
1759 Release();
1760}

◆ Validate()

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

Name: CIccTagUtf16Text::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 1872 of file IccTagBasic.cpp.

1873{
1874 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
1875
1876 CIccInfo Info;
1877 std::string sSigPathName = Info.GetSigPathName(sigPath);
1878
1879 if (!m_nBufSize) {
1880 sReport += icMsgValidateWarning;
1881 sReport += sSigPathName;
1882 sReport += " - Empty Tag.\n";
1884 }
1885
1886 return rv;
1887}
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().

+ Here is the call graph for this function:

◆ Write()

bool CIccTagUtf16Text::Write ( CIccIO * pIO)
virtual

Name: CIccTagUtf16Text::Write.

Purpose: Write a text type tag to a file

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

Return: true = succesful, false = failure

Reimplemented from CIccTag.

Definition at line 1636 of file IccTagBasic.cpp.

1637{
1639
1640 if (!pIO)
1641 return false;
1642
1643 if (!pIO->Write32(&sig))
1644 return false;
1645
1646 if (!pIO->Write32(&m_nReserved))
1647 return false;
1648
1649 if (!m_szText)
1650 return false;
1651
1652 icUInt32Number nSize = GetLength();
1653
1654 if (nSize) {
1655 if (pIO->Write16(m_szText, nSize) != (icInt32Number)nSize)
1656 return false;
1657 }
1658
1659 return true;
1660}
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().

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nBufSize

icUInt32Number CIccTagUtf16Text::m_nBufSize
protected

Definition at line 469 of file IccTagBasic.h.

◆ m_szText

icUChar16* CIccTagUtf16Text::m_szText
protected

Definition at line 468 of file IccTagBasic.h.

Referenced by CIccTagUtf16Text(), and operator=().


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