• Skip to content
  • Skip to link menu
  • KDE API Reference
  • kdelibs-4.14.38 API Reference
  • KDE Home
  • Contact Us
 

KDocTools

  • kdoctools
meinproc_simple.cpp
Go to the documentation of this file.
1
2#include "meinproc_common.h"
3
4#include "xslt.h"
5
6#include <QCoreApplication>
7#include <QtCore/QString>
8#include <QtCore/QFile>
9#include <QtCore/QDir>
10#include <QtCore/QTextCodec>
11#include <QtCore/QFileInfo>
12#include <QtCore/QList>
13
14#include <libxml/xmlversion.h>
15#include <libxml/xmlmemory.h>
16#include <libxml/debugXML.h>
17#include <libxml/HTMLtree.h>
18#include <libxml/xmlIO.h>
19#include <libxml/catalog.h>
20#include <libxml/parserInternals.h>
21#include <libxslt/xsltconfig.h>
22#include <libxslt/xsltInternals.h>
23#include <libxslt/transform.h>
24#include <libxslt/xsltutils.h>
25#include <libexslt/exslt.h>
26
27#include <stdlib.h>
28#include <string.h>
29#include <sys/time.h>
30#include <unistd.h>
31
32#ifndef _WIN32
33extern "C" int xmlLoadExtDtdDefaultValue;
34#endif
35
36int main(int argc, char **argv) {
37
38 // xsltSetGenericDebugFunc(stderr, NULL);
39
40 QCoreApplication app( argc, argv );
41
42 const QStringList arguments = app.arguments();
43 if ( arguments.count() != 4 ) {
44 qCritical() << "wrong argument count";
45 return ( 1 );
46 }
47
48 const QString srcDir = arguments[1];
49 const QString xmllintPath = arguments[2];
50 const QString checkFilename = arguments[3];
51 const QString customizationCatalog = srcDir + "/customization/catalog.xml";
52
53 if ( checkFile( checkFilename ) != CheckFileSuccess )
54 {
55 qCritical() << "checkFile failed in " << checkFilename;
56 return ( 2 );
57 }
58 if ( checkFile( customizationCatalog ) != CheckFileSuccess )
59 {
60 qCritical() << "checkFile failed in " << customizationCatalog;
61 return ( 2 );
62 }
63
64 exsltRegisterAll();
65
66 QByteArray catalogs;
67 catalogs += customizationCatalog.toUtf8();
68
69 setenv( "XML_CATALOG_FILES", catalogs.constData(), 1 );
70 xmlInitializeCatalog();
71
72 LIBXML_TEST_VERSION
73
74 if ( check( checkFilename, xmllintPath, catalogs ) != CheckSuccess )
75 {
76 qWarning() << "Check failed";
77 return 3;
78 }
79
80 xmlSubstituteEntitiesDefault(1);
81 xmlLoadExtDtdDefaultValue = 1;
82
83 QVector<const char *> params;
84 params.append( NULL );
85
86 const QString tss = srcDir + "/customization/kde-chunk.xsl";
87 QString output = transform(checkFilename , tss, params);
88 if (output.isEmpty()) {
89 fprintf(stderr, "unable to parse %s\n", checkFilename.toLocal8Bit().data());
90 return(4);
91 }
92
93 doOutput(output, true, false, QString(), false /* replaceCharset */);
94
95 xmlCleanupParser();
96 xmlMemoryDump();
97 return(0);
98}
99
output
void output(QList< Action > actions, QHash< QString, QString > domain)
doOutput
void doOutput(QString output, bool usingStdOut, bool usingOutput, const QString &outputOption, bool replaceCharset)
Definition: meinproc_common.cpp:60
checkFile
CheckFileResult checkFile(const QString &checkFilename)
Definition: meinproc_common.cpp:11
check
CheckResult check(const QString &checkFilename, const QString &exe, const QByteArray &catalogs)
Definition: meinproc_common.cpp:29
meinproc_common.h
CheckFileSuccess
@ CheckFileSuccess
Definition: meinproc_common.h:10
CheckSuccess
@ CheckSuccess
Definition: meinproc_common.h:20
main
int main(int argc, char **argv)
Definition: meinproc_simple.cpp:36
xmlLoadExtDtdDefaultValue
int xmlLoadExtDtdDefaultValue
Definition: meinproc_simple.cpp:33
transform
QString transform(const QString &pat, const QString &tss, const QVector< const char * > &params)
Definition: xslt.cpp:130
xslt.h
This file is part of the KDE documentation.
Documentation copyright © 1996-2023 The KDE developers.
Generated on Mon Feb 20 2023 00:00:00 by doxygen 1.9.6 written by Dimitri van Heesch, © 1997-2006

KDE's Doxygen guidelines are available online.

KDocTools

Skip menu "KDocTools"
  • Main Page
  • Alphabetical List
  • Class List
  • Class Hierarchy
  • Class Members
  • File List
  • File Members
  • Related Pages

kdelibs-4.14.38 API Reference

Skip menu "kdelibs-4.14.38 API Reference"
  • DNSSD
  • Interfaces
  •   KHexEdit
  •   KMediaPlayer
  •   KSpeech
  •   KTextEditor
  • kconf_update
  • KDE3Support
  •   KUnitTest
  • KDECore
  • KDED
  • KDEsu
  • KDEUI
  • KDEWebKit
  • KDocTools
  • KFile
  • KHTML
  • KImgIO
  • KInit
  • kio
  • KIOSlave
  • KJS
  •   KJS-API
  •   WTF
  • kjsembed
  • KNewStuff
  • KParts
  • KPty
  • Kross
  • KUnitConversion
  • KUtils
  • Nepomuk
  • Plasma
  • Solid
  • Sonnet
  • ThreadWeaver
Report problems with this website to our bug tracking system.
Contact the specific authors with questions and comments about the page contents.

KDE® and the K Desktop Environment® logo are registered trademarks of KDE e.V. | Legal