ConstraintGroup Class Reference

A Managed Collection of Constraints. More...

#include <constraintgroup.h>

List of all members.

Public Member Functions

Constraintvalue (QString key) const
 ConstraintGroup ()
bool hasConstraint (QString className, QString propertyName)
 
Returns:
true if className has a property called PropertyName with a constraint

virtual QString toString () const
 
Returns:
not implemented yet

bool filter (const ConstrainedDataObject *theObject, QString classname=QString())
 Filter method.
void addTypeConstraints (const QObject &prototype)
 Intraspects the properties of the prototype and inserts type-based constraints into the constraint map for the prototype's class.
ConstraintgetConstraint (QString className, QString propertyName)
 Return pointer to constraint for a particular className::propertyName.
void setRegexConstraint (QString className, QString propertyName, QString regularExpression)
 Convenience method which creates/sets a RegexConstraint.
void setDoubleRangeConstraint (QString className, QString propertyName, double lowval, double highval)
 Convenience method which creates/sets a DoubleRangeConstraint.
void setConstraint (QString className, QString propertyName, Constraint *constraint)
 Sets a constraint on a particular className::propertyName.
virtual ~ConstraintGroup ()
 Deletes the constraint objects that were added to this structure as well.


Detailed Description

A Managed Collection of Constraints.

Used to describe multidimensional constraints. First, it is a singleton used by ConstrainedDataObject to impose setProperty() constraints. Second, it is used to describe multidimensional queries.

Author:
Alan Ezust

Definition at line 24 of file constraintgroup.h.


Member Function Documentation

bool ConstraintGroup::filter ( const ConstrainedDataObject theObject,
QString  classname = QString() 
)

Filter method.

Parameters:
theObject - the object with values to check against constraints
classname - the name of the class which we wish to constrain the dataobject. If null, then defaults to whatever theObject.objectype() returns.
Returns:
true if the dataobject satisfies constraints for a particular class/property set.

Definition at line 41 of file constraintgroup.cpp.

References Constraint::accepts(), DataObject::className(), hasConstraint(), DataObject::property(), DataObject::propertyNames(), and value().

Here is the call graph for this function:

void ConstraintGroup::addTypeConstraints ( const QObject &  prototype  ) 

Intraspects the properties of the prototype and inserts type-based constraints into the constraint map for the prototype's class.

Currently only looks at enum and QDate properties.

Parameters:
prototype the object to intraspect

Definition at line 84 of file constraintgroup.cpp.

References setConstraint().

Here is the call graph for this function:

Constraint * ConstraintGroup::getConstraint ( QString  className,
QString  propertyName 
)

Return pointer to constraint for a particular className::propertyName.

Returns:
if no constraint was set, returns a constraint object which satisfies every possible value

Definition at line 65 of file constraintgroup.cpp.

References value().

Referenced by ConstrainedDataObject::setProperty(), and ConstrainedDataObject::validInputs().

Here is the call graph for this function:

void ConstraintGroup::setRegexConstraint ( QString  className,
QString  propertyName,
QString  regularExpression 
)

Convenience method which creates/sets a RegexConstraint.

Parameters:
regularExpression the expression to create a QRegExp from

Definition at line 72 of file constraintgroup.cpp.

References setConstraint().

Here is the call graph for this function:

void ConstraintGroup::setDoubleRangeConstraint ( QString  className,
QString  propertyName,
double  lowval,
double  highval 
)

Convenience method which creates/sets a DoubleRangeConstraint.

Assumes the property is a double type.

Definition at line 129 of file constraintgroup.cpp.

References setConstraint().

Here is the call graph for this function:


The documentation for this class was generated from the following files:
Generated on Wed Sep 30 01:15:43 2009 for oopapidocs by  doxygen 1.5.1