1
Fork 0
mirror of https://github.com/SapphireServer/Sapphire.git synced 2025-04-29 23:57:46 +00:00
sapphire/src/servers/sapphire_zone/Script/ScriptInfo.h

67 lines
1.8 KiB
C
Raw Normal View History

2018-03-02 07:39:38 -03:00
#ifndef CORE_SCRIPTINFO_H
#define CORE_SCRIPTINFO_H
#include <vector>
#include "NativeScriptApi.h"
#ifdef _WIN32
2018-03-02 08:13:45 -03:00
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
typedef HMODULE ModuleHandle;
#else
typedef void* ModuleHandle;
#endif
namespace Core {
namespace Scripting {
2018-07-24 22:48:42 +10:00
/*!
* An internal class used to track information about loaded modules and their scripts.
* The main purpose of this is to maintain easy access to the module handle and the pointers to scripts that are loaded.
* Furthermore, allows for quick and easy cross platform access to the module paths associated with the runtime module cache and its original path.
*/
class ScriptInfo
{
public:
ScriptInfo() = default;
2018-07-24 22:48:42 +10:00
/*!
* @brief The file name of the loaded library.
*
* On all platforms, this will be the full filename of the module, eg:
* - script_instances.dll on Windows
* - libscript_instances.so on Linux
*/
std::string library_name;
2018-07-24 22:48:42 +10:00
/*!
* The path to the module currently loaded in memory from the cached location.
*/
std::string cache_path;
2018-07-24 22:48:42 +10:00
/*!
* The original path of the module before it was copied to the cache location.
*/
std::string library_path;
2018-07-24 22:48:42 +10:00
/*!
* @brief A handle to the module.
*
* The underlying type for this depends on platform. On Windows it's some stupid shit, on everything else it's a void*.
*/
ModuleHandle handle;
2018-07-24 22:48:42 +10:00
/*!
* @An internal list of all the pointers to each ScriptObject
*
* This is tracked so when we unload this module we can call delete on each ScriptObject and correctly free it from memory.
*/
std::vector< ScriptObject* > scripts;
};
}
}
#endif //SAPPHIRE_SCRIPTINFO_H