OpenLexocad  28.0
PythonClassObject.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/DocObject.h>
5 #include <Core/PropertyLink.h>
6 #include <Core/PropertyGUID.h>
7 #include <Core/PropertyText.h>
8 #include <Core/PropertyInteger.h>
10 
11 
12 namespace Core
13 {
14 class PythonScriptObject;
15 class PropertyDescriptor;
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 
46  void setPropertyHeader(const Base::String& aDefaultName, int aTranslationId = -1);
47  void setPropertyGroupName(const Base::String& aDefaultName, int aTranslationId = -1);
49  int getTranslationHeader() const;
52 
53  void save(Base::AbstractWriter& writer, Base::PersistenceVersion& save_version) override;
55  bool mustbeSaved() const override;
56  static bool isRegistered(const Base::GlobalId& aClassId);
57  static bool registerClass(PythonClassObject* aClassObject);
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;
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 ) override;
77 };
78 DECLARE_OBJECT_FACTORY_NOIFC(Core::PythonClassObject_Factory, Core::PythonClassObject);
79 } // namespace Core
Core::PythonClassObject::isRegistered
static bool isRegistered(const Base::GlobalId &aClassId)
Core::PythonClassObject
Keeps the information about a Python class like class name, the super class etc. Also keeps the infor...
Definition: PythonClassObject.h:25
Core::PythonClassObject::addPropertyDescriptor
void addPropertyDescriptor(PropertyDescriptor *aDescriptor)
Core::CoreDocument
Definition: CoreDocument.h:269
Core::PythonClassObject::copy
Core::DocObject * copy(Core::CoreDocument *toDoc, DocObjectMap &copyMap) override
Base::GlobalId
Definition: GlobalId.h:28
Core::DocObjectMap
std::map< Core::DocObject *, Core::DocObject * > DocObjectMap
Definition: DocObject.h:50
Core::PythonClassObject::superClassName
PropertyText superClassName
Definition: PythonClassObject.h:37
DocObject.h
Core::PythonClassObject::restore
void restore(Base::AbstractXMLReader &reader, Base::PersistenceVersion &version) override
Restores the PropertyContainer from reader in specified version.
Core::StandardManipulatorPolicy
Definition: StandardManipulatorPolicy.h:8
Core::PythonClassObject::PythonClassObject
PythonClassObject()
Core::PythonClassObject::mustbeSaved
bool mustbeSaved() const override
Return 'true' if this object must always be saved in the file.
Core::PythonClassObject::getPropertyDescriptorByName
PropertyDescriptor * getPropertyDescriptorByName(const std::string &aName)
Core::PythonClassObject::getPropertyGroupName
Base::String getPropertyGroupName() const
Core::PythonClassObject::setStandardManipulatorPolicy
void setStandardManipulatorPolicy(const Core::StandardManipulatorPolicy &aPolicy)
Core::PythonClassObject::save
void save(Base::AbstractWriter &writer, Base::PersistenceVersion &save_version) override
Saves the PropertyContainer to writer.
Core::PythonClassObject::registerClass
static bool registerClass(PythonClassObject *aClassObject)
Core::PythonClassObject::pythonScriptObject
PropertyBackLink< PythonScriptObject * > pythonScriptObject
Definition: PythonClassObject.h:34
Core::DocObject
Definition: DocObject.h:54
Core::PythonClassObject::propertyHeader
PropertyText propertyHeader
Definition: PythonClassObject.h:39
Core::PythonClassObject::getPropertyDescriptorMap
std::map< std::string, PropertyDescriptor * > getPropertyDescriptorMap() const
Core::PythonClassObject::getRegisteredClass
static PythonClassObject * getRegisteredClass(const Base::GlobalId &aClassId)
Base::PersistenceVersion
Definition: Persistence.h:13
Core::PythonClassObject::getTranslationHeader
int getTranslationHeader() const
Core
Definition: Base.h:5
PropertyGUID.h
LX_NODE_HEADER
#define LX_NODE_HEADER()
Definition: PropertyMacros.h:7
Core::PropertyDescriptor
Definition: PropertyDescriptor.h:11
PropertyText.h
Base::AbstractWriter
Definition: Writer.h:13
Core::PythonClassObject::setPropertyHeader
void setPropertyHeader(const Base::String &aDefaultName, int aTranslationId=-1)
Core::DECLARE_OBJECT_FACTORY_NOIFC
DECLARE_OBJECT_FACTORY_NOIFC(PropertyBoolDescriptor_Factory, PropertyBoolDescriptor)
Base::AbstractXMLReader
Definition: AbstractXMLReader.h:7
PropertyInteger.h
Core::PythonClassObject::className
PropertyText className
Definition: PythonClassObject.h:36
Core::PropertyText
Definition: PropertyText.h:8
Core::PythonClassObject::getPropertyDescriptorList
std::list< PropertyDescriptor * > getPropertyDescriptorList() const
Core::PythonClassObject::getPropertyHeader
Base::String getPropertyHeader() const
Core::PythonClassObject::translatorGroupName
PropertyIndex translatorGroupName
Definition: PythonClassObject.h:42
Core::PythonClassObject::getTranslationGroupName
int getTranslationGroupName() const
Core::version
LX_CORE_EXPORT Version & version
StandardManipulatorPolicy.h
Core::PythonClassObject::propertyGroupName
PropertyText propertyGroupName
Definition: PythonClassObject.h:41
Core::PropertyIndex
Definition: PropertyInteger.h:129
Core::PythonClassObject::getStandardManipulatorPolicy
Core::StandardManipulatorPolicy getStandardManipulatorPolicy() const
Base::String
A Utf-16 (windows) or ucs4 (unix) encoded string class.
Definition: String.h:18
Core::PythonClassObject::~PythonClassObject
virtual ~PythonClassObject()
TYPESYSTEM_HEADER
#define TYPESYSTEM_HEADER()
define for subclassing Base::BaseClass
Definition: Base.h:12
Core::PythonClassObject::restorePythonInstance
bool restorePythonInstance(const Base::GlobalId &aObjectId)
Core::PropertyGUID
The PropertyGUID class saves and restores GUIDs. It also handles the management of GUIDs in the Docum...
Definition: PropertyGUID.h:21
Core::PythonClassObject::setPropertyGroupName
void setPropertyGroupName(const Base::String &aDefaultName, int aTranslationId=-1)
Core::PythonClassObject::translatorHeader
PropertyIndex translatorHeader
Definition: PythonClassObject.h:40
Core::PythonClassObject::standardManipulatorPolicy
PropertyUInt64 standardManipulatorPolicy
Definition: PythonClassObject.h:38
Core::PropertyUInt64
Definition: PropertyInteger.h:53
Core::PythonClassObject::classId
PropertyGUID classId
Definition: PythonClassObject.h:35