]> rtime.felk.cvut.cz Git - hornmich/skoda-qr-demo.git/blob - QRScanner/mobile/jni/include/mupdf/fitz/string.h
Add MuPDF native source codes
[hornmich/skoda-qr-demo.git] / QRScanner / mobile / jni / include / mupdf / fitz / string.h
1 #ifndef MUPDF_FITZ_STRING_H
2 #define MUPDF_FITZ_STRING_H
3
4 #include "mupdf/fitz/system.h"
5
6 /*
7         Safe string functions
8 */
9
10 /*
11         fz_strsep: Given a pointer to a C string (or a pointer to NULL) break
12         it at the first occurence of a delimiter char (from a given set).
13
14         stringp: Pointer to a C string pointer (or NULL). Updated on exit to
15         point to the first char of the string after the delimiter that was
16         found. The string pointed to by stringp will be corrupted by this
17         call (as the found delimiter will be overwritten by 0).
18
19         delim: A C string of acceptable delimiter characters.
20
21         Returns a pointer to a C string containing the chars of stringp up
22         to the first delimiter char (or the end of the string), or NULL.
23 */
24 char *fz_strsep(char **stringp, const char *delim);
25
26 /*
27         fz_strlcpy: Copy at most n-1 chars of a string into a destination
28         buffer with null termination, returning the real length of the
29         initial string (excluding terminator).
30
31         dst: Destination buffer, at least n bytes long.
32
33         src: C string (non-NULL).
34
35         n: Size of dst buffer in bytes.
36
37         Returns the length (excluding terminator) of src.
38 */
39 int fz_strlcpy(char *dst, const char *src, int n);
40
41 /*
42         fz_strlcat: Concatenate 2 strings, with a maximum length.
43
44         dst: pointer to first string in a buffer of n bytes.
45
46         src: pointer to string to concatenate.
47
48         n: Size (in bytes) of buffer that dst is in.
49
50         Returns the real length that a concatenated dst + src would have been
51         (not including terminator).
52 */
53 int fz_strlcat(char *dst, const char *src, int n);
54
55 /*
56         fz_dirname: extract the directory component from a path.
57 */
58 void fz_dirname(char *dir, const char *path, int dirsize);
59
60 /*
61         fz_cleanname: rewrite path to the shortest string that names the same path.
62
63         Eliminates multiple and trailing slashes, interprets "." and "..".
64         Overwrites the string in place.
65 */
66 char *fz_cleanname(char *name);
67
68 /*
69         fz_chartorune: UTF8 decode a single rune from a sequence of chars.
70
71         rune: Pointer to an int to assign the decoded 'rune' to.
72
73         str: Pointer to a UTF8 encoded string.
74
75         Returns the number of bytes consumed. Does not throw exceptions.
76 */
77 int fz_chartorune(int *rune, const char *str);
78
79 /*
80         fz_runetochar: UTF8 encode a rune to a sequence of chars.
81
82         str: Pointer to a place to put the UTF8 encoded character.
83
84         rune: Pointer to a 'rune'.
85
86         Returns the number of bytes the rune took to output. Does not throw
87         exceptions.
88 */
89 int fz_runetochar(char *str, int rune);
90
91 /*
92         fz_runelen: Count how many chars are required to represent a rune.
93
94         rune: The rune to encode.
95
96         Returns the number of bytes required to represent this run in UTF8.
97 */
98 int fz_runelen(int rune);
99
100 /*
101         fz_strtod: Locale-independent implementation of strtod().
102 */
103 double fz_strtod(const char *s, char **es);
104
105 /*
106         fz_ftoa: Compute decimal integer m, exp such that:
107                 f = m * 10^exp
108                 m is as short as possible without losing exactness
109         Assumes special cases (NaN, +Inf, -Inf) have been handled.
110 */
111 void fz_ftoa(float f, char *s, int *exp, int *neg, int *ns);
112
113 #endif