summaryrefslogtreecommitdiffstats
path: root/qtools
diff options
context:
space:
mode:
authordimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-01-07 17:28:47 (GMT)
committerdimitri <dimitri@afe2bf4a-e733-0410-8a33-86f594647bc7>2001-01-07 17:28:47 (GMT)
commiteab6039875f05c8776119469fff0df8761b9b3a2 (patch)
treee0730802a8bb7eac348a5e39cffb88118aa42020 /qtools
parente4cebf12a245705a0ecb714cd3794750af9d0844 (diff)
downloadDoxygen-eab6039875f05c8776119469fff0df8761b9b3a2.zip
Doxygen-eab6039875f05c8776119469fff0df8761b9b3a2.tar.gz
Doxygen-eab6039875f05c8776119469fff0df8761b9b3a2.tar.bz2
Release-1.2.4-20010107
Diffstat (limited to 'qtools')
-rw-r--r--qtools/qdir.cpp29
-rw-r--r--qtools/qdir_win32.cpp2
-rw-r--r--qtools/qfeatures.h30
-rw-r--r--qtools/qfile_win32.cpp2
-rw-r--r--qtools/qfileinfo_win32.cpp2
-rw-r--r--qtools/qglobal.cpp13
-rw-r--r--qtools/qglobal.h19
-rw-r--r--qtools/qstring.cpp10
-rw-r--r--qtools/qtextcodec.cpp93
-rw-r--r--qtools/qxml.cpp405
-rw-r--r--qtools/qxml.h21
11 files changed, 356 insertions, 270 deletions
diff --git a/qtools/qdir.cpp b/qtools/qdir.cpp
index 185933a..ed7ed99 100644
--- a/qtools/qdir.cpp
+++ b/qtools/qdir.cpp
@@ -1012,14 +1012,10 @@ QStringList qt_makeFilterList( const QString &filter )
if ( filter.isEmpty() )
return QStringList();
- int i = filter.find( ' ', 0 );
- QChar sep( ' ' );
- if ( i == -1 ) {
- if ( filter.find( ';', 0 ) != -1 ) {
- sep = QChar( ';' );
- i = filter.find( sep, 0 );
- }
- }
+ QChar sep( ';' );
+ int i = filter.find( sep, 0 );
+ if ( i == -1 && filter.find( ' ', 0 ) != -1 )
+ sep = QChar( ' ' );
QStringList lst = QStringList::split( sep, filter );
QStringList lst2;
@@ -1027,22 +1023,7 @@ QStringList qt_makeFilterList( const QString &filter )
for ( ; it != lst.end(); ++it ) {
QString s = *it;
- if ( s[ (int)s.length() - 1 ] == ';' )
- s.remove( s.length() - 1, 1 );
- if ( s[0] == '\"' ) {
- s.remove( 0, 1 );
- while( ++it != lst.end() ) {
- QString s2 = *it;
- s += " "+s2;
- if ( s2[(int)s2.length() -1] == '\"' ) {
- s.remove( s.length() -1, 1 );
- break;
- }
- }
- }
- lst2 << s;
- if ( it == lst.end() )
- break;
+ lst2 << s.stripWhiteSpace();
}
return lst2;
}
diff --git a/qtools/qdir_win32.cpp b/qtools/qdir_win32.cpp
index 70c3563..b1eee66 100644
--- a/qtools/qdir_win32.cpp
+++ b/qtools/qdir_win32.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2000 by Dimitri van Heesch.
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
diff --git a/qtools/qfeatures.h b/qtools/qfeatures.h
index e2e356c..84fa715 100644
--- a/qtools/qfeatures.h
+++ b/qtools/qfeatures.h
@@ -52,8 +52,6 @@
//
#if defined(QCONFIG_LOCAL)
#include <qconfig-local.h>
-#elif defined(QCONFIG_QPE)
-#include <qconfig-qpe.h>
#elif defined(QCONFIG_MINIMAL)
#include <qconfig-minimal.h>
#elif defined(QCONFIG_SMALL)
@@ -367,15 +365,23 @@
Transformed frame buffer
*/
//#define QT_NO_QWS_TRANSFORMED
+#if defined(QT_NO_NETWORK)
/*!
Remote frame buffer (VNC)
*/
-#define QT_NO_QWS_VNC
+# ifndef QT_NO_QWS_VNC
+# define QT_NO_QWS_VNC
+# endif
+#endif
/*!
1-bit monochrome
*/
//#define QT_NO_QWS_DEPTH_1
/*!
+ 4-bit greyscale
+*/
+//#define QT_NO_QWS_DEPTH_4
+/*!
4-bit VGA
*/
//#define QT_NO_QWS_VGA_16
@@ -397,16 +403,32 @@
*/
//#define QT_NO_QWS_DEPTH_16
/*!
+ 24-bit color
+*/
+//#define QT_NO_QWS_DEPTH_24
+/*!
32-bit color
*/
//#define QT_NO_QWS_DEPTH_32
/*!
- Window manager
+ Window Manager
*/
//#define QT_NO_QWS_MANAGER
/*!
+ Window Manager Styles
+*/
+#define QT_NO_QWS_KDE2_WM_STYLE
+#if defined( QT_NO_QWS_MANAGER ) || defined( QT_NO_IMAGEIO_XPM )
+# define QT_NO_QWS_AQUA_WM_STYLE
+# define QT_NO_QWS_BEOS_WM_STYLE
+# define QT_NO_QWS_KDE_WM_STYLE
+# define QT_NO_QWS_QPE_WM_STYLE
+# define QT_NO_QWS_WINDOWS_WM_STYLE
+#endif
+
+/*!
Saving of fonts
*/
//#define QT_NO_QWS_SAVEFONTS
diff --git a/qtools/qfile_win32.cpp b/qtools/qfile_win32.cpp
index 5272365..fd28d43 100644
--- a/qtools/qfile_win32.cpp
+++ b/qtools/qfile_win32.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2000 by Dimitri van Heesch.
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
diff --git a/qtools/qfileinfo_win32.cpp b/qtools/qfileinfo_win32.cpp
index 47b8491..bfcc6ac 100644
--- a/qtools/qfileinfo_win32.cpp
+++ b/qtools/qfileinfo_win32.cpp
@@ -2,7 +2,7 @@
*
*
*
- * Copyright (C) 1997-2000 by Dimitri van Heesch.
+ * Copyright (C) 1997-2001 by Dimitri van Heesch.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation under the terms of the GNU General Public License is hereby
diff --git a/qtools/qglobal.cpp b/qtools/qglobal.cpp
index 2789e30..50f5202 100644
--- a/qtools/qglobal.cpp
+++ b/qtools/qglobal.cpp
@@ -589,8 +589,12 @@ void qObsolete( const char *obj, const char *oldfunc, const char *newfunc )
return;
if ( !firstObsoleteWarning(obj, oldfunc) )
return;
- qDebug( "%s::%s: This function is obsolete, use %s instead",
- obj, oldfunc, newfunc );
+ if ( obj )
+ qDebug( "%s::%s: This function is obsolete, use %s instead.",
+ obj, oldfunc, newfunc );
+ else
+ qDebug( "%s: This function is obsolete, use %s instead.",
+ oldfunc, newfunc );
}
void qObsolete( const char *obj, const char *oldfunc )
@@ -599,7 +603,10 @@ void qObsolete( const char *obj, const char *oldfunc )
return;
if ( !firstObsoleteWarning(obj, oldfunc) )
return;
- qDebug( "%s::%s: This function is obsolete.", obj, oldfunc );
+ if ( obj )
+ qDebug( "%s::%s: This function is obsolete.", obj, oldfunc );
+ else
+ qDebug( "%s: This function is obsolete.", oldfunc );
}
void qObsolete( const char *message )
diff --git a/qtools/qglobal.h b/qtools/qglobal.h
index c58e466..9c2b53e 100644
--- a/qtools/qglobal.h
+++ b/qtools/qglobal.h
@@ -39,8 +39,8 @@
#define QGLOBAL_H
-#define QT_VERSION 222
-#define QT_VERSION_STR "2.2.2"
+#define QT_VERSION 223
+#define QT_VERSION_STR "2.2.3"
//
@@ -198,10 +198,6 @@
#if __GNUC__ == 2 && __GNUC_MINOR__ >= 95
#define Q_DELETING_VOID_UNDEFINED
#endif
-#if __GNUC__ == 2 && __GNUC_MINOR__ >= 96
-#define Q_DELETING_VOID_UNDEFINED
-#define Q_FP_CCAST_BROKEN
-#endif
#if (defined(__arm__) || defined(__ARMEL__)) && !defined(QT_MOC_CPP)
#define Q_PACKED __attribute__ ((packed))
#endif
@@ -224,6 +220,11 @@
#ifdef __EDG__ // UnixWare7
#define Q_HAS_BOOL_TYPE
#endif
+#elif defined(__DECCXX)
+#define _CC_DEC_
+#if __DECCXX_VER >= 60060005
+#define Q_HAS_BOOL_TYPE
+#endif
#elif defined(__EDG) || defined(__EDG__)
// one observed on SGI DCC, the other documented
#define _CC_EDG_
@@ -236,14 +237,8 @@
#define _CC_SUN_
#if __SUNPRO_CC >= 0x500
#define Q_HAS_BOOL_TYPE
-#define Q_FP_CCAST_BROKEN
#define Q_C_CALLBACKS
#endif
-#elif defined(__DECCXX)
-#define _CC_DEC_
-#if __DECCXX_VER >= 60060005
-#define Q_HAS_BOOL_TYPE
-#endif
#elif defined(__CDS__)
#define _CC_CDS_
#define Q_HAS_BOOL_TYPE
diff --git a/qtools/qstring.cpp b/qtools/qstring.cpp
index 85962b2..e13ffc8 100644
--- a/qtools/qstring.cpp
+++ b/qtools/qstring.cpp
@@ -13928,8 +13928,14 @@ uint QString::toUInt( bool *ok, int base ) const
double QString::toDouble( bool *ok ) const
{
char *end;
- const char *a = latin1();
- double val = strtod( a ? a : "", &end );
+
+ QCString a = latin1();
+ // Just latin1() is not sufficient, since U0131 would look like '1'.
+ for (uint i=0; i<d->len; i++)
+ if ( d->unicode[i].row() )
+ a[(int)i]='z';
+
+ double val = strtod( a.data() ? a.data() : "", &end );
if ( ok )
*ok = ( a && *a && ( end == 0 || *end == '\0' ) );
return val;
diff --git a/qtools/qtextcodec.cpp b/qtools/qtextcodec.cpp
index 9f94cb6..cdecfce 100644
--- a/qtools/qtextcodec.cpp
+++ b/qtools/qtextcodec.cpp
@@ -802,7 +802,10 @@ QCString QTextCodec::fromUnicode(const QString& uc) const
*/
QString QTextCodec::toUnicode(const QByteArray& a, int len) const
{
- return toUnicode(a.data(),len);
+ int l = a.size();
+ if( l > 0 && a.data()[l - 1] == '\0' ) l--;
+ l = QMIN( l, len );
+ return toUnicode( a.data(), l );
}
/*!
@@ -810,7 +813,9 @@ QString QTextCodec::toUnicode(const QByteArray& a, int len) const
*/
QString QTextCodec::toUnicode(const QByteArray& a) const
{
- return toUnicode(a.data(),a.size());
+ int l = a.size();
+ if( l > 0 && a.data()[l - 1] == '\0' ) l--;
+ return toUnicode( a.data(), l );
}
/*!
@@ -976,13 +981,16 @@ public:
const int maxlen=100;
char line[maxlen];
char esc='\\';
+ char comm='%';
bool incmap = FALSE;
while (iod->readLine(line,maxlen) > 0) {
if (0==qstrnicmp(line,"<code_set_name>",15))
n = line+15;
- else if (0==qstrnicmp(line,"<escape_char>",13))
+ else if (0==qstrnicmp(line,"<escape_char> ",14))
esc = line[14];
- else if (0==qstrnicmp(line,"% alias ",8)) {
+ else if (0==qstrnicmp(line,"<comment_char> ",15))
+ comm = line[15];
+ else if (line[0]==comm && 0==qstrnicmp(line+1," alias ",7)) {
aliases.append(line+8);
} else if (0==qstrnicmp(line,"CHARMAP",7)) {
if (!from_unicode_page) {
@@ -1004,45 +1012,54 @@ public:
char mb[maxmb+1];
int nmb=0;
- while (*cursor && *cursor!=' ')
- cursor++;
- while (*cursor && *cursor!=esc)
- cursor++;
- byte = getByte(cursor);
-
- if ( *cursor == esc ) {
- if ( !to_unicode_multibyte ) {
- to_unicode_multibyte = new QMultiByteUnicodeTable[256];
- for (int i=0; i<256; i++) {
- to_unicode_multibyte[i].unicode = to_unicode[i];
- to_unicode_multibyte[i].multibyte = 0;
- }
- delete [] to_unicode;
- to_unicode = 0;
- }
- QMultiByteUnicodeTable* mbut = to_unicode_multibyte+byte;
- mb[nmb++] = byte;
- while ( nmb < maxmb && *cursor == esc ) {
- // Always at least once
+ while (*cursor) {
+ if (cursor[0]=='<' && cursor[1]=='U' &&
+ cursor[2]>='0' && cursor[2]<='9' &&
+ cursor[3]>='0' && cursor[3]<='9') {
+
+ unicode = strtol(cursor+2,&cursor,16);
+
+ } else if (*cursor==esc) {
- mbut->unicode = CHAINED;
byte = getByte(cursor);
- mb[nmb++] = byte;
- if (!mbut->multibyte) {
- mbut->multibyte =
- new QMultiByteUnicodeTable[256];
+
+ if ( *cursor == esc ) {
+ if ( !to_unicode_multibyte ) {
+ to_unicode_multibyte =
+ new QMultiByteUnicodeTable[256];
+ for (int i=0; i<256; i++) {
+ to_unicode_multibyte[i].unicode =
+ to_unicode[i];
+ to_unicode_multibyte[i].multibyte = 0;
+ }
+ delete [] to_unicode;
+ to_unicode = 0;
+ }
+ QMultiByteUnicodeTable* mbut =
+ to_unicode_multibyte+byte;
+ mb[nmb++] = byte;
+ while ( nmb < maxmb && *cursor == esc ) {
+ // Always at least once
+
+ mbut->unicode = CHAINED;
+ byte = getByte(cursor);
+ mb[nmb++] = byte;
+ if (!mbut->multibyte) {
+ mbut->multibyte =
+ new QMultiByteUnicodeTable[256];
+ }
+ mbut = mbut->multibyte+byte;
+ mb_unicode = & mbut->unicode;
+ }
+
+ if ( nmb > max_bytes_per_char )
+ max_bytes_per_char = nmb;
}
- mbut = mbut->multibyte+byte;
- mb_unicode = & mbut->unicode;
+ } else {
+ cursor++;
}
-
- if ( nmb > max_bytes_per_char )
- max_bytes_per_char = nmb;
}
- while (*cursor && (*cursor!='<' || cursor[1]!='U'))
- cursor++;
- if ( *cursor )
- unicode = strtol(cursor+2,&cursor,16);
+
if (unicode >= 0 && unicode <= 0xffff)
{
QChar ch((ushort)unicode);
diff --git a/qtools/qxml.cpp b/qtools/qxml.cpp
index d171828..11a9b01 100644
--- a/qtools/qxml.cpp
+++ b/qtools/qxml.cpp
@@ -35,6 +35,7 @@
**
**********************************************************************/
+#define QT_XML_CPP
#include "qxml.h"
#include "qtextcodec.h"
#include "qbuffer.h"
@@ -80,7 +81,7 @@
#define XMLERR_EDECLORSDDECLEXPECTED "EDecl or SDDecl expected while reading the XML declaration"
#define XMLERR_SDDECLEXPECTED "SDDecl expected while reading the XML declaration"
#define XMLERR_WRONGVALUEFORSDECL "wrong value for standalone declaration"
-#define XMLERR_UNPARSEDENTITYREFERENCE "unparsed entity reference"
+#define XMLERR_UNPARSEDENTITYREFERENCE "unparsed entity reference in wrong context"
#define XMLERR_INTERNALGENERALENTITYINDTD "internal general entity reference not allowed in DTD"
#define XMLERR_EXTERNALGENERALENTITYINDTD "external parsed general entity reference not allowed in DTD"
#define XMLERR_EXTERNALGENERALENTITYINAV "external parsed general entity reference not allowed in attribute value"
@@ -2733,13 +2734,14 @@ bool QXmlSimpleReader::parseContent()
next();
break;
case Ref:
- // reference may be CharData; so clear string to be safe
if ( !charDataRead) {
- charDataRead = TRUE;
+ // reference may be CharData; so clear string to be safe
stringClear();
+ parseOk = parseReference( charDataRead, InContent );
+ } else {
+ bool tmp;
+ parseOk = parseReference( tmp, InContent );
}
- // parse reference
- parseOk = parseReference( charDataRead, InContent );
break;
case Lt:
// call the handler for CharData
@@ -2977,6 +2979,12 @@ bool QXmlSimpleReader::parseMisc()
d->error = XMLERR_ERRORPARSINGPI;
goto parseError;
}
+ if ( contentHnd ) {
+ if ( !contentHnd->processingInstruction(name(),string()) ) {
+ d->error = contentHnd->errorString();
+ goto parseError;
+ }
+ }
return TRUE;
case Comment2:
if ( !parseOk ) {
@@ -3241,8 +3249,8 @@ parseError:
bool QXmlSimpleReader::parseDoctype()
{
// some init-stuff
- d->systemId = "";
- d->publicId = "";
+ d->systemId = QString::null;
+ d->publicId = QString::null;
const signed char Init = 0;
const signed char Doctype = 1; // read the doctype
@@ -3420,8 +3428,8 @@ parseError:
bool QXmlSimpleReader::parseExternalID( bool allowPublicID )
{
// some init-stuff
- d->systemId = "";
- d->publicId = "";
+ d->systemId = QString::null;
+ d->publicId = QString::null;
const signed char Init = 0;
const signed char Sys = 1; // parse 'SYSTEM'
@@ -3687,6 +3695,12 @@ bool QXmlSimpleReader::parseMarkupdecl()
d->error = XMLERR_ERRORPARSINGPI;
goto parseError;
}
+ if ( contentHnd ) {
+ if ( !contentHnd->processingInstruction(name(),string()) ) {
+ d->error = contentHnd->errorString();
+ goto parseError;
+ }
+ }
return TRUE;
case Dash:
if ( !parseOk ) {
@@ -3812,13 +3826,13 @@ bool QXmlSimpleReader::parsePEReference( EntityRecognitionContext context )
}
}
} else {
- if ( context == InEntityValue ) {
+ if ( context == InEntityValue ) {
// Included in literal
xmlRef = d->parameterEntities.find( ref() )
.data().replace( QRegExp("\""), "&quot;" ).replace( QRegExp("'"), "&apos;" )
+ xmlRef;
} else if ( context == InDTD ) {
- // Included as PE ### correct???
+ // Included as PE
xmlRef = QString(" ") +
d->parameterEntities.find( ref() ).data() +
QString(" ") + xmlRef;
@@ -4896,6 +4910,7 @@ bool QXmlSimpleReader::parseEntityDecl()
const signed char PEVal = 15; // parse entity value
const signed char PEEID = 16; // parse ExternalID
const signed char WsE = 17; // white space read
+ const signed char EDDone = 19; // done, but also report an external, unparsed entity decl
const signed char Done = 18;
const signed char InpWs = 0; // white space
@@ -4914,8 +4929,8 @@ bool QXmlSimpleReader::parseEntityDecl()
{ Ws2, -1, -1, -1, -1, -1 }, // Name
{ -1, -1, EValue, -1, -1, ExtID }, // Ws2
{ WsE, -1, -1, Done, -1, -1 }, // EValue
- { Ws3, -1, -1, Done, -1, -1 }, // ExtID
- { -1, -1, -1, Done, Ndata, -1 }, // Ws3
+ { Ws3, -1, -1, EDDone,-1, -1 }, // ExtID
+ { -1, -1, -1, EDDone,Ndata, -1 }, // Ws3
{ Ws4, -1, -1, -1, -1, -1 }, // Ndata
{ -1, -1, -1, -1, NNam, NNam }, // Ws4
{ WsE, -1, -1, Done, -1, -1 }, // NNam
@@ -5008,6 +5023,9 @@ bool QXmlSimpleReader::parseEntityDecl()
case WsE:
eat_ws();
break;
+ case EDDone:
+ next();
+ break;
case Done:
next();
break;
@@ -5031,8 +5049,7 @@ bool QXmlSimpleReader::parseEntityDecl()
d->error = XMLERR_ERRORPARSINGENTITYVALUE;
goto parseError;
}
- if ( d->entities.find( name() ) == d->entities.end() &&
- d->externEntities.find( name() ) == d->externEntities.end() ) {
+ if ( !entityExist( name() ) ) {
d->entities.insert( name(), string() );
if ( declHnd ) {
if ( !declHnd->internalEntityDecl( name(), string() ) ) {
@@ -5047,16 +5064,6 @@ bool QXmlSimpleReader::parseEntityDecl()
d->error = XMLERR_ERRORPARSINGEXTERNALID;
goto parseError;
}
- if ( d->entities.find( name() ) == d->entities.end() &&
- d->externEntities.find( name() ) == d->externEntities.end() ) {
- d->externEntities.insert( name(), QXmlSimpleReaderPrivate::ExternEntity( d->publicId, d->systemId, "" ) );
- if ( declHnd ) {
- if ( !declHnd->externalEntityDecl( name(), d->publicId, d->systemId ) ) {
- d->error = declHnd->errorString();
- goto parseError;
- }
- }
- }
break;
case Ndata:
if ( !parseOk ) {
@@ -5069,11 +5076,10 @@ bool QXmlSimpleReader::parseEntityDecl()
d->error = XMLERR_ERRORPARSINGNAME;
goto parseError;
}
- if ( d->entities.find( name() ) == d->entities.end() &&
- d->externEntities.find( name() ) == d->externEntities.end() ) {
+ if ( !entityExist( name() ) ) {
d->externEntities.insert( name(), QXmlSimpleReaderPrivate::ExternEntity( d->publicId, d->systemId, ref() ) );
- if ( declHnd ) {
- if ( !declHnd->externalEntityDecl( name(), d->publicId, d->systemId ) ) {
+ if ( dtdHnd ) {
+ if ( !dtdHnd->unparsedEntityDecl( name(), d->publicId, d->systemId, ref() ) ) {
d->error = declHnd->errorString();
goto parseError;
}
@@ -5091,8 +5097,7 @@ bool QXmlSimpleReader::parseEntityDecl()
d->error = XMLERR_ERRORPARSINGENTITYVALUE;
goto parseError;
}
- if ( d->parameterEntities.find( name() ) == d->parameterEntities.end() &&
- d->externParameterEntities.find( name() ) == d->externParameterEntities.end() ) {
+ if ( !entityExist( name() ) ) {
d->parameterEntities.insert( name(), string() );
if ( declHnd ) {
if ( !declHnd->internalEntityDecl( QString("%")+name(), string() ) ) {
@@ -5107,8 +5112,7 @@ bool QXmlSimpleReader::parseEntityDecl()
d->error = XMLERR_ERRORPARSINGEXTERNALID;
goto parseError;
}
- if ( d->parameterEntities.find( name() ) == d->parameterEntities.end() &&
- d->externParameterEntities.find( name() ) == d->externParameterEntities.end() ) {
+ if ( !entityExist( name() ) ) {
d->externParameterEntities.insert( name(), QXmlSimpleReaderPrivate::ExternParameterEntity( d->publicId, d->systemId ) );
if ( declHnd ) {
if ( !declHnd->externalEntityDecl( QString("%")+name(), d->publicId, d->systemId ) ) {
@@ -5118,6 +5122,17 @@ bool QXmlSimpleReader::parseEntityDecl()
}
}
break;
+ case EDDone:
+ if ( !entityExist( name() ) ) {
+ d->externEntities.insert( name(), QXmlSimpleReaderPrivate::ExternEntity( d->publicId, d->systemId, QString::null ) );
+ if ( declHnd ) {
+ if ( !declHnd->externalEntityDecl( name(), d->publicId, d->systemId ) ) {
+ d->error = declHnd->errorString();
+ goto parseError;
+ }
+ }
+ }
+ return TRUE;
case Done:
return TRUE;
case -1:
@@ -5741,154 +5756,8 @@ bool QXmlSimpleReader::parseReference( bool &charDataRead, EntityRecognitionCont
next();
break;
case DoneN:
- if ( ref() == "amp" ) {
- if ( context == InEntityValue ) {
- // Bypassed
- stringAddC( '&' ); stringAddC( 'a' ); stringAddC( 'm' ); stringAddC( 'p' ); stringAddC( ';' );
- } else {
- // Included or Included in literal
- stringAddC( '&' );
- }
- charDataRead = TRUE;
- } else if ( ref() == "lt" ) {
- if ( context == InEntityValue ) {
- // Bypassed
- stringAddC( '&' ); stringAddC( 'l' ); stringAddC( 't' ); stringAddC( ';' );
- } else {
- // Included or Included in literal
- stringAddC( '<' );
- }
- charDataRead = TRUE;
- } else if ( ref() == "gt" ) {
- if ( context == InEntityValue ) {
- // Bypassed
- stringAddC( '&' ); stringAddC( 'g' ); stringAddC( 't' ); stringAddC( ';' );
- } else {
- // Included or Included in literal
- stringAddC( '>' );
- }
- charDataRead = TRUE;
- } else if ( ref() == "apos" ) {
- if ( context == InEntityValue ) {
- // Bypassed
- stringAddC( '&' ); stringAddC( 'a' ); stringAddC( 'p' ); stringAddC( 'o' ); stringAddC( 's' ); stringAddC( ';' );
- } else {
- // Included or Included in literal
- stringAddC( '\'' );
- }
- charDataRead = TRUE;
- } else if ( ref() == "quot" ) {
- if ( context == InEntityValue ) {
- // Bypassed
- stringAddC( '&' ); stringAddC( 'q' ); stringAddC( 'u' ); stringAddC( 'o' ); stringAddC( 't' ); stringAddC( ';' );
- } else {
- // Included or Included in literal
- stringAddC( '"' );
- }
- charDataRead = TRUE;
- } else {
- QMap<QString,QString>::Iterator it;
- it = d->entities.find( ref() );
- if ( it != d->entities.end() ) {
- // "Internal General"
- switch ( context ) {
- case InContent:
- // Included
- xmlRef = it.data() + xmlRef;
- charDataRead = FALSE;
- break;
- case InAttributeValue:
- // Included in literal
- xmlRef = it.data().replace( QRegExp("\""), "&quot;" ).replace( QRegExp("'"), "&apos;" )
- + xmlRef;
- charDataRead = FALSE;
- break;
- case InEntityValue:
- {
- // Bypassed
- stringAddC( '&' );
- for ( int i=0; i<(int)ref().length(); i++ ) {
- stringAddC( ref()[i] );
- }
- stringAddC( ';');
- charDataRead = TRUE;
- }
- break;
- case InDTD:
- // Forbidden
- d->error = XMLERR_INTERNALGENERALENTITYINDTD;
- charDataRead = FALSE;
- break;
- }
- } else {
- QMap<QString,QXmlSimpleReaderPrivate::ExternEntity>::Iterator itExtern;
- itExtern = d->externEntities.find( ref() );
- if ( itExtern != d->externEntities.end() ) {
- // "External Parsed General"
- switch ( context ) {
- case InContent:
- // Included if validating
- if ( contentHnd ) {
- if ( !contentHnd->skippedEntity( ref() ) ) {
- d->error = contentHnd->errorString();
- goto parseError;
- }
- }
- charDataRead = FALSE;
- break;
- case InAttributeValue:
- // Forbidden
- d->error = XMLERR_EXTERNALGENERALENTITYINAV;
- charDataRead = FALSE;
- break;
- case InEntityValue:
- {
- // Bypassed
- stringAddC( '&' );
- for ( int i=0; i<(int)ref().length(); i++ ) {
- stringAddC( ref()[i] );
- }
- stringAddC( ';');
- charDataRead = TRUE;
- }
- break;
- case InDTD:
- // Forbidden
- d->error = XMLERR_EXTERNALGENERALENTITYINDTD;
- charDataRead = FALSE;
- break;
- }
- } else {
- // "Unparsed" ### or is the definition of unparsed entities different?
- if ( context == InEntityValue ) {
- // Bypassed
- // (this does not conform with the table 4.4 of the XML specification;
- // on the other hand: in this case it is not really an unparsed entity)
- stringAddC( '&' );
- for ( int i=0; i<(int)ref().length(); i++ ) {
- stringAddC( ref()[i] );
- }
- stringAddC( ';');
- charDataRead = TRUE;
- } else {
-#if 0
- // Forbidden
- d->error = XMLERR_UNPARSEDENTITYREFERENCE;
- goto parseError;
- charDataRead = FALSE;
-#else
- // ### skip it???
- if ( contentHnd ) {
- if ( !contentHnd->skippedEntity( ref() ) ) {
- d->error = contentHnd->errorString();
- goto parseError;
- }
- }
-#endif
- }
- }
- }
- }
+ if ( !processReference( charDataRead, context ) )
+ goto parseError;
next();
break;
}
@@ -5916,6 +5785,162 @@ parseError:
}
/*!
+ Helper function for parseReference()
+*/
+bool QXmlSimpleReader::processReference( bool &charDataRead, EntityRecognitionContext context )
+{
+ QString reference = ref();
+ if ( reference == "amp" ) {
+ if ( context == InEntityValue ) {
+ // Bypassed
+ stringAddC( '&' ); stringAddC( 'a' ); stringAddC( 'm' ); stringAddC( 'p' ); stringAddC( ';' );
+ } else {
+ // Included or Included in literal
+ stringAddC( '&' );
+ }
+ charDataRead = TRUE;
+ } else if ( reference == "lt" ) {
+ if ( context == InEntityValue ) {
+ // Bypassed
+ stringAddC( '&' ); stringAddC( 'l' ); stringAddC( 't' ); stringAddC( ';' );
+ } else {
+ // Included or Included in literal
+ stringAddC( '<' );
+ }
+ charDataRead = TRUE;
+ } else if ( reference == "gt" ) {
+ if ( context == InEntityValue ) {
+ // Bypassed
+ stringAddC( '&' ); stringAddC( 'g' ); stringAddC( 't' ); stringAddC( ';' );
+ } else {
+ // Included or Included in literal
+ stringAddC( '>' );
+ }
+ charDataRead = TRUE;
+ } else if ( reference == "apos" ) {
+ if ( context == InEntityValue ) {
+ // Bypassed
+ stringAddC( '&' ); stringAddC( 'a' ); stringAddC( 'p' ); stringAddC( 'o' ); stringAddC( 's' ); stringAddC( ';' );
+ } else {
+ // Included or Included in literal
+ stringAddC( '\'' );
+ }
+ charDataRead = TRUE;
+ } else if ( reference == "quot" ) {
+ if ( context == InEntityValue ) {
+ // Bypassed
+ stringAddC( '&' ); stringAddC( 'q' ); stringAddC( 'u' ); stringAddC( 'o' ); stringAddC( 't' ); stringAddC( ';' );
+ } else {
+ // Included or Included in literal
+ stringAddC( '"' );
+ }
+ charDataRead = TRUE;
+ } else {
+ QMap<QString,QString>::Iterator it;
+ it = d->entities.find( reference );
+ if ( it != d->entities.end() ) {
+ // "Internal General"
+ switch ( context ) {
+ case InContent:
+ // Included
+ xmlRef = it.data() + xmlRef;
+ charDataRead = FALSE;
+ break;
+ case InAttributeValue:
+ // Included in literal
+ xmlRef = it.data().replace( QRegExp("\""), "&quot;" ).replace( QRegExp("'"), "&apos;" )
+ + xmlRef;
+ charDataRead = FALSE;
+ break;
+ case InEntityValue:
+ {
+ // Bypassed
+ stringAddC( '&' );
+ for ( int i=0; i<(int)reference.length(); i++ ) {
+ stringAddC( reference[i] );
+ }
+ stringAddC( ';');
+ charDataRead = TRUE;
+ }
+ break;
+ case InDTD:
+ // Forbidden
+ d->error = XMLERR_INTERNALGENERALENTITYINDTD;
+ charDataRead = FALSE;
+ break;
+ }
+ } else {
+ QMap<QString,QXmlSimpleReaderPrivate::ExternEntity>::Iterator itExtern;
+ itExtern = d->externEntities.find( reference );
+ if ( itExtern == d->externEntities.end() ) {
+ // entity not declared
+ // ### check this case for conformance
+ if ( context == InEntityValue ) {
+ // Bypassed
+ stringAddC( '&' );
+ for ( int i=0; i<(int)reference.length(); i++ ) {
+ stringAddC( reference[i] );
+ }
+ stringAddC( ';');
+ charDataRead = TRUE;
+ } else {
+ if ( contentHnd ) {
+ if ( !contentHnd->skippedEntity( reference ) ) {
+ d->error = contentHnd->errorString();
+ return FALSE; // error
+ }
+ }
+ }
+ } else if ( (*itExtern).notation.isNull() ) {
+ // "External Parsed General"
+ switch ( context ) {
+ case InContent:
+ // Included if validating
+ if ( contentHnd ) {
+ if ( !contentHnd->skippedEntity( reference ) ) {
+ d->error = contentHnd->errorString();
+ return FALSE; // error
+ }
+ }
+ charDataRead = FALSE;
+ break;
+ case InAttributeValue:
+ // Forbidden
+ d->error = XMLERR_EXTERNALGENERALENTITYINAV;
+ charDataRead = FALSE;
+ break;
+ case InEntityValue:
+ {
+ // Bypassed
+ stringAddC( '&' );
+ for ( int i=0; i<(int)reference.length(); i++ ) {
+ stringAddC( reference[i] );
+ }
+ stringAddC( ';');
+ charDataRead = TRUE;
+ }
+ break;
+ case InDTD:
+ // Forbidden
+ d->error = XMLERR_EXTERNALGENERALENTITYINDTD;
+ charDataRead = FALSE;
+ break;
+ }
+ } else {
+ // "Unparsed"
+ // ### notify for "Occurs as Attribute Value" missing (but this is no refence, anyway)
+ // Forbidden
+ d->error = XMLERR_UNPARSEDENTITYREFERENCE;
+ charDataRead = FALSE;
+ return FALSE; // error
+ }
+ }
+ }
+ return TRUE; // no error
+}
+
+
+/*!
Parse over a simple string.
After the string was successfully parsed, the head is on the first
@@ -5970,8 +5995,8 @@ parseError:
}
-/*
- Init the data values.
+/*!
+ Inits the data values.
*/
void QXmlSimpleReader::init( const QXmlInputSource& i )
{
@@ -5998,6 +6023,20 @@ void QXmlSimpleReader::init( const QXmlInputSource& i )
d->error = XMLERR_OK;
}
+/*!
+ Returns TRUE if a entity with the name \a e exists,
+ otherwise returns FALSE.
+*/
+bool QXmlSimpleReader::entityExist( const QString& e ) const
+{
+ if ( d->parameterEntities.find(e) == d->parameterEntities.end() &&
+ d->externParameterEntities.find(e) == d->externParameterEntities.end() ) {
+ return FALSE;
+ } else {
+ return TRUE;
+ }
+}
+
void QXmlSimpleReader::reportParseError()
{
if ( errorHnd )
diff --git a/qtools/qxml.h b/qtools/qxml.h
index c23430c..ce40e5f 100644
--- a/qtools/qxml.h
+++ b/qtools/qxml.h
@@ -322,7 +322,7 @@ private:
// used by parseReference() and parsePEReference()
enum EntityRecognitionContext { InContent, InAttributeValue, InEntityValue, InDTD };
- // private methods
+ // private functions
void eat_ws();
void next_eat_ws();
@@ -331,6 +331,8 @@ private:
void init( const QXmlInputSource& i );
+ bool entityExist( const QString& ) const;
+
bool parseProlog();
bool parseElement();
bool parseElementEmptyTag( bool &t, QString &uri, QString &lname );
@@ -347,6 +349,7 @@ private:
bool parseNmtoken();
bool parseAttribute();
bool parseReference( bool &charDataRead, EntityRecognitionContext context );
+ bool processReference( bool &charDataRead, EntityRecognitionContext context );
bool parseExternalID( bool allowPublicID = FALSE );
bool parsePEReference( EntityRecognitionContext context );
@@ -504,7 +507,15 @@ private:
QXmlDefaultHandlerPrivate *d;
};
+#ifdef _WS_QWS_
+#ifdef QT_XML_CPP
+#define inline
+#else
+#define QT_NO_XML_INLINE
+#endif
+#endif
+#ifndef QT_NO_XML_INLINE
//
// inlines
//
@@ -640,6 +651,14 @@ inline void QXmlSimpleReader::refAddC(const QChar& ch)
}
refArray[refPos++] = ch;
}
+#endif
+
+#ifdef _WS_QWS_
+#ifdef QT_XML_CPP
+#undef inline
+#endif
+#endif
+
#endif //QT_NO_XML
#endif