diff --git a/src/corelib/xml/qxmlstream.h b/src/corelib/xml/qxmlstream.h index 402afa3..7989530 100644 --- a/src/corelib/xml/qxmlstream.h +++ b/src/corelib/xml/qxmlstream.h @@ -4,7 +4,7 @@ ** All rights reserved. ** Contact: Nokia Corporation (qt-info@nokia.com) ** -** This file is part of the QtCore module of the Qt Toolkit. +** This file is part of the QtXml module of the Qt Toolkit. ** ** $QT_BEGIN_LICENSE:LGPL$ ** No Commercial Usage @@ -39,450 +39,35 @@ ** ****************************************************************************/ -#ifndef QXMLSTREAM_H -#define QXMLSTREAM_H +#ifndef OLD_QXMLSTREAM_H +#define OLD_QXMLSTREAM_H -#include - -#ifndef QT_NO_XMLSTREAM - -#include -#include -#include +#include QT_BEGIN_HEADER QT_BEGIN_NAMESPACE -QT_MODULE(Core) - -// QXmlStream* was originally in the QtXml module -// since we've moved it to QtCore in Qt 4.4.0, we need to -// keep binary compatibility -// -// The list of supported platforms is in: -// http://qt.nokia.com/doc/supported_platforms.html -// -// These platforms do not support symbol moving nor duplication -// (because duplicate symbols cause warnings when linking): -// Apple MacOS X (Mach-O executable format) -// special case: 64-bit on Mac wasn't supported before 4.5.0 -// IBM AIX (XCOFF executable format) -// -// These platforms do not support symbol moving but allow it to be duplicated: -// Microsoft Windows (COFF PE executable format) -// special case: Windows CE wasn't supported before 4.4.0 -// -// These platforms support symbol moving: -// HP HP-UX (PA-RISC2.0 shared executables) -// HP HP-UXi (ELF executable format) -// FreeBSD (ELF executable format) -// Linux (ELF executable format) -// SGI IRIX (ELF executable format) -// Sun Solaris (ELF executable format) -// -// Other platforms are supported through community contributions only. -// We are taking the optimist scenario here to avoid creating more -// symbols to be supported. - -#if defined(Q_OS_MAC32) || defined(Q_OS_AIX) -# if !defined QT_BUILD_XML_LIB -# define Q_XMLSTREAM_RENAME_SYMBOLS -# endif -#endif - -#if defined QT_BUILD_XML_LIB -# define Q_XMLSTREAM_EXPORT Q_XML_EXPORT -#else -# define Q_XMLSTREAM_EXPORT Q_CORE_EXPORT -#endif - -#if defined Q_XMLSTREAM_RENAME_SYMBOLS -// don't worry, we'll undef and change to typedef at the bottom of the file -# define QXmlStreamAttribute QCoreXmlStreamAttribute -# define QXmlStreamAttributes QCoreXmlStreamAttributes -# define QXmlStreamEntityDeclaration QCoreXmlStreamEntityDeclaration -# define QXmlStreamEntityDeclarations QCoreXmlStreamEntityDeclarations -# define QXmlStreamEntityResolver QCoreXmlStreamEntityResolver -# define QXmlStreamNamespaceDeclaration QCoreXmlStreamNamespaceDeclaration -# define QXmlStreamNamespaceDeclarations QCoreXmlStreamNamespaceDeclarations -# define QXmlStreamNotationDeclaration QCoreXmlStreamNotationDeclaration -# define QXmlStreamNotationDeclarations QCoreXmlStreamNotationDeclarations -# define QXmlStreamReader QCoreXmlStreamReader -# define QXmlStreamStringRef QCoreXmlStreamStringRef -# define QXmlStreamWriter QCoreXmlStreamWriter -#endif - -class Q_XMLSTREAM_EXPORT QXmlStreamStringRef { - QString m_string; - int m_position, m_size; -public: - inline QXmlStreamStringRef():m_position(0), m_size(0){} - inline QXmlStreamStringRef(const QStringRef &aString) - :m_string(aString.string()?*aString.string():QString()), m_position(aString.position()), m_size(aString.size()){} - inline QXmlStreamStringRef(const QString &aString):m_string(aString), m_position(0), m_size(aString.size()){} - inline ~QXmlStreamStringRef(){} - inline void clear() { m_string.clear(); m_position = m_size = 0; } - inline operator QStringRef() const { return QStringRef(&m_string, m_position, m_size); } - inline const QString *string() const { return &m_string; } - inline int position() const { return m_position; } - inline int size() const { return m_size; } -}; - - -class QXmlStreamReaderPrivate; -class QXmlStreamAttributes; -class Q_XMLSTREAM_EXPORT QXmlStreamAttribute { - QXmlStreamStringRef m_name, m_namespaceUri, m_qualifiedName, m_value; - void *reserved; - uint m_isDefault : 1; - friend class QXmlStreamReaderPrivate; - friend class QXmlStreamAttributes; -public: - QXmlStreamAttribute(); - QXmlStreamAttribute(const QString &qualifiedName, const QString &value); - QXmlStreamAttribute(const QString &namespaceUri, const QString &name, const QString &value); - QXmlStreamAttribute(const QXmlStreamAttribute &); - QXmlStreamAttribute& operator=(const QXmlStreamAttribute &); - ~QXmlStreamAttribute(); - inline QStringRef namespaceUri() const { return m_namespaceUri; } - inline QStringRef name() const { return m_name; } - inline QStringRef qualifiedName() const { return m_qualifiedName; } - inline QStringRef prefix() const { - return QStringRef(m_qualifiedName.string(), - m_qualifiedName.position(), - qMax(0, m_qualifiedName.size() - m_name.size() - 1)); - } - inline QStringRef value() const { return m_value; } - inline bool isDefault() const { return m_isDefault; } - inline bool operator==(const QXmlStreamAttribute &other) const { - return (value() == other.value() - && (namespaceUri().isNull() ? (qualifiedName() == other.qualifiedName()) - : (namespaceUri() == other.namespaceUri() && name() == other.name()))); - } - inline bool operator!=(const QXmlStreamAttribute &other) const - { return !operator==(other); } -}; - -Q_DECLARE_TYPEINFO(QXmlStreamAttribute, Q_MOVABLE_TYPE); - -class Q_XMLSTREAM_EXPORT QXmlStreamAttributes : public QVector -{ -public: - QStringRef value(const QString &namespaceUri, const QString &name) const; - QStringRef value(const QString &namespaceUri, const QLatin1String &name) const; - QStringRef value(const QLatin1String &namespaceUri, const QLatin1String &name) const; - QStringRef value(const QString &qualifiedName) const; - QStringRef value(const QLatin1String &qualifiedName) const; - void append(const QString &namespaceUri, const QString &name, const QString &value); - void append(const QString &qualifiedName, const QString &value); - - inline bool hasAttribute(const QString &qualifiedName) const - { - return !value(qualifiedName).isNull(); - } - - inline bool hasAttribute(const QLatin1String &qualifiedName) const - { - return !value(qualifiedName).isNull(); - } - - inline bool hasAttribute(const QString &namespaceUri, const QString &name) const - { - return !value(namespaceUri, name).isNull(); - } - -#if !defined(Q_NO_USING_KEYWORD) - using QVector::append; -#else - inline void append(const QXmlStreamAttribute &attribute) - { QVector::append(attribute); } -#endif -}; - -class Q_XMLSTREAM_EXPORT QXmlStreamNamespaceDeclaration { - QXmlStreamStringRef m_prefix, m_namespaceUri; - void *reserved; - - friend class QXmlStreamReaderPrivate; -public: - QXmlStreamNamespaceDeclaration(); - QXmlStreamNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &); - QXmlStreamNamespaceDeclaration(const QString &prefix, const QString &namespaceUri); - ~QXmlStreamNamespaceDeclaration(); - QXmlStreamNamespaceDeclaration& operator=(const QXmlStreamNamespaceDeclaration &); - inline QStringRef prefix() const { return m_prefix; } - inline QStringRef namespaceUri() const { return m_namespaceUri; } - inline bool operator==(const QXmlStreamNamespaceDeclaration &other) const { - return (prefix() == other.prefix() && namespaceUri() == other.namespaceUri()); - } - inline bool operator!=(const QXmlStreamNamespaceDeclaration &other) const - { return !operator==(other); } -}; - -Q_DECLARE_TYPEINFO(QXmlStreamNamespaceDeclaration, Q_MOVABLE_TYPE); -typedef QVector QXmlStreamNamespaceDeclarations; - -class Q_XMLSTREAM_EXPORT QXmlStreamNotationDeclaration { - QXmlStreamStringRef m_name, m_systemId, m_publicId; - void *reserved; - - friend class QXmlStreamReaderPrivate; -public: - QXmlStreamNotationDeclaration(); - ~QXmlStreamNotationDeclaration(); - QXmlStreamNotationDeclaration(const QXmlStreamNotationDeclaration &); - QXmlStreamNotationDeclaration& operator=(const QXmlStreamNotationDeclaration &); - inline QStringRef name() const { return m_name; } - inline QStringRef systemId() const { return m_systemId; } - inline QStringRef publicId() const { return m_publicId; } - inline bool operator==(const QXmlStreamNotationDeclaration &other) const { - return (name() == other.name() && systemId() == other.systemId() - && publicId() == other.publicId()); - } - inline bool operator!=(const QXmlStreamNotationDeclaration &other) const - { return !operator==(other); } -}; - -Q_DECLARE_TYPEINFO(QXmlStreamNotationDeclaration, Q_MOVABLE_TYPE); -typedef QVector QXmlStreamNotationDeclarations; - -class Q_XMLSTREAM_EXPORT QXmlStreamEntityDeclaration { - QXmlStreamStringRef m_name, m_notationName, m_systemId, m_publicId, m_value; - void *reserved; - - friend class QXmlStreamReaderPrivate; -public: - QXmlStreamEntityDeclaration(); - ~QXmlStreamEntityDeclaration(); - QXmlStreamEntityDeclaration(const QXmlStreamEntityDeclaration &); - QXmlStreamEntityDeclaration& operator=(const QXmlStreamEntityDeclaration &); - inline QStringRef name() const { return m_name; } - inline QStringRef notationName() const { return m_notationName; } - inline QStringRef systemId() const { return m_systemId; } - inline QStringRef publicId() const { return m_publicId; } - inline QStringRef value() const { return m_value; } - inline bool operator==(const QXmlStreamEntityDeclaration &other) const { - return (name() == other.name() - && notationName() == other.notationName() - && systemId() == other.systemId() - && publicId() == other.publicId() - && value() == other.value()); - } - inline bool operator!=(const QXmlStreamEntityDeclaration &other) const - { return !operator==(other); } -}; - -Q_DECLARE_TYPEINFO(QXmlStreamEntityDeclaration, Q_MOVABLE_TYPE); -typedef QVector QXmlStreamEntityDeclarations; - - -class Q_XMLSTREAM_EXPORT QXmlStreamEntityResolver -{ -public: - virtual ~QXmlStreamEntityResolver(); - virtual QString resolveEntity(const QString& publicId, const QString& systemId); - virtual QString resolveUndeclaredEntity(const QString &name); -}; - -#ifndef QT_NO_XMLSTREAMREADER -class Q_XMLSTREAM_EXPORT QXmlStreamReader { - QDOC_PROPERTY(bool namespaceProcessing READ namespaceProcessing WRITE setNamespaceProcessing) -public: - enum TokenType { - NoToken = 0, - Invalid, - StartDocument, - EndDocument, - StartElement, - EndElement, - Characters, - Comment, - DTD, - EntityReference, - ProcessingInstruction - }; - - - QXmlStreamReader(); - QXmlStreamReader(QIODevice *device); - QXmlStreamReader(const QByteArray &data); - QXmlStreamReader(const QString &data); - QXmlStreamReader(const char * data); - ~QXmlStreamReader(); - - void setDevice(QIODevice *device); - QIODevice *device() const; - void addData(const QByteArray &data); - void addData(const QString &data); - void addData(const char *data); - void clear(); - - - bool atEnd() const; - TokenType readNext(); - - bool readNextStartElement(); - void skipCurrentElement(); - - TokenType tokenType() const; - QString tokenString() const; - - void setNamespaceProcessing(bool); - bool namespaceProcessing() const; - - inline bool isStartDocument() const { return tokenType() == StartDocument; } - inline bool isEndDocument() const { return tokenType() == EndDocument; } - inline bool isStartElement() const { return tokenType() == StartElement; } - inline bool isEndElement() const { return tokenType() == EndElement; } - inline bool isCharacters() const { return tokenType() == Characters; } - bool isWhitespace() const; - bool isCDATA() const; - inline bool isComment() const { return tokenType() == Comment; } - inline bool isDTD() const { return tokenType() == DTD; } - inline bool isEntityReference() const { return tokenType() == EntityReference; } - inline bool isProcessingInstruction() const { return tokenType() == ProcessingInstruction; } - - bool isStandaloneDocument() const; - QStringRef documentVersion() const; - QStringRef documentEncoding() const; - - qint64 lineNumber() const; - qint64 columnNumber() const; - qint64 characterOffset() const; - - QXmlStreamAttributes attributes() const; - - enum ReadElementTextBehaviour { - ErrorOnUnexpectedElement, - IncludeChildElements, - SkipChildElements - }; - QString readElementText(ReadElementTextBehaviour behaviour); - QString readElementText(); - - QStringRef name() const; - QStringRef namespaceUri() const; - QStringRef qualifiedName() const; - QStringRef prefix() const; - - QStringRef processingInstructionTarget() const; - QStringRef processingInstructionData() const; - - QStringRef text() const; - - QXmlStreamNamespaceDeclarations namespaceDeclarations() const; - void addExtraNamespaceDeclaration(const QXmlStreamNamespaceDeclaration &extraNamespaceDeclaraction); - void addExtraNamespaceDeclarations(const QXmlStreamNamespaceDeclarations &extraNamespaceDeclaractions); - QXmlStreamNotationDeclarations notationDeclarations() const; - QXmlStreamEntityDeclarations entityDeclarations() const; - QStringRef dtdName() const; - QStringRef dtdPublicId() const; - QStringRef dtdSystemId() const; - - - enum Error { - NoError, - UnexpectedElementError, - CustomError, - NotWellFormedError, - PrematureEndOfDocumentError - }; - void raiseError(const QString& message = QString()); - QString errorString() const; - Error error() const; - - inline bool hasError() const - { - return error() != NoError; - } - - void setEntityResolver(QXmlStreamEntityResolver *resolver); - QXmlStreamEntityResolver *entityResolver() const; - -private: - Q_DISABLE_COPY(QXmlStreamReader) - Q_DECLARE_PRIVATE(QXmlStreamReader) - QScopedPointer d_ptr; - -}; -#endif // QT_NO_XMLSTREAMREADER - -#ifndef QT_NO_XMLSTREAMWRITER - -class QXmlStreamWriterPrivate; - -class Q_XMLSTREAM_EXPORT QXmlStreamWriter -{ - QDOC_PROPERTY(bool autoFormatting READ autoFormatting WRITE setAutoFormatting) - QDOC_PROPERTY(int autoFormattingIndent READ autoFormattingIndent WRITE setAutoFormattingIndent) -public: - QXmlStreamWriter(); - QXmlStreamWriter(QIODevice *device); - QXmlStreamWriter(QByteArray *array); - QXmlStreamWriter(QString *string); - ~QXmlStreamWriter(); - - void setDevice(QIODevice *device); - QIODevice *device() const; - -#ifndef QT_NO_TEXTCODEC - void setCodec(QTextCodec *codec); - void setCodec(const char *codecName); - QTextCodec *codec() const; -#endif - - void setAutoFormatting(bool); - bool autoFormatting() const; - - void setAutoFormattingIndent(int spacesOrTabs); - int autoFormattingIndent() const; - - void writeAttribute(const QString &qualifiedName, const QString &value); - void writeAttribute(const QString &namespaceUri, const QString &name, const QString &value); - void writeAttribute(const QXmlStreamAttribute& attribute); - void writeAttributes(const QXmlStreamAttributes& attributes); - - void writeCDATA(const QString &text); - void writeCharacters(const QString &text); - void writeComment(const QString &text); - - void writeDTD(const QString &dtd); - - void writeEmptyElement(const QString &qualifiedName); - void writeEmptyElement(const QString &namespaceUri, const QString &name); - - void writeTextElement(const QString &qualifiedName, const QString &text); - void writeTextElement(const QString &namespaceUri, const QString &name, const QString &text); - - void writeEndDocument(); - void writeEndElement(); - - void writeEntityReference(const QString &name); - void writeNamespace(const QString &namespaceUri, const QString &prefix = QString()); - void writeDefaultNamespace(const QString &namespaceUri); - void writeProcessingInstruction(const QString &target, const QString &data = QString()); - - void writeStartDocument(); - void writeStartDocument(const QString &version); - void writeStartDocument(const QString &version, bool standalone); - void writeStartElement(const QString &qualifiedName); - void writeStartElement(const QString &namespaceUri, const QString &name); - -#ifndef QT_NO_XMLSTREAMREADER - void writeCurrentToken(const QXmlStreamReader &reader); +QT_MODULE(Xml) + +#if 0 +// make syncqt generate forwarding headers for this file too +#pragma qt_class(QXmlStreamAttribute) +#pragma qt_class(QXmlStreamAttributes) +#pragma qt_class(QXmlStreamEntityDeclaration) +#pragma qt_class(QXmlStreamEntityDeclarations) +#pragma qt_class(QXmlStreamEntityResolver) +#pragma qt_class(QXmlStreamNamespaceDeclaration) +#pragma qt_class(QXmlStreamNamespaceDeclarations) +#pragma qt_class(QXmlStreamNotationDeclaration) +#pragma qt_class(QXmlStreamNotationDeclarations) +#pragma qt_class(QXmlStreamReader) +#pragma qt_class(QXmlStreamStringRef) +#pragma qt_class(QXmlStreamWriter) #endif -private: - Q_DISABLE_COPY(QXmlStreamWriter) - Q_DECLARE_PRIVATE(QXmlStreamWriter) - QScopedPointer d_ptr; -}; -#endif // QT_NO_XMLSTREAMWRITER - QT_END_NAMESPACE QT_END_HEADER -#endif // QT_NO_XMLSTREAM -#endif // QXMLSTREAM_H +#endif // OLD_QXMLSTREAM_H diff --git a/tools/assistant/lib/fulltextsearch/qtokenizer_p.h b/tools/assistant/lib/fulltextsearch/qtokenizer_p.h index 6e61864..38834ef 100644 --- a/tools/assistant/lib/fulltextsearch/qtokenizer_p.h +++ b/tools/assistant/lib/fulltextsearch/qtokenizer_p.h @@ -1,97 +1,216 @@ /**************************************************************************** ** -** Copyright (C) 2003-2006 Ben van Klinken and the CLucene Team. +** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). ** All rights reserved. +** Contact: Nokia Corporation (qt-info@nokia.com) +** +** This file is part of the QtXmlPatterns module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Nokia gives you certain additional +** rights. These rights are described in the Nokia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** ** -** Portion Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies). -** All rights reserved. ** -** This file may be used under the terms of the GNU Lesser General Public -** License version 2.1 as published by the Free Software Foundation and -** appearing in the file LICENSE.LGPL included in the packaging of this file. -** Please review the following information to ensure the GNU Lesser General -** Public License version 2.1 requirements will be met: -** http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** +** +** +** $QT_END_LICENSE$ ** ****************************************************************************/ -#ifndef QTOKENIZER_P_H -#define QTOKENIZER_P_H - // // W A R N I N G // ------------- // -// This file is not part of the Qt API. It exists for the convenience -// of the help generator tools. This header file may change from version -// to version without notice, or even be removed. +// This file is not part of the Qt API. It exists purely as an +// implementation detail. This header file may change from version to +// version without notice, or even be removed. // // We mean it. -// -#include "qtoken_p.h" -#include "qreader_p.h" -#include "qtokenstream_p.h" -#include "qclucene_global_p.h" +#ifndef Patternist_Tokenizer_H +#define Patternist_Tokenizer_H -#include -#include +#include +#include +#include +#include -QT_BEGIN_NAMESPACE +#include "qparsercontext_p.h" +#include "qtokensource_p.h" -class QHELP_EXPORT QCLuceneTokenizer : public QCLuceneTokenStream -{ -public: - QCLuceneTokenizer(const QCLuceneReader &reader); - virtual ~QCLuceneTokenizer(); +/** + * @file + * @short Contains functions and classes used by the parser and tokenizer. + */ - void close(); - bool next(QCLuceneToken &token); +QT_BEGIN_HEADER -protected: - friend class QCLuceneStandardTokenizer; - -private: - QCLuceneTokenizer(); - QCLuceneReader reader; -}; - -class QHELP_EXPORT QCLuceneStandardTokenizer : public QCLuceneTokenizer -{ -public: - QCLuceneStandardTokenizer(const QCLuceneReader &reader); - ~QCLuceneStandardTokenizer(); - - bool readApostrophe(const QString &string, QCLuceneToken &token); - bool readAt(const QString &string, QCLuceneToken &token); - bool readCompany(const QString &string, QCLuceneToken &token); -}; - -class QCLuceneCharTokenizer : public QCLuceneTokenizer -{ - -}; +QT_BEGIN_NAMESPACE -class QCLuceneLetterTokenizer : public QCLuceneCharTokenizer +namespace QPatternist { + typedef QPair AttributeHolder; + typedef QVector AttributeHolderVector; + + class OrderSpecTransfer + { + public: + typedef QList List; + inline OrderSpecTransfer() + { + } + + inline OrderSpecTransfer(const Expression::Ptr &aExpr, + const OrderBy::OrderSpec aOrderSpec) : expression(aExpr), + orderSpec(aOrderSpec) + { + Q_ASSERT(expression); + } + + Expression::Ptr expression; + OrderBy::OrderSpec orderSpec; + }; + + /** + * @short The value the parser, but not the tokenizers, uses for tokens and + * non-terminals. + * + * It is inefficient but ensures nothing leaks, by invoking C++ + * destructors even in the cases the code throws exceptions. This might be + * able to be done in a more efficient way -- suggestions are welcome. + */ + class TokenValue + { + public: + QString sval; + + Expression::Ptr expr; + Expression::List expressionList; + + Cardinality cardinality; + ItemType::Ptr itemType; + SequenceType::Ptr sequenceType; + FunctionArgument::List functionArguments; + FunctionArgument::Ptr functionArgument; + QVector qNameVector; + QXmlName qName; + /** + * Holds enum values. + */ + EnumUnion enums; + + AttributeHolder attributeHolder; + AttributeHolderVector attributeHolders; + OrderSpecTransfer::List orderSpecs; + OrderSpecTransfer orderSpec; + }; +} -}; - -class QCLuceneLowerCaseTokenizer : public QCLuceneLetterTokenizer -{ +QT_END_NAMESPACE -}; +/** + * Macro for the data type of semantic values; int by default. + * See section Data Types of Semantic Values. + */ +#define YYSTYPE QPatternist::TokenValue -class QCLuceneWhitespaceTokenizer : public QCLuceneCharTokenizer -{ +#include "qquerytransformparser_p.h" /* This inclusion must be after TokenValue. */ -}; +QT_BEGIN_NAMESPACE -class QCLuceneKeywordTokenizer : public QCLuceneTokenizer +namespace QPatternist { - -}; + /** + * @short Base class for all tokenizers. + * + * The main entry point is nextToken(), which ones calls to retrieve the stream + * of tokens this Tokenizer delivers. + * + * @see Building a + * Tokenizer for XPath or XQuery + * @author Frans Englich + */ + class Tokenizer : public TokenSource + { + public: + inline Tokenizer(const QUrl &queryU) : m_queryURI(queryU) + { + Q_ASSERT(queryU.isValid()); + } + + typedef QExplicitlySharedDataPointer Ptr; + + /** + * Switches the Tokenizer to only do scanning, and returns complete + * strings for attribute value templates as opposed to the tokens for + * the contained expressions. + * + * The current position in the stream is returned. It can be used to + * later resume regular tokenization. + */ + virtual int commenceScanOnly() = 0; + + /** + * Resumes regular parsing from @p position. The tokenizer must be in + * the scan-only state, which the commenceScanOnly() call transists to. + * + * The tokenizer will return the token POSITION_SET once after this + * function has been called. + */ + virtual void resumeTokenizationFrom(const int position) = 0; + + /** + * @returns the URI of the resource being tokenized. + */ + inline const QUrl &queryURI() const + { + return m_queryURI; + } + + virtual void setParserContext(const ParserContext::Ptr &parseInfo) = 0; + + protected: + /** + * Returns a string representation of @p token. + * + * This function is used for debugging purposes. The implementation of + * this function is in querytransformparser.ypp. + */ + static QString tokenToString(const Token &token); + + private: + Q_DISABLE_COPY(Tokenizer) + const QUrl m_queryURI; + }; + +} + +#undef Patternist_DEBUG_PARSER // disable it for now QT_END_NAMESPACE -#endif // QTOKENIZER_P_H +QT_END_HEADER + +#endif