From 7807756f46b9dcd90994ac57a8a514f0570e794e Mon Sep 17 00:00:00 2001 From: spo Date: Fri, 18 Sep 2015 12:55:11 +0300 Subject: [PATCH] Documentation fixes. --- src/Config/Config_DataModelReader.h | 3 +-- src/Config/Config_XMLReader.h | 2 ++ .../ExchangePlugin_ExportFeature.h | 4 +++- .../ExchangePlugin_ImportFeature.h | 5 +++-- src/ExchangePlugin/ExchangePlugin_Plugin.h | 3 ++- src/ExchangePlugin/ExchangePlugin_Tools.h | 3 ++- .../ExchangePlugin_Validators.h | 3 ++- .../ParametersPlugin_EvalListener.cpp | 6 +++--- .../ParametersPlugin_EvalListener.h | 16 ++++++++++++++- .../ParametersPlugin_Parameter.h | 20 +++++++++++-------- .../ParametersPlugin_Plugin.h | 7 +++++-- .../ParametersPlugin_PyInterp.cpp | 2 +- .../ParametersPlugin_PyInterp.h | 20 +++++++++++++++---- .../ParametersPlugin_Validators.cpp | 2 +- .../ParametersPlugin_Validators.h | 16 ++++++++++++++- 15 files changed, 83 insertions(+), 29 deletions(-) diff --git a/src/Config/Config_DataModelReader.h b/src/Config/Config_DataModelReader.h index d17f54eae..7af52946e 100644 --- a/src/Config/Config_DataModelReader.h +++ b/src/Config/Config_DataModelReader.h @@ -27,7 +27,6 @@ class Config_DataModelReader : public Config_XMLReader public: /*! * Constructor - * \param theXmlFile - full path to the xml file which will be processed by the reader */ CONFIG_EXPORT Config_DataModelReader(); CONFIG_EXPORT virtual ~Config_DataModelReader(); @@ -118,4 +117,4 @@ private: }; -#endif \ No newline at end of file +#endif diff --git a/src/Config/Config_XMLReader.h b/src/Config/Config_XMLReader.h index 6cfefc62d..258af0cd5 100644 --- a/src/Config/Config_XMLReader.h +++ b/src/Config/Config_XMLReader.h @@ -92,7 +92,9 @@ class Config_XMLReader std::string restoreAttribute(xmlNodePtr theNode, const char* theNodeAttribute); /// Restores an attribute from internal map. std::string restoreAttribute(const char* theNodeName, const char* theNodeAttribute); + /// Cleanups attribute from cache bool cleanupAttribute(xmlNodePtr theNode, const char* theNodeAttribute); + /// Cleanups attribute from cache bool cleanupAttribute(const char* theNodeName, const char* theNodeAttribute); protected: diff --git a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h index c653861f3..f5c27d0da 100644 --- a/src/ExchangePlugin/ExchangePlugin_ExportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ExportFeature.h @@ -13,7 +13,8 @@ #include -/**\class ExchangePlugin_ExportFeature +/** + * \class ExchangePlugin_ExportFeature * \ingroup Plugins * \brief Feature for export shapes to the external files in CAD formats. * @@ -22,6 +23,7 @@ class ExchangePlugin_ExportFeature : public ModelAPI_Feature { public: + /// Feature kind inline static const std::string& ID() { static const std::string MY_EXPORT_ID("Export"); diff --git a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h index 62a7c84b8..afb436b19 100644 --- a/src/ExchangePlugin/ExchangePlugin_ImportFeature.h +++ b/src/ExchangePlugin/ExchangePlugin_ImportFeature.h @@ -13,7 +13,8 @@ #include - /**\class ExchangePlugin_ImportFeature +/** + * \class ExchangePlugin_ImportFeature * \ingroup Plugins * \brief Feature for import shapes from the external files in CAD formats. * @@ -22,7 +23,7 @@ class ExchangePlugin_ImportFeature : public ModelAPI_Feature { public: - /// Extrusion kind + /// Feature kind inline static const std::string& ID() { static const std::string MY_IMPORT_ID("Import"); diff --git a/src/ExchangePlugin/ExchangePlugin_Plugin.h b/src/ExchangePlugin/ExchangePlugin_Plugin.h index 02a536c46..6f8aa0200 100644 --- a/src/ExchangePlugin/ExchangePlugin_Plugin.h +++ b/src/ExchangePlugin/ExchangePlugin_Plugin.h @@ -11,7 +11,8 @@ #include #include -/**\class ExchangePlugin_Plugin +/** + * \class ExchangePlugin_Plugin * \ingroup Plugins * \brief The main class for management the import and export operations as plugin. */ diff --git a/src/ExchangePlugin/ExchangePlugin_Tools.h b/src/ExchangePlugin/ExchangePlugin_Tools.h index bc3494229..dc8253266 100644 --- a/src/ExchangePlugin/ExchangePlugin_Tools.h +++ b/src/ExchangePlugin/ExchangePlugin_Tools.h @@ -12,7 +12,8 @@ #include #include -/**\class ExchangePlugin_Tools +/** + * \class ExchangePlugin_Tools * \ingroup Plugins * \brief Internal tools for the plugin. */ diff --git a/src/ExchangePlugin/ExchangePlugin_Validators.h b/src/ExchangePlugin/ExchangePlugin_Validators.h index cf7851e7a..b4b6a437e 100644 --- a/src/ExchangePlugin/ExchangePlugin_Validators.h +++ b/src/ExchangePlugin/ExchangePlugin_Validators.h @@ -10,7 +10,8 @@ #include "ExchangePlugin.h" #include -/**\class ExchangePlugin_ImportFormatValidator +/** + * \class ExchangePlugin_FormatValidator * \ingroup Validators * \brief Validator for the imported formats checking * diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp index 183a027f4..3d5212bfb 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.cpp @@ -279,7 +279,7 @@ void ParametersPlugin_EvalListener::renameInAttribute( } } -void ParametersPlugin_EvalListener::renameInDependants(std::shared_ptr theResultParameter, +void ParametersPlugin_EvalListener::renameInDependents(std::shared_ptr theResultParameter, const std::string& theOldName, const std::string& theNewName) { @@ -358,7 +358,7 @@ void ParametersPlugin_EvalListener::processObjectRenamedEvent( return; } - renameInDependants(aResultParameter, aMessage->oldName(), aMessage->newName()); + renameInDependents(aResultParameter, aMessage->oldName(), aMessage->newName()); } void ParametersPlugin_EvalListener::processReplaceParameterEvent( @@ -383,5 +383,5 @@ void ParametersPlugin_EvalListener::processReplaceParameterEvent( double aRealValue = aResultParameter->data()->real(ModelAPI_ResultParameter::VALUE())->value(); std::string aValue = toStdString(aRealValue); - renameInDependants(aResultParameter, aResultParameter->data()->name(), aValue); + renameInDependents(aResultParameter, aResultParameter->data()->name(), aValue); } diff --git a/src/ParametersPlugin/ParametersPlugin_EvalListener.h b/src/ParametersPlugin/ParametersPlugin_EvalListener.h index c24831780..96181169a 100644 --- a/src/ParametersPlugin/ParametersPlugin_EvalListener.h +++ b/src/ParametersPlugin/ParametersPlugin_EvalListener.h @@ -17,32 +17,46 @@ class ModelAPI_ResultParameter; class ParametersPlugin_Parameter; class ParametersPlugin_PyInterp; +/** + * \class ParametersPlugin_EvalListener + * \ingroup Plugins + * \brief Class which process the events from the event loop. + */ class ParametersPlugin_EvalListener : public Events_Listener { public: PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener(); PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener(); + /// Reimplemented from Events_Listener::processEvent(). PARAMETERSPLUGIN_EXPORT virtual void processEvent(const std::shared_ptr& theMessage); protected: + /// Evaluates theExpression and returns its value. double evaluate(const std::string& theExpression, std::string& theError, const std::shared_ptr& theDocument); + /// Processes Evaluation event. void processEvaluationEvent(const std::shared_ptr& theMessage); + /// Processes ObjectRenamed event. void processObjectRenamedEvent(const std::shared_ptr& theMessage); + /// Processes ReplaceParameter event. void processReplaceParameterEvent(const std::shared_ptr& theMessage); + /// Renames theOldName in theExpression by theNewName. std::string renameInPythonExpression(const std::string& theExpression, const std::string& theOldName, const std::string& theNewName); + /// Renames theOldName in the expression attribute of theParameter by theNewName. void renameInParameter(std::shared_ptr theParameter, const std::string& theOldName, const std::string& theNewName); + /// Renames theOldName in the text fields of theAttribute by theNewName. void renameInAttribute(std::shared_ptr theAttribute, const std::string& theOldName, const std::string& theNewName); - void renameInDependants(std::shared_ptr theResultParameter, + /// Renames theOldName in all dependents of theResultParameter by theNewName. + void renameInDependents(std::shared_ptr theResultParameter, const std::string& theOldName, const std::string& theNewName); diff --git a/src/ParametersPlugin/ParametersPlugin_Parameter.h b/src/ParametersPlugin/ParametersPlugin_Parameter.h index 9b029a156..2eef33feb 100644 --- a/src/ParametersPlugin/ParametersPlugin_Parameter.h +++ b/src/ParametersPlugin/ParametersPlugin_Parameter.h @@ -14,39 +14,40 @@ class ParametersPlugin_PyInterp; +/** + * \class ParametersPlugin_Parameter + * \ingroup Plugins + * \brief Feature for parameter. + */ class ParametersPlugin_Parameter : public ModelAPI_Feature { public: virtual ~ParametersPlugin_Parameter(); - /// Extrusion kind + /// Feature kind inline static const std::string& ID() { static const std::string MY_PARAMETER_ID("Parameter"); return MY_PARAMETER_ID; } - /// attribute name of references sketch entities list, it should contain a sketch result or - /// a pair a sketch result to sketch face + /// attribute of parameter name inline static const std::string& VARIABLE_ID() { static const std::string MY_VARIABLE_ID("variable"); return MY_VARIABLE_ID; } - - /// attribute name of extrusion size + /// attribute of parameter expression inline static const std::string& EXPRESSION_ID() { static const std::string MY_EXPRESSION_ID("expression"); return MY_EXPRESSION_ID; } - - /// attribute name of extrusion size + /// attribute of parameter expression error inline static const std::string& EXPRESSION_ERROR_ID() { static const std::string MY_EXPRESSION_ERROR_ID("ExpressionError"); return MY_EXPRESSION_ERROR_ID; } - /// list of references to the arguments of this expression inline static const std::string& ARGUMENTS_ID() { @@ -78,8 +79,11 @@ class ParametersPlugin_Parameter : public ModelAPI_Feature ParametersPlugin_Parameter(); protected: + /// Evaluates theExpression and returns its value. double evaluate(const std::string& theExpression, std::string& theError); + /// Update name of the parameter void updateName(); + /// Update expression of the parameter void updateExpression(); private: diff --git a/src/ParametersPlugin/ParametersPlugin_Plugin.h b/src/ParametersPlugin/ParametersPlugin_Plugin.h index 280f00903..8a14b613d 100644 --- a/src/ParametersPlugin/ParametersPlugin_Plugin.h +++ b/src/ParametersPlugin/ParametersPlugin_Plugin.h @@ -9,8 +9,10 @@ #include #include -/**\class ParametersPlugin_Plugin - * TODO: Add documentation +/** + * \class ParametersPlugin_Plugin + * \ingroup Plugins + * \brief The main class for management of parameter evaluation operations as plugin. */ class ParametersPlugin_Plugin : public ModelAPI_Plugin { @@ -21,6 +23,7 @@ class ParametersPlugin_Plugin : public ModelAPI_Plugin public: ParametersPlugin_Plugin(); + private: std::shared_ptr myEvalListener; }; diff --git a/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp b/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp index 021f28552..cc5ff327e 100644 --- a/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp +++ b/src/ParametersPlugin/ParametersPlugin_PyInterp.cpp @@ -93,7 +93,7 @@ std::list ParametersPlugin_PyInterp::compile(const std::string& the // co_names should be tuple, but can be changed in modern versions of python (>2.7.3) if(!PyTuple_Check(aCodeObj->co_names)) return aResult; - + int params_size = PyTuple_Size(aCodeObj->co_names); if (params_size > 0) { for (int i = 0; i < params_size; i++) { diff --git a/src/ParametersPlugin/ParametersPlugin_PyInterp.h b/src/ParametersPlugin/ParametersPlugin_PyInterp.h index 32b5c6d31..4d019556e 100644 --- a/src/ParametersPlugin/ParametersPlugin_PyInterp.h +++ b/src/ParametersPlugin/ParametersPlugin_PyInterp.h @@ -15,23 +15,35 @@ #include #include +/** + * \class ParametersPlugin_PyInterp + * \ingroup Plugins + * \brief Helper class for using Python interpreter. + */ class PARAMETERSPLUGIN_EXPORT ParametersPlugin_PyInterp : public PyInterp_Interp { public: ParametersPlugin_PyInterp(); virtual ~ParametersPlugin_PyInterp(); + /// Returns a list of positions for theName in theExpression. std::list > positions(const std::string& theExpression, const std::string& theName); - std::list compile(const std::string&); - void extendLocalContext(const std::list&); + /// Compiles theExpression and returns a list of parameters from theExpression. + std::list compile(const std::string& theExpression); + /// Extends local context with the list of parameters with values. + void extendLocalContext(const std::list& theParameters); + /// Clears local context. void clearLocalContext(); - double evaluate(const std::string&, std::string&); + /// Evaluates theExpression and returns its value. + double evaluate(const std::string& theExpression, std::string& theError); protected: + /// Returns error message. std::string errorMessage(); - // Overrides PyInterp_Interp + /// Overrides PyInterp_Interp. virtual bool initContext(); + /// Reimplemented from PyInterp_Interp::closeContext(). virtual void closeContext(); }; diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.cpp b/src/ParametersPlugin/ParametersPlugin_Validators.cpp index 82bd9d8d4..f2a957384 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.cpp +++ b/src/ParametersPlugin/ParametersPlugin_Validators.cpp @@ -54,7 +54,7 @@ bool ParametersPlugin_VariableValidator::isVariable(const std::string& theString return true; } -bool ParametersPlugin_VariableValidator::isUnique(const AttributePtr& theAttribute, +bool ParametersPlugin_VariableValidator::isUnique(const AttributePtr& theAttribute, const std::string& theString) const { DocumentPtr aDocument = theAttribute->owner()->document(); diff --git a/src/ParametersPlugin/ParametersPlugin_Validators.h b/src/ParametersPlugin/ParametersPlugin_Validators.h index b81b1c92c..a0551de61 100644 --- a/src/ParametersPlugin/ParametersPlugin_Validators.h +++ b/src/ParametersPlugin/ParametersPlugin_Validators.h @@ -15,6 +15,11 @@ #include +/** + * \class ParametersPlugin_VariableValidator + * \ingroup Validators + * \brief Validator for the variable name of parameter. + */ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator { public: @@ -24,16 +29,24 @@ class ParametersPlugin_VariableValidator : public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute + //! \param theError the error string message if validation fails PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, std::string& theError) const; protected: + /// Returns true if theString is a variable name. PARAMETERSPLUGIN_EXPORT bool isVariable(const std::string& theString) const; - PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute, + /// Returns true if theString is unique parameter name for theAttribute context. + PARAMETERSPLUGIN_EXPORT bool isUnique(const AttributePtr& theAttribute, const std::string& theString) const; }; +/** + * \class ParametersPlugin_ExpressionValidator + * \ingroup Validators + * \brief Validator for the expression of parameter. + */ class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator { public: @@ -43,6 +56,7 @@ class ParametersPlugin_ExpressionValidator: public ModelAPI_AttributeValidator //! returns true if attribute is valid //! \param theAttribute the checked attribute //! \param theArguments arguments of the attribute + //! \param theError the error string message if validation fails PARAMETERSPLUGIN_EXPORT virtual bool isValid(const AttributePtr& theAttribute, const std::list& theArguments, std::string& theError) const; -- 2.39.2