DBUtils.h 3.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. /* ---------------------------------------------------------------------------
  2. Nullsoft Database Engine
  3. --------------------
  4. codename: Near Death Experience
  5. --------------------------------------------------------------------------- */
  6. /* ---------------------------------------------------------------------------
  7. All Purposes Functions Prototypes
  8. --------------------------------------------------------------------------- */
  9. #ifndef __DBUTILS_H
  10. #define __DBUTILS_H
  11. #include <stdio.h>
  12. #include "vfs.h"
  13. #include "field.h"
  14. bool CompatibleFields(unsigned char oldType, unsigned char newType);
  15. uint32_t AllocNewPos(VFILE *Handle);
  16. Field *TranslateObject(unsigned char Type, Table *tbl);
  17. #ifndef __ANDROID__
  18. const void *memmem(const void *a, const void *b, size_t s, size_t l);
  19. #endif
  20. #ifdef __ANDROID__
  21. char *stristr(const char *s1, const char *s2);
  22. int mystricmp(const char *a, const char *b);
  23. char* mystristr(const char *a, const char *b);
  24. int nde_stricmp(const char *a, const char *b);
  25. int nde_stricmp_ignore(const char *a, const char *b); // ignores accents
  26. int nde_strnicmp(const char *a, const char *b, size_t len); // len must be <= strlen(b)
  27. int nde_strnicmp_ignore(const char *a, const char *b, size_t len); // ignores accents
  28. char *stristr_ignore(const char *s1, const char *s2);
  29. // filesystem safe versions
  30. char* mystristr_fn(const char *a, const char *b);
  31. int mystricmp_fn(const char *a, const char *b);
  32. char *stristr_fn(const char *s1, const char *s2);
  33. extern "C" int NDE_API nde_stricmp_fn(const char *a, const char *b);
  34. int nde_strnicmp_fn(const char *a, const char *b, size_t len); // len must be <= strlen(b)
  35. size_t utf16LE_to_utf8(const uint16_t *src, size_t source_len, char *dst, size_t out_len);
  36. size_t utf16BE_to_utf8(const uint16_t *src, size_t source_len, char *dst, size_t out_len);
  37. #endif
  38. #ifdef _WIN32
  39. #include <windows.h>
  40. int WINAPI NDE_FindNLSString(LCID Locale, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, LPINT pcchFound);
  41. extern int (WINAPI *findNLSString)(LCID Locale, DWORD dwFindNLSStringFlags, LPCWSTR lpStringSource, int cchSource, LPCWSTR lpStringValue, int cchValue, LPINT pcchFound);
  42. bool nde_wcsbegins(const wchar_t *a, const wchar_t *b);
  43. bool nde_wcsends(const wchar_t *a, const wchar_t *b);
  44. bool nde_wcscontains(const wchar_t *a, const wchar_t *b);
  45. int mywcsicmp(const wchar_t *a, const wchar_t *b);
  46. int nde_wcsicmp(const wchar_t *a, const wchar_t *b);
  47. // filesystem safe versions
  48. bool nde_fnbegins(const wchar_t *a, const wchar_t *b);
  49. bool nde_fnends(const wchar_t *a, const wchar_t *b);
  50. bool nde_fncontains(const wchar_t *a, const wchar_t *b);
  51. const wchar_t* mywcsistr_fn(const wchar_t *a, const wchar_t *b);
  52. int mywcsicmp_fn(const wchar_t *a, const wchar_t *b);
  53. extern "C" int NDE_API nde_wcsicmp_fn(const wchar_t *a, const wchar_t *b);
  54. #endif
  55. #ifdef __APPLE__
  56. wchar_t *_wcsdup(const wchar_t *val);
  57. #endif
  58. #endif