OpenLexocad  27.0
PythonClassObject.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/DocObject.h>
6 #include <Core/PropertyGUID.h>
7 #include <Core/PropertyInteger.h>
8 #include <Core/PropertyLink.h>
11 #include <Core/core_defines2.h>
12 
13 #include <map>
14 
15 namespace Core
16 {
26 {
27  typedef Core::DocObject inherited;
28 
31 
32 public:
33  friend class PythonClassObject_Factory;
34 
36  PropertyGUID classId; // The class Id
37  PropertyText className; // The class name
38  PropertyText superClassName; // The name of the super class
39  PropertyUInt64 standardManipulatorPolicy; // The StandardManipulatorPolicy in the UI
40  PropertyText propertyHeader; // The header text in the UI
41  PropertyIndex translatorHeader; // Index of the translator text
42  PropertyText propertyGroupName; // The group name in the UI
43  PropertyIndex translatorGroupName; // Index of the translator text
44 
45  Core::StandardManipulatorPolicy getStandardManipulatorPolicy() const;
46  void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy& aPolicy);
47  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId = -1);
48  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId = -1);
49  Base::String getPropertyHeader() const;
50  int getTranslationHeader() const;
51  Base::String getPropertyGroupName() const;
52  int getTranslationGroupName() const;
53 
54  void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version) override;
55  void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version) override;
56  bool mustbeSaved() const override;
57  static bool isRegistered(const Base::GlobalId& aClassId);
58  static bool registerClass(PythonClassObject* aClassObject);
59  static PythonClassObject* getRegisteredClass(const Base::GlobalId& aClassId);
60 
61  bool restorePythonInstance(const Base::GlobalId& aObjectId);
62  // static Base::String getPythonClassName(PyObject* aObject);
63 
64  std::list<PropertyDescriptor*> getPropertyDescriptorList() const;
65  std::map<std::string, PropertyDescriptor*> getPropertyDescriptorMap() const;
66  void addPropertyDescriptor(PropertyDescriptor* aDescriptor);
67  PropertyDescriptor* getPropertyDescriptorByName(const std::string& aName);
68 
70  virtual ~PythonClassObject();
71 
72 private:
73  PropertyLinkList scriptParamConfig; // Configuration of the ScriptParams
74  static std::map<Base::GlobalId, PythonClassObject*> classRegistry;
75 
76 protected:
77  Core::DocObject* copy(Core::CoreDocument* toDoc, DocObjectMap& copyMap = DocObjectMap()) override;
78 };
79 DECLARE_OBJECT_FACTORY_NOIFC(Core::PythonClassObject_Factory, Core::PythonClassObject);
80 } // namespace Core
#define CORE_EXPORT
Definition: core_defines2.h:10
PropertyText propertyHeader
Definition: PythonClassObject.h:40
The PropertyGUID class saves and restores GUIDs. It also handles the management of GUIDs in the Docum...
Definition: PropertyGUID.h:25
Definition: PropertyText.h:12
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:29
Definition: Persistance.h:20
PropertyBackLink< PythonScriptObject * > pythonScriptObject
Definition: PythonClassObject.h:35
LX_CORE_EXPORT Version & version
Definition: CoreDocument.h:197
PropertyText superClassName
Definition: PythonClassObject.h:38
Definition: AbstractXMLReader.h:10
Definition: GlobalId.h:32
Definition: StandardManipulatorPolicy.h:9
Definition: Base.h:19
Keeps the information about a Python class like class name, the super class etc. Also keeps the infor...
Definition: PythonClassObject.h:25
PropertyText className
Definition: PythonClassObject.h:37
DECLARE_OBJECT_FACTORY_NOIFC(PropertyBoolDescriptor_Factory, PropertyBoolDescriptor)
PropertyText propertyGroupName
Definition: PythonClassObject.h:42
Definition: PropertyInteger.h:57
Definition: PropertyDescriptor.h:16
Definition: Writer.h:27
LX_NODE_HEADER()
PropertyIndex translatorHeader
Definition: PythonClassObject.h:41
PropertyGUID classId
Definition: PythonClassObject.h:36
PropertyIndex translatorGroupName
Definition: PythonClassObject.h:43
Definition: PropertyInteger.h:140
std::map< Core::DocObject *, Core::DocObject * > DocObjectMap
Definition: DocObject.h:11
TYPESYSTEM_HEADER()
PropertyUInt64 standardManipulatorPolicy
Definition: PythonClassObject.h:39
Definition: DocObject.h:28