diff options
Diffstat (limited to 'examples/dte/encoding.h')
| -rw-r--r-- | examples/dte/encoding.h | 46 |
1 files changed, 0 insertions, 46 deletions
diff --git a/examples/dte/encoding.h b/examples/dte/encoding.h deleted file mode 100644 index bb4cf67..0000000 --- a/examples/dte/encoding.h +++ /dev/null | |||
| @@ -1,46 +0,0 @@ | |||
| 1 | #ifndef ENCODING_ENCODING_H | ||
| 2 | #define ENCODING_ENCODING_H | ||
| 3 | |||
| 4 | #include <stdbool.h> | ||
| 5 | #include <stddef.h> | ||
| 6 | #include "util/macros.h" | ||
| 7 | |||
| 8 | typedef enum { | ||
| 9 | UTF8, | ||
| 10 | UTF16BE, | ||
| 11 | UTF16LE, | ||
| 12 | UTF32BE, | ||
| 13 | UTF32LE, | ||
| 14 | UNKNOWN_ENCODING, | ||
| 15 | NR_ENCODING_TYPES, | ||
| 16 | |||
| 17 | // This value is used by the "open" command to instruct other | ||
| 18 | // routines that no specific encoding was requested and that | ||
| 19 | // it should be detected instead. It is always replaced by | ||
| 20 | // some other value by the time a file is successfully opened. | ||
| 21 | ENCODING_AUTODETECT | ||
| 22 | } EncodingType; | ||
| 23 | |||
| 24 | typedef struct { | ||
| 25 | EncodingType type; | ||
| 26 | // An interned encoding name compatible with iconv_open(3) | ||
| 27 | const char *name; | ||
| 28 | } Encoding; | ||
| 29 | |||
| 30 | typedef struct { | ||
| 31 | const unsigned char bytes[4]; | ||
| 32 | unsigned int len; | ||
| 33 | } ByteOrderMark; | ||
| 34 | |||
| 35 | static inline bool same_encoding(const Encoding *a, const Encoding *b) | ||
| 36 | { | ||
| 37 | return a->type == b->type && a->name == b->name; | ||
| 38 | } | ||
| 39 | |||
| 40 | Encoding encoding_from_type(EncodingType type); | ||
| 41 | Encoding encoding_from_name(const char *name) NONNULL_ARGS; | ||
| 42 | EncodingType lookup_encoding(const char *name) NONNULL_ARGS; | ||
| 43 | EncodingType detect_encoding_from_bom(const unsigned char *buf, size_t size); | ||
| 44 | const ByteOrderMark *get_bom_for_encoding(EncodingType encoding); | ||
| 45 | |||
| 46 | #endif | ||
