AGXDynamics  2.31.1.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
ScriptIDEAutocomplete.h
Go to the documentation of this file.
1 /*
2 Copyright 2007-2021. Algoryx Simulation AB.
3 
4 All AGX source code, intellectual property, documentation, sample code,
5 tutorials, scene files and technical white papers, are copyrighted, proprietary
6 and confidential material of Algoryx Simulation AB. You may not download, read,
7 store, distribute, publish, copy or otherwise disseminate, use or expose this
8 material unless having a written signed agreement with Algoryx Simulation AB, or having been
9 advised so by Algoryx Simulation AB for a time limited evaluation, or having purchased a
10 valid commercial license from Algoryx Simulation AB.
11 
12 Algoryx Simulation AB disclaims all responsibilities for loss or damage caused
13 from using this software, unless otherwise stated in written agreements with
14 Algoryx Simulation AB.
15 */
16 
17 
18 #pragma once
19 #ifndef AGXPYTHON_SCRIPTIDEAUTOCOMPLETE_H
20 #define AGXPYTHON_SCRIPTIDEAUTOCOMPLETE_H 1
21 
23 
24 #if AGX_USE_PYTHON()
25 
26 #include <agxPython/export.h>
27 
28 #include <agx/Referenced.h>
29 
31 
32 #include <thread>
33 #include <mutex>
34 #include <vector>
35 #include <agx/HashTable.h>
36 
37 namespace agxPython
38 {
39 
40  class ScriptIDE;
43  {
44  public:
45 
46  friend class ScriptIDEAutocomplete;
47 
49  {
50  Category = 0,
59  };
60 
62  {
63 
64  public:
65 
66  Item();
67 
68  // Copy constructor
69  Item(const Item& copy);
70 
71  Item(void* jediObject, ScriptIDEAutocompleteCollection *collection);
72 
73  virtual agx::String str() const override;
74 
75  virtual agx::String type() const override {
76  return "AutocompleteItem";
77  }
78 
79  virtual bool isGood() const override;
80 
81  protected:
82 
83  virtual ~Item();
84 
85  private:
86 
87  bool m_isGood;
88 
89  };
92 
94 
95  bool add(ScriptIDEDataRef item) override;
96 
97  ItemRefVector getItems();
98 
99  protected:
100 
101  void addToDocstringHash(const agx::String& key, const agx::String& value);
102  agx::String getFromDocstringHash(const agx::String& key) const;
103 
104 
106 
109 
110 
111 
112  private:
113 
114  std::mutex m_lock;
115 
116  };
117 
120  {
121 
122  public:
123 
124  friend class ScriptIDE;
125  class JediThread;
126 
128 
129  virtual bool onUpdate(const agx::String& sourceCode) = 0;
130 
131  ScriptIDE* getIDE();
132 
133  ScriptIDEAutocompleteCollection* getCollection();
134 
135  static void preloadMomentumModules();
136 
137  protected:
138 
139  virtual ~ScriptIDEAutocomplete();
140 
141  private:
142 
143  void refresh(bool readOnly, bool scopeChange);
144 
145  JediThread* m_worker;
146 
147  ScriptIDE* m_ide;
148 
150  };
151 
152 }
153 
154 #endif
155 
156 #endif
#define AGX_DECLARE_POINTER_TYPES(type)
Definition: Referenced.h:248
Base class providing referencing counted objects.
Definition: Referenced.h:113
Templated vector class.
Definition: Vector.h:52
agx::HashTable< agx::String, agx::String > StringHashTable
Smart pointer for handling referenced counted objects.
Definition: ref_ptr.h:29
Inheritance with partial specialization due to bug with ref_ptr containers.
#define AGXPYTHON_EXPORT