string_escape.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. /*
  2. * Copyright (c) 2009-2016 Petri Lehtinen <petri@digip.org>
  3. *
  4. * Jansson is free software; you can redistribute it and/or modify
  5. * it under the terms of the MIT license.
  6. */
  7. #ifndef STRING_ESCAPE_H
  8. #define STRING_ESCAPE_H
  9. #ifdef __cplusplus
  10. extern "C" {
  11. #endif
  12. #include <open62541/architecture_definitions.h>
  13. #include <string.h>
  14. /* Locale independent versions of isxxx() functions */
  15. #define l_isupper(c) ('A' <= (c) && (c) <= 'Z')
  16. #define l_islower(c) ('a' <= (c) && (c) <= 'z')
  17. #define l_isalpha(c) (l_isupper(c) || l_islower(c))
  18. #define l_isdigit(c) ('0' <= (c) && (c) <= '9')
  19. #define l_isxdigit(c) (l_isdigit(c) || ('A' <= (c) && (c) <= 'F') || ('a' <= (c) && (c) <= 'f'))
  20. int utf8_encode(int32_t codepoint, char *buffer, size_t *size);
  21. size_t utf8_check_first(char byte);
  22. size_t utf8_check_full(const char *buffer, size_t size, int32_t *codepoint);
  23. const char *utf8_iterate(const char *buffer, size_t size, int32_t *codepoint);
  24. int utf8_check_string(const char *string, size_t length);
  25. int32_t decode_unicode_escape(const char *str);
  26. #ifdef __cplusplus
  27. }
  28. #endif
  29. #endif /* STRING_ESCAPE_H */