amxmodx/amxmodx/libraries.h
David Anderson f600a96657 Initial massive import of the new code module auto-loading code
Important difference - pubtags table is used instead of library table!
2006-05-10 02:32:34 +00:00

70 lines
1.1 KiB
C

#ifndef _INCLUDE_LIBRARIES_H
#define _INCLUDE_LIBRARIES_H
#include <string.h>
#include "amxmodx.h"
#include "CString.h"
enum LibSource
{
LibSource_Plugin,
LibSource_Module
};
enum LibType
{
LibType_Library,
LibType_Class
};
struct Library
{
String name;
LibSource src;
LibType type;
void *parent;
};
enum LibCmd
{
LibCmd_ReqLib,
LibCmd_ReqClass,
LibCmd_ForceLib,
LibCmd_ExpectLib,
LibCmd_ExpectClass,
LibCmd_DefaultLib,
};
enum LibError
{
LibErr_None = 0,
LibErr_NoLibrary,
LibErr_NoClass,
};
struct LibDecoder
{
LibDecoder() : buffer(NULL)
{
};
~LibDecoder()
{
free(buffer);
}
char *buffer;
char *param1;
char *param2;
LibCmd cmd;
};
bool AddLibrary(const char *name, LibType type, LibSource src, void *parent=NULL);
bool DecodeLibCmdString(const char *str, LibDecoder *cmd);
size_t AddLibrariesFromString(const char *name, LibType type, LibSource src, void *parent=NULL);
size_t ClearLibraries(LibSource src);
LibError RunLibCommand(const LibDecoder *enc);
size_t RemoveLibraries(void *parent);
bool FindLibrary(const char *name, LibType type);
#endif //_INCLUDE_LIBRARIES_H