1 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
3 // File: GeomValidators_ShapeType.h
4 // Created: 19 Mar 2015
5 // Author: Natalia ERMOLAEVA
7 #ifndef GeomValidators_ShapeType_H
8 #define GeomValidators_ShapeType_H
10 #include "GeomValidators.h"
11 #include "ModelAPI_AttributeValidator.h"
13 #include <GeomAPI_Shape.h>
19 * A validator for shape types, such as vertex, line, circe or arc.
20 * If there are some argument parameters, this validator returns true if the attribute satisfied
21 * at least one argument (OR combination of arguments).
23 class GeomValidators_ShapeType : public ModelAPI_AttributeValidator
44 GEOMVALIDATORS_EXPORT GeomValidators_ShapeType() {}
45 //! Returns true if attribute has shape type listed in the parameter arguments
46 //! \param[in] theAttribute the checked attribute
47 //! \param[in] theArguments arguments of the attribute
48 //! \param[out] theError error message.
49 GEOMVALIDATORS_EXPORT virtual bool isValid(const AttributePtr& theAttribute,
50 const std::list<std::string>& theArguments,
51 std::string& theError) const;
53 /// Convert string to TypeOfShape value
54 /// \param theType a string value
55 static TypeOfShape shapeType(const std::string& theType);
57 /// Returns true if the attibute's object type satisfies the argument value
58 /// \param[in] theAttribute a checked attribute
59 /// \param[in] theShapeType a type of shape
60 /// \param[out] theError error message.
61 bool isValidAttribute(const AttributePtr& theAttribute,
62 const TypeOfShape theShapeType,
63 std::string& theError) const;
65 /// Returns true if the attibute's object type satisfies the argument value
66 /// \param[in] theObject a checked object
67 /// \param[in] theShapeType a shape type
68 /// \param[out] theError error message.
69 bool isValidObject(const ObjectPtr& theObject,
70 const TypeOfShape theShapeType,
71 std::string& theError) const;
73 /// Returns true if the attibute's object type satisfies the argument value
74 /// \param[in] theShape a checked shape
75 /// \param[in] theShapeType a shape type
76 /// \param[out] theError error message.
77 bool isValidShape(const GeomShapePtr theShape,
78 const TypeOfShape theShapeType,
79 std::string& theError) const;