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
66 lines
1.1 KiB
C++
66 lines
1.1 KiB
C++
#include "CKeytable.h"
|
|
|
|
void Keytable::ThrowIndexError( char* index, bool disable_check = false )
|
|
{
|
|
if(disable_check == true) return;
|
|
|
|
char error[50];
|
|
sprintf(error,"Index %s is not set.",index);
|
|
|
|
throw JudyEx(error,true);
|
|
}
|
|
|
|
void Keytable::ThrowSearchError(char* type)
|
|
{
|
|
char value[50];
|
|
sprintf(value,"Function attempted to search %s: Judy returned NULL value", type);
|
|
|
|
throw JudyEx(value,false);
|
|
}
|
|
|
|
char* Keytable::First( char* Start)
|
|
{
|
|
PPvoid_t index = JudySLFirst(Table, Start, PJE0);
|
|
if (index == NULL)
|
|
{
|
|
sprintf(Start,"dne");
|
|
ThrowSearchError("Type:First");
|
|
}
|
|
|
|
return Start;
|
|
}
|
|
|
|
char* Keytable::Next( char* Start)
|
|
{
|
|
PPvoid_t index = JudySLNext(Table, Start, PJE0);
|
|
if (index == NULL)
|
|
{
|
|
sprintf(Start,"dne");
|
|
ThrowSearchError("Type:Next");
|
|
}
|
|
return Start;
|
|
}
|
|
|
|
char* Keytable::Prev( char* Start)
|
|
{
|
|
PPvoid_t index = JudySLPrev(Table, Start, PJE0);
|
|
if (index == NULL)
|
|
{
|
|
sprintf(Start,"dne");
|
|
ThrowSearchError("Type:Prev");
|
|
}
|
|
|
|
return Start;
|
|
}
|
|
|
|
char* Keytable::Last( char* Start)
|
|
{
|
|
PPvoid_t index = JudySLLast(Table, Start, PJE0);
|
|
if (index == NULL)
|
|
{
|
|
sprintf(Start,"dne");
|
|
ThrowSearchError("Type:Last");
|
|
}
|
|
|
|
return Start;
|
|
} |