Qt 4.8
|
Store names such as namespace bindings and QNames and allows them to be referenced in efficient ways. More...
#include <qnamepool_p.h>
Public Types | |
typedef QExplicitlySharedDataPointer< NamePool > | Ptr |
Private Types | |
enum | { NoSuchValue = -1, StandardNamespaceCount = 11, StandardPrefixCount = 9, StandardLocalNameCount = 141 } |
enum | DefaultCapacities { DefaultPrefixCapacity = 10, DefaultURICapacity = DefaultPrefixCapacity, DefaultLocalNameCapacity = 60 } |
Private Functions | |
const QString & | displayPrefix (const QXmlName::NamespaceCode nc) const |
QXmlName::LocalNameCode | unlockedAllocateLocalName (const QString &ln) |
QXmlName::NamespaceCode | unlockedAllocateNamespace (const QString &uri) |
QXmlName::PrefixCode | unlockedAllocatePrefix (const QString &prefix) |
Friends | |
class | StandardNamespaces |
Additional Inherited Members | |
Public Variables inherited from QSharedData | |
QAtomicInt | ref |
Store names such as namespace bindings and QNames and allows them to be referenced in efficient ways.
Once a string have been inserted it stays there and cannot be removed. The only way to deallocate any string in the NamePool is to deallocate the NamePool itself, as a whole.
This class is not only reentrant, it is thread-safe in all sense of the word. All functions of this class can be called concurrently. This is achieved by internal locking.
Definition at line 87 of file qnamepool_p.h.
Definition at line 90 of file qnamepool_p.h.
|
private |
Enumerator | |
---|---|
NoSuchValue | |
StandardNamespaceCount | This must be identical to the amount of members in StandardNamespaces. |
StandardPrefixCount | |
StandardLocalNameCount |
Definition at line 95 of file qnamepool_p.h.
|
private |
Enumerator | |
---|---|
DefaultPrefixCapacity | |
DefaultURICapacity | |
DefaultLocalNameCapacity | It looks like it's quite common with 40-60 different local names per XML vocabulary. For background, see: |
Definition at line 129 of file qnamepool_p.h.
NamePool::NamePool | ( | ) |
Definition at line 53 of file qnamepool.cpp.
Allocates a namespace binding for prefix
and uri
.
In the returned QXmlName, the local name is StandardLocalNames::empty, and QXmlName::prefix() and QXmlName::namespaceUri() returns prefix
and uri
, respectively.
In older versions of this code, the class NamespaceBinding existed, but as part of having the public class QXmlName, it was dropped and a special interpretation/convention involving use of QXmlName was adopted.
Definition at line 275 of file qnamepool.cpp.
Referenced by QPatternist::AccelTreeResourceLoader::streamToReceiver().
|
inline |
Definition at line 208 of file qnamepool_p.h.
Referenced by QPatternist::XsdInstanceReader::convertToQName(), QPatternist::XsdTypeChecker::convertToQName(), and QPatternist::NamespaceSupport::processName().
|
inline |
Definition at line 202 of file qnamepool_p.h.
Referenced by QPatternist::NamespaceSupport::setPrefixes(), QPatternist::XsdSchemaParser::setTargetNamespaceExtended(), termMatches(), QPatternist::FunctionAvailableFN::typeCheck(), and QPatternist::XsdValidatingInstanceReader::validateAttributeWildcard().
|
inline |
Definition at line 214 of file qnamepool_p.h.
Referenced by QPatternist::XsdInstanceReader::convertToQName(), QPatternist::XsdTypeChecker::convertToQName(), QPatternist::NamespaceURIForPrefixFN::evaluateSingleton(), QPatternist::NamespaceSupport::processName(), and QPatternist::NamespaceSupport::setPrefixes().
QXmlName NamePool::allocateQName | ( | const QString & | uri, |
const QString & | localName, | ||
const QString & | prefix = QString() |
||
) |
Definition at line 251 of file qnamepool.cpp.
Referenced by QPatternist::XsdSchema::addAnonymousType(), QPatternist::XsdSchemaParserContext::createAnonymousName(), QPatternist::URILoader::createRequest(), QPatternist::QNameFN::evaluateSingleton(), QPatternist::ProcessingInstructionConstructor::evaluateTardata(), fromClarkName(), QPatternist::AnyType::name(), QPatternist::AnySimpleType::name(), QPatternist::Untyped::name(), QPatternist::XsdSchemaParser::parseGlobalAttribute(), QPatternist::XsdSchemaParser::parseGlobalComplexType(), QPatternist::XsdSchemaParser::parseGlobalElement(), QPatternist::XsdSchemaParser::parseGlobalSimpleType(), QPatternist::XsdSchemaParser::parseKey(), QPatternist::XsdSchemaParser::parseKeyRef(), QPatternist::XsdSchemaParser::parseLocalAttribute(), QPatternist::XsdSchemaParser::parseLocalElement(), QPatternist::XsdSchemaParser::parseNamedAttributeGroup(), QPatternist::XsdSchemaParser::parseNamedGroup(), QPatternist::XsdSchemaParser::parseNotation(), QPatternist::XsdSchemaParser::parseUnique(), QXmlName::QXmlName(), QPatternist::AccelTreeResourceLoader::streamToReceiver(), QPatternist::XsdSchemaTypesFactory::XsdSchemaTypesFactory(), and QPatternist::XsdValidatingInstanceReader::XsdValidatingInstanceReader().
|
inline |
Definition at line 162 of file qnamepool_p.h.
Definition at line 347 of file qnamepool.cpp.
Referenced by QPatternist::XsdSchemaParser::addAttribute(), QPatternist::XsdSchemaParser::addElement(), QPatternist::QNameTest::displayName(), QPatternist::AnySimpleType::displayName(), QPatternist::XsdSimpleType::displayName(), QPatternist::NamedSchemaComponent::displayName(), QPatternist::FunctionSignature::displayName(), QPatternist::XsdComplexType::displayName(), QPatternist::AccelTree::printStats(), QPatternist::XsdValidatingInstanceReader::qNameAttribute(), QPatternist::XsdValidatingInstanceReader::read(), QPatternist::XsdValidatingInstanceReader::validate(), and QPatternist::XsdValidatingInstanceReader::validateElementComplexType().
|
private |
Definition at line 334 of file qnamepool.cpp.
Referenced by displayName().
Definition at line 389 of file qnamepool.cpp.
Referenced by QXmlName::fromClarkName().
|
inline |
Definition at line 168 of file qnamepool_p.h.
Referenced by QPatternist::XsdSchema::addAnonymousType(), QXmlQuery::bindVariable(), QPatternist::LocalNameTest::displayName(), QPatternist::ReportContext::error(), QPatternist::LocalNameFN::evaluateSingleton(), QPatternist::LocalNameFromQNameFN::evaluateSingleton(), QXmlName::localName(), QPatternist::XsdSchemaParser::parseGlobalAttribute(), QPatternist::XsdSchemaParser::parseLocalAttribute(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), and toClarkName().
|
inline |
Definition at line 180 of file qnamepool_p.h.
Referenced by QPatternist::NamespaceNameTest::displayName(), QPatternist::NamespaceURIFN::evaluateSingleton(), QPatternist::NamespaceURIFromQNameFN::evaluateSingleton(), QPatternist::NamespaceURIForPrefixFN::evaluateSingleton(), QXmlName::namespaceUri(), QPatternist::XsdSchemaParser::parseRedefine(), QPatternist::AccelTree::printStats(), QPatternist::XsdSchemaParser::readXPathExpression(), QPatternist::XsdValidatingInstanceReader::selectNodeSets(), toClarkName(), QPatternist::XsdValidatingInstanceReader::validate(), and QPatternist::XsdSchemaHelper::wildcardAllowsExpandedName().
|
inline |
Definition at line 174 of file qnamepool_p.h.
Referenced by QPatternist::PrefixFromQNameFN::evaluateSingleton(), QPatternist::QNameConstructor::namespaceForPrefix(), QXmlName::prefix(), QPatternist::AccelTree::printStats(), and toClarkName().
Definition at line 367 of file qnamepool.cpp.
Referenced by QXmlName::toClarkName().
Definition at line 188 of file qnamepool_p.h.
Referenced by displayName(), QPatternist::NameFN::evaluateSingleton(), and QPatternist::QNameValue::stringValue().
|
private |
Definition at line 289 of file qnamepool.cpp.
Referenced by allocateQName(), and NamePool().
|
private |
Definition at line 320 of file qnamepool.cpp.
Referenced by allocateBinding(), allocateQName(), and NamePool().
|
private |
It's assumed that prefix
is a valid NCName
.
Definition at line 306 of file qnamepool.cpp.
Referenced by allocateBinding(), allocateQName(), and NamePool().
|
friend |
Definition at line 93 of file qnamepool_p.h.
|
mutableprivate |
Definition at line 248 of file qnamepool_p.h.
Referenced by allocateBinding(), allocateQName(), and displayName().
|
private |
Definition at line 127 of file qnamepool_p.h.
Referenced by NamePool(), and unlockedAllocateLocalName().
Definition at line 109 of file qnamepool_p.h.
Referenced by displayName(), NamePool(), and unlockedAllocateLocalName().
|
private |
Same as m_prefixMapping but applies for URIs, and hence m_namespaces instead of m_prefixes.
Definition at line 125 of file qnamepool_p.h.
Referenced by NamePool(), and unlockedAllocateNamespace().
Definition at line 108 of file qnamepool_p.h.
Referenced by displayName(), NamePool(), and unlockedAllocateNamespace().
Definition at line 107 of file qnamepool_p.h.
Referenced by displayPrefix(), NamePool(), and unlockedAllocatePrefix().
|
private |
This hash contains no essential data, but speeds up finding a prefix in m_prefixes by mapping a prefix(the key) to the index into m_prefixes(which the value is).
In other words, one can skip this variable at the cost of having to linearly loop over prefixes, in order to find the entry.
Definition at line 119 of file qnamepool_p.h.
Referenced by NamePool(), and unlockedAllocatePrefix().