52 #ifndef Patternist_NamePool_H 53 #define Patternist_NamePool_H 56 #include <QReadLocker> 57 #include <QReadWriteLock> 58 #include <QSharedData> 63 #include <QtXmlPatterns/private/qprimitives_p.h> 102 StandardNamespaceCount = 11,
103 StandardPrefixCount = 9,
104 StandardLocalNameCount = 141
131 DefaultPrefixCapacity = 10,
132 DefaultURICapacity = DefaultPrefixCapacity,
140 DefaultLocalNameCapacity = 60
165 return QXmlName(uri, allocateLocalName(ln));
171 return m_localNames.
at(code);
177 return m_prefixes.
at(code);
183 return m_namespaces.
at(code);
191 Q_ASSERT_X(!qName.
isNull(),
"",
"It makes no sense to call toLexical() on a null name.");
205 return unlockedAllocateNamespace(uri);
211 return unlockedAllocateLocalName(ln);
217 return unlockedAllocatePrefix(prefix);
259 escape(np->displayName(name)) +
478 StopNamespaceInheritance
485 return (m_qNameCode & LocalNameMask) >> LocalNameOffset;
490 return (m_qNameCode & PrefixMask) >> PrefixOffset;
495 return prefix() != 0;
500 return namespaceURI() != 0;
505 return (m_qNameCode & NamespaceMask) >> NamespaceOffset;
510 return (m_qNameCode & LexicalQNameMask) == (other.
m_qNameCode & LexicalQNameMask);
515 m_qNameCode |= (c << PrefixOffset);
520 m_qNameCode |= (c << NamespaceOffset);
525 m_qNameCode |= (c << LocalNameOffset);
535 const PrefixCode p) : m_qNameCode((uri << NamespaceOffset) +
536 (ln << LocalNameOffset) +
const QString & stringForLocalName(const QXmlName::LocalNameCode code) const
QHash< QString, QXmlName::PrefixCode > m_prefixMapping
QString Q_AUTOTEST_EXPORT escape(const QString &input)
Similar to Qt::escape(), but also escapes apostrophes and quotes, such that the result is suitable as...
#define QT_END_NAMESPACE
This macro expands to.
bool hasNamespace() const
Returns true if this QXmlName has a non-empty namespace URI.
NamespaceCode LocalNameCode
QHash< QString, QXmlName::LocalNameCode > m_localNameMapping
void setPrefix(const PrefixCode c)
Store names such as namespace bindings and QNames and allows them to be referenced in efficient ways...
A special value that when passed as the namespace part to NamespaceResolver::addBinding(), undeclares the prefix.
static QString formatKeyword(const NamePool::Ptr &np, const QXmlName name)
Formats QName.
LocalNameCode localName() const
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
#define Q_DISABLE_COPY(Class)
Disables the use of copy constructors and assignment operators for the given Class.
QVector< QString > m_localNames
QXmlName::NamespaceCode allocateNamespace(const QString &uri)
PrefixCode prefix() const
The QString class provides a Unicode character string.
QHash< QString, QXmlName::NamespaceCode > m_namespaceMapping
QString prefix(const QXmlNamePool &query) const
Returns the prefix.
QXmlName::PrefixCode allocatePrefix(const QString &prefix)
const QString & stringForPrefix(const QXmlName::PrefixCode code) const
QXmlName::LocalNameCode allocateLocalName(const QString &ln)
bool hasPrefix() const
Returns true if this QXmlName has a non-empty prefix.
#define QT_BEGIN_NAMESPACE
This macro expands to.
QXmlName allocateQName(const QXmlName::NamespaceCode uri, const QString &ln)
Q_DECLARE_TYPEINFO(QPatternist::NamePool::Ptr, Q_MOVABLE_TYPE)
QExplicitlySharedDataPointer< NamePool > Ptr
The namespace for the internal API of QtXmlPatterns.
QVector< QString > m_namespaces
bool isLexicallyEqual(const QXmlName &other) const
Returns true if this and other are lexically equal.
The QReadLocker class is a convenience class that simplifies locking and unlocking read-write locks f...
The QWriteLocker class is a convenience class that simplifies locking and unlocking read-write locks ...
const T & at(int i) const
Returns the item at index position i in the vector.
QVector< QString > m_prefixes
QString localName(const QXmlNamePool &query) const
Returns the local name.
NamespaceCode namespaceURI() const
#define Q_ASSERT_X(cond, where, what)
QXmlName()
Constructs an uninitialized QXmlName.
The QXmlName class represents the name of an XML node, in an efficient, namespace-aware way...
The QSharedData class is a base class for shared data objects.
void setLocalName(const LocalNameCode c)
The QReadWriteLock class provides read-write locking.
static QString fromLatin1(const char *, int size=-1)
Returns a QString initialized with the first size characters of the Latin-1 string str...
const QString & stringForNamespace(const QXmlName::NamespaceCode code) const
static QReadWriteLock lock
Code code() const
Returns the internal code that contains the id codes for the local name, prefix and namespace URI...
#define Q_AUTOTEST_EXPORT
QString toLexical(const QXmlName qName) const
#define qPrintable(string)
qint64 Code
Stores the QXmlNamePool {name pool} identifiers for the namespace URI, local name, and prefix.
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
void setNamespaceURI(const NamespaceCode c)
bool isNull() const
Returns true if this QXmlName is not initialized with a valid combination of {namespace URI}...