Mercurial > hgrepos > Python2 > PyMuPDF
comparison mupdf-source/thirdparty/extract/src/astring.h @ 2:b50eed0cc0ef upstream
ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4.
The directory name has changed: no version number in the expanded directory now.
| author | Franz Glasner <fzglas.hg@dom66.de> |
|---|---|
| date | Mon, 15 Sep 2025 11:43:07 +0200 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 1:1d09e1dec1d9 | 2:b50eed0cc0ef |
|---|---|
| 1 #ifndef ARTIFEX_EXTRACT_AUTOSTRING_XML | |
| 2 #define ARTIFEX_EXTRACT_AUTOSTRING_XML | |
| 3 | |
| 4 #include "extract/alloc.h" | |
| 5 | |
| 6 /* Only for internal use by extract code. */ | |
| 7 | |
| 8 /* A simple string struct that reallocs as required. */ | |
| 9 typedef struct | |
| 10 { | |
| 11 char *chars; /* NULL or zero-terminated. */ | |
| 12 size_t chars_num; /* Length of string pointed to by .chars. */ | |
| 13 } extract_astring_t; | |
| 14 | |
| 15 /* Initialises <string> so it is ready for use. */ | |
| 16 void extract_astring_init(extract_astring_t *string); | |
| 17 | |
| 18 /* Frees any existing data and returns with <string> ready for use as if by | |
| 19 extract_astring_init(). */ | |
| 20 void extract_astring_free(extract_alloc_t *alloc, extract_astring_t *string); | |
| 21 | |
| 22 int extract_astring_catl(extract_alloc_t *alloc, extract_astring_t *string, const char *s, size_t s_len); | |
| 23 | |
| 24 int extract_astring_catc(extract_alloc_t *alloc, extract_astring_t *string, char c); | |
| 25 | |
| 26 int extract_astring_cat(extract_alloc_t *alloc, extract_astring_t *string, const char *s); | |
| 27 int extract_astring_catf(extract_alloc_t *alloc, extract_astring_t *string, const char *format, ...); | |
| 28 | |
| 29 /* Removes last <len> chars. */ | |
| 30 int extract_astring_truncate(extract_astring_t *content, int len); | |
| 31 | |
| 32 /* Removes last char if it is <c>. */ | |
| 33 int extract_astring_char_truncate_if(extract_astring_t *content, char c); | |
| 34 | |
| 35 /* Appends specified character using XML escapes as necessary. */ | |
| 36 int extract_astring_cat_xmlc(extract_alloc_t *alloc, extract_astring_t *string, int c); | |
| 37 | |
| 38 /* Appends unicode character <c> to <string>. | |
| 39 xml: | |
| 40 If true, we use XML escape sequences for special characters | |
| 41 such as '<' and unicode values above 127. Otherwise we encode | |
| 42 as utf8. | |
| 43 ascii_ligatures: if true we expand ligatures to "fl", "fi" etc. | |
| 44 ascii_dash: | |
| 45 If true we replace unicode dash characters with '-'. | |
| 46 ascii_apostrophe: | |
| 47 If true we replace unicode apostrophe with ascii single-quote "'". | |
| 48 */ | |
| 49 int extract_astring_catc_unicode(extract_alloc_t *alloc, | |
| 50 extract_astring_t *string, | |
| 51 int c, | |
| 52 int xml, | |
| 53 int ascii_ligatures, | |
| 54 int ascii_dash, | |
| 55 int ascii_apostrophe); | |
| 56 | |
| 57 /* Appends specific unicode character, using XML escape sequences as required. */ | |
| 58 int extract_astring_catc_unicode_xml(extract_alloc_t *alloc, extract_astring_t *string, int c); | |
| 59 | |
| 60 #endif |
