Qt 4.8
Public Types | Public Functions | Static Public Functions | Private Functions | Properties | List of all members
QPatternist::Cardinality Class Reference

Represents a cardinality, a possible , often represented by occurrence indicators. More...

#include <qcardinality_p.h>

Public Types

typedef qint32 Count
 
enum  CustomizeDisplayName { IncludeExplanation = 1, ExcludeExplanation }
 

Public Functions

bool allowsEmpty () const
 
bool allowsMany () const
 
bool canMatch (const Cardinality &other) const
 
 Cardinality (const Cardinality &other)
 
 Cardinality ()
 
QString displayName (const CustomizeDisplayName explanation) const
 
bool isEmpty () const
 
bool isExact () const
 
bool isExactlyOne () const
 
bool isMatch (const Cardinality &other) const
 
bool isOneOrMore () const
 
bool isZeroOrOne () const
 
Count maximum () const
 
Count minimum () const
 
Cardinality operator & (const Cardinality &other) const
 
bool operator!= (const Cardinality &other) const
 
Cardinality operator* (const Cardinality &other) const
 
Cardinality operator+ (const Cardinality &other) const
 
Cardinalityoperator+= (const Cardinality &other)
 
Cardinalityoperator= (const Cardinality &other)
 
bool operator== (const Cardinality &other) const
 
Cardinality operator| (const Cardinality &other) const
 
Cardinalityoperator|= (const Cardinality &other)
 
Cardinality toWithoutMany () const
 

Static Public Functions

static Cardinality empty ()
 
static Cardinality exactlyOne ()
 
static Cardinality fromCount (const Count count)
 
static Cardinality fromExact (const Count count)
 
static Cardinality fromRange (const Count minimum, const Count maximum)
 
static Cardinality oneOrMore ()
 
static Cardinality twoOrMore ()
 
static Cardinality zeroOrMore ()
 
static Cardinality zeroOrOne ()
 

Private Functions

 Cardinality (const Count min, const Count max)
 

Properties

Count m_max
 
Count m_min
 

Detailed Description

Represents a cardinality, a possible , often represented by occurrence indicators.

As opposed to the cardinality concept in the XQuery/XPath specifications, which only allows cardinalities to be expressed with kleene operators, this representation allows ranges. For example, the cardinality 10-11, describes a sequence containing ten or eleven items, inclusive.

See also
ItemType
SequenceType
XML Path Language (XPath) 2.0, The EBNF grammar for SequenceType
Author
Frans Englich frans.nosp@m..eng.nosp@m.lich@.nosp@m.noki.nosp@m.a.com

Definition at line 80 of file qcardinality_p.h.

Typedefs

◆ Count

This integer type, is what Cardinality uses for representing its ranges.

Definition at line 86 of file qcardinality_p.h.

Enumerations

◆ CustomizeDisplayName

Used with displayName(), and specifies how a display name for a Cardinality should be.

Enumerator
IncludeExplanation 

Includes a describing string in the return value of displayName().

ExcludeExplanation 

Excludes a describing string in the return value of displayName().

Definition at line 92 of file qcardinality_p.h.

Constructors and Destructors

◆ Cardinality() [1/3]

QPatternist::Cardinality::Cardinality ( const Cardinality other)
inline

A traditional copy constructor. This Cardinality becomes identical to other.

Definition at line 109 of file qcardinality_p.h.

109  : m_min(other.m_min),
110  m_max(other.m_max)
111  {
112  }

◆ Cardinality() [2/3]

QPatternist::Cardinality::Cardinality ( )
inline

This default constructor constructs an invalid Cardinality. Using its operators and members yields undefined results. A value must first be assigned to it by creating a Cardinality with fromRange(), fromCount(), or one of the predefined cardinalities such as empty() or oneOrMore().

Definition at line 120 of file qcardinality_p.h.

Referenced by empty(), exactlyOne(), fromCount(), fromExact(), fromRange(), oneOrMore(), operator &(), operator*(), operator+(), operator|(), toWithoutMany(), twoOrMore(), zeroOrMore(), and zeroOrOne().

120  : m_min(-1), m_max(0)
121  {
122  }

◆ Cardinality() [3/3]

QPatternist::Cardinality::Cardinality ( const Count  min,
const Count  max 
)
inlineprivate

Definition at line 528 of file qcardinality_p.h.

528  : m_min(min),
529  m_max(max)
530  {
531  }

Functions

◆ allowsEmpty()

bool QPatternist::Cardinality::allowsEmpty ( ) const
inline

◆ allowsMany()

bool QPatternist::Cardinality::allowsMany ( ) const
inline

◆ canMatch()

bool QPatternist::Cardinality::canMatch ( const Cardinality other) const
inline

Determines whether at least one of the possible outcomes represented by other, can match this Cardinality. For example, if this Cardinality is oneOrMore(), true will be returned if other is exactlyOne() or zeroOrOne().

Definition at line 300 of file qcardinality_p.h.

Referenced by QPatternist::Existence< Id >::compress(), and QPatternist::CardinalityVerifier::verifyCardinality().

301  {
302  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
303  if(m_max == -1)
304  return m_min <= other.m_min || other.m_max >= m_min || other.m_max == -1;
305  else
306  {
307  if(m_max == other.m_min)
308  return true;
309  else if(m_max > other.m_min)
310  return other.m_max >= m_min || other.m_max == -1;
311  else /* m_max < other.m_min */
312  return false;
313  }
314  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ displayName()

QString Cardinality::displayName ( const CustomizeDisplayName  explanation) const

Returns a string representation of this Cardinality.

If explain is ExcludeExplanation the kleene operator is returned. For example, if the Cardinality is zeroOrOne, is "?" returned.

If explain is IncludeExplanation a string more suited for human interpretation is returned, which is appropriately translated. For example, when the locale is English and this Cardinality being zeroOrOne, then is 'zero or one("?")' returned.

Typically, passing ExcludeExplanation is useful when generating function signatures and the like, while passing IncludeExplanation is suitable appropriate when generating error messages.

Returns
a string representation for this Cardinality.

Definition at line 50 of file qcardinality.cpp.

Referenced by QPatternist::GenericSequenceType::displayName(), QPatternist::formatType(), and isExact().

51 {
52  if(explain == IncludeExplanation)
53  {
54  if(isEmpty())
55  return QString(QtXmlPatterns::tr("empty") + QLatin1String("(\"empty-sequence()\")"));
56  else if(isZeroOrOne())
57  return QString(QtXmlPatterns::tr("zero or one") + QLatin1String("(\"?\")"));
58  else if(isExactlyOne())
59  return QString(QtXmlPatterns::tr("exactly one"));
60  else if(isOneOrMore())
61  return QString(QtXmlPatterns::tr("one or more") + QLatin1String("(\"+\")"));
62  else
63  return QString(QtXmlPatterns::tr("zero or more") + QLatin1String("(\"*\")"));
64  }
65  else
66  {
67  Q_ASSERT(explain == ExcludeExplanation);
68 
69  if(isEmpty() || isZeroOrOne())
70  return QLatin1String("?");
71  else if(isExactlyOne())
72  return QString();
73  else if(isExact())
74  {
75  return QString(QLatin1Char('{')) +
77  QLatin1Char('}');
78  }
79  else
80  {
81  if(m_max == -1)
82  {
83  if(isOneOrMore())
84  return QChar::fromLatin1('+');
85  else
86  return QChar::fromLatin1('*');
87  }
88  else
89  {
90  /* We have a range. We use a RegExp-like syntax. */
91  return QString(QLatin1Char('{')) +
93  QLatin1String(", ") +
95  QLatin1Char('}');
96 
97  }
98  }
99  }
100 }
static QString number(int, int base=10)
This is an overloaded member function, provided for convenience. It differs from the above function o...
Definition: qstring.cpp:6448
QLatin1String(DBUS_INTERFACE_DBUS))) Q_GLOBAL_STATIC_WITH_ARGS(QString
The QString class provides a Unicode character string.
Definition: qstring.h:83
#define Q_ASSERT(cond)
Definition: qglobal.h:1823
static QChar fromLatin1(char c)
Converts the Latin-1 character c to its equivalent QChar.
Definition: qchar.h:378
The QLatin1Char class provides an 8-bit ASCII/Latin-1 character.
Definition: qchar.h:55

◆ empty()

static Cardinality QPatternist::Cardinality::empty ( )
inlinestatic

The cardinality assigned to the exprssion (), formally speaking. The cardinality part of empty-sequence().

Definition at line 128 of file qcardinality_p.h.

Referenced by QPatternist::EmptySequenceType::cardinality(), QPatternist::Existence< Id >::compress(), QPatternist::CastAs::evaluateSingleton(), operator &(), and QPatternist::ExpressionSequence::typeCheck().

129  {
130  return Cardinality(0, 0);
131  }

◆ exactlyOne()

static Cardinality QPatternist::Cardinality::exactlyOne ( )
inlinestatic

◆ fromCount()

static Cardinality QPatternist::Cardinality::fromCount ( const Count  count)
inlinestatic

Determines the cardinality from the count of a sequence. For example, if count is 11, a Cardinality is returned that allows at minimum and maximum 11 items.

count must be positive or zero. If it is not, the result is undefined. When debugging is enabled, a Q_ASSERT() macro ensures this.

Definition at line 186 of file qcardinality_p.h.

Referenced by QPatternist::LiteralSequence::staticType().

187  {
188  Q_ASSERT_X(count > -1, Q_FUNC_INFO,
189  "A count smaller than 0 makes no sense.");
190  return Cardinality(count, count);
191  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ fromExact()

static Cardinality QPatternist::Cardinality::fromExact ( const Count  count)
inlinestatic

Definition at line 214 of file qcardinality_p.h.

Referenced by QPatternist::RangeExpression::staticType().

215  {
216  Q_ASSERT(count >= 0);
217  return Cardinality(count, count);
218  }
#define Q_ASSERT(cond)
Definition: qglobal.h:1823

◆ fromRange()

static Cardinality QPatternist::Cardinality::fromRange ( const Count  minimum,
const Count  maximum 
)
inlinestatic

Creates a Cardinality that allows minimum and maximum items, inclusive.

If maximum is -1, it signals infinity.

If you before hand knows that a predefined Cardinality is needed, remember to use one of the factory functions empty(), zeroOrOne(), exactlyOne(), oneOrMore() or zeroOrMore(), since they improves readability, are safer, and slightly faster.

Definition at line 204 of file qcardinality_p.h.

Referenced by QPatternist::RemoveFN::staticType().

205  {
207  "minimum should never be less than 0.");
209  "minimum cannot be larger than maximum.");
210 
211  return Cardinality(minimum, maximum);
212  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isEmpty()

bool QPatternist::Cardinality::isEmpty ( ) const
inline
Returns
true if this Cardinality is empty, the empty-sequence(), otherwise false.

Definition at line 320 of file qcardinality_p.h.

Referenced by QPatternist::NodeComparison::compress(), displayName(), QPatternist::CardinalityVerifier::evaluateSequence(), and QPatternist::GenericSequenceType::makeGenericSequenceType().

321  {
322  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
323  return m_min == 0 && m_max == 0;
324  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isExact()

bool QPatternist::Cardinality::isExact ( ) const
inline

Determines whether this Cardinality only allows a specific length. For example, empty() and exactlyOne() are exact, but oneOrMore() or zeroOrOne() is not.

Definition at line 360 of file qcardinality_p.h.

Referenced by displayName().

361  {
362  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
363  return m_min == m_max;
364  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isExactlyOne()

bool QPatternist::Cardinality::isExactlyOne ( ) const
inline
Returns
true if this Cardinality only allows exactly one item, otherwise false.

Definition at line 340 of file qcardinality_p.h.

Referenced by displayName().

341  {
342  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
343  return m_min == 1 && m_max == 1;
344  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isMatch()

bool QPatternist::Cardinality::isMatch ( const Cardinality other) const
inline

Determines whether all the possible outcomes represented by other, will always match this Cardinality. For example, if this Cardinality is oneOrMore(), true will be returned if other is exactlyOne(), but false if other is zeroOrOne().

Definition at line 279 of file qcardinality_p.h.

Referenced by QPatternist::InstanceOf::compress(), QPatternist::CastableAs::compress(), QPatternist::CardinalityVerifier::compress(), QPatternist::Existence< Id >::compress(), QPatternist::BySequenceTypeIdentifier::matches(), QPatternist::SequenceType::matches(), QPatternist::CastAs::typeCheck(), and QPatternist::CardinalityVerifier::verifyCardinality().

280  {
281  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
282  if(other.m_min < m_min)
283  return false;
284  else
285  { /* Ok, we now know the minimum will always be ok. */
286  if(m_max == -1)
287  return true; /* We allow infinite, so anything can match. */
288  else if(other.m_max == -1)
289  return false; /* other allows infinity, while we don't. */
290  else
291  return m_max >= other.m_max;
292  }
293  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isOneOrMore()

bool QPatternist::Cardinality::isOneOrMore ( ) const
inline
Returns
true if this Cardinality only allows one or more items, otherwise false.

Definition at line 350 of file qcardinality_p.h.

Referenced by displayName().

351  {
352  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
353  return m_min > 0 && (m_max == -1 || m_max >= 1);
354  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ isZeroOrOne()

bool QPatternist::Cardinality::isZeroOrOne ( ) const
inline
Returns
true if this Cardinality is zero-or-one, ?, otherwise false.

Definition at line 330 of file qcardinality_p.h.

Referenced by displayName().

331  {
332  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality is invalid.");
333  return m_min == 0 && m_max == 1;
334  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ maximum()

Count QPatternist::Cardinality::maximum ( ) const
inline
Returns
the maximum amount of items this Cardinality allows. For example, for zeroOrOne() is 1 returned.

Definition at line 234 of file qcardinality_p.h.

Referenced by displayName().

235  {
236  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality are invalid.");
237  return m_max;
238  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ minimum()

Count QPatternist::Cardinality::minimum ( ) const
inline
Returns
the minimum amount of items this Cardinality allows. For example, for zeroOrOne() is 0 returned.

Definition at line 224 of file qcardinality_p.h.

Referenced by displayName().

225  {
226  Q_ASSERT_X(m_min != -1, Q_FUNC_INFO, "The cardinality are invalid.");
227  return m_min;
228  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ oneOrMore()

static Cardinality QPatternist::Cardinality::oneOrMore ( )
inlinestatic

◆ operator &()

Cardinality QPatternist::Cardinality::operator& ( const Cardinality other) const
inline

Computes the intersection of this Cardinality and other, and returns the result. For example, the intersection between zeroOrOne() and oneOrMore() is exactlyOne().

If no intersection exists, such as the case in empty() and exactlyOne(), then is a default constructed Cardinality is returned. That is, an invalid Cardinality.

Definition at line 424 of file qcardinality_p.h.

425  {
426  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
427 
428  if(m_max < other.m_min) /* No intersection. */
429  return empty();
430 
431  const Count min = qMax(m_min, other.m_min);
432 
433  if(m_max == -1)
434  return Cardinality(min, other.m_max);
435  else if(other.m_max == -1)
436  return Cardinality(min, m_max);
437  else
438  return Cardinality(min, qMin(m_max, other.m_max));
439  }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
static Cardinality empty()
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator!=()

bool QPatternist::Cardinality::operator!= ( const Cardinality other) const
inline
Returns
the opposite of operator==()

Definition at line 521 of file qcardinality_p.h.

522  {
523  return m_min != other.m_min ||
524  m_max != other.m_max;
525  }

◆ operator*()

Cardinality QPatternist::Cardinality::operator* ( const Cardinality other) const
inline

Multiplies this Cardinality with other, and returns the result. The minimum and maximum of each Cardinality is multiplied such that the new Cardinality represents the possible range of the two sequences being multiplied, length-wise. For example the Cardinality 4, 5 multiplied with 2, 3 becomes 8, 15.

Definition at line 482 of file qcardinality_p.h.

483  {
484  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO,
485  "One of the cardinalities are invalid.");
486  if(m_max == -1 || other.m_max == -1)
487  return Cardinality(m_min * other.m_min, -1);
488  else
489  return Cardinality(m_min * other.m_min, m_max * other.m_max);
490  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator+()

Cardinality QPatternist::Cardinality::operator+ ( const Cardinality other) const
inline

Adds two cardinalities, as if two sequences represented by them were concatenated. For example, if this Cardinality allows the range 6-8 and other allows 0-1, the return Cardinality has a range of 6-9.

Returns
the result of the comparison.

Definition at line 448 of file qcardinality_p.h.

449  {
450  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
451  if(m_max == -1 || other.m_max == -1)
452  return Cardinality(m_min + other.m_min, -1);
453  else
454  return Cardinality(m_min + other.m_min, m_max + other.m_max);
455  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator+=()

Cardinality& QPatternist::Cardinality::operator+= ( const Cardinality other)
inline

Behaves as operator+() but assigns the result to this Cardinality.

Definition at line 460 of file qcardinality_p.h.

461  {
462  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO,
463  "One of the cardinalities are invalid.");
464  m_min += other.m_min;
465 
466  if(m_max == -1)
467  return *this;
468  if(other.m_max == -1)
469  m_max = -1;
470  else
471  m_max += other.m_max;
472 
473  return *this;
474  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator=()

Cardinality& QPatternist::Cardinality::operator= ( const Cardinality other)
inline

A traditional assignment operator. Behaves as assignment operators typically do.

Definition at line 496 of file qcardinality_p.h.

497  {
498  Q_ASSERT_X(this != &other, Q_FUNC_INFO, "Assigning to oneself makes no sense.");
499  m_min = other.m_min;
500  m_max = other.m_max;
501  return *this;
502  }
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator==()

bool QPatternist::Cardinality::operator== ( const Cardinality other) const
inline

Determines whether other is equal to this Cardinality.

For example, empty() is equal to empty(), but zeroOrOne() is not equal to exactlyOne().

Returns
true if other is equal to this Cardinality.

Definition at line 512 of file qcardinality_p.h.

513  {
514  return m_min == other.m_min &&
515  m_max == other.m_max;
516  }

◆ operator|()

Cardinality QPatternist::Cardinality::operator| ( const Cardinality other) const
inline

Computes the Cardinality that comprises this Cardinality as well as other. For example, if this Cardinality is zeroOrOne() and other is oneOrMore(), then is zeroOrMore() returned.

Definition at line 389 of file qcardinality_p.h.

390  {
391  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
392  if(m_max == -1 || other.m_max == -1)
393  return Cardinality(qMin(m_min, other.m_min), -1);
394  else
395  return Cardinality(qMin(m_min, other.m_min), qMax(m_max, other.m_max));
396  }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ operator|=()

Cardinality& QPatternist::Cardinality::operator|= ( const Cardinality other)
inline

Behaves as operator|() but assigns the result to this Cardinality.

Definition at line 401 of file qcardinality_p.h.

402  {
403  Q_ASSERT_X(m_min != -1 && other.m_min != -1, Q_FUNC_INFO, "One of the cardinalities are invalid.");
404  m_min = qMin(m_min, other.m_min);
405 
406  if(m_max == -1)
407  return *this;
408  else if(other.m_max == -1)
409  m_max = -1;
410  else
411  m_max = qMax(m_max, other.m_max);
412 
413  return *this;
414  }
Q_DECL_CONSTEXPR const T & qMin(const T &a, const T &b)
Definition: qglobal.h:1215
Q_DECL_CONSTEXPR const T & qMax(const T &a, const T &b)
Definition: qglobal.h:1217
#define Q_ASSERT_X(cond, where, what)
Definition: qglobal.h:1837
#define Q_FUNC_INFO
Definition: qglobal.h:1871

◆ toWithoutMany()

Cardinality QPatternist::Cardinality::toWithoutMany ( ) const
inline

Maps directly to Formal Semantics' aggregate_quantifier function.

Returns
zeroOrOne() if this Cardinality allows the empty sequence, otherwise exactlyOne()
See also
XQuery 1.0 and XPath 2.0 Formal Semantics, The function quantifier()

Definition at line 267 of file qcardinality_p.h.

Referenced by QPatternist::RootFN::staticType().

268  {
269  return m_min == 0 ? Cardinality(0, 1)
270  : Cardinality(1, 1);
271  }

◆ twoOrMore()

static Cardinality QPatternist::Cardinality::twoOrMore ( )
inlinestatic

Allows one or more. This cardinality has no kleene operator and is used by the implementation in order to be able to know when a cardinality that at amximum allows one, is exceeded.

Definition at line 173 of file qcardinality_p.h.

Referenced by QPatternist::CardinalityVerifier::evaluateSequence(), and QPatternist::CardinalityVerifier::evaluateSingleton().

174  {
175  return Cardinality(2, -1);
176  }

◆ zeroOrMore()

static Cardinality QPatternist::Cardinality::zeroOrMore ( )
inlinestatic

Allows any amount. This is therefore the widest, an unconstrained cardinality. Represented by the kleene operator *.

Definition at line 155 of file qcardinality_p.h.

Referenced by QPatternist::NoneType::cardinality(), QPatternist::EBVType::cardinality(), QPatternist::CardinalityVerifier::CardinalityVerifier(), QPatternist::quantificationType(), QPatternist::AxisStep::staticType(), QPatternist::CombineNodes::staticType(), and QPatternist::yyparse().

156  {
157  return Cardinality(0, -1);
158  }

◆ zeroOrOne()

static Cardinality QPatternist::Cardinality::zeroOrOne ( )
inlinestatic

Properties

◆ m_max

Count QPatternist::Cardinality::m_max
private

◆ m_min

Count QPatternist::Cardinality::m_min
private

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