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
16 namespace dena {
17
18 inline const char *
memchr_char(const char * s,int c,size_t n)19 memchr_char(const char *s, int c, size_t n)
20 {
21 return static_cast<const char *>(memchr(s, c, n));
22 }
23
24 inline char *
memchr_char(char * s,int c,size_t n)25 memchr_char(char *s, int c, size_t n)
26 {
27 return static_cast<char *>(memchr(s, c, n));
28 }
29
30 string_wref get_token(char *& wp, char *wp_end, char delim);
31 uint32 atoi_uint32_nocheck(const char *start, const char *finish);
32 /*
33 String *to_stdstring(uint32 v);
34 */
35 void append_uint32(string_buffer& buf, uint32 v);
36 long long atoll_nocheck(const char *start, const char *finish);
37
38 int errno_string(const char *s, int en, String& err_r);
39
40 size_t split(char delim, const string_ref& buf, string_ref *parts,
41 size_t parts_len);
42 size_t split(char delim, const string_wref& buf, string_wref *parts,
43 size_t parts_len);
44 size_t split(char delim, const string_ref& buf,
45 DYNAMIC_ARRAY& parts_r);
46 size_t split(char delim, const string_wref& buf,
47 DYNAMIC_ARRAY& parts_r);
48 };
49
50 #endif
51
52