COPASI API  4.16.103
Public Member Functions | Protected Attributes | Static Protected Attributes | List of all members
CQFrameInputValidator Class Reference

#include <CQScreenshotOptionsDialog.h>

Inheritance diagram for CQFrameInputValidator:
Inheritance graph
[legend]
Collaboration diagram for CQFrameInputValidator:
Collaboration graph
[legend]

Public Member Functions

 CQFrameInputValidator (QObject *pParent=NULL)
 
virtual QValidator::State validate (QString &input, int &pos) const
 

Protected Attributes

QRegExp mClosedRangeGroupRegExp
 
QRegExp mIntermediateRegExp
 
QRegExp mValidationRegExp
 

Static Protected Attributes

static const QString ClosedRangeGroupRegExpString
 
static const QString IntermediateRegExpString
 
static const QString ValidRegExpString
 

Detailed Description

Definition at line 171 of file CQScreenshotOptionsDialog.h.

Constructor & Destructor Documentation

CQFrameInputValidator::CQFrameInputValidator ( QObject *  pParent = NULL)

Definition at line 571 of file CQScreenshotOptionsDialog.cpp.

References mClosedRangeGroupRegExp, mIntermediateRegExp, and mValidationRegExp.

571  :
572  QValidator(pParent)
576 {
577  this->mValidationRegExp.setPatternSyntax(QRegExp::RegExp2);
578  this->mIntermediateRegExp.setPatternSyntax(QRegExp::RegExp2);
579  this->mClosedRangeGroupRegExp.setPatternSyntax(QRegExp::RegExp2);
580 }
static const QString IntermediateRegExpString
static const QString ClosedRangeGroupRegExpString
static const QString ValidRegExpString

Member Function Documentation

QValidator::State CQFrameInputValidator::validate ( QString &  input,
int &  pos 
) const
virtual

Definition at line 582 of file CQScreenshotOptionsDialog.cpp.

References mClosedRangeGroupRegExp, mIntermediateRegExp, and mValidationRegExp.

583 {
584  // the expression is valid if it creates a match with mValidationRegexp
585  QValidator::State state = QValidator::Invalid;
586 
587  if (this->mValidationRegExp.exactMatch(input))
588  {
589  state = QValidator::Acceptable;
590  QStringList l = this->mValidationRegExp.capturedTexts();
591 
592  for (int i = 0; i < l.size() && state != QValidator::Invalid; ++i)
593  {
594  if (this->mClosedRangeGroupRegExp.exactMatch(l[i]))
595  {
596  // check if the numbers are ascending
597  QStringList l2 = this->mClosedRangeGroupRegExp.capturedTexts();
598  assert(l2.size() == 3);
599 
600  if (l2.size() != 3 || (l2.size() == 3 && l2[1].toUInt() > l2[2].toUInt()))
601  {
602  state = QValidator::Intermediate;
603  }
604  }
605  }
606  }
607  else
608  {
609  if (this->mIntermediateRegExp.exactMatch(input))
610  {
611  state = QValidator::Intermediate;
612  }
613  }
614 
615  // and if the order of items in a closed range group is ascending
616  // if not, we check with mIntermediateRegExp if the state is intermediate
617  return state;
618 }

Member Data Documentation

const QString CQFrameInputValidator::ClosedRangeGroupRegExpString
staticprotected

Definition at line 176 of file CQScreenshotOptionsDialog.h.

const QString CQFrameInputValidator::IntermediateRegExpString
staticprotected

Definition at line 175 of file CQScreenshotOptionsDialog.h.

QRegExp CQFrameInputValidator::mClosedRangeGroupRegExp
protected

Definition at line 180 of file CQScreenshotOptionsDialog.h.

Referenced by CQFrameInputValidator(), and validate().

QRegExp CQFrameInputValidator::mIntermediateRegExp
protected

Definition at line 179 of file CQScreenshotOptionsDialog.h.

Referenced by CQFrameInputValidator(), and validate().

QRegExp CQFrameInputValidator::mValidationRegExp
protected

Definition at line 178 of file CQScreenshotOptionsDialog.h.

Referenced by CQFrameInputValidator(), and validate().

const QString CQFrameInputValidator::ValidRegExpString
staticprotected

Definition at line 174 of file CQScreenshotOptionsDialog.h.


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