From: Jürg Billeter Date: Sat, 15 Jan 2011 17:46:08 +0000 (+0100) Subject: glib-2.0: Add string.valid_char X-Git-Tag: 0.11.4~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=f84f37c39b9b35fd2a2c18e32832b3f4c989c4da;p=thirdparty%2Fvala.git glib-2.0: Add string.valid_char --- diff --git a/vapi/glib-2.0.vapi b/vapi/glib-2.0.vapi index 6c726f7db..c3abf8b38 100644 --- a/vapi/glib-2.0.vapi +++ b/vapi/glib-2.0.vapi @@ -992,6 +992,17 @@ public class string { return ((char*) this)[index]; } + // checks whether valid string character starts at specified index + // embedded NULs are not supported by the string class + public bool valid_char (int index) { + uint8 c = ((uint8*) this)[index]; + if (c == 0x00 || (c >= 0x80 && c < 0xc2) || c >= 0xf5) { + return false; + } else { + return true; + } + } + [CCode (cname = "g_utf8_next_char")] public unowned string next_char (); [CCode (cname = "g_utf8_get_char")]