Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccUtilXml.cpp File Reference

File: IccUtilXml.cpp. More...

#include <time.h>
#include "IccUtilXml.h"
#include "IccConvertUTF.h"
#include "IccTagFactory.h"
#include <cstring>
#include <math.h>
+ Include dependency graph for IccUtilXml.cpp:

Go to the source code of this file.

Classes

class  CIccDumpXmlCLUT
 

Functions

static int hexValue (char c)
 
const char * icAnsiToUtf8 (std::string &buf, const char *szSrc)
 
bool icCLUTDataToXml (std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks, bool bSaveGridPoints)
 
bool icCLUTToXml (std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks, bool bSaveGridPoints, const char *szExtraAttrs, const char *szName)
 
const char * icFixXml (char *szDest, const char *szStr)
 
const char * icFixXml (std::string &buf, const char *szStr)
 
icMeasurementGeometry icGeNamedtMeasurementGeometryValue (const icChar *str)
 
icColorantEncoding icGetColorantValue (const icChar *str)
 
icDateTimeNumber icGetDateTimeValue (const icChar *str)
 
const std::string icGetDeviceAttrName (icUInt64Number devAttr)
 
icUInt64Number icGetDeviceAttrValue (xmlNode *pNode)
 
const std::string icGetHeaderFlagsName (icUInt32Number flags, bool bUsesMCS)
 
icIlluminant icGetIlluminantValue (const icChar *str)
 
icMeasurementUnitSig icGetMeasurementValue (const icChar *str)
 
icMeasurementFlare icGetNamedMeasurementFlareValue (const icChar *str)
 
icStandardObserver icGetNamedStandardObserverValue (const icChar *str)
 
const std::string icGetPadSpace (double value)
 
icRenderingIntent icGetRenderingIntentValue (const icChar *szRenderingIntent)
 
const icCharicGetStandardObserverName (icStandardObserver str)
 
icTagSignature icGetTagNameSig (const icChar *szName)
 
const icCharicGetTagSigName (icTagSignature tagTypeSig)
 
const icCharicGetTagSigTypeName (icTagTypeSignature tagTypeSig)
 
icTagTypeSignature icGetTypeNameTagSig (const icChar *szTagType)
 
static bool icIsNumChar (char c)
 
const char * icUtf16ToUtf8 (std::string &buf, const icUInt16Number *szSrc, int sizeSrc)
 
const char * icUtf8ToAnsi (std::string &buf, const char *szSrc)
 
const unsigned short * icUtf8ToUtf16 (CIccUTF16String &buf, const char *szSrc, int sizeSrc)
 
const char * icXmlAttrValue (xmlAttr *attr, const char *szDefault)
 
const char * icXmlAttrValue (xmlNode *pNode, const char *szName, const char *szDefault)
 
icUInt32Number icXmlDumpHexData (std::string &xml, std::string blanks, void *pBuf, icUInt32Number nBufSize)
 
xmlAttr * icXmlFindAttr (xmlNode *pNode, const char *szAttrName)
 
xmlNode * icXmlFindNode (xmlNode *pNode, const char *szNodeName)
 
icUInt32Number icXmlGetChildSigVal (xmlNode *pNode)
 
icUInt32Number icXmlGetHexData (void *pBuf, const char *szText, icUInt32Number nBufSize)
 
icUInt32Number icXmlGetHexDataSize (const char *szText)
 
icUInt32Number icXmlNodeCount (xmlNode *pNode, const char *szNodeName)
 
icUInt32Number icXmlNodeCount2 (xmlNode *pNode, const char *szNodeName1, const char *szNodeName2)
 
icUInt32Number icXmlNodeCount3 (xmlNode *pNode, const char *szNodeName1, const char *szNodeName2, const char *szNodeName3)
 
icFloatNumber icXmlStrToFloat (const xmlChar *szStr)
 
icSignature icXmlStrToSig (const char *szStr)
 

Detailed Description

File: IccUtilXml.cpp.

Contains: Implementation of XML conversion utilities

Version: V1

Copyright: (c) see ICC Software License

Definition in file IccUtilXml.cpp.

Function Documentation

◆ hexValue()

static int hexValue ( char c)
static

Definition at line 597 of file IccUtilXml.cpp.

598{
599 if (c>='0' && c<='9')
600 return c-'0';
601 if (c>='A' && c<='F')
602 return c-'A'+10;
603 if (c>='a' && c<='f')
604 return c-'a'+10;
605 return -1;
606}

Referenced by icXmlGetHexData(), and icXmlGetHexDataSize().

+ Here is the caller graph for this function:

◆ icAnsiToUtf8()

const char * icAnsiToUtf8 ( std::string & buf,
const char * szSrc )

Definition at line 372 of file IccUtilXml.cpp.

373{
374#ifdef WIN32
375 size_t len = strlen(szSrc)+1;
376 wchar_t *szUnicodeBuf = (wchar_t*)malloc(len*sizeof(icUInt16Number)*2);
377 char *szBuf = (char*)malloc(len*2);
378
379 size_t n;
380
381 n=MultiByteToWideChar(CP_ACP, 0, szSrc, (int)len-1, szUnicodeBuf, (int)len*2);
382 szUnicodeBuf[n] = '\0';
383
384 n = WideCharToMultiByte(CP_UTF8, 0, (const wchar_t*)szUnicodeBuf, (int)n, szBuf, (int)len*2, 0, NULL);
385 szBuf[n] = '\0';
386
387 buf = szBuf;
388
389 free(szBuf);
390 free(szUnicodeBuf);
391#else
392 buf = szSrc;
393#endif
394 return buf.c_str();
395}
unsigned short icUInt16Number

Referenced by icXmlDumpTextData(), CIccTagXmlColorantTable::ToXml(), and CIccTagXmlNamedColor2::ToXml().

+ Here is the caller graph for this function:

◆ icCLUTDataToXml()

bool icCLUTDataToXml ( std::string & xml,
CIccCLUT * pCLUT,
icConvertType nType,
std::string blanks,
bool bSaveGridPoints )

Definition at line 485 of file IccUtilXml.cpp.

487{
488 char buf[128];
489 int nStartType = nType;
490 if (nType == icConvertVariable) {
491 nType = pCLUT->GetPrecision()==1 ? icConvert8Bit : icConvert16Bit;
492 }
493
494 if (bSaveGridPoints) {
495 xml += blanks + " <GridPoints>";
496 int i;
497
498 for (i=0; i<pCLUT->GetInputDim(); i++) {
499 if (i)
500 sprintf(buf, " %d", pCLUT->GridPoint(i));
501 else
502 sprintf(buf, "%d", pCLUT->GridPoint(i));
503 xml += buf;
504 }
505 xml += "</GridPoints>\n";
506 }
507
508 int nPixelsPerRow = pCLUT->GridPoint(0);
509
510 // if the CLUT has no GridPoints, profile is invalid
511 if (nPixelsPerRow == 0) {
512 printf("\nError! - CLUT Table not found.\n");
513 return false;
514 }
515
516 CIccDumpXmlCLUT dumper(&xml, nType, blanks + " ", pCLUT->GetOutputChannels(), nPixelsPerRow);
517
518 xml += blanks + " <TableData";
519
520 if (nStartType == icConvertVariable && nType == icConvert8Bit) {
521 sprintf(buf, " Precision=\"1\"");
522 xml += buf;
523 }
524
525 xml += ">\n";
526
527 pCLUT->Iterate(&dumper);
528
529 dumper.Finish();
530
531 xml += blanks + " </TableData>\n";
532
533 return true;
534
535}
@ icConvert8Bit
@ icConvert16Bit
@ icConvertVariable
icUInt8Number GetInputDim() const
Definition IccTagLut.h:356
icUInt16Number GetOutputChannels() const
Definition IccTagLut.h:357
void Iterate(IIccCLUTExec *pExec)
Name: CIccCLUT::Iterate.
icUInt8Number GridPoint(int index) const
Definition IccTagLut.h:350
icUInt8Number GetPrecision()
Definition IccTagLut.h:381

References CIccDumpXmlCLUT::Finish(), CIccCLUT::GetInputDim(), CIccCLUT::GetOutputChannels(), CIccCLUT::GetPrecision(), CIccCLUT::GridPoint(), icConvert16Bit, icConvert8Bit, icConvertVariable, and CIccCLUT::Iterate().

Referenced by icCLUTToXml(), CIccMpeXmlEmissionCLUT::ToXml(), and CIccMpeXmlReflectanceCLUT::ToXml().

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

◆ icCLUTToXml()

bool icCLUTToXml ( std::string & xml,
CIccCLUT * pCLUT,
icConvertType nType,
std::string blanks,
bool bSaveGridPoints,
const char * szExtraAttrs,
const char * szName )

Definition at line 537 of file IccUtilXml.cpp.

539{
540 char buf[128];
541 xml += blanks + "<" + szName;
542
543 if (!bSaveGridPoints) {
544 sprintf(buf, " GridGranularity=\"%d\"", pCLUT->GridPoint(0));
545 xml += buf;
546 }
547
548 if (szExtraAttrs && *szExtraAttrs) {
549 xml += szExtraAttrs;
550 }
551 xml += ">\n";
552
553 icCLUTDataToXml(xml, pCLUT, nType, blanks, bSaveGridPoints);
554
555 xml += blanks + "</" + szName + ">\n";
556 return true;
557}
const icChar * szName
bool icCLUTDataToXml(std::string &xml, CIccCLUT *pCLUT, icConvertType nType, std::string blanks, bool bSaveGridPoints)

References CIccCLUT::GridPoint(), icCLUTDataToXml(), and szName.

Referenced by icMBBToXml(), CIccMpeXmlCLUT::ToXml(), and CIccMpeXmlExtCLUT::ToXml().

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

◆ icFixXml() [1/2]

const char * icFixXml ( char * szDest,
const char * szStr )

Definition at line 305 of file IccUtilXml.cpp.

306{
307 char *m_ptr = szDest;
308
309 while (*szStr) {
310 switch (*szStr) {
311 case '\'':
312 strcpy(m_ptr, "&apos;");
313 m_ptr += 6;
314 break;
315 case '&':
316 strcpy(m_ptr, "&amp;");
317 m_ptr += 5;
318 break;
319 case '\"':
320 strcpy(m_ptr, "&quot;");
321 m_ptr += 6;
322 break;
323 case '<':
324 strcpy(m_ptr, "&lt;");
325 m_ptr += 4;
326 break;
327 case '>':
328 strcpy(m_ptr, "&gt;");
329 m_ptr += 4;
330 break;
331 default:
332 *m_ptr++ = *szStr;
333 }
334 szStr++;
335 }
336 *m_ptr = '\0';
337
338 return szDest;
339}

◆ icFixXml() [2/2]

const char * icFixXml ( std::string & buf,
const char * szStr )

Definition at line 276 of file IccUtilXml.cpp.

277{
278 buf = "";
279 while (*szStr) {
280 switch (*szStr) {
281 case '\'':
282 buf += "&apos;";
283 break;
284 case '&':
285 buf += "&amp;";
286 break;
287 case '\"':
288 buf += "&quot;";
289 break;
290 case '<':
291 buf += "&lt;";
292 break;
293 case '>':
294 buf += "&gt;";
295 break;
296 default:
297 buf += *szStr;
298 }
299 szStr++;
300 }
301
302 return buf.c_str();
303}

Referenced by icProfDescToXml(), CIccMpeXmlBAcs::ToXml(), CIccMpeXmlEAcs::ToXml(), CIccMpeXmlUnknown::ToXml(), CIccTagXmlArray::ToXml(), CIccTagXmlColorantTable::ToXml(), CIccTagXmlDict::ToXml(), CIccTagXmlMultiLocalizedUnicode::ToXml(), CIccTagXmlNamedColor2::ToXml(), CIccTagXmlProfileSequenceId::ToXml(), CIccTagXmlSignature::ToXml(), CIccTagXmlSpectralDataInfo::ToXml(), CIccTagXmlStruct::ToXml(), CIccTagXmlTextDescription::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ icGeNamedtMeasurementGeometryValue()

icMeasurementGeometry icGeNamedtMeasurementGeometryValue ( const icChar * str)

Definition at line 1190 of file IccUtilXml.cpp.

1191{
1192 if (!strcmp(str, "Geometry Unknown"))
1193 return icGeometryUnknown;
1194
1195 if (!strcmp(str, "Geometry 0-45 or 45-0"))
1196 return icGeometry045or450;
1197
1198 if (!strcmp(str, "Geometry 0-d or d-0"))
1199 return icGeometry0dord0;
1200
1201 if (!strcmp(str, "Max Geometry"))
1202 return icMaxEnumGeometry;
1203
1204 return icGeometryUnknown;
1205}
@ icGeometry045or450
@ icGeometry0dord0
@ icGeometryUnknown
#define icMaxEnumGeometry
Convenience Enum Definition - Not defined in ICC specification.

References icGeometry045or450, icGeometry0dord0, icGeometryUnknown, and icMaxEnumGeometry.

Referenced by CIccTagXmlMeasurement::ParseXml().

+ Here is the caller graph for this function:

◆ icGetColorantValue()

icColorantEncoding icGetColorantValue ( const icChar * str)

Definition at line 1377 of file IccUtilXml.cpp.

1378{
1379 if (!strcmp(str, "ITU-R BT.709"))
1380 return icColorantITU;
1381
1382 if (!strcmp(str, "SMPTE RP145-1994"))
1383 return icColorantSMPTE;
1384
1385 if (!strcmp(str, "EBU Tech.3213-E"))
1386 return icColorantEBU;
1387
1388 if (!strcmp(str, "P22"))
1389 return icColorantP22;
1390
1391 return icColorantUnknown;
1392}
@ icColorantEBU
@ icColorantUnknown
@ icColorantITU
@ icColorantSMPTE
@ icColorantP22

References icColorantEBU, icColorantITU, icColorantP22, icColorantSMPTE, and icColorantUnknown.

Referenced by CIccTagXmlChromaticity::ParseXml().

+ Here is the caller graph for this function:

◆ icGetDateTimeValue()

icDateTimeNumber icGetDateTimeValue ( const icChar * str)

Definition at line 1312 of file IccUtilXml.cpp.

1313{
1314 unsigned int day=0, month=0, year=0, hours=0, minutes=0, seconds=0;
1315 icDateTimeNumber dateTime = {};
1316
1317 if (!stricmp(str, "now")) {
1318 time_t rawtime;
1319 struct tm * timeinfo;
1320
1321 time ( &rawtime );
1322 timeinfo = localtime ( &rawtime );
1323 year = timeinfo->tm_year+1900;
1324 month = timeinfo->tm_mon+1;
1325 day = timeinfo->tm_mday;
1326 hours = timeinfo->tm_hour;
1327 minutes = timeinfo->tm_min;
1328 seconds = timeinfo->tm_sec;
1329 }
1330 else {
1331 sscanf(str, "%d-%02d-%02dT%02d:%02d:%02d", &year, &month, &day, &hours, &minutes, &seconds);
1332 }
1333
1334 dateTime.year = year;
1335 dateTime.month = month;
1336 dateTime.day = day;
1337 dateTime.hours = hours;
1338 dateTime.minutes = minutes;
1339 dateTime.seconds = seconds;
1340
1341 return dateTime;
1342}
#define stricmp
The base date time number.
icUInt16Number year
icUInt16Number month
icUInt16Number minutes
icUInt16Number seconds
icUInt16Number hours
icUInt16Number day

References icDateTimeNumber::day, icDateTimeNumber::hours, icDateTimeNumber::minutes, icDateTimeNumber::month, icDateTimeNumber::seconds, stricmp, and icDateTimeNumber::year.

Referenced by CIccProfileXml::ParseBasic(), and CIccTagXmlDateTime::ParseXml().

+ Here is the caller graph for this function:

◆ icGetDeviceAttrName()

const std::string icGetDeviceAttrName ( icUInt64Number devAttr)

Definition at line 1426 of file IccUtilXml.cpp.

1427{
1428 char line[256];
1429 std::string xml;
1430
1431 if (devAttr & icTransparency)
1432 sprintf(line, "<DeviceAttributes ReflectiveOrTransparency=\"transparency\"");
1433 else
1434 sprintf(line, "<DeviceAttributes ReflectiveOrTransparency=\"reflective\"");
1435 xml += line;
1436
1437
1438 if (devAttr & icMatte)
1439 sprintf(line, " GlossyOrMatte=\"matte\"");
1440 else
1441 sprintf(line, " GlossyOrMatte=\"glossy\"");
1442 xml += line;
1443
1444
1445 if (devAttr & icMediaNegative)
1446 sprintf(line, " MediaPolarity=\"negative\"");
1447 else
1448 sprintf(line, " MediaPolarity=\"positive\"");
1449 xml += line;
1450
1451 if (devAttr & icMediaBlackAndWhite)
1452 sprintf(line, " MediaColour=\"blackAndwhite\"");
1453 else
1454 sprintf(line, " MediaColour=\"colour\"");
1455 xml += line;
1456
1458
1459 if (devAttr & otherAttr) {
1460 sprintf(line, " VendorSpecific=\"%016llx\"", devAttr & otherAttr);
1461 xml += line;
1462 }
1463
1464 xml += "/>\n";
1465
1466 return xml;
1467}
#define icMediaBlackAndWhite
#define icTransparency
#define icMatte
#define icMediaNegative
icUInt32Number icUInt64Number[2]

References icMatte, icMediaBlackAndWhite, icMediaNegative, and icTransparency.

Referenced by icProfDescToXml(), and CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ icGetDeviceAttrValue()

icUInt64Number icGetDeviceAttrValue ( xmlNode * pNode)

Definition at line 1344 of file IccUtilXml.cpp.

1345{
1346 icUInt64Number devAttr = 0;
1347 xmlAttr *attr = icXmlFindAttr(pNode, "ReflectiveOrTransparency");
1348 if (attr && !strcmp(icXmlAttrValue(attr), "transparency")) {
1349 devAttr |= icTransparency;
1350 }
1351
1352 attr = icXmlFindAttr(pNode, "GlossyOrMatte");
1353 if (attr && !strcmp(icXmlAttrValue(attr), "matte")) {
1354 devAttr |= icMatte;
1355 }
1356
1357 attr = icXmlFindAttr(pNode, "MediaPolarity");
1358 if (attr && !strcmp(icXmlAttrValue(attr), "negative")) {
1359 devAttr |= icMediaNegative;
1360 }
1361
1362 attr = icXmlFindAttr(pNode, "MediaColour");
1363 if (attr && !strcmp(icXmlAttrValue(attr), "blackAndWhite")) {
1364 devAttr |= icMediaBlackAndWhite;
1365 }
1366
1367 attr = icXmlFindAttr(pNode, "VendorSpecific");
1368 if (attr) {
1369 icUInt64Number vendor;
1370 sscanf(icXmlAttrValue(attr), "%llx", &vendor);
1371 devAttr |= vendor;
1372 }
1373
1374 return devAttr;
1375}
xmlAttr * icXmlFindAttr(xmlNode *pNode, const char *szAttrName)
const char * icXmlAttrValue(xmlAttr *attr, const char *szDefault)

References icMatte, icMediaBlackAndWhite, icMediaNegative, icTransparency, icXmlAttrValue(), and icXmlFindAttr().

Referenced by icXmlParseProfDesc(), and CIccProfileXml::ParseBasic().

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

◆ icGetHeaderFlagsName()

const std::string icGetHeaderFlagsName ( icUInt32Number flags,
bool bUsesMCS )

Definition at line 1469 of file IccUtilXml.cpp.

1470{
1471 char line[256];
1472 std::string xml;
1473
1474 if (flags & icEmbeddedProfileTrue)
1475 sprintf(line, "<ProfileFlags EmbeddedInFile=\"true\"");
1476 else
1477 sprintf(line, "<ProfileFlags EmbeddedInFile=\"false\"");
1478 xml += line;
1479
1480 if (flags & icUseWithEmbeddedDataOnly)
1481 sprintf(line, " UseWithEmbeddedDataOnly=\"true\"");
1482 else
1483 sprintf(line, " UseWithEmbeddedDataOnly=\"false\"");
1484 xml += line;
1485
1486 if (flags & icExtendedRangePCS) {
1487 sprintf(line, " ExtendedRangePCS=\"true\"");
1488 xml += line;
1489 }
1490
1492
1493 if (bUsesMCS) {
1494 if (flags & icMCSNeedsSubsetTrue)
1495 sprintf(line, " MCSNeedsSubset=\"true\"");
1496 else
1497 sprintf(line, " MCSNeedsSubset=\"false\"");
1498 xml += line;
1499
1500 otherFlags &= ~icMCSNeedsSubsetTrue;
1501 }
1502
1503 if (flags & otherFlags) {
1504 sprintf(line, " VendorFlags=\"%08x\"", flags & otherFlags);
1505 xml += line;
1506 }
1507
1508 xml += "/>\n";
1509
1510 return xml;
1511}
unsigned int icUInt32Number
#define icEmbeddedProfileTrue
#define icUseWithEmbeddedDataOnly
#define icExtendedRangePCS
#define icMCSNeedsSubsetTrue

References icEmbeddedProfileTrue, icExtendedRangePCS, icMCSNeedsSubsetTrue, and icUseWithEmbeddedDataOnly.

Referenced by CIccProfileXml::ToXmlWithBlanks().

+ Here is the caller graph for this function:

◆ icGetIlluminantValue()

icIlluminant icGetIlluminantValue ( const icChar * str)

Definition at line 1221 of file IccUtilXml.cpp.

1222{
1223 if (!strcmp(str, "Illuminant Unknown"))
1224 return icIlluminantUnknown;
1225
1226 if (!strcmp(str, "Illuminant D50") || !strcmp(str, "D50"))
1227 return icIlluminantD50;
1228
1229 if (!strcmp(str, "Illuminant D65") || !strcmp(str, "D65"))
1230 return icIlluminantD65;
1231
1232 if (!strcmp(str, "Illuminant D93") || !strcmp(str, "D93"))
1233 return icIlluminantD93;
1234
1235 if (!strcmp(str, "Illuminant F2") || !strcmp(str, "F2"))
1236 return icIlluminantF2;
1237
1238 if (!strcmp(str, "Illuminant D55") || !strcmp(str, "D55"))
1239 return icIlluminantD55;
1240
1241 if (!strcmp(str, "Illuminant A") || !strcmp(str, "A"))
1242 return icIlluminantA;
1243
1244 if (!strcmp(str, "Illuminant EquiPowerE") || !strcmp(str, "Illuminant E") || !strcmp(str, "E"))
1246
1247 if (!strcmp(str, "Illuminant F8") || !strcmp(str, "F8"))
1248 return icIlluminantF8;
1249
1250 if (!strcmp(str, "Illuminant Black Body") || !strcmp(str, "Black Body"))
1251 return icIlluminantBlackBody;
1252
1253 if (!strcmp(str, "Illuminant Daylight") || !strcmp(str, "Daylight"))
1254 return icIlluminantDaylight;
1255
1256 if (!strcmp(str, "Illuminant B") || !strcmp(str, "B"))
1257 return icIlluminantB;
1258
1259 if (!strcmp(str, "Illuminant C") || !strcmp(str, "C"))
1260 return icIlluminantC;
1261
1262 if (!strcmp(str, "Illuminant F1") || !strcmp(str, "F1"))
1263 return icIlluminantF1;
1264
1265 if (!strcmp(str, "Illuminant F3") || !strcmp(str, "F3"))
1266 return icIlluminantF3;
1267
1268 if (!strcmp(str, "Illuminant F4") || !strcmp(str, "F4"))
1269 return icIlluminantF4;
1270
1271 if (!strcmp(str, "Illuminant F5") || !strcmp(str, "F5"))
1272 return icIlluminantF5;
1273
1274 if (!strcmp(str, "Illuminant F6") || !strcmp(str, "F6"))
1275 return icIlluminantF6;
1276
1277 if (!strcmp(str, "Illuminant F7") || !strcmp(str, "F7"))
1278 return icIlluminantF7;
1279
1280 if (!strcmp(str, "Illuminant F9") || !strcmp(str, "F9"))
1281 return icIlluminantF9;
1282
1283 if (!strcmp(str, "Illuminant F10") || !strcmp(str, "F10"))
1284 return icIlluminantF10;
1285
1286 if (!strcmp(str, "Illuminant F11") || !strcmp(str, "F11"))
1287 return icIlluminantF11;
1288
1289 if (!strcmp(str, "Illuminant F12") || !strcmp(str, "F12"))
1290 return icIlluminantF12;
1291
1292 return icIlluminantCustom;
1293}
@ icIlluminantF6
@ icIlluminantF8
@ icIlluminantF1
@ icIlluminantEquiPowerE
@ icIlluminantF11
@ icIlluminantF7
@ icIlluminantF2
@ icIlluminantF4
@ icIlluminantF3
@ icIlluminantD55
@ icIlluminantDaylight
@ icIlluminantB
@ icIlluminantA
@ icIlluminantF9
@ icIlluminantBlackBody
@ icIlluminantUnknown
@ icIlluminantD65
@ icIlluminantF10
@ icIlluminantD93
@ icIlluminantD50
@ icIlluminantC
@ icIlluminantF5
@ icIlluminantF12
#define icIlluminantCustom

References icIlluminantA, icIlluminantB, icIlluminantBlackBody, icIlluminantC, icIlluminantCustom, icIlluminantD50, icIlluminantD55, icIlluminantD65, icIlluminantD93, icIlluminantDaylight, icIlluminantEquiPowerE, icIlluminantF1, icIlluminantF10, icIlluminantF11, icIlluminantF12, icIlluminantF2, icIlluminantF3, icIlluminantF4, icIlluminantF5, icIlluminantF6, icIlluminantF7, icIlluminantF8, icIlluminantF9, and icIlluminantUnknown.

Referenced by CIccTagXmlMeasurement::ParseXml(), CIccTagXmlSpectralViewingConditions::ParseXml(), and CIccTagXmlViewingConditions::ParseXml().

+ Here is the caller graph for this function:

◆ icGetMeasurementValue()

icMeasurementUnitSig icGetMeasurementValue ( const icChar * str)

Definition at line 1394 of file IccUtilXml.cpp.

1395{
1396 if (!strcmp(str, "Status A"))
1397 return icSigStatusA;
1398
1399 if (!strcmp(str, "Status E"))
1400 return icSigStatusE;
1401
1402 if (!strcmp(str, "Status I"))
1403 return icSigStatusI;
1404
1405 if (!strcmp(str, "Status T"))
1406 return icSigStatusT;
1407
1408 if (!strcmp(str, "Status M"))
1409 return icSigStatusM;
1410
1411 if (!strcmp(str, "DIN with no polarizing filter"))
1412 return icSigDN;
1413
1414 if (!strcmp(str, "DIN with polarizing filter"))
1415 return icSigDNP;
1416
1417 if (!strcmp(str, "Narrow band DIN with no polarizing filter"))
1418 return icSigDNN;
1419
1420 if (!strcmp(str, "Narrow band DIN with polarizing filter"))
1421 return icSigDNNP;
1422
1423 return icSigStatusA;
1424}
@ icSigStatusI
@ icSigStatusE
@ icSigDNNP
@ icSigStatusA
@ icSigDN
@ icSigStatusT
@ icSigDNP
@ icSigDNN
@ icSigStatusM

References icSigDN, icSigDNN, icSigDNNP, icSigDNP, icSigStatusA, icSigStatusE, icSigStatusI, icSigStatusM, and icSigStatusT.

Referenced by CIccTagXmlResponseCurveSet16::ParseXml().

+ Here is the caller graph for this function:

◆ icGetNamedMeasurementFlareValue()

icMeasurementFlare icGetNamedMeasurementFlareValue ( const icChar * str)

Definition at line 1207 of file IccUtilXml.cpp.

1208{
1209 if (!strcmp(str, "Flare 0"))
1210 return icFlare0;
1211
1212 if (!strcmp(str, "Flare 100"))
1213 return icFlare100;
1214
1215 if (!strcmp(str, "Max Flare"))
1216 return icMaxEnumFlare;
1217
1218 return icFlare0;
1219}
@ icFlare100
@ icFlare0
#define icMaxEnumFlare
Convenience Enum Definition - Not defined in ICC specification.

References icFlare0, icFlare100, and icMaxEnumFlare.

Referenced by CIccTagXmlMeasurement::ParseXml().

+ Here is the caller graph for this function:

◆ icGetNamedStandardObserverValue()

icStandardObserver icGetNamedStandardObserverValue ( const icChar * str)

Definition at line 1175 of file IccUtilXml.cpp.

1176{
1177 if (!strcmp(str, "Unknown observer"))
1178 return icStdObsUnknown;
1179
1180 if (!strcmp(str, "CIE 1931 (two degree) standard observer"))
1182
1183 if (!strcmp(str, "CIE 1964 (ten degree) standard observer"))
1184 return icStdObs1964TenDegrees;
1185
1186 return icStdObsCustom;
1187}
#define icStdObsCustom
@ icStdObsUnknown
@ icStdObs1964TenDegrees
@ icStdObs1931TwoDegrees

References icStdObs1931TwoDegrees, icStdObs1964TenDegrees, icStdObsCustom, and icStdObsUnknown.

Referenced by CIccTagXmlMeasurement::ParseXml(), and CIccTagXmlSpectralViewingConditions::ParseXml().

+ Here is the caller graph for this function:

◆ icGetPadSpace()

const std::string icGetPadSpace ( double value)

Definition at line 1513 of file IccUtilXml.cpp.

1514{
1515 std::string space = "";
1516 if ( value >=0 && value < 10)
1517 space = " ";
1518 if ( value >=10 && value < 100)
1519 space = " ";
1520 if ( value >=100 && value < 1000 )
1521 space = " ";
1522
1523 return space;
1524}

◆ icGetRenderingIntentValue()

icRenderingIntent icGetRenderingIntentValue ( const icChar * szRenderingIntent)

Definition at line 1127 of file IccUtilXml.cpp.

1128{
1129 if (!strcmp(szRenderingIntent, "Perceptual"))
1130 return icPerceptual;
1131 else if (!strcmp(szRenderingIntent, "Media-relative colorimetric"))
1133 else if (!strcmp(szRenderingIntent, "Saturation"))
1134 return icSaturation;
1135 else if (!strcmp(szRenderingIntent, "ICC-absolute colorimetric"))
1137
1138 return icPerceptual;
1139}
@ icPerceptual
@ icRelativeColorimetric
@ icAbsoluteColorimetric
@ icSaturation

References icAbsoluteColorimetric, icPerceptual, icRelativeColorimetric, and icSaturation.

◆ icGetStandardObserverName()

const icChar * icGetStandardObserverName ( icStandardObserver str)

Definition at line 1295 of file IccUtilXml.cpp.

1296{
1297 switch (str) {
1298 case icStdObsUnknown:
1299 return "Unknown Observer";
1300
1302 return "CIE 1931 standard colorimetric observer";
1303
1305 return "CIE 1964 standard colorimetric observer";
1306
1307 default:
1308 return "Unknown Observer";
1309 }
1310}

References icStdObs1931TwoDegrees, icStdObs1964TenDegrees, and icStdObsUnknown.

Referenced by CIccTagXmlMeasurement::ToXml().

+ Here is the caller graph for this function:

◆ icGetTagNameSig()

icTagSignature icGetTagNameSig ( const icChar * szName)

Definition at line 1169 of file IccUtilXml.cpp.

1170{
1172}
static icTagSignature GetTagNameSig(const icChar *szName)
Function: GetTagNameSig(szTagName) Get signature from tag display name.

References CIccTagCreator::GetTagNameSig(), and szName.

Referenced by CIccProfileXml::ParseTag(), and CIccTagXmlStruct::ParseTag().

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

◆ icGetTagSigName()

const icChar * icGetTagSigName ( icTagSignature tagTypeSig)

Definition at line 1158 of file IccUtilXml.cpp.

1159{
1160 const icChar *rv = CIccTagCreator::GetTagSigName(tagTypeSig);
1161
1162 // if the tag signature is not found, it is a custom type.
1163 if (!rv)
1164 return "PrivateTag";
1165
1166 return rv;
1167}
char icChar
Definition IccDefs.h:109
static const icChar * GetTagSigName(icTagSignature tagTypeSig)
Function: GetTagSigName(tagSig) Get display name of tagSig.

References CIccTagCreator::GetTagSigName().

+ Here is the call graph for this function:

◆ icGetTagSigTypeName()

const icChar * icGetTagSigTypeName ( icTagTypeSignature tagTypeSig)

Definition at line 1141 of file IccUtilXml.cpp.

1142{
1143 const icChar *rv = CIccTagCreator::GetTagTypeSigName(tagTypeSig);
1144
1145 // if the tag signature is not found, it is a custom type.
1146 if (!rv)
1147 return "PrivateType";
1148
1149 return rv;
1150}
static const icChar * GetTagTypeSigName(icTagTypeSignature tagTypeSig)
Function: GetTagTypeSigName(tagTypeSig) Get display name of tagTypeSig.

References CIccTagCreator::GetTagTypeSigName().

Referenced by icProfDescToXml(), CIccMpeXmlTintArray::ToXml(), CIccTagXmlArray::ToXml(), CIccTagXmlStruct::ToXml(), and CIccProfileXml::ToXmlWithBlanks().

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

◆ icGetTypeNameTagSig()

icTagTypeSignature icGetTypeNameTagSig ( const icChar * szTagType)

Definition at line 1152 of file IccUtilXml.cpp.

1153{
1154 return CIccTagCreator::GetTagTypeNameSig(szTagType);
1155
1156}
static icTagTypeSignature GetTagTypeNameSig(const icChar *szName)
Function: GetTagTypeNameSig(szTypeName) Get signature based on display name of tag type.

References CIccTagCreator::GetTagTypeNameSig().

Referenced by icXmlParseProfDesc(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccMpeXmlTintArray::ParseXml(), and CIccTagXmlArray::ParseXml().

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

◆ icIsNumChar()

static bool icIsNumChar ( char c)
inlinestatic

Definition at line 912 of file IccUtilXml.cpp.

913{
914 if ((c>='0' && c<='9') || c=='.' || c=='+' || c=='-' || c=='e' || c == 'n' || c == 'a')
915 return true;
916 return false;
917}

Referenced by CIccXmlArrayType< T, Tsig >::ParseTextCount(), and CIccXmlArrayType< T, Tsig >::ParseTextCountNum().

+ Here is the caller graph for this function:

◆ icUtf16ToUtf8()

const char * icUtf16ToUtf8 ( std::string & buf,
const icUInt16Number * szSrc,
int sizeSrc )

Definition at line 341 of file IccUtilXml.cpp.

342{
343 if (!sizeSrc) {
344 sizeSrc = (int)CIccUTF16String::WStrlen(szSrc);
345 }
346
347 int n = sizeSrc*4;
348
349 if (n) {
350 char *szBuf = (char *)malloc(n+1);
351 char *szDest = szBuf;
352 icConvertUTF16toUTF8(&szSrc, &szSrc[sizeSrc], (UTF8**)&szDest, (UTF8*)&szDest[n+1], lenientConversion);
353 *szDest= '\0';
354
355 buf = szBuf;
356 free(szBuf);
357 }
358 else {
359 buf.clear();
360 }
361
362 return buf.c_str();
363}
icUtfConversionResult icConvertUTF16toUTF8(const UTF16 **sourceStart, const UTF16 *sourceEnd, UTF8 **targetStart, UTF8 *targetEnd, icUtfConversionFlags flags)
unsigned char UTF8
@ lenientConversion
static size_t WStrlen(const icUInt16Number *uzStr)

References icConvertUTF16toUTF8(), lenientConversion, and CIccUTF16String::WStrlen().

Referenced by CIccUTF16String::ToUtf8(), CIccTagXmlDict::ToXml(), CIccTagXmlMultiLocalizedUnicode::ToXml(), CIccTagXmlProfileSequenceId::ToXml(), and CIccTagXmlTextDescription::ToXml().

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

◆ icUtf8ToAnsi()

const char * icUtf8ToAnsi ( std::string & buf,
const char * szSrc )

Definition at line 397 of file IccUtilXml.cpp.

398{
399#ifdef WIN32
400 size_t len = strlen(szSrc)+1;
401 wchar_t *szUnicodeBuf = (wchar_t*)malloc(len*sizeof(icUInt16Number)*2);
402 char *szBuf = (char*)malloc(len*2);
403
404 size_t n;
405
406 n=MultiByteToWideChar(CP_UTF8, 0, szSrc, (int)len, szUnicodeBuf, (int)len*2);
407 szUnicodeBuf[n] = '\0';
408
409 n = WideCharToMultiByte(CP_ACP, 0, (const wchar_t*)szUnicodeBuf, (int)n, szBuf, (int)len*2, "?", NULL);
410 szBuf[n] = '\0';
411
412 buf = szBuf;
413
414 free(szBuf);
415 free(szUnicodeBuf);
416#else
417 buf = szSrc;
418#endif
419 return buf.c_str();
420}

Referenced by icXmlParseTextString(), CIccTagXmlColorantTable::ParseXml(), CIccTagXmlNamedColor2::ParseXml(), and CIccTagXmlTextDescription::ParseXml().

+ Here is the caller graph for this function:

◆ icUtf8ToUtf16()

const unsigned short * icUtf8ToUtf16 ( CIccUTF16String & buf,
const char * szSrc,
int sizeSrc )

Definition at line 365 of file IccUtilXml.cpp.

366{
367 buf.FromUtf8(szSrc, sizeSrc);
368
369 return buf.c_str();
370}
bool FromUtf8(const char *szStr, size_t sizeSrc=0)
const icUInt16Number * c_str()
Definition IccUtilXml.h:93

References CIccUTF16String::c_str(), and CIccUTF16String::FromUtf8().

+ Here is the call graph for this function:

◆ icXmlAttrValue() [1/2]

const char * icXmlAttrValue ( xmlAttr * attr,
const char * szDefault )

Definition at line 572 of file IccUtilXml.cpp.

573{
574 if (attr && attr->children && attr->children->type == XML_TEXT_NODE && attr->children->content)
575 return (const char*)attr->children->content;
576
577 return szDefault;
578}

Referenced by icCLutFromXml(), icGetDeviceAttrValue(), icMatrixFromXml(), icMBBFromXml(), icXmlAttrValue(), icXmlParseColorAppearanceParams(), icXmlParseTextString(), CIccProfileXml::ParseBasic(), CIccTagXmlMultiProcessElement::ParseElement(), CIccMpeXmlCalculator::ParseImport(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccFormulaCurveSegmentXml::ParseXml(), CIccMpeXmlBAcs::ParseXml(), CIccMpeXmlCalculator::ParseXml(), CIccMpeXmlCLUT::ParseXml(), CIccMpeXmlCurveSet::ParseXml(), CIccMpeXmlEAcs::ParseXml(), CIccMpeXmlEmissionCLUT::ParseXml(), CIccMpeXmlEmissionMatrix::ParseXml(), CIccMpeXmlEmissionObserver::ParseXml(), CIccMpeXmlExtCLUT::ParseXml(), CIccMpeXmlInvEmissionMatrix::ParseXml(), CIccMpeXmlJabToXYZ::ParseXml(), CIccMpeXmlMatrix::ParseXml(), CIccMpeXmlReflectanceCLUT::ParseXml(), CIccMpeXmlReflectanceObserver::ParseXml(), CIccMpeXmlTintArray::ParseXml(), CIccMpeXmlToneMap::ParseXml(), CIccMpeXmlUnknown::ParseXml(), CIccMpeXmlXYZToJab::ParseXml(), CIccSampledCalculatorCurveXml::ParseXml(), CIccSampledCurveSegmentXml::ParseXml(), CIccSegmentedCurveXml::ParseXml(), CIccSinglSampledeCurveXml::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagXmlChromaticity::ParseXml(), CIccTagXmlCicp::ParseXml(), CIccTagXmlColorantTable::ParseXml(), CIccTagXmlCurve::ParseXml(), CIccTagXmlDict::ParseXml(), CIccTagXmlEmbeddedHeightImage::ParseXml(), CIccTagXmlEmbeddedNormalImage::ParseXml(), CIccTagXmlFloatNum< T, A, Tsig >::ParseXml(), CIccTagXmlGamutBoundaryDesc::ParseXml(), CIccTagXmlMeasurement::ParseXml(), CIccTagXmlMultiLocalizedUnicode::ParseXml(), CIccTagXmlMultiProcessElement::ParseXml(), CIccTagXmlNamedColor2::ParseXml(), CIccTagXmlParametricCurve::ParseXml(), CIccTagXmlProfileSequenceId::ParseXml(), CIccTagXmlResponseCurveSet16::ParseXml(), CIccTagXmlSparseMatrixArray::ParseXml(), CIccTagXmlSpectralDataInfo::ParseXml(), CIccTagXmlSpectralViewingConditions::ParseXml(), CIccTagXmlTagData::ParseXml(), CIccTagXmlTextDescription::ParseXml(), CIccTagXmlUnknown::ParseXml(), CIccTagXmlViewingConditions::ParseXml(), CIccTagXmlXYZ::ParseXml(), and CIccXmlToneMapFunc::ParseXml().

◆ icXmlAttrValue() [2/2]

const char * icXmlAttrValue ( xmlNode * pNode,
const char * szName,
const char * szDefault )

Definition at line 580 of file IccUtilXml.cpp.

581{
582 xmlAttr *attr = icXmlFindAttr(pNode, szName);
583 if (attr) {
584 return icXmlAttrValue(attr, szDefault);
585 }
586 return szDefault;
587}

References icXmlAttrValue(), icXmlFindAttr(), and szName.

+ Here is the call graph for this function:

◆ icXmlDumpHexData()

icUInt32Number icXmlDumpHexData ( std::string & xml,
std::string blanks,
void * pBuf,
icUInt32Number nBufSize )

Definition at line 648 of file IccUtilXml.cpp.

649{
650 icUInt8Number *m_ptr = (icUInt8Number *)pBuf;
651 char buf[15];
653
654 for (i=0; i<nBufSize; i++, m_ptr++) {
655 if (!(i%32)) {
656 if (i)
657 xml += "\n";
658 xml += blanks;
659 }
660 sprintf(buf, "%02x", *m_ptr);
661 xml += buf;
662 }
663 if (i) {
664 xml += "\n";
665 }
666 return i;
667}
unsigned char icUInt8Number
Number definitions.

Referenced by icXmlDumpTextData(), CIccMpeXmlBAcs::ToXml(), CIccMpeXmlEAcs::ToXml(), CIccMpeXmlUnknown::ToXml(), CIccTagXmlEmbeddedHeightImage::ToXml(), CIccTagXmlEmbeddedNormalImage::ToXml(), CIccTagXmlTagData::ToXml(), CIccTagXmlUnknown::ToXml(), CIccTagXmlZipUtf8Text::ToXml(), and CIccTagXmlZipXml::ToXml().

+ Here is the caller graph for this function:

◆ icXmlFindAttr()

xmlAttr * icXmlFindAttr ( xmlNode * pNode,
const char * szAttrName )

Definition at line 669 of file IccUtilXml.cpp.

670{
671 if (!pNode) return NULL;
672
673 xmlAttr *attr;
674
675 for (attr = pNode->properties; attr; attr = attr->next) {
676 if (attr->type != XML_ATTRIBUTE_NODE)
677 continue;
678
679 if (!icXmlStrCmp(attr->name, szAttrName)) {
680 return attr;
681 }
682 }
683
684 return NULL;
685}
#define icXmlStrCmp(x, y)
Definition IccUtilXml.h:134

References icXmlStrCmp.

Referenced by icCLutFromXml(), icGetDeviceAttrValue(), icMatrixFromXml(), icMBBFromXml(), icXmlAttrValue(), icXmlParseColorAppearanceParams(), CIccProfileXml::ParseBasic(), CIccTagXmlMultiProcessElement::ParseElement(), CIccMpeXmlCalculator::ParseImport(), CIccProfileXml::ParseTag(), CIccTagXmlStruct::ParseTag(), CIccFormulaCurveSegmentXml::ParseXml(), CIccMpeXmlTintArray::ParseXml(), CIccSampledCalculatorCurveXml::ParseXml(), CIccSampledCurveSegmentXml::ParseXml(), CIccSinglSampledeCurveXml::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagXmlChromaticity::ParseXml(), CIccTagXmlCicp::ParseXml(), CIccTagXmlColorantTable::ParseXml(), CIccTagXmlDict::ParseXml(), CIccTagXmlMeasurement::ParseXml(), CIccTagXmlMultiLocalizedUnicode::ParseXml(), CIccTagXmlMultiProcessElement::ParseXml(), CIccTagXmlNamedColor2::ParseXml(), CIccTagXmlParametricCurve::ParseXml(), CIccTagXmlProfileSequenceId::ParseXml(), CIccTagXmlSparseMatrixArray::ParseXml(), CIccTagXmlSpectralViewingConditions::ParseXml(), CIccTagXmlViewingConditions::ParseXml(), CIccTagXmlXYZ::ParseXml(), and CIccXmlToneMapFunc::ParseXml().

+ Here is the caller graph for this function:

◆ icXmlFindNode()

xmlNode * icXmlFindNode ( xmlNode * pNode,
const char * szNodeName )

Definition at line 687 of file IccUtilXml.cpp.

688{
689 if (!pNode) return NULL;
690
691 for (; pNode; pNode = pNode->next) {
692 if (pNode->type != XML_ELEMENT_NODE)
693 continue;
694
695 if (!icXmlStrCmp(pNode->name, szNodeName)) {
696 return pNode;
697 }
698 }
699
700 return NULL;
701}

References icXmlStrCmp.

Referenced by icCLutFromXml(), icMBBFromXml(), icXmlParseColorAppearanceParams(), icXmlParseProfDesc(), CIccProfileXml::ParseBasic(), CIccMpeXmlCalculator::ParseImport(), CIccMpeXmlCalculator::ParseXml(), CIccMpeXmlEmissionCLUT::ParseXml(), CIccMpeXmlEmissionMatrix::ParseXml(), CIccMpeXmlEmissionObserver::ParseXml(), CIccMpeXmlInvEmissionMatrix::ParseXml(), CIccMpeXmlJabToXYZ::ParseXml(), CIccMpeXmlMatrix::ParseXml(), CIccMpeXmlReflectanceCLUT::ParseXml(), CIccMpeXmlReflectanceObserver::ParseXml(), CIccMpeXmlToneMap::ParseXml(), CIccMpeXmlXYZToJab::ParseXml(), CIccProfileXml::ParseXml(), CIccSampledCalculatorCurveXml::ParseXml(), CIccTagXmlArray::ParseXml(), CIccTagXmlChromaticity::ParseXml(), CIccTagXmlCicp::ParseXml(), CIccTagXmlColorantOrder::ParseXml(), CIccTagXmlColorantTable::ParseXml(), CIccTagXmlCurve::ParseXml(), CIccTagXmlDateTime::ParseXml(), CIccTagXmlDict::ParseXml(), CIccTagXmlEmbeddedHeightImage::ParseXml(), CIccTagXmlEmbeddedNormalImage::ParseXml(), CIccTagXmlEmbeddedProfile::ParseXml(), CIccTagXmlFixedNum< T, Tsig >::ParseXml(), CIccTagXmlFloatNum< T, A, Tsig >::ParseXml(), CIccTagXmlGamutBoundaryDesc::ParseXml(), CIccTagXmlMeasurement::ParseXml(), CIccTagXmlMultiLocalizedUnicode::ParseXml(), CIccTagXmlMultiProcessElement::ParseXml(), CIccTagXmlNamedColor2::ParseXml(), CIccTagXmlNum< T, A, Tsig >::ParseXml(), CIccTagXmlParametricCurve::ParseXml(), CIccTagXmlProfileSeqDesc::ParseXml(), CIccTagXmlProfileSequenceId::ParseXml(), CIccTagXmlResponseCurveSet16::ParseXml(), CIccTagXmlSegmentedCurve::ParseXml(), CIccTagXmlSignature::ParseXml(), CIccTagXmlSparseMatrixArray::ParseXml(), CIccTagXmlSpectralDataInfo::ParseXml(), CIccTagXmlSpectralViewingConditions::ParseXml(), CIccTagXmlStruct::ParseXml(), CIccTagXmlTagData::ParseXml(), CIccTagXmlTextDescription::ParseXml(), CIccTagXmlUnknown::ParseXml(), and CIccTagXmlViewingConditions::ParseXml().

◆ icXmlGetChildSigVal()

icUInt32Number icXmlGetChildSigVal ( xmlNode * pNode)

Definition at line 589 of file IccUtilXml.cpp.

590{
591 if (!pNode || !pNode->children || !pNode->children->content)
592 return 0;
593
594 return icGetSigVal((const char*)pNode->children->content);
595}
icUInt32Number icGetSigVal(const icChar *pBuf)
Definition IccUtil.cpp:1258

References icGetSigVal().

Referenced by CIccProfileXml::ParseBasic().

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

◆ icXmlGetHexData()

icUInt32Number icXmlGetHexData ( void * pBuf,
const char * szText,
icUInt32Number nBufSize )

Definition at line 609 of file IccUtilXml.cpp.

610{
611 unsigned char *pDest = (unsigned char*)pBuf;
612 icUInt32Number rv =0;
613
614 while(*szText && rv<nBufSize) {
615 int c1=hexValue(szText[0]);
616 int c2=hexValue(szText[1]);
617 if (c1>=0 && c2>=0) {
618 *pDest = c1*16+ c2;
619 pDest++;
620 szText +=2;
621 rv++;
622 }
623 else {
624 szText++;
625 }
626 }
627 return rv;
628}
static int hexValue(char c)

References hexValue().

Referenced by icXmlParseTextString(), CIccProfileXml::ParseBasic(), CIccMpeXmlBAcs::ParseXml(), CIccMpeXmlEAcs::ParseXml(), CIccMpeXmlUnknown::ParseXml(), CIccTagXmlEmbeddedHeightImage::ParseXml(), CIccTagXmlEmbeddedNormalImage::ParseXml(), CIccTagXmlProfileSequenceId::ParseXml(), CIccTagXmlTagData::ParseXml(), CIccTagXmlTextDescription::ParseXml(), CIccTagXmlUnknown::ParseXml(), CIccTagXmlZipUtf8Text::ParseXml(), and CIccTagXmlZipXml::ParseXml().

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

◆ icXmlGetHexDataSize()

icUInt32Number icXmlGetHexDataSize ( const char * szText)

Definition at line 630 of file IccUtilXml.cpp.

631{
632 icUInt32Number rv =0;
633
634 while(*szText) {
635 int c1=hexValue(szText[0]);
636 int c2=hexValue(szText[1]);
637 if (c1>=0 && c2>=0) {
638 szText +=2;
639 rv++;
640 }
641 else {
642 szText++;
643 }
644 }
645 return rv;
646}

References hexValue().

Referenced by icXmlParseTextString(), CIccMpeXmlBAcs::ParseXml(), CIccMpeXmlEAcs::ParseXml(), CIccMpeXmlUnknown::ParseXml(), CIccTagXmlEmbeddedHeightImage::ParseXml(), CIccTagXmlEmbeddedNormalImage::ParseXml(), CIccTagXmlTagData::ParseXml(), CIccTagXmlUnknown::ParseXml(), CIccTagXmlZipUtf8Text::ParseXml(), and CIccTagXmlZipXml::ParseXml().

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

◆ icXmlNodeCount()

icUInt32Number icXmlNodeCount ( xmlNode * pNode,
const char * szNodeName )

Definition at line 703 of file IccUtilXml.cpp.

704{
705 icUInt32Number rv = 0;
706 for (; pNode; pNode = pNode->next) {
707 if (pNode->type == XML_ELEMENT_NODE &&
708 !icXmlStrCmp(pNode->name, szNodeName)) {
709 rv++;
710 }
711 }
712 return rv;
713}

References icXmlStrCmp.

Referenced by CIccXmlArrayType< T, Tsig >::ParseArray(), CIccXmlArrayType< T, Tsig >::ParseArray(), CIccTagXmlChromaticity::ParseXml(), CIccTagXmlColorantOrder::ParseXml(), CIccTagXmlColorantTable::ParseXml(), CIccTagXmlResponseCurveSet16::ParseXml(), and CIccTagXmlXYZ::ParseXml().

+ Here is the caller graph for this function:

◆ icXmlNodeCount2()

icUInt32Number icXmlNodeCount2 ( xmlNode * pNode,
const char * szNodeName1,
const char * szNodeName2 )

Definition at line 715 of file IccUtilXml.cpp.

716{
717 icUInt32Number rv = 0;
718 for (; pNode; pNode = pNode->next) {
719 if (pNode->type == XML_ELEMENT_NODE &&
720 (!icXmlStrCmp(pNode->name, szNodeName1) || !icXmlStrCmp(pNode->name, szNodeName2))) {
721 rv++;
722 }
723 }
724 return rv;
725}

References icXmlStrCmp.

◆ icXmlNodeCount3()

icUInt32Number icXmlNodeCount3 ( xmlNode * pNode,
const char * szNodeName1,
const char * szNodeName2,
const char * szNodeName3 )

Definition at line 727 of file IccUtilXml.cpp.

728{
729 icUInt32Number rv = 0;
730 for (; pNode; pNode = pNode->next) {
731 if (pNode->type == XML_ELEMENT_NODE &&
732 (!icXmlStrCmp(pNode->name, szNodeName1) || !icXmlStrCmp(pNode->name, szNodeName2) || !icXmlStrCmp(pNode->name, szNodeName3))) {
733 rv++;
734 }
735 }
736 return rv;
737}

References icXmlStrCmp.

Referenced by CIccTagXmlNamedColor2::ParseXml().

+ Here is the caller graph for this function:

◆ icXmlStrToFloat()

icFloatNumber icXmlStrToFloat ( const xmlChar * szStr)

Definition at line 559 of file IccUtilXml.cpp.

560{
561 float f=0.0;
562 sscanf((const char*)szStr, "%f", &f);
563
564 return (icFloatNumber)f;
565}
float icFloatNumber
All floating point operations/variables in IccProfLib use the icFloatNumber data type.
Definition IccDefs.h:100

◆ icXmlStrToSig()

icSignature icXmlStrToSig ( const char * szStr)

Definition at line 567 of file IccUtilXml.cpp.

568{
569 return icGetSigVal(szStr);
570}

References icGetSigVal().

Referenced by icXmlParseProfDesc(), CIccMpeXmlBAcs::ParseXml(), CIccMpeXmlEAcs::ParseXml(), and CIccMpeXmlUnknown::ParseXml().

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