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

#include <IccTagXml.h>

+ Inheritance diagram for CIccTagXmlArray:
+ Collaboration diagram for CIccTagXmlArray:

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 ~CIccTagXmlArray ()
 
- Public Member Functions inherited from CIccTagArray
bool AreAllOfType (icTagTypeSignature sigTagType)
 Name: CIccTagArray::AreAllOftype.
 
bool AttachTag (icUInt32Number nIndex, CIccTag *pTag)
 Name: CIccTagArray::AttachTag.
 
 CIccTagArray ()
 Name: CIccTagArray::CIccTagArray.
 
 CIccTagArray (const CIccTagArray &lut)
 Name: CIccTagArray::CIccTagArray.
 
 CIccTagArray (icArraySignature sigArrayType)
 Name: CIccTagArray::CIccTagArray.
 
virtual void Describe (std::string &sDescription, int nVerboseness)
 Name: CIccTagArray::Describe.
 
CIccTagDetachTag (icUInt32Number nIndex, bool bDeleteFlag=false)
 Name: CIccTagArray::DetachTag.
 
IIccArrayGetArrayHandler ()
 Name: CIccTagArray::GetArrayHandler.
 
CIccTagGetIndex (icUInt32Number index) const
 Name: CIccTagArray::GetIndex.
 
icUInt32Number GetSize () const
 Returns the size of the data array.
 
virtual icArraySignature GetTagArrayType () const
 
virtual icTagTypeSignature GetType () const
 Function: GetType()
 
virtual CIccTagNewCopy () const
 Function: NewCopy(sDescription) Each derived tag will implement it's own NewCopy() function.
 
CIccTagArrayoperator= (const CIccTagArray &lut)
 Name: &operator=.
 
CIccTagoperator[] (icUInt32Number index) const
 
virtual bool Read (icUInt32Number size, CIccIO *pIO)
 Name: CIccTagArray::Read.
 
bool SetSize (icUInt32Number nSize)
 Name: CIccTagArray::SetSize.
 
virtual bool SetTagArrayType (icArraySignature sig)
 Name: CIccTagArray::~SetTagArrayType.
 
virtual icValidateStatus Validate (std::string sigPath, std::string &sReport, const CIccProfile *pProfile=NULL) const
 Name: CIccTagArray::Validate.
 
virtual bool Write (CIccIO *pIO)
 Name: CIccTagArray::Write.
 
virtual ~CIccTagArray ()
 Name: CIccTagArray::~CIccTagArray.
 
- Public Member Functions inherited from CIccTag
 CIccTag ()
 Name: CIccTag::CIccTag.
 
virtual void DetachIO ()
 Function: ReadAll() - Read All sub data for tag from file.
 
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 CIccTagArray
static CIccTagArrayParseMem (icUInt8Number *pMem, icUInt32Number size)
 
- Static Public Member Functions inherited from CIccTag
static CIccTagCreate (icTagTypeSignature sig)
 Name: CIccTag::Create.
 
- Public Attributes inherited from CIccTag
icUInt32Number m_nReserved
 
- Protected Member Functions inherited from CIccTagArray
void Cleanup ()
 Name: CIccTagArray::Cleanup.
 
- Protected Attributes inherited from CIccTagArray
icUInt32Number m_nSize
 
IIccArraym_pArray
 
icArraySignature m_sigArrayType
 
IccTagPtr * m_TagVals
 

Detailed Description

Definition at line 657 of file IccTagXml.h.

Constructor & Destructor Documentation

◆ ~CIccTagXmlArray()

virtual CIccTagXmlArray::~CIccTagXmlArray ( )
inlinevirtual

Definition at line 660 of file IccTagXml.h.

660{}

Member Function Documentation

◆ GetClassName()

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

Reimplemented from CIccTagArray.

Definition at line 662 of file IccTagXml.h.

662{return "CIccTagXmlArray"; }

◆ GetExtension()

virtual IIccExtensionTag * CIccTagXmlArray::GetExtension ( )
inlinevirtual

Reimplemented from CIccTag.

Definition at line 664 of file IccTagXml.h.

664{return this; }

◆ ParseXml()

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

Implements CIccTagXml.

Definition at line 4775 of file IccTagXml.cpp.

4776{
4777 // parse each tag
4778 xmlNode *tagNode, *indexNode, *firstNode = pNode;;
4779 xmlAttr *attr;
4780
4781 for (; pNode; pNode = pNode->next) {
4782 if (pNode->type == XML_ELEMENT_NODE)
4783 break;
4784 }
4785 if (!pNode) {
4786 parseStr += "Invalid Tag Array: ";
4787 parseStr += (const char *)firstNode->name;
4788 parseStr += "\n";
4789 return false;
4790 }
4791
4792 std::string nodeName = (icChar*)pNode->name;
4793 icArraySignature sigArray = CIccArrayCreator::GetArraySig(nodeName.c_str());
4794
4795 if (sigArray) {
4796 SetTagArrayType(sigArray);
4797 pNode = pNode->children;
4798 }
4799 else {
4800 tagNode = icXmlFindNode(firstNode, "ArraySignature");
4801 if (!tagNode) {
4802 parseStr += "Unable to find ArraySignature\n";
4803 return false;
4804 }
4805
4806 if (tagNode->type == XML_ELEMENT_NODE && tagNode->children && tagNode->children->content) {
4807 sigArray = (icArraySignature)icGetSigVal(tagNode->children ? (const icChar*)tagNode->children->content : "");
4808 SetTagArrayType(sigArray);
4809 }
4810 else {
4811 parseStr += "Invalid XNode type for ArraySignature\n";
4812 return false;
4813 }
4814 }
4815
4816 indexNode = icXmlFindNode(pNode, "ArrayTags");
4817 if (!indexNode)
4818 return false;
4819
4820 int nMaxIndex = 0, n=0;
4821 for (tagNode = indexNode->children; tagNode; tagNode = tagNode->next) {
4822 if (tagNode->type == XML_ELEMENT_NODE) {
4823 nMaxIndex++;
4824 }
4825 }
4826 if (!SetSize(nMaxIndex))
4827 return false;
4828
4829 n=0;
4830 for (tagNode = indexNode->children; tagNode; tagNode = tagNode->next) {
4831 if (tagNode->type == XML_ELEMENT_NODE) {
4832 CIccTag *pTag = NULL;
4833 icSignature sigTag = (icSignature)0;
4834
4835 // get the tag signature
4836 icTagTypeSignature sigType = icGetTypeNameTagSig ((icChar*) tagNode->name);
4837
4838 if (sigType==icSigUnknownType){
4839 xmlAttr *attr = icXmlFindAttr(pNode, "type");
4841 }
4842
4843 CIccInfo info;
4844
4845 // create a tag based on the signature
4846 pTag = CIccTag::Create(sigType);
4847
4848 IIccExtensionTag *pExt;
4849
4850 if (pTag && (pExt = pTag->GetExtension()) && !strcmp(pExt->GetExtClassName(), "CIccTagXml")) {
4851 CIccTagXml* pXmlTag = (CIccTagXml*)pExt;
4852
4853 if (pXmlTag->ParseXml(tagNode->children, parseStr)) {
4854 if ((attr=icXmlFindAttr(pNode, "reserved"))) {
4855 sscanf(icXmlAttrValue(attr), "%u", &pTag->m_nReserved);
4856 }
4857
4858 if (!m_TagVals[n].ptr)
4859 m_TagVals[n].ptr = pTag;
4860 else {
4861 parseStr += "Tag Array Index ";
4862 parseStr += n;
4863 parseStr += " already filled!\n";
4864 return false;
4865 }
4866 }
4867 else {
4868 parseStr += "Unable to Parse xml node named \"";
4869 parseStr += (icChar*)tagNode->name;
4870 parseStr += "\"\n";
4871 return false;
4872 }
4873 }
4874 n++;
4875 }
4876 }
4877
4878 for (n=0; n<(int)m_nSize; n++) {
4879 if (!m_TagVals[n].ptr) {
4880 parseStr += "Undefined Array Tag at index ";
4881 parseStr += n;
4882 parseStr += "\n";
4883 return false;
4884 }
4885 }
4886
4887 return true;
4888}
char icChar
Definition IccDefs.h:109
icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
xmlNode * icXmlFindNode(xmlNode *pNode, const char *szNodeName)
icTagTypeSignature icGetTypeNameTagSig(const icChar *szTagType)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)
icTagTypeSignature
static icArraySignature GetArraySig(const icChar *arrayName)
Function: GetArraySig(arrayName) Get signature associate with display name arrayName handler.
Type: Class.
Definition IccUtil.h:303
icUInt32Number m_nSize
virtual bool SetTagArrayType(icArraySignature sig)
Name: CIccTagArray::~SetTagArrayType.
bool SetSize(icUInt32Number nSize)
Name: CIccTagArray::SetSize.
IccTagPtr * m_TagVals
Class: CIccTag.
icUInt32Number m_nReserved
static CIccTag * Create(icTagTypeSignature sig)
Name: CIccTag::Create.
virtual IIccExtensionTag * GetExtension()
virtual bool ParseXml(xmlNode *pNode, std::string &parseStr)=0
virtual const char * GetExtClassName() const =0
#define icSigUnknownType
Convenience Enum Definitions - Not defined in ICC specification.
icUInt32Number icSignature
icArraySignature
Tag Array type signatures.

References CIccTag::Create(), CIccArrayCreator::GetArraySig(), IIccExtensionTag::GetExtClassName(), CIccTag::GetExtension(), icGetSigVal(), icGetTypeNameTagSig(), icSigUnknownType, icXmlAttrValue(), icXmlFindAttr(), icXmlFindNode(), CIccTag::m_nReserved, and CIccTagXml::ParseXml().

+ Here is the call graph for this function:

◆ ToXml()

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

Implements CIccTagXml.

Definition at line 4718 of file IccTagXml.cpp.

4719{
4720 std::string info;
4721 char buf[256], fix[256], line[256];
4722
4723 std::string arrayName;
4724 std::string arrayBlanks = "";
4725 bool found = CIccArrayCreator::GetArraySigName(arrayName, m_sigArrayType, false);
4726
4727 if (found) {
4728 sprintf(line, "<%s> ", arrayName.c_str());
4729 arrayBlanks = " ";
4730 }
4731 else {
4732 // print out the struct signature
4733 sprintf(line, "<privateArray StructSignature=\"%s\"/> ", icFixXml(fix, icGetSigStr(buf, m_sigArrayType)));
4734 arrayName = "privateArray";
4735 }
4736
4737 xml += blanks + line + "<ArrayTags>\n";
4738 int i;
4739
4740 for (i=0; i<(int)m_nSize; i++) {
4741 CIccTag* pTag = m_TagVals[i].ptr;
4742 if (pTag) {
4743 CIccTagXml *pTagXml = (CIccTagXml*)(pTag->GetExtension());
4744 if (pTagXml) {
4745 const icChar* tagSig = icGetTagSigTypeName(pTag->GetType());
4746
4747 // PrivateType - a type that does not belong to the list in the icc specs - custom for vendor.
4748 if ( !strcmp("PrivateType", tagSig) )
4749 sprintf(line, " <PrivateType type=\"%s\">\n", icFixXml(fix, icGetSigStr(buf, pTag->GetType())));
4750 else
4751 sprintf(line, " <%s>\n", tagSig); //parent node is the tag type
4752
4753 xml += blanks + arrayBlanks + line;
4754
4755 //convert the rest of the tag to xml
4756 if (!pTagXml->ToXml(xml, blanks + arrayBlanks + " ")) {
4757 printf("Unable to output tag with type %s\n", icGetSigStr(buf, pTag->GetType()));
4758 return false;
4759 }
4760 sprintf(line, " </%s>\n\n", tagSig);
4761 xml += blanks + arrayBlanks + line;
4762 }
4763 else {
4764 printf("Non XML tag in list with type %s!\n", icGetSigStr(buf, pTag->GetType()));
4765 return false;
4766 }
4767 }
4768 }
4769 xml += blanks + "</ArrayTags> </" + arrayName + ">\n";
4770
4771 return true;
4772}
const icChar * icGetSigStr(icChar *pBuf, icUInt32Number nSig)
Definition IccUtil.cpp:1056
const icChar * icGetTagSigTypeName(icTagTypeSignature tagTypeSig)
const char * icFixXml(std::string &buf, const char *szStr)
static bool GetArraySigName(std::string &arrayName, icArraySignature arrayTypeSig, bool bFillUnknown=true)
Function: GetArraySigName(structTypeSig) Get display name of structTypeSig.
icArraySignature m_sigArrayType
virtual icTagTypeSignature GetType() const
Function: GetType()
virtual bool ToXml(std::string &xml, std::string blanks="")=0

References CIccArrayCreator::GetArraySigName(), CIccTag::GetExtension(), CIccTag::GetType(), icFixXml(), icGetSigStr(), icGetTagSigTypeName(), and CIccTagXml::ToXml().

+ Here is the call graph for this function:

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