1
0
mirror of https://github.com/stedolan/jq.git synced 2024-05-11 05:55:39 +00:00

Add jv string utility functions

jv_string_empty()
        -> return an empty string with given allocated length (for fast
           appends)
    jv_string_append_codepoint
        -> append a single codepoint (int) to the given string
    jv_string_explode
        -> return an array of codepoints making up a string
    jv_string_implode
        -> return the UTF-8 encoding of an array of codepoint numbers
This commit is contained in:
Nicolas Williams
2013-11-28 14:48:46 -06:00
parent 1fc5656762
commit 08b4a34a8e
2 changed files with 57 additions and 0 deletions

4
jv.h
View File

@@ -75,14 +75,18 @@ jv jv_array_slice(jv, int, int);
jv jv_string(const char*);
jv jv_string_sized(const char*, int);
jv jv_string_empty(int len);
int jv_string_length_bytes(jv);
int jv_string_length_codepoints(jv);
unsigned long jv_string_hash(jv);
const char* jv_string_value(jv);
jv jv_string_concat(jv, jv);
jv jv_string_fmt(const char*, ...);
jv jv_string_append_codepoint(jv a, int c);
jv jv_string_append_buf(jv a, const char* buf, int len);
jv jv_string_append_str(jv a, const char* str);
jv jv_string_explode(jv j);
jv jv_string_implode(jv j);
jv jv_object();
jv jv_object_get(jv object, jv key);