OpenLexocad  27.0
PythonScriptObject.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include <Core/DocObject.h>
4 #include <Core/PropertyGUID.h>
5 #include <Core/PropertyLogical.h>
6 #include <Core/PropertyText.h>
7 #include <Core/core_defines2.h>
8 
9 namespace Core
10 {
12 {
13  typedef Core::DocObject inherited;
14 
17 public:
18  friend class PythonScriptObject_Factory;
19 
22 
23  PropertyGUID scriptId; // The Script Id
24  PropertyText scriptPath; // The Script path
25  PropertyLogical isExternal; // Flag if Script is internal or external
26 
27  void save(Base::AbstractWriter& writer, Base::PersistanceVersion& save_version) override;
28  void restore(Base::AbstractXMLReader& reader, Base::PersistanceVersion& version) override;
29  // void saveDocFile(Base::AbstractWriter &writer, const Base::String& filename, const Base::String& tmpdir) override;
30  // void restoreDocFile(Base::Reader &reader, const Base::String& tmpdir) override;
31  bool mustbeSaved() const override;
32 
33  static bool isRegistered(const Base::GlobalId& aScriptId);
34  static bool registerScript(PythonScriptObject* aScriptObject);
35  static PythonScriptObject* getRegisteredScript(const Base::GlobalId& aScriptPath);
36 
37 protected:
38  Core::DocObject* copy(Core::CoreDocument* toDoc, DocObjectMap& copyMap = DocObjectMap()) override;
39 
40 private:
41  static std::map<Base::GlobalId, Core::PythonScriptObject*> scriptRegistry;
42 };
43 
44 DECLARE_OBJECT_FACTORY_NOIFC(PythonScriptObject_Factory, PythonScriptObject);
45 } // namespace Core
#define CORE_EXPORT
Definition: core_defines2.h:10
PropertyText scriptPath
Definition: PythonScriptObject.h:24
Definition: PropertyLogical.h:18
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
Definition: Persistance.h:20
LX_CORE_EXPORT Version & version
Definition: CoreDocument.h:197
Definition: AbstractXMLReader.h:10
Definition: GlobalId.h:32
Definition: PythonScriptObject.h:11
Definition: Base.h:19
DECLARE_OBJECT_FACTORY_NOIFC(PropertyBoolDescriptor_Factory, PropertyBoolDescriptor)
Definition: Writer.h:27
PropertyLogical isExternal
Definition: PythonScriptObject.h:25
LX_NODE_HEADER()
PropertyGUID scriptId
Definition: PythonScriptObject.h:23
std::map< Core::DocObject *, Core::DocObject * > DocObjectMap
Definition: DocObject.h:11
TYPESYSTEM_HEADER()
Definition: DocObject.h:28