Qt 4.8
Public Functions | Static Public Functions | Properties | List of all members
QPatternist::GenericNamespaceResolver Class Reference

Generic namespace resolver which resolves lookups against entries in a QHash. More...

#include <qgenericnamespaceresolver_p.h>

Inheritance diagram for QPatternist::GenericNamespaceResolver:
QPatternist::NamespaceResolver QSharedData

Public Functions

virtual void addBinding (const QXmlName nb)
 
virtual Bindings bindings () const
 
 GenericNamespaceResolver (const Bindings &list)
 
virtual QXmlName::NamespaceCode lookupNamespaceURI (const QXmlName::PrefixCode prefix) const
 
- Public Functions inherited from QPatternist::NamespaceResolver
 NamespaceResolver ()
 
virtual ~NamespaceResolver ()
 
- Public Functions inherited from QSharedData
 QSharedData ()
 Constructs a QSharedData object with a reference count of 0. More...
 
 QSharedData (const QSharedData &)
 Constructs a QSharedData object with reference count 0. More...
 

Static Public Functions

static NamespaceResolver::Ptr defaultXQueryBindings ()
 
static NamespaceResolver::Ptr defaultXSLTBindings ()
 

Properties

Bindings m_bindings
 

Additional Inherited Members

- Public Types inherited from QPatternist::NamespaceResolver
typedef QHash< QXmlName::PrefixCode, QXmlName::NamespaceCodeBindings
 
enum  Constants { NoBinding = -1 }
 
typedef QExplicitlySharedDataPointer< NamespaceResolverPtr
 
- Public Variables inherited from QSharedData
QAtomicInt ref
 

Detailed Description

Generic namespace resolver which resolves lookups against entries in a QHash.

Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 71 of file qgenericnamespaceresolver_p.h.

Constructors and Destructors

◆ GenericNamespaceResolver()

GenericNamespaceResolver::GenericNamespaceResolver ( const Bindings list)

Functions

◆ addBinding()

void GenericNamespaceResolver::addBinding ( const QXmlName  nb)
virtual

Adds the mapping from prefix to namespaceURI to this NamespaceResolver. If this NamespaceResolver already contains a binding involving prefix, the old binding is replaced.

Implements QPatternist::NamespaceResolver.

Definition at line 54 of file qgenericnamespaceresolver.cpp.

55 {
57  m_bindings.remove(nb.prefix());
58  else
60 }
int remove(const Key &key)
Removes all the items that have the key from the hash.
Definition: qhash.h:784
A special value that when passed as the namespace part to NamespaceResolver::addBinding(), undeclares the prefix.
Definition: qnamepool_p.h:293
QString prefix(const QXmlNamePool &query) const
Returns the prefix.
Definition: qxmlname.cpp:370
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
NamespaceCode namespaceURI() const
Definition: qnamepool_p.h:503

◆ bindings()

NamespaceResolver::Bindings GenericNamespaceResolver::bindings ( ) const
virtual
Returns
all bindings this NamespaceResolver handles.

Implements QPatternist::NamespaceResolver.

Definition at line 91 of file qgenericnamespaceresolver.cpp.

◆ defaultXQueryBindings()

NamespaceResolver::Ptr GenericNamespaceResolver::defaultXQueryBindings ( )
static

Returns a GenericNamespaceResolver containing the following bindings:

Definition at line 67 of file qgenericnamespaceresolver.cpp.

68 {
69  Bindings list;
70 
77 
79 }
QExplicitlySharedDataPointer< NamespaceResolver > Ptr
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
QHash< QXmlName::PrefixCode, QXmlName::NamespaceCode > Bindings

◆ defaultXSLTBindings()

NamespaceResolver::Ptr GenericNamespaceResolver::defaultXSLTBindings ( )
static

Returns a GenericNamespaceResolver containing the following bindings:

Definition at line 81 of file qgenericnamespaceresolver.cpp.

82 {
83  Bindings list;
84 
87 
89 }
QExplicitlySharedDataPointer< NamespaceResolver > Ptr
iterator insert(const Key &key, const T &value)
Inserts a new item with the key and a value of value.
Definition: qhash.h:753
QHash< QXmlName::PrefixCode, QXmlName::NamespaceCode > Bindings

◆ lookupNamespaceURI()

QXmlName::NamespaceCode GenericNamespaceResolver::lookupNamespaceURI ( const QXmlName::PrefixCode  prefix) const
virtual

Resolves the prefix to the corresponding namespace URI. If no binding exists for prefix, NoBinding is returned.

Returns
the namespace corresponding to prefix.

Implements QPatternist::NamespaceResolver.

Definition at line 62 of file qgenericnamespaceresolver.cpp.

63 {
64  return m_bindings.value(prefix, NoBinding);
65 }
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606

Properties

◆ m_bindings

Bindings QPatternist::GenericNamespaceResolver::m_bindings
private

The key is the prefix, the value the namespace URI.

Definition at line 105 of file qgenericnamespaceresolver_p.h.

Referenced by addBinding(), bindings(), and lookupNamespaceURI().


The documentation for this class was generated from the following files: