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

Class: CIccTagUtf8Text() More...

#include <IccTagBasic.h>

+ Inheritance diagram for CIccTagUtf8Text:
+ Collaboration diagram for CIccTagUtf8Text:

Public Member Functions

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

Purpose: The utf8TextType ICC tag

Definition at line 321 of file IccTagBasic.h.

Constructor & Destructor Documentation

◆ CIccTagUtf8Text() [1/2]

CIccTagUtf8Text::CIccTagUtf8Text ( )

Name: CIccTagUtf8Text::CIccTagUtf8Text.

Purpose: Constructor

Definition at line 706 of file IccTagBasic.cpp.

707{
708 m_szText = (icUChar*)malloc(1);
709 m_szText[0] = '\0';
710 m_nBufSize = 1;
711}
unsigned char icUChar
Definition IccDefs.h:110
icUInt32Number m_nBufSize
icUChar * m_szText

◆ CIccTagUtf8Text() [2/2]

CIccTagUtf8Text::CIccTagUtf8Text ( const CIccTagUtf8Text & ITT)

Name: CIccTagUtf8Text::CIccTagUtf8Text.

Purpose: Copy Constructor

Args: ITT = The CIccTagText object to be copied

Definition at line 723 of file IccTagBasic.cpp.

724{
725 m_szText = (icUChar*)malloc(1);
726 m_szText[0] = '\0';
727 m_nBufSize = 1;
728 SetText(ITT.m_szText);
729}
void SetText(const icUChar16 *szText)
Name: CIccTagUtf8Text::SetText.

References m_szText.

◆ ~CIccTagUtf8Text()

CIccTagUtf8Text::~CIccTagUtf8Text ( )
virtual

Name: CIccTagUtf8Text::~CIccTagUtf8Text.

Purpose: Destructor

Definition at line 762 of file IccTagBasic.cpp.

763{
764 free(m_szText);
765}

Member Function Documentation

◆ Capacity()

icUInt32Number CIccTagUtf8Text::Capacity ( ) const
inline

Definition at line 349 of file IccTagBasic.h.

349{ return m_nBufSize; }

◆ Describe()

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

Name: CIccTagUtf8Text::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 861 of file IccTagBasic.cpp.

862{
863 sDescription += "UTF8 Length = ";
864 if (m_szText && *m_szText) {
865 char buf[40];
866 sprintf(buf, "%d bytes\n", m_nBufSize);
867 sDescription += buf;
868 }
869 else
870 sDescription += "0 (NULL)";
871
872 if (nVerboseness > 25) {
873 sDescription += "\"";
874 if (m_szText && *m_szText) {
875 if ((nVerboseness > 50) || (m_nBufSize < BRIEF_STRING_SIZE)) {
876 // output entire string if short or doing verbose output
877 sDescription += (icChar*)m_szText;
878 }
879 else {
880 // copy just first part of string to keep nVerboseness under control
881 char buf[BRIEF_STRING_SIZE + 1];
882 strncpy(buf, (icChar*)m_szText, BRIEF_STRING_SIZE);
883 buf[BRIEF_STRING_SIZE] = '\0'; // ensure NULL termination
884 sDescription += buf;
885 sDescription += "\n... <!truncated!>";
886 }
887 }
888 sDescription += "\"\n";
889 }
890}
char icChar
Definition IccDefs.h:109
#define BRIEF_STRING_SIZE

References BRIEF_STRING_SIZE.

◆ GetBuffer()

icUChar * CIccTagUtf8Text::GetBuffer ( icUInt32Number nSize)

Name: CIccTagUtf8Text::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 character buffer array

Definition at line 971 of file IccTagBasic.cpp.

972{
973 if (m_nBufSize < nSize) {
974 m_szText = (icUChar*)icRealloc(m_szText, nSize+1);
975
976 if (m_szText) {
977 m_szText[nSize] = '\0';
978 m_nBufSize = nSize;
979 }
980 else {
981 m_nBufSize = 0;
982 }
983 }
984
985 return m_szText;
986}
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 * CIccTagUtf8Text::GetClassName ( ) const
inlinevirtual

Reimplemented from CIccTag.

Reimplemented in CIccTagXmlUtf8Text.

Definition at line 331 of file IccTagBasic.h.

331{ return "CIccUtf8TagText"; }

◆ GetText()

const icUChar * CIccTagUtf8Text::GetText ( ) const
inline

Definition at line 338 of file IccTagBasic.h.

338{ return m_szText; }

Referenced by CIccStructNamedColor::getName(), icConvertEncodingProfile(), and icGetTagText().

+ Here is the caller graph for this function:

◆ GetType()

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

330{ return icSigUtf8TextType; }
@ icSigUtf8TextType

References icSigUtf8TextType.

◆ NewCopy()

virtual CIccTag * CIccTagUtf8Text::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 CIccTagXmlUtf8Text.

Definition at line 327 of file IccTagBasic.h.

327{return new CIccTagUtf8Text(*this);}
CIccTagUtf8Text()
Name: CIccTagUtf8Text::CIccTagUtf8Text.

◆ operator=() [1/3]

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

Name: CIccTagUtf8Text::operator=.

Purpose: Copy Operator

Args: TextTag = The CIccTagText object to be copied

Definition at line 741 of file IccTagBasic.cpp.

742{
743 if (&TextTag == this)
744 return *this;
745
746 m_szText = (icUChar*)malloc(1);
747 m_szText[0] = '\0';
748 m_nBufSize = 1;
749 SetText(TextTag.m_szText);
750
751 return *this;
752}

References m_szText.

◆ operator=() [2/3]

const icChar * CIccTagUtf8Text::operator= ( const icChar * szText)
inline

Definition at line 345 of file IccTagBasic.h.

345{ return (const icChar*)operator=((icUChar*)szText); }
CIccTagUtf8Text & operator=(const CIccTagUtf8Text &TextTag)
Name: CIccTagUtf8Text::operator=.

References operator=().

Referenced by operator=().

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

◆ operator=() [3/3]

const icUChar * CIccTagUtf8Text::operator= ( const icUChar * szText)

Name: *CIccTagUtf8Textoperator=.

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 952 of file IccTagBasic.cpp.

953{
954 SetText(szText);
955 return (icUChar*)m_szText;
956}

◆ Read()

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

Name: CIccTagUtf8Text::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 781 of file IccTagBasic.cpp.

782{
784
785 if (size<sizeof(icTagTypeSignature) || !pIO) {
786 m_szText[0] = '\0';
787 return false;
788 }
789
790 if (!pIO->Read32(&sig))
791 return false;
792
793 if (!pIO->Read32(&m_nReserved))
794 return false;
795
796 if (size < sizeof(icTagTypeSignature) + sizeof(icUInt32Number))
797 return false;
798
799 icUInt32Number nSize = size - sizeof(icTagTypeSignature) - sizeof(icUInt32Number);
800
801 icUChar *pBuf = GetBuffer(nSize);
802
803 if (nSize) {
804 if (pIO->Read8(pBuf, nSize) != (icInt32Number)nSize) {
805 return false;
806 }
807 }
808
809 Release();
810
811 return true;
812}
icArraySignature sig
icTagTypeSignature
unsigned int icUInt32Number
virtual icInt32Number Read8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:104
icInt32Number Read32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:143
icUInt32Number m_nReserved
void Release()
Name: CIccTagUtf8Text::Release.
icUChar * GetBuffer(icUInt32Number nSize)
Name: CIccTagUtf8Text::GetBuffer.
long icInt32Number

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

+ Here is the call graph for this function:

◆ Release()

void CIccTagUtf8Text::Release ( )

Name: CIccTagUtf8Text::Release.

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

Definition at line 996 of file IccTagBasic.cpp.

997{
998 icUInt32Number nSize = (icUInt32Number)strlen((icChar*)m_szText)+1;
999
1000 if (nSize < m_nBufSize-1) {
1001 m_szText=(icUChar*)icRealloc(m_szText, nSize+1);
1002 m_nBufSize = nSize+1;
1003 }
1004}

References icRealloc().

+ Here is the call graph for this function:

◆ SetText() [1/3]

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

Definition at line 342 of file IccTagBasic.h.

342{ SetText((icUChar*)szText); }

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 CIccTagUtf8Text::SetText ( const icUChar * szText)

Name: CIccTagUtf8Text::SetText.

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

Args: szText - zero terminated string to put in tag

Definition at line 903 of file IccTagBasic.cpp.

904{
905 if (!szText)
906 SetText("");
907
908 icUInt32Number len=(icUInt32Number)strlen((icChar*)szText) + 1;
909 icUChar *szBuf = GetBuffer(len);
910
911 strcpy((icChar*)szBuf, (icChar*)szText);
912 Release();
913}

◆ SetText() [3/3]

void CIccTagUtf8Text::SetText ( const icUChar16 * szText)

Name: CIccTagUtf8Text::SetText.

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

Args: szText - zero terminated string to put in tag

Definition at line 926 of file IccTagBasic.cpp.

927{
928 if (!szText)
929 SetText("");
930
931 icUtf8Vector text;
932 icUInt32Number len;
933 for (len=0; szText[len]; len++);
934
935 icConvertUTF16toUTF8(szText, &szText[len], text, lenientConversion);
936
937 SetText((const icUChar*)&text[0]);
938}
icUtfConversionResult icConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, icUtfConversionFlags flags)
@ lenientConversion

References icConvertUTF16toUTF8(), and lenientConversion.

+ Here is the call graph for this function:

◆ Validate()

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

Name: CIccTagUtf8Text::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 1021 of file IccTagBasic.cpp.

1022{
1023 icValidateStatus rv = CIccTag::Validate(sigPath, sReport, pProfile);
1024
1025 CIccInfo Info;
1026 std::string sSigPathName = Info.GetSigPathName(sigPath);
1027
1028 if (!m_nBufSize) {
1029 sReport += icMsgValidateWarning;
1030 sReport += sSigPathName;
1031 sReport += " - Empty Tag.\n";
1033 }
1034
1035
1036 return rv;
1037}
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 CIccTagUtf8Text::Write ( CIccIO * pIO)
virtual

Name: CIccTagUtf8Text::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 827 of file IccTagBasic.cpp.

828{
830
831 if (!pIO)
832 return false;
833
834 if (!pIO->Write32(&sig))
835 return false;
836
837 if (!pIO->Write32(&m_nReserved))
838 return false;
839
840 if (!m_szText)
841 return false;
842
843 icUInt32Number nSize = (icUInt32Number)strlen((icChar*)m_szText)+1;
844
845 if (pIO->Write8(m_szText, nSize) != (icInt32Number)nSize)
846 return false;
847
848 return true;
849}
virtual icInt32Number Write8(void *pBuf8, icInt32Number nNum=1)
Definition IccIO.h:105
icInt32Number Write32(void *pBuf32, icInt32Number nNum=1)
Definition IccIO.cpp:152
virtual icTagTypeSignature GetType() const
Function: GetType()

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

+ Here is the call graph for this function:

Member Data Documentation

◆ m_nBufSize

icUInt32Number CIccTagUtf8Text::m_nBufSize
protected

Definition at line 354 of file IccTagBasic.h.

◆ m_szText

icUChar* CIccTagUtf8Text::m_szText
protected

Definition at line 353 of file IccTagBasic.h.

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


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