ScummVM API documentation
system_imports.h
1 /* ScummVM - Graphic Adventure Engine
2  *
3  * ScummVM is the legal property of its developers, whose names
4  * are too numerous to list here. Please refer to the COPYRIGHT
5  * file distributed with this source distribution.
6  *
7  * This program is free software: you can redistribute it and/or modify
8  * it under the terms of the GNU General Public License as published by
9  * the Free Software Foundation, either version 3 of the License, or
10  * (at your option) any later version.
11  *
12  * This program is distributed in the hope that it will be useful,
13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15  * GNU General Public License for more details.
16  *
17  * You should have received a copy of the GNU General Public License
18  * along with this program. If not, see <http://www.gnu.org/licenses/>.
19  *
20  */
21 
22 #ifndef AGS_ENGINE_SCRIPT_CC_SYSTEM_IMPORTS_H
23 #define AGS_ENGINE_SCRIPT_CC_SYSTEM_IMPORTS_H
24 
25 #include "common/std/map.h"
26 #include "ags/engine/script/cc_instance.h" // ccInstance
27 
28 namespace AGS3 {
29 
30 struct IScriptObject;
31 
32 using AGS::Shared::String;
33 
34 struct ScriptImport {
35  ScriptImport() {
36  InstancePtr = nullptr;
37  }
38 
39  String Name; // import's uid
41  ccInstance *InstancePtr; // script instance
42 };
43 
44 struct SystemImports {
45 private:
46  // Note we can't use a hash-map here, because we sometimes need to search
47  // by partial keys.
49 
51  IndexMap btree;
52 
53 public:
54  uint32_t add(const String &name, const RuntimeScriptValue &value, ccInstance *inst);
55  void remove(const String &name);
56  const ScriptImport *getByName(const String &name);
57  uint32_t get_index_of(const String &name);
58  const ScriptImport *getByIndex(uint32_t index);
59  String findName(const RuntimeScriptValue &value);
60  void RemoveScriptExports(ccInstance *inst);
61  void clear();
62 };
63 
64 } // namespace AGS3
65 
66 #endif
Definition: vector.h:39
Definition: system_imports.h:34
Definition: runtime_script_value.h:63
Definition: lobject.h:59
Definition: string.h:62
Definition: cc_instance.h:114
Definition: ags.h:40
Definition: system_imports.h:44