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