mirror of
https://github.com/alliedmodders/amxmodx.git
synced 2024-12-27 07:15:37 +03:00
5c88803942
Error handling: Array now has sufficiently advanced error handling to remove most, if not all, disable_checks. Extention: With the metaprogramming techniques, new types can be added easily. Speed: With the new changes I've made to Judy, the Array module has far exceeded the speed of any traditional datatype
50 lines
819 B
C++
50 lines
819 B
C++
#ifndef _JUDYEX_INCLUDED
|
|
#define _JUDYEX_INCLUDED
|
|
|
|
#include <exception>
|
|
|
|
class JudyEx
|
|
{
|
|
private:
|
|
char* ex_message;
|
|
bool fatal;
|
|
|
|
public:
|
|
|
|
JudyEx() { ex_message = NULL; fatal = true; }
|
|
JudyEx(char* set, bool isfatal)
|
|
{
|
|
ex_message = new char[strlen(set) + 1];
|
|
strcpy(ex_message, set);
|
|
|
|
fatal = isfatal;
|
|
}
|
|
|
|
JudyEx(const JudyEx ©)
|
|
{
|
|
ex_message = new char[strlen(copy.ex_message) + 1];
|
|
strcpy(ex_message, copy.ex_message);
|
|
|
|
fatal = copy.fatal;
|
|
}
|
|
|
|
~JudyEx() { delete ex_message; }
|
|
|
|
void Destroy() { delete ex_message; }
|
|
|
|
void SetIsFatal(bool isfatal) { fatal = isfatal; }
|
|
bool IsFatal( void ) { return fatal; }
|
|
|
|
char* SetErrorMessage(char* set)
|
|
{
|
|
ex_message = new char[strlen(set) + 1];
|
|
strcpy(ex_message, set);
|
|
}
|
|
|
|
char* ErrorMessage( void )
|
|
{
|
|
return ex_message;
|
|
}
|
|
};
|
|
|
|
#endif |