1
2// vim:sw=2:ai
3
4/*
5 * Copyright (C) 2010-2011 DeNA Co.,Ltd.. All rights reserved.
6 * Copyright (C) 2011 Kentoku SHIBA
7 * See COPYRIGHT.txt for details.
8 */
9
10#ifndef DENA_STRING_UTIL_HPP
11#define DENA_STRING_UTIL_HPP
12
13#include "string_buffer.hpp"
14#include "string_ref.hpp"
15
16namespace dena {
17
18inline const char *
19memchr_char(const char *s, int c, size_t n)
20{
21 return static_cast<const char *>(memchr(s, c, n));
22}
23
24inline char *
25memchr_char(char *s, int c, size_t n)
26{
27 return static_cast<char *>(memchr(s, c, n));
28}
29
30string_wref get_token(char *& wp, char *wp_end, char delim);
31uint32 atoi_uint32_nocheck(const char *start, const char *finish);
32/*
33String *to_stdstring(uint32 v);
34*/
35void append_uint32(string_buffer& buf, uint32 v);
36long long atoll_nocheck(const char *start, const char *finish);
37
38int errno_string(const char *s, int en, String& err_r);
39
40size_t split(char delim, const string_ref& buf, string_ref *parts,
41 size_t parts_len);
42size_t split(char delim, const string_wref& buf, string_wref *parts,
43 size_t parts_len);
44size_t split(char delim, const string_ref& buf,
45 DYNAMIC_ARRAY& parts_r);
46size_t split(char delim, const string_wref& buf,
47 DYNAMIC_ARRAY& parts_r);
48};
49
50#endif
51
52