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

A helper class for validating identity constraints. More...

#include <qxsdidchelper_p.h>

Public Types

typedef QSet< TargetNodeSet
 

Public Functions

void addField (const QXmlItem &item, const QString &data, const SchemaType::Ptr &type)
 
int emptyFieldsCount () const
 
QVector< QXmlItemfieldItems () const
 
bool fieldsAreEqual (const TargetNode &other, const NamePool::Ptr &namePool, const ReportContext::Ptr &context, const SourceLocationReflection *const reflection) const
 
QXmlItem item () const
 
bool operator== (const TargetNode &other) const
 
 TargetNode (const QXmlItem &item)
 

Properties

QVector< FieldNodem_fields
 
QXmlItem m_item
 

Detailed Description

A helper class for validating identity constraints.

This class represents a target or qualified node from the target or qualified node set as defined in the validation rules at http://www.w3.org/TR/xmlschema11-1/#d0e32243.

A target node is part of the qualified node set, if all of its fields are not empty.

Definition at line 125 of file qxsdidchelper_p.h.

Typedefs

◆ Set

Defines a set of target nodes.

Definition at line 131 of file qxsdidchelper_p.h.

Constructors and Destructors

◆ TargetNode()

TargetNode::TargetNode ( const QXmlItem item)
explicit

Creates a new target node that is bound to the xml node item.

Definition at line 83 of file qxsdidchelper.cpp.

84  : m_item(item)
85 {
86 }

Functions

◆ addField()

void TargetNode::addField ( const QXmlItem item,
const QString data,
const SchemaType::Ptr type 
)

Adds a new field to the target node with the given values.

Definition at line 127 of file qxsdidchelper.cpp.

Referenced by QPatternist::XsdValidatingInstanceReader::selectNodeSets().

128 {
129  m_fields.append(FieldNode(item, data, type));
130 }
A helper class for validating identity constraints.
QVector< FieldNode > m_fields

◆ emptyFieldsCount()

int TargetNode::emptyFieldsCount ( ) const

Returns the number of fields that are empty.

Definition at line 103 of file qxsdidchelper.cpp.

Referenced by QPatternist::XsdValidatingInstanceReader::selectNodeSets().

104 {
105  int counter = 0;
106  for (int i = 0; i < m_fields.count(); ++i) {
107  if (m_fields.at(i).isEmpty())
108  ++counter;
109  }
110 
111  return counter;
112 }
QVector< FieldNode > m_fields

◆ fieldItems()

QVector< QXmlItem > TargetNode::fieldItems ( ) const

Returns all xml node items, the fields of that target node are bound to.

Definition at line 93 of file qxsdidchelper.cpp.

Referenced by QPatternist::XsdValidatingInstanceReader::validateKeyIdentityConstraint().

94 {
95  QVector<QXmlItem> items;
96 
97  for (int i = 0; i < m_fields.count(); ++i)
98  items.append(m_fields.at(i).item());
99 
100  return items;
101 }
The QVector class is a template class that provides a dynamic array.
Definition: qdatastream.h:64
void append(const T &t)
Inserts value at the end of the vector.
Definition: qvector.h:573
QVector< FieldNode > m_fields

◆ fieldsAreEqual()

bool TargetNode::fieldsAreEqual ( const TargetNode other,
const NamePool::Ptr namePool,
const ReportContext::Ptr context,
const SourceLocationReflection *const  reflection 
) const

Returns whether the target node has the same fields as the other target node.

Definition at line 114 of file qxsdidchelper.cpp.

Referenced by QPatternist::XsdValidatingInstanceReader::validateKeyRefIdentityConstraint(), and QPatternist::XsdValidatingInstanceReader::validateUniqueIdentityConstraint().

115 {
116  if (m_fields.count() != other.m_fields.count())
117  return false;
118 
119  for (int i = 0; i < m_fields.count(); ++i) {
120  if (!m_fields.at(i).isEqualTo(other.m_fields.at(i), namePool, context, reflection))
121  return false;
122  }
123 
124  return true;
125 }
QVector< FieldNode > m_fields

◆ item()

QXmlItem TargetNode::item ( ) const

Returns the xml node item the target node is bound to.

Definition at line 88 of file qxsdidchelper.cpp.

Referenced by QPatternist::qHash().

89 {
90  return m_item;
91 }

◆ operator==()

bool TargetNode::operator== ( const TargetNode other) const

Returns whether the target node is equal to the other target node.

Definition at line 132 of file qxsdidchelper.cpp.

133 {
134  return (m_item.toNodeModelIndex() == other.m_item.toNodeModelIndex());
135 }
QXmlNodeModelIndex toNodeModelIndex() const
If this QXmlItem represents a node, it returns the item as a QXmlNodeModelIndex.

Properties

◆ m_fields

QVector<FieldNode> QPatternist::TargetNode::m_fields
private

Definition at line 170 of file qxsdidchelper_p.h.

Referenced by addField(), emptyFieldsCount(), fieldItems(), and fieldsAreEqual().

◆ m_item

QXmlItem QPatternist::TargetNode::m_item
private

Definition at line 169 of file qxsdidchelper_p.h.

Referenced by item(), and operator==().


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