SHAPER  9.12.0
ParametersPlugin_EvalListener.h
1 // Copyright (C) 2014-2023 CEA, EDF
2 //
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
7 //
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
12 //
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
16 //
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
18 //
19 
20 #ifndef SRC_PARAMETERSPLUGIN_EVALLISTENER_H_
21 #define SRC_PARAMETERSPLUGIN_EVALLISTENER_H_
22 
23 #include <ParametersPlugin.h>
24 #include <Events_Loop.h>
25 
26 class ModelAPI_Attribute;
27 class ModelAPI_Document;
28 class ModelAPI_Feature;
31 
38 {
41  std::map<ParametersPlugin_Parameter*, std::wstring> myOldNames;
42  public:
43  PARAMETERSPLUGIN_EXPORT ParametersPlugin_EvalListener();
44  PARAMETERSPLUGIN_EXPORT virtual ~ParametersPlugin_EvalListener();
45 
47  PARAMETERSPLUGIN_EXPORT
48  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
49 
50  protected:
52  void processObjectRenamedEvent(const std::shared_ptr<Events_Message>& theMessage);
54  void processReplaceParameterEvent(const std::shared_ptr<Events_Message>& theMessage);
55 
57  std::wstring renameInPythonExpression(const std::wstring& theExpression,
58  const std::wstring& theOldName,
59  const std::wstring& theNewName);
61  void renameInParameter(std::shared_ptr<ParametersPlugin_Parameter> theParameter,
62  const std::wstring& theOldName,
63  const std::wstring& theNewName);
65  void renameInAttribute(std::shared_ptr<ModelAPI_Attribute> theAttribute,
66  const std::wstring& theOldName,
67  const std::wstring& theNewName);
69  void renameInDependents(std::shared_ptr<ModelAPI_ResultParameter> theResultParameter,
70  const std::wstring& theOldName,
71  const std::wstring& theNewName);
72 };
73 
74 #endif /* SRC_PARAMETERSPLUGIN_PARAMETERSPLUGIN_EVALLISTENER_H_ */
Base interface for any event listener.
Definition: Events_Listener.h:37
Generic attribute of the Object.
Definition: ModelAPI_Attribute.h:34
Document for internal data structure of any object storage.
Definition: ModelAPI_Document.h:52
Feature function that represents the particular functionality of this operation.
Definition: ModelAPI_Feature.h:39
The construction element result of a feature.
Definition: ModelAPI_ResultParameter.h:34
Class which process the events from the event loop.
Definition: ParametersPlugin_EvalListener.h:38
void renameInDependents(std::shared_ptr< ModelAPI_ResultParameter > theResultParameter, const std::wstring &theOldName, const std::wstring &theNewName)
Renames theOldName in all dependents of theResultParameter by theNewName.
Definition: ParametersPlugin_EvalListener.cpp:212
std::wstring renameInPythonExpression(const std::wstring &theExpression, const std::wstring &theOldName, const std::wstring &theNewName)
Renames theOldName in theExpression by theNewName.
Definition: ParametersPlugin_EvalListener.cpp:100
void processObjectRenamedEvent(const std::shared_ptr< Events_Message > &theMessage)
Processes ObjectRenamed event.
Definition: ParametersPlugin_EvalListener.cpp:260
void renameInAttribute(std::shared_ptr< ModelAPI_Attribute > theAttribute, const std::wstring &theOldName, const std::wstring &theNewName)
Renames theOldName in the text fields of theAttribute by theNewName.
Definition: ParametersPlugin_EvalListener.cpp:161
virtual PARAMETERSPLUGIN_EXPORT void processEvent(const std::shared_ptr< Events_Message > &theMessage)
Reimplemented from Events_Listener::processEvent().
Definition: ParametersPlugin_EvalListener.cpp:84
void processReplaceParameterEvent(const std::shared_ptr< Events_Message > &theMessage)
Processes ReplaceParameter event.
Definition: ParametersPlugin_EvalListener.cpp:321
void renameInParameter(std::shared_ptr< ParametersPlugin_Parameter > theParameter, const std::wstring &theOldName, const std::wstring &theNewName)
Renames theOldName in the expression attribute of theParameter by theNewName.
Definition: ParametersPlugin_EvalListener.cpp:140
Feature for parameter.
Definition: ParametersPlugin_Parameter.h:34