diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-05-04 18:00:34 +0000 |
commit | 3f619478f796eddbba6e39502fe941b285dd97b1 (patch) | |
tree | e2c7b5777f728320e5b5542b6213fd3591ba51e2 /plugin/handler_socket/libhsclient/string_util.hpp | |
parent | Initial commit. (diff) | |
download | mariadb-upstream.tar.xz mariadb-upstream.zip |
Adding upstream version 1:10.11.6.upstream/1%10.11.6upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'plugin/handler_socket/libhsclient/string_util.hpp')
-rw-r--r-- | plugin/handler_socket/libhsclient/string_util.hpp | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/plugin/handler_socket/libhsclient/string_util.hpp b/plugin/handler_socket/libhsclient/string_util.hpp new file mode 100644 index 00000000..45cc5b00 --- /dev/null +++ b/plugin/handler_socket/libhsclient/string_util.hpp @@ -0,0 +1,53 @@ + +// vim:sw=2:ai + +/* + * Copyright (C) 2010 DeNA Co.,Ltd.. All rights reserved. + * See COPYRIGHT.txt for details. + */ + +#ifndef DENA_STRING_UTIL_HPP +#define DENA_STRING_UTIL_HPP + +#include <string> +#include <string.h> +#include <stdint.h> + +#include "string_buffer.hpp" +#include "string_ref.hpp" + +namespace dena { + +inline const char * +memchr_char(const char *s, int c, size_t n) +{ + return static_cast<const char *>(memchr(s, c, n)); +} + +inline char * +memchr_char(char *s, int c, size_t n) +{ + return static_cast<char *>(memchr(s, c, n)); +} + +string_wref get_token(char *& wp, char *wp_end, char delim); +uint32_t atoi_uint32_nocheck(const char *start, const char *finish); +std::string to_stdstring(uint32_t v); +void append_uint32(string_buffer& buf, uint32_t v); +long long atoll_nocheck(const char *start, const char *finish); + +int errno_string(const char *s, int en, std::string& err_r); + +size_t split(char delim, const string_ref& buf, string_ref *parts, + size_t parts_len); +size_t split(char delim, const string_wref& buf, string_wref *parts, + size_t parts_len); +size_t split(char delim, const string_ref& buf, + std::vector<string_ref>& parts_r); +size_t split(char delim, const string_wref& buf, + std::vector<string_wref>& parts_r); + +}; + +#endif + |