Hoyt's FORK of DemoIccMAX 2.1.17.hoyt
Documentation for Hoyt's FORK of DemoIccMAX
Loading...
Searching...
No Matches
IccToXml.cpp File Reference
#include <stdio.h>
#include "IccTagXmlFactory.h"
#include "IccMpeXmlFactory.h"
#include "IccProfileXml.h"
#include "IccIO.h"
#include "IccProfLibVer.h"
#include "IccLibXMLVer.h"
+ Include dependency graph for IccToXml.cpp:

Go to the source code of this file.

Functions

int main (int argc, char *argv[])
 

Function Documentation

◆ main()

int main ( int argc,
char * argv[] )

Definition at line 12 of file IccToXml.cpp.

13{
14 if (argc<=2) {
15 printf("IccToXml built with IccProfLib Version " ICCPROFLIBVER ", IccLibXML Version " ICCLIBXMLVER "\n\nUsage: IccToXml src_icc_profile dest_xml_file\n");
16 return -1;
17 }
18
21
22 CIccProfileXml profile;
23 CIccFileIO srcIO, dstIO;
24
25 if (!srcIO.Open(argv[1], "r")) {
26 printf("Unable to open '%s'\n", argv[1]);
27 return -1;
28 }
29
30 if (!profile.Read(&srcIO)) {
31 printf("Unable to read '%s'\n", argv[1]);
32 return -1;
33 }
34
35 std::string xml;
36 xml.reserve(40000000);
37
38 if (!profile.ToXml(xml)) {
39 printf("Unable to convert '%s' to xml\n", argv[1]);
40 return -1;
41 }
42
43 if (!dstIO.Open(argv[2], "wb")) {
44 printf("unable to open '%s'\n", argv[2]);
45 return -1;
46 }
47
48 if (dstIO.Write8((char*)xml.c_str(), (icInt32Number)xml.size())==(icInt32Number)xml.size()) {
49 printf("XML successfully created\n");
50 }
51 else {
52 printf("Unable to write '%s'\n", argv[2]);
53 return -1;
54 }
55
56 dstIO.Close();
57
58 return 0;
59}
#define ICCLIBXMLVER
Definition IccLibXMLVer.h:2
#define ICCPROFLIBVER
Type: Class.
Definition IccIO.h:150
virtual void Close()
Definition IccIO.cpp:443
virtual icInt32Number Write8(void *pBuf, icInt32Number nNum=1)
Definition IccIO.cpp:461
bool Open(const icChar *szFilename, const icChar *szAttr)
Definition IccIO.cpp:382
static void PushFactory(IIccMpeFactory *pFactory)
Function: PushFactory(pFactory) Add an IIccMpeFactory to the stack of element factories tracked by th...
Class: CIccMpeXmlFactory.
bool ToXml(std::string &xmlString)
static void PushFactory(IIccTagFactory *pFactory)
Function: PushFactory(pFactory) Add an IIccTagFactory to the stack of tag factories tracked by the sy...
Class: CIccTagXmlFactory.
long icInt32Number

References CIccFileIO::Close(), ICCLIBXMLVER, ICCPROFLIBVER, CIccFileIO::Open(), CIccMpeCreator::PushFactory(), CIccTagCreator::PushFactory(), CIccProfileXml::ToXml(), and CIccFileIO::Write8().

+ Here is the call graph for this function: