New update! 3.1 is liiiive!
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
This commit is contained in:
66
dlls/arrayx/CKeytable.cpp
Normal file
66
dlls/arrayx/CKeytable.cpp
Normal file
@ -0,0 +1,66 @@
|
||||
#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;
|
||||
}
|
Reference in New Issue
Block a user