MPD  0.20.6
UTF8.hxx
Go to the documentation of this file.
1 /*
2  * Copyright (C) 2011-2014 Max Kellermann <max.kellermann@gmail.com>
3  * http://www.musicpd.org
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
9  * - Redistributions of source code must retain the above copyright
10  * notice, this list of conditions and the following disclaimer.
11  *
12  * - Redistributions in binary form must reproduce the above copyright
13  * notice, this list of conditions and the following disclaimer in the
14  * documentation and/or other materials provided with the
15  * distribution.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
20  * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
21  * FOUNDATION OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
22  * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
24  * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
26  * STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
27  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
28  * OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30 
31 #ifndef UTF8_HXX
32 #define UTF8_HXX
33 
34 #include "Compiler.h"
35 
36 #include <stddef.h>
37 
42 bool
43 ValidateUTF8(const char *p);
44 
50 size_t
51 SequenceLengthUTF8(char ch);
52 
58 size_t
59 SequenceLengthUTF8(const char *p);
60 
69 const char *
70 Latin1ToUTF8(const char *src, char *buffer, size_t buffer_size);
71 
79 char *
80 UnicodeToUTF8(unsigned ch, char *buffer);
81 
87 size_t
88 LengthUTF8(const char *p);
89 
90 #endif
#define gcc_nonnull_all
Definition: Compiler.h:122
gcc_const size_t SequenceLengthUTF8(char ch)
#define gcc_const
Definition: Compiler.h:109
gcc_pure gcc_nonnull_all const char * Latin1ToUTF8(const char *src, char *buffer, size_t buffer_size)
Convert the specified string from ISO-8859-1 to UTF-8.
gcc_pure gcc_nonnull_all size_t LengthUTF8(const char *p)
Returns the number of characters in the string.
gcc_pure gcc_nonnull_all bool ValidateUTF8(const char *p)
Is this a valid UTF-8 string?
gcc_nonnull_all char * UnicodeToUTF8(unsigned ch, char *buffer)
Convert the specified Unicode character to UTF-8 and write it to the buffer.
#define gcc_pure
Definition: Compiler.h:116