Groonga 3.0.9 Source Code Document
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
string.h
Go to the documentation of this file.
1 /*
2 ** mruby/string.h - String class
3 **
4 ** See Copyright Notice in mruby.h
5 */
6 
7 #ifndef MRUBY_STRING_H
8 #define MRUBY_STRING_H
9 
10 #if defined(__cplusplus)
11 extern "C" {
12 #endif
13 
14 #define IS_EVSTR(p,e) ((p) < (e) && (*(p) == '$' || *(p) == '@' || *(p) == '{'))
15 
16 extern const char mrb_digitmap[];
17 
18 struct RString {
21  union {
24  } aux;
25  char *ptr;
26 };
27 
28 #define mrb_str_ptr(s) ((struct RString*)(mrb_ptr(s)))
29 #define RSTRING(s) ((struct RString*)(mrb_ptr(s)))
30 #define RSTRING_PTR(s) (RSTRING(s)->ptr)
31 #define RSTRING_LEN(s) (RSTRING(s)->len)
32 #define RSTRING_CAPA(s) (RSTRING(s)->aux.capa)
33 #define RSTRING_END(s) (RSTRING(s)->ptr + RSTRING(s)->len)
34 
35 void mrb_gc_free_str(mrb_state*, struct RString*);
36 void mrb_str_modify(mrb_state*, struct RString*);
47 mrb_value mrb_str_buf_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len);
48 
51 int mrb_str_offset(mrb_state *mrb, mrb_value str, int pos);
55 mrb_value mrb_str_to_inum(mrb_state *mrb, mrb_value str, int base, int badcheck);
56 double mrb_str_to_dbl(mrb_state *mrb, mrb_value str, int badcheck);
63 mrb_value mrb_str_cat(mrb_state *mrb, mrb_value str, const char *ptr, size_t len);
65 
66 int mrb_str_cmp(mrb_state *mrb, mrb_value str1, mrb_value str2);
67 char *mrb_str_to_cstr(mrb_state *mrb, mrb_value str);
68 
69 /* For backward compatibility */
70 static inline mrb_value
71 mrb_str_cat2(mrb_state *mrb, mrb_value str, const char *ptr) {
72  return mrb_str_cat_cstr(mrb, str, ptr);
73 }
74 
75 #if defined(__cplusplus)
76 } /* extern "C" { */
77 #endif
78 
79 #endif /* MRUBY_STRING_H */