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

Contains a set of bindings, plus a pointer to another resolver which is delegates requests to, in case it can't handle a lookup on its own. More...

#include <qdelegatingnamespaceresolver_p.h>

Inheritance diagram for QPatternist::DelegatingNamespaceResolver:
QPatternist::NamespaceResolver QSharedData

Public Functions

virtual void addBinding (const QXmlName nb)
 
virtual Bindings bindings () const
 
 DelegatingNamespaceResolver (const NamespaceResolver::Ptr &ns)
 
 DelegatingNamespaceResolver (const NamespaceResolver::Ptr &ns, const Bindings &overrides)
 
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...
 

Properties

Bindings m_bindings
 
const NamespaceResolver::Ptr m_nsResolver
 

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

Contains a set of bindings, plus a pointer to another resolver which is delegates requests to, in case it can't handle a lookup on its own.

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

Definition at line 74 of file qdelegatingnamespaceresolver_p.h.

Constructors and Destructors

◆ DelegatingNamespaceResolver() [1/2]

DelegatingNamespaceResolver::DelegatingNamespaceResolver ( const NamespaceResolver::Ptr ns)

Definition at line 50 of file qdelegatingnamespaceresolver.cpp.

50  : m_nsResolver(resolver)
51 {
53 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ DelegatingNamespaceResolver() [2/2]

DelegatingNamespaceResolver::DelegatingNamespaceResolver ( const NamespaceResolver::Ptr ns,
const Bindings overrides 
)

Definition at line 55 of file qdelegatingnamespaceresolver.cpp.

56  : m_nsResolver(ns)
57  , m_bindings(overrides)
58 {
60 }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

Functions

◆ addBinding()

void DelegatingNamespaceResolver::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 84 of file qdelegatingnamespaceresolver.cpp.

85 {
87  m_bindings.remove(nb.prefix());
88  else
90 }
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 DelegatingNamespaceResolver::bindings ( ) const
virtual
Returns
all bindings this NamespaceResolver handles.

Implements QPatternist::NamespaceResolver.

Definition at line 72 of file qdelegatingnamespaceresolver.cpp.

73 {
77 
78  for(; it != end; ++it)
79  bs.insert(it.key(), it.value());
80 
81  return bs;
82 }
#define it(className, varName)
const_iterator constBegin() const
Returns a const STL-style iterator pointing to the first item in the hash.
Definition: qhash.h:466
const_iterator constEnd() const
Returns a const STL-style iterator pointing to the imaginary item after the last item in the hash...
Definition: qhash.h:469
QHash< QXmlName::PrefixCode, QXmlName::NamespaceCode > Bindings
virtual Bindings bindings() const =0
static const KeyPair *const end

◆ lookupNamespaceURI()

QXmlName::NamespaceCode DelegatingNamespaceResolver::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 qdelegatingnamespaceresolver.cpp.

63 {
65 
66  if(val == NoBinding)
67  return m_nsResolver->lookupNamespaceURI(prefix);
68  else
69  return val;
70 }
qint16 NamespaceCode
Definition: qxmlname.h:82
const T value(const Key &key) const
Returns the value associated with the key.
Definition: qhash.h:606
virtual QXmlName::NamespaceCode lookupNamespaceURI(const QXmlName::PrefixCode prefix) const =0

Properties

◆ m_bindings

Bindings QPatternist::DelegatingNamespaceResolver::m_bindings
private

Definition at line 88 of file qdelegatingnamespaceresolver_p.h.

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

◆ m_nsResolver

const NamespaceResolver::Ptr QPatternist::DelegatingNamespaceResolver::m_nsResolver
private

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