COPASI API  4.16.103
Public Member Functions | Private Attributes | List of all members
CQValidatorXML Class Reference

#include <CQNotes.h>

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

Public Member Functions

 CQValidatorXML (QPlainTextEdit *parent, const char *name=0)
 
const bool & isFreeText () const
 
const bool & needsWrap () const
 
virtual State validate (QString &input, int &pos) const
 
- Public Member Functions inherited from CQValidator< QPlainTextEdit >
 CQValidator (QPlainTextEdit *parent, QString(QPlainTextEdit::*retrieve)(void) const, const char *name=0)
 
virtual void force (const QString &input) const
 
virtual State revalidate ()
 
virtual void saved () const
 

Private Attributes

bool mIsFreeText
 
bool mNeedsWrap
 

Additional Inherited Members

- Protected Member Functions inherited from CQValidator< QPlainTextEdit >
State setColor (const State &state) const
 
- Protected Attributes inherited from CQValidator< QPlainTextEdit >
QString mLastAccepted
 
QPlainTextEdit * mpContainer
 
QString(QPlainTextEdit::* mRetrieve )(void) const
 

Detailed Description

Definition at line 16 of file CQNotes.h.

Constructor & Destructor Documentation

CQValidatorXML::CQValidatorXML ( QPlainTextEdit *  parent,
const char *  name = 0 
)

Definition at line 32 of file CQNotes.cpp.

32  :
33  CQValidator< QPlainTextEdit >(parent, &QPlainTextEdit::toPlainText, name),
34  mIsFreeText(true),
35  mNeedsWrap(false)
36 {}
bool mIsFreeText
Definition: CQNotes.h:30
bool mNeedsWrap
Definition: CQNotes.h:32

Member Function Documentation

const bool & CQValidatorXML::isFreeText ( ) const

Definition at line 63 of file CQNotes.cpp.

References mIsFreeText.

Referenced by CQNotes::load(), and CQNotes::slotValidateXML().

64 {
65  return mIsFreeText;
66 }
bool mIsFreeText
Definition: CQNotes.h:30
const bool & CQValidatorXML::needsWrap ( ) const

Definition at line 68 of file CQNotes.cpp.

References mNeedsWrap.

Referenced by CQNotes::save().

69 {
70  return mNeedsWrap;
71 }
bool mNeedsWrap
Definition: CQNotes.h:32
QValidator::State CQValidatorXML::validate ( QString &  input,
int &  pos 
) const
virtual

Reimplemented from CQValidator< QPlainTextEdit >.

Definition at line 39 of file CQNotes.cpp.

References CQNotesContentHandler::isFreeText(), mIsFreeText, mNeedsWrap, CQNotesContentHandler::needsWrap(), CQValidator< QPlainTextEdit >::setColor(), and CQValidator< Type >::validate().

Referenced by CQNotes::slotValidateXML().

40 {
41  QXmlSimpleReader Validator;
42  QXmlInputSource Input;
43  CQNotesContentHandler ContentHandler;
44 
45  Validator.setContentHandler(&ContentHandler);
46 
47  // We like to allow free text and therefore wrap the text to create valid XML.
48  Input.setData("<Validate:XML xmlns:Validate=\"http://www.copasi.org/Validate\">" + input + "</Validate:XML>");
49 
50  if (Validator.parse(Input))
51  {
52  mIsFreeText = ContentHandler.isFreeText();
53  mNeedsWrap = ContentHandler.needsWrap();
54  return CQValidator< QPlainTextEdit >::validate(input, pos);
55  }
56 
57  mIsFreeText = true;
58  mNeedsWrap = false;
59  setColor(Invalid);
60  return Intermediate;
61 }
bool needsWrap() const
Definition: CQNotes.cpp:127
bool mIsFreeText
Definition: CQNotes.h:30
const bool & isFreeText() const
Definition: CQNotes.cpp:122
virtual State validate(QString &input, int &) const
Definition: CQValidator.h:51
State setColor(const State &state) const
Definition: CQValidator.h:84
bool mNeedsWrap
Definition: CQNotes.h:32

Member Data Documentation

bool CQValidatorXML::mIsFreeText
mutableprivate

Definition at line 30 of file CQNotes.h.

Referenced by isFreeText(), and validate().

bool CQValidatorXML::mNeedsWrap
mutableprivate

Definition at line 32 of file CQNotes.h.

Referenced by needsWrap(), and validate().


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