nxuri.h 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #pragma once
  2. #include "../../foundation/types.h"
  3. #include "../../nx/nxapi.h"
  4. #include "../../nx/nxstring.h"
  5. #ifdef __cplusplus
  6. extern "C" {
  7. #endif
  8. /* this thing is meant to be identical to nx_string_t, but we want to try to protect it so they don't get easily cast to nx_string_t
  9. since they aren't the same on all platforms */
  10. typedef struct nx_uri_struct_t
  11. {
  12. size_t ref_count;
  13. size_t len;
  14. wchar_t string[1]; // utf-16
  15. } nx_uri_struct_t, *nx_uri_t;
  16. NX_API nx_uri_t NXURIRetain(nx_uri_t string);
  17. NX_API void NXURIRelease(nx_uri_t string);
  18. NX_API nx_uri_t NXURIMalloc(size_t characters);
  19. NX_API int NXURICreateWithNXString(nx_uri_t *uri, nx_string_t string);
  20. NX_API int NXURICreateFromPath(nx_uri_t *uri, const wchar_t *filename, const nx_uri_t path); // windows only
  21. NX_API int NXURICreateWithPath(nx_uri_t *uri, const nx_uri_t filename, const nx_uri_t path);
  22. NX_API int NXURICreateWithNXString(nx_uri_t *new_value, nx_string_t string);
  23. NX_API int NXURICreateTempForFilepath(nx_uri_t *out_temp, nx_uri_t filename);
  24. NX_API int NXURICreateTempWithExtension(nx_uri_t *out_temp, const char *extension);
  25. NX_API int NXURICreateWithUTF8(nx_uri_t *value, const char *utf8);
  26. NX_API int NXURICreateTemp(nx_uri_t *out_temp);
  27. // replaces only the filename portion of the path with the desired filename
  28. // e.g., filepath = /path/to/1.mp3, *out_uri = /path/to/
  29. NX_API int NXURICreateRemovingFilename(nx_uri_t *out_uri, nx_uri_t filename);
  30. NX_API int NXURIGetNXString(nx_string_t *string, nx_uri_t uri);
  31. NX_API size_t NXURIGetLength(nx_uri_t string);
  32. #ifdef __cplusplus
  33. }
  34. #endif