nde.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168
  1. /* ---------------------------------------------------------------------------
  2. Nullsoft Database Engine - Codename: Neutrino
  3. --------------------------------------------------------------------------- */
  4. /* ---------------------------------------------------------------------------
  5. Global Include File
  6. --------------------------------------------------------------------------- */
  7. #ifndef __NDE_H
  8. #define __NDE_H
  9. // TODO: find better Mac preproc symbol
  10. #include "nde_defines.h"
  11. extern const char *tSign;
  12. extern const char *iSign;
  13. // Magic headers
  14. #define __TABLE_SIGNATURE__ tSign
  15. #define __INDEX_SIGNATURE__ iSign
  16. // Linked list entry types
  17. #define UNKNOWN 0
  18. #define FIELD 1
  19. #define FILTER 2
  20. #define SCANNER 3
  21. // Records constants
  22. #define NEW_RECORD -128
  23. #define FIELD_NOT_FOUND -1
  24. #define INVALID_RECORD -1
  25. #define NUM_SPECIAL_RECORDS 2 //
  26. #define FIELDS_RECORD_NUM 0
  27. #define INDEX_RECORD_NUM 1
  28. // Index constants
  29. #define PRIMARY_INDEX 255
  30. #define QFIND_ENTIRE_SCOPE -1
  31. #define throwException(x) {}
  32. #define FILTER_NOT 0
  33. #define FILTER_AND 1
  34. #define FILTER_OR 2
  35. #define FILTERS_INVALID -1
  36. #define FILTERS_INCOMPLETE 1
  37. #define FILTERS_COMPLETE 1
  38. #define ADDFILTER_FAILED 2
  39. // Permissions
  40. #define PERM_DENYALL 0
  41. #define PERM_READ 1
  42. #define PERM_READWRITE 3
  43. // All our classes so we can foreward reference
  44. class NDE_API LinkedListEntry;
  45. class LinkedList;
  46. class Field;
  47. class ColumnField;
  48. class IndexField;
  49. class StringField;
  50. class IntegerField;
  51. class Int64Field;
  52. class Int128Field;
  53. class GUIDField;
  54. class FloatField;
  55. class BooleanField;
  56. class BinaryField;
  57. class Binary32Field;
  58. class BitmapField;
  59. class PrivateField;
  60. class FilenameField;
  61. class Record;
  62. class NDE_API Scanner;
  63. class Table;
  64. class Index;
  65. class Filter;
  66. class Database;
  67. #if !defined (WIN32) && !defined(WIN64)
  68. #define NDE_NOWIN32FILEIO
  69. #define NO_TABLE_WIN32_LOCKING
  70. typedef int BOOL;
  71. typedef void* HANDLE;
  72. #define TRUE 1
  73. #define FALSE 0
  74. #ifdef __APPLE__
  75. #include <bfc/platform/types.h>
  76. #else
  77. #include <foundation/types.h> // TODO
  78. #endif
  79. #define HINSTANCE int
  80. //#define HWND int
  81. #define DWORD int
  82. #define wsprintf sprintf
  83. #define OutputDebugString(x) ;
  84. #define GetCurrentProcessId() getpid()
  85. #include <stdlib.h>
  86. #include <ctype.h>
  87. #include <strings.h>
  88. #include <string.h>
  89. #include <wchar.h>
  90. #include <sys/stat.h>
  91. void clear_stdin(void);
  92. void CopyFile(const char *filename, const char *destfilename, BOOL b);
  93. void DeleteFile(const char *filename);
  94. BOOL MoveFile(const char *filename, const char *destfilename);
  95. void Sleep(int ms);
  96. #define _stricmp strcasecmp
  97. #define strcmpi strcasecmp
  98. #define _strnicmp strncasecmp
  99. #define strncmpi strncasecmp
  100. #define _wtoi(x) wcstol(x,0,10)
  101. // TODO: find case insensitive compare on Mac OS X
  102. #define _wcsicmp wcscmp
  103. #define _wcsnicmp wcsncmp
  104. #define _MAX_PATH 8192
  105. #define _MAX_DRIVE 256
  106. #define _MAX_DIR 7424
  107. #define _MAX_FNAME 256
  108. #define _MAX_EXT 256
  109. #define min(x,y) ((x > y) ? y : x)
  110. #define max(x,y) ((x < y) ? y : x)
  111. #endif
  112. // All our includes+
  113. #include "Vfs.h"
  114. #include "LinkedList.h"
  115. #include "Field.h"
  116. #include "ColumnField.h"
  117. #include "IndexField.h"
  118. #include "StringField.h"
  119. #include "IntegerField.h"
  120. #include "Int64Field.h"
  121. #include "Int128Field.h"
  122. #include "BinaryField.h"
  123. #include "Binary32Field.h"
  124. #include "FilenameField.h"
  125. #include "Record.h"
  126. #include "Scanner.h"
  127. #include "Table.h"
  128. #include "Database.h"
  129. #include "Index.h"
  130. #include "Filter.h"
  131. #include "DBUtils.h"
  132. #endif