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 ICCDynamicObject;
31 struct ICCStaticObject;
32 
33 using AGS::Shared::String;
34 
35 struct ScriptImport {
36  ScriptImport() {
37  InstancePtr = nullptr;
38  }
39 
40  String Name; // import's uid
42  ccInstance *InstancePtr; // script instance
43 };
44 
45 struct SystemImports {
46 private:
47  // Note we can't use a hash-map here, because we sometimes need to search
48  // by partial keys.
50 
52  IndexMap btree;
53 
54 public:
55  uint32_t add(const String &name, const RuntimeScriptValue &value, ccInstance *inst);
56  void remove(const String &name);
57  const ScriptImport *getByName(const String &name);
58  uint32_t get_index_of(const String &name);
59  const ScriptImport *getByIndex(uint32_t index);
60  String findName(const RuntimeScriptValue &value);
61  void RemoveScriptExports(ccInstance *inst);
62  void clear();
63 };
64 
65 } // namespace AGS3
66 
67 #endif
Definition: vector.h:39
Definition: system_imports.h:35
Definition: runtime_script_value.h:65
Definition: lobject.h:59
Definition: string.h:62
Definition: cc_instance.h:99
Definition: ags.h:40
Definition: system_imports.h:45